diff --git a/DKTools.js b/DKTools.js index ac4c88f..5799763 100644 --- a/DKTools.js +++ b/DKTools.js @@ -3,8 +3,8 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 7.0.0 -Release: 29.03.2019 +Version: 8.0.0 +Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English */ @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 7.0.0 -Релиз: 29.03.2019 +Версия: 8.0.0 +Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.7.0.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.0.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,8 +29,8 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 7.0.0 - Release: 29.03.2019 + Version: 8.0.0 + Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English Thank you for your support: https://dk-plugins.ru/donate @@ -49,6 +49,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Instructions ### + ## Parameters ## + + ### 1 ### File system ### + File system modes: + Nwjs + Stamp - Advanced file system mode (all Platforms) + Nwjs - standard file system mode (PC only) + + In the Nwjs + Stamp mode, each time you start a game test, the plugin scans + project files and saves data to the file "data/stamp.json" + + Data can also be updated using the plugin command UpdateFileSystemStamp + + Q. Why do I need Nwjs + Stamp file system mode ? + A. Browsers and old mobile devices do not provide the ability to check for specific files. + in a particular directory, and also do not provide a list of files and directories. + + Q. Which mode should I choose ? + A. Nwjs + Stamp, if your project is designed for all platforms (including browsers and mobile devices). + + ### 1.1 ### Ignored directories ### + Only applicable for Nwjs + Stamp mode. + Ignores specified (and nested) directories when scanning project files. + + ## Functions ## + ### 1 ### Screenshots ### Templates for the filename of the screenshot: %year - Year @@ -77,6 +102,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Checks for plugins updates from DKPlugins DKPluginsCheckUpdates + 2. Update file system stamp + UpdateFileSystemStamp + ### Elements ### DKTools.Utils DKTools.Utils.Object @@ -141,6 +169,24 @@ E-mail: kuznetsovdenis96@gmail.com You can't: -Delete or change any information about the plugin (Title, authorship, contact information, version and release) + * @param Parameters + * @default --------------------------------- + + * @param File System + * @parent Parameters + * @desc File system parameters. Details in the help (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @default --------------------------------- + + * @param Print Detailed Error + * @parent New Functions + * @desc Detailed error display + * @type struct + * @default {"Enabled":"false","Error Message":"Game has encountered a bug. Please report it.","Restart Message":"Press F5 to restart the game."} + * @param Functions * @default --------------------------------- @@ -225,7 +271,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.7.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -233,8 +279,8 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 7.0.0 - Релиз: 29.03.2019 + Версия: 8.0.0 + Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский Спасибо за Вашу поддержку: https://dk-plugins.ru/donate @@ -253,6 +299,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Инструкции ### + ## Параметры ## + + ### 1 ### Файловая система ### + Режимы работы файловой системы: + Nwjs + Stamp - Расширенный режим работы файловой системы (все платформы) + Nwjs - стандартный режим работы файловой системы (только PC) + + В режиме Nwjs + Stamp каждый раз при запуске теста игры плагин сканирует + файлы проекта и сохраняет данные в файл "data/Stamp.json" + + Данные также могут быть обновлены с помощью команды плагина UpdateFileSystemStamp + + Q. Зачем нужен режим работы Nwjs + Stamp ? + A. Браузеры и старые мобильные устройства не предоставляют возможность проверять наличие конкретных файлов + в той или иной директории, а также не предоставляют список файлов и директорий. + + Q. Какой режим выбрать мне ? + A. Nwjs + Stamp, если Ваш проект расчитан на все платформы (включая браузеры и мобильные устройства). + + ### 1.1 ### Игнорируемые директории ### + Применяется только для режима Nwjs + Stamp. + Игнорирует указанные (и вложенные) директории при сканировании файлов проекта. + + ## Функции ## + ### 1 ### Скриншоты ### Шаблоны для названия файла скриншота: %year - Год @@ -281,6 +352,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Проверить обновления плагинов от DKPlugins DKPluginsCheckUpdates + 2. Обновить штамп файловой системы + UpdateFileSystemStamp + ### Элементы ### DKTools.Utils DKTools.Utils.Object @@ -345,6 +419,28 @@ E-mail: kuznetsovdenis96@gmail.com Вы не можете: -Убирать или изменять любую информацию о плагине (Название, авторство, контактная информация, версия и дата релиза) + * @param Parameters + * @text Параметры + * @default --------------------------------- + + * @param File System + * @text Файловая система + * @parent Parameters + * @desc Параметры файловой системы. Подробности в справке (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @text Новые функции + * @default --------------------------------- + + * @param Print Detailed Error + * @text Детальное отображение ошибок + * @parent New Functions + * @desc Детальное отображение ошибок + * @type struct + * @default {"Enabled":"false","Error Message":"В игре обнаружена ошибка. Пожалуйста, сообщите об этом.","Restart Message":"Нажмите F5, чтобы перезапустить игру."} + * @param Functions * @text Функции * @default --------------------------------- @@ -442,6 +538,53 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~FileSystem: + + * @param Mode + * @desc File system mode. Details in the help (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @default --------------------------------- + + * @param Ignored Directories + * @parent Stamp + * @desc Ignored directories. Details in the help (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + +/*~struct~FileSystem:ru + + * @param Mode + * @text Режим работы файловой систмы + * @desc Режим работы файловой системы. Подробности в справке (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @text Штамп файловой системы + * @default --------------------------------- + + * @param Ignored Directories + * @text Игнорируемые директории + * @parent Stamp + * @desc Игнорируемые директории. Подробности в справке (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + /*~struct~CheckUpdates: * @param Enabled @@ -1141,6 +1284,45 @@ E-mail: kuznetsovdenis96@gmail.com * @dir img/system */ + +/*~struct~PrintDetailedError: + + * @param Enabled + * @desc Enable detailed error display ? + * @type boolean + * @default false + + * @param Error Message + * @text Error message + * @desc Error message + * @default Game has encountered a bug. Please report it. + + * @param Restart Message + * @text Game restart message + * @desc Game restart message + * @default Press F5 to restart the game. + +*/ + +/*~struct~PrintDetailedError:ru + + * @param Enabled + * @text Включено + * @desc Включить детальное отображение ошибок ? + * @type boolean + * @default false + + * @param Error Message + * @text Сообщение об ошибке + * @desc Сообщение об ошибке + * @default В игре обнаружена ошибка. Пожалуйста, сообщите об этом. + + * @param Restart Message + * @text Сообщение о перезапуске игры + * @desc Сообщение о перезапуске игры + * @default Нажмите F5, чтобы перезапустить игру. + +*/ 'use strict'; @@ -1153,7 +1335,7 @@ E-mail: kuznetsovdenis96@gmail.com * @type {Object} */ window.Imported = window.Imported || {}; -window.Imported.DKTools = '7.0.0'; +window.Imported.DKTools = '8.0.0'; @@ -1166,141 +1348,141 @@ window.Imported.DKTools = '7.0.0'; /* eslint-disable */ /** - * @version 4.17.10 - * @license Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * @license + * Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE */ ;(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={}; - Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false; - var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true, - Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){ - try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I", - "\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C", - "\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i", - "\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r", - "\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij", - "\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(du(n)&&!of(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(ii.call(n,"__wrapped__"))return $e(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n, - this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!gu(n))return n;if(u=of(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=_o(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(cf(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn), - i=o.get(n))return i;if(o.set(n,f),hf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(lf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Wu:zu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=zu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Yu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ni("Expected a function"); - return yo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&ii.call(n,t)}function zt(n,t){return null!=n&&t in Yu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Vu(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ui(p.length,s), - l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[De(qe(r))],null==r?T:n(r,t,e)}function Ut(n){return du(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ - return du(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return du(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!du(n)&&!du(t))t=n!==n&&t!==t;else n:{var i=of(n),o=of(t),f=i?"[object Array]":_o(n),c=o?"[object Array]":_o(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&cf(n)){if(!cf(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||pf(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ - if(!(1&r)&&(i=a&&ii.call(n,"__wrapped__"),f=o&&ii.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:ii.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[Tu],k(ye())), - n=Gt(n,function(n){return{a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return Ru(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Vu(u);++e=u){for(;e>>1,o=n[i];null!==o&&!ju(o)&&(r?o<=t:ot.length?n:kt(n,hr(t,0,-1)),null==n||delete n[De(qe(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Vu(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=vi?vi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new _i(t).set(new _i(n)), - t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=ju(n),o=t!==T,f=null===t,c=t===t,a=ju(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Yu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:L(f,a), - o-=c.length,or?r?or(t,n):t:(r=or(t,Si(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Vu(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ui(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1], - r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),Le((h?fo:go)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||au(n,ri[r])&&!ii.call(e,r)?t:n}function ae(n,t,r,e,u,i){return gu(n)&&gu(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return bu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new Nn:T; - for(i.set(n,t),i.set(t,n);++cr&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Ne(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Au(r),u=0>r?Li(e+u,0):Ui(u,e-1)),_(n,ye(t,3),u,true)}function Pe(n){return(null==n?0:n.length)?wt(n,1):[]}function Ze(n){ - return n&&n.length?n[0]:T}function qe(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ve(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ke(n){return null==n?n:Ti.call(n)}function Ge(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(su(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function He(t,r){if(!t||!t.length)return[];var e=Ge(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Je(n){return n=An(n),n.__chain__=true,n}function Ye(n,t){ - return t(n)}function Qe(){return this}function Xe(n,t){return(of(n)?r:eo)(n,ye(t,3))}function nu(n,t){return(of(n)?e:uo)(n,ye(t,3))}function tu(n,t){return(of(n)?c:Gt)(n,ye(t,3))}function ru(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function eu(n,t){var r;if(typeof t!="function")throw new ni("Expected a function");return n=Au(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function uu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=uu.placeholder, - n}function iu(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Ko();if(u(n))return o(n);var r,e=yo;r=n-_,n=t-(n-p),r=g?Ui(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Ko(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=yo(i,t),v?e(n):s;if(g)return h=yo(i,t),e(p)}return h===T&&(h=yo(i,t)), - s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ni("Expected a function");return t=ku(t)||0,gu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(ku(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&ao(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Ko())},f}function fu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ni("Expected a function"); - return r.cache=new(fu.Cache||Fn),r}function cu(n){if(typeof n!="function")throw new ni("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function au(n,t){return n===t||n!==n&&t!==t}function lu(n){return null!=n&&vu(n.length)&&!pu(n)}function su(n){return du(n)&&lu(n)}function hu(n){if(!du(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!bu(n); - }function pu(n){return!!gu(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function _u(n){return typeof n=="number"&&n==Au(n)}function vu(n){return typeof n=="number"&&-1=n}function gu(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function du(n){return null!=n&&typeof n=="object"}function yu(n){return typeof n=="number"||du(n)&&"[object Number]"==Ot(n)}function bu(n){return!(!du(n)||"[object Object]"!=Ot(n))&&(n=gi(n), - null===n||(n=ii.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ui.call(n)==ai))}function xu(n){return typeof n=="string"||!of(n)&&du(n)&&"[object String]"==Ot(n)}function ju(n){return typeof n=="symbol"||du(n)&&"[object Symbol]"==Ot(n)}function wu(n){if(!n)return[];if(lu(n))return xu(n)?M(n):Ur(n);if(ji&&n[ji]){n=n[ji]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=_o(n),("[object Map]"==t?W:"[object Set]"==t?U:Lu)(n)}function mu(n){return n?(n=ku(n), - n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Au(n){n=mu(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(Au(n),0,4294967295):0}function ku(n){if(typeof n=="number")return n;if(ju(n))return F;if(gu(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=gu(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Su(n){return Cr(n,Wu(n))}function Ou(n){return null==n?"":yr(n); - }function Iu(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function Ru(n,t){return null!=n&&we(n,t,zt)}function zu(n){return lu(n)?qn(n):Vt(n)}function Wu(n){if(lu(n))n=qn(n,true);else if(gu(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&ii.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Yu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,zu(n)); - }function Uu(n){return Tf(Ou(n).toLowerCase())}function Cu(n){return(n=Ou(n))&&n.replace(xn,Xn).replace(Sn,"")}function Du(n,t,r){return n=Ou(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Mu(n){return function(){return n}}function Tu(n){return n}function $u(n){return qt(typeof n=="function"?n:_t(n,1))}function Fu(n,t,e){var u=zu(t),i=Et(t,u);null!=e||gu(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,zu(t)));var o=!(gu(e)&&"chain"in e&&!e.chain),f=pu(n);return r(i,function(r){ - var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Nu(){}function Pu(n){return Ie(n)?b(De(n)):rr(n)}function Zu(){return[]}function qu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Vu=mn.Array,Ku=mn.Date,Gu=mn.Error,Hu=mn.Function,Ju=mn.Math,Yu=mn.Object,Qu=mn.RegExp,Xu=mn.String,ni=mn.TypeError,ti=Vu.prototype,ri=Yu.prototype,ei=mn["__core-js_shared__"],ui=Hu.prototype.toString,ii=ri.hasOwnProperty,oi=0,fi=function(){ - var n=/[^.]+$/.exec(ei&&ei.keys&&ei.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ci=ri.toString,ai=ui.call(Yu),li=$n._,si=Qu("^"+ui.call(ii).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hi=Pn?mn.Buffer:T,pi=mn.Symbol,_i=mn.Uint8Array,vi=hi?hi.g:T,gi=B(Yu.getPrototypeOf,Yu),di=Yu.create,yi=ri.propertyIsEnumerable,bi=ti.splice,xi=pi?pi.isConcatSpreadable:T,ji=pi?pi.iterator:T,wi=pi?pi.toStringTag:T,mi=function(){try{var n=je(Yu,"defineProperty"); - return n({},"",{}),n}catch(n){}}(),Ai=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Ku&&Ku.now!==$n.Date.now&&Ku.now,ki=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Si=Ju.ceil,Oi=Ju.floor,Ii=Yu.getOwnPropertySymbols,Ri=hi?hi.isBuffer:T,zi=mn.isFinite,Wi=ti.join,Bi=B(Yu.keys,Yu),Li=Ju.max,Ui=Ju.min,Ci=Ku.now,Di=mn.parseInt,Mi=Ju.random,Ti=ti.reverse,$i=je(mn,"DataView"),Fi=je(mn,"Map"),Ni=je(mn,"Promise"),Pi=je(mn,"Set"),Zi=je(mn,"WeakMap"),qi=je(Yu,"create"),Vi=Zi&&new Zi,Ki={},Gi=Me($i),Hi=Me(Fi),Ji=Me(Ni),Yi=Me(Pi),Qi=Me(Zi),Xi=pi?pi.prototype:T,no=Xi?Xi.valueOf:T,to=Xi?Xi.toString:T,ro=function(){ - function n(){}return function(t){return gu(t)?di?di(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=ro(En.prototype),On.prototype.constructor=On,Un.prototype=ro(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=qi?qi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], - this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return qi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):ii.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return qi?t[n]!==T:ii.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=qi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():bi.call(t,n,1), - --this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Fi||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); +}function A(n,t){for(var r=-1,e=Array(n);++r"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,kn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",En=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kn+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Un={}; + Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=true,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=false; + var Bn={};Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object DataView]"]=Bn["[object Boolean]"]=Bn["[object Date]"]=Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object Symbol]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true, + Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object WeakMap]"]=false;var Ln={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){ + try{var n=Nn&&Nn.require&&Nn.require("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e", + "\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a", + "\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I", + "\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r", + "\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ", + "\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Ln)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function kn(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Ln(n){ + this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Lr(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Bn[s])return i?n:{};f=ke(n,s,c)}}if(o||(o=new Zn), + i=o.get(n))return i;if(o.set(n,f),pf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(sf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Uu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function"); + return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,E(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,E(t))),s=Ci(p.length,s), + l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:Et(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Lt(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ + return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)return true;if(null==n||null==t||!yu(n)&&!yu(t))return n!==n&&t!==t;n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ + if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],E(ye())),n=Gt(n,function(n,r,u){return{a:c(t,function(t){return t(n)}), + b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f){e=c;break n}e=c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e=u){for(;e>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:ot.length?n:Et(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length); + }function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Qu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:B(f,a),o-=c.length,or?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Ur(e,r,h[4]):r,i[4]=e?B(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Br(e,r,h[6]):r,i[6]=e?B(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1], + r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),c=t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),Le((h?co:yo)(c,i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t; + var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++cr&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=ku(r),u=0>r?Li(e+u,0):Ci(u,e-1)),_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]; + }function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n; + }function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=ku(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder, + n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)), + s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e), + r.cache=i.set(u,e)||i,e)};return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false; + var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==ku(n)}function gu(n){return typeof n=="number"&&-1=n}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"; + }function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n)}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Lr(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value); + return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?L:Lu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function ku(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(ku(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n; + }function Ou(n){return Cr(n,Uu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:Et(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Uu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){ + return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=kt(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=kt(t,Wu(t))); + var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Lr(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){ + var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.allocUnsafe:T,di=U(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){try{var n=je(Qu,"defineProperty"); + return n({},"",{}),n}catch(n){}}(),ki=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Ui=ri.join,Bi=U(Qu.keys,Qu),Li=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){ + function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=kn.prototype,An.prototype.constructor=An,On.prototype=eo(kn.prototype),On.prototype.constructor=On,Ln.prototype=eo(kn.prototype),Ln.prototype.constructor=Ln,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], + this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1), + --this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); },Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){ - return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Fi||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var eo=Fr(mt),uo=Fr(At,true),io=Nr(),oo=Nr(true),fo=Vi?function(n,t){return Vi.set(n,t),n}:Tu,co=mi?function(n,t){return mi(n,"toString",{configurable:true,enumerable:false,value:Mu(t),writable:true})}:Tu,ao=Ai||function(n){ - return $n.clearTimeout(n)},lo=Pi&&1/U(new Pi([,-0]))[1]==$?function(n){return new Pi(n)}:Nu,so=Vi?function(n){return Vi.get(n)}:Nu,ho=Ii?function(n){return null==n?[]:(n=Yu(n),i(Ii(n),function(t){return yi.call(n,t)}))}:Zu,po=Ii?function(n){for(var t=[];n;)a(t,ho(n)),n=gi(n);return t}:Zu,_o=Ot;($i&&"[object DataView]"!=_o(new $i(new ArrayBuffer(1)))||Fi&&"[object Map]"!=_o(new Fi)||Ni&&"[object Promise]"!=_o(Ni.resolve())||Pi&&"[object Set]"!=_o(new Pi)||Zi&&"[object WeakMap]"!=_o(new Zi))&&(_o=function(n){ - var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Me(n):"")switch(n){case Gi:return"[object DataView]";case Hi:return"[object Map]";case Ji:return"[object Promise]";case Yi:return"[object Set]";case Qi:return"[object WeakMap]"}return t});var vo=ei?pu:qu,go=Ue(fo),yo=ki||function(n,t){return $n.setTimeout(n,t)},bo=Ue(co),xo=function(n){n=fu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ - t.push(e?u.replace(hn,"$1"):r||n)}),t}),jo=fr(function(n,t){return su(n)?yt(n,wt(t,1,su,true)):[]}),wo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),ye(r,2)):[]}),mo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),T,r):[]}),Ao=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=qe(n),r=c(n,Er);return t===qe(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),ko=fr(function(n){var t=qe(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(), - r.length&&r[0]===n[0]?Wt(r,T,t):[]}),So=fr(Ve),Oo=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Io=fr(function(n){return br(wt(n,1,su,true))}),Ro=fr(function(n){var t=qe(n);return su(t)&&(t=T),br(wt(n,1,su,true),ye(t,2))}),zo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return br(wt(n,1,su,true),T,t)}),Wo=fr(function(n,t){return su(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,su))}),Lo=fr(function(n){var t=qe(n);return su(t)&&(t=T), - mr(i(n,su),ye(t,2))}),Uo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return mr(i(n,su),T,t)}),Co=fr(Ge),Do=fr(function(n){var t=n.length,t=1=t}),uf=Ut(function(){return arguments}())?Ut:function(n){return du(n)&&ii.call(n,"callee")&&!yi.call(n,"callee")},of=Vu.isArray,ff=Vn?k(Vn):Ct,cf=Ri||qu,af=Kn?k(Kn):Dt,lf=Gn?k(Gn):Tt,sf=Hn?k(Hn):Nt,hf=Jn?k(Jn):Pt,pf=Yn?k(Yn):Zt,_f=ee(Kt),vf=ee(function(n,t){return n<=t}),gf=$r(function(n,t){ - if(ze(t)||lu(t))Cr(t,zu(t),n);else for(var r in t)ii.call(t,r)&&ot(n,r,t[r])}),df=$r(function(n,t){Cr(t,Wu(t),n)}),yf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),bf=$r(function(n,t,r,e){Cr(t,zu(t),n,e)}),xf=pe(ht),jf=fr(function(n,t){n=Yu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=ru,An.assign=gf,An.assignIn=df,An.assignInWith=yf,An.assignWith=bf,An.at=xf,An.before=eu,An.bind=Go,An.bindAll=Ff,An.bindKey=Ho,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return of(n)?n:[n]},An.chain=Je,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(Au(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Vu(Si(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; - },An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Au(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Au(e),0>e&&(e+=u),e=r>e?0:Eu(e);r>>0,r?(n=Ou(n))&&(typeof t=="string"||null!=t&&!sf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ni("Expected a function");return r=null==r?0:Li(Au(r),0), - fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Au(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), - n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ni("Expected a function");return gu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ou(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Ye,An.toArray=wu,An.toPairs=Rf,An.toPairsIn=zf,An.toPath=function(n){return of(n)?c(n,De):ju(n)?[n]:Ur(xo(Ou(n)))},An.toPlainObject=Su,An.transform=function(n,t,e){var u=of(n),i=u||cf(n)||pf(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:gu(n)&&pu(o)?ro(gi(n)):{}; - }return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return ru(n,1)},An.union=Io,An.unionBy=Ro,An.unionWith=zo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=Ge,An.unzipWith=He,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){ - return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Wu(n))},An.without=Wo,An.words=Du,An.wrap=function(n,t){return Xo(kr(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Uo,An.zip=Co,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Do,An.entries=Rf,An.entriesIn=zf,An.extend=df,An.extendWith=yf,Fu(An,An),An.add=Yf,An.attempt=$f,An.camelCase=Wf,An.capitalize=Uu, - An.ceil=Qf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=ku(r),r=r===r?r:0),t!==T&&(t=ku(t),t=t===t?t:0),pt(ku(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,zu(t))},An.deburr=Cu,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=Xf,An.endsWith=function(n,t,r){ - n=Ou(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Au(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=au,An.escape=function(n){return(n=Ou(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Ou(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=of(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=$o,An.findIndex=Fe,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=Fo,An.findLastIndex=Ne,An.findLastKey=function(n,t){return p(n,ye(t,3),At); - },An.floor=nc,An.forEach=Xe,An.forEachRight=nu,An.forIn=function(n,t){return null==n?n:io(n,ye(t,3),Wu)},An.forInRight=function(n,t){return null==n?n:oo(n,ye(t,3),Wu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Iu,An.gt=rf,An.gte=ef,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=Ru,An.head=Ze,An.identity=Tu,An.includes=function(n,t,r,e){return n=lu(n)?n:Lu(n),r=r&&!e?Au(r):0,e=n.length,0>r&&(r=Li(e+r,0)),xu(n)?r<=e&&-1r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=mu(t),r===T?(r=t,t=0):r=mu(r),n=ku(n),n>=Ui(t,r)&&n=n},An.isSet=hf,An.isString=xu,An.isSymbol=ju,An.isTypedArray=pf,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return du(n)&&"[object WeakMap]"==_o(n)},An.isWeakSet=function(n){return du(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Wi.call(n,t)},An.kebabCase=Bf,An.last=qe,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Au(r),u=0>u?Li(e+u,0):Ui(u,e-1)), - t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Uf,An.lt=_f,An.lte=vf,An.max=function(n){return n&&n.length?xt(n,Tu,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,Tu)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,Tu,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=Zu,An.stubFalse=qu,An.stubObject=function(){return{}},An.stubString=function(){ - return""},An.stubTrue=function(){return true},An.multiply=tc,An.nth=function(n,t){return n&&n.length?Qt(n,Au(t)):T},An.noConflict=function(){return $n._===this&&($n._=li),this},An.noop=Nu,An.now=Ko,An.pad=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Oi(t),r)+n+ne(Si(t),r))},An.padEnd=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Mi(),Ui(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=of(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,eo)},An.reduceRight=function(n,t,r){var e=of(n)?s:j,u=3>arguments.length; - return e(n,ye(t,4),r,u,uo)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Au(t),or(Ou(n),t)},An.replace=function(){var n=arguments,t=Ou(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),sf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Qu(u.source,Ou(_n.exec(u))+"g")), - u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({ - iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter(Tu)},Un.prototype.find=function(n){return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n); - },Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(cu(ye(n)))},Un.prototype.slice=function(n,t){n=Au(n);var r=this;return r.__filtered__&&(0t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Au(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295); - },mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||of(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({ - func:Ye,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ti[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(of(u)?u:[],n)}return this[r](function(r){return t.apply(of(r)?r:[],n)})}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+""; - (Ki[e]||(Ki[e]=[])).push({name:t,func:r})}}),Ki[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n; - },Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=of(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof En;){ - var e=$e(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Ye,args:[Ke],thisArg:T}),new On(n,this.__chain__)):this.thru(Ke)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,ji&&(An.prototype[ji]=Qe), + return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=ki||function(n){ + return $n.clearTimeout(n)},so=Zi&&1/L(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){ + var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ + t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),ko=fr(function(n){var t=c(n,kr);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=Ve(n),r=c(n,kr);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,kr);return(t=typeof t=="function"?t:T)&&r.pop(), + r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Uo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,hu))}),Lo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T), + mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1=t}),of=Lt(function(){return arguments}())?Lt:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?E(Vn):Ct,af=zi||Vu,lf=Kn?E(Kn):Dt,sf=Gn?E(Gn):Tt,hf=Hn?E(Hn):Nt,pf=Jn?E(Jn):Pt,_f=Yn?E(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){ + if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Uu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Uu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(ku(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; + },An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=ku(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:ku(e),0>e&&(e+=u),e=r>e?0:Eu(e);r>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Li(ku(r),0), + fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:ku(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), + n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Lr(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}; + }return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),void 0)),n},An.updateWith=function(n,t,r,e){ + return e=typeof e=="function"?e:T,null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Uu(n))},An.without=Uo,An.words=Mu,An.wrap=function(n,t){return nf(Er(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Uf,An.capitalize=Cu, + An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){ + n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(ku(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At); + },An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Uu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Uu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Lu(n),r=r&&!e?ku(r):0,e=n.length,0>r&&(r=Li(e+r,0)),ju(n)?r<=e&&-1r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Ui.call(n,t)},An.kebabCase=Bf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=ku(r),u=0>u?Li(e+u,0):Ci(u,e-1)), + t===t)n:{for(r=u+1;r--;)if(n[r]===t){n=r;break n}n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){ + return{}},An.stubString=function(){return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,ku(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){ + var e=ff(n)?s:j,u=3>arguments.length;return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:ku(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")), + u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Ln.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Ln.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({ + iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Ln.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ln.prototype[n]=function(){return this.__filtered__?new Ln(this):this[r](1)}}),Ln.prototype.compact=function(){return this.filter($u)},Ln.prototype.find=function(n){return this.filter(n).head()},Ln.prototype.findLast=function(n){return this.reverse().find(n); + },Ln.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Ln(this):this.map(function(r){return Bt(r,n,t)})}),Ln.prototype.reject=function(n){return this.filter(au(ye(n)))},Ln.prototype.slice=function(n,t){n=ku(n);var r=this;return r.__filtered__&&(0t)?new Ln(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=ku(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Ln.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295); + },mt(Ln.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ln,c=o[0],l=f||ff(t),s=function(n){return n=u.apply(An,a([n],o)),e&&h?n[0]:n};l&&r&&typeof c=="function"&&1!=c.length&&(f=l=false);var h=this.__chain__,p=!!this.__actions__.length,c=i&&!h,f=f&&!p;return!i&&l?(t=f?t:new Ln(this),t=n.apply(t,o),t.__actions__.push({ + func:Qe,args:[s],thisArg:T}),new On(t,h)):c&&f?n.apply(this,o):(t=this.thru(s),c?e?t.value()[0]:t.value():t)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)})}}),mt(Ln.prototype,function(n,t){var r=An[t];if(r){var e=r.name+""; + (Gi[e]||(Gi[e]=[])).push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Ln.prototype.clone=function(){var n=new Ln(this.__wrapped__);return n.__actions__=Lr(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Lr(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Lr(this.__views__),n},Ln.prototype.reverse=function(){if(this.__filtered__){var n=new Ln(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n; + },Ln.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=0;for(var o=i,f=this.__views__,c=-1,a=f.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof kn;){ + var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ln?(this.__actions__.length&&(n=new Ln(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,wi&&(An.prototype[wi]=Xe), An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); /* eslint-enable */ @@ -1546,6 +1728,66 @@ DKTools.Utils = class { }); } + // G methods + + /** + * Returns the data for error logging + * + * @since 8.0.0 + * @private + * @static + * + * @see DKTools.Utils.logError + * + * @returns {Object} Data for error logging + */ + static _getErrorLogData() { + const scene = SceneManager._scene; + const data = {}; + + if (scene && scene.constructor.name) { + data['Scene'] = scene.constructor.name; + + if (SceneManager.isCurrentScene(Scene_Map)) { + const interpreter = $gameMap._interpreter; + + if (interpreter) { + if (interpreter._mapId > 0) { + data['Map ID'] = interpreter._mapId; + } + + if (interpreter._eventId > 0) { + data['Event ID'] = interpreter._eventId; + + const event = $gameMap.event(interpreter._eventId); + + if (event) { + data['Event Page'] = event._pageIndex + 1; + } + } + + if (interpreter._list && interpreter._list.length > 0) { + let command = interpreter._list[interpreter._index]; + + if (command && command.code === 0 && interpreter._index > 0) { + command = interpreter._list[interpreter._index - 1]; + } + + if (command && command.code > 0) { + data['Last Event Command'] = command.code; + } + } + + if (interpreter._params && interpreter._params.length > 0) { + data['Params'] = JSON.stringify(interpreter._params); + } + } + } + } + + return data; + } + // H methods /** @@ -1696,7 +1938,7 @@ DKTools.Utils = class { /** * Logs the error to file * - * @version 7.0.0 + * @version 8.0.0 * @since 3.1.0 * @static * @async @@ -1709,6 +1951,8 @@ DKTools.Utils = class { * @param {String} [error.lineNumber] * @param {String} [error.columnNumber] * @param {String} [error.stack] + * + * @see DKTools.Utils._getErrorLogData */ static async logError(error) { if (!error || !this.isNwjs()) { @@ -1751,11 +1995,16 @@ DKTools.Utils = class { } const fileDescriptor = await fs.openSync(filename, 'a'); + const errorData = this._getErrorLogData(); + let data = `Date: ${new Date().toString()}` + os.EOL; + + _.forEach(errorData, (value, key) => { + data += key + ': ' + value + os.EOL; + }); if (error instanceof Object) { - let data = `Date: ${new Date().toString()}` + os.EOL + - `Name: ${error.name}` + os.EOL + - `Message: ${error.message}` + os.EOL; + data += `Name: ${error.name}` + os.EOL; + data += `Message: ${error.message}` + os.EOL; if (error.filename !== undefined) { data += `Filename: ${error.filename}` + os.EOL; @@ -1770,15 +2019,11 @@ DKTools.Utils = class { } data += `Stack: ${error.stack}` + os.EOL + os.EOL; - - await fs.writeSync(fileDescriptor, data); } else { - const data = `Date: ${new Date().toString()}` + os.EOL + - `Error: ${error}` + os.EOL + os.EOL; - - await fs.writeSync(fileDescriptor, data); + data += `Error: ${error}` + os.EOL + os.EOL; } + await fs.writeSync(fileDescriptor, data); await fs.closeSync(fileDescriptor); } @@ -2413,6 +2658,11 @@ DKTools.Utils.Array = class { * DKTools.Utils.Array.contains(array, 3); * => false * + * @example + * var array = null; + * DKTools.Utils.Array.contains(array, 1); + * => false + * * @returns {Boolean} Array contains a given item */ static contains(array, item) { @@ -2429,12 +2679,12 @@ DKTools.Utils.Array = class { * * @example * var array = [1, 1, 2]; - * DKTools.Utils.Array.contains(array, 1); + * DKTools.Utils.Array.count(array, 1); * => 2 * * @example * var array = [1, 1, 2]; - * DKTools.Utils.Array.contains(array, 2); + * DKTools.Utils.Array.count(array, 2); * => 1 * * @returns {Number} Number of item in the array @@ -3624,7 +3874,7 @@ DKTools.Utils.Bitmap = class { * @returns {Promise} Loaded bitmap or null */ static async loadAsync(object, filename, listener, hue, smooth) { - return new Promise(resolve => { + return new Promise((resolve) => { const bitmap = this.load(object, filename, listener, hue, smooth); if (bitmap) { @@ -4024,7 +4274,7 @@ DKTools.Utils.Event = class { */ static getAllComments(event) { if (Number.isFinite(event)) { - event = $gameMap.events()[event]; + event = $gameMap.event(event); } if (!event) { @@ -4071,7 +4321,7 @@ DKTools.Utils.Event = class { */ static getComments(event) { if (Number.isFinite(event)) { - event = $gameMap.events()[event]; + event = $gameMap.event(event); } if (!event || !event.page()) { @@ -4193,6 +4443,7 @@ DKTools.IO = class { // initialize methods /** + * @version 8.0.0 * @static */ static initialize() { @@ -4229,6 +4480,25 @@ DKTools.IO = class { * @type {String} */ this._projectPath = projectPath; + + /** + * @since 8.0.0 + * @private + * @readonly + * @type {Number} + */ + this._mode = DKToolsParam.get('File System', 'Mode'); + + /** + * @since 8.0.0 + * @private + * @readonly + * @type {Object} + */ + this._stamp = {}; + + this._loadStamp(); + this._createStamp(); } // A methods @@ -4236,6 +4506,7 @@ DKTools.IO = class { /** * Returns true if the absolute path exists * + * @version 8.0.0 * @since 3.0.0 * @static * @@ -4246,11 +4517,74 @@ DKTools.IO = class { * @returns {Boolean} Absolute path exists */ static absolutePathExists(path) { - if (!this.isLocalMode()) { - return false; + if (this.isLocalMode()) { + return this._fs.existsSync(path); + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP && path.startsWith(this._projectPath)) { + if (this.isFile(path)) { + return true; + } else if (this.isDirectory(path)) { + return true; + } } - return this._fs.existsSync(path); + return false; + } + + // C methods + + /** + * Creates the file system stamp + * + * @since 8.0.0 + * @private + * @static + */ + static _createStamp() { + if (!DKTools.Utils.isTest() || !this.isLocalMode() || this.mode === DKTools.IO.MODE_NWJS) { + return; + } + + const ignoredDirectories = DKToolsParam.get('File System', 'Ignored Directories') + .map(path => new DKTools.IO.Directory(path)); + const directory = DKTools.IO.getRootDirectory(); + const stamp = this._stamp; + let timeout = null; + + const processDirectory = (directory) => { + if (ignoredDirectories.some(dir => dir.getFullPath() === directory.getFullPath())) { + return; + } + + directory.getAllAsync().then(result => result.data).then((data) => { + data.forEach((entity) => { + entity.getStatsAsync().then(result => result.data).then((stats) => { + const fullPath = entity.getFullPath().substring(1).split('\\'); + + if (entity.isFile()) { + _.set(stamp, fullPath, { __stats__: { ...stats, type: 'file' } }); + } else { + _.set(stamp, fullPath, { __stats__: { ...stats, type: 'directory' } }); + } + + if (timeout) { + clearTimeout(timeout); + } + + timeout = setTimeout(() => { + const file = new DKTools.IO.File('data/Stamp.json'); + + file.saveJsonAsync(stamp, { compress: true }); + }); + }); + + if (entity.isDirectory()) { + processDirectory(entity); + } + }); + }); + }; + + processDirectory(directory); } // G methods @@ -4298,7 +4632,7 @@ DKTools.IO = class { /** * Returns true if the full path is a file * - * @version 3.0.0 + * @version 8.0.0 * @static * * @param {String} fullPath - Path to file @@ -4310,14 +4644,19 @@ DKTools.IO = class { * @returns {Boolean} Full path is a file */ static isFile(fullPath) { - if (!this.isLocalMode()) { - return false; - } + if (this.isLocalMode()) { + const absolutePath = this.getAbsolutePath(fullPath); - const absolutePath = this.getAbsolutePath(fullPath); + if (this.absolutePathExists(absolutePath)) { + return this._fs.lstatSync(absolutePath).isFile(); + } + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.normalizePath(fullPath).split('\\'); + const extension = _.last(parts); - if (this.absolutePathExists(absolutePath)) { - return this._fs.lstatSync(absolutePath).isFile(); + if (extension.includes('.')) { + return _.get(this._stamp, parts.concat('__stats__'), {}).type === 'file'; + } } return false; @@ -4326,7 +4665,7 @@ DKTools.IO = class { /** * Returns true if the full path is a directory * - * @version 3.0.0 + * @version 8.0.0 * @static * * @param {String} fullPath - Path to directory @@ -4338,14 +4677,19 @@ DKTools.IO = class { * @returns {Boolean} Full path is a directory */ static isDirectory(fullPath) { - if (!this.isLocalMode()) { - return false; - } + if (this.isLocalMode()) { + const absolutePath = this.getAbsolutePath(fullPath); - const absolutePath = this.getAbsolutePath(fullPath); + if (this.absolutePathExists(absolutePath)) { + return this._fs.lstatSync(absolutePath).isDirectory(); + } + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.normalizePath(fullPath).split('\\').filter(part => !!part); + const extension = _.last(parts); - if (this.absolutePathExists(absolutePath)) { - return this._fs.lstatSync(absolutePath).isDirectory(); + if (!extension.includes('.')) { + return _.get(this._stamp, parts.concat('__stats__'), {}).type === 'directory'; + } } return false; @@ -4383,6 +4727,31 @@ DKTools.IO = class { return this.normalizePath(joined); } + // L methods + + /** + * Loads the file system stamp + * + * @since 8.0.0 + * @private + * @static + */ + static _loadStamp() { + if (this.isLocalMode() || this.mode === DKTools.IO.MODE_NWJS) { + return; + } + + const file = new DKTools.IO.File('data/Stamp.json'); + + file.loadJson({ + sync: true, + decompress: true, + onSuccess: (result) => { + this._stamp = result.data || this._stamp; + } + }); + } + // N methods /** @@ -4634,6 +5003,36 @@ Object.defineProperties(DKTools.IO, { configurable: true }, + /** + * File system mode + * + * @since 8.0.0 + * @readonly + * @type {Number} + * @memberof DKTools.IO + */ + mode: { + get: function() { + return this._mode; + }, + configurable: true + }, + + /** + * File system stamp + * + * @since 8.0.0 + * @readonly + * @type {Object} + * @memberof DKTools.IO + */ + stamp: { + get: function() { + return this._stamp; + }, + configurable: true + }, + /** * Operation completed successfully * @@ -4738,6 +5137,26 @@ Object.defineProperties(DKTools.IO, { */ ERROR_PARSING_DATA: { value: 10 }, + /** + * Nwjs + Stamp file system mode + * + * @since 8.0.0 + * @constant + * @type {Number} + * @memberof DKTools.IO + */ + MODE_NWJS_STAMP: { value: 0 }, + + /** + * Nwjs file system mode + * + * @since 8.0.0 + * @constant + * @type {Number} + * @memberof DKTools.IO + */ + MODE_NWJS: { value: 1 } + }); @@ -4905,7 +5324,7 @@ DKTools.IO.Entity = class { * DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE * DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE * - * @version 7.0.0 + * @version 8.0.0 * @since 2.0.0 * * @param {Object} object - Options of an operation @@ -4928,7 +5347,7 @@ DKTools.IO.Entity = class { return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; } - if (!DKTools.IO.isLocalMode()) { + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS) { return { data: null, status: DKTools.IO.ERROR_NOT_LOCAL_MODE }; } @@ -4936,6 +5355,13 @@ DKTools.IO.Entity = class { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.getFullPath().split('\\').filter(part => !!part); + const data = _.get(DKTools.IO.stamp, parts.concat('__stats__'), {}); + + return { data, status: DKTools.IO.OK }; + } + const fs = DKTools.IO.fs; const absolutePath = this.getAbsolutePath(); @@ -5454,13 +5880,13 @@ DKTools.IO.File = class extends DKTools.IO.Entity { /** * Returns true if the file exists * - * @version 6.2.1 + * @version 8.0.0 * @override * * @returns {Boolean} File exists */ exists() { - if (DKTools.IO.isLocalMode()) { + if (DKTools.IO.isLocalMode() || DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { if (Decrypter.hasEncryptedAudio && this.isAudio() || Decrypter.hasEncryptedImages && this.isImage()) { const path = DKTools.IO.normalizePath(this.getPath() + '/' + Decrypter.extToEncryptExt(this.getFullName())); @@ -5585,7 +6011,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_DECOMPRESSING_DATA * DKTools.IO.ERROR_PARSING_DATA * - * @version 7.0.0 + * @version 8.0.0 * * @param {Object} object - Options of an operation * @@ -5685,6 +6111,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { }); } } else { + if (DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP && this.getFullName() !== 'Stamp.json' && !this.exists()) { + return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; + } + const xhr = new XMLHttpRequest(); xhr.open('GET', absolutePath, !object.sync); @@ -6993,7 +7423,7 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE * DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE * - * @version 7.0.0 + * @version 8.0.0 * * @param {Object} object - Options of an operation * @@ -7017,7 +7447,7 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; } - if (!DKTools.IO.isLocalMode()) { + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS) { return { data: null, status: DKTools.IO.ERROR_NOT_LOCAL_MODE }; } @@ -7025,9 +7455,6 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } - const fs = DKTools.IO.fs; - const path = this.getFullPath(); - const absolutePath = this.getAbsolutePath(); const processData = (names) => { if (object.template instanceof RegExp) { names = _.filter(names, name => object.template.test(name)); @@ -7050,6 +7477,24 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data, status: DKTools.IO.OK }; }; + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.getFullPath().split('\\'); + const temp = _.get(DKTools.IO.stamp, parts, {}); + const names = Object.keys(temp); + + if (object.sync) { + return processData(names); + } else { + object.onSuccess(processData(names), this); + + return { data: null, status: DKTools.IO.EXPECT_CALLBACK }; + } + } + + const fs = DKTools.IO.fs; + const path = this.getFullPath(); + const absolutePath = this.getAbsolutePath(); + if (object.sync) { try { const names = fs.readdirSync(absolutePath, object.options); @@ -8226,7 +8671,7 @@ DKTools.Network = class { * @returns {Promise} ArrayBuffer */ static async fetchFile(url, options = {}) { - return fetch(url, options).then(response => { + return fetch(url, options).then((response) => { if (response.ok) { return this._toFile(response); } @@ -8256,7 +8701,7 @@ DKTools.Network = class { options.headers.Accept = 'application/json'; - return fetch(url, options).then(response => { + return fetch(url, options).then((response) => { if (response.ok) { return this._toJson(response); } @@ -9453,10 +9898,10 @@ DKTools.PreloadManager = class { return; } - const audioPromises = Promise.all(this._processLoadAudioFiles()); - const imagePromises = Promise.all(this._processLoadImageFiles()); + const audioPromise = Promise.all(this._processLoadAudioFiles()); + const imagePromise = Promise.all(this._processLoadImageFiles()); - Promise.all([audioPromises, imagePromises]).then(() => this._finish()); + Promise.all([audioPromise, imagePromise]).then(() => this._finish()); } }; @@ -10687,11 +11132,18 @@ DKTools.Event = class { /** * Removes the event + * Returns true if the event was removed + * + * @version 8.0.0 + * + * @returns {Boolean} Event was removed */ remove() { if (this.hasTarget()) { - this._target.removeEvent(this); + return this._target.removeEvent(this); } + + return true; } /** @@ -11982,7 +12434,7 @@ DKTools.Animation.Action = class extends DKTools.Event { * * @param {DKTools.Animation} animation - Animation */ - setAnimation (animation) { + setAnimation(animation) { this._animation = animation; } @@ -12139,7 +12591,7 @@ DKTools.OptionManager = class { if (cloneListeners) { _.forEach(this._optionChangeListeners, (listeners, option) => { - _.forEach(listeners, listener => { + _.forEach(listeners, (listener) => { optionManager.addOptionChangeListener(option, listener); }); }); @@ -13998,18 +14450,23 @@ DKTools.Unit.Properties = class extends DKTools.Unit { * @returns {Boolean} Unit has the property */ hasProperty(property) { - return DKTools.Utils.Array.contains(this._getProperties(), property); + const properties = this._getProperties(); + + return properties.includes(property); } /** * Returns true if the unit has the properties * + * @version 8.0.0 * @since 6.3.0 * * @returns {Boolean} Unit has the properties */ hasProperties() { - return DKTools.Utils.isFunction(this._properties) || Array.isArray(this._properties) && this._properties.length > 0; + const properties = this._getProperties(); + + return properties.length > 0; } /** @@ -14750,40 +15207,6 @@ DKTools.Base = class { return this.hasBitmap(); } - /** - * Converts the X of the canvas to the local X - * - * @param {Number} x - The X of the canvas - * @returns {Number} Local X - */ - canvasToLocalX(x) { - let node = this; - - while (node) { - x -= node.x; - node = node.parent; - } - - return x; - } - - /** - * Converts the Y of the canvas to the local Y - * - * @param {Number} y - The Y of the canvas - * @returns {Number} Local Y - */ - canvasToLocalY(y) { - let node = this; - - while (node) { - y -= node.y; - node = node.parent; - } - - return y; - } - /** * Checks all * @@ -14936,7 +15359,7 @@ DKTools.Base = class { const clone = new (this.constructor)(this); if (options.cloneTexts) { - _.forEach(this._texts, textObj => { + _.forEach(this._texts, (textObj) => { clone.addText(textObj.text, { ...textObj.options }); }); } @@ -15018,6 +15441,20 @@ DKTools.Base = class { } } + /** + * Destroys the object + * + * @since 8.0.0 + * + * @param {Object} [options] - Destroy options + */ + destroy(options = {}) { + this._clearAll(); + + this.clearEvents(); + this.hide(); + } + /** * Turns off the option * @@ -16355,6 +16792,8 @@ DKTools.Base = class { /** * Returns a rectangle of the line * + * @version 8.0.0 + * * @param {Number | String} line - Line number * * @see DKTools.Base.prototype.getLineHeight @@ -16364,18 +16803,42 @@ DKTools.Base = class { getLineRect(line) { const lineHeight = this.getLineHeight(); - return new Rectangle(0, lineHeight * parseInt(line), this.realWidth, lineHeight); + return new Rectangle(0, lineHeight * parseInt(line), this.width, lineHeight); } /** * Returns the maximum of lines * + * @version 8.0.0 + * * @see DKTools.Base.prototype.getLineHeight * * @returns {Number} Maximum of lines */ getLines() { - return this.realHeight / this.getLineHeight(); + return this.height / this.getLineHeight(); + } + + /** + * Returns the local point (coordinates inside the object) + * + * @since 8.0.0 + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number} [y] - The Y coordinate (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number} [object.y] - The Y coordinate + * + * @see DKTools.Utils.Point.toPoint + * @see PIXI.Matrix.applyInverse + * + * @returns {PIXI.Point} Local point (coordinates inside the object) + */ + getLocalPoint(object, y) { + const point = DKTools.Utils.Point.toPoint(object, y); + + return this.worldTransform.applyInverse(point); } /** @@ -16408,6 +16871,7 @@ DKTools.Base = class { /** * Returns the real center of the object (not including scaling) * + * @deprecated 8.0.0 * @since 5.0.0 * * @see DKTools.Base.prototype.getRealSize @@ -16438,10 +16902,12 @@ DKTools.Base = class { /** * Returns the real size of the object (not including scaling) * + * @deprecated 8.0.0 + * * @returns {{ width: Number, height: Number }} Real size of the object (not including scaling) */ getRealSize() { - return { width: this.realWidth, height: this.realHeight }; + return { width: this.width, height: this.height }; } /** @@ -16885,6 +17351,17 @@ DKTools.Base = class { return this instanceof DKTools.Sprite.Cursor; } + /** + * Returns true if the object was destroyed + * + * @since 8.0.0 + * + * @returns {Boolean} Object was destroyed + */ + isDestroyed() { + return this._destroyed; + } + /** * Checks the events for pause * Returns the conjunction of pauses of the events @@ -16904,13 +17381,37 @@ DKTools.Base = class { /** * Returns true if the coordinates is inside the object * + * @version 8.0.0 + * * @param {Number} x - The X coordinate * @param {Number} y - The Y coordinate * + * @see DKTools.Base.prototype.getLocalPoint + * * @returns {Boolean} Coordinates is inside the object */ isInside(x, y) { - return false; + const point = this.getLocalPoint(x, y); + const frame = new Rectangle(0, 0, this.width, this.height); + const mask = this.mask; + + if (mask && DKTools.Utils.isFunction(mask.containsPoint)) { + if (!mask.containsPoint(point)) { + return false; + } + } + + if (!frame.contains(point.x, point.y)) { + return false; + } + + const area = this.hitArea; + + if (!area) { + return true; + } + + return area.contains(point.x, point.y); } /** @@ -17225,36 +17726,6 @@ DKTools.Base = class { this.position.copy(point); } - /** - * Moves the object (taking into account the anchor) - * - * @since 5.0.0 - * - * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters - * @param {Number | String} [y] - The Y coordinate or line number (String) (if object is Number) - * - * @param {Number} [object.x] - The X coordinate - * @param {Number | String} [object.y] - The Y coordinate or line number (String) - * - * @see DKTools.Base.prototype.getRealSize - * @see DKTools.Base.prototype.move - */ - moveWithAnchor(object, y) { - if (object instanceof Object) { - y = object.y; - } - - if (DKTools.Utils.isString(y)) { // line number - y = this.getLineHeight() * parseFloat(y); - } - - const point = DKTools.Utils.Point.toPoint(object, y); - const size = this.getRealSize(); - const anchor = this.anchor; - - this.move(point.x + anchor.x * size.width, point.y + anchor.y * size.height); - } - // O methods /** @@ -17383,6 +17854,7 @@ DKTools.Base = class { } this.updateMouseOutsideEvents(); + this._clearMouseEnterTime(); } } else { @@ -17658,34 +18130,38 @@ DKTools.Base = class { } /** - * Returns the standard height of the drawing + * Returns the standard width of the drawing * - * @returns {Number | null} Standard height of the drawing or null + * @version 8.0.0 + * + * @returns {Number | null} Standard width of the drawing or null */ - standardDrawingHeight() { + standardDrawingWidth() { if (this.hasBitmap()) { - return this.bitmap.height; + return this.bitmap.width; } else if (this.isSprite()) { - return this._bitmapHeight; + return this._bitmapWidth; } else if (this.isWindow()) { - return this.realHeight; + return this.width; } return null; } /** - * Returns the standard width of the drawing + * Returns the standard height of the drawing * - * @returns {Number | null} Standard width of the drawing or null + * @version 8.0.0 + * + * @returns {Number | null} Standard height of the drawing or null */ - standardDrawingWidth() { + standardDrawingHeight() { if (this.hasBitmap()) { - return this.bitmap.width; + return this.bitmap.height; } else if (this.isSprite()) { - return this._bitmapWidth; + return this._bitmapHeight; } else if (this.isWindow()) { - return this.realWidth; + return this.height; } return null; @@ -18928,13 +19404,16 @@ Object.defineProperties(DKTools.Base.prototype, { /** * The X coordinate of mouse inside the object * + * @deprecated 8.0.0 + * @version 8.0.0 + * * @readonly * @type {Number} * @memberof DKTools.Base.prototype */ mouseX : { get: function() { - return this.canvasToLocalX(TouchInput.mouseX); + return this.mouse.x; }, configurable: true }, @@ -18942,13 +19421,32 @@ Object.defineProperties(DKTools.Base.prototype, { /** * The Y coordinate of mouse inside the object * + * @deprecated 8.0.0 + * @version 8.0.0 + * * @readonly * @type {Number} * @memberof DKTools.Base.prototype */ mouseY : { get: function() { - return this.canvasToLocalY(TouchInput.mouseY); + return this.mouse.y; + }, + configurable: true + }, + + /** + * The coordinates of mouse inside the object + * + * @since 8.0.0 + * + * @readonly + * @type {Number} + * @memberof DKTools.Base.prototype + */ + mouse: { + get: function() { + return this.getLocalPoint(TouchInput.mouseX, TouchInput.mouseY); }, configurable: true }, @@ -19060,69 +19558,95 @@ Object.defineProperties(DKTools.Sprite.prototype, { }, /** - * Real width of the sprite (not including scaling) + * Real width of the sprite + * + * @deprecated 8.0.0 + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ realWidth: { get: function() { - return this._frame.width; + return this.width; }, set: function(value) { - this._frame.width = value; - - this._refresh(); + this.width = value; }, configurable: true }, /** - * Real height of the sprite (not including scaling) + * Real height of the sprite + * + * @deprecated 8.0.0 + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ realHeight: { get: function() { - return this._frame.height; + return this.height; }, set: function(value) { - this._frame.height = value; - - this._refresh(); + this.height = value; }, configurable: true }, /** - * Width of the sprite (taking into account the scaling) + * Width of the sprite + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ width: { get: function() { - return this.realWidth * this.scale.x; + return this._frame.width; }, set: function(value) { - this.realWidth = Math.floor(value / this.scale.x); + this._frame.width = value; + + this._refresh(); }, configurable: true }, /** - * Height of the sprite (taking into account the scaling) + * Height of the sprite + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ height: { get: function() { - return this.realHeight * this.scale.y; + return this._frame.height; }, set: function(value) { - this.realHeight = Math.floor(value / this.scale.y); + this._frame.height = value; + + this._refresh(); + }, + configurable: true + }, + + /** + * The coordinates of mouse inside the object + * + * @since 8.0.0 + * + * @readonly + * @type {Number} + * @memberof DKTools.Base.prototype + */ + mouse: { + get: function() { + return this.getLocalPoint(TouchInput.mouseX, TouchInput.mouseY); }, configurable: true }, @@ -19637,6 +20161,23 @@ DKTools.Sprite.prototype.createMask = function(maskShape) { // D methods +/** + * Destroys the sprite + * + * @version 8.0.0 + * + * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see DKTools.Base.prototype.destroy + * @see Sprite.prototype.destroy + */ +DKTools.Sprite.prototype.destroy = function(options) { + DKTools.Base.prototype.destroy.call(this, options); + Sprite.prototype.destroy.call(this, options); +}; + /** * Draws all * @@ -19657,7 +20198,7 @@ DKTools.Sprite.prototype.drawAll = function() { * Draws all texts */ DKTools.Sprite.prototype.drawAllTexts = function() { - _.forEach(this._texts, text => { + _.forEach(this._texts, (text) => { this[text.type](text.text, text.options); }); }; @@ -19831,6 +20372,33 @@ DKTools.Sprite.prototype.getCurrentOpacity = function() { return this.alpha * 255; }; +/** + * Returns the local point (coordinates inside the sprite) + * + * @since 8.0.0 + * + * @override + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number} [y] - The Y coordinate (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number} [object.y] - The Y coordinate + * + * @see DKTools.Base.prototype.getLocalPoint + * + * @returns {PIXI.Point} Local point (coordinates inside the sprite) + */ +DKTools.Sprite.prototype.getLocalPoint = function(object, y) { + const localPoint = DKTools.Base.prototype.getLocalPoint.call(this, object, y); + const anchor = this.anchor; + + localPoint.x += this.width * anchor.x; + localPoint.y += this.height * anchor.y; + + return localPoint; +}; + // H methods /** @@ -19881,30 +20449,6 @@ DKTools.Sprite.prototype.hasTexts = function() { // I methods -/** - * Returns true if the coordinates is inside the sprite - * - * @override - * - * @param {Number} x - The X coordinate - * @param {Number} y - The Y coordinate - * - * @see DKTools.Sprite.prototype.canvasToLocalX - * @see DKTools.Sprite.prototype.canvasToLocalY - * - * @returns {Boolean} Coordinates is inside the sprite - */ -DKTools.Sprite.prototype.isInside = function(x, y) { - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); - const width = this.width; - const height = this.height; - const anchor = this.anchor; - const frame = new Rectangle(-width * anchor.x, -height * anchor.y, width, height); - - return frame.contains(localX, localY); -}; - /** * Returns true if you can change the size of the sprite * @@ -20392,6 +20936,36 @@ DKTools.Sprite.prototype.loadWindowskin = function(object, listener, hue, smooth return this.loadSystem(object || this.standardWindowskin(), listener, hue, smooth); }; +// M methods + +/** + * Moves the sprite (taking into account the anchor) + * + * @since 5.0.0 + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number | String} [y] - The Y coordinate or line number (String) (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number | String} [object.y] - The Y coordinate or line number (String) + * + * @see DKTools.Base.prototype.move + */ +DKTools.Sprite.prototype.moveWithAnchor = function(object, y) { + if (object instanceof Object) { + y = object.y; + } + + if (DKTools.Utils.isString(y)) { // line number + y = this.getLineHeight() * parseFloat(y); + } + + const point = DKTools.Utils.Point.toPoint(object, y); + const anchor = this.anchor; + + this.move(point.x + this.width * anchor.x, point.y + this.height * anchor.y); +}; + // S methods /** @@ -20468,11 +21042,11 @@ DKTools.Sprite.prototype.standardFontSize = function() { /** * Returns the standard frame * - * @version 3.1.0 + * @version 8.0.0 * @returns {Rectangle} Standard frame */ DKTools.Sprite.prototype.standardFrame = function() { - return new Rectangle(0, 0, this.realWidth, this.realHeight); + return new Rectangle(0, 0, this.width, this.height); }; /** @@ -22727,34 +23301,6 @@ Object.defineProperties(DKTools.Sprite.Button.prototype, { return this._mousePressTime; }, configurable: true - }, - - /** - * The X coordinate of press inside the sprite - * - * @readonly - * @type {Number} - * @memberof DKTools.Sprite.Button.prototype - */ - pressX : { - get: function() { - return this.canvasToLocalX(TouchInput.x); - }, - configurable: true - }, - - /** - * The Y coordinate of press inside the sprite - * - * @readonly - * @type {Number} - * @memberof DKTools.Sprite.Button.prototype - */ - pressY : { - get: function() { - return this.canvasToLocalY(TouchInput.y); - }, - configurable: true } }); @@ -22852,6 +23398,8 @@ DKTools.Sprite.Cursor = class extends DKTools.Sprite { /** * Updates the cursor * + * @version 8.0.0 + * * @see DKTools.Sprite.Cursor.prototype.move * @see DKTools.Sprite.Cursor.prototype.setupBitmap */ @@ -22864,8 +23412,8 @@ DKTools.Sprite.Cursor = class extends DKTools.Sprite { const m = 4; const ox = 0; const oy = 0; - const w2 = Math.min(w, parent.realWidth - x); - const h2 = Math.min(h, parent.realHeight - y); + const w2 = Math.min(w, parent.width - x); + const h2 = Math.min(h, parent.height - y); this.move(x, y); @@ -24534,6 +25082,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Returns the maximum page rows * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.getItemHeight * @see DKTools.Sprite.Selectable.prototype.getMaxRows * @@ -24541,21 +25091,21 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { */ getMaxPageRows() { const spacing = this._verticalSpacing; - const realHeight = this.realHeight; const itemHeight = this.getItemHeight(); const maxRows = this.getMaxRows(); - let rows = 0, height = 0; + let height = this.height; + let rows = 0; for (; rows < maxRows; rows++) { if (rows === maxRows - 1) { - if (height + itemHeight > realHeight) { + if (height - itemHeight < 0) { break; } - } else if (height + itemHeight + spacing > realHeight) { + } else if (height - itemHeight - spacing < 0) { break; } - height += itemHeight + spacing; + height -= itemHeight + spacing; } return rows; @@ -24946,12 +25496,13 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { } /** + * @version 8.0.0 + * * @param {Number} x - The X coordinate * @param {Number} y - The Y coordinate * * @see DKTools.Sprite.Selectable.prototype.isOutside - * @see DKTools.Sprite.Selectable.prototype.canvasToLocalX - * @see DKTools.Sprite.Selectable.prototype.canvasToLocalY + * @see DKTools.Sprite.Selectable.prototype.getLocalPoint * @see DKTools.Sprite.Selectable.prototype.getMaxPageItems * @see DKTools.Sprite.Selectable.prototype.getMaxItems * @see DKTools.Sprite.Selectable.prototype.getTopIndex @@ -24965,8 +25516,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { } const scale = this.scale; - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); + const localPoint = this.getLocalPoint(x, y); const maxPageItems = this.getMaxPageItems(); const maxItems = this.getMaxItems(); let index = this.getTopIndex(); @@ -24979,7 +25529,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { rect.width *= scale.x; rect.height *= scale.y; - if (rect.contains(localX, localY)) { + if (rect.contains(localPoint.x, localPoint.y)) { return index; } } @@ -25441,6 +25991,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Processes the hover of the mouse * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.isOptionEnabled * @see DKTools.Sprite.Selectable.prototype.isCursorMovable * @see DKTools.Sprite.Selectable.prototype.hitTest @@ -25448,7 +26000,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { * @see DKTools.Sprite.Selectable.prototype.playCursorSound */ processMouseHover() { - if (this.isOptionEnabled('process-mouse-hover') && this.isCursorMovable()) { + if (this.isOptionEnabled('process-mouse-hover') && this.isCursorMovable() && TouchInput.date > Input.date) { const lastIndex = this._index; const x = TouchInput.mouseX; const y = TouchInput.mouseY; @@ -26047,10 +26599,11 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Returns the standard item width * + * @version 8.0.0 * @returns {Function} Standard item width */ standardItemWidth() { - return () => Math.floor((this.realWidth + this._horizontalSpacing) / this.getMaxCols() - this._horizontalSpacing); + return () => Math.floor((this.width + this._horizontalSpacing) / this.getMaxCols() - this._horizontalSpacing); } /** @@ -27824,6 +28377,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Updates the cursor * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.isHorizontal * @see DKTools.Sprite.Selectable.prototype.isCursorAll * @see DKTools.Sprite.Selectable.prototype.isCursorVisible @@ -27865,7 +28420,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { if (this.isCursorAll()) { const allRowsHeight = this.getMaxRows() * this.getItemHeight(); - this.setCursorRect(0, 0, this.realWidth, allRowsHeight); + this.setCursorRect(0, 0, this.width, allRowsHeight); this.resetScroll(); } else if (this.isCursorVisible() || !this._cursorSprite.hasBitmap()) { const rect = this.getItemRect(this._index); @@ -29271,7 +29826,7 @@ DKTools.Sprite.ProgressBar.Rectangle = class extends DKTools.Sprite.ProgressBar const percents = this.getPercents(); const text = `${percents}%`; - this.drawText(text, { height: this.realHeight }); + this.drawText(text, { height: this.height }); }; } @@ -29448,14 +30003,16 @@ DKTools.Sprite.ProgressBar.Circle = class extends DKTools.Sprite.ProgressBar { /** * Returns the standard handler of draw of the graphic * + * @version 8.0.0 + * * @override + * * @returns {Function} Standard handler of draw of the graphic */ standardDrawGraphicHandler() { return () => { const lineWidth = this._lineWidth; - const realWidth = this.realWidth; - const radius = (realWidth - lineWidth) / 2; + const radius = (this.width - lineWidth) / 2; const x = radius + lineWidth / 2; const y = x; @@ -29488,7 +30045,7 @@ DKTools.Sprite.ProgressBar.Circle = class extends DKTools.Sprite.ProgressBar { const percents = this.getPercents(); const text = `${percents}%`; - this.drawText(text, { height: this.realHeight }); + this.drawText(text, { height: this.height }); }; } @@ -29548,16 +30105,18 @@ DKTools.Sprite.ProgressBar.SemiCircle = class extends DKTools.Sprite.ProgressBar /** * Returns the standard handler of draw of the graphic * + * @version 8.0.0 + * * @override + * * @returns {Function} Standard handler of draw of the graphic */ standardDrawGraphicHandler() { return () => { const lineWidth = this._lineWidth; - const realWidth = this.realWidth; - const radius = (realWidth - lineWidth) / 2; + const radius = (this.width - lineWidth) / 2; const x = radius + lineWidth / 2; - const y = this.realHeight; + const y = this.height; this.strokeArc({ x, y, @@ -32005,55 +32564,57 @@ DKTools.Window.prototype.constructor = DKTools.Window; Object.defineProperties(DKTools.Window.prototype, { /** - * Real width of the window (not including scaling) + * Real width of the window + * + * @deprecated 8.0.0 + * @version 8.0.0 * - * @readonly * @type {Number} * @memberof DKTools.Window.prototype */ realWidth: { get: function() { - return this._width; + return this.width; }, set: function(value) { - this._width = value; - - this._refreshAllParts(); + this.width = value; }, configurable: true }, /** - * Real height of the window (not including scaling) + * Real height of the window + * + * @deprecated 8.0.0 + * @version 8.0.0 * - * @readonly * @type {Number} * @memberof DKTools.Window.prototype */ realHeight: { get: function() { - return this._height; + return this.height; }, set: function(value) { - this._height = value; - - this._refreshAllParts(); + this.height = value; }, configurable: true }, /** - * Width of the window (taking into account scaling) + * Width of the window + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Window.prototype */ width: { get: function() { - return this.realWidth * this.scale.x; + return this._width; }, set: function(value) { - this._width = Math.floor(value / this.scale.x); + this._width = value; this._refreshAllParts(); }, @@ -32061,17 +32622,19 @@ Object.defineProperties(DKTools.Window.prototype, { }, /** - * Height of the window (taking into account scaling) + * Height of the window + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Window.prototype */ height: { get: function() { - return this.realHeight * this.scale.y; + return this._height; }, set: function(value) { - this._height = Math.floor(value / this.scale.y); + this._height = value; this._refreshAllParts(); }, @@ -32931,6 +33494,23 @@ DKTools.Window.prototype.deactivate = function() { } }; +/** + * Destroys the window + * + * @version 8.0.0 + * + * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see DKTools.Base.prototype.destroy + * @see Window_Base.prototype.destroy + */ +DKTools.Window.prototype.destroy = function(options) { + DKTools.Base.prototype.destroy.call(this, options); + Window_Base.prototype.destroy.call(this, options); +}; + /** * Draws the text * Returns true if successfully completed @@ -33236,24 +33816,6 @@ DKTools.Window.prototype.isOpenAndActive = function() { return this.isOpen() && this.isActive(); }; -/** - * Returns true if the coordinates is inside the window - * - * @override - * - * @param {Number} x - The X coordinate - * @param {Number} y - The Y coordinate - * - * @returns {Boolean} Coordinates is inside the window - */ -DKTools.Window.prototype.isInside = function(x, y) { - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); - const frame = new Rectangle(0, 0, this.width, this.height); - - return frame.contains(localX, localY); -}; - // N methods /** @@ -34060,17 +34622,21 @@ DKTools.Window.prototype.setupAll = function(object = {}) { /** * Sets the width of the window * + * @version 8.0.0 + * * @param {Number} [width] - Width of the window * * @see DKTools.Window.prototype._checkWidth */ DKTools.Window.prototype.setupWidth = function(width) { - this.realWidth = this._checkWidth(width); + this.width = this._checkWidth(width); }; /** * Sets the height of the window * + * @version 8.0.0 + * * @param {Number | String} [height] - Height of the window of number of lines (String) * * @see DKTools.Window.prototype._checkHeight @@ -34080,7 +34646,7 @@ DKTools.Window.prototype.setupHeight = function(height) { height = this.getLineHeight() * parseFloat(height); } - this.realHeight = this._checkHeight(height); + this.height = this._checkHeight(height); }; /** @@ -35093,10 +35659,103 @@ DKTools.Scene.prototype.initialize = function() { this._createAll(); this._setupAll(); this._addAllChildren(); + Scene_Base.prototype.initialize.call(this); }; -// _clear methods +// A methods + +/** + * Adds children objects to processing + * + * @private + */ +DKTools.Scene.prototype._addAllChildren = function() { + // to be overridden by plugins +}; + +/** + * Adds a listener of change of the option + * + * @since 2.0.0 + * + * @param {String} option - Name of the option + * @param {Function} listener - Listener + * + * @see DKTools.OptionManager.prototype.addOptionChangeListener + */ +DKTools.Scene.prototype.addOptionChangeListener = function(option, listener) { + this._optionManager.addOptionChangeListener(option, listener); +}; + +/** + * Adds the event + * + * @since 2.0.0 + * + * @param {DKTools.Event | Object} object - Event or object with parameters for the event + * + * @param {String} [object.type] - Type of the event + * @param {Number} [object.repeatTime] - Time of one repeat + * @param {Number} [object.repeats] - Amount of repeats + * @param {Number} [object.remainingPauseTime] - Remaining time of pause + * @param {Function} [object.onStart] - Handler of the event start + * @param {Function} [object.onUpdate] - Handler of the event update + * @param {Function} [object.onPause] - Handler of the event pause + * @param {Function} [object.onReset] - Handler of the event reset + * @param {Function} [object.onRepeat] - Handler of the event repeat + * @param {Function} [object.onSuccess] - Handler of the event success + * @param {Function} [object.onFail] - Handler of the event fail + * + * @see DKTools.Event + * @see DKTools.EventManager.prototype.addEvent + * + * @returns {DKTools.Event} Added event + */ +DKTools.Scene.prototype.addEvent = function(object) { + return this._eventManager.addEvent(object); +}; + +/** + * Adds the one time event + * + * @since 2.0.0 + * + * @param {DKTools.Event | Object} object - Event or object with parameters for the event + * + * @param {String} [object.type] - Type of the event + * @param {Number} [object.remainingPauseTime] - Remaining time of pause + * @param {Function} [object.onStart] - Handler of the event start + * @param {Function} [object.onUpdate] - Handler of the event update + * @param {Function} [object.onPause] - Handler of the event pause + * @param {Function} [object.onReset] - Handler of the event reset + * @param {Function} [object.onRepeat] - Handler of the event repeat + * @param {Function} [object.onSuccess] - Handler of the event success + * @param {Function} [object.onFail] - Handler of the event fail + * + * @see DKTools.Event + * @see DKTools.EventManager.prototype.addOneTimeEvent + * + * @returns {DKTools.Event} Added event + */ +DKTools.Scene.prototype.addOneTimeEvent = function(object) { + return this._eventManager.addOneTimeEvent(object); +}; + +/** + * Adds the animation + * + * @since 2.0.0 + * + * @param {DKTools.Animation} animation - Animation to add + * + * @see DKTools.EventManager.addAnimation + */ +DKTools.Scene.prototype.addAnimation = function(animation) { + this._eventManager.addAnimation(animation); +}; + +// C methods /** * Clears all data @@ -35107,8 +35766,6 @@ DKTools.Scene.prototype._clearAll = function() { // to be overridden by plugins }; -// _create methods - /** * Creates all * @@ -35155,67 +35812,30 @@ DKTools.Scene.prototype._createEventManager = function() { this._eventManager = new DKTools.EventManager(this); }; -// _setup methods - /** - * Sets all data - * - * @version 2.0.0 - * @private - * - * @see DKTools.Scene.prototype._setupOptions - * @see DKTools.Scene.prototype._setupEvents - * @see DKTools.Scene.prototype._setupAnimations - */ -DKTools.Scene.prototype._setupAll = function() { - this._setupOptions(); - this._setupEvents(); - this._setupAnimations(); -}; - -/** - * Sets the options + * Clears the options * * @since 2.0.0 - * @private - */ -DKTools.Scene.prototype._setupOptions = function() { - // to be overridden by plugins -}; - -/** - * Sets the events * - * @since 2.0.0 - * @private + * @see DKTools.OptionManager.prototype.clear */ -DKTools.Scene.prototype._setupEvents = function() { - // to be overridden by plugins +DKTools.Scene.prototype.clearOptions = function() { + this._optionManager.clear(); }; /** - * Sets the animations + * Clears the events * - * @since 2.0.0 - * @private - */ -DKTools.Scene.prototype._setupAnimations = function() { - // to be overridden by plugins -}; - -// _add methods - -/** - * Adds children objects to processing + * @version 2.0.0 * - * @private + * @param {String[] | String} object Array with event types or event type + * + * @see DKTools.EventManager.prototype.clearEvents */ -DKTools.Scene.prototype._addAllChildren = function() { - // to be overridden by plugins +DKTools.Scene.prototype.clearEvents = function(object) { + this._eventManager.clearEvents(object); }; -// create methods - /** * Creates all * @@ -35230,11 +35850,11 @@ DKTools.Scene.prototype._addAllChildren = function() { */ DKTools.Scene.prototype.create = function() { Scene_Base.prototype.create.call(this); - this.createBackground(); - this.createAllSprites(); - this.createWindowLayer(); - this.createAllWindows(); - this.createForeground(); + this.createBackground(); + this.createAllSprites(); + this.createWindowLayer(); + this.createAllWindows(); + this.createForeground(); }; /** @@ -35265,129 +35885,285 @@ DKTools.Scene.prototype.createForeground = function() { // to be overridden by plugins }; -// start methods +// D methods /** - * Starts the scene + * Destroys the scene + * + * @version 8.0.0 * * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see Stage.prototype.destroy */ -DKTools.Scene.prototype.start = function() { - Scene_Base.prototype.start.call(this); - this.startAllSprites(); - this.startAllWindows(); +DKTools.Scene.prototype.destroy = function(options) { + this._clearAll(); + + this.clearEvents(); + this.deactivate(); + + Stage.prototype.destroy.call(this, options); }; /** - * Starts all sprites + * Turns off the option + * + * @since 2.0.0 + * + * @param {String} option - Name of the option + * + * @see DKTools.OptionManager.prototype.disableOption */ -DKTools.Scene.prototype.startAllSprites = function() { - // to be overridden by plugins +DKTools.Scene.prototype.disableOption = function(option) { + this._optionManager.disableOption(option); }; /** - * Starts all windows + * Turns off the options + * + * @since 2.0.0 + * + * @param {String[] | ...String} object - Names of the options + * + * @see DKTools.OptionManager.prototype.disableOptions */ -DKTools.Scene.prototype.startAllWindows = function() { - // to be overridden by plugins +DKTools.Scene.prototype.disableOptions = function(object) { + this._optionManager.disableOption(object); }; -// remove methods +// E methods /** - * Removes the window from the scene + * Turns on the option * - * @param {DKTools.Window | *} window - Window to remove + * @since 2.0.0 + * + * @param {String} option - Name of the option + * + * @see DKTools.OptionManager.prototype.enableOption */ -DKTools.Scene.prototype.removeWindow = function(window) { - if (this.hasWindowLayer() && this.isChild(window)) { - this._windowLayer.removeChild(window); - } +DKTools.Scene.prototype.enableOption = function(option) { + this._optionManager.enableOption(option); +}; + +/** + * Turns on the options + * + * @since 2.0.0 + * + * @param {String[] | ...String} object - Names of the options + * + * @see DKTools.OptionManager.prototype.enableOptions + */ +DKTools.Scene.prototype.enableOptions = function(object) { + this._optionManager.enableOption(object); }; -// has methods +// F methods /** - * Returns true if the scene has the layer of windows + * Finishes the events * - * @returns {Boolean} Scene has the layer of windows + * @since 2.0.0 + * + * @param {String} type - Type of the events + * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events + * + * @see DKTools.EventManager.prototype.finishEvents */ -DKTools.Scene.prototype.hasWindowLayer = function() { - return !!this._windowLayer; +DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { + this._eventManager.finishEvents(type, forcedSuccess); }; -// is methods +// G methods /** - * Returns true if the object (parameter) is child of scene + * Returns a container for the events by event type * - * @param {Sprite | Window} object - Object + * @since 2.0.0 * - * @returns {Boolean} Object (parameter) is child of scene + * @param {String} type - Type of the events + * + * @see DKTools.EventManager.prototype.getEventsContainerByType + * + * @returns {Array} Container for the events */ -DKTools.Scene.prototype.isChild = function(object) { - if (object instanceof Window && this.hasWindowLayer()) { - return DKTools.Utils.Array.contains(this._windowLayer.children, object); - } +DKTools.Scene.prototype.getEventsContainerByType = function(type) { + return this._eventManager.getEventsContainerByType(type); +}; - return DKTools.Utils.Array.contains(this.children, object); +/** + * Returns a container for the events by event + * + * @since 2.0.0 + * + * @param {DKTools.Event | DKTools.Animation} event - Event + * + * @see DKTools.EventManager.prototype.getEventsContainer + * + * @returns {Array} Container for the events + */ +DKTools.Scene.prototype.getEventsContainer = function(event) { + return this._eventManager.getEventsContainer(event); }; -// stop methods +/** + * Returns an index of the event in its container + * + * @since 2.0.0 + * + * @param {DKTools.Event | DKTools.Animation} event - Event + * + * @see DKTools.EventManager.prototype.getEventIndex + * + * @returns {Number} Index of the event in its container + */ +DKTools.Scene.prototype.getEventIndex = function(event) { + return this._eventManager.getEventIndex(event); +}; /** - * Stops the scene + * Returns an array with the all events or events of a certain type * - * @override + * @since 2.0.0 * - * @see Scene_Base.prototype.stop - * @see DKTools.Scene.prototype.stopAll + * @param {String} [type] - Type of the events + * + * @see DKTools.EventManager.prototype.getEvents + * + * @returns {Array} Array with the events */ -DKTools.Scene.prototype.stop = function() { - Scene_Base.prototype.stop.call(this); - this.stopAll(); +DKTools.Scene.prototype.getEvents = function(type) { + return this._eventManager.getEvents(type); }; /** - * Stops all + * Returns an array with the all animations or animations of a certain type + * + * @since 2.0.0 + * + * @param {String} [type] - Type of animation + * + * @see DKTools.EventManager.prototype.getAnimations + * + * @returns {Array} Array with the animations */ -DKTools.Scene.prototype.stopAll = function() { - // to be overridden by plugins +DKTools.Scene.prototype.getAnimations = function(type) { + return this._eventManager.getAnimations(type); }; -// terminate methods +// H methods /** - * Terminates the scene + * Returns true if the scene has the layer of windows * - * @override + * @returns {Boolean} Scene has the layer of windows + */ +DKTools.Scene.prototype.hasWindowLayer = function() { + return !!this._windowLayer; +}; + +/** + * Checks for existence of the event in the object + * Returns true if the event exists * - * @see Scene_Base.prototype.terminate - * @see DKTools.Scene.prototype.stopAll + * @since 2.0.0 + * + * @param {DKTools.Event | DKTools.Animation} event - Event + * + * @see DKTools.EventManager.prototype.hasEvent + * + * @returns {Boolean} Event exists */ -DKTools.Scene.prototype.terminate = function() { - Scene_Base.prototype.terminate.call(this); - this.terminateAll(); +DKTools.Scene.prototype.hasEvent = function(event) { + return this._eventManager.hasEvent(event); }; /** - * Terminates all + * Checks for existence of the events of a certain type + * Returns true if the events exists + * + * @since 2.0.0 + * + * @param {String} [type] - Type of the Events + * + * @see DKTools.EventManager.prototype.hasEvents + * + * @returns {Boolean} Events exists */ -DKTools.Scene.prototype.terminateAll = function() { - // to be overridden by plugins +DKTools.Scene.prototype.hasEvents = function(type) { + return this._eventManager.hasEvents(type); }; -// option methods +/** + * Checks for existence of the animation in the object + * Returns true if the animation exists + * + * @since 2.0.0 + * + * @param {DKTools.Animation} animation - Animation + * + * @see DKTools.EventManager.prototype.hasAnimation + * + * @returns {Boolean} Animation exists + */ +DKTools.Scene.prototype.hasAnimation = function(animation) { + return this._eventManager.hasAnimation(animation); +}; /** - * Clears the options + * Checks for existence of the animations of a certain type + * Returns true if the animations exists * * @since 2.0.0 * - * @see DKTools.OptionManager.prototype.clear + * @param {String} [type] - Type of the animations + * + * @see DKTools.EventManager.prototype.hasAnimations + * + * @returns {Boolean} Animations exists */ -DKTools.Scene.prototype.clearOptions = function() { - this._optionManager.clear(); +DKTools.Scene.prototype.hasAnimations = function(type) { + return this._eventManager.hasAnimations(type); +}; + +// I methods + +/** + * Calls the callback function for the child objects + * + * @param {Function} callback - Function for the child objects + */ +DKTools.Scene.prototype.iterateChildren = function(callback) { + _.forEach(this.children, callback); +}; + +/** + * Returns true if the object (parameter) is child of scene + * + * @param {Sprite | Window} object - Object + * + * @returns {Boolean} Object (parameter) is child of scene + */ +DKTools.Scene.prototype.isChild = function(object) { + if (object instanceof Window && this.hasWindowLayer()) { + return DKTools.Utils.Array.contains(this._windowLayer.children, object); + } + + return DKTools.Utils.Array.contains(this.children, object); +}; + +/** + * Returns true if the scene was destroyed + * + * @since 8.0.0 + * + * @returns {Boolean} Scene was destroyed + */ +DKTools.Scene.prototype.isDestroyed = function() { + return this._destroyed; }; /** @@ -35494,225 +36270,300 @@ DKTools.Scene.prototype.isSomeOptionEnabled = function() { }; /** - * Adds a listener of change of the option + * Performs a callback function for the events * * @since 2.0.0 * - * @param {String} option - Name of the option - * @param {Function} listener - Listener + * @param {String} type - Type of the events + * @param {Function} callback - Event processing function * - * @see DKTools.OptionManager.prototype.addOptionChangeListener + * @see DKTools.EventManager.prototype.iterateEventsContainer */ -DKTools.Scene.prototype.addOptionChangeListener = function(option, listener) { - this._optionManager.addOptionChangeListener(option, listener); +DKTools.Scene.prototype.iterateEventsContainer = function(type, callback) { + this._eventManager.iterateEventsContainer(type, callback); }; /** - * Removes the listener of change of the option + * Checks the events for pause + * Returns the conjunction of pauses of the events * * @since 2.0.0 * - * @param {String} option - Name of the option - * @param {Function} listener - Listener + * @param {String} type - Type of the events * - * @see DKTools.OptionManager.prototype.removeOptionsChangeListener + * @see DKTools.EventManager.prototype.isEventsPaused + * + * @returns {Boolean} Conjunction of pauses of the events */ -DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) { - this._optionManager.removeOptionChangeListener(option, listener); +DKTools.Scene.prototype.isEventsPaused = function(type) { + return this._eventManager.isEventsPaused(type); }; +// P methods + /** - * Turns on the option + * Pauses the events * * @since 2.0.0 * - * @param {String} option - Name of the option + * @param {String} type - Type of the events + * @param {Number} duration - Duration of pause * - * @see DKTools.OptionManager.prototype.enableOption + * @see DKTools.EventManager.prototype.pauseEvents */ -DKTools.Scene.prototype.enableOption = function(option) { - this._optionManager.enableOption(option); +DKTools.Scene.prototype.pauseEvents = function(type, duration) { + this._eventManager.pauseEvents(type, duration); }; +// R methods + /** - * Turns on the options + * Removes the listener of change of the option * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {String} option - Name of the option + * @param {Function} listener - Listener * - * @see DKTools.OptionManager.prototype.enableOptions + * @see DKTools.OptionManager.prototype.removeOptionsChangeListener */ -DKTools.Scene.prototype.enableOptions = function(object) { - this._optionManager.enableOption(object); +DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) { + this._optionManager.removeOptionChangeListener(option, listener); }; /** - * Turns off the option + * Removes the event from a container + * Returns true if the event was removed * * @since 2.0.0 * - * @param {String} option - Name of the option + * @param {DKTools.Event | DKTools.Animation} event - Event * - * @see DKTools.OptionManager.prototype.disableOption + * @see DKTools.EventManager.prototype.removeEvent + * + * @returns {Boolean} Event was removed */ -DKTools.Scene.prototype.disableOption = function(option) { - this._optionManager.disableOption(option); +DKTools.Scene.prototype.removeEvent = function(event) { + return this._eventManager.removeEvent(event); }; /** - * Turns off the options + * Resumes the events * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {String} type - Type of the events * - * @see DKTools.OptionManager.prototype.disableOptions + * @see DKTools.EventManager.prototype.resumeEvents */ -DKTools.Scene.prototype.disableOptions = function(object) { - this._optionManager.disableOption(object); +DKTools.Scene.prototype.resumeEvents = function(type) { + this._eventManager.resumeEvents(type); }; /** - * Switches the option + * Removes the window from the scene * - * @since 2.0.0 + * @param {DKTools.Window | *} window - Window to remove + */ +DKTools.Scene.prototype.removeWindow = function(window) { + if (this.hasWindowLayer() && this.isChild(window)) { + this._windowLayer.removeChild(window); + } +}; + +// S methods + +/** + * Sets all data * - * @param {String} option - Name of the option + * @version 2.0.0 + * @private * - * @see DKTools.OptionManager.prototype.switchOption + * @see DKTools.Scene.prototype._setupOptions + * @see DKTools.Scene.prototype._setupEvents + * @see DKTools.Scene.prototype._setupAnimations */ -DKTools.Scene.prototype.switchOption = function(option) { - this._optionManager.disableOption(option); +DKTools.Scene.prototype._setupAll = function() { + this._setupOptions(); + this._setupEvents(); + this._setupAnimations(); }; /** - * Switches the options + * Sets the options * * @since 2.0.0 - * - * @param {String[] | ...String} object - Names of the options - * - * @see DKTools.OptionManager.prototype.switchOptions + * @private */ -DKTools.Scene.prototype.switchOptions = function(object) { - this._optionManager.switchOptions(object); +DKTools.Scene.prototype._setupOptions = function() { + // to be overridden by plugins }; -// events methods - /** - * Clears the events - * - * @version 2.0.0 - * - * @param {String[] | String} object Array with event types or event type + * Sets the events * - * @see DKTools.EventManager.prototype.clearEvents + * @since 2.0.0 + * @private */ -DKTools.Scene.prototype.clearEvents = function(object) { - this._eventManager.clearEvents(object); +DKTools.Scene.prototype._setupEvents = function() { + // to be overridden by plugins }; /** - * Removes the event from a container - * Returns true if the event was removed + * Sets the animations * * @since 2.0.0 + * @private + */ +DKTools.Scene.prototype._setupAnimations = function() { + // to be overridden by plugins +}; + +/** + * Starts the scene * - * @param {DKTools.Event | DKTools.Animation} event - Event + * @override + */ +DKTools.Scene.prototype.start = function() { + Scene_Base.prototype.start.call(this); + this.startAllSprites(); + this.startAllWindows(); +}; + +/** + * Starts all sprites + */ +DKTools.Scene.prototype.startAllSprites = function() { + // to be overridden by plugins +}; + +/** + * Starts all windows + */ +DKTools.Scene.prototype.startAllWindows = function() { + // to be overridden by plugins +}; + +/** + * Stops the scene * - * @see DKTools.EventManager.prototype.removeEvent + * @override * - * @returns {Boolean} Event was removed + * @see Scene_Base.prototype.stop + * @see DKTools.Scene.prototype.stopAll */ -DKTools.Scene.prototype.removeEvent = function(event) { - return this._eventManager.removeEvent(event); +DKTools.Scene.prototype.stop = function() { + Scene_Base.prototype.stop.call(this); + this.stopAll(); }; /** - * Performs a callback function for the events + * Stops all + */ +DKTools.Scene.prototype.stopAll = function() { + // to be overridden by plugins +}; + +/** + * Stops the events * * @since 2.0.0 * * @param {String} type - Type of the events - * @param {Function} callback - Event processing function + * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events * - * @see DKTools.EventManager.prototype.iterateEventsContainer + * @see DKTools.EventManager.prototype.stopEvents */ -DKTools.Scene.prototype.iterateEventsContainer = function(type, callback) { - this._eventManager.iterateEventsContainer(type, callback); +DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { + this._eventManager.stopEvents(type, forcedSuccess); }; /** - * Checks the events for pause - * Returns the conjunction of pauses of the events + * Switches the option * * @since 2.0.0 * - * @param {String} type - Type of the events - * - * @see DKTools.EventManager.prototype.isEventsPaused + * @param {String} option - Name of the option * - * @returns {Boolean} Conjunction of pauses of the events + * @see DKTools.OptionManager.prototype.switchOption */ -DKTools.Scene.prototype.isEventsPaused = function(type) { - return this._eventManager.isEventsPaused(type); +DKTools.Scene.prototype.switchOption = function(option) { + this._optionManager.disableOption(option); }; /** - * Pauses the events + * Switches the options * * @since 2.0.0 * - * @param {String} type - Type of the events - * @param {Number} duration - Duration of pause + * @param {String[] | ...String} object - Names of the options * - * @see DKTools.EventManager.prototype.pauseEvents + * @see DKTools.OptionManager.prototype.switchOptions */ -DKTools.Scene.prototype.pauseEvents = function(type, duration) { - this._eventManager.pauseEvents(type, duration); +DKTools.Scene.prototype.switchOptions = function(object) { + this._optionManager.switchOptions(object); }; +// T methods + /** - * Resumes the events - * - * @since 2.0.0 + * Terminates the scene * - * @param {String} type - Type of the events + * @override * - * @see DKTools.EventManager.prototype.resumeEvents + * @see Scene_Base.prototype.terminate + * @see DKTools.Scene.prototype.stopAll */ -DKTools.Scene.prototype.resumeEvents = function(type) { - this._eventManager.resumeEvents(type); +DKTools.Scene.prototype.terminate = function() { + Scene_Base.prototype.terminate.call(this); + this.terminateAll(); }; /** - * Finishes the events - * - * @since 2.0.0 + * Terminates all + */ +DKTools.Scene.prototype.terminateAll = function() { + // to be overridden by plugins +}; + +// U methods + +/** + * Updates the scene * - * @param {String} type - Type of the events - * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events + * @version 2.0.0 + * @override * - * @see DKTools.EventManager.prototype.finishEvents + * @see DKTools.Scene.prototype.updateChildren + * @see DKTools.Scene.prototype.updateFade */ -DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { - this._eventManager.finishEvents(type, forcedSuccess); +DKTools.Scene.prototype.update = function() { + this.updateChildren(); + this.updateFade(); + this.updateEvents(); }; /** - * Stops the events + * Updates the child object * - * @since 2.0.0 + * @param {*} child - Child object + */ +DKTools.Scene.prototype.updateChild = function(child) { + if (child && DKTools.Utils.isFunction(child.update)) { + child.update(); + } +}; + +/** + * Updates the child objects * - * @param {String} type - Type of the events - * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events + * @override * - * @see DKTools.EventManager.prototype.stopEvents + * @see DKTools.Scene.prototype.iterateChildren + * @see DKTools.Scene.prototype.updateChild */ -DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { - this._eventManager.stopEvents(type, forcedSuccess); +DKTools.Scene.prototype.updateChildren = function() { + this.iterateChildren(this.updateChild); }; /** @@ -35797,264 +36648,6 @@ DKTools.Scene.prototype.updateQueueEvents = function() { this.updateEvent(event); }; -/** - * Returns a container for the events by event type - * - * @since 2.0.0 - * - * @param {String} type - Type of the events - * - * @see DKTools.EventManager.prototype.getEventsContainerByType - * - * @returns {Array} Container for the events - */ -DKTools.Scene.prototype.getEventsContainerByType = function(type) { - return this._eventManager.getEventsContainerByType(type); -}; - -/** - * Returns a container for the events by event - * - * @since 2.0.0 - * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.getEventsContainer - * - * @returns {Array} Container for the events - */ -DKTools.Scene.prototype.getEventsContainer = function(event) { - return this._eventManager.getEventsContainer(event); -}; - -/** - * Returns an index of the event in its container - * - * @since 2.0.0 - * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.getEventIndex - * - * @returns {Number} Index of the event in its container - */ -DKTools.Scene.prototype.getEventIndex = function(event) { - return this._eventManager.getEventIndex(event); -}; - -/** - * Returns an array with the all events or events of a certain type - * - * @since 2.0.0 - * - * @param {String} [type] - Type of the events - * - * @see DKTools.EventManager.prototype.getEvents - * - * @returns {Array} Array with the events - */ -DKTools.Scene.prototype.getEvents = function(type) { - return this._eventManager.getEvents(type); -}; - -/** - * Returns an array with the all animations or animations of a certain type - * - * @since 2.0.0 - * - * @param {String} [type] - Type of animation - * - * @see DKTools.EventManager.prototype.getAnimations - * - * @returns {Array} Array with the animations - */ -DKTools.Scene.prototype.getAnimations = function(type) { - return this._eventManager.getAnimations(type); -}; - -/** - * Checks for existence of the event in the object - * Returns true if the event exists - * - * @since 2.0.0 - * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.hasEvent - * - * @returns {Boolean} Event exists - */ -DKTools.Scene.prototype.hasEvent = function(event) { - return this._eventManager.hasEvent(event); -}; - -/** - * Checks for existence of the events of a certain type - * Returns true if the events exists - * - * @since 2.0.0 - * - * @param {String} [type] - Type of the Events - * - * @see DKTools.EventManager.prototype.hasEvents - * - * @returns {Boolean} Events exists - */ -DKTools.Scene.prototype.hasEvents = function(type) { - return this._eventManager.hasEvents(type); -}; - -/** - * Checks for existence of the animation in the object - * Returns true if the animation exists - * - * @since 2.0.0 - * - * @param {DKTools.Animation} animation - Animation - * - * @see DKTools.EventManager.prototype.hasAnimation - * - * @returns {Boolean} Animation exists - */ -DKTools.Scene.prototype.hasAnimation = function(animation) { - return this._eventManager.hasAnimation(animation); -}; - -/** - * Checks for existence of the animations of a certain type - * Returns true if the animations exists - * - * @since 2.0.0 - * - * @param {String} [type] - Type of the animations - * - * @see DKTools.EventManager.prototype.hasAnimations - * - * @returns {Boolean} Animations exists - */ -DKTools.Scene.prototype.hasAnimations = function(type) { - return this._eventManager.hasAnimations(type); -}; - -/** - * Adds the event - * - * @since 2.0.0 - * - * @param {DKTools.Event | Object} object - Event or object with parameters for the event - * - * @param {String} [object.type] - Type of the event - * @param {Number} [object.repeatTime] - Time of one repeat - * @param {Number} [object.repeats] - Amount of repeats - * @param {Number} [object.remainingPauseTime] - Remaining time of pause - * @param {Function} [object.onStart] - Handler of the event start - * @param {Function} [object.onUpdate] - Handler of the event update - * @param {Function} [object.onPause] - Handler of the event pause - * @param {Function} [object.onReset] - Handler of the event reset - * @param {Function} [object.onRepeat] - Handler of the event repeat - * @param {Function} [object.onSuccess] - Handler of the event success - * @param {Function} [object.onFail] - Handler of the event fail - * - * @see DKTools.Event - * @see DKTools.EventManager.prototype.addEvent - * - * @returns {DKTools.Event} Added event - */ -DKTools.Scene.prototype.addEvent = function(object) { - return this._eventManager.addEvent(object); -}; - -/** - * Adds the one time event - * - * @since 2.0.0 - * - * @param {DKTools.Event | Object} object - Event or object with parameters for the event - * - * @param {String} [object.type] - Type of the event - * @param {Number} [object.remainingPauseTime] - Remaining time of pause - * @param {Function} [object.onStart] - Handler of the event start - * @param {Function} [object.onUpdate] - Handler of the event update - * @param {Function} [object.onPause] - Handler of the event pause - * @param {Function} [object.onReset] - Handler of the event reset - * @param {Function} [object.onRepeat] - Handler of the event repeat - * @param {Function} [object.onSuccess] - Handler of the event success - * @param {Function} [object.onFail] - Handler of the event fail - * - * @see DKTools.Event - * @see DKTools.EventManager.prototype.addOneTimeEvent - * - * @returns {DKTools.Event} Added event - */ -DKTools.Scene.prototype.addOneTimeEvent = function(object) { - return this._eventManager.addOneTimeEvent(object); -}; - -/** - * Adds the animation - * - * @since 2.0.0 - * - * @param {DKTools.Animation} animation - Animation to add - * - * @see DKTools.EventManager.addAnimation - */ -DKTools.Scene.prototype.addAnimation = function(animation) { - this._eventManager.addAnimation(animation); -}; - -// other methods - -/** - * Calls the callback function for the child objects - * - * @param {Function} callback - Function for the child objects - */ -DKTools.Scene.prototype.iterateChildren = function(callback) { - _.forEach(this.children, callback); -}; - -// update methods - -/** - * Updates the scene - * - * @version 2.0.0 - * @override - * - * @see DKTools.Scene.prototype.updateChildren - * @see DKTools.Scene.prototype.updateFade - */ -DKTools.Scene.prototype.update = function() { - this.updateChildren(); - this.updateFade(); - this.updateEvents(); -}; - -/** - * Updates the child object - * - * @param {*} child - Child object - */ -DKTools.Scene.prototype.updateChild = function(child) { - if (child && DKTools.Utils.isFunction(child.update)) { - child.update(); - } -}; - -/** - * Updates the child objects - * - * @override - * - * @see DKTools.Scene.prototype.iterateChildren - * @see DKTools.Scene.prototype.updateChild - */ -DKTools.Scene.prototype.updateChildren = function() { - this.iterateChildren(this.updateChild); -}; - - @@ -36072,7 +36665,7 @@ DKTools.Scene.prototype.updateChildren = function() { * @memberof DKTools.Scene */ DKTools.Scene.Preloader = class { - + constructor() { this.initialize.apply(this, arguments); } @@ -36184,7 +36777,7 @@ DKTools.Scene.Preloader = class { */ start() { const promises = _.map(this._queue, (promise) => { - return promise.catch(result => { + return promise.catch((result) => { this._onError(); throw result; @@ -36224,6 +36817,10 @@ DKTools.PluginCommandManager.set('DKPluginsCheckUpdates', () => { DKTools.Utils._checkUpdates(); }); +DKTools.PluginCommandManager.set('UpdateFileSystemStamp', () => { + DKTools.IO._createStamp(); +}); + @@ -36260,7 +36857,7 @@ ImageCache.prototype._truncateCache = function() { Object.keys(items).map(key => items[key]) .filter(item => !this._mustBeHeld(item)) .sort((a, b) => b.touch - a.touch) - .forEach(item => { + .forEach((item) => { if (sizeLeft > 0 && !DKTools.PreloadManager.isImageCachedByKey(item.key)) { const bitmap = item.bitmap; @@ -36322,15 +36919,137 @@ Graphics._createFPSMeter = function() { const param = DKToolsParam.get('FPS Meter'); if (param.Enabled) { - const options = { toggleOn: null, graph: 1, decimals: 0, theme: param.Theme, history: param.History }; + this._fpsMeter = new FPSMeter({ + theme: param.Theme, + history: param.History, + toggleOn: null, + graph: 1, + decimals: 0 + }); - this._fpsMeter = new FPSMeter(options); this._fpsMeter.hide(); } else { DKTools_Graphics_createFPSMeter.call(this); } }; +Graphics.printDetailedError = function(error) { + if (!this._errorPrinter) { + return; + } + + const stack = error.stack.split(/(?:\r\n|\r|\n)/).map((value) => { + return value.replace(/[\(](.*[\/])/, '('); + }); + + this._errorPrinter.innerHTML = this._makeDetailedErrorHtml(error.name, error.message, stack); + + this._applyCanvasFilter(); + this._clearUpperCanvas(); +}; + +Graphics._getErrorReferenceInfo = function() { + const scene = SceneManager._scene; + const data = {}; + + if (scene && scene.constructor.name) { + data['Scene'] = scene.constructor.name; + + if (SceneManager.isCurrentScene(Scene_Map)) { + const interpreter = $gameMap._interpreter; + + if (interpreter) { + if (interpreter._mapId > 0) { + data['Map ID'] = interpreter._mapId; + } + + if (interpreter._eventId > 0) { + data['Event ID'] = interpreter._eventId; + + const event = $gameMap.event(interpreter._eventId); + + if (event) { + data['Event Page'] = event._pageIndex + 1; + } + } + + if (interpreter._list && interpreter._list.length > 0) { + let command = interpreter._list[interpreter._index]; + + if (command && command.code === 0 && interpreter._index > 0) { + command = interpreter._list[interpreter._index - 1]; + } + + if (command && command.code > 0) { + data['Last Event Command'] = command.code; + } + } + + if (interpreter._params && interpreter._params.length > 0) { + data['Params'] = JSON.stringify(interpreter._params); + } + } + } + } + + return data; +}; + +Graphics._getErrorMessageForErrorPrint = function() { + return DKToolsParam.get('Print Detailed Error', 'Error Message'); +}; + +Graphics._getRestartMessageForErrorPrint = function() { + return DKToolsParam.get('Print Detailed Error', 'Restart Message'); +}; + +Graphics._makeDetailedErrorHtml = function(name, message, stack) { + const errorMessage = this._getErrorMessageForErrorPrint(); + const restartMessage = this._getRestartMessageForErrorPrint(); + const referenceInfo = this._getErrorReferenceInfo(); + let text = ''; + + if (errorMessage) { + text = '' + errorMessage + '
' + '

'; + } + + if (Object.keys(referenceInfo).length > 0) { + text += '' + 'Reference Information' + '
'; + + _.forEach(referenceInfo, (value, key) => { + text += '' + key + ': ' + value + '
'; + }); + + text += '
'; + } + + text += '' + message + '
'; + + _.forEach(stack, (value) => { + text += '' + value + '
'; + }); + + if (restartMessage) { + text += '
' + restartMessage + '

'; + } + + return text; +}; + +const DKTools_Graphics_updateErrorPrinter = Graphics._updateErrorPrinter; +Graphics._updateErrorPrinter = function() { + DKTools_Graphics_updateErrorPrinter.call(this); + + if (!this._errorPrinter || !DKToolsParam.get('Print Detailed Error', 'Enabled')) { + return; + } + + this._errorPrinter.style.textAlign = 'left'; + this._errorPrinter.height = this._height * 0.8; + + this._centerElement(this._errorPrinter); +}; + @@ -36592,6 +37311,8 @@ TouchInput._onMouseMove = function(event) { if (this._mouseX !== x || this._mouseY !== y) { this._events.mouseMoved = true; + + this._date = Date.now(); this._mouseX = x; this._mouseY = y; } @@ -36657,6 +37378,7 @@ Object.defineProperties(TouchInput, { + //=========================================================================== // Tilemap //=========================================================================== @@ -36758,10 +37480,11 @@ SceneManager.initialize = async function() { const DKTools_SceneManager_initGraphics = SceneManager.initGraphics; SceneManager.initGraphics = function() { const param = DKToolsParam.get('Screen Resolution'); - const width = param.Width; - const height = param.Height; if (param.Enabled) { + const width = param.Width; + const height = param.Height; + this._boxWidth = width; this._screenWidth = width; this._boxHeight = height; @@ -36781,7 +37504,7 @@ SceneManager.updateResolution = function() { const resizeWidth = this._screenWidth - window.innerWidth; const resizeHeight = this._screenHeight - window.innerHeight; - if (!Imported.ScreenResolution && resizeWidth > 0 && resizeHeight > 0) { + if (resizeWidth > 0 && resizeHeight > 0) { window.moveBy(-1 * resizeWidth / 2, -1 * resizeHeight / 2); window.resizeBy(resizeWidth, resizeHeight); } @@ -36824,10 +37547,14 @@ SceneManager.onKeyDown = function(event) { }; const DKTools_SceneManager_catchException = SceneManager.catchException; -SceneManager.catchException = function(e) { - DKTools_SceneManager_catchException.call(this, e); +SceneManager.catchException = function(error) { + DKTools_SceneManager_catchException.call(this, error); - DKTools.Utils.logError(e); + if (error instanceof Error && DKToolsParam.get('Print Detailed Error', 'Enabled')) { + Graphics.printDetailedError(error); + } + + DKTools.Utils.logError(error); if (DKToolsParam.get('Debugging Console', 'Open On Error')) { DKTools.Utils.openConsole(); @@ -36850,6 +37577,7 @@ SceneManager.changeScene = function() { if (this._scene) { this._scene.terminate(); this._scene.detachReservation(); + this._previousClass = this._scene.constructor; } @@ -36866,6 +37594,7 @@ SceneManager.changeScene = function() { if (this._scene.isPreloaded()) { this._scene.create(); this._sceneCreated = true; + this.onSceneCreate(); } } @@ -36881,6 +37610,7 @@ SceneManager.updateScene = function() { if (!this._sceneCreated && this._scene.isPreloaded()) { this._scene.create(); this._sceneCreated = true; + this.onSceneCreate(); } @@ -36889,11 +37619,17 @@ SceneManager.updateScene = function() { if (this._scene.isReady()) { this._scene.start(); this._sceneStarted = true; + this.onSceneStart(); } } catch (e) { + console.error(e); + + DKTools.Utils.logError(e); + this._scene.start(); this._sceneStarted = true; + this.onSceneStart(); } } @@ -36905,12 +37641,13 @@ SceneManager.updateScene = function() { }; /** + * @version 8.0.0 * @since 6.1.0 * * @returns {Boolean} */ SceneManager.isCurrentScene = function(sceneClass) { - return this._scene instanceof sceneClass; + return !!this._scene && this._scene.constructor === sceneClass; }; const DKTools_SceneManager_goto = SceneManager.goto; @@ -36931,9 +37668,32 @@ const DKTools_Scene_Base_initialize = Scene_Base.prototype.initialize; Scene_Base.prototype.initialize = function() { DKTools_Scene_Base_initialize.call(this); + /** + * @private + * @readonly + * @type {DKTools.Scene.Preloader} + */ this._preloader = new DKTools.Scene.Preloader(); }; +/** + * Activates the scene + * + * @since 8.0.0 + */ +Scene_Base.prototype.activate = function() { + this._active = true; +}; + +/** + * Deactivates the scene + * + * @since 8.0.0 + */ +Scene_Base.prototype.deactivate = function() { + this._active = false; +}; + /** * Returns true if the scene is preloaded * @@ -36975,6 +37735,13 @@ Scene_Base.prototype.startPreloading = function() { this._preloader.start(); }; +const DKTools_Scene_Base_terminate = Scene_Base.prototype.terminate; +Scene_Base.prototype.terminate = function() { + DKTools_Scene_Base_terminate.call(this); + + this._preloader.finish(); +}; + diff --git a/README.md b/README.md index 294e584..d155ffd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ **Author**: DK -**Version**: Public 7.0.0 +**Version**: Public 8.0.0 **Description**: Library for RPG Maker MV. Contains many tools for developing. diff --git a/dev/DKTools.js b/dev/DKTools.js index 61a5a4f..4b47414 100644 --- a/dev/DKTools.js +++ b/dev/DKTools.js @@ -3,8 +3,8 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 7.0.0 -Release: 29.03.2019 +Version: 8.0.0 +Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English */ @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 7.0.0 -Релиз: 29.03.2019 +Версия: 8.0.0 +Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.7.0.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.0.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,8 +29,8 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 7.0.0 - Release: 29.03.2019 + Version: 8.0.0 + Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English Thank you for your support: https://dk-plugins.ru/donate @@ -49,6 +49,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Instructions ### + ## Parameters ## + + ### 1 ### File system ### + File system modes: + Nwjs + Stamp - Advanced file system mode (all Platforms) + Nwjs - standard file system mode (PC only) + + In the Nwjs + Stamp mode, each time you start a game test, the plugin scans + project files and saves data to the file "data/stamp.json" + + Data can also be updated using the plugin command UpdateFileSystemStamp + + Q. Why do I need Nwjs + Stamp file system mode ? + A. Browsers and old mobile devices do not provide the ability to check for specific files. + in a particular directory, and also do not provide a list of files and directories. + + Q. Which mode should I choose ? + A. Nwjs + Stamp, if your project is designed for all platforms (including browsers and mobile devices). + + ### 1.1 ### Ignored directories ### + Only applicable for Nwjs + Stamp mode. + Ignores specified (and nested) directories when scanning project files. + + ## Functions ## + ### 1 ### Screenshots ### Templates for the filename of the screenshot: %year - Year @@ -77,6 +102,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Checks for plugins updates from DKPlugins DKPluginsCheckUpdates + 2. Update file system stamp + UpdateFileSystemStamp + ### Elements ### DKTools.Utils DKTools.Utils.Object @@ -141,6 +169,24 @@ E-mail: kuznetsovdenis96@gmail.com You can't: -Delete or change any information about the plugin (Title, authorship, contact information, version and release) + * @param Parameters + * @default --------------------------------- + + * @param File System + * @parent Parameters + * @desc File system parameters. Details in the help (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @default --------------------------------- + + * @param Print Detailed Error + * @parent New Functions + * @desc Detailed error display + * @type struct + * @default {"Enabled":"false","Error Message":"Game has encountered a bug. Please report it.","Restart Message":"Press F5 to restart the game."} + * @param Functions * @default --------------------------------- @@ -225,7 +271,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.7.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -233,8 +279,8 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 7.0.0 - Релиз: 29.03.2019 + Версия: 8.0.0 + Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский Спасибо за Вашу поддержку: https://dk-plugins.ru/donate @@ -253,6 +299,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Инструкции ### + ## Параметры ## + + ### 1 ### Файловая система ### + Режимы работы файловой системы: + Nwjs + Stamp - Расширенный режим работы файловой системы (все платформы) + Nwjs - стандартный режим работы файловой системы (только PC) + + В режиме Nwjs + Stamp каждый раз при запуске теста игры плагин сканирует + файлы проекта и сохраняет данные в файл "data/Stamp.json" + + Данные также могут быть обновлены с помощью команды плагина UpdateFileSystemStamp + + Q. Зачем нужен режим работы Nwjs + Stamp ? + A. Браузеры и старые мобильные устройства не предоставляют возможность проверять наличие конкретных файлов + в той или иной директории, а также не предоставляют список файлов и директорий. + + Q. Какой режим выбрать мне ? + A. Nwjs + Stamp, если Ваш проект расчитан на все платформы (включая браузеры и мобильные устройства). + + ### 1.1 ### Игнорируемые директории ### + Применяется только для режима Nwjs + Stamp. + Игнорирует указанные (и вложенные) директории при сканировании файлов проекта. + + ## Функции ## + ### 1 ### Скриншоты ### Шаблоны для названия файла скриншота: %year - Год @@ -281,6 +352,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Проверить обновления плагинов от DKPlugins DKPluginsCheckUpdates + 2. Обновить штамп файловой системы + UpdateFileSystemStamp + ### Элементы ### DKTools.Utils DKTools.Utils.Object @@ -345,6 +419,28 @@ E-mail: kuznetsovdenis96@gmail.com Вы не можете: -Убирать или изменять любую информацию о плагине (Название, авторство, контактная информация, версия и дата релиза) + * @param Parameters + * @text Параметры + * @default --------------------------------- + + * @param File System + * @text Файловая система + * @parent Parameters + * @desc Параметры файловой системы. Подробности в справке (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @text Новые функции + * @default --------------------------------- + + * @param Print Detailed Error + * @text Детальное отображение ошибок + * @parent New Functions + * @desc Детальное отображение ошибок + * @type struct + * @default {"Enabled":"false","Error Message":"В игре обнаружена ошибка. Пожалуйста, сообщите об этом.","Restart Message":"Нажмите F5, чтобы перезапустить игру."} + * @param Functions * @text Функции * @default --------------------------------- @@ -442,6 +538,53 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~FileSystem: + + * @param Mode + * @desc File system mode. Details in the help (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @default --------------------------------- + + * @param Ignored Directories + * @parent Stamp + * @desc Ignored directories. Details in the help (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + +/*~struct~FileSystem:ru + + * @param Mode + * @text Режим работы файловой систмы + * @desc Режим работы файловой системы. Подробности в справке (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @text Штамп файловой системы + * @default --------------------------------- + + * @param Ignored Directories + * @text Игнорируемые директории + * @parent Stamp + * @desc Игнорируемые директории. Подробности в справке (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + /*~struct~CheckUpdates: * @param Enabled @@ -1142,4 +1285,43 @@ E-mail: kuznetsovdenis96@gmail.com */ -!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var s;window.Imported=window.Imported||{},window.Imported.DKTools="7.0.0",function(){function n(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,$=RegExp(G.source),q=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,st=RegExp(it.source),nt=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,wt=/['\n\r\u2028\u2029\\]/g,Dt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Dt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Dt,"g"),Ct=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),Ot=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),It=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ht="object"==typeof global&&global&&global.Object===Object&&global,Ft="object"==typeof self&&self&&self.Object===Object&&self,Lt=Ht||Ft||Function("return this")(),kt=e&&!e.nodeType&&e,Ut=kt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===kt,jt=Wt&&Ht.process,Nt=function(){try{var t=Ut&&Ut.f&&Ut.f("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,$t=Nt&&Nt.isSet,qt=Nt&&Nt.isTypedArray,Yt=D("length"),Zt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Jt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(Ws(t)&&!xo(t)&&!(t instanceof Dt)){if(t instanceof S)return t;if(xn.call(t,"__wrapped__"))return ds(t)}return new S(t)}function s(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=k}function Dt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,s,n,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=n?i(t,s,n,r):i(t)),a!==k)return a;if(!Us(t))return t;if(s=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xn.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=kr(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Po(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(a=h||p?{}:Ji(t),!l)return h?function(t,e){return gi(t,Lr(t),e)}(t,function(t,e){return t&&gi(e,sn(e),t)}(a,t)):function(t,e){return gi(t,Fr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return n?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Kr?Dn(Kr.call(t)):{}}}(t,c,l)}}if(r||(r=new Ft),n=r.get(t))return n;if(r.set(t,a),Ho(t))return t.forEach(function(s){a.add(oe(s,e,i,s,t,r))}),a;if(Mo(t))return t.forEach(function(s,n){a.set(n,oe(s,e,i,n,t,r))}),a;h=u?h?zi:Ni:h?sn:en;var d=s?k:h(t);return o(d||t,function(s,n){d&&(s=t[n=s]),Nt(a,n,oe(s,e,i,n,t,r))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Dn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===k&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new Kn("Expected a function");return jr(function(){t.apply(k,i)},e)}function he(t,e,i,s){var n=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,C(i))),s?(r=u,o=!1):200<=e.length&&(r=I,o=!1,e=new Ht(e));t:for(;++ne}function we(t,e){return null!=t&&xn.call(t,e)}function De(t,e){return null!=t&&e in Dn(t)}function Se(t,e,i){for(var s=i?u:h,n=t[0].length,r=t.length,o=r,a=mn(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,C(e))),l=or(d.length,l),a[o]=!i&&(e||120<=n&&120<=d.length)?new Ht(o&&d):k}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[us(ys(e))])?k:n(e,t,i)}function Ke(t){return Ws(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,s,n){if(t===e)e=!0;else if(null==t||null==e||!Ws(t)&&!Ws(e))e=t!=t&&e!=e;else t:{var r=xo(t),o=xo(e),a=r?"[object Array]":kr(t),l=o?"[object Array]":kr(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Po(t)){if(!Po(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new Ft),e=r||Fo(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new kn(t),new kn(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Rs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=H),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Kr)return Kr.call(t)==Kr.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&xn.call(t,"__wrapped__"),a=o&&xn.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new Ft),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new Ft),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xn.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:k}function Fe(t,e,i){var s=-1;return e=c(e.length?e:[un],C(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t){return{a:c(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a?l:l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function Le(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=mn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Vs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[us(ys(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Je(t[0]):[];for(var n=-1,r=mn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Un?Un(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new kn(e).set(new kn(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==k,s=null===t,n=t==t,r=Vs(t),o=e!==k,a=null===e,l=e==e,h=Vs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?k:r,n=1),e=Dn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Jn(t/F(e))),Ot.test(e)?ai(L(i),0,t).join(""):i.slice(0,t))}function Ei(t,e,i,s){var r=1&e,o=Di(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=s.length,c=mn(u+l),p=this&&this!==Lt&&this instanceof e?o:t;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:or(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===k?l?0:t.length:rr(r[9]-h,0))&&24&e&&(e&=-25),as((p?Pr:Wr)(e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(k,r):Ei(t,e,i,s):function(t,e,i){var s=1&e,n=Di(t);return function e(){return(this&&this!==Lt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),r),t,e)}function Li(t,e,i,s){return t===k||Rs(t,Cn[i])&&!xn.call(s,i)?e:t}function ki(t,e,i,s,n,r){return Us(t)&&Us(e)&&(r.set(e,t),Be(t,e,k,ki,r),r.delete(e)),t}function Ui(t){return Ns(t)?k:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ht:k;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:$s(i))&&(i=rr(s+i,0)),m(t,Xi(e,3),i)):-1}function gs(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==k&&(n=$s(i),n=0>i?rr(s+n,0):or(n,s-1)),m(t,Xi(e,3),n,!0)}function _s(t){return null!=t&&t.length?de(t,1):[]}function ms(t){return t&&t.length?t[0]:k}function ys(t){var e=null==t?0:t.length;return e?t[e-1]:k}function Ts(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function vs(t){return null==t?t:ur.call(t)}function ws(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Bs(t))return e=rr(t.length,e),!0}),A(e,function(e){return c(t,D(e))})}function Ds(t,e){if(!t||!t.length)return[];var i=ws(t);return null==e?i:c(i,function(t){return n(e,k,t)})}function Ss(t){return(t=i(t)).__chain__=!0,t}function bs(t,e){return e(t)}function Ks(t,e){return(xo(t)?o:Or)(t,Xi(e,3))}function As(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Ir)(t,Xi(e,3))}function Cs(t,e){return(xo(t)?c:Pe)(t,Xi(e,3))}function Os(t,e,i){return e=i?k:e,e=t&&null==e?t.length:e,Fi(t,128,k,k,k,k,e)}function Is(t,e){var i;if("function"!=typeof e)throw new Kn("Expected a function");return t=$s(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=k),i}}function xs(t,e,i){function s(e){var i=l,s=h;return l=h=k,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===k||i>=e||0>i||_&&t>=u}function r(){var t=yo();if(n(t))return o(t);var i,s=jr;i=t-f,t=e-(t-d),i=_?or(t,u-i):t,p=s(r,i)}function o(t){return p=k,m&&l?s(t):(l=h=k,c)}function a(){var t=yo(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===k)return f=t=d,p=jr(r,e),g?s(t):c;if(_)return p=jr(r,e),s(d)}return p===k&&(p=jr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new Kn("Expected a function");return e=Ys(e)||0,Us(i)&&(g=!!i.leading,u=(_="maxWait"in i)?rr(Ys(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==k&&Mr(p),f=0,l=d=h=p=k},a.flush=function(){return p===k?c:o(yo())},a}function Es(t,e){function i(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)}if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Kn("Expected a function");return i.cache=new(Es.Cache||Rt),i}function Ps(t){if("function"!=typeof t)throw new Kn("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Rs(t,e){return t===e||t!=t&&e!=e}function Ms(t){return null!=t&&ks(t.length)&&!Fs(t)}function Bs(t){return Ws(t)&&Ms(t)}function Hs(t){if(!Ws(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ns(t)}function Fs(t){return!!Us(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Ls(t){return"number"==typeof t&&t==$s(t)}function ks(t){return"number"==typeof t&&-1=t}function Us(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ws(t){return null!=t&&"object"==typeof t}function js(t){return"number"==typeof t||Ws(t)&&"[object Number]"==Te(t)}function Ns(t){return!(!Ws(t)||"[object Object]"!=Te(t))&&(null===(t=Wn(t))||"function"==typeof(t=xn.call(t,"constructor")&&t.constructor)&&t instanceof t&&In.call(t)==Mn)}function zs(t){return"string"==typeof t||!xo(t)&&Ws(t)&&"[object String]"==Te(t)}function Vs(t){return"symbol"==typeof t||Ws(t)&&"[object Symbol]"==Te(t)}function Gs(t){if(!t)return[];if(Ms(t))return zs(t)?L(t):fi(t);if(Gn&&t[Gn]){t=t[Gn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=kr(t))?R:"[object Set]"==e?H:rn)(t)}function Xs(t){return t?(t=Ys(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function $s(t){var e=(t=Xs(t))%1;return t==t?e?t-e:t:0}function qs(t){return t?re($s(t),0,4294967295):0}function Ys(t){if("number"==typeof t)return t;if(Vs(t))return W;if(Us(t)&&(t=Us(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(nt,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Zs(t){return gi(t,sn(t))}function Js(t){return null==t?"":Ze(t)}function Qs(t,e,i){return(t=null==t?k:me(t,e))===k?i:t}function tn(t,e){return null!=t&&Zi(t,e,De)}function en(t){return Ms(t)?kt(t):xe(t)}function sn(t){if(Ms(t))t=kt(t,!0);else if(Us(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&xn.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Dn(t))e.push(i);t=e}return t}function nn(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),Le(t,i,function(t,i){return e(t,i[0])})}function rn(t){return null==t?[]:O(t,en(t))}function on(t){return ha(Js(t).toLowerCase())}function an(t){return(t=Js(t))&&t.replace(Tt,Zt).replace(Kt,"")}function ln(t,e,i){return t=Js(t),(e=i?k:e)===k?It.test(t)?t.match(Ct)||[]:t.match(ut)||[]:t.match(e)||[]}function hn(t){return function(){return t}}function un(t){return t}function cn(t){return Ie("function"==typeof t?t:oe(t,1))}function pn(t,e,i){var s=en(e),n=_e(e,s);null!=i||Us(e)&&(n.length||!s.length)||(i=e,e=t,t=this,n=_e(e,en(e)));var r=!(Us(i)&&"chain"in i&&!i.chain),a=Fs(t);return o(n,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,p([this.value()],arguments))})}),t}function dn(){}function fn(t){return is(t)?D(us(t)):function(t){return function(e){return me(e,t)}}(t)}function gn(){return[]}function _n(){return!1}var mn=(e=null==e?Lt:te.defaults(Lt.Object(),e,te.pick(Lt,xt))).Array,yn=e.Date,Tn=e.Error,vn=e.Function,wn=e.Math,Dn=e.Object,Sn=e.RegExp,bn=e.String,Kn=e.TypeError,An=mn.prototype,Cn=Dn.prototype,On=e["__core-js_shared__"],In=vn.prototype.toString,xn=Cn.hasOwnProperty,En=0,Pn=function(){var t=/[^.]+$/.exec(On&&On.keys&&On.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Rn=Cn.toString,Mn=In.call(Dn),Bn=Lt._,Hn=Sn("^"+In.call(xn).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fn=Wt?e.Buffer:k,Ln=e.Symbol,kn=e.Uint8Array,Un=Fn?Fn.g:k,Wn=M(Dn.getPrototypeOf,Dn),jn=Dn.create,Nn=Cn.propertyIsEnumerable,zn=An.splice,Vn=Ln?Ln.isConcatSpreadable:k,Gn=Ln?Ln.iterator:k,Xn=Ln?Ln.toStringTag:k,$n=function(){try{var t=Yi(Dn,"defineProperty");return t({},"",{}),t}catch(t){}}(),qn=e.clearTimeout!==Lt.clearTimeout&&e.clearTimeout,Yn=yn&&yn.now!==Lt.Date.now&&yn.now,Zn=e.setTimeout!==Lt.setTimeout&&e.setTimeout,Jn=wn.ceil,Qn=wn.floor,tr=Dn.getOwnPropertySymbols,er=Fn?Fn.isBuffer:k,ir=e.isFinite,sr=An.join,nr=M(Dn.keys,Dn),rr=wn.max,or=wn.min,ar=yn.now,lr=e.parseInt,hr=wn.random,ur=An.reverse,cr=Yi(e,"DataView"),pr=Yi(e,"Map"),dr=Yi(e,"Promise"),fr=Yi(e,"Set"),gr=Yi(e,"WeakMap"),_r=Yi(Dn,"create"),mr=gr&&new gr,yr={},Tr=cs(cr),vr=cs(pr),wr=cs(dr),Dr=cs(fr),Sr=cs(gr),br=Ln?Ln.prototype:k,Kr=br?br.valueOf:k,Ar=br?br.toString:k,Cr=function(){function t(){}return function(e){return Us(e)?jn?jn(e):(t.prototype=e,e=new t,t.prototype=k,e):{}}}();i.templateSettings={escape:Y,evaluate:Z,interpolate:J,variable:"",imports:{_:i}},i.prototype=s.prototype,i.prototype.constructor=i,S.prototype=Cr(s.prototype),S.prototype.constructor=S,Dt.prototype=Cr(s.prototype),Dt.prototype.constructor=Dt,St.prototype.clear=function(){this.__data__=_r?_r(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return _r?"__lodash_hash_undefined__"===(t=e[t])?k:t:xn.call(e,t)?e[t]:k},St.prototype.has=function(t){var e=this.__data__;return _r?e[t]!==k:xn.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=_r&&e===k?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():zn.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?k:e[t][1]},At.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(pr||At),string:new St}},Rt.prototype.delete=function(t){return t=$i(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return $i(this,t).get(t)},Rt.prototype.has=function(t){return $i(this,t).has(t)},Rt.prototype.set=function(t,e){var i=$i(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ht.prototype.add=Ht.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ht.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.clear=function(){this.__data__=new At,this.size=0},Ft.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var s=i.__data__;if(!pr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(s)}return i.set(t,e),this.size=i.size,this};var Or=yi(fe),Ir=yi(ge,!0),xr=Ti(),Er=Ti(!0),Pr=mr?function(t,e){return mr.set(t,e),t}:un,Rr=$n?function(t,e){return $n(t,"toString",{configurable:!0,enumerable:!1,value:hn(e),writable:!0})}:un,Mr=qn||function(t){return Lt.clearTimeout(t)},Br=fr&&1/H(new fr([,-0]))[1]==U?function(t){return new fr(t)}:dn,Hr=mr?function(t){return mr.get(t)}:dn,Fr=tr?function(t){return null==t?[]:(t=Dn(t),l(tr(t),function(e){return Nn.call(t,e)}))}:gn,Lr=tr?function(t){for(var e=[];t;)p(e,Fr(t)),t=Wn(t);return e}:gn,kr=Te;(cr&&"[object DataView]"!=kr(new cr(new ArrayBuffer(1)))||pr&&"[object Map]"!=kr(new pr)||dr&&"[object Promise]"!=kr(dr.resolve())||fr&&"[object Set]"!=kr(new fr)||gr&&"[object WeakMap]"!=kr(new gr))&&(kr=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:k)?cs(t):"")switch(t){case Tr:return"[object DataView]";case vr:return"[object Map]";case wr:return"[object Promise]";case Dr:return"[object Set]";case Sr:return"[object WeakMap]"}return e});var Ur=On?Fs:_n,Wr=ls(Pr),jr=Zn||function(t,e){return Lt.setTimeout(t,e)},Nr=ls(Rr),zr=function(t){var e=(t=Es(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,s,n){e.push(s?n.replace(ct,"$1"):i||t)}),e}),Vr=Ne(function(t,e){return Bs(t)?he(t,de(e,1,Bs,!0)):[]}),Gr=Ne(function(t,e){var i=ys(e);return Bs(i)&&(i=k),Bs(t)?he(t,de(e,1,Bs,!0),Xi(i,2)):[]}),Xr=Ne(function(t,e){var i=ys(e);return Bs(i)&&(i=k),Bs(t)?he(t,de(e,1,Bs,!0),k,i):[]}),$r=Ne(function(t){var e=c(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),qr=Ne(function(t){var e=ys(t),i=c(t,ni);return e===ys(i)?e=k:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Yr=Ne(function(t){var e=ys(t),i=c(t,ni);return(e="function"==typeof e?e:k)&&i.pop(),i.length&&i[0]===t[0]?Se(i,k,e):[]}),Zr=Ne(Ts),Jr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,c(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),Qr=Ne(function(t){return Je(de(t,1,Bs,!0))}),to=Ne(function(t){var e=ys(t);return Bs(e)&&(e=k),Je(de(t,1,Bs,!0),Xi(e,2))}),eo=Ne(function(t){var e="function"==typeof(e=ys(t))?e:k;return Je(de(t,1,Bs,!0),k,e)}),io=Ne(function(t,e){return Bs(t)?he(t,e):[]}),so=Ne(function(t){return ii(l(t,Bs))}),no=Ne(function(t){var e=ys(t);return Bs(e)&&(e=k),ii(l(t,Bs),Xi(e,2))}),ro=Ne(function(t){var e="function"==typeof(e=ys(t))?e:k;return ii(l(t,Bs),k,e)}),oo=Ne(ws),ao=Ne(function(t){var e;return Ds(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:k)?(t.pop(),e):k)}),lo=ji(function(t){function e(e){return ne(e,t)}var i=t.length,s=i?t[0]:0,n=this.__wrapped__;return!(1=e}),Io=Ke(function(){return arguments}())?Ke:function(t){return Ws(t)&&xn.call(t,"callee")&&!Nn.call(t,"callee")},xo=mn.isArray,Eo=zt?C(zt):function(t){return Ws(t)&&"[object ArrayBuffer]"==Te(t)},Po=er||_n,Ro=Vt?C(Vt):function(t){return Ws(t)&&"[object Date]"==Te(t)},Mo=Gt?C(Gt):function(t){return Ws(t)&&"[object Map]"==kr(t)},Bo=Xt?C(Xt):function(t){return Ws(t)&&"[object RegExp]"==Te(t)},Ho=$t?C($t):function(t){return Ws(t)&&"[object Set]"==kr(t)},Fo=qt?C(qt):function(t){return Ws(t)&&ks(t.length)&&!!Et[Te(t)]},Lo=Ri(Ee),ko=Ri(function(t,e){return t<=e}),Uo=mi(function(t,e){if(ns(e)||Ms(e))gi(e,en(e),t);else for(var i in e)xn.call(e,i)&&Nt(t,i,e[i])}),Wo=mi(function(t,e){gi(e,sn(e),t)}),jo=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),No=mi(function(t,e,i,s){gi(e,en(e),t,s)}),zo=ji(ne),Vo=Ne(function(t,e){t=Dn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},i.ary=Os,i.assign=Uo,i.assignIn=Wo,i.assignInWith=jo,i.assignWith=No,i.at=zo,i.before=Is,i.bind=To,i.bindAll=ca,i.bindKey=vo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},i.chain=Ss,i.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===k)?1:rr($s(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=mn(Jn(i/e));s(e=i||e===k?1:$s(e))?0:e,s):[]},i.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===k?1:$s(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=$s(i))&&(i=-i>n?0:n+i),0>(s=s===k||s>n?n:$s(s))&&(s+=n),s=i>s?0:qs(s);i>>0)?(t=Js(t))&&("string"==typeof e||null!=e&&!Bo(e))&&(!(e=Ze(e))&&Ot.test(t))?ai(L(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new Kn("Expected a function");return e=null==e?0:rr($s(e),0),Ne(function(i){var s=i[e];return i=ai(i,0,e),s&&p(i,s),n(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===k?1:$s(e))?0:e):[]},i.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===k?1:$s(e)))?0:e,s):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new Kn("Expected a function");return Us(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xs(t,e,{leading:s,maxWait:e,trailing:n})},i.thru=bs,i.toArray=Gs,i.toPairs=ta,i.toPairsIn=ea,i.toPath=function(t){return xo(t)?c(t,us):Vs(t)?[t]:fi(zr(Js(t)))},i.toPlainObject=Zs,i.transform=function(t,e,i){var s=xo(t),n=s||Po(t)||Fo(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=n?s?new r:[]:Us(t)&&Fs(r)?Cr(Wn(t)):{}}return(n?o:fe)(t,function(t,s,n){return e(i,t,s,n)}),i},i.unary=function(t){return Os(t,1)},i.union=Qr,i.unionBy=to,i.unionWith=eo,i.uniq=function(t){return t&&t.length?Je(t):[]},i.uniqBy=function(t,e){return t&&t.length?Je(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:k,t&&t.length?Je(t,k,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=ws,i.unzipWith=Ds,i.update=function(t,e,i){return null==t?t:ze(t,e,ri(i)(me(t,e)),void 0)},i.updateWith=function(t,e,i,s){return s="function"==typeof s?s:k,null!=t&&(t=ze(t,e,ri(i)(me(t,e)),s)),t},i.values=rn,i.valuesIn=function(t){return null==t?[]:O(t,sn(t))},i.without=io,i.words=ln,i.wrap=function(t,e){return bo(ri(e),t)},i.xor=so,i.xorBy=no,i.xorWith=ro,i.zip=oo,i.zipObject=function(t,e){return si(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return si(t||[],e||[],ze)},i.zipWith=ao,i.entries=ta,i.entriesIn=ea,i.extend=Wo,i.extendWith=jo,pn(i,i),i.add=wa,i.attempt=ua,i.camelCase=ia,i.capitalize=on,i.ceil=Da,i.clamp=function(t,e,i){return i===k&&(i=e,e=k),i!==k&&(i=(i=Ys(i))==i?i:0),e!==k&&(e=(e=Ys(e))==e?e:0),re(Ys(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:k)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:k)},i.conformsTo=function(t,e){return null==e||ae(t,e,en(e))},i.deburr=an,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=Sa,i.endsWith=function(t,e,i){t=Js(t),e=Ze(e);var s=t.length;s=i=i===k?s:re($s(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},i.eq=Rs,i.escape=function(t){return(t=Js(t))&&q.test(t)?t.replace(X,Jt):t},i.escapeRegExp=function(t){return(t=Js(t))&&st.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var s=xo(t)?a:ue;return i&&es(t,e,i)&&(e=k),s(t,Xi(e,3))},i.find=uo,i.findIndex=fs,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=co,i.findLastIndex=gs,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=ba,i.forEach=Ks,i.forEachRight=As,i.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),sn)},i.forInRight=function(t,e){return null==t?t:Er(t,Xi(e,3),sn)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=Qs,i.gt=Co,i.gte=Oo,i.has=function(t,e){return null!=t&&Zi(t,e,we)},i.hasIn=tn,i.head=ms,i.identity=un,i.includes=function(t,e,i,s){return t=Ms(t)?t:rn(t),i=i&&!s?$s(i):0,s=t.length,0>i&&(i=rr(s+i,0)),zs(t)?i<=s&&-1(i=null==i?0:$s(i))&&(i=rr(s+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=Xs(e),i===k?(i=e,e=0):i=Xs(i),(t=Ys(t))>=or(e,i)&&t=t},i.isSet=Ho,i.isString=zs,i.isSymbol=Vs,i.isTypedArray=Fo,i.isUndefined=function(t){return t===k},i.isWeakMap=function(t){return Ws(t)&&"[object WeakMap]"==kr(t)},i.isWeakSet=function(t){return Ws(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":sr.call(t,e)},i.kebabCase=sa,i.last=ys,i.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==k&&(n=0>(n=$s(i))?rr(s+n,0):or(n,s-1)),e==e){for(i=n+1;i--&&t[i]!==e;);t=i}else t=m(t,v,n,!0);return t},i.lowerCase=na,i.lowerFirst=ra,i.lt=Lo,i.lte=ko,i.max=function(t){return t&&t.length?ce(t,un,ve):k},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),ve):k},i.mean=function(t){return w(t,un)},i.meanBy=function(t,e){return w(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,un,Ee):k},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),Ee):k},i.stubArray=gn,i.stubFalse=_n,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Ka,i.nth=function(t,e){return t&&t.length?He(t,$s(e)):k},i.noConflict=function(){return Lt._===this&&(Lt._=Bn),this},i.noop=dn,i.now=yo,i.pad=function(t,e,i){t=Js(t);var s=(e=$s(e))?F(t):0;return!e||s>=e?t:xi(Qn(e=(e-s)/2),i)+t+xi(Jn(e),i)},i.padEnd=function(t,e,i){t=Js(t);var s=(e=$s(e))?F(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=hr(),or(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var s=xo(t)?d:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Or)},i.reduceRight=function(t,e,i){var s=xo(t)?f:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Ir)},i.repeat=function(t,e,i){return e=(i?es(t,e,i):e===k)?1:$s(e),je(Js(t),e)},i.replace=function(){var t=arguments,e=Js(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=k);++s(t=$s(t))||9007199254740991=r)return t;if(1>(r=i-F(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===k)return i+s;if(o&&(r+=i.length-r),Bo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=Sn(n.source,Js(dt.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===k?r:l)}}else t.indexOf(Ze(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},i.unescape=function(t){return(t=Js(t))&&$.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++En;return Js(t)+e},i.upperCase=la,i.upperFirst=ha,i.each=Ks,i.eachRight=As,i.first=ms,pn(i,function(){var t={};return fe(i,function(e,s){xn.call(i.prototype,s)||(t[s]=e)}),t}(),{chain:!1}),i.VERSION="4.17.10",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){Dt.prototype[t]=function(i){i=i===k?1:rr($s(i),0);var s=this.__filtered__&&!e?new Dt(this):this.clone();return s.__filtered__?s.__takeCount__=or(i,s.__takeCount__):s.__views__.push({size:or(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Dt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Dt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");Dt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Dt.prototype[t]=function(){return this.__filtered__?new Dt(this):this[i](1)}}),Dt.prototype.compact=function(){return this.filter(un)},Dt.prototype.find=function(t){return this.filter(t).head()},Dt.prototype.findLast=function(t){return this.reverse().find(t)},Dt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new Dt(this):this.map(function(i){return be(i,t,e)})}),Dt.prototype.reject=function(t){return this.filter(Ps(Xi(t)))},Dt.prototype.slice=function(t,e){t=$s(t);var i=this;return i.__filtered__&&(0e)?new Dt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==k&&(i=0>(e=$s(e))?i.dropRight(-e):i.take(e-t)),i)},Dt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Dt.prototype.toArray=function(){return this.take(4294967295)},fe(Dt.prototype,function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),r=i[n?"take"+("last"==e?"Right":""):e],o=n||/^find/.test(e);r&&(i.prototype[e]=function(){function e(t){return t=r.apply(i,p([t],l)),n&&d?t[0]:t}var a=this.__wrapped__,l=n?[1]:arguments,h=a instanceof Dt,u=l[0],c=h||xo(a);c&&s&&"function"==typeof u&&1!=u.length&&(h=c=!1);var d=this.__chain__,f=!!this.__actions__.length;u=o&&!d,h=h&&!f;return!o&&c?(a=h?a:new Dt(this),(a=t.apply(a,l)).__actions__.push({func:bs,args:[e],thisArg:k}),new S(a,d)):u&&h?t.apply(this,l):(a=this.thru(e),u?n?a.value()[0]:a.value():a)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=An[t],s=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(xo(i)?i:[],t)}return this[s](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(Dt.prototype,function(t,e){var s=i[e];if(s){var n=s.name+"";(yr[n]||(yr[n]=[])).push({name:e,func:s})}}),yr[Ai(k,2).name]=[{name:"wrapper",func:k}],Dt.prototype.clone=function(){var t=new Dt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Dt.prototype.reverse=function(){if(this.__filtered__){var t=new Dt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Dt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=xo(e),n=0>i,r=s?e.length:0;t=r;for(var o=this.__views__,a=0,l=-1,h=o.length;++l=this.__values__.length;return{done:t,value:t?k:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof s;){var n=ds(i);n.__index__=0,n.__values__=k,e?r.__wrapped__=n:e=n;var r=n;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Dt?(this.__actions__.length&&(t=new Dt(this)),(t=t.reverse()).__actions__.push({func:bs,args:[vs],thisArg:k}),new S(t,this.__chain__)):this.thru(vs)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Gn&&(i.prototype[Gn]=function(){return this}),i}();Lt._=te,void 0===(s=function(){return te}.call(e,i,e,t))||(t.exports=s)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),n.get("Debugging Console","Enabled")&&this.openConsole(),n.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}const e=n.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=n.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=n.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${s}.${n}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a");if(t instanceof Object){let e=`Date: ${(new Date).toString()}`+o.EOL+`Name: ${t.name}`+o.EOL+`Message: ${t.message}`+o.EOL;void 0!==t.filename&&(e+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(e+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(e+=`Column: ${t.columnNumber}`+o.EOL),e+=`Stack: ${t.stack}`+o.EOL+o.EOL,await r.writeSync(c,e)}else{const e=`Date: ${(new Date).toString()}`+o.EOL+`Error: ${t}`+o.EOL+o.EOL;await r.writeSync(c,e)}await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=n.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,s),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=n.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!n.get("Quick Load","Enabled"))return;const t=n.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!n.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=n.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.forEach(_.keys(t),e=>{const i=_.camelCase(e);i!==e&&(t[i]=t[e],delete t[e])}),t}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.events()[t]),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.events()[t]),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t}static absolutePathExists(t){return!!this.isLocalMode()&&this._fs.existsSync(t)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(!this.isLocalMode())return!1;const e=this.getAbsolutePath(t);return!!this.absolutePathExists(e)&&this._fs.lstatSync(e).isFile()}static isDirectory(t){if(!this.isLocalMode())return!1;const e=this.getAbsolutePath(t);return!!this.absolutePathExists(e)&&this._fs.lstatSync(e).isDirectory()}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){DKTools.IO.Entity.prototype.initialize.call(this,t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(DKTools.IO.isLocalMode()&&(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage())){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return DKTools.IO.Entity.prototype.exists.call(this)}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}else{const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return!this.isAudio()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName())}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):!this.isImage()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i})}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=DKTools.IO.fs,i=this.getFullPath(),s=this.getAbsolutePath(),n=e=>{return t.template instanceof RegExp?e=_.filter(e,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(e=_.filter(e,e=>e===t.template)),{data:_.reduce(e,(t,e)=>{const s=DKTools.IO.normalizePath(i+"/"+e);return DKTools.IO.isFile(s)?t.push(new DKTools.IO.File(s)):DKTools.IO.isDirectory(s)&&t.push(new DKTools.IO.Directory(s)),t},[]),status:DKTools.IO.OK}};if(!t.sync)return e.readdir(s,t.options,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess(n(i),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const i=e.readdirSync(s,t.options);return n(i)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().then(t=>t,()=>null)}static async _toJson(t){return t.json().then(t=>t,()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},initialParams:{get:function(){return this._initialParams||(this._initialParams=PluginManager.parameters(this._pluginName)),this._initialParams},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=n.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&n.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode())throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),_.forEach(n,i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{const i=new DKTools.IO.File(e.path),s=i.getFullPath();i.isFile()?this._queue[t][s]||(this._queue[t][s]=e):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){this.hasTarget()&&this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return DKTools.Utils.Array.contains(this._getProperties(),t)}hasProperties(){return DKTools.Utils.isFunction(this._properties)||Array.isArray(this._properties)&&this._properties.length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(y)&&(y=r*parseFloat(y)),n(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,s&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,s&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}moveWithAnchor(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.getRealSize(),n=this.anchor;this.move(i.x+n.x*s.width,i.y+n.y*s.height)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{Window_Base.prototype.processEscapeCharacter.call(this,t,e)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isInside=function(t,e){const i=this.canvasToLocalX(t),s=this.canvasToLocalY(e),n=this.width,r=this.height,o=this.anchor;return new Rectangle(-n*o.x,-r*o.y,n,r).contains(i,s)},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/parallaxes/",t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/tilesets/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){return"GameFont"},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){return 28},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.realWidth,this.realHeight)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=_.defaultTo(t,this.standardOpacity())},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/parallaxes/",t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/tilesets/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0},pressX:{get:function(){return this.canvasToLocalX(TouchInput.x)},configurable:!0},pressY:{get:function(){return this.canvasToLocalY(TouchInput.y)},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.realWidth-t),o=Math.min(s,n.realHeight-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._indexe)break}else if(r+i+t>e)break;r+=i+t}return n}getMaxPageCols(){return this.getMaxCols()}getMaxPageItems(){return this.isHorizontal()?this.getMaxPageCols():this.getMaxPageRows()*this.getMaxPageCols()}getRow(t){return Math.floor(t/this.getMaxCols())}getCurrentRow(){return this.getRow(this._index)}getItemRow(t){return this.hasItem(t)?this.getRow(t):-1}getRowItems(t){const e=[];if(DKTools.Utils.Number.inRange(t,0,this.getMaxRows())){const i=this.getMaxPageItems(),s=this.getMaxItems();let n=t*this.getMaxCols();for(let r=0;r0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.canvasToLocalX(t),n=this.canvasToLocalY(e),r=this.getMaxPageItems(),o=this.getMaxItems();let a=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.realWidth+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.realWidth,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.realHeight})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.realWidth-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.realHeight})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.realWidth-t)/2,i=e+t/2,s=this.realHeight;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.isInside=function(t,e){const i=this.canvasToLocalX(t),s=this.canvasToLocalY(e);return new Rectangle(0,0,this.width,this.height).contains(i,s)},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.realWidth=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.realHeight=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const n=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.printLoadingError;Graphics.printLoadingError=function(t){l.call(this,t),DKTools.Utils.logError(`Failed to load: ${t}`)};const h=Graphics.initialize;Graphics.initialize=function(t,e,i){h.call(this,t,e,i);const s=n.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=n.get("FPS Meter");if(t.Enabled){const e={toggleOn:null,graph:1,decimals:0,theme:t.Theme,history:t.History};this._fpsMeter=new FPSMeter(e),this._fpsMeter.hide()}else u.call(this)};const c=TouchInput.initialize;TouchInput.initialize=function(){c.call(this);const t=n.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const p=TouchInput.clear;TouchInput.clear=function(){p.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const d=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,d.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const f=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);f.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const g=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const m=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const y=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._mouseX=e,this._mouseY=i)};const T=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const v=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){v.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const w=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):w.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const D=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!D.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()};const S=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):S.call(this,t,e)};const b=SceneManager.initialize;SceneManager.initialize=async function(){await b.call(this),await DKTools.StartupManager.initialize()};const K=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=n.get("Screen Resolution"),e=t.Width,i=t.Height;t.Enabled?(this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,K.call(this),DKTools.Utils.isNwjs()&&this.updateResolution()):K.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;!Imported.ScreenResolution&&t>0&&e>0&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const A=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(A.call(this,t),t.ctrlKey||t.altKey)return;const e=n.get("Quick Load","Key Code"),i=n.get("Screenshots","Key Code"),s=n.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:n.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const C=SceneManager.catchException;SceneManager.catchException=function(t){C.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const O=SceneManager.onError;SceneManager.onError=function(t){O.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return this._scene instanceof t};const I=SceneManager.goto;SceneManager.goto=function(t){I.call(this,t),DKTools.Utils.__hideGrid()};const x=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){x.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const E=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return E.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const P=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return P.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const R=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=n.get("Quick Start");t.Enabled?(R.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):R.call(this)};const M=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&M.call(this)};const B=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||B.call(this)};const H=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||H.call(this)};const F=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){F.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)}}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file +/*~struct~PrintDetailedError: + + * @param Enabled + * @desc Enable detailed error display ? + * @type boolean + * @default false + + * @param Error Message + * @text Error message + * @desc Error message + * @default Game has encountered a bug. Please report it. + + * @param Restart Message + * @text Game restart message + * @desc Game restart message + * @default Press F5 to restart the game. + +*/ + +/*~struct~PrintDetailedError:ru + + * @param Enabled + * @text Включено + * @desc Включить детальное отображение ошибок ? + * @type boolean + * @default false + + * @param Error Message + * @text Сообщение об ошибке + * @desc Сообщение об ошибке + * @default В игре обнаружена ошибка. Пожалуйста, сообщите об этом. + + * @param Restart Message + * @text Сообщение о перезапуске игры + * @desc Сообщение о перезапуске игры + * @default Нажмите F5, чтобы перезапустить игру. + +*/ + +!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var s;window.Imported=window.Imported||{},window.Imported.DKTools="8.0.0",function(){function n(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,$=RegExp(G.source),q=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,st=RegExp(it.source),nt=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,wt=/['\n\r\u2028\u2029\\]/g,Dt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Dt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Dt,"g"),Ot=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),Ct=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),It=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ft="object"==typeof global&&global&&global.Object===Object&&global,Ht="object"==typeof self&&self&&self.Object===Object&&self,kt=Ft||Ht||Function("return this")(),Lt=e&&!e.nodeType&&e,Ut=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===Lt,jt=Wt&&Ft.process,Nt=function(){try{var t=Ut&&Ut.require&&Ut.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,$t=Nt&&Nt.isSet,qt=Nt&&Nt.isTypedArray,Yt=D("length"),Jt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Zt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(js(t)&&!Eo(t)&&!(t instanceof Dt)){if(t instanceof S)return t;if(En.call(t,"__wrapped__"))return fs(t)}return new S(t)}function s(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=L}function Dt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,s,n,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=n?i(t,s,n,r):i(t)),a!==L)return a;if(!Ws(t))return t;if(s=Eo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&En.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Ro(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,Lr(t),e)}(t,function(t,e){return t&&gi(e,nn(e),t)}(a,t)):function(t,e){return gi(t,kr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return n?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Ar?Sn(Ar.call(t)):{}}}(t,c,l)}}if(r||(r=new Ht),n=r.get(t))return n;if(r.set(t,a),Ho(t))return t.forEach(function(s){a.add(oe(s,e,i,s,t,r))}),a;if(Bo(t))return t.forEach(function(s,n){a.set(n,oe(s,e,i,n,t,r))}),a;h=u?h?zi:Ni:h?nn:sn;var d=s?L:h(t);return o(d||t,function(s,n){d&&(s=t[n=s]),Nt(a,n,oe(s,e,i,n,t,r))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Sn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===L&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new An("Expected a function");return Nr(function(){t.apply(L,i)},e)}function he(t,e,i,s){var n=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,O(i))),s?(r=u,o=!1):200<=e.length&&(r=I,o=!1,e=new Ft(e));t:for(;++ne}function we(t,e){return null!=t&&En.call(t,e)}function De(t,e){return null!=t&&e in Sn(t)}function Se(t,e,i){for(var s=i?u:h,n=t[0].length,r=t.length,o=r,a=yn(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,O(e))),l=ar(d.length,l),a[o]=!i&&(e||120<=n&&120<=d.length)?new Ft(o&&d):L}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[cs(Ts(e))])?L:n(e,t,i)}function Ke(t){return js(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,s,n){if(t===e)return!0;if(null==t||null==e||!js(t)&&!js(e))return t!=t&&e!=e;t:{var r=Eo(t),o=Eo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Ro(t)){if(!Ro(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new Ht),e=r||ko(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Un(t),new Un(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Ms(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=F),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&En.call(t,"__wrapped__"),a=o&&En.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new Ht),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new Ht),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:En.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:L}function He(t,e,i){var s=-1;return e=c(e.length?e:[cn],O(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,n){return{a:c(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a){s=l;break t}s=l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function ke(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=yn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Gs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[cs(Ts(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Ze(t[0]):[];for(var n=-1,r=yn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Wn?Wn(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Un(e).set(new Un(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==L,s=null===t,n=t==t,r=Gs(t),o=e!==L,a=null===e,l=e==e,h=Gs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?L:r,n=1),e=Sn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Qn(t/H(e))),Ct.test(e)?ai(k(i),0,t).join(""):i.slice(0,t))}function Ei(t,e,i,s){var r=1&e,o=Di(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=s.length,c=yn(u+l),p=this&&this!==kt&&this instanceof e?o:t;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===L?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(L,r):Ei(t,e,i,s):function(t,e,i){var s=1&e,n=Di(t);return function e(){return(this&&this!==kt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),ls((p?Rr:jr)(l,r),t,e)}function ki(t,e,i,s){return t===L||Ms(t,Cn[i])&&!En.call(s,i)?e:t}function Li(t,e,i,s,n,r){return Ws(t)&&Ws(e)&&(r.set(e,t),Be(t,e,L,Li,r),r.delete(e)),t}function Ui(t){return zs(t)?L:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ft:L;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:qs(i))&&(i=or(s+i,0)),m(t,Xi(e,3),i)):-1}function _s(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==L&&(n=qs(i),n=0>i?or(s+n,0):ar(n,s-1)),m(t,Xi(e,3),n,!0)}function ms(t){return null!=t&&t.length?de(t,1):[]}function ys(t){return t&&t.length?t[0]:L}function Ts(t){var e=null==t?0:t.length;return e?t[e-1]:L}function vs(t,e){return t&&t.length&&e&&e.length?Le(t,e):t}function ws(t){return null==t?t:cr.call(t)}function Ds(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Fs(t))return e=or(t.length,e),!0}),A(e,function(e){return c(t,D(e))})}function Ss(t,e){if(!t||!t.length)return[];var i=Ds(t);return null==e?i:c(i,function(t){return n(e,L,t)})}function bs(t){return(t=i(t)).__chain__=!0,t}function Ks(t,e){return e(t)}function As(t,e){return(Eo(t)?o:Ir)(t,Xi(e,3))}function Os(t,e){return(Eo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:xr)(t,Xi(e,3))}function Cs(t,e){return(Eo(t)?c:Pe)(t,Xi(e,3))}function Is(t,e,i){return e=i?L:e,e=t&&null==e?t.length:e,Hi(t,128,L,L,L,L,e)}function xs(t,e){var i;if("function"!=typeof e)throw new An("Expected a function");return t=qs(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=L),i}}function Es(t,e,i){function s(e){var i=l,s=h;return l=h=L,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===L||i>=e||0>i||_&&t>=u}function r(){var t=To();if(n(t))return o(t);var i,s=Nr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=s(r,i)}function o(t){return p=L,m&&l?s(t):(l=h=L,c)}function a(){var t=To(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===L)return f=t=d,p=Nr(r,e),g?s(t):c;if(_)return p=Nr(r,e),s(d)}return p===L&&(p=Nr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new An("Expected a function");return e=Js(e)||0,Ws(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Js(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==L&&Br(p),f=0,l=d=h=p=L},a.flush=function(){return p===L?c:o(To())},a}function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new An("Expected a function");var i=function(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)};return i.cache=new(Ps.Cache||Rt),i}function Rs(t){if("function"!=typeof t)throw new An("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Ms(t,e){return t===e||t!=t&&e!=e}function Bs(t){return null!=t&&Us(t.length)&&!ks(t)}function Fs(t){return js(t)&&Bs(t)}function Hs(t){if(!js(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!zs(t)}function ks(t){return!!Ws(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Ls(t){return"number"==typeof t&&t==qs(t)}function Us(t){return"number"==typeof t&&-1=t}function Ws(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function js(t){return null!=t&&"object"==typeof t}function Ns(t){return"number"==typeof t||js(t)&&"[object Number]"==Te(t)}function zs(t){return!(!js(t)||"[object Object]"!=Te(t))&&(null===(t=jn(t))||"function"==typeof(t=En.call(t,"constructor")&&t.constructor)&&t instanceof t&&xn.call(t)==Bn)}function Vs(t){return"string"==typeof t||!Eo(t)&&js(t)&&"[object String]"==Te(t)}function Gs(t){return"symbol"==typeof t||js(t)&&"[object Symbol]"==Te(t)}function Xs(t){if(!t)return[];if(Bs(t))return Vs(t)?k(t):fi(t);if(Xn&&t[Xn]){t=t[Xn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?R:"[object Set]"==e?F:on)(t)}function $s(t){return t?(t=Js(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function qs(t){var e=(t=$s(t))%1;return t==t?e?t-e:t:0}function Ys(t){return t?re(qs(t),0,4294967295):0}function Js(t){if("number"==typeof t)return t;if(Gs(t))return W;if(Ws(t)&&(t=Ws(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(nt,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Zs(t){return gi(t,nn(t))}function Qs(t){return null==t?"":Je(t)}function tn(t,e,i){return(t=null==t?L:me(t,e))===L?i:t}function en(t,e){return null!=t&&Ji(t,e,De)}function sn(t){return Bs(t)?Lt(t):xe(t)}function nn(t){if(Bs(t))t=Lt(t,!0);else if(Ws(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&En.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Sn(t))e.push(i);t=e}return t}function rn(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),ke(t,i,function(t,i){return e(t,i[0])})}function on(t){return null==t?[]:C(t,sn(t))}function an(t){return ua(Qs(t).toLowerCase())}function ln(t){return(t=Qs(t))&&t.replace(Tt,Jt).replace(Kt,"")}function hn(t,e,i){return t=Qs(t),(e=i?L:e)===L?It.test(t)?t.match(Ot)||[]:t.match(ut)||[]:t.match(e)||[]}function un(t){return function(){return t}}function cn(t){return t}function pn(t){return Ie("function"==typeof t?t:oe(t,1))}function dn(t,e,i){var s=sn(e),n=_e(e,s);null!=i||Ws(e)&&(n.length||!s.length)||(i=e,e=t,t=this,n=_e(e,sn(e)));var r=!(Ws(i)&&"chain"in i&&!i.chain),a=ks(t);return o(n,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,p([this.value()],arguments))})}),t}function fn(){}function gn(t){return is(t)?D(cs(t)):function(t){return function(e){return me(e,t)}}(t)}function _n(){return[]}function mn(){return!1}var yn=(e=null==e?kt:te.defaults(kt.Object(),e,te.pick(kt,xt))).Array,Tn=e.Date,vn=e.Error,wn=e.Function,Dn=e.Math,Sn=e.Object,bn=e.RegExp,Kn=e.String,An=e.TypeError,On=yn.prototype,Cn=Sn.prototype,In=e["__core-js_shared__"],xn=wn.prototype.toString,En=Cn.hasOwnProperty,Pn=0,Rn=function(){var t=/[^.]+$/.exec(In&&In.keys&&In.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Mn=Cn.toString,Bn=xn.call(Sn),Fn=kt._,Hn=bn("^"+xn.call(En).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kn=Wt?e.Buffer:L,Ln=e.Symbol,Un=e.Uint8Array,Wn=kn?kn.allocUnsafe:L,jn=M(Sn.getPrototypeOf,Sn),Nn=Sn.create,zn=Cn.propertyIsEnumerable,Vn=On.splice,Gn=Ln?Ln.isConcatSpreadable:L,Xn=Ln?Ln.iterator:L,$n=Ln?Ln.toStringTag:L,qn=function(){try{var t=Yi(Sn,"defineProperty");return t({},"",{}),t}catch(t){}}(),Yn=e.clearTimeout!==kt.clearTimeout&&e.clearTimeout,Jn=Tn&&Tn.now!==kt.Date.now&&Tn.now,Zn=e.setTimeout!==kt.setTimeout&&e.setTimeout,Qn=Dn.ceil,tr=Dn.floor,er=Sn.getOwnPropertySymbols,ir=kn?kn.isBuffer:L,sr=e.isFinite,nr=On.join,rr=M(Sn.keys,Sn),or=Dn.max,ar=Dn.min,lr=Tn.now,hr=e.parseInt,ur=Dn.random,cr=On.reverse,pr=Yi(e,"DataView"),dr=Yi(e,"Map"),fr=Yi(e,"Promise"),gr=Yi(e,"Set"),_r=Yi(e,"WeakMap"),mr=Yi(Sn,"create"),yr=_r&&new _r,Tr={},vr=ps(pr),wr=ps(dr),Dr=ps(fr),Sr=ps(gr),br=ps(_r),Kr=Ln?Ln.prototype:L,Ar=Kr?Kr.valueOf:L,Or=Kr?Kr.toString:L,Cr=function(){function t(){}return function(e){return Ws(e)?Nn?Nn(e):(t.prototype=e,e=new t,t.prototype=L,e):{}}}();i.templateSettings={escape:Y,evaluate:J,interpolate:Z,variable:"",imports:{_:i}},i.prototype=s.prototype,i.prototype.constructor=i,S.prototype=Cr(s.prototype),S.prototype.constructor=S,Dt.prototype=Cr(s.prototype),Dt.prototype.constructor=Dt,St.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?L:t:En.call(e,t)?e[t]:L},St.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==L:En.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===L?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():Vn.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?L:e[t][1]},At.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(dr||At),string:new St}},Rt.prototype.delete=function(t){return t=$i(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return $i(this,t).get(t)},Rt.prototype.has=function(t){return $i(this,t).has(t)},Rt.prototype.set=function(t,e){var i=$i(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ft.prototype.add=Ft.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ft.prototype.has=function(t){return this.__data__.has(t)},Ht.prototype.clear=function(){this.__data__=new At,this.size=0},Ht.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Ht.prototype.get=function(t){return this.__data__.get(t)},Ht.prototype.has=function(t){return this.__data__.has(t)},Ht.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var s=i.__data__;if(!dr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(s)}return i.set(t,e),this.size=i.size,this};var Ir=yi(fe),xr=yi(ge,!0),Er=Ti(),Pr=Ti(!0),Rr=yr?function(t,e){return yr.set(t,e),t}:cn,Mr=qn?function(t,e){return qn(t,"toString",{configurable:!0,enumerable:!1,value:un(e),writable:!0})}:cn,Br=Yn||function(t){return kt.clearTimeout(t)},Fr=gr&&1/F(new gr([,-0]))[1]==U?function(t){return new gr(t)}:fn,Hr=yr?function(t){return yr.get(t)}:fn,kr=er?function(t){return null==t?[]:(t=Sn(t),l(er(t),function(e){return zn.call(t,e)}))}:_n,Lr=er?function(t){for(var e=[];t;)p(e,kr(t)),t=jn(t);return e}:_n,Ur=Te;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:L)?ps(t):"")switch(t){case vr:return"[object DataView]";case wr:return"[object Map]";case Dr:return"[object Promise]";case Sr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Wr=In?ks:mn,jr=hs(Rr),Nr=Zn||function(t,e){return kt.setTimeout(t,e)},zr=hs(Mr),Vr=function(t){var e=(t=Ps(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,s,n){e.push(s?n.replace(ct,"$1"):i||t)}),e}),Gr=Ne(function(t,e){return Fs(t)?he(t,de(e,1,Fs,!0)):[]}),Xr=Ne(function(t,e){var i=Ts(e);return Fs(i)&&(i=L),Fs(t)?he(t,de(e,1,Fs,!0),Xi(i,2)):[]}),$r=Ne(function(t,e){var i=Ts(e);return Fs(i)&&(i=L),Fs(t)?he(t,de(e,1,Fs,!0),L,i):[]}),qr=Ne(function(t){var e=c(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=Ne(function(t){var e=Ts(t),i=c(t,ni);return e===Ts(i)?e=L:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=Ne(function(t){var e=Ts(t),i=c(t,ni);return(e="function"==typeof e?e:L)&&i.pop(),i.length&&i[0]===t[0]?Se(i,L,e):[]}),Zr=Ne(vs),Qr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,c(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),to=Ne(function(t){return Ze(de(t,1,Fs,!0))}),eo=Ne(function(t){var e=Ts(t);return Fs(e)&&(e=L),Ze(de(t,1,Fs,!0),Xi(e,2))}),io=Ne(function(t){var e="function"==typeof(e=Ts(t))?e:L;return Ze(de(t,1,Fs,!0),L,e)}),so=Ne(function(t,e){return Fs(t)?he(t,e):[]}),no=Ne(function(t){return ii(l(t,Fs))}),ro=Ne(function(t){var e=Ts(t);return Fs(e)&&(e=L),ii(l(t,Fs),Xi(e,2))}),oo=Ne(function(t){var e="function"==typeof(e=Ts(t))?e:L;return ii(l(t,Fs),L,e)}),ao=Ne(Ds),lo=Ne(function(t){var e;return Ss(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:L)?(t.pop(),e):L)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,s=this.__wrapped__,n=function(e){return ne(e,t)};return!(1=e}),xo=Ke(function(){return arguments}())?Ke:function(t){return js(t)&&En.call(t,"callee")&&!zn.call(t,"callee")},Eo=yn.isArray,Po=zt?O(zt):function(t){return js(t)&&"[object ArrayBuffer]"==Te(t)},Ro=ir||mn,Mo=Vt?O(Vt):function(t){return js(t)&&"[object Date]"==Te(t)},Bo=Gt?O(Gt):function(t){return js(t)&&"[object Map]"==Ur(t)},Fo=Xt?O(Xt):function(t){return js(t)&&"[object RegExp]"==Te(t)},Ho=$t?O($t):function(t){return js(t)&&"[object Set]"==Ur(t)},ko=qt?O(qt):function(t){return js(t)&&Us(t.length)&&!!Et[Te(t)]},Lo=Ri(Ee),Uo=Ri(function(t,e){return t<=e}),Wo=mi(function(t,e){if(ns(e)||Bs(e))gi(e,sn(e),t);else for(var i in e)En.call(e,i)&&Nt(t,i,e[i])}),jo=mi(function(t,e){gi(e,nn(e),t)}),No=mi(function(t,e,i,s){gi(e,nn(e),t,s)}),zo=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),Vo=ji(ne),Go=Ne(function(t,e){t=Sn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},i.ary=Is,i.assign=Wo,i.assignIn=jo,i.assignInWith=No,i.assignWith=zo,i.at=Vo,i.before=xs,i.bind=vo,i.bindAll=pa,i.bindKey=wo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Eo(t)?t:[t]},i.chain=bs,i.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===L)?1:or(qs(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=yn(Qn(i/e));s(e=i||e===L?1:qs(e))?0:e,s):[]},i.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===L?1:qs(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=qs(i))&&(i=-i>n?0:n+i),0>(s=s===L||s>n?n:qs(s))&&(s+=n),s=i>s?0:Ys(s);i>>0)?(t=Qs(t))&&("string"==typeof e||null!=e&&!Fo(e))&&(!(e=Je(e))&&Ct.test(t))?ai(k(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new An("Expected a function");return e=null==e?0:or(qs(e),0),Ne(function(i){var s=i[e];return i=ai(i,0,e),s&&p(i,s),n(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===L?1:qs(e))?0:e):[]},i.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===L?1:qs(e)))?0:e,s):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new An("Expected a function");return Ws(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),Es(t,e,{leading:s,maxWait:e,trailing:n})},i.thru=Ks,i.toArray=Xs,i.toPairs=ea,i.toPairsIn=ia,i.toPath=function(t){return Eo(t)?c(t,cs):Gs(t)?[t]:fi(Vr(Qs(t)))},i.toPlainObject=Zs,i.transform=function(t,e,i){var s=Eo(t),n=s||Ro(t)||ko(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=n?s?new r:[]:Ws(t)&&ks(r)?Cr(jn(t)):{}}return(n?o:fe)(t,function(t,s,n){return e(i,t,s,n)}),i},i.unary=function(t){return Is(t,1)},i.union=to,i.unionBy=eo,i.unionWith=io,i.uniq=function(t){return t&&t.length?Ze(t):[]},i.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:L,t&&t.length?Ze(t,L,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=Ds,i.unzipWith=Ss,i.update=function(t,e,i){return null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),void 0)),t},i.updateWith=function(t,e,i,s){return s="function"==typeof s?s:L,null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),s)),t},i.values=on,i.valuesIn=function(t){return null==t?[]:C(t,nn(t))},i.without=so,i.words=hn,i.wrap=function(t,e){return Ko(ri(e),t)},i.xor=no,i.xorBy=ro,i.xorWith=oo,i.zip=ao,i.zipObject=function(t,e){return si(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return si(t||[],e||[],ze)},i.zipWith=lo,i.entries=ea,i.entriesIn=ia,i.extend=jo,i.extendWith=No,dn(i,i),i.add=Da,i.attempt=ca,i.camelCase=sa,i.capitalize=an,i.ceil=Sa,i.clamp=function(t,e,i){return i===L&&(i=e,e=L),i!==L&&(i=(i=Js(i))==i?i:0),e!==L&&(e=(e=Js(e))==e?e:0),re(Js(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:L)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:L)},i.conformsTo=function(t,e){return null==e||ae(t,e,sn(e))},i.deburr=ln,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=ba,i.endsWith=function(t,e,i){t=Qs(t),e=Je(e);var s=t.length;s=i=i===L?s:re(qs(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},i.eq=Ms,i.escape=function(t){return(t=Qs(t))&&q.test(t)?t.replace(X,Zt):t},i.escapeRegExp=function(t){return(t=Qs(t))&&st.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var s=Eo(t)?a:ue;return i&&es(t,e,i)&&(e=L),s(t,Xi(e,3))},i.find=co,i.findIndex=gs,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=po,i.findLastIndex=_s,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=Ka,i.forEach=As,i.forEachRight=Os,i.forIn=function(t,e){return null==t?t:Er(t,Xi(e,3),nn)},i.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),nn)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=tn,i.gt=Co,i.gte=Io,i.has=function(t,e){return null!=t&&Ji(t,e,we)},i.hasIn=en,i.head=ys,i.identity=cn,i.includes=function(t,e,i,s){return t=Bs(t)?t:on(t),i=i&&!s?qs(i):0,s=t.length,0>i&&(i=or(s+i,0)),Vs(t)?i<=s&&-1(i=null==i?0:qs(i))&&(i=or(s+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=$s(e),i===L?(i=e,e=0):i=$s(i),(t=Js(t))>=ar(e,i)&&t=t},i.isSet=Ho,i.isString=Vs,i.isSymbol=Gs,i.isTypedArray=ko,i.isUndefined=function(t){return t===L},i.isWeakMap=function(t){return js(t)&&"[object WeakMap]"==Ur(t)},i.isWeakSet=function(t){return js(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":nr.call(t,e)},i.kebabCase=na,i.last=Ts,i.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==L&&(n=0>(n=qs(i))?or(s+n,0):ar(n,s-1)),e==e)t:{for(i=n+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=m(t,v,n,!0);return t},i.lowerCase=ra,i.lowerFirst=oa,i.lt=Lo,i.lte=Uo,i.max=function(t){return t&&t.length?ce(t,cn,ve):L},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),ve):L},i.mean=function(t){return w(t,cn)},i.meanBy=function(t,e){return w(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,cn,Ee):L},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),Ee):L},i.stubArray=_n,i.stubFalse=mn,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Aa,i.nth=function(t,e){return t&&t.length?Fe(t,qs(e)):L},i.noConflict=function(){return kt._===this&&(kt._=Fn),this},i.noop=fn,i.now=To,i.pad=function(t,e,i){t=Qs(t);var s=(e=qs(e))?H(t):0;return!e||s>=e?t:xi(tr(e=(e-s)/2),i)+t+xi(Qn(e),i)},i.padEnd=function(t,e,i){t=Qs(t);var s=(e=qs(e))?H(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var s=Eo(t)?d:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Ir)},i.reduceRight=function(t,e,i){var s=Eo(t)?f:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,xr)},i.repeat=function(t,e,i){return e=(i?es(t,e,i):e===L)?1:qs(e),je(Qs(t),e)},i.replace=function(){var t=arguments,e=Qs(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=L);++s(t=qs(t))||9007199254740991=r)return t;if(1>(r=i-H(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===L)return i+s;if(o&&(r+=i.length-r),Fo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=bn(n.source,Qs(dt.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===L?r:l)}}else t.indexOf(Je(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},i.unescape=function(t){return(t=Qs(t))&&$.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++Pn;return Qs(t)+e},i.upperCase=ha,i.upperFirst=ua,i.each=As,i.eachRight=Os,i.first=ys,dn(i,function(){var t={};return fe(i,function(e,s){En.call(i.prototype,s)||(t[s]=e)}),t}(),{chain:!1}),i.VERSION="4.17.11",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){Dt.prototype[t]=function(i){i=i===L?1:or(qs(i),0);var s=this.__filtered__&&!e?new Dt(this):this.clone();return s.__filtered__?s.__takeCount__=ar(i,s.__takeCount__):s.__views__.push({size:ar(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Dt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Dt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");Dt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Dt.prototype[t]=function(){return this.__filtered__?new Dt(this):this[i](1)}}),Dt.prototype.compact=function(){return this.filter(cn)},Dt.prototype.find=function(t){return this.filter(t).head()},Dt.prototype.findLast=function(t){return this.reverse().find(t)},Dt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new Dt(this):this.map(function(i){return be(i,t,e)})}),Dt.prototype.reject=function(t){return this.filter(Rs(Xi(t)))},Dt.prototype.slice=function(t,e){t=qs(t);var i=this;return i.__filtered__&&(0e)?new Dt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==L&&(i=0>(e=qs(e))?i.dropRight(-e):i.take(e-t)),i)},Dt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Dt.prototype.toArray=function(){return this.take(4294967295)},fe(Dt.prototype,function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),r=i[n?"take"+("last"==e?"Right":""):e],o=n||/^find/.test(e);r&&(i.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,l=e instanceof Dt,h=a[0],u=l||Eo(e),c=function(t){return t=r.apply(i,p([t],a)),n&&d?t[0]:t};u&&s&&"function"==typeof h&&1!=h.length&&(l=u=!1);var d=this.__chain__,f=!!this.__actions__.length;h=o&&!d,l=l&&!f;return!o&&u?(e=l?e:new Dt(this),(e=t.apply(e,a)).__actions__.push({func:Ks,args:[c],thisArg:L}),new S(e,d)):h&&l?t.apply(this,a):(e=this.thru(c),h?n?e.value()[0]:e.value():e)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=On[t],s=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Eo(i)?i:[],t)}return this[s](function(i){return e.apply(Eo(i)?i:[],t)})}}),fe(Dt.prototype,function(t,e){var s=i[e];if(s){var n=s.name+"";(Tr[n]||(Tr[n]=[])).push({name:e,func:s})}}),Tr[Ai(L,2).name]=[{name:"wrapper",func:L}],Dt.prototype.clone=function(){var t=new Dt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Dt.prototype.reverse=function(){if(this.__filtered__){var t=new Dt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Dt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=Eo(e),n=0>i,r=s?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?L:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof s;){var n=fs(i);n.__index__=0,n.__values__=L,e?r.__wrapped__=n:e=n;var r=n;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Dt?(this.__actions__.length&&(t=new Dt(this)),(t=t.reverse()).__actions__.push({func:Ks,args:[ws],thisArg:L}),new S(t,this.__chain__)):this.thru(ws)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Xn&&(i.prototype[Xn]=function(){return this}),i}();kt._=te,void 0===(s=function(){return te}.call(e,i,e,t))||(t.exports=s)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),n.get("Debugging Console","Enabled")&&this.openConsole(),n.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}const e=n.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=n.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=n.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${s}.${n}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a"),p=this._getErrorLogData();let d=`Date: ${(new Date).toString()}`+o.EOL;_.forEach(p,(t,e)=>{d+=e+": "+t+o.EOL}),t instanceof Object?(d+=`Name: ${t.name}`+o.EOL,d+=`Message: ${t.message}`+o.EOL,void 0!==t.filename&&(d+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(d+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(d+=`Column: ${t.columnNumber}`+o.EOL),d+=`Stack: ${t.stack}`+o.EOL+o.EOL):d+=`Error: ${t}`+o.EOL+o.EOL,await r.writeSync(c,d),await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=n.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,s),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=n.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!n.get("Quick Load","Enabled"))return;const t=n.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!n.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=n.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.forEach(_.keys(t),e=>{const i=_.camelCase(e);i!==e&&(t[i]=t[e],delete t[e])}),t}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=n.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=n.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let s=null;const r=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const n=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,n,{__stats__:{...e,type:"file"}}):_.set(i,n,{__stats__:{...e,type:"directory"}}),s&&clearTimeout(s),s=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&r(t)})})};r(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){DKTools.IO.Entity.prototype.initialize.call(this,t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if((DKTools.IO.isLocalMode()||DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP)&&(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage())){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return DKTools.IO.Entity.prototype.exists.call(this)}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}else{if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return!this.isAudio()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName())}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):!this.isImage()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i})}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=e=>{return t.template instanceof RegExp?e=_.filter(e,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(e=_.filter(e,e=>e===t.template)),{data:_.reduce(e,(t,e)=>{const i=DKTools.IO.normalizePath(s+"/"+e);return DKTools.IO.isFile(i)?t.push(new DKTools.IO.File(i)):DKTools.IO.isDirectory(i)&&t.push(new DKTools.IO.Directory(i)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const i=this.getFullPath().split("\\"),s=_.get(DKTools.IO.stamp,i,{}),n=Object.keys(s);return t.sync?e(n):(t.onSuccess(e(n),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const i=DKTools.IO.fs,s=this.getFullPath(),n=this.getAbsolutePath();if(!t.sync)return i.readdir(n,t.options,(i,s)=>{i?this.__processError(i,t.onError):t.onSuccess(e(s),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const s=i.readdirSync(n,t.options);return e(s)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().then(t=>t,()=>null)}static async _toJson(t){return t.json().then(t=>t,()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},initialParams:{get:function(){return this._initialParams||(this._initialParams=PluginManager.parameters(this._pluginName)),this._initialParams},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=n.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&n.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode())throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),_.forEach(n,i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{const i=new DKTools.IO.File(e.path),s=i.getFullPath();i.isFile()?this._queue[t][s]||(this._queue[t][s]=e):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(y)&&(y=r*parseFloat(y)),n(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,s&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,s&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{Window_Base.prototype.processEscapeCharacter.call(this,t,e)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),s=this.anchor;return i.x+=this.width*s.x,i.y+=this.height*s.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/parallaxes/",t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/tilesets/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.anchor;this.move(i.x+this.width*s.x,i.y+this.height*s.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){return"GameFont"},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){return 28},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=_.defaultTo(t,this.standardOpacity())},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/parallaxes/",t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/tilesets/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.width-t),o=Math.min(s,n.height-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.getLocalPoint(t,e),n=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=this.height;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const n=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.printLoadingError;Graphics.printLoadingError=function(t){l.call(this,t),DKTools.Utils.logError(`Failed to load: ${t}`)};const h=Graphics.initialize;Graphics.initialize=function(t,e,i){h.call(this,t,e,i);const s=n.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=n.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):u.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return n.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return n.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const s=this._getErrorMessageForErrorPrint(),n=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return s&&(o=''+s+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),n&&(o+='
'+n+"

"),o};const c=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){c.call(this),this._errorPrinter&&n.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const p=TouchInput.initialize;TouchInput.initialize=function(){p.call(this);const t=n.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const d=TouchInput.clear;TouchInput.clear=function(){d.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const f=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,f.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const g=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const m=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const y=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const T=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const v=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);v.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const w=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){w.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const D=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):D.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const S=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!S.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()};const b=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):b.call(this,t,e)};const K=SceneManager.initialize;SceneManager.initialize=async function(){await K.call(this),await DKTools.StartupManager.initialize()};const A=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=n.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,A.call(this),DKTools.Utils.isNwjs()&&this.updateResolution()}else A.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;t>0&&e>0&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const O=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(O.call(this,t),t.ctrlKey||t.altKey)return;const e=n.get("Quick Load","Key Code"),i=n.get("Screenshots","Key Code"),s=n.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:n.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const C=SceneManager.catchException;SceneManager.catchException=function(t){C.call(this,t),t instanceof Error&&n.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const I=SceneManager.onError;SceneManager.onError=function(t){I.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const x=SceneManager.goto;SceneManager.goto=function(t){x.call(this,t),DKTools.Utils.__hideGrid()};const E=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){E.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const P=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return P.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const R=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){R.call(this),this._preloader.finish()};const M=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return M.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const B=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=n.get("Quick Start");t.Enabled?(B.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):B.call(this)};const F=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&F.call(this)};const H=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||H.call(this)};const k=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||k.call(this)};const L=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){L.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)}}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file diff --git a/release/DKTools.js b/release/DKTools.js index ab8af25..496af9d 100644 --- a/release/DKTools.js +++ b/release/DKTools.js @@ -1 +1 @@ -!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var s;window.Imported=window.Imported||{},window.Imported.DKTools="7.0.0",function(){function n(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,$=RegExp(G.source),q=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,st=RegExp(it.source),nt=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,wt=/['\n\r\u2028\u2029\\]/g,Dt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Dt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Dt,"g"),Ct=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),Ot=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),It=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ht="object"==typeof global&&global&&global.Object===Object&&global,Ft="object"==typeof self&&self&&self.Object===Object&&self,Lt=Ht||Ft||Function("return this")(),kt=e&&!e.nodeType&&e,Ut=kt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===kt,jt=Wt&&Ht.process,Nt=function(){try{var t=Ut&&Ut.f&&Ut.f("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,$t=Nt&&Nt.isSet,qt=Nt&&Nt.isTypedArray,Yt=D("length"),Zt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Jt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(Ws(t)&&!xo(t)&&!(t instanceof Dt)){if(t instanceof S)return t;if(xn.call(t,"__wrapped__"))return ds(t)}return new S(t)}function s(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=k}function Dt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,s,n,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=n?i(t,s,n,r):i(t)),a!==k)return a;if(!Us(t))return t;if(s=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xn.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=kr(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Po(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(a=h||p?{}:Ji(t),!l)return h?function(t,e){return gi(t,Lr(t),e)}(t,function(t,e){return t&&gi(e,sn(e),t)}(a,t)):function(t,e){return gi(t,Fr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return n?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Kr?Dn(Kr.call(t)):{}}}(t,c,l)}}if(r||(r=new Ft),n=r.get(t))return n;if(r.set(t,a),Ho(t))return t.forEach(function(s){a.add(oe(s,e,i,s,t,r))}),a;if(Mo(t))return t.forEach(function(s,n){a.set(n,oe(s,e,i,n,t,r))}),a;h=u?h?zi:Ni:h?sn:en;var d=s?k:h(t);return o(d||t,function(s,n){d&&(s=t[n=s]),Nt(a,n,oe(s,e,i,n,t,r))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Dn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===k&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new Kn("Expected a function");return jr(function(){t.apply(k,i)},e)}function he(t,e,i,s){var n=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,C(i))),s?(r=u,o=!1):200<=e.length&&(r=I,o=!1,e=new Ht(e));t:for(;++ne}function we(t,e){return null!=t&&xn.call(t,e)}function De(t,e){return null!=t&&e in Dn(t)}function Se(t,e,i){for(var s=i?u:h,n=t[0].length,r=t.length,o=r,a=mn(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,C(e))),l=or(d.length,l),a[o]=!i&&(e||120<=n&&120<=d.length)?new Ht(o&&d):k}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[us(ys(e))])?k:n(e,t,i)}function Ke(t){return Ws(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,s,n){if(t===e)e=!0;else if(null==t||null==e||!Ws(t)&&!Ws(e))e=t!=t&&e!=e;else t:{var r=xo(t),o=xo(e),a=r?"[object Array]":kr(t),l=o?"[object Array]":kr(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Po(t)){if(!Po(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new Ft),e=r||Fo(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new kn(t),new kn(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Rs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=H),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Kr)return Kr.call(t)==Kr.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&xn.call(t,"__wrapped__"),a=o&&xn.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new Ft),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new Ft),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xn.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:k}function Fe(t,e,i){var s=-1;return e=c(e.length?e:[un],C(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t){return{a:c(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a?l:l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function Le(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=mn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Vs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[us(ys(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Je(t[0]):[];for(var n=-1,r=mn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Un?Un(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new kn(e).set(new kn(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==k,s=null===t,n=t==t,r=Vs(t),o=e!==k,a=null===e,l=e==e,h=Vs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?k:r,n=1),e=Dn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Jn(t/F(e))),Ot.test(e)?ai(L(i),0,t).join(""):i.slice(0,t))}function Ei(t,e,i,s){var r=1&e,o=Di(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=s.length,c=mn(u+l),p=this&&this!==Lt&&this instanceof e?o:t;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:or(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===k?l?0:t.length:rr(r[9]-h,0))&&24&e&&(e&=-25),as((p?Pr:Wr)(e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(k,r):Ei(t,e,i,s):function(t,e,i){var s=1&e,n=Di(t);return function e(){return(this&&this!==Lt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),r),t,e)}function Li(t,e,i,s){return t===k||Rs(t,Cn[i])&&!xn.call(s,i)?e:t}function ki(t,e,i,s,n,r){return Us(t)&&Us(e)&&(r.set(e,t),Be(t,e,k,ki,r),r.delete(e)),t}function Ui(t){return Ns(t)?k:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ht:k;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:$s(i))&&(i=rr(s+i,0)),m(t,Xi(e,3),i)):-1}function gs(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==k&&(n=$s(i),n=0>i?rr(s+n,0):or(n,s-1)),m(t,Xi(e,3),n,!0)}function _s(t){return null!=t&&t.length?de(t,1):[]}function ms(t){return t&&t.length?t[0]:k}function ys(t){var e=null==t?0:t.length;return e?t[e-1]:k}function Ts(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function vs(t){return null==t?t:ur.call(t)}function ws(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Bs(t))return e=rr(t.length,e),!0}),A(e,function(e){return c(t,D(e))})}function Ds(t,e){if(!t||!t.length)return[];var i=ws(t);return null==e?i:c(i,function(t){return n(e,k,t)})}function Ss(t){return(t=i(t)).__chain__=!0,t}function bs(t,e){return e(t)}function Ks(t,e){return(xo(t)?o:Or)(t,Xi(e,3))}function As(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Ir)(t,Xi(e,3))}function Cs(t,e){return(xo(t)?c:Pe)(t,Xi(e,3))}function Os(t,e,i){return e=i?k:e,e=t&&null==e?t.length:e,Fi(t,128,k,k,k,k,e)}function Is(t,e){var i;if("function"!=typeof e)throw new Kn("Expected a function");return t=$s(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=k),i}}function xs(t,e,i){function s(e){var i=l,s=h;return l=h=k,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===k||i>=e||0>i||_&&t>=u}function r(){var t=yo();if(n(t))return o(t);var i,s=jr;i=t-f,t=e-(t-d),i=_?or(t,u-i):t,p=s(r,i)}function o(t){return p=k,m&&l?s(t):(l=h=k,c)}function a(){var t=yo(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===k)return f=t=d,p=jr(r,e),g?s(t):c;if(_)return p=jr(r,e),s(d)}return p===k&&(p=jr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new Kn("Expected a function");return e=Ys(e)||0,Us(i)&&(g=!!i.leading,u=(_="maxWait"in i)?rr(Ys(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==k&&Mr(p),f=0,l=d=h=p=k},a.flush=function(){return p===k?c:o(yo())},a}function Es(t,e){function i(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)}if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Kn("Expected a function");return i.cache=new(Es.Cache||Rt),i}function Ps(t){if("function"!=typeof t)throw new Kn("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Rs(t,e){return t===e||t!=t&&e!=e}function Ms(t){return null!=t&&ks(t.length)&&!Fs(t)}function Bs(t){return Ws(t)&&Ms(t)}function Hs(t){if(!Ws(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ns(t)}function Fs(t){return!!Us(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Ls(t){return"number"==typeof t&&t==$s(t)}function ks(t){return"number"==typeof t&&-1=t}function Us(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Ws(t){return null!=t&&"object"==typeof t}function js(t){return"number"==typeof t||Ws(t)&&"[object Number]"==Te(t)}function Ns(t){return!(!Ws(t)||"[object Object]"!=Te(t))&&(null===(t=Wn(t))||"function"==typeof(t=xn.call(t,"constructor")&&t.constructor)&&t instanceof t&&In.call(t)==Mn)}function zs(t){return"string"==typeof t||!xo(t)&&Ws(t)&&"[object String]"==Te(t)}function Vs(t){return"symbol"==typeof t||Ws(t)&&"[object Symbol]"==Te(t)}function Gs(t){if(!t)return[];if(Ms(t))return zs(t)?L(t):fi(t);if(Gn&&t[Gn]){t=t[Gn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=kr(t))?R:"[object Set]"==e?H:rn)(t)}function Xs(t){return t?(t=Ys(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function $s(t){var e=(t=Xs(t))%1;return t==t?e?t-e:t:0}function qs(t){return t?re($s(t),0,4294967295):0}function Ys(t){if("number"==typeof t)return t;if(Vs(t))return W;if(Us(t)&&(t=Us(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(nt,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Zs(t){return gi(t,sn(t))}function Js(t){return null==t?"":Ze(t)}function Qs(t,e,i){return(t=null==t?k:me(t,e))===k?i:t}function tn(t,e){return null!=t&&Zi(t,e,De)}function en(t){return Ms(t)?kt(t):xe(t)}function sn(t){if(Ms(t))t=kt(t,!0);else if(Us(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&xn.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Dn(t))e.push(i);t=e}return t}function nn(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),Le(t,i,function(t,i){return e(t,i[0])})}function rn(t){return null==t?[]:O(t,en(t))}function on(t){return ha(Js(t).toLowerCase())}function an(t){return(t=Js(t))&&t.replace(Tt,Zt).replace(Kt,"")}function ln(t,e,i){return t=Js(t),(e=i?k:e)===k?It.test(t)?t.match(Ct)||[]:t.match(ut)||[]:t.match(e)||[]}function hn(t){return function(){return t}}function un(t){return t}function cn(t){return Ie("function"==typeof t?t:oe(t,1))}function pn(t,e,i){var s=en(e),n=_e(e,s);null!=i||Us(e)&&(n.length||!s.length)||(i=e,e=t,t=this,n=_e(e,en(e)));var r=!(Us(i)&&"chain"in i&&!i.chain),a=Fs(t);return o(n,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,p([this.value()],arguments))})}),t}function dn(){}function fn(t){return is(t)?D(us(t)):function(t){return function(e){return me(e,t)}}(t)}function gn(){return[]}function _n(){return!1}var mn=(e=null==e?Lt:te.defaults(Lt.Object(),e,te.pick(Lt,xt))).Array,yn=e.Date,Tn=e.Error,vn=e.Function,wn=e.Math,Dn=e.Object,Sn=e.RegExp,bn=e.String,Kn=e.TypeError,An=mn.prototype,Cn=Dn.prototype,On=e["__core-js_shared__"],In=vn.prototype.toString,xn=Cn.hasOwnProperty,En=0,Pn=function(){var t=/[^.]+$/.exec(On&&On.keys&&On.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Rn=Cn.toString,Mn=In.call(Dn),Bn=Lt._,Hn=Sn("^"+In.call(xn).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fn=Wt?e.Buffer:k,Ln=e.Symbol,kn=e.Uint8Array,Un=Fn?Fn.g:k,Wn=M(Dn.getPrototypeOf,Dn),jn=Dn.create,Nn=Cn.propertyIsEnumerable,zn=An.splice,Vn=Ln?Ln.isConcatSpreadable:k,Gn=Ln?Ln.iterator:k,Xn=Ln?Ln.toStringTag:k,$n=function(){try{var t=Yi(Dn,"defineProperty");return t({},"",{}),t}catch(t){}}(),qn=e.clearTimeout!==Lt.clearTimeout&&e.clearTimeout,Yn=yn&&yn.now!==Lt.Date.now&&yn.now,Zn=e.setTimeout!==Lt.setTimeout&&e.setTimeout,Jn=wn.ceil,Qn=wn.floor,tr=Dn.getOwnPropertySymbols,er=Fn?Fn.isBuffer:k,ir=e.isFinite,sr=An.join,nr=M(Dn.keys,Dn),rr=wn.max,or=wn.min,ar=yn.now,lr=e.parseInt,hr=wn.random,ur=An.reverse,cr=Yi(e,"DataView"),pr=Yi(e,"Map"),dr=Yi(e,"Promise"),fr=Yi(e,"Set"),gr=Yi(e,"WeakMap"),_r=Yi(Dn,"create"),mr=gr&&new gr,yr={},Tr=cs(cr),vr=cs(pr),wr=cs(dr),Dr=cs(fr),Sr=cs(gr),br=Ln?Ln.prototype:k,Kr=br?br.valueOf:k,Ar=br?br.toString:k,Cr=function(){function t(){}return function(e){return Us(e)?jn?jn(e):(t.prototype=e,e=new t,t.prototype=k,e):{}}}();i.templateSettings={escape:Y,evaluate:Z,interpolate:J,variable:"",imports:{_:i}},i.prototype=s.prototype,i.prototype.constructor=i,S.prototype=Cr(s.prototype),S.prototype.constructor=S,Dt.prototype=Cr(s.prototype),Dt.prototype.constructor=Dt,St.prototype.clear=function(){this.__data__=_r?_r(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return _r?"__lodash_hash_undefined__"===(t=e[t])?k:t:xn.call(e,t)?e[t]:k},St.prototype.has=function(t){var e=this.__data__;return _r?e[t]!==k:xn.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=_r&&e===k?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():zn.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?k:e[t][1]},At.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(pr||At),string:new St}},Rt.prototype.delete=function(t){return t=$i(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return $i(this,t).get(t)},Rt.prototype.has=function(t){return $i(this,t).has(t)},Rt.prototype.set=function(t,e){var i=$i(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ht.prototype.add=Ht.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ht.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.clear=function(){this.__data__=new At,this.size=0},Ft.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var s=i.__data__;if(!pr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(s)}return i.set(t,e),this.size=i.size,this};var Or=yi(fe),Ir=yi(ge,!0),xr=Ti(),Er=Ti(!0),Pr=mr?function(t,e){return mr.set(t,e),t}:un,Rr=$n?function(t,e){return $n(t,"toString",{configurable:!0,enumerable:!1,value:hn(e),writable:!0})}:un,Mr=qn||function(t){return Lt.clearTimeout(t)},Br=fr&&1/H(new fr([,-0]))[1]==U?function(t){return new fr(t)}:dn,Hr=mr?function(t){return mr.get(t)}:dn,Fr=tr?function(t){return null==t?[]:(t=Dn(t),l(tr(t),function(e){return Nn.call(t,e)}))}:gn,Lr=tr?function(t){for(var e=[];t;)p(e,Fr(t)),t=Wn(t);return e}:gn,kr=Te;(cr&&"[object DataView]"!=kr(new cr(new ArrayBuffer(1)))||pr&&"[object Map]"!=kr(new pr)||dr&&"[object Promise]"!=kr(dr.resolve())||fr&&"[object Set]"!=kr(new fr)||gr&&"[object WeakMap]"!=kr(new gr))&&(kr=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:k)?cs(t):"")switch(t){case Tr:return"[object DataView]";case vr:return"[object Map]";case wr:return"[object Promise]";case Dr:return"[object Set]";case Sr:return"[object WeakMap]"}return e});var Ur=On?Fs:_n,Wr=ls(Pr),jr=Zn||function(t,e){return Lt.setTimeout(t,e)},Nr=ls(Rr),zr=function(t){var e=(t=Es(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,s,n){e.push(s?n.replace(ct,"$1"):i||t)}),e}),Vr=Ne(function(t,e){return Bs(t)?he(t,de(e,1,Bs,!0)):[]}),Gr=Ne(function(t,e){var i=ys(e);return Bs(i)&&(i=k),Bs(t)?he(t,de(e,1,Bs,!0),Xi(i,2)):[]}),Xr=Ne(function(t,e){var i=ys(e);return Bs(i)&&(i=k),Bs(t)?he(t,de(e,1,Bs,!0),k,i):[]}),$r=Ne(function(t){var e=c(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),qr=Ne(function(t){var e=ys(t),i=c(t,ni);return e===ys(i)?e=k:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Yr=Ne(function(t){var e=ys(t),i=c(t,ni);return(e="function"==typeof e?e:k)&&i.pop(),i.length&&i[0]===t[0]?Se(i,k,e):[]}),Zr=Ne(Ts),Jr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,c(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),Qr=Ne(function(t){return Je(de(t,1,Bs,!0))}),to=Ne(function(t){var e=ys(t);return Bs(e)&&(e=k),Je(de(t,1,Bs,!0),Xi(e,2))}),eo=Ne(function(t){var e="function"==typeof(e=ys(t))?e:k;return Je(de(t,1,Bs,!0),k,e)}),io=Ne(function(t,e){return Bs(t)?he(t,e):[]}),so=Ne(function(t){return ii(l(t,Bs))}),no=Ne(function(t){var e=ys(t);return Bs(e)&&(e=k),ii(l(t,Bs),Xi(e,2))}),ro=Ne(function(t){var e="function"==typeof(e=ys(t))?e:k;return ii(l(t,Bs),k,e)}),oo=Ne(ws),ao=Ne(function(t){var e;return Ds(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:k)?(t.pop(),e):k)}),lo=ji(function(t){function e(e){return ne(e,t)}var i=t.length,s=i?t[0]:0,n=this.__wrapped__;return!(1=e}),Io=Ke(function(){return arguments}())?Ke:function(t){return Ws(t)&&xn.call(t,"callee")&&!Nn.call(t,"callee")},xo=mn.isArray,Eo=zt?C(zt):function(t){return Ws(t)&&"[object ArrayBuffer]"==Te(t)},Po=er||_n,Ro=Vt?C(Vt):function(t){return Ws(t)&&"[object Date]"==Te(t)},Mo=Gt?C(Gt):function(t){return Ws(t)&&"[object Map]"==kr(t)},Bo=Xt?C(Xt):function(t){return Ws(t)&&"[object RegExp]"==Te(t)},Ho=$t?C($t):function(t){return Ws(t)&&"[object Set]"==kr(t)},Fo=qt?C(qt):function(t){return Ws(t)&&ks(t.length)&&!!Et[Te(t)]},Lo=Ri(Ee),ko=Ri(function(t,e){return t<=e}),Uo=mi(function(t,e){if(ns(e)||Ms(e))gi(e,en(e),t);else for(var i in e)xn.call(e,i)&&Nt(t,i,e[i])}),Wo=mi(function(t,e){gi(e,sn(e),t)}),jo=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),No=mi(function(t,e,i,s){gi(e,en(e),t,s)}),zo=ji(ne),Vo=Ne(function(t,e){t=Dn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},i.ary=Os,i.assign=Uo,i.assignIn=Wo,i.assignInWith=jo,i.assignWith=No,i.at=zo,i.before=Is,i.bind=To,i.bindAll=ca,i.bindKey=vo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},i.chain=Ss,i.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===k)?1:rr($s(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=mn(Jn(i/e));s(e=i||e===k?1:$s(e))?0:e,s):[]},i.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===k?1:$s(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=$s(i))&&(i=-i>n?0:n+i),0>(s=s===k||s>n?n:$s(s))&&(s+=n),s=i>s?0:qs(s);i>>0)?(t=Js(t))&&("string"==typeof e||null!=e&&!Bo(e))&&(!(e=Ze(e))&&Ot.test(t))?ai(L(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new Kn("Expected a function");return e=null==e?0:rr($s(e),0),Ne(function(i){var s=i[e];return i=ai(i,0,e),s&&p(i,s),n(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===k?1:$s(e))?0:e):[]},i.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===k?1:$s(e)))?0:e,s):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new Kn("Expected a function");return Us(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xs(t,e,{leading:s,maxWait:e,trailing:n})},i.thru=bs,i.toArray=Gs,i.toPairs=ta,i.toPairsIn=ea,i.toPath=function(t){return xo(t)?c(t,us):Vs(t)?[t]:fi(zr(Js(t)))},i.toPlainObject=Zs,i.transform=function(t,e,i){var s=xo(t),n=s||Po(t)||Fo(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=n?s?new r:[]:Us(t)&&Fs(r)?Cr(Wn(t)):{}}return(n?o:fe)(t,function(t,s,n){return e(i,t,s,n)}),i},i.unary=function(t){return Os(t,1)},i.union=Qr,i.unionBy=to,i.unionWith=eo,i.uniq=function(t){return t&&t.length?Je(t):[]},i.uniqBy=function(t,e){return t&&t.length?Je(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:k,t&&t.length?Je(t,k,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=ws,i.unzipWith=Ds,i.update=function(t,e,i){return null==t?t:ze(t,e,ri(i)(me(t,e)),void 0)},i.updateWith=function(t,e,i,s){return s="function"==typeof s?s:k,null!=t&&(t=ze(t,e,ri(i)(me(t,e)),s)),t},i.values=rn,i.valuesIn=function(t){return null==t?[]:O(t,sn(t))},i.without=io,i.words=ln,i.wrap=function(t,e){return bo(ri(e),t)},i.xor=so,i.xorBy=no,i.xorWith=ro,i.zip=oo,i.zipObject=function(t,e){return si(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return si(t||[],e||[],ze)},i.zipWith=ao,i.entries=ta,i.entriesIn=ea,i.extend=Wo,i.extendWith=jo,pn(i,i),i.add=wa,i.attempt=ua,i.camelCase=ia,i.capitalize=on,i.ceil=Da,i.clamp=function(t,e,i){return i===k&&(i=e,e=k),i!==k&&(i=(i=Ys(i))==i?i:0),e!==k&&(e=(e=Ys(e))==e?e:0),re(Ys(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:k)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:k)},i.conformsTo=function(t,e){return null==e||ae(t,e,en(e))},i.deburr=an,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=Sa,i.endsWith=function(t,e,i){t=Js(t),e=Ze(e);var s=t.length;s=i=i===k?s:re($s(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},i.eq=Rs,i.escape=function(t){return(t=Js(t))&&q.test(t)?t.replace(X,Jt):t},i.escapeRegExp=function(t){return(t=Js(t))&&st.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var s=xo(t)?a:ue;return i&&es(t,e,i)&&(e=k),s(t,Xi(e,3))},i.find=uo,i.findIndex=fs,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=co,i.findLastIndex=gs,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=ba,i.forEach=Ks,i.forEachRight=As,i.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),sn)},i.forInRight=function(t,e){return null==t?t:Er(t,Xi(e,3),sn)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=Qs,i.gt=Co,i.gte=Oo,i.has=function(t,e){return null!=t&&Zi(t,e,we)},i.hasIn=tn,i.head=ms,i.identity=un,i.includes=function(t,e,i,s){return t=Ms(t)?t:rn(t),i=i&&!s?$s(i):0,s=t.length,0>i&&(i=rr(s+i,0)),zs(t)?i<=s&&-1(i=null==i?0:$s(i))&&(i=rr(s+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=Xs(e),i===k?(i=e,e=0):i=Xs(i),(t=Ys(t))>=or(e,i)&&t=t},i.isSet=Ho,i.isString=zs,i.isSymbol=Vs,i.isTypedArray=Fo,i.isUndefined=function(t){return t===k},i.isWeakMap=function(t){return Ws(t)&&"[object WeakMap]"==kr(t)},i.isWeakSet=function(t){return Ws(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":sr.call(t,e)},i.kebabCase=sa,i.last=ys,i.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==k&&(n=0>(n=$s(i))?rr(s+n,0):or(n,s-1)),e==e){for(i=n+1;i--&&t[i]!==e;);t=i}else t=m(t,v,n,!0);return t},i.lowerCase=na,i.lowerFirst=ra,i.lt=Lo,i.lte=ko,i.max=function(t){return t&&t.length?ce(t,un,ve):k},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),ve):k},i.mean=function(t){return w(t,un)},i.meanBy=function(t,e){return w(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,un,Ee):k},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),Ee):k},i.stubArray=gn,i.stubFalse=_n,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Ka,i.nth=function(t,e){return t&&t.length?He(t,$s(e)):k},i.noConflict=function(){return Lt._===this&&(Lt._=Bn),this},i.noop=dn,i.now=yo,i.pad=function(t,e,i){t=Js(t);var s=(e=$s(e))?F(t):0;return!e||s>=e?t:xi(Qn(e=(e-s)/2),i)+t+xi(Jn(e),i)},i.padEnd=function(t,e,i){t=Js(t);var s=(e=$s(e))?F(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=hr(),or(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var s=xo(t)?d:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Or)},i.reduceRight=function(t,e,i){var s=xo(t)?f:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Ir)},i.repeat=function(t,e,i){return e=(i?es(t,e,i):e===k)?1:$s(e),je(Js(t),e)},i.replace=function(){var t=arguments,e=Js(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=k);++s(t=$s(t))||9007199254740991=r)return t;if(1>(r=i-F(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===k)return i+s;if(o&&(r+=i.length-r),Bo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=Sn(n.source,Js(dt.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===k?r:l)}}else t.indexOf(Ze(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},i.unescape=function(t){return(t=Js(t))&&$.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++En;return Js(t)+e},i.upperCase=la,i.upperFirst=ha,i.each=Ks,i.eachRight=As,i.first=ms,pn(i,function(){var t={};return fe(i,function(e,s){xn.call(i.prototype,s)||(t[s]=e)}),t}(),{chain:!1}),i.VERSION="4.17.10",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){Dt.prototype[t]=function(i){i=i===k?1:rr($s(i),0);var s=this.__filtered__&&!e?new Dt(this):this.clone();return s.__filtered__?s.__takeCount__=or(i,s.__takeCount__):s.__views__.push({size:or(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Dt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Dt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");Dt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Dt.prototype[t]=function(){return this.__filtered__?new Dt(this):this[i](1)}}),Dt.prototype.compact=function(){return this.filter(un)},Dt.prototype.find=function(t){return this.filter(t).head()},Dt.prototype.findLast=function(t){return this.reverse().find(t)},Dt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new Dt(this):this.map(function(i){return be(i,t,e)})}),Dt.prototype.reject=function(t){return this.filter(Ps(Xi(t)))},Dt.prototype.slice=function(t,e){t=$s(t);var i=this;return i.__filtered__&&(0e)?new Dt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==k&&(i=0>(e=$s(e))?i.dropRight(-e):i.take(e-t)),i)},Dt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Dt.prototype.toArray=function(){return this.take(4294967295)},fe(Dt.prototype,function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),r=i[n?"take"+("last"==e?"Right":""):e],o=n||/^find/.test(e);r&&(i.prototype[e]=function(){function e(t){return t=r.apply(i,p([t],l)),n&&d?t[0]:t}var a=this.__wrapped__,l=n?[1]:arguments,h=a instanceof Dt,u=l[0],c=h||xo(a);c&&s&&"function"==typeof u&&1!=u.length&&(h=c=!1);var d=this.__chain__,f=!!this.__actions__.length;u=o&&!d,h=h&&!f;return!o&&c?(a=h?a:new Dt(this),(a=t.apply(a,l)).__actions__.push({func:bs,args:[e],thisArg:k}),new S(a,d)):u&&h?t.apply(this,l):(a=this.thru(e),u?n?a.value()[0]:a.value():a)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=An[t],s=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(xo(i)?i:[],t)}return this[s](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(Dt.prototype,function(t,e){var s=i[e];if(s){var n=s.name+"";(yr[n]||(yr[n]=[])).push({name:e,func:s})}}),yr[Ai(k,2).name]=[{name:"wrapper",func:k}],Dt.prototype.clone=function(){var t=new Dt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Dt.prototype.reverse=function(){if(this.__filtered__){var t=new Dt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Dt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=xo(e),n=0>i,r=s?e.length:0;t=r;for(var o=this.__views__,a=0,l=-1,h=o.length;++l=this.__values__.length;return{done:t,value:t?k:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof s;){var n=ds(i);n.__index__=0,n.__values__=k,e?r.__wrapped__=n:e=n;var r=n;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Dt?(this.__actions__.length&&(t=new Dt(this)),(t=t.reverse()).__actions__.push({func:bs,args:[vs],thisArg:k}),new S(t,this.__chain__)):this.thru(vs)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Gn&&(i.prototype[Gn]=function(){return this}),i}();Lt._=te,void 0===(s=function(){return te}.call(e,i,e,t))||(t.exports=s)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),n.get("Debugging Console","Enabled")&&this.openConsole(),n.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}const e=n.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=n.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=n.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${s}.${n}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a");if(t instanceof Object){let e=`Date: ${(new Date).toString()}`+o.EOL+`Name: ${t.name}`+o.EOL+`Message: ${t.message}`+o.EOL;void 0!==t.filename&&(e+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(e+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(e+=`Column: ${t.columnNumber}`+o.EOL),e+=`Stack: ${t.stack}`+o.EOL+o.EOL,await r.writeSync(c,e)}else{const e=`Date: ${(new Date).toString()}`+o.EOL+`Error: ${t}`+o.EOL+o.EOL;await r.writeSync(c,e)}await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=n.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,s),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=n.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!n.get("Quick Load","Enabled"))return;const t=n.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!n.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=n.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.forEach(_.keys(t),e=>{const i=_.camelCase(e);i!==e&&(t[i]=t[e],delete t[e])}),t}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.events()[t]),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.events()[t]),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t}static absolutePathExists(t){return!!this.isLocalMode()&&this._fs.existsSync(t)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(!this.isLocalMode())return!1;const e=this.getAbsolutePath(t);return!!this.absolutePathExists(e)&&this._fs.lstatSync(e).isFile()}static isDirectory(t){if(!this.isLocalMode())return!1;const e=this.getAbsolutePath(t);return!!this.absolutePathExists(e)&&this._fs.lstatSync(e).isDirectory()}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){DKTools.IO.Entity.prototype.initialize.call(this,t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(DKTools.IO.isLocalMode()&&(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage())){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return DKTools.IO.Entity.prototype.exists.call(this)}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}else{const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return!this.isAudio()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName())}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):!this.isImage()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i})}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=DKTools.IO.fs,i=this.getFullPath(),s=this.getAbsolutePath(),n=e=>{return t.template instanceof RegExp?e=_.filter(e,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(e=_.filter(e,e=>e===t.template)),{data:_.reduce(e,(t,e)=>{const s=DKTools.IO.normalizePath(i+"/"+e);return DKTools.IO.isFile(s)?t.push(new DKTools.IO.File(s)):DKTools.IO.isDirectory(s)&&t.push(new DKTools.IO.Directory(s)),t},[]),status:DKTools.IO.OK}};if(!t.sync)return e.readdir(s,t.options,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess(n(i),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const i=e.readdirSync(s,t.options);return n(i)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().then(t=>t,()=>null)}static async _toJson(t){return t.json().then(t=>t,()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},initialParams:{get:function(){return this._initialParams||(this._initialParams=PluginManager.parameters(this._pluginName)),this._initialParams},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=n.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&n.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode())throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),_.forEach(n,i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{const i=new DKTools.IO.File(e.path),s=i.getFullPath();i.isFile()?this._queue[t][s]||(this._queue[t][s]=e):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){this.hasTarget()&&this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return DKTools.Utils.Array.contains(this._getProperties(),t)}hasProperties(){return DKTools.Utils.isFunction(this._properties)||Array.isArray(this._properties)&&this._properties.length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(y)&&(y=r*parseFloat(y)),n(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,s&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,s&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}moveWithAnchor(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.getRealSize(),n=this.anchor;this.move(i.x+n.x*s.width,i.y+n.y*s.height)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{Window_Base.prototype.processEscapeCharacter.call(this,t,e)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isInside=function(t,e){const i=this.canvasToLocalX(t),s=this.canvasToLocalY(e),n=this.width,r=this.height,o=this.anchor;return new Rectangle(-n*o.x,-r*o.y,n,r).contains(i,s)},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/parallaxes/",t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/tilesets/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){return"GameFont"},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){return 28},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.realWidth,this.realHeight)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=_.defaultTo(t,this.standardOpacity())},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/parallaxes/",t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/tilesets/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0},pressX:{get:function(){return this.canvasToLocalX(TouchInput.x)},configurable:!0},pressY:{get:function(){return this.canvasToLocalY(TouchInput.y)},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.realWidth-t),o=Math.min(s,n.realHeight-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._indexe)break}else if(r+i+t>e)break;r+=i+t}return n}getMaxPageCols(){return this.getMaxCols()}getMaxPageItems(){return this.isHorizontal()?this.getMaxPageCols():this.getMaxPageRows()*this.getMaxPageCols()}getRow(t){return Math.floor(t/this.getMaxCols())}getCurrentRow(){return this.getRow(this._index)}getItemRow(t){return this.hasItem(t)?this.getRow(t):-1}getRowItems(t){const e=[];if(DKTools.Utils.Number.inRange(t,0,this.getMaxRows())){const i=this.getMaxPageItems(),s=this.getMaxItems();let n=t*this.getMaxCols();for(let r=0;r0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.canvasToLocalX(t),n=this.canvasToLocalY(e),r=this.getMaxPageItems(),o=this.getMaxItems();let a=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.realWidth+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.realWidth,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.realHeight})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.realWidth-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.realHeight})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.realWidth-t)/2,i=e+t/2,s=this.realHeight;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.isInside=function(t,e){const i=this.canvasToLocalX(t),s=this.canvasToLocalY(e);return new Rectangle(0,0,this.width,this.height).contains(i,s)},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.realWidth=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.realHeight=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const n=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.printLoadingError;Graphics.printLoadingError=function(t){l.call(this,t),DKTools.Utils.logError(`Failed to load: ${t}`)};const h=Graphics.initialize;Graphics.initialize=function(t,e,i){h.call(this,t,e,i);const s=n.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=n.get("FPS Meter");if(t.Enabled){const e={toggleOn:null,graph:1,decimals:0,theme:t.Theme,history:t.History};this._fpsMeter=new FPSMeter(e),this._fpsMeter.hide()}else u.call(this)};const c=TouchInput.initialize;TouchInput.initialize=function(){c.call(this);const t=n.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const p=TouchInput.clear;TouchInput.clear=function(){p.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const d=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,d.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const f=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);f.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const g=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const m=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const y=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._mouseX=e,this._mouseY=i)};const T=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const v=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){v.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const w=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):w.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const D=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!D.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()};const S=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):S.call(this,t,e)};const b=SceneManager.initialize;SceneManager.initialize=async function(){await b.call(this),await DKTools.StartupManager.initialize()};const K=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=n.get("Screen Resolution"),e=t.Width,i=t.Height;t.Enabled?(this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,K.call(this),DKTools.Utils.isNwjs()&&this.updateResolution()):K.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;!Imported.ScreenResolution&&t>0&&e>0&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const A=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(A.call(this,t),t.ctrlKey||t.altKey)return;const e=n.get("Quick Load","Key Code"),i=n.get("Screenshots","Key Code"),s=n.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:n.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const C=SceneManager.catchException;SceneManager.catchException=function(t){C.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const O=SceneManager.onError;SceneManager.onError=function(t){O.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return this._scene instanceof t};const I=SceneManager.goto;SceneManager.goto=function(t){I.call(this,t),DKTools.Utils.__hideGrid()};const x=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){x.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const E=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return E.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const P=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return P.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const R=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=n.get("Quick Start");t.Enabled?(R.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):R.call(this)};const M=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&M.call(this)};const B=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||B.call(this)};const H=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||H.call(this)};const F=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){F.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)}}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file +!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var s;window.Imported=window.Imported||{},window.Imported.DKTools="8.0.0",function(){function n(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,$=RegExp(G.source),q=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,st=RegExp(it.source),nt=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,wt=/['\n\r\u2028\u2029\\]/g,Dt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Dt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Dt,"g"),Ot=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),Ct=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),It=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Et={};Et["[object Float32Array]"]=Et["[object Float64Array]"]=Et["[object Int8Array]"]=Et["[object Int16Array]"]=Et["[object Int32Array]"]=Et["[object Uint8Array]"]=Et["[object Uint8ClampedArray]"]=Et["[object Uint16Array]"]=Et["[object Uint32Array]"]=!0,Et["[object Arguments]"]=Et["[object Array]"]=Et["[object ArrayBuffer]"]=Et["[object Boolean]"]=Et["[object DataView]"]=Et["[object Date]"]=Et["[object Error]"]=Et["[object Function]"]=Et["[object Map]"]=Et["[object Number]"]=Et["[object Object]"]=Et["[object RegExp]"]=Et["[object Set]"]=Et["[object String]"]=Et["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ft="object"==typeof global&&global&&global.Object===Object&&global,Ht="object"==typeof self&&self&&self.Object===Object&&self,kt=Ft||Ht||Function("return this")(),Lt=e&&!e.nodeType&&e,Ut=Lt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===Lt,jt=Wt&&Ft.process,Nt=function(){try{var t=Ut&&Ut.require&&Ut.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,$t=Nt&&Nt.isSet,qt=Nt&&Nt.isTypedArray,Yt=D("length"),Jt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Zt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(js(t)&&!Eo(t)&&!(t instanceof Dt)){if(t instanceof S)return t;if(En.call(t,"__wrapped__"))return fs(t)}return new S(t)}function s(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=L}function Dt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,s,n,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=n?i(t,s,n,r):i(t)),a!==L)return a;if(!Ws(t))return t;if(s=Eo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&En.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Ro(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!n){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,Lr(t),e)}(t,function(t,e){return t&&gi(e,nn(e),t)}(a,t)):function(t,e){return gi(t,kr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return n?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Ar?Sn(Ar.call(t)):{}}}(t,c,l)}}if(r||(r=new Ht),n=r.get(t))return n;if(r.set(t,a),Ho(t))return t.forEach(function(s){a.add(oe(s,e,i,s,t,r))}),a;if(Bo(t))return t.forEach(function(s,n){a.set(n,oe(s,e,i,n,t,r))}),a;h=u?h?zi:Ni:h?nn:sn;var d=s?L:h(t);return o(d||t,function(s,n){d&&(s=t[n=s]),Nt(a,n,oe(s,e,i,n,t,r))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Sn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===L&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new An("Expected a function");return Nr(function(){t.apply(L,i)},e)}function he(t,e,i,s){var n=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,O(i))),s?(r=u,o=!1):200<=e.length&&(r=I,o=!1,e=new Ft(e));t:for(;++ne}function we(t,e){return null!=t&&En.call(t,e)}function De(t,e){return null!=t&&e in Sn(t)}function Se(t,e,i){for(var s=i?u:h,n=t[0].length,r=t.length,o=r,a=yn(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,O(e))),l=ar(d.length,l),a[o]=!i&&(e||120<=n&&120<=d.length)?new Ft(o&&d):L}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[cs(Ts(e))])?L:n(e,t,i)}function Ke(t){return js(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,s,n){if(t===e)return!0;if(null==t||null==e||!js(t)&&!js(e))return t!=t&&e!=e;t:{var r=Eo(t),o=Eo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Ro(t)){if(!Ro(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new Ht),e=r||ko(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Un(t),new Un(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Ms(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=F),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&En.call(t,"__wrapped__"),a=o&&En.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new Ht),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new Ht),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:En.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:L}function He(t,e,i){var s=-1;return e=c(e.length?e:[cn],O(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,n){return{a:c(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a){s=l;break t}s=l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function ke(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=yn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Gs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[cs(Ts(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Ze(t[0]):[];for(var n=-1,r=yn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Wn?Wn(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Un(e).set(new Un(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==L,s=null===t,n=t==t,r=Gs(t),o=e!==L,a=null===e,l=e==e,h=Gs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?L:r,n=1),e=Sn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Qn(t/H(e))),Ct.test(e)?ai(k(i),0,t).join(""):i.slice(0,t))}function Ei(t,e,i,s){var r=1&e,o=Di(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=s.length,c=yn(u+l),p=this&&this!==kt&&this instanceof e?o:t;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===L?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(L,r):Ei(t,e,i,s):function(t,e,i){var s=1&e,n=Di(t);return function e(){return(this&&this!==kt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),ls((p?Rr:jr)(l,r),t,e)}function ki(t,e,i,s){return t===L||Ms(t,Cn[i])&&!En.call(s,i)?e:t}function Li(t,e,i,s,n,r){return Ws(t)&&Ws(e)&&(r.set(e,t),Be(t,e,L,Li,r),r.delete(e)),t}function Ui(t){return zs(t)?L:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ft:L;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:qs(i))&&(i=or(s+i,0)),m(t,Xi(e,3),i)):-1}function _s(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==L&&(n=qs(i),n=0>i?or(s+n,0):ar(n,s-1)),m(t,Xi(e,3),n,!0)}function ms(t){return null!=t&&t.length?de(t,1):[]}function ys(t){return t&&t.length?t[0]:L}function Ts(t){var e=null==t?0:t.length;return e?t[e-1]:L}function vs(t,e){return t&&t.length&&e&&e.length?Le(t,e):t}function ws(t){return null==t?t:cr.call(t)}function Ds(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Fs(t))return e=or(t.length,e),!0}),A(e,function(e){return c(t,D(e))})}function Ss(t,e){if(!t||!t.length)return[];var i=Ds(t);return null==e?i:c(i,function(t){return n(e,L,t)})}function bs(t){return(t=i(t)).__chain__=!0,t}function Ks(t,e){return e(t)}function As(t,e){return(Eo(t)?o:Ir)(t,Xi(e,3))}function Os(t,e){return(Eo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:xr)(t,Xi(e,3))}function Cs(t,e){return(Eo(t)?c:Pe)(t,Xi(e,3))}function Is(t,e,i){return e=i?L:e,e=t&&null==e?t.length:e,Hi(t,128,L,L,L,L,e)}function xs(t,e){var i;if("function"!=typeof e)throw new An("Expected a function");return t=qs(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=L),i}}function Es(t,e,i){function s(e){var i=l,s=h;return l=h=L,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===L||i>=e||0>i||_&&t>=u}function r(){var t=To();if(n(t))return o(t);var i,s=Nr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=s(r,i)}function o(t){return p=L,m&&l?s(t):(l=h=L,c)}function a(){var t=To(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===L)return f=t=d,p=Nr(r,e),g?s(t):c;if(_)return p=Nr(r,e),s(d)}return p===L&&(p=Nr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new An("Expected a function");return e=Js(e)||0,Ws(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Js(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==L&&Br(p),f=0,l=d=h=p=L},a.flush=function(){return p===L?c:o(To())},a}function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new An("Expected a function");var i=function(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)};return i.cache=new(Ps.Cache||Rt),i}function Rs(t){if("function"!=typeof t)throw new An("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Ms(t,e){return t===e||t!=t&&e!=e}function Bs(t){return null!=t&&Us(t.length)&&!ks(t)}function Fs(t){return js(t)&&Bs(t)}function Hs(t){if(!js(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!zs(t)}function ks(t){return!!Ws(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Ls(t){return"number"==typeof t&&t==qs(t)}function Us(t){return"number"==typeof t&&-1=t}function Ws(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function js(t){return null!=t&&"object"==typeof t}function Ns(t){return"number"==typeof t||js(t)&&"[object Number]"==Te(t)}function zs(t){return!(!js(t)||"[object Object]"!=Te(t))&&(null===(t=jn(t))||"function"==typeof(t=En.call(t,"constructor")&&t.constructor)&&t instanceof t&&xn.call(t)==Bn)}function Vs(t){return"string"==typeof t||!Eo(t)&&js(t)&&"[object String]"==Te(t)}function Gs(t){return"symbol"==typeof t||js(t)&&"[object Symbol]"==Te(t)}function Xs(t){if(!t)return[];if(Bs(t))return Vs(t)?k(t):fi(t);if(Xn&&t[Xn]){t=t[Xn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?R:"[object Set]"==e?F:on)(t)}function $s(t){return t?(t=Js(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function qs(t){var e=(t=$s(t))%1;return t==t?e?t-e:t:0}function Ys(t){return t?re(qs(t),0,4294967295):0}function Js(t){if("number"==typeof t)return t;if(Gs(t))return W;if(Ws(t)&&(t=Ws(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(nt,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Zs(t){return gi(t,nn(t))}function Qs(t){return null==t?"":Je(t)}function tn(t,e,i){return(t=null==t?L:me(t,e))===L?i:t}function en(t,e){return null!=t&&Ji(t,e,De)}function sn(t){return Bs(t)?Lt(t):xe(t)}function nn(t){if(Bs(t))t=Lt(t,!0);else if(Ws(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&En.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Sn(t))e.push(i);t=e}return t}function rn(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),ke(t,i,function(t,i){return e(t,i[0])})}function on(t){return null==t?[]:C(t,sn(t))}function an(t){return ua(Qs(t).toLowerCase())}function ln(t){return(t=Qs(t))&&t.replace(Tt,Jt).replace(Kt,"")}function hn(t,e,i){return t=Qs(t),(e=i?L:e)===L?It.test(t)?t.match(Ot)||[]:t.match(ut)||[]:t.match(e)||[]}function un(t){return function(){return t}}function cn(t){return t}function pn(t){return Ie("function"==typeof t?t:oe(t,1))}function dn(t,e,i){var s=sn(e),n=_e(e,s);null!=i||Ws(e)&&(n.length||!s.length)||(i=e,e=t,t=this,n=_e(e,sn(e)));var r=!(Ws(i)&&"chain"in i&&!i.chain),a=ks(t);return o(n,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,p([this.value()],arguments))})}),t}function fn(){}function gn(t){return is(t)?D(cs(t)):function(t){return function(e){return me(e,t)}}(t)}function _n(){return[]}function mn(){return!1}var yn=(e=null==e?kt:te.defaults(kt.Object(),e,te.pick(kt,xt))).Array,Tn=e.Date,vn=e.Error,wn=e.Function,Dn=e.Math,Sn=e.Object,bn=e.RegExp,Kn=e.String,An=e.TypeError,On=yn.prototype,Cn=Sn.prototype,In=e["__core-js_shared__"],xn=wn.prototype.toString,En=Cn.hasOwnProperty,Pn=0,Rn=function(){var t=/[^.]+$/.exec(In&&In.keys&&In.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Mn=Cn.toString,Bn=xn.call(Sn),Fn=kt._,Hn=bn("^"+xn.call(En).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kn=Wt?e.Buffer:L,Ln=e.Symbol,Un=e.Uint8Array,Wn=kn?kn.allocUnsafe:L,jn=M(Sn.getPrototypeOf,Sn),Nn=Sn.create,zn=Cn.propertyIsEnumerable,Vn=On.splice,Gn=Ln?Ln.isConcatSpreadable:L,Xn=Ln?Ln.iterator:L,$n=Ln?Ln.toStringTag:L,qn=function(){try{var t=Yi(Sn,"defineProperty");return t({},"",{}),t}catch(t){}}(),Yn=e.clearTimeout!==kt.clearTimeout&&e.clearTimeout,Jn=Tn&&Tn.now!==kt.Date.now&&Tn.now,Zn=e.setTimeout!==kt.setTimeout&&e.setTimeout,Qn=Dn.ceil,tr=Dn.floor,er=Sn.getOwnPropertySymbols,ir=kn?kn.isBuffer:L,sr=e.isFinite,nr=On.join,rr=M(Sn.keys,Sn),or=Dn.max,ar=Dn.min,lr=Tn.now,hr=e.parseInt,ur=Dn.random,cr=On.reverse,pr=Yi(e,"DataView"),dr=Yi(e,"Map"),fr=Yi(e,"Promise"),gr=Yi(e,"Set"),_r=Yi(e,"WeakMap"),mr=Yi(Sn,"create"),yr=_r&&new _r,Tr={},vr=ps(pr),wr=ps(dr),Dr=ps(fr),Sr=ps(gr),br=ps(_r),Kr=Ln?Ln.prototype:L,Ar=Kr?Kr.valueOf:L,Or=Kr?Kr.toString:L,Cr=function(){function t(){}return function(e){return Ws(e)?Nn?Nn(e):(t.prototype=e,e=new t,t.prototype=L,e):{}}}();i.templateSettings={escape:Y,evaluate:J,interpolate:Z,variable:"",imports:{_:i}},i.prototype=s.prototype,i.prototype.constructor=i,S.prototype=Cr(s.prototype),S.prototype.constructor=S,Dt.prototype=Cr(s.prototype),Dt.prototype.constructor=Dt,St.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?L:t:En.call(e,t)?e[t]:L},St.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==L:En.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===L?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():Vn.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?L:e[t][1]},At.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(dr||At),string:new St}},Rt.prototype.delete=function(t){return t=$i(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return $i(this,t).get(t)},Rt.prototype.has=function(t){return $i(this,t).has(t)},Rt.prototype.set=function(t,e){var i=$i(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ft.prototype.add=Ft.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ft.prototype.has=function(t){return this.__data__.has(t)},Ht.prototype.clear=function(){this.__data__=new At,this.size=0},Ht.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Ht.prototype.get=function(t){return this.__data__.get(t)},Ht.prototype.has=function(t){return this.__data__.has(t)},Ht.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var s=i.__data__;if(!dr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(s)}return i.set(t,e),this.size=i.size,this};var Ir=yi(fe),xr=yi(ge,!0),Er=Ti(),Pr=Ti(!0),Rr=yr?function(t,e){return yr.set(t,e),t}:cn,Mr=qn?function(t,e){return qn(t,"toString",{configurable:!0,enumerable:!1,value:un(e),writable:!0})}:cn,Br=Yn||function(t){return kt.clearTimeout(t)},Fr=gr&&1/F(new gr([,-0]))[1]==U?function(t){return new gr(t)}:fn,Hr=yr?function(t){return yr.get(t)}:fn,kr=er?function(t){return null==t?[]:(t=Sn(t),l(er(t),function(e){return zn.call(t,e)}))}:_n,Lr=er?function(t){for(var e=[];t;)p(e,kr(t)),t=jn(t);return e}:_n,Ur=Te;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:L)?ps(t):"")switch(t){case vr:return"[object DataView]";case wr:return"[object Map]";case Dr:return"[object Promise]";case Sr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Wr=In?ks:mn,jr=hs(Rr),Nr=Zn||function(t,e){return kt.setTimeout(t,e)},zr=hs(Mr),Vr=function(t){var e=(t=Ps(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,s,n){e.push(s?n.replace(ct,"$1"):i||t)}),e}),Gr=Ne(function(t,e){return Fs(t)?he(t,de(e,1,Fs,!0)):[]}),Xr=Ne(function(t,e){var i=Ts(e);return Fs(i)&&(i=L),Fs(t)?he(t,de(e,1,Fs,!0),Xi(i,2)):[]}),$r=Ne(function(t,e){var i=Ts(e);return Fs(i)&&(i=L),Fs(t)?he(t,de(e,1,Fs,!0),L,i):[]}),qr=Ne(function(t){var e=c(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=Ne(function(t){var e=Ts(t),i=c(t,ni);return e===Ts(i)?e=L:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=Ne(function(t){var e=Ts(t),i=c(t,ni);return(e="function"==typeof e?e:L)&&i.pop(),i.length&&i[0]===t[0]?Se(i,L,e):[]}),Zr=Ne(vs),Qr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,c(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),to=Ne(function(t){return Ze(de(t,1,Fs,!0))}),eo=Ne(function(t){var e=Ts(t);return Fs(e)&&(e=L),Ze(de(t,1,Fs,!0),Xi(e,2))}),io=Ne(function(t){var e="function"==typeof(e=Ts(t))?e:L;return Ze(de(t,1,Fs,!0),L,e)}),so=Ne(function(t,e){return Fs(t)?he(t,e):[]}),no=Ne(function(t){return ii(l(t,Fs))}),ro=Ne(function(t){var e=Ts(t);return Fs(e)&&(e=L),ii(l(t,Fs),Xi(e,2))}),oo=Ne(function(t){var e="function"==typeof(e=Ts(t))?e:L;return ii(l(t,Fs),L,e)}),ao=Ne(Ds),lo=Ne(function(t){var e;return Ss(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:L)?(t.pop(),e):L)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,s=this.__wrapped__,n=function(e){return ne(e,t)};return!(1=e}),xo=Ke(function(){return arguments}())?Ke:function(t){return js(t)&&En.call(t,"callee")&&!zn.call(t,"callee")},Eo=yn.isArray,Po=zt?O(zt):function(t){return js(t)&&"[object ArrayBuffer]"==Te(t)},Ro=ir||mn,Mo=Vt?O(Vt):function(t){return js(t)&&"[object Date]"==Te(t)},Bo=Gt?O(Gt):function(t){return js(t)&&"[object Map]"==Ur(t)},Fo=Xt?O(Xt):function(t){return js(t)&&"[object RegExp]"==Te(t)},Ho=$t?O($t):function(t){return js(t)&&"[object Set]"==Ur(t)},ko=qt?O(qt):function(t){return js(t)&&Us(t.length)&&!!Et[Te(t)]},Lo=Ri(Ee),Uo=Ri(function(t,e){return t<=e}),Wo=mi(function(t,e){if(ns(e)||Bs(e))gi(e,sn(e),t);else for(var i in e)En.call(e,i)&&Nt(t,i,e[i])}),jo=mi(function(t,e){gi(e,nn(e),t)}),No=mi(function(t,e,i,s){gi(e,nn(e),t,s)}),zo=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),Vo=ji(ne),Go=Ne(function(t,e){t=Sn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},i.ary=Is,i.assign=Wo,i.assignIn=jo,i.assignInWith=No,i.assignWith=zo,i.at=Vo,i.before=xs,i.bind=vo,i.bindAll=pa,i.bindKey=wo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Eo(t)?t:[t]},i.chain=bs,i.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===L)?1:or(qs(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=yn(Qn(i/e));s(e=i||e===L?1:qs(e))?0:e,s):[]},i.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===L?1:qs(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=qs(i))&&(i=-i>n?0:n+i),0>(s=s===L||s>n?n:qs(s))&&(s+=n),s=i>s?0:Ys(s);i>>0)?(t=Qs(t))&&("string"==typeof e||null!=e&&!Fo(e))&&(!(e=Je(e))&&Ct.test(t))?ai(k(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new An("Expected a function");return e=null==e?0:or(qs(e),0),Ne(function(i){var s=i[e];return i=ai(i,0,e),s&&p(i,s),n(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===L?1:qs(e))?0:e):[]},i.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===L?1:qs(e)))?0:e,s):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new An("Expected a function");return Ws(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),Es(t,e,{leading:s,maxWait:e,trailing:n})},i.thru=Ks,i.toArray=Xs,i.toPairs=ea,i.toPairsIn=ia,i.toPath=function(t){return Eo(t)?c(t,cs):Gs(t)?[t]:fi(Vr(Qs(t)))},i.toPlainObject=Zs,i.transform=function(t,e,i){var s=Eo(t),n=s||Ro(t)||ko(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=n?s?new r:[]:Ws(t)&&ks(r)?Cr(jn(t)):{}}return(n?o:fe)(t,function(t,s,n){return e(i,t,s,n)}),i},i.unary=function(t){return Is(t,1)},i.union=to,i.unionBy=eo,i.unionWith=io,i.uniq=function(t){return t&&t.length?Ze(t):[]},i.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:L,t&&t.length?Ze(t,L,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=Ds,i.unzipWith=Ss,i.update=function(t,e,i){return null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),void 0)),t},i.updateWith=function(t,e,i,s){return s="function"==typeof s?s:L,null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),s)),t},i.values=on,i.valuesIn=function(t){return null==t?[]:C(t,nn(t))},i.without=so,i.words=hn,i.wrap=function(t,e){return Ko(ri(e),t)},i.xor=no,i.xorBy=ro,i.xorWith=oo,i.zip=ao,i.zipObject=function(t,e){return si(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return si(t||[],e||[],ze)},i.zipWith=lo,i.entries=ea,i.entriesIn=ia,i.extend=jo,i.extendWith=No,dn(i,i),i.add=Da,i.attempt=ca,i.camelCase=sa,i.capitalize=an,i.ceil=Sa,i.clamp=function(t,e,i){return i===L&&(i=e,e=L),i!==L&&(i=(i=Js(i))==i?i:0),e!==L&&(e=(e=Js(e))==e?e:0),re(Js(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:L)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:L)},i.conformsTo=function(t,e){return null==e||ae(t,e,sn(e))},i.deburr=ln,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=ba,i.endsWith=function(t,e,i){t=Qs(t),e=Je(e);var s=t.length;s=i=i===L?s:re(qs(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},i.eq=Ms,i.escape=function(t){return(t=Qs(t))&&q.test(t)?t.replace(X,Zt):t},i.escapeRegExp=function(t){return(t=Qs(t))&&st.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var s=Eo(t)?a:ue;return i&&es(t,e,i)&&(e=L),s(t,Xi(e,3))},i.find=co,i.findIndex=gs,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=po,i.findLastIndex=_s,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=Ka,i.forEach=As,i.forEachRight=Os,i.forIn=function(t,e){return null==t?t:Er(t,Xi(e,3),nn)},i.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),nn)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=tn,i.gt=Co,i.gte=Io,i.has=function(t,e){return null!=t&&Ji(t,e,we)},i.hasIn=en,i.head=ys,i.identity=cn,i.includes=function(t,e,i,s){return t=Bs(t)?t:on(t),i=i&&!s?qs(i):0,s=t.length,0>i&&(i=or(s+i,0)),Vs(t)?i<=s&&-1(i=null==i?0:qs(i))&&(i=or(s+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=$s(e),i===L?(i=e,e=0):i=$s(i),(t=Js(t))>=ar(e,i)&&t=t},i.isSet=Ho,i.isString=Vs,i.isSymbol=Gs,i.isTypedArray=ko,i.isUndefined=function(t){return t===L},i.isWeakMap=function(t){return js(t)&&"[object WeakMap]"==Ur(t)},i.isWeakSet=function(t){return js(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":nr.call(t,e)},i.kebabCase=na,i.last=Ts,i.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==L&&(n=0>(n=qs(i))?or(s+n,0):ar(n,s-1)),e==e)t:{for(i=n+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=m(t,v,n,!0);return t},i.lowerCase=ra,i.lowerFirst=oa,i.lt=Lo,i.lte=Uo,i.max=function(t){return t&&t.length?ce(t,cn,ve):L},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),ve):L},i.mean=function(t){return w(t,cn)},i.meanBy=function(t,e){return w(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,cn,Ee):L},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),Ee):L},i.stubArray=_n,i.stubFalse=mn,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Aa,i.nth=function(t,e){return t&&t.length?Fe(t,qs(e)):L},i.noConflict=function(){return kt._===this&&(kt._=Fn),this},i.noop=fn,i.now=To,i.pad=function(t,e,i){t=Qs(t);var s=(e=qs(e))?H(t):0;return!e||s>=e?t:xi(tr(e=(e-s)/2),i)+t+xi(Qn(e),i)},i.padEnd=function(t,e,i){t=Qs(t);var s=(e=qs(e))?H(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var s=Eo(t)?d:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,Ir)},i.reduceRight=function(t,e,i){var s=Eo(t)?f:b,n=3>arguments.length;return s(t,Xi(e,4),i,n,xr)},i.repeat=function(t,e,i){return e=(i?es(t,e,i):e===L)?1:qs(e),je(Qs(t),e)},i.replace=function(){var t=arguments,e=Qs(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=L);++s(t=qs(t))||9007199254740991=r)return t;if(1>(r=i-H(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===L)return i+s;if(o&&(r+=i.length-r),Fo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=bn(n.source,Qs(dt.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===L?r:l)}}else t.indexOf(Je(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},i.unescape=function(t){return(t=Qs(t))&&$.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++Pn;return Qs(t)+e},i.upperCase=ha,i.upperFirst=ua,i.each=As,i.eachRight=Os,i.first=ys,dn(i,function(){var t={};return fe(i,function(e,s){En.call(i.prototype,s)||(t[s]=e)}),t}(),{chain:!1}),i.VERSION="4.17.11",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){Dt.prototype[t]=function(i){i=i===L?1:or(qs(i),0);var s=this.__filtered__&&!e?new Dt(this):this.clone();return s.__filtered__?s.__takeCount__=ar(i,s.__takeCount__):s.__views__.push({size:ar(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Dt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Dt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");Dt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Dt.prototype[t]=function(){return this.__filtered__?new Dt(this):this[i](1)}}),Dt.prototype.compact=function(){return this.filter(cn)},Dt.prototype.find=function(t){return this.filter(t).head()},Dt.prototype.findLast=function(t){return this.reverse().find(t)},Dt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new Dt(this):this.map(function(i){return be(i,t,e)})}),Dt.prototype.reject=function(t){return this.filter(Rs(Xi(t)))},Dt.prototype.slice=function(t,e){t=qs(t);var i=this;return i.__filtered__&&(0e)?new Dt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==L&&(i=0>(e=qs(e))?i.dropRight(-e):i.take(e-t)),i)},Dt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Dt.prototype.toArray=function(){return this.take(4294967295)},fe(Dt.prototype,function(t,e){var s=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),r=i[n?"take"+("last"==e?"Right":""):e],o=n||/^find/.test(e);r&&(i.prototype[e]=function(){var e=this.__wrapped__,a=n?[1]:arguments,l=e instanceof Dt,h=a[0],u=l||Eo(e),c=function(t){return t=r.apply(i,p([t],a)),n&&d?t[0]:t};u&&s&&"function"==typeof h&&1!=h.length&&(l=u=!1);var d=this.__chain__,f=!!this.__actions__.length;h=o&&!d,l=l&&!f;return!o&&u?(e=l?e:new Dt(this),(e=t.apply(e,a)).__actions__.push({func:Ks,args:[c],thisArg:L}),new S(e,d)):h&&l?t.apply(this,a):(e=this.thru(c),h?n?e.value()[0]:e.value():e)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=On[t],s=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Eo(i)?i:[],t)}return this[s](function(i){return e.apply(Eo(i)?i:[],t)})}}),fe(Dt.prototype,function(t,e){var s=i[e];if(s){var n=s.name+"";(Tr[n]||(Tr[n]=[])).push({name:e,func:s})}}),Tr[Ai(L,2).name]=[{name:"wrapper",func:L}],Dt.prototype.clone=function(){var t=new Dt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Dt.prototype.reverse=function(){if(this.__filtered__){var t=new Dt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Dt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=Eo(e),n=0>i,r=s?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?L:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof s;){var n=fs(i);n.__index__=0,n.__values__=L,e?r.__wrapped__=n:e=n;var r=n;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Dt?(this.__actions__.length&&(t=new Dt(this)),(t=t.reverse()).__actions__.push({func:Ks,args:[ws],thisArg:L}),new S(t,this.__chain__)):this.thru(ws)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Xn&&(i.prototype[Xn]=function(){return this}),i}();kt._=te,void 0===(s=function(){return te}.call(e,i,e,t))||(t.exports=s)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),n.get("Debugging Console","Enabled")&&this.openConsole(),n.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}const e=n.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=n.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=n.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${s}.${n}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a"),p=this._getErrorLogData();let d=`Date: ${(new Date).toString()}`+o.EOL;_.forEach(p,(t,e)=>{d+=e+": "+t+o.EOL}),t instanceof Object?(d+=`Name: ${t.name}`+o.EOL,d+=`Message: ${t.message}`+o.EOL,void 0!==t.filename&&(d+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(d+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(d+=`Column: ${t.columnNumber}`+o.EOL),d+=`Stack: ${t.stack}`+o.EOL+o.EOL):d+=`Error: ${t}`+o.EOL+o.EOL,await r.writeSync(c,d),await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=n.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,s),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=n.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!n.get("Quick Load","Enabled"))return;const t=n.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!n.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=n.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.forEach(_.keys(t),e=>{const i=_.camelCase(e);i!==e&&(t[i]=t[e],delete t[e])}),t}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=n.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=n.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let s=null;const r=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const n=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,n,{__stats__:{...e,type:"file"}}):_.set(i,n,{__stats__:{...e,type:"directory"}}),s&&clearTimeout(s),s=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&r(t)})})};r(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){DKTools.IO.Entity.prototype.initialize.call(this,t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if((DKTools.IO.isLocalMode()||DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP)&&(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage())){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return DKTools.IO.Entity.prototype.exists.call(this)}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}else{if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return!this.isAudio()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName())}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):!this.isImage()||DKTools.IO.isLocalMode()&&!this.exists()?null:DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i})}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=e=>{return t.template instanceof RegExp?e=_.filter(e,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(e=_.filter(e,e=>e===t.template)),{data:_.reduce(e,(t,e)=>{const i=DKTools.IO.normalizePath(s+"/"+e);return DKTools.IO.isFile(i)?t.push(new DKTools.IO.File(i)):DKTools.IO.isDirectory(i)&&t.push(new DKTools.IO.Directory(i)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const i=this.getFullPath().split("\\"),s=_.get(DKTools.IO.stamp,i,{}),n=Object.keys(s);return t.sync?e(n):(t.onSuccess(e(n),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const i=DKTools.IO.fs,s=this.getFullPath(),n=this.getAbsolutePath();if(!t.sync)return i.readdir(n,t.options,(i,s)=>{i?this.__processError(i,t.onError):t.onSuccess(e(s),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const s=i.readdirSync(n,t.options);return e(s)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().then(t=>t,()=>null)}static async _toJson(t){return t.json().then(t=>t,()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},initialParams:{get:function(){return this._initialParams||(this._initialParams=PluginManager.parameters(this._pluginName)),this._initialParams},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=n.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&n.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode())throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),_.forEach(n,i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{const i=new DKTools.IO.File(e.path),s=i.getFullPath();i.isFile()?this._queue[t][s]||(this._queue[t][s]=e):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(y)&&(y=r*parseFloat(y)),n(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,s&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,s&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{Window_Base.prototype.processEscapeCharacter.call(this,t,e)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),s=this.anchor;return i.x+=this.width*s.x,i.y+=this.height*s.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/parallaxes/",t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/tilesets/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.anchor;this.move(i.x+this.width*s.x,i.y+this.height*s.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){return"GameFont"},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){return 28},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=_.defaultTo(t,this.standardOpacity())},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/parallaxes/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/parallaxes/",t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/tilesets/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/tilesets/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.width-t),o=Math.min(s,n.height-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.getLocalPoint(t,e),n=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=this.height;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const n=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.printLoadingError;Graphics.printLoadingError=function(t){l.call(this,t),DKTools.Utils.logError(`Failed to load: ${t}`)};const h=Graphics.initialize;Graphics.initialize=function(t,e,i){h.call(this,t,e,i);const s=n.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=n.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):u.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return n.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return n.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const s=this._getErrorMessageForErrorPrint(),n=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return s&&(o=''+s+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),n&&(o+='
'+n+"

"),o};const c=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){c.call(this),this._errorPrinter&&n.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const p=TouchInput.initialize;TouchInput.initialize=function(){p.call(this);const t=n.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const d=TouchInput.clear;TouchInput.clear=function(){d.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const f=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,f.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const g=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const m=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const y=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const T=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const v=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);v.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const w=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){w.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const D=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):D.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const S=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!S.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()};const b=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):b.call(this,t,e)};const K=SceneManager.initialize;SceneManager.initialize=async function(){await K.call(this),await DKTools.StartupManager.initialize()};const A=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=n.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,A.call(this),DKTools.Utils.isNwjs()&&this.updateResolution()}else A.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;t>0&&e>0&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const O=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(O.call(this,t),t.ctrlKey||t.altKey)return;const e=n.get("Quick Load","Key Code"),i=n.get("Screenshots","Key Code"),s=n.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:n.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const C=SceneManager.catchException;SceneManager.catchException=function(t){C.call(this,t),t instanceof Error&&n.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const I=SceneManager.onError;SceneManager.onError=function(t){I.call(this,t),DKTools.Utils.logError(t),n.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const x=SceneManager.goto;SceneManager.goto=function(t){x.call(this,t),DKTools.Utils.__hideGrid()};const E=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){E.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const P=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return P.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const R=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){R.call(this),this._preloader.finish()};const M=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return M.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const B=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=n.get("Quick Start");t.Enabled?(B.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):B.call(this)};const F=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&F.call(this)};const H=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||H.call(this)};const k=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||k.call(this)};const L=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){L.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)}}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file diff --git a/src/DKTools.js b/src/DKTools.js index 6010cad..d95f654 100644 --- a/src/DKTools.js +++ b/src/DKTools.js @@ -3,8 +3,8 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 7.0.0 -Release: 29.03.2019 +Version: 8.0.0 +Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English */ @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 7.0.0 -Релиз: 29.03.2019 +Версия: 8.0.0 +Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.7.0.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.0.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,8 +29,8 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 7.0.0 - Release: 29.03.2019 + Version: 8.0.0 + Release: 30.07.2019 First release: 13.01.2016 Supported languages: Russian, English Thank you for your support: https://dk-plugins.ru/donate @@ -49,6 +49,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Instructions ### + ## Parameters ## + + ### 1 ### File system ### + File system modes: + Nwjs + Stamp - Advanced file system mode (all Platforms) + Nwjs - standard file system mode (PC only) + + In the Nwjs + Stamp mode, each time you start a game test, the plugin scans + project files and saves data to the file "data/stamp.json" + + Data can also be updated using the plugin command UpdateFileSystemStamp + + Q. Why do I need Nwjs + Stamp file system mode ? + A. Browsers and old mobile devices do not provide the ability to check for specific files. + in a particular directory, and also do not provide a list of files and directories. + + Q. Which mode should I choose ? + A. Nwjs + Stamp, if your project is designed for all platforms (including browsers and mobile devices). + + ### 1.1 ### Ignored directories ### + Only applicable for Nwjs + Stamp mode. + Ignores specified (and nested) directories when scanning project files. + + ## Functions ## + ### 1 ### Screenshots ### Templates for the filename of the screenshot: %year - Year @@ -77,6 +102,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Checks for plugins updates from DKPlugins DKPluginsCheckUpdates + 2. Update file system stamp + UpdateFileSystemStamp + ### Elements ### DKTools.Utils DKTools.Utils.Object @@ -141,6 +169,24 @@ E-mail: kuznetsovdenis96@gmail.com You can't: -Delete or change any information about the plugin (Title, authorship, contact information, version and release) + * @param Parameters + * @default --------------------------------- + + * @param File System + * @parent Parameters + * @desc File system parameters. Details in the help (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @default --------------------------------- + + * @param Print Detailed Error + * @parent New Functions + * @desc Detailed error display + * @type struct + * @default {"Enabled":"false","Error Message":"Game has encountered a bug. Please report it.","Restart Message":"Press F5 to restart the game."} + * @param Functions * @default --------------------------------- @@ -225,7 +271,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.7.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.0.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -233,8 +279,8 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 7.0.0 - Релиз: 29.03.2019 + Версия: 8.0.0 + Релиз: 30.07.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский Спасибо за Вашу поддержку: https://dk-plugins.ru/donate @@ -253,6 +299,31 @@ E-mail: kuznetsovdenis96@gmail.com ### Инструкции ### + ## Параметры ## + + ### 1 ### Файловая система ### + Режимы работы файловой системы: + Nwjs + Stamp - Расширенный режим работы файловой системы (все платформы) + Nwjs - стандартный режим работы файловой системы (только PC) + + В режиме Nwjs + Stamp каждый раз при запуске теста игры плагин сканирует + файлы проекта и сохраняет данные в файл "data/Stamp.json" + + Данные также могут быть обновлены с помощью команды плагина UpdateFileSystemStamp + + Q. Зачем нужен режим работы Nwjs + Stamp ? + A. Браузеры и старые мобильные устройства не предоставляют возможность проверять наличие конкретных файлов + в той или иной директории, а также не предоставляют список файлов и директорий. + + Q. Какой режим выбрать мне ? + A. Nwjs + Stamp, если Ваш проект расчитан на все платформы (включая браузеры и мобильные устройства). + + ### 1.1 ### Игнорируемые директории ### + Применяется только для режима Nwjs + Stamp. + Игнорирует указанные (и вложенные) директории при сканировании файлов проекта. + + ## Функции ## + ### 1 ### Скриншоты ### Шаблоны для названия файла скриншота: %year - Год @@ -281,6 +352,9 @@ E-mail: kuznetsovdenis96@gmail.com 1. Проверить обновления плагинов от DKPlugins DKPluginsCheckUpdates + 2. Обновить штамп файловой системы + UpdateFileSystemStamp + ### Элементы ### DKTools.Utils DKTools.Utils.Object @@ -345,6 +419,28 @@ E-mail: kuznetsovdenis96@gmail.com Вы не можете: -Убирать или изменять любую информацию о плагине (Название, авторство, контактная информация, версия и дата релиза) + * @param Parameters + * @text Параметры + * @default --------------------------------- + + * @param File System + * @text Файловая система + * @parent Parameters + * @desc Параметры файловой системы. Подробности в справке (1) + * @type struct + * @default {"Mode":"0","Stamp":"---------------------------------","Ignored Directories":"[\"node_modules\"]"} + + * @param New Functions + * @text Новые функции + * @default --------------------------------- + + * @param Print Detailed Error + * @text Детальное отображение ошибок + * @parent New Functions + * @desc Детальное отображение ошибок + * @type struct + * @default {"Enabled":"false","Error Message":"В игре обнаружена ошибка. Пожалуйста, сообщите об этом.","Restart Message":"Нажмите F5, чтобы перезапустить игру."} + * @param Functions * @text Функции * @default --------------------------------- @@ -442,6 +538,53 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~FileSystem: + + * @param Mode + * @desc File system mode. Details in the help (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @default --------------------------------- + + * @param Ignored Directories + * @parent Stamp + * @desc Ignored directories. Details in the help (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + +/*~struct~FileSystem:ru + + * @param Mode + * @text Режим работы файловой систмы + * @desc Режим работы файловой системы. Подробности в справке (1) + * @type select + * @option Nwjs + Stamp + * @value 0 + * @option Nwjs + * @value 1 + * @default 0 + + * @param Stamp + * @text Штамп файловой системы + * @default --------------------------------- + + * @param Ignored Directories + * @text Игнорируемые директории + * @parent Stamp + * @desc Игнорируемые директории. Подробности в справке (1.1) + * @type string[] + * @default ["node_modules"] + +*/ + /*~struct~CheckUpdates: * @param Enabled @@ -1141,3 +1284,42 @@ E-mail: kuznetsovdenis96@gmail.com * @dir img/system */ + +/*~struct~PrintDetailedError: + + * @param Enabled + * @desc Enable detailed error display ? + * @type boolean + * @default false + + * @param Error Message + * @text Error message + * @desc Error message + * @default Game has encountered a bug. Please report it. + + * @param Restart Message + * @text Game restart message + * @desc Game restart message + * @default Press F5 to restart the game. + +*/ + +/*~struct~PrintDetailedError:ru + + * @param Enabled + * @text Включено + * @desc Включить детальное отображение ошибок ? + * @type boolean + * @default false + + * @param Error Message + * @text Сообщение об ошибке + * @desc Сообщение об ошибке + * @default В игре обнаружена ошибка. Пожалуйста, сообщите об этом. + + * @param Restart Message + * @text Сообщение о перезапуске игры + * @desc Сообщение о перезапуске игры + * @default Нажмите F5, чтобы перезапустить игру. + +*/ diff --git a/src/DKTools/Animation Action.js b/src/DKTools/Animation Action.js index 117c506..c784399 100644 --- a/src/DKTools/Animation Action.js +++ b/src/DKTools/Animation Action.js @@ -581,7 +581,7 @@ DKTools.Animation.Action = class extends DKTools.Event { * * @param {DKTools.Animation} animation - Animation */ - setAnimation (animation) { + setAnimation(animation) { this._animation = animation; } diff --git a/src/DKTools/Base.js b/src/DKTools/Base.js index e0de3dd..62700e3 100644 --- a/src/DKTools/Base.js +++ b/src/DKTools/Base.js @@ -451,40 +451,6 @@ DKTools.Base = class { return this.hasBitmap(); } - /** - * Converts the X of the canvas to the local X - * - * @param {Number} x - The X of the canvas - * @returns {Number} Local X - */ - canvasToLocalX(x) { - let node = this; - - while (node) { - x -= node.x; - node = node.parent; - } - - return x; - } - - /** - * Converts the Y of the canvas to the local Y - * - * @param {Number} y - The Y of the canvas - * @returns {Number} Local Y - */ - canvasToLocalY(y) { - let node = this; - - while (node) { - y -= node.y; - node = node.parent; - } - - return y; - } - /** * Checks all * @@ -637,7 +603,7 @@ DKTools.Base = class { const clone = new (this.constructor)(this); if (options.cloneTexts) { - _.forEach(this._texts, textObj => { + _.forEach(this._texts, (textObj) => { clone.addText(textObj.text, { ...textObj.options }); }); } @@ -719,6 +685,20 @@ DKTools.Base = class { } } + /** + * Destroys the object + * + * @since 8.0.0 + * + * @param {Object} [options] - Destroy options + */ + destroy(options = {}) { + this._clearAll(); + + this.clearEvents(); + this.hide(); + } + /** * Turns off the option * @@ -2056,6 +2036,8 @@ DKTools.Base = class { /** * Returns a rectangle of the line * + * @version 8.0.0 + * * @param {Number | String} line - Line number * * @see DKTools.Base.prototype.getLineHeight @@ -2065,18 +2047,42 @@ DKTools.Base = class { getLineRect(line) { const lineHeight = this.getLineHeight(); - return new Rectangle(0, lineHeight * parseInt(line), this.realWidth, lineHeight); + return new Rectangle(0, lineHeight * parseInt(line), this.width, lineHeight); } /** * Returns the maximum of lines * + * @version 8.0.0 + * * @see DKTools.Base.prototype.getLineHeight * * @returns {Number} Maximum of lines */ getLines() { - return this.realHeight / this.getLineHeight(); + return this.height / this.getLineHeight(); + } + + /** + * Returns the local point (coordinates inside the object) + * + * @since 8.0.0 + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number} [y] - The Y coordinate (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number} [object.y] - The Y coordinate + * + * @see DKTools.Utils.Point.toPoint + * @see PIXI.Matrix.applyInverse + * + * @returns {PIXI.Point} Local point (coordinates inside the object) + */ + getLocalPoint(object, y) { + const point = DKTools.Utils.Point.toPoint(object, y); + + return this.worldTransform.applyInverse(point); } /** @@ -2109,6 +2115,7 @@ DKTools.Base = class { /** * Returns the real center of the object (not including scaling) * + * @deprecated 8.0.0 * @since 5.0.0 * * @see DKTools.Base.prototype.getRealSize @@ -2139,10 +2146,12 @@ DKTools.Base = class { /** * Returns the real size of the object (not including scaling) * + * @deprecated 8.0.0 + * * @returns {{ width: Number, height: Number }} Real size of the object (not including scaling) */ getRealSize() { - return { width: this.realWidth, height: this.realHeight }; + return { width: this.width, height: this.height }; } /** @@ -2586,6 +2595,17 @@ DKTools.Base = class { return this instanceof DKTools.Sprite.Cursor; } + /** + * Returns true if the object was destroyed + * + * @since 8.0.0 + * + * @returns {Boolean} Object was destroyed + */ + isDestroyed() { + return this._destroyed; + } + /** * Checks the events for pause * Returns the conjunction of pauses of the events @@ -2605,13 +2625,37 @@ DKTools.Base = class { /** * Returns true if the coordinates is inside the object * + * @version 8.0.0 + * * @param {Number} x - The X coordinate * @param {Number} y - The Y coordinate * + * @see DKTools.Base.prototype.getLocalPoint + * * @returns {Boolean} Coordinates is inside the object */ isInside(x, y) { - return false; + const point = this.getLocalPoint(x, y); + const frame = new Rectangle(0, 0, this.width, this.height); + const mask = this.mask; + + if (mask && DKTools.Utils.isFunction(mask.containsPoint)) { + if (!mask.containsPoint(point)) { + return false; + } + } + + if (!frame.contains(point.x, point.y)) { + return false; + } + + const area = this.hitArea; + + if (!area) { + return true; + } + + return area.contains(point.x, point.y); } /** @@ -2926,36 +2970,6 @@ DKTools.Base = class { this.position.copy(point); } - /** - * Moves the object (taking into account the anchor) - * - * @since 5.0.0 - * - * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters - * @param {Number | String} [y] - The Y coordinate or line number (String) (if object is Number) - * - * @param {Number} [object.x] - The X coordinate - * @param {Number | String} [object.y] - The Y coordinate or line number (String) - * - * @see DKTools.Base.prototype.getRealSize - * @see DKTools.Base.prototype.move - */ - moveWithAnchor(object, y) { - if (object instanceof Object) { - y = object.y; - } - - if (DKTools.Utils.isString(y)) { // line number - y = this.getLineHeight() * parseFloat(y); - } - - const point = DKTools.Utils.Point.toPoint(object, y); - const size = this.getRealSize(); - const anchor = this.anchor; - - this.move(point.x + anchor.x * size.width, point.y + anchor.y * size.height); - } - // O methods /** @@ -3084,6 +3098,7 @@ DKTools.Base = class { } this.updateMouseOutsideEvents(); + this._clearMouseEnterTime(); } } else { @@ -3359,34 +3374,38 @@ DKTools.Base = class { } /** - * Returns the standard height of the drawing + * Returns the standard width of the drawing * - * @returns {Number | null} Standard height of the drawing or null + * @version 8.0.0 + * + * @returns {Number | null} Standard width of the drawing or null */ - standardDrawingHeight() { + standardDrawingWidth() { if (this.hasBitmap()) { - return this.bitmap.height; + return this.bitmap.width; } else if (this.isSprite()) { - return this._bitmapHeight; + return this._bitmapWidth; } else if (this.isWindow()) { - return this.realHeight; + return this.width; } return null; } /** - * Returns the standard width of the drawing + * Returns the standard height of the drawing * - * @returns {Number | null} Standard width of the drawing or null + * @version 8.0.0 + * + * @returns {Number | null} Standard height of the drawing or null */ - standardDrawingWidth() { + standardDrawingHeight() { if (this.hasBitmap()) { - return this.bitmap.width; + return this.bitmap.height; } else if (this.isSprite()) { - return this._bitmapWidth; + return this._bitmapHeight; } else if (this.isWindow()) { - return this.realWidth; + return this.height; } return null; @@ -4629,13 +4648,16 @@ Object.defineProperties(DKTools.Base.prototype, { /** * The X coordinate of mouse inside the object * + * @deprecated 8.0.0 + * @version 8.0.0 + * * @readonly * @type {Number} * @memberof DKTools.Base.prototype */ mouseX : { get: function() { - return this.canvasToLocalX(TouchInput.mouseX); + return this.mouse.x; }, configurable: true }, @@ -4643,13 +4665,32 @@ Object.defineProperties(DKTools.Base.prototype, { /** * The Y coordinate of mouse inside the object * + * @deprecated 8.0.0 + * @version 8.0.0 + * * @readonly * @type {Number} * @memberof DKTools.Base.prototype */ mouseY : { get: function() { - return this.canvasToLocalY(TouchInput.mouseY); + return this.mouse.y; + }, + configurable: true + }, + + /** + * The coordinates of mouse inside the object + * + * @since 8.0.0 + * + * @readonly + * @type {Number} + * @memberof DKTools.Base.prototype + */ + mouse: { + get: function() { + return this.getLocalPoint(TouchInput.mouseX, TouchInput.mouseY); }, configurable: true }, diff --git a/src/DKTools/Event.js b/src/DKTools/Event.js index b040778..1e0af60 100644 --- a/src/DKTools/Event.js +++ b/src/DKTools/Event.js @@ -602,11 +602,18 @@ DKTools.Event = class { /** * Removes the event + * Returns true if the event was removed + * + * @version 8.0.0 + * + * @returns {Boolean} Event was removed */ remove() { if (this.hasTarget()) { - this._target.removeEvent(this); + return this._target.removeEvent(this); } + + return true; } /** diff --git a/src/DKTools/IO Directory.js b/src/DKTools/IO Directory.js index 4fb056e..0b7dbb9 100644 --- a/src/DKTools/IO Directory.js +++ b/src/DKTools/IO Directory.js @@ -557,7 +557,7 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE * DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE * - * @version 7.0.0 + * @version 8.0.0 * * @param {Object} object - Options of an operation * @@ -581,7 +581,7 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; } - if (!DKTools.IO.isLocalMode()) { + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS) { return { data: null, status: DKTools.IO.ERROR_NOT_LOCAL_MODE }; } @@ -589,9 +589,6 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } - const fs = DKTools.IO.fs; - const path = this.getFullPath(); - const absolutePath = this.getAbsolutePath(); const processData = (names) => { if (object.template instanceof RegExp) { names = _.filter(names, name => object.template.test(name)); @@ -614,6 +611,24 @@ DKTools.IO.Directory = class extends DKTools.IO.Entity { return { data, status: DKTools.IO.OK }; }; + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.getFullPath().split('\\'); + const temp = _.get(DKTools.IO.stamp, parts, {}); + const names = Object.keys(temp); + + if (object.sync) { + return processData(names); + } else { + object.onSuccess(processData(names), this); + + return { data: null, status: DKTools.IO.EXPECT_CALLBACK }; + } + } + + const fs = DKTools.IO.fs; + const path = this.getFullPath(); + const absolutePath = this.getAbsolutePath(); + if (object.sync) { try { const names = fs.readdirSync(absolutePath, object.options); diff --git a/src/DKTools/IO Entity.js b/src/DKTools/IO Entity.js index 237f2b5..e2dfde8 100644 --- a/src/DKTools/IO Entity.js +++ b/src/DKTools/IO Entity.js @@ -159,7 +159,7 @@ DKTools.IO.Entity = class { * DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE * DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE * - * @version 7.0.0 + * @version 8.0.0 * @since 2.0.0 * * @param {Object} object - Options of an operation @@ -182,7 +182,7 @@ DKTools.IO.Entity = class { return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; } - if (!DKTools.IO.isLocalMode()) { + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS) { return { data: null, status: DKTools.IO.ERROR_NOT_LOCAL_MODE }; } @@ -190,6 +190,13 @@ DKTools.IO.Entity = class { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } + if (!DKTools.IO.isLocalMode() && DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.getFullPath().split('\\').filter(part => !!part); + const data = _.get(DKTools.IO.stamp, parts.concat('__stats__'), {}); + + return { data, status: DKTools.IO.OK }; + } + const fs = DKTools.IO.fs; const absolutePath = this.getAbsolutePath(); diff --git a/src/DKTools/IO File.js b/src/DKTools/IO File.js index 26812e0..c889390 100644 --- a/src/DKTools/IO File.js +++ b/src/DKTools/IO File.js @@ -193,13 +193,13 @@ DKTools.IO.File = class extends DKTools.IO.Entity { /** * Returns true if the file exists * - * @version 6.2.1 + * @version 8.0.0 * @override * * @returns {Boolean} File exists */ exists() { - if (DKTools.IO.isLocalMode()) { + if (DKTools.IO.isLocalMode() || DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP) { if (Decrypter.hasEncryptedAudio && this.isAudio() || Decrypter.hasEncryptedImages && this.isImage()) { const path = DKTools.IO.normalizePath(this.getPath() + '/' + Decrypter.extToEncryptExt(this.getFullName())); @@ -324,7 +324,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_DECOMPRESSING_DATA * DKTools.IO.ERROR_PARSING_DATA * - * @version 7.0.0 + * @version 8.0.0 * * @param {Object} object - Options of an operation * @@ -424,6 +424,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { }); } } else { + if (DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP && this.getFullName() !== 'Stamp.json' && !this.exists()) { + return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; + } + const xhr = new XMLHttpRequest(); xhr.open('GET', absolutePath, !object.sync); diff --git a/src/DKTools/IO.js b/src/DKTools/IO.js index 3afe207..0d23850 100644 --- a/src/DKTools/IO.js +++ b/src/DKTools/IO.js @@ -17,6 +17,7 @@ DKTools.IO = class { // initialize methods /** + * @version 8.0.0 * @static */ static initialize() { @@ -53,6 +54,25 @@ DKTools.IO = class { * @type {String} */ this._projectPath = projectPath; + + /** + * @since 8.0.0 + * @private + * @readonly + * @type {Number} + */ + this._mode = DKToolsParam.get('File System', 'Mode'); + + /** + * @since 8.0.0 + * @private + * @readonly + * @type {Object} + */ + this._stamp = {}; + + this._loadStamp(); + this._createStamp(); } // A methods @@ -60,6 +80,7 @@ DKTools.IO = class { /** * Returns true if the absolute path exists * + * @version 8.0.0 * @since 3.0.0 * @static * @@ -70,11 +91,74 @@ DKTools.IO = class { * @returns {Boolean} Absolute path exists */ static absolutePathExists(path) { - if (!this.isLocalMode()) { - return false; + if (this.isLocalMode()) { + return this._fs.existsSync(path); + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP && path.startsWith(this._projectPath)) { + if (this.isFile(path)) { + return true; + } else if (this.isDirectory(path)) { + return true; + } + } + + return false; + } + + // C methods + + /** + * Creates the file system stamp + * + * @since 8.0.0 + * @private + * @static + */ + static _createStamp() { + if (!DKTools.Utils.isTest() || !this.isLocalMode() || this.mode === DKTools.IO.MODE_NWJS) { + return; } - return this._fs.existsSync(path); + const ignoredDirectories = DKToolsParam.get('File System', 'Ignored Directories') + .map(path => new DKTools.IO.Directory(path)); + const directory = DKTools.IO.getRootDirectory(); + const stamp = this._stamp; + let timeout = null; + + const processDirectory = (directory) => { + if (ignoredDirectories.some(dir => dir.getFullPath() === directory.getFullPath())) { + return; + } + + directory.getAllAsync().then(result => result.data).then((data) => { + data.forEach((entity) => { + entity.getStatsAsync().then(result => result.data).then((stats) => { + const fullPath = entity.getFullPath().substring(1).split('\\'); + + if (entity.isFile()) { + _.set(stamp, fullPath, { __stats__: { ...stats, type: 'file' } }); + } else { + _.set(stamp, fullPath, { __stats__: { ...stats, type: 'directory' } }); + } + + if (timeout) { + clearTimeout(timeout); + } + + timeout = setTimeout(() => { + const file = new DKTools.IO.File('data/Stamp.json'); + + file.saveJsonAsync(stamp, { compress: true }); + }); + }); + + if (entity.isDirectory()) { + processDirectory(entity); + } + }); + }); + }; + + processDirectory(directory); } // G methods @@ -122,7 +206,7 @@ DKTools.IO = class { /** * Returns true if the full path is a file * - * @version 3.0.0 + * @version 8.0.0 * @static * * @param {String} fullPath - Path to file @@ -134,14 +218,19 @@ DKTools.IO = class { * @returns {Boolean} Full path is a file */ static isFile(fullPath) { - if (!this.isLocalMode()) { - return false; - } + if (this.isLocalMode()) { + const absolutePath = this.getAbsolutePath(fullPath); - const absolutePath = this.getAbsolutePath(fullPath); + if (this.absolutePathExists(absolutePath)) { + return this._fs.lstatSync(absolutePath).isFile(); + } + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.normalizePath(fullPath).split('\\'); + const extension = _.last(parts); - if (this.absolutePathExists(absolutePath)) { - return this._fs.lstatSync(absolutePath).isFile(); + if (extension.includes('.')) { + return _.get(this._stamp, parts.concat('__stats__'), {}).type === 'file'; + } } return false; @@ -150,7 +239,7 @@ DKTools.IO = class { /** * Returns true if the full path is a directory * - * @version 3.0.0 + * @version 8.0.0 * @static * * @param {String} fullPath - Path to directory @@ -162,14 +251,19 @@ DKTools.IO = class { * @returns {Boolean} Full path is a directory */ static isDirectory(fullPath) { - if (!this.isLocalMode()) { - return false; - } + if (this.isLocalMode()) { + const absolutePath = this.getAbsolutePath(fullPath); - const absolutePath = this.getAbsolutePath(fullPath); + if (this.absolutePathExists(absolutePath)) { + return this._fs.lstatSync(absolutePath).isDirectory(); + } + } else if (this.mode === DKTools.IO.MODE_NWJS_STAMP) { + const parts = this.normalizePath(fullPath).split('\\').filter(part => !!part); + const extension = _.last(parts); - if (this.absolutePathExists(absolutePath)) { - return this._fs.lstatSync(absolutePath).isDirectory(); + if (!extension.includes('.')) { + return _.get(this._stamp, parts.concat('__stats__'), {}).type === 'directory'; + } } return false; @@ -207,6 +301,31 @@ DKTools.IO = class { return this.normalizePath(joined); } + // L methods + + /** + * Loads the file system stamp + * + * @since 8.0.0 + * @private + * @static + */ + static _loadStamp() { + if (this.isLocalMode() || this.mode === DKTools.IO.MODE_NWJS) { + return; + } + + const file = new DKTools.IO.File('data/Stamp.json'); + + file.loadJson({ + sync: true, + decompress: true, + onSuccess: (result) => { + this._stamp = result.data || this._stamp; + } + }); + } + // N methods /** @@ -458,6 +577,36 @@ Object.defineProperties(DKTools.IO, { configurable: true }, + /** + * File system mode + * + * @since 8.0.0 + * @readonly + * @type {Number} + * @memberof DKTools.IO + */ + mode: { + get: function() { + return this._mode; + }, + configurable: true + }, + + /** + * File system stamp + * + * @since 8.0.0 + * @readonly + * @type {Object} + * @memberof DKTools.IO + */ + stamp: { + get: function() { + return this._stamp; + }, + configurable: true + }, + /** * Operation completed successfully * @@ -562,6 +711,26 @@ Object.defineProperties(DKTools.IO, { */ ERROR_PARSING_DATA: { value: 10 }, + /** + * Nwjs + Stamp file system mode + * + * @since 8.0.0 + * @constant + * @type {Number} + * @memberof DKTools.IO + */ + MODE_NWJS_STAMP: { value: 0 }, + + /** + * Nwjs file system mode + * + * @since 8.0.0 + * @constant + * @type {Number} + * @memberof DKTools.IO + */ + MODE_NWJS: { value: 1 } + }); diff --git a/src/DKTools/Imported.js b/src/DKTools/Imported.js index 33f0a03..14452fe 100644 --- a/src/DKTools/Imported.js +++ b/src/DKTools/Imported.js @@ -7,7 +7,7 @@ * @type {Object} */ window.Imported = window.Imported || {}; -window.Imported.DKTools = '7.0.0'; +window.Imported.DKTools = '8.0.0'; diff --git a/src/DKTools/Network.js b/src/DKTools/Network.js index b0d7128..a4b033a 100644 --- a/src/DKTools/Network.js +++ b/src/DKTools/Network.js @@ -32,7 +32,7 @@ DKTools.Network = class { * @returns {Promise} ArrayBuffer */ static async fetchFile(url, options = {}) { - return fetch(url, options).then(response => { + return fetch(url, options).then((response) => { if (response.ok) { return this._toFile(response); } @@ -62,7 +62,7 @@ DKTools.Network = class { options.headers.Accept = 'application/json'; - return fetch(url, options).then(response => { + return fetch(url, options).then((response) => { if (response.ok) { return this._toJson(response); } diff --git a/src/DKTools/OptionManager.js b/src/DKTools/OptionManager.js index 207bff4..1f6c3d6 100644 --- a/src/DKTools/OptionManager.js +++ b/src/DKTools/OptionManager.js @@ -78,7 +78,7 @@ DKTools.OptionManager = class { if (cloneListeners) { _.forEach(this._optionChangeListeners, (listeners, option) => { - _.forEach(listeners, listener => { + _.forEach(listeners, (listener) => { optionManager.addOptionChangeListener(option, listener); }); }); diff --git a/src/DKTools/PreloadManager.js b/src/DKTools/PreloadManager.js index 101b71d..6eac483 100644 --- a/src/DKTools/PreloadManager.js +++ b/src/DKTools/PreloadManager.js @@ -628,10 +628,10 @@ DKTools.PreloadManager = class { return; } - const audioPromises = Promise.all(this._processLoadAudioFiles()); - const imagePromises = Promise.all(this._processLoadImageFiles()); + const audioPromise = Promise.all(this._processLoadAudioFiles()); + const imagePromise = Promise.all(this._processLoadImageFiles()); - Promise.all([audioPromises, imagePromises]).then(() => this._finish()); + Promise.all([audioPromise, imagePromise]).then(() => this._finish()); } }; diff --git a/src/DKTools/Scene Preloader.js b/src/DKTools/Scene Preloader.js index 8e7395e..b10dbba 100644 --- a/src/DKTools/Scene Preloader.js +++ b/src/DKTools/Scene Preloader.js @@ -11,7 +11,7 @@ * @memberof DKTools.Scene */ DKTools.Scene.Preloader = class { - + constructor() { this.initialize.apply(this, arguments); } @@ -123,7 +123,7 @@ DKTools.Scene.Preloader = class { */ start() { const promises = _.map(this._queue, (promise) => { - return promise.catch(result => { + return promise.catch((result) => { this._onError(); throw result; diff --git a/src/DKTools/Scene.js b/src/DKTools/Scene.js index 7c06412..88cf504 100644 --- a/src/DKTools/Scene.js +++ b/src/DKTools/Scene.js @@ -23,10 +23,103 @@ DKTools.Scene.prototype.initialize = function() { this._createAll(); this._setupAll(); this._addAllChildren(); + Scene_Base.prototype.initialize.call(this); }; -// _clear methods +// A methods + +/** + * Adds children objects to processing + * + * @private + */ +DKTools.Scene.prototype._addAllChildren = function() { + // to be overridden by plugins +}; + +/** + * Adds a listener of change of the option + * + * @since 2.0.0 + * + * @param {String} option - Name of the option + * @param {Function} listener - Listener + * + * @see DKTools.OptionManager.prototype.addOptionChangeListener + */ +DKTools.Scene.prototype.addOptionChangeListener = function(option, listener) { + this._optionManager.addOptionChangeListener(option, listener); +}; + +/** + * Adds the event + * + * @since 2.0.0 + * + * @param {DKTools.Event | Object} object - Event or object with parameters for the event + * + * @param {String} [object.type] - Type of the event + * @param {Number} [object.repeatTime] - Time of one repeat + * @param {Number} [object.repeats] - Amount of repeats + * @param {Number} [object.remainingPauseTime] - Remaining time of pause + * @param {Function} [object.onStart] - Handler of the event start + * @param {Function} [object.onUpdate] - Handler of the event update + * @param {Function} [object.onPause] - Handler of the event pause + * @param {Function} [object.onReset] - Handler of the event reset + * @param {Function} [object.onRepeat] - Handler of the event repeat + * @param {Function} [object.onSuccess] - Handler of the event success + * @param {Function} [object.onFail] - Handler of the event fail + * + * @see DKTools.Event + * @see DKTools.EventManager.prototype.addEvent + * + * @returns {DKTools.Event} Added event + */ +DKTools.Scene.prototype.addEvent = function(object) { + return this._eventManager.addEvent(object); +}; + +/** + * Adds the one time event + * + * @since 2.0.0 + * + * @param {DKTools.Event | Object} object - Event or object with parameters for the event + * + * @param {String} [object.type] - Type of the event + * @param {Number} [object.remainingPauseTime] - Remaining time of pause + * @param {Function} [object.onStart] - Handler of the event start + * @param {Function} [object.onUpdate] - Handler of the event update + * @param {Function} [object.onPause] - Handler of the event pause + * @param {Function} [object.onReset] - Handler of the event reset + * @param {Function} [object.onRepeat] - Handler of the event repeat + * @param {Function} [object.onSuccess] - Handler of the event success + * @param {Function} [object.onFail] - Handler of the event fail + * + * @see DKTools.Event + * @see DKTools.EventManager.prototype.addOneTimeEvent + * + * @returns {DKTools.Event} Added event + */ +DKTools.Scene.prototype.addOneTimeEvent = function(object) { + return this._eventManager.addOneTimeEvent(object); +}; + +/** + * Adds the animation + * + * @since 2.0.0 + * + * @param {DKTools.Animation} animation - Animation to add + * + * @see DKTools.EventManager.addAnimation + */ +DKTools.Scene.prototype.addAnimation = function(animation) { + this._eventManager.addAnimation(animation); +}; + +// C methods /** * Clears all data @@ -37,8 +130,6 @@ DKTools.Scene.prototype._clearAll = function() { // to be overridden by plugins }; -// _create methods - /** * Creates all * @@ -85,67 +176,30 @@ DKTools.Scene.prototype._createEventManager = function() { this._eventManager = new DKTools.EventManager(this); }; -// _setup methods - -/** - * Sets all data - * - * @version 2.0.0 - * @private - * - * @see DKTools.Scene.prototype._setupOptions - * @see DKTools.Scene.prototype._setupEvents - * @see DKTools.Scene.prototype._setupAnimations - */ -DKTools.Scene.prototype._setupAll = function() { - this._setupOptions(); - this._setupEvents(); - this._setupAnimations(); -}; - /** - * Sets the options + * Clears the options * * @since 2.0.0 - * @private - */ -DKTools.Scene.prototype._setupOptions = function() { - // to be overridden by plugins -}; - -/** - * Sets the events * - * @since 2.0.0 - * @private + * @see DKTools.OptionManager.prototype.clear */ -DKTools.Scene.prototype._setupEvents = function() { - // to be overridden by plugins +DKTools.Scene.prototype.clearOptions = function() { + this._optionManager.clear(); }; /** - * Sets the animations + * Clears the events * - * @since 2.0.0 - * @private - */ -DKTools.Scene.prototype._setupAnimations = function() { - // to be overridden by plugins -}; - -// _add methods - -/** - * Adds children objects to processing + * @version 2.0.0 * - * @private + * @param {String[] | String} object Array with event types or event type + * + * @see DKTools.EventManager.prototype.clearEvents */ -DKTools.Scene.prototype._addAllChildren = function() { - // to be overridden by plugins +DKTools.Scene.prototype.clearEvents = function(object) { + this._eventManager.clearEvents(object); }; -// create methods - /** * Creates all * @@ -160,11 +214,11 @@ DKTools.Scene.prototype._addAllChildren = function() { */ DKTools.Scene.prototype.create = function() { Scene_Base.prototype.create.call(this); - this.createBackground(); - this.createAllSprites(); - this.createWindowLayer(); - this.createAllWindows(); - this.createForeground(); + this.createBackground(); + this.createAllSprites(); + this.createWindowLayer(); + this.createAllWindows(); + this.createForeground(); }; /** @@ -195,369 +249,388 @@ DKTools.Scene.prototype.createForeground = function() { // to be overridden by plugins }; -// start methods +// D methods /** - * Starts the scene + * Destroys the scene + * + * @version 8.0.0 * * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see Stage.prototype.destroy */ -DKTools.Scene.prototype.start = function() { - Scene_Base.prototype.start.call(this); - this.startAllSprites(); - this.startAllWindows(); -}; +DKTools.Scene.prototype.destroy = function(options) { + this._clearAll(); -/** - * Starts all sprites - */ -DKTools.Scene.prototype.startAllSprites = function() { - // to be overridden by plugins + this.clearEvents(); + this.deactivate(); + + Stage.prototype.destroy.call(this, options); }; /** - * Starts all windows + * Turns off the option + * + * @since 2.0.0 + * + * @param {String} option - Name of the option + * + * @see DKTools.OptionManager.prototype.disableOption */ -DKTools.Scene.prototype.startAllWindows = function() { - // to be overridden by plugins +DKTools.Scene.prototype.disableOption = function(option) { + this._optionManager.disableOption(option); }; -// remove methods - /** - * Removes the window from the scene + * Turns off the options * - * @param {DKTools.Window | *} window - Window to remove + * @since 2.0.0 + * + * @param {String[] | ...String} object - Names of the options + * + * @see DKTools.OptionManager.prototype.disableOptions */ -DKTools.Scene.prototype.removeWindow = function(window) { - if (this.hasWindowLayer() && this.isChild(window)) { - this._windowLayer.removeChild(window); - } +DKTools.Scene.prototype.disableOptions = function(object) { + this._optionManager.disableOption(object); }; -// has methods +// E methods /** - * Returns true if the scene has the layer of windows + * Turns on the option * - * @returns {Boolean} Scene has the layer of windows + * @since 2.0.0 + * + * @param {String} option - Name of the option + * + * @see DKTools.OptionManager.prototype.enableOption */ -DKTools.Scene.prototype.hasWindowLayer = function() { - return !!this._windowLayer; +DKTools.Scene.prototype.enableOption = function(option) { + this._optionManager.enableOption(option); }; -// is methods - /** - * Returns true if the object (parameter) is child of scene + * Turns on the options * - * @param {Sprite | Window} object - Object + * @since 2.0.0 * - * @returns {Boolean} Object (parameter) is child of scene + * @param {String[] | ...String} object - Names of the options + * + * @see DKTools.OptionManager.prototype.enableOptions */ -DKTools.Scene.prototype.isChild = function(object) { - if (object instanceof Window && this.hasWindowLayer()) { - return DKTools.Utils.Array.contains(this._windowLayer.children, object); - } - - return DKTools.Utils.Array.contains(this.children, object); +DKTools.Scene.prototype.enableOptions = function(object) { + this._optionManager.enableOption(object); }; -// stop methods +// F methods /** - * Stops the scene + * Finishes the events * - * @override + * @since 2.0.0 * - * @see Scene_Base.prototype.stop - * @see DKTools.Scene.prototype.stopAll + * @param {String} type - Type of the events + * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events + * + * @see DKTools.EventManager.prototype.finishEvents */ -DKTools.Scene.prototype.stop = function() { - Scene_Base.prototype.stop.call(this); - this.stopAll(); +DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { + this._eventManager.finishEvents(type, forcedSuccess); }; +// G methods + /** - * Stops all + * Returns a container for the events by event type + * + * @since 2.0.0 + * + * @param {String} type - Type of the events + * + * @see DKTools.EventManager.prototype.getEventsContainerByType + * + * @returns {Array} Container for the events */ -DKTools.Scene.prototype.stopAll = function() { - // to be overridden by plugins +DKTools.Scene.prototype.getEventsContainerByType = function(type) { + return this._eventManager.getEventsContainerByType(type); }; -// terminate methods - /** - * Terminates the scene + * Returns a container for the events by event * - * @override + * @since 2.0.0 * - * @see Scene_Base.prototype.terminate - * @see DKTools.Scene.prototype.stopAll - */ -DKTools.Scene.prototype.terminate = function() { - Scene_Base.prototype.terminate.call(this); - this.terminateAll(); -}; - -/** - * Terminates all + * @param {DKTools.Event | DKTools.Animation} event - Event + * + * @see DKTools.EventManager.prototype.getEventsContainer + * + * @returns {Array} Container for the events */ -DKTools.Scene.prototype.terminateAll = function() { - // to be overridden by plugins +DKTools.Scene.prototype.getEventsContainer = function(event) { + return this._eventManager.getEventsContainer(event); }; -// option methods - /** - * Clears the options + * Returns an index of the event in its container * * @since 2.0.0 * - * @see DKTools.OptionManager.prototype.clear + * @param {DKTools.Event | DKTools.Animation} event - Event + * + * @see DKTools.EventManager.prototype.getEventIndex + * + * @returns {Number} Index of the event in its container */ -DKTools.Scene.prototype.clearOptions = function() { - this._optionManager.clear(); +DKTools.Scene.prototype.getEventIndex = function(event) { + return this._eventManager.getEventIndex(event); }; /** - * Returns true if the option is enabled + * Returns an array with the all events or events of a certain type * * @since 2.0.0 * - * @param {String} option - Name of the option + * @param {String} [type] - Type of the events * - * @see DKTools.OptionManager.prototype.isOptionEnabled + * @see DKTools.EventManager.prototype.getEvents * - * @returns {Boolean} Option is enabled + * @returns {Array} Array with the events */ -DKTools.Scene.prototype.isOptionEnabled = function(option) { - return this._optionManager.isOptionEnabled(option); +DKTools.Scene.prototype.getEvents = function(type) { + return this._eventManager.getEvents(type); }; /** - * Returns conjunction of the options + * Returns an array with the all animations or animations of a certain type * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {String} [type] - Type of animation * - * @see DKTools.OptionManager.prototype.isOptionsEnabled + * @see DKTools.EventManager.prototype.getAnimations * - * @returns {Boolean} Conjunction of the options + * @returns {Array} Array with the animations */ -DKTools.Scene.prototype.isOptionsEnabled = function(object) { - return this._optionManager.isOptionsEnabled(object); +DKTools.Scene.prototype.getAnimations = function(type) { + return this._eventManager.getAnimations(type); }; +// H methods + /** - * Returns disjunction of the options - * - * @since 2.0.0 - * - * @param {String[] | ...String} object - Names of the options - * - * @see DKTools.OptionManager.prototype.isSomeOptionsEnabled + * Returns true if the scene has the layer of windows * - * @returns {Boolean} Disjunction of the options + * @returns {Boolean} Scene has the layer of windows */ -DKTools.Scene.prototype.isSomeOptionsEnabled = function(object) { - return this._optionManager.isSomeOptionsEnabled(object); +DKTools.Scene.prototype.hasWindowLayer = function() { + return !!this._windowLayer; }; /** - * Returns true if the option is disabled + * Checks for existence of the event in the object + * Returns true if the event exists * * @since 2.0.0 * - * @param {String} option - Name of the option + * @param {DKTools.Event | DKTools.Animation} event - Event * - * @see DKTools.OptionManager.prototype.isOptionDisabled + * @see DKTools.EventManager.prototype.hasEvent * - * @returns {Boolean} Option is disabled + * @returns {Boolean} Event exists */ -DKTools.Scene.prototype.isOptionDisabled = function(option) { - return this._optionManager.isOptionDisabled(option); +DKTools.Scene.prototype.hasEvent = function(event) { + return this._eventManager.hasEvent(event); }; /** - * Returns conjunction of the options + * Checks for existence of the events of a certain type + * Returns true if the events exists * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {String} [type] - Type of the Events * - * @see DKTools.OptionManager.prototype.isOptionsDisabled + * @see DKTools.EventManager.prototype.hasEvents * - * @returns {Boolean} Conjunction of the options + * @returns {Boolean} Events exists */ -DKTools.Scene.prototype.isOptionsDisabled = function(object) { - return this._optionManager.isOptionsDisabled(object); +DKTools.Scene.prototype.hasEvents = function(type) { + return this._eventManager.hasEvents(type); }; /** - * Returns disjunction of the options + * Checks for existence of the animation in the object + * Returns true if the animation exists * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {DKTools.Animation} animation - Animation * - * @see DKTools.OptionManager.prototype.isSomeOptionsDisabled + * @see DKTools.EventManager.prototype.hasAnimation * - * @returns {Boolean} Disjunction of the options + * @returns {Boolean} Animation exists */ -DKTools.Scene.prototype.isSomeOptionsDisabled = function(object) { - return this._optionManager.isSomeOptionsDisabled(object); +DKTools.Scene.prototype.hasAnimation = function(animation) { + return this._eventManager.hasAnimation(animation); }; /** - * Returns true if some option is enabled + * Checks for existence of the animations of a certain type + * Returns true if the animations exists * * @since 2.0.0 * - * @see DKTools.OptionManager.prototype.isSomeOptionEnabled + * @param {String} [type] - Type of the animations * - * @returns {Boolean} Some option is enabled + * @see DKTools.EventManager.prototype.hasAnimations + * + * @returns {Boolean} Animations exists */ -DKTools.Scene.prototype.isSomeOptionEnabled = function() { - return this._optionManager.isSomeOptionEnabled(); +DKTools.Scene.prototype.hasAnimations = function(type) { + return this._eventManager.hasAnimations(type); }; +// I methods + /** - * Adds a listener of change of the option - * - * @since 2.0.0 - * - * @param {String} option - Name of the option - * @param {Function} listener - Listener + * Calls the callback function for the child objects * - * @see DKTools.OptionManager.prototype.addOptionChangeListener + * @param {Function} callback - Function for the child objects */ -DKTools.Scene.prototype.addOptionChangeListener = function(option, listener) { - this._optionManager.addOptionChangeListener(option, listener); +DKTools.Scene.prototype.iterateChildren = function(callback) { + _.forEach(this.children, callback); }; /** - * Removes the listener of change of the option - * - * @since 2.0.0 + * Returns true if the object (parameter) is child of scene * - * @param {String} option - Name of the option - * @param {Function} listener - Listener + * @param {Sprite | Window} object - Object * - * @see DKTools.OptionManager.prototype.removeOptionsChangeListener + * @returns {Boolean} Object (parameter) is child of scene */ -DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) { - this._optionManager.removeOptionChangeListener(option, listener); +DKTools.Scene.prototype.isChild = function(object) { + if (object instanceof Window && this.hasWindowLayer()) { + return DKTools.Utils.Array.contains(this._windowLayer.children, object); + } + + return DKTools.Utils.Array.contains(this.children, object); }; /** - * Turns on the option - * - * @since 2.0.0 + * Returns true if the scene was destroyed * - * @param {String} option - Name of the option + * @since 8.0.0 * - * @see DKTools.OptionManager.prototype.enableOption + * @returns {Boolean} Scene was destroyed */ -DKTools.Scene.prototype.enableOption = function(option) { - this._optionManager.enableOption(option); +DKTools.Scene.prototype.isDestroyed = function() { + return this._destroyed; }; /** - * Turns on the options + * Returns true if the option is enabled * * @since 2.0.0 * - * @param {String[] | ...String} object - Names of the options + * @param {String} option - Name of the option * - * @see DKTools.OptionManager.prototype.enableOptions + * @see DKTools.OptionManager.prototype.isOptionEnabled + * + * @returns {Boolean} Option is enabled */ -DKTools.Scene.prototype.enableOptions = function(object) { - this._optionManager.enableOption(object); +DKTools.Scene.prototype.isOptionEnabled = function(option) { + return this._optionManager.isOptionEnabled(option); }; /** - * Turns off the option + * Returns conjunction of the options * * @since 2.0.0 * - * @param {String} option - Name of the option + * @param {String[] | ...String} object - Names of the options * - * @see DKTools.OptionManager.prototype.disableOption + * @see DKTools.OptionManager.prototype.isOptionsEnabled + * + * @returns {Boolean} Conjunction of the options */ -DKTools.Scene.prototype.disableOption = function(option) { - this._optionManager.disableOption(option); +DKTools.Scene.prototype.isOptionsEnabled = function(object) { + return this._optionManager.isOptionsEnabled(object); }; /** - * Turns off the options + * Returns disjunction of the options * * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options * - * @see DKTools.OptionManager.prototype.disableOptions + * @see DKTools.OptionManager.prototype.isSomeOptionsEnabled + * + * @returns {Boolean} Disjunction of the options */ -DKTools.Scene.prototype.disableOptions = function(object) { - this._optionManager.disableOption(object); +DKTools.Scene.prototype.isSomeOptionsEnabled = function(object) { + return this._optionManager.isSomeOptionsEnabled(object); }; /** - * Switches the option + * Returns true if the option is disabled * * @since 2.0.0 * * @param {String} option - Name of the option * - * @see DKTools.OptionManager.prototype.switchOption + * @see DKTools.OptionManager.prototype.isOptionDisabled + * + * @returns {Boolean} Option is disabled */ -DKTools.Scene.prototype.switchOption = function(option) { - this._optionManager.disableOption(option); +DKTools.Scene.prototype.isOptionDisabled = function(option) { + return this._optionManager.isOptionDisabled(option); }; /** - * Switches the options + * Returns conjunction of the options * * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options * - * @see DKTools.OptionManager.prototype.switchOptions + * @see DKTools.OptionManager.prototype.isOptionsDisabled + * + * @returns {Boolean} Conjunction of the options */ -DKTools.Scene.prototype.switchOptions = function(object) { - this._optionManager.switchOptions(object); +DKTools.Scene.prototype.isOptionsDisabled = function(object) { + return this._optionManager.isOptionsDisabled(object); }; -// events methods - /** - * Clears the events + * Returns disjunction of the options * - * @version 2.0.0 + * @since 2.0.0 * - * @param {String[] | String} object Array with event types or event type + * @param {String[] | ...String} object - Names of the options * - * @see DKTools.EventManager.prototype.clearEvents + * @see DKTools.OptionManager.prototype.isSomeOptionsDisabled + * + * @returns {Boolean} Disjunction of the options */ -DKTools.Scene.prototype.clearEvents = function(object) { - this._eventManager.clearEvents(object); +DKTools.Scene.prototype.isSomeOptionsDisabled = function(object) { + return this._optionManager.isSomeOptionsDisabled(object); }; /** - * Removes the event from a container - * Returns true if the event was removed + * Returns true if some option is enabled * * @since 2.0.0 * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.removeEvent + * @see DKTools.OptionManager.prototype.isSomeOptionEnabled * - * @returns {Boolean} Event was removed + * @returns {Boolean} Some option is enabled */ -DKTools.Scene.prototype.removeEvent = function(event) { - return this._eventManager.removeEvent(event); +DKTools.Scene.prototype.isSomeOptionEnabled = function() { + return this._optionManager.isSomeOptionEnabled(); }; /** @@ -590,6 +663,8 @@ DKTools.Scene.prototype.isEventsPaused = function(type) { return this._eventManager.isEventsPaused(type); }; +// P methods + /** * Pauses the events * @@ -604,386 +679,338 @@ DKTools.Scene.prototype.pauseEvents = function(type, duration) { this._eventManager.pauseEvents(type, duration); }; +// R methods + /** - * Resumes the events + * Removes the listener of change of the option * * @since 2.0.0 * - * @param {String} type - Type of the events + * @param {String} option - Name of the option + * @param {Function} listener - Listener * - * @see DKTools.EventManager.prototype.resumeEvents + * @see DKTools.OptionManager.prototype.removeOptionsChangeListener */ -DKTools.Scene.prototype.resumeEvents = function(type) { - this._eventManager.resumeEvents(type); +DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) { + this._optionManager.removeOptionChangeListener(option, listener); }; /** - * Finishes the events + * Removes the event from a container + * Returns true if the event was removed * * @since 2.0.0 * - * @param {String} type - Type of the events - * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events + * @param {DKTools.Event | DKTools.Animation} event - Event * - * @see DKTools.EventManager.prototype.finishEvents + * @see DKTools.EventManager.prototype.removeEvent + * + * @returns {Boolean} Event was removed */ -DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { - this._eventManager.finishEvents(type, forcedSuccess); +DKTools.Scene.prototype.removeEvent = function(event) { + return this._eventManager.removeEvent(event); }; /** - * Stops the events + * Resumes the events * * @since 2.0.0 * * @param {String} type - Type of the events - * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events * - * @see DKTools.EventManager.prototype.stopEvents + * @see DKTools.EventManager.prototype.resumeEvents */ -DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { - this._eventManager.stopEvents(type, forcedSuccess); +DKTools.Scene.prototype.resumeEvents = function(type) { + this._eventManager.resumeEvents(type); }; /** - * Updates the events - * - * @since 2.0.0 + * Removes the window from the scene * - * @see DKTools.EventManager.prototype.update - * @see DKTools.Base.protoype.updateReadyEvents - * @see DKTools.Base.protoype.updateUpdateEvents - * @see DKTools.Base.protoype.updateQueueEvents - * @see DKTools.Base.protoype.updateWheelEvents + * @param {DKTools.Window | *} window - Window to remove */ -DKTools.Scene.prototype.updateEvents = function() { - this._eventManager.update(); - this.updateReadyEvents(); - this.updateUpdateEvents(); - this.updateQueueEvents(); +DKTools.Scene.prototype.removeWindow = function(window) { + if (this.hasWindowLayer() && this.isChild(window)) { + this._windowLayer.removeChild(window); + } }; +// S methods + /** - * Updates the event - * - * @since 2.0.0 + * Sets all data * - * @param {DKTools.Event | DKTools.Animation} event - Event + * @version 2.0.0 + * @private * - * @see DKTools.EventManager.prototype.updateEvent + * @see DKTools.Scene.prototype._setupOptions + * @see DKTools.Scene.prototype._setupEvents + * @see DKTools.Scene.prototype._setupAnimations */ -DKTools.Scene.prototype.updateEvent = function(event) { - this._eventManager.updateEvent(event); +DKTools.Scene.prototype._setupAll = function() { + this._setupOptions(); + this._setupEvents(); + this._setupAnimations(); }; /** - * Updates the events from container + * Sets the options * * @since 2.0.0 - * - * @param {String} type - Type of the events - * - * @see DKTools.EventManager.prototype.updateEventsContainer + * @private */ -DKTools.Scene.prototype.updateEventsContainer = function(type) { - this._eventManager.updateEventsContainer(type); +DKTools.Scene.prototype._setupOptions = function() { + // to be overridden by plugins }; /** - * Updates the events with type: ready + * Sets the events * * @since 2.0.0 - * - * @see DKTools.EventManager.prototype.updateEventsContainer + * @private */ -DKTools.Scene.prototype.updateReadyEvents = function() { - if (this.isReady()) { - this.updateEventsContainer('ready'); - } +DKTools.Scene.prototype._setupEvents = function() { + // to be overridden by plugins }; /** - * Updates the events with type: update + * Sets the animations * * @since 2.0.0 - * - * @see DKTools.EventManager.prototype.updateEventsContainer + * @private */ -DKTools.Scene.prototype.updateUpdateEvents = function() { - this.updateEventsContainer('update'); +DKTools.Scene.prototype._setupAnimations = function() { + // to be overridden by plugins }; /** - * Updates the events with type: queue - * - * @since 2.0.0 + * Starts the scene * - * @see DKTools.EventManager.prototype.updateEventsContainer + * @override */ -DKTools.Scene.prototype.updateQueueEvents = function() { - const container = this.getEventsContainerByType('queue'); - const event = container[0]; +DKTools.Scene.prototype.start = function() { + Scene_Base.prototype.start.call(this); + this.startAllSprites(); + this.startAllWindows(); +}; - this.updateEvent(event); +/** + * Starts all sprites + */ +DKTools.Scene.prototype.startAllSprites = function() { + // to be overridden by plugins }; /** - * Returns a container for the events by event type - * - * @since 2.0.0 - * - * @param {String} type - Type of the events - * - * @see DKTools.EventManager.prototype.getEventsContainerByType - * - * @returns {Array} Container for the events + * Starts all windows */ -DKTools.Scene.prototype.getEventsContainerByType = function(type) { - return this._eventManager.getEventsContainerByType(type); +DKTools.Scene.prototype.startAllWindows = function() { + // to be overridden by plugins }; /** - * Returns a container for the events by event - * - * @since 2.0.0 - * - * @param {DKTools.Event | DKTools.Animation} event - Event + * Stops the scene * - * @see DKTools.EventManager.prototype.getEventsContainer + * @override * - * @returns {Array} Container for the events + * @see Scene_Base.prototype.stop + * @see DKTools.Scene.prototype.stopAll */ -DKTools.Scene.prototype.getEventsContainer = function(event) { - return this._eventManager.getEventsContainer(event); +DKTools.Scene.prototype.stop = function() { + Scene_Base.prototype.stop.call(this); + this.stopAll(); }; /** - * Returns an index of the event in its container - * - * @since 2.0.0 - * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.getEventIndex - * - * @returns {Number} Index of the event in its container + * Stops all */ -DKTools.Scene.prototype.getEventIndex = function(event) { - return this._eventManager.getEventIndex(event); +DKTools.Scene.prototype.stopAll = function() { + // to be overridden by plugins }; /** - * Returns an array with the all events or events of a certain type + * Stops the events * * @since 2.0.0 * - * @param {String} [type] - Type of the events - * - * @see DKTools.EventManager.prototype.getEvents + * @param {String} type - Type of the events + * @param {Boolean} [forcedSuccess] - Forced success for the finish of the events * - * @returns {Array} Array with the events + * @see DKTools.EventManager.prototype.stopEvents */ -DKTools.Scene.prototype.getEvents = function(type) { - return this._eventManager.getEvents(type); +DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { + this._eventManager.stopEvents(type, forcedSuccess); }; /** - * Returns an array with the all animations or animations of a certain type + * Switches the option * * @since 2.0.0 * - * @param {String} [type] - Type of animation - * - * @see DKTools.EventManager.prototype.getAnimations + * @param {String} option - Name of the option * - * @returns {Array} Array with the animations + * @see DKTools.OptionManager.prototype.switchOption */ -DKTools.Scene.prototype.getAnimations = function(type) { - return this._eventManager.getAnimations(type); +DKTools.Scene.prototype.switchOption = function(option) { + this._optionManager.disableOption(option); }; /** - * Checks for existence of the event in the object - * Returns true if the event exists + * Switches the options * * @since 2.0.0 * - * @param {DKTools.Event | DKTools.Animation} event - Event - * - * @see DKTools.EventManager.prototype.hasEvent + * @param {String[] | ...String} object - Names of the options * - * @returns {Boolean} Event exists + * @see DKTools.OptionManager.prototype.switchOptions */ -DKTools.Scene.prototype.hasEvent = function(event) { - return this._eventManager.hasEvent(event); +DKTools.Scene.prototype.switchOptions = function(object) { + this._optionManager.switchOptions(object); }; +// T methods + /** - * Checks for existence of the events of a certain type - * Returns true if the events exists - * - * @since 2.0.0 - * - * @param {String} [type] - Type of the Events + * Terminates the scene * - * @see DKTools.EventManager.prototype.hasEvents + * @override * - * @returns {Boolean} Events exists + * @see Scene_Base.prototype.terminate + * @see DKTools.Scene.prototype.stopAll */ -DKTools.Scene.prototype.hasEvents = function(type) { - return this._eventManager.hasEvents(type); +DKTools.Scene.prototype.terminate = function() { + Scene_Base.prototype.terminate.call(this); + this.terminateAll(); }; /** - * Checks for existence of the animation in the object - * Returns true if the animation exists - * - * @since 2.0.0 - * - * @param {DKTools.Animation} animation - Animation - * - * @see DKTools.EventManager.prototype.hasAnimation - * - * @returns {Boolean} Animation exists + * Terminates all */ -DKTools.Scene.prototype.hasAnimation = function(animation) { - return this._eventManager.hasAnimation(animation); +DKTools.Scene.prototype.terminateAll = function() { + // to be overridden by plugins }; +// U methods + /** - * Checks for existence of the animations of a certain type - * Returns true if the animations exists - * - * @since 2.0.0 - * - * @param {String} [type] - Type of the animations + * Updates the scene * - * @see DKTools.EventManager.prototype.hasAnimations + * @version 2.0.0 + * @override * - * @returns {Boolean} Animations exists + * @see DKTools.Scene.prototype.updateChildren + * @see DKTools.Scene.prototype.updateFade */ -DKTools.Scene.prototype.hasAnimations = function(type) { - return this._eventManager.hasAnimations(type); +DKTools.Scene.prototype.update = function() { + this.updateChildren(); + this.updateFade(); + this.updateEvents(); }; /** - * Adds the event - * - * @since 2.0.0 - * - * @param {DKTools.Event | Object} object - Event or object with parameters for the event + * Updates the child object * - * @param {String} [object.type] - Type of the event - * @param {Number} [object.repeatTime] - Time of one repeat - * @param {Number} [object.repeats] - Amount of repeats - * @param {Number} [object.remainingPauseTime] - Remaining time of pause - * @param {Function} [object.onStart] - Handler of the event start - * @param {Function} [object.onUpdate] - Handler of the event update - * @param {Function} [object.onPause] - Handler of the event pause - * @param {Function} [object.onReset] - Handler of the event reset - * @param {Function} [object.onRepeat] - Handler of the event repeat - * @param {Function} [object.onSuccess] - Handler of the event success - * @param {Function} [object.onFail] - Handler of the event fail + * @param {*} child - Child object + */ +DKTools.Scene.prototype.updateChild = function(child) { + if (child && DKTools.Utils.isFunction(child.update)) { + child.update(); + } +}; + +/** + * Updates the child objects * - * @see DKTools.Event - * @see DKTools.EventManager.prototype.addEvent + * @override * - * @returns {DKTools.Event} Added event + * @see DKTools.Scene.prototype.iterateChildren + * @see DKTools.Scene.prototype.updateChild */ -DKTools.Scene.prototype.addEvent = function(object) { - return this._eventManager.addEvent(object); +DKTools.Scene.prototype.updateChildren = function() { + this.iterateChildren(this.updateChild); }; /** - * Adds the one time event + * Updates the events * * @since 2.0.0 * - * @param {DKTools.Event | Object} object - Event or object with parameters for the event - * - * @param {String} [object.type] - Type of the event - * @param {Number} [object.remainingPauseTime] - Remaining time of pause - * @param {Function} [object.onStart] - Handler of the event start - * @param {Function} [object.onUpdate] - Handler of the event update - * @param {Function} [object.onPause] - Handler of the event pause - * @param {Function} [object.onReset] - Handler of the event reset - * @param {Function} [object.onRepeat] - Handler of the event repeat - * @param {Function} [object.onSuccess] - Handler of the event success - * @param {Function} [object.onFail] - Handler of the event fail - * - * @see DKTools.Event - * @see DKTools.EventManager.prototype.addOneTimeEvent - * - * @returns {DKTools.Event} Added event + * @see DKTools.EventManager.prototype.update + * @see DKTools.Base.protoype.updateReadyEvents + * @see DKTools.Base.protoype.updateUpdateEvents + * @see DKTools.Base.protoype.updateQueueEvents + * @see DKTools.Base.protoype.updateWheelEvents */ -DKTools.Scene.prototype.addOneTimeEvent = function(object) { - return this._eventManager.addOneTimeEvent(object); +DKTools.Scene.prototype.updateEvents = function() { + this._eventManager.update(); + this.updateReadyEvents(); + this.updateUpdateEvents(); + this.updateQueueEvents(); }; /** - * Adds the animation + * Updates the event * * @since 2.0.0 * - * @param {DKTools.Animation} animation - Animation to add + * @param {DKTools.Event | DKTools.Animation} event - Event * - * @see DKTools.EventManager.addAnimation + * @see DKTools.EventManager.prototype.updateEvent */ -DKTools.Scene.prototype.addAnimation = function(animation) { - this._eventManager.addAnimation(animation); +DKTools.Scene.prototype.updateEvent = function(event) { + this._eventManager.updateEvent(event); }; -// other methods - /** - * Calls the callback function for the child objects + * Updates the events from container * - * @param {Function} callback - Function for the child objects + * @since 2.0.0 + * + * @param {String} type - Type of the events + * + * @see DKTools.EventManager.prototype.updateEventsContainer */ -DKTools.Scene.prototype.iterateChildren = function(callback) { - _.forEach(this.children, callback); +DKTools.Scene.prototype.updateEventsContainer = function(type) { + this._eventManager.updateEventsContainer(type); }; -// update methods - /** - * Updates the scene + * Updates the events with type: ready * - * @version 2.0.0 - * @override + * @since 2.0.0 * - * @see DKTools.Scene.prototype.updateChildren - * @see DKTools.Scene.prototype.updateFade + * @see DKTools.EventManager.prototype.updateEventsContainer */ -DKTools.Scene.prototype.update = function() { - this.updateChildren(); - this.updateFade(); - this.updateEvents(); +DKTools.Scene.prototype.updateReadyEvents = function() { + if (this.isReady()) { + this.updateEventsContainer('ready'); + } }; /** - * Updates the child object + * Updates the events with type: update * - * @param {*} child - Child object + * @since 2.0.0 + * + * @see DKTools.EventManager.prototype.updateEventsContainer */ -DKTools.Scene.prototype.updateChild = function(child) { - if (child && DKTools.Utils.isFunction(child.update)) { - child.update(); - } +DKTools.Scene.prototype.updateUpdateEvents = function() { + this.updateEventsContainer('update'); }; /** - * Updates the child objects + * Updates the events with type: queue * - * @override + * @since 2.0.0 * - * @see DKTools.Scene.prototype.iterateChildren - * @see DKTools.Scene.prototype.updateChild + * @see DKTools.EventManager.prototype.updateEventsContainer */ -DKTools.Scene.prototype.updateChildren = function() { - this.iterateChildren(this.updateChild); -}; +DKTools.Scene.prototype.updateQueueEvents = function() { + const container = this.getEventsContainerByType('queue'); + const event = container[0]; + this.updateEvent(event); +}; diff --git a/src/DKTools/Sprite Button.js b/src/DKTools/Sprite Button.js index f13cca7..b5a4f46 100644 --- a/src/DKTools/Sprite Button.js +++ b/src/DKTools/Sprite Button.js @@ -486,34 +486,6 @@ Object.defineProperties(DKTools.Sprite.Button.prototype, { return this._mousePressTime; }, configurable: true - }, - - /** - * The X coordinate of press inside the sprite - * - * @readonly - * @type {Number} - * @memberof DKTools.Sprite.Button.prototype - */ - pressX : { - get: function() { - return this.canvasToLocalX(TouchInput.x); - }, - configurable: true - }, - - /** - * The Y coordinate of press inside the sprite - * - * @readonly - * @type {Number} - * @memberof DKTools.Sprite.Button.prototype - */ - pressY : { - get: function() { - return this.canvasToLocalY(TouchInput.y); - }, - configurable: true } }); diff --git a/src/DKTools/Sprite Cursor.js b/src/DKTools/Sprite Cursor.js index e35bf2a..b813489 100644 --- a/src/DKTools/Sprite Cursor.js +++ b/src/DKTools/Sprite Cursor.js @@ -87,6 +87,8 @@ DKTools.Sprite.Cursor = class extends DKTools.Sprite { /** * Updates the cursor * + * @version 8.0.0 + * * @see DKTools.Sprite.Cursor.prototype.move * @see DKTools.Sprite.Cursor.prototype.setupBitmap */ @@ -99,8 +101,8 @@ DKTools.Sprite.Cursor = class extends DKTools.Sprite { const m = 4; const ox = 0; const oy = 0; - const w2 = Math.min(w, parent.realWidth - x); - const h2 = Math.min(h, parent.realHeight - y); + const w2 = Math.min(w, parent.width - x); + const h2 = Math.min(h, parent.height - y); this.move(x, y); diff --git a/src/DKTools/Sprite ProgressBar Circle.js b/src/DKTools/Sprite ProgressBar Circle.js index 971e59f..6e7706a 100644 --- a/src/DKTools/Sprite ProgressBar Circle.js +++ b/src/DKTools/Sprite ProgressBar Circle.js @@ -129,14 +129,16 @@ DKTools.Sprite.ProgressBar.Circle = class extends DKTools.Sprite.ProgressBar { /** * Returns the standard handler of draw of the graphic * + * @version 8.0.0 + * * @override + * * @returns {Function} Standard handler of draw of the graphic */ standardDrawGraphicHandler() { return () => { const lineWidth = this._lineWidth; - const realWidth = this.realWidth; - const radius = (realWidth - lineWidth) / 2; + const radius = (this.width - lineWidth) / 2; const x = radius + lineWidth / 2; const y = x; @@ -169,7 +171,7 @@ DKTools.Sprite.ProgressBar.Circle = class extends DKTools.Sprite.ProgressBar { const percents = this.getPercents(); const text = `${percents}%`; - this.drawText(text, { height: this.realHeight }); + this.drawText(text, { height: this.height }); }; } diff --git a/src/DKTools/Sprite ProgressBar Rectangle.js b/src/DKTools/Sprite ProgressBar Rectangle.js index 3f525d2..bd2d0f1 100644 --- a/src/DKTools/Sprite ProgressBar Rectangle.js +++ b/src/DKTools/Sprite ProgressBar Rectangle.js @@ -54,7 +54,7 @@ DKTools.Sprite.ProgressBar.Rectangle = class extends DKTools.Sprite.ProgressBar const percents = this.getPercents(); const text = `${percents}%`; - this.drawText(text, { height: this.realHeight }); + this.drawText(text, { height: this.height }); }; } diff --git a/src/DKTools/Sprite ProgressBar SemiCircle.js b/src/DKTools/Sprite ProgressBar SemiCircle.js index e623f58..8c865d5 100644 --- a/src/DKTools/Sprite ProgressBar SemiCircle.js +++ b/src/DKTools/Sprite ProgressBar SemiCircle.js @@ -19,16 +19,18 @@ DKTools.Sprite.ProgressBar.SemiCircle = class extends DKTools.Sprite.ProgressBar /** * Returns the standard handler of draw of the graphic * + * @version 8.0.0 + * * @override + * * @returns {Function} Standard handler of draw of the graphic */ standardDrawGraphicHandler() { return () => { const lineWidth = this._lineWidth; - const realWidth = this.realWidth; - const radius = (realWidth - lineWidth) / 2; + const radius = (this.width - lineWidth) / 2; const x = radius + lineWidth / 2; - const y = this.realHeight; + const y = this.height; this.strokeArc({ x, y, diff --git a/src/DKTools/Sprite Selectable.js b/src/DKTools/Sprite Selectable.js index 77c0069..5aa474a 100644 --- a/src/DKTools/Sprite Selectable.js +++ b/src/DKTools/Sprite Selectable.js @@ -1086,6 +1086,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Returns the maximum page rows * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.getItemHeight * @see DKTools.Sprite.Selectable.prototype.getMaxRows * @@ -1093,21 +1095,21 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { */ getMaxPageRows() { const spacing = this._verticalSpacing; - const realHeight = this.realHeight; const itemHeight = this.getItemHeight(); const maxRows = this.getMaxRows(); - let rows = 0, height = 0; + let height = this.height; + let rows = 0; for (; rows < maxRows; rows++) { if (rows === maxRows - 1) { - if (height + itemHeight > realHeight) { + if (height - itemHeight < 0) { break; } - } else if (height + itemHeight + spacing > realHeight) { + } else if (height - itemHeight - spacing < 0) { break; } - height += itemHeight + spacing; + height -= itemHeight + spacing; } return rows; @@ -1498,12 +1500,13 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { } /** + * @version 8.0.0 + * * @param {Number} x - The X coordinate * @param {Number} y - The Y coordinate * * @see DKTools.Sprite.Selectable.prototype.isOutside - * @see DKTools.Sprite.Selectable.prototype.canvasToLocalX - * @see DKTools.Sprite.Selectable.prototype.canvasToLocalY + * @see DKTools.Sprite.Selectable.prototype.getLocalPoint * @see DKTools.Sprite.Selectable.prototype.getMaxPageItems * @see DKTools.Sprite.Selectable.prototype.getMaxItems * @see DKTools.Sprite.Selectable.prototype.getTopIndex @@ -1517,8 +1520,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { } const scale = this.scale; - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); + const localPoint = this.getLocalPoint(x, y); const maxPageItems = this.getMaxPageItems(); const maxItems = this.getMaxItems(); let index = this.getTopIndex(); @@ -1531,7 +1533,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { rect.width *= scale.x; rect.height *= scale.y; - if (rect.contains(localX, localY)) { + if (rect.contains(localPoint.x, localPoint.y)) { return index; } } @@ -1993,6 +1995,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Processes the hover of the mouse * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.isOptionEnabled * @see DKTools.Sprite.Selectable.prototype.isCursorMovable * @see DKTools.Sprite.Selectable.prototype.hitTest @@ -2000,7 +2004,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { * @see DKTools.Sprite.Selectable.prototype.playCursorSound */ processMouseHover() { - if (this.isOptionEnabled('process-mouse-hover') && this.isCursorMovable()) { + if (this.isOptionEnabled('process-mouse-hover') && this.isCursorMovable() && TouchInput.date > Input.date) { const lastIndex = this._index; const x = TouchInput.mouseX; const y = TouchInput.mouseY; @@ -2599,10 +2603,11 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Returns the standard item width * + * @version 8.0.0 * @returns {Function} Standard item width */ standardItemWidth() { - return () => Math.floor((this.realWidth + this._horizontalSpacing) / this.getMaxCols() - this._horizontalSpacing); + return () => Math.floor((this.width + this._horizontalSpacing) / this.getMaxCols() - this._horizontalSpacing); } /** @@ -4376,6 +4381,8 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { /** * Updates the cursor * + * @version 8.0.0 + * * @see DKTools.Sprite.Selectable.prototype.isHorizontal * @see DKTools.Sprite.Selectable.prototype.isCursorAll * @see DKTools.Sprite.Selectable.prototype.isCursorVisible @@ -4417,7 +4424,7 @@ DKTools.Sprite.Selectable = class extends DKTools.Sprite.Button { if (this.isCursorAll()) { const allRowsHeight = this.getMaxRows() * this.getItemHeight(); - this.setCursorRect(0, 0, this.realWidth, allRowsHeight); + this.setCursorRect(0, 0, this.width, allRowsHeight); this.resetScroll(); } else if (this.isCursorVisible() || !this._cursorSprite.hasBitmap()) { const rect = this.getItemRect(this._index); diff --git a/src/DKTools/Sprite.js b/src/DKTools/Sprite.js index feb354e..aae4996 100644 --- a/src/DKTools/Sprite.js +++ b/src/DKTools/Sprite.js @@ -57,69 +57,95 @@ Object.defineProperties(DKTools.Sprite.prototype, { }, /** - * Real width of the sprite (not including scaling) + * Real width of the sprite + * + * @deprecated 8.0.0 + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ realWidth: { get: function() { - return this._frame.width; + return this.width; }, set: function(value) { - this._frame.width = value; - - this._refresh(); + this.width = value; }, configurable: true }, /** - * Real height of the sprite (not including scaling) + * Real height of the sprite + * + * @deprecated 8.0.0 + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ realHeight: { get: function() { - return this._frame.height; + return this.height; }, set: function(value) { - this._frame.height = value; - - this._refresh(); + this.height = value; }, configurable: true }, /** - * Width of the sprite (taking into account the scaling) + * Width of the sprite + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ width: { get: function() { - return this.realWidth * this.scale.x; + return this._frame.width; }, set: function(value) { - this.realWidth = Math.floor(value / this.scale.x); + this._frame.width = value; + + this._refresh(); }, configurable: true }, /** - * Height of the sprite (taking into account the scaling) + * Height of the sprite + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Sprite.prototype */ height: { get: function() { - return this.realHeight * this.scale.y; + return this._frame.height; }, set: function(value) { - this.realHeight = Math.floor(value / this.scale.y); + this._frame.height = value; + + this._refresh(); + }, + configurable: true + }, + + /** + * The coordinates of mouse inside the object + * + * @since 8.0.0 + * + * @readonly + * @type {Number} + * @memberof DKTools.Base.prototype + */ + mouse: { + get: function() { + return this.getLocalPoint(TouchInput.mouseX, TouchInput.mouseY); }, configurable: true }, @@ -634,6 +660,23 @@ DKTools.Sprite.prototype.createMask = function(maskShape) { // D methods +/** + * Destroys the sprite + * + * @version 8.0.0 + * + * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see DKTools.Base.prototype.destroy + * @see Sprite.prototype.destroy + */ +DKTools.Sprite.prototype.destroy = function(options) { + DKTools.Base.prototype.destroy.call(this, options); + Sprite.prototype.destroy.call(this, options); +}; + /** * Draws all * @@ -654,7 +697,7 @@ DKTools.Sprite.prototype.drawAll = function() { * Draws all texts */ DKTools.Sprite.prototype.drawAllTexts = function() { - _.forEach(this._texts, text => { + _.forEach(this._texts, (text) => { this[text.type](text.text, text.options); }); }; @@ -828,6 +871,33 @@ DKTools.Sprite.prototype.getCurrentOpacity = function() { return this.alpha * 255; }; +/** + * Returns the local point (coordinates inside the sprite) + * + * @since 8.0.0 + * + * @override + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number} [y] - The Y coordinate (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number} [object.y] - The Y coordinate + * + * @see DKTools.Base.prototype.getLocalPoint + * + * @returns {PIXI.Point} Local point (coordinates inside the sprite) + */ +DKTools.Sprite.prototype.getLocalPoint = function(object, y) { + const localPoint = DKTools.Base.prototype.getLocalPoint.call(this, object, y); + const anchor = this.anchor; + + localPoint.x += this.width * anchor.x; + localPoint.y += this.height * anchor.y; + + return localPoint; +}; + // H methods /** @@ -878,30 +948,6 @@ DKTools.Sprite.prototype.hasTexts = function() { // I methods -/** - * Returns true if the coordinates is inside the sprite - * - * @override - * - * @param {Number} x - The X coordinate - * @param {Number} y - The Y coordinate - * - * @see DKTools.Sprite.prototype.canvasToLocalX - * @see DKTools.Sprite.prototype.canvasToLocalY - * - * @returns {Boolean} Coordinates is inside the sprite - */ -DKTools.Sprite.prototype.isInside = function(x, y) { - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); - const width = this.width; - const height = this.height; - const anchor = this.anchor; - const frame = new Rectangle(-width * anchor.x, -height * anchor.y, width, height); - - return frame.contains(localX, localY); -}; - /** * Returns true if you can change the size of the sprite * @@ -1389,6 +1435,36 @@ DKTools.Sprite.prototype.loadWindowskin = function(object, listener, hue, smooth return this.loadSystem(object || this.standardWindowskin(), listener, hue, smooth); }; +// M methods + +/** + * Moves the sprite (taking into account the anchor) + * + * @since 5.0.0 + * + * @param {Number | PIXI.Point | PIXI.ObservablePoint | Point | Object} [object] - The X coordinate or Point or object with parameters + * @param {Number | String} [y] - The Y coordinate or line number (String) (if object is Number) + * + * @param {Number} [object.x] - The X coordinate + * @param {Number | String} [object.y] - The Y coordinate or line number (String) + * + * @see DKTools.Base.prototype.move + */ +DKTools.Sprite.prototype.moveWithAnchor = function(object, y) { + if (object instanceof Object) { + y = object.y; + } + + if (DKTools.Utils.isString(y)) { // line number + y = this.getLineHeight() * parseFloat(y); + } + + const point = DKTools.Utils.Point.toPoint(object, y); + const anchor = this.anchor; + + this.move(point.x + this.width * anchor.x, point.y + this.height * anchor.y); +}; + // S methods /** @@ -1465,11 +1541,11 @@ DKTools.Sprite.prototype.standardFontSize = function() { /** * Returns the standard frame * - * @version 3.1.0 + * @version 8.0.0 * @returns {Rectangle} Standard frame */ DKTools.Sprite.prototype.standardFrame = function() { - return new Rectangle(0, 0, this.realWidth, this.realHeight); + return new Rectangle(0, 0, this.width, this.height); }; /** diff --git a/src/DKTools/Unit Properties.js b/src/DKTools/Unit Properties.js index 9fef255..30624b6 100644 --- a/src/DKTools/Unit Properties.js +++ b/src/DKTools/Unit Properties.js @@ -315,18 +315,23 @@ DKTools.Unit.Properties = class extends DKTools.Unit { * @returns {Boolean} Unit has the property */ hasProperty(property) { - return DKTools.Utils.Array.contains(this._getProperties(), property); + const properties = this._getProperties(); + + return properties.includes(property); } /** * Returns true if the unit has the properties * + * @version 8.0.0 * @since 6.3.0 * * @returns {Boolean} Unit has the properties */ hasProperties() { - return DKTools.Utils.isFunction(this._properties) || Array.isArray(this._properties) && this._properties.length > 0; + const properties = this._getProperties(); + + return properties.length > 0; } /** diff --git a/src/DKTools/Utils Array.js b/src/DKTools/Utils Array.js index af9bf63..43a5599 100644 --- a/src/DKTools/Utils Array.js +++ b/src/DKTools/Utils Array.js @@ -93,6 +93,11 @@ DKTools.Utils.Array = class { * DKTools.Utils.Array.contains(array, 3); * => false * + * @example + * var array = null; + * DKTools.Utils.Array.contains(array, 1); + * => false + * * @returns {Boolean} Array contains a given item */ static contains(array, item) { @@ -109,12 +114,12 @@ DKTools.Utils.Array = class { * * @example * var array = [1, 1, 2]; - * DKTools.Utils.Array.contains(array, 1); + * DKTools.Utils.Array.count(array, 1); * => 2 * * @example * var array = [1, 1, 2]; - * DKTools.Utils.Array.contains(array, 2); + * DKTools.Utils.Array.count(array, 2); * => 1 * * @returns {Number} Number of item in the array diff --git a/src/DKTools/Utils Bitmap.js b/src/DKTools/Utils Bitmap.js index 10756b3..d9f16fb 100644 --- a/src/DKTools/Utils Bitmap.js +++ b/src/DKTools/Utils Bitmap.js @@ -190,7 +190,7 @@ DKTools.Utils.Bitmap = class { * @returns {Promise} Loaded bitmap or null */ static async loadAsync(object, filename, listener, hue, smooth) { - return new Promise(resolve => { + return new Promise((resolve) => { const bitmap = this.load(object, filename, listener, hue, smooth); if (bitmap) { diff --git a/src/DKTools/Utils Event.js b/src/DKTools/Utils Event.js index b2dc850..d2a4119 100644 --- a/src/DKTools/Utils Event.js +++ b/src/DKTools/Utils Event.js @@ -36,7 +36,7 @@ DKTools.Utils.Event = class { */ static getAllComments(event) { if (Number.isFinite(event)) { - event = $gameMap.events()[event]; + event = $gameMap.event(event); } if (!event) { @@ -83,7 +83,7 @@ DKTools.Utils.Event = class { */ static getComments(event) { if (Number.isFinite(event)) { - event = $gameMap.events()[event]; + event = $gameMap.event(event); } if (!event || !event.page()) { diff --git a/src/DKTools/Utils.js b/src/DKTools/Utils.js index a6393ae..98f7a62 100644 --- a/src/DKTools/Utils.js +++ b/src/DKTools/Utils.js @@ -145,6 +145,66 @@ DKTools.Utils = class { }); } + // G methods + + /** + * Returns the data for error logging + * + * @since 8.0.0 + * @private + * @static + * + * @see DKTools.Utils.logError + * + * @returns {Object} Data for error logging + */ + static _getErrorLogData() { + const scene = SceneManager._scene; + const data = {}; + + if (scene && scene.constructor.name) { + data['Scene'] = scene.constructor.name; + + if (SceneManager.isCurrentScene(Scene_Map)) { + const interpreter = $gameMap._interpreter; + + if (interpreter) { + if (interpreter._mapId > 0) { + data['Map ID'] = interpreter._mapId; + } + + if (interpreter._eventId > 0) { + data['Event ID'] = interpreter._eventId; + + const event = $gameMap.event(interpreter._eventId); + + if (event) { + data['Event Page'] = event._pageIndex + 1; + } + } + + if (interpreter._list && interpreter._list.length > 0) { + let command = interpreter._list[interpreter._index]; + + if (command && command.code === 0 && interpreter._index > 0) { + command = interpreter._list[interpreter._index - 1]; + } + + if (command && command.code > 0) { + data['Last Event Command'] = command.code; + } + } + + if (interpreter._params && interpreter._params.length > 0) { + data['Params'] = JSON.stringify(interpreter._params); + } + } + } + } + + return data; + } + // H methods /** @@ -295,7 +355,7 @@ DKTools.Utils = class { /** * Logs the error to file * - * @version 7.0.0 + * @version 8.0.0 * @since 3.1.0 * @static * @async @@ -308,6 +368,8 @@ DKTools.Utils = class { * @param {String} [error.lineNumber] * @param {String} [error.columnNumber] * @param {String} [error.stack] + * + * @see DKTools.Utils._getErrorLogData */ static async logError(error) { if (!error || !this.isNwjs()) { @@ -350,11 +412,16 @@ DKTools.Utils = class { } const fileDescriptor = await fs.openSync(filename, 'a'); + const errorData = this._getErrorLogData(); + let data = `Date: ${new Date().toString()}` + os.EOL; + + _.forEach(errorData, (value, key) => { + data += key + ': ' + value + os.EOL; + }); if (error instanceof Object) { - let data = `Date: ${new Date().toString()}` + os.EOL + - `Name: ${error.name}` + os.EOL + - `Message: ${error.message}` + os.EOL; + data += `Name: ${error.name}` + os.EOL; + data += `Message: ${error.message}` + os.EOL; if (error.filename !== undefined) { data += `Filename: ${error.filename}` + os.EOL; @@ -369,15 +436,11 @@ DKTools.Utils = class { } data += `Stack: ${error.stack}` + os.EOL + os.EOL; - - await fs.writeSync(fileDescriptor, data); } else { - const data = `Date: ${new Date().toString()}` + os.EOL + - `Error: ${error}` + os.EOL + os.EOL; - - await fs.writeSync(fileDescriptor, data); + data += `Error: ${error}` + os.EOL + os.EOL; } + await fs.writeSync(fileDescriptor, data); await fs.closeSync(fileDescriptor); } diff --git a/src/DKTools/Window.js b/src/DKTools/Window.js index f418bfd..83ca0ca 100644 --- a/src/DKTools/Window.js +++ b/src/DKTools/Window.js @@ -11,55 +11,57 @@ DKTools.Window.prototype.constructor = DKTools.Window; Object.defineProperties(DKTools.Window.prototype, { /** - * Real width of the window (not including scaling) + * Real width of the window + * + * @deprecated 8.0.0 + * @version 8.0.0 * - * @readonly * @type {Number} * @memberof DKTools.Window.prototype */ realWidth: { get: function() { - return this._width; + return this.width; }, set: function(value) { - this._width = value; - - this._refreshAllParts(); + this.width = value; }, configurable: true }, /** - * Real height of the window (not including scaling) + * Real height of the window + * + * @deprecated 8.0.0 + * @version 8.0.0 * - * @readonly * @type {Number} * @memberof DKTools.Window.prototype */ realHeight: { get: function() { - return this._height; + return this.height; }, set: function(value) { - this._height = value; - - this._refreshAllParts(); + this.height = value; }, configurable: true }, /** - * Width of the window (taking into account scaling) + * Width of the window + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Window.prototype */ width: { get: function() { - return this.realWidth * this.scale.x; + return this._width; }, set: function(value) { - this._width = Math.floor(value / this.scale.x); + this._width = value; this._refreshAllParts(); }, @@ -67,17 +69,19 @@ Object.defineProperties(DKTools.Window.prototype, { }, /** - * Height of the window (taking into account scaling) + * Height of the window + * + * @version 8.0.0 * * @type {Number} * @memberof DKTools.Window.prototype */ height: { get: function() { - return this.realHeight * this.scale.y; + return this._height; }, set: function(value) { - this._height = Math.floor(value / this.scale.y); + this._height = value; this._refreshAllParts(); }, @@ -937,6 +941,23 @@ DKTools.Window.prototype.deactivate = function() { } }; +/** + * Destroys the window + * + * @version 8.0.0 + * + * @override + * + * @param {Object | Boolean} [options] - Destroy options + * + * @see DKTools.Base.prototype.destroy + * @see Window_Base.prototype.destroy + */ +DKTools.Window.prototype.destroy = function(options) { + DKTools.Base.prototype.destroy.call(this, options); + Window_Base.prototype.destroy.call(this, options); +}; + /** * Draws the text * Returns true if successfully completed @@ -1242,24 +1263,6 @@ DKTools.Window.prototype.isOpenAndActive = function() { return this.isOpen() && this.isActive(); }; -/** - * Returns true if the coordinates is inside the window - * - * @override - * - * @param {Number} x - The X coordinate - * @param {Number} y - The Y coordinate - * - * @returns {Boolean} Coordinates is inside the window - */ -DKTools.Window.prototype.isInside = function(x, y) { - const localX = this.canvasToLocalX(x); - const localY = this.canvasToLocalY(y); - const frame = new Rectangle(0, 0, this.width, this.height); - - return frame.contains(localX, localY); -}; - // N methods /** @@ -2066,17 +2069,21 @@ DKTools.Window.prototype.setupAll = function(object = {}) { /** * Sets the width of the window * + * @version 8.0.0 + * * @param {Number} [width] - Width of the window * * @see DKTools.Window.prototype._checkWidth */ DKTools.Window.prototype.setupWidth = function(width) { - this.realWidth = this._checkWidth(width); + this.width = this._checkWidth(width); }; /** * Sets the height of the window * + * @version 8.0.0 + * * @param {Number | String} [height] - Height of the window of number of lines (String) * * @see DKTools.Window.prototype._checkHeight @@ -2086,7 +2093,7 @@ DKTools.Window.prototype.setupHeight = function(height) { height = this.getLineHeight() * parseFloat(height); } - this.realHeight = this._checkHeight(height); + this.height = this._checkHeight(height); }; /** diff --git a/src/DKTools/initialize plugin commands.js b/src/DKTools/initialize plugin commands.js index e5ebfeb..f7e8eee 100644 --- a/src/DKTools/initialize plugin commands.js +++ b/src/DKTools/initialize plugin commands.js @@ -7,6 +7,10 @@ DKTools.PluginCommandManager.set('DKPluginsCheckUpdates', () => { DKTools.Utils._checkUpdates(); }); +DKTools.PluginCommandManager.set('UpdateFileSystemStamp', () => { + DKTools.IO._createStamp(); +}); + diff --git a/src/DKTools/lodash.js b/src/DKTools/lodash.js index 73db7d7..b78d8c8 100644 --- a/src/DKTools/lodash.js +++ b/src/DKTools/lodash.js @@ -5,141 +5,141 @@ /* eslint-disable */ /** - * @version 4.17.10 - * @license Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * @license + * Lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE */ ;(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,En="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",kn=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+En+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Bn={}; - Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true,Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object Boolean]"]=Bn["[object DataView]"]=Bn["[object Date]"]=Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object WeakMap]"]=false; - var Ln={};Ln["[object Arguments]"]=Ln["[object Array]"]=Ln["[object ArrayBuffer]"]=Ln["[object DataView]"]=Ln["[object Boolean]"]=Ln["[object Date]"]=Ln["[object Float32Array]"]=Ln["[object Float64Array]"]=Ln["[object Int8Array]"]=Ln["[object Int16Array]"]=Ln["[object Int32Array]"]=Ln["[object Map]"]=Ln["[object Number]"]=Ln["[object Object]"]=Ln["[object RegExp]"]=Ln["[object Set]"]=Ln["[object String]"]=Ln["[object Symbol]"]=Ln["[object Uint8Array]"]=Ln["[object Uint8ClampedArray]"]=Ln["[object Uint16Array]"]=Ln["[object Uint32Array]"]=true, - Ln["[object Error]"]=Ln["[object Function]"]=Ln["[object WeakMap]"]=false;var Un={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){ - try{var n=Nn&&Nn.f&&Nn.f("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I", - "\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C", - "\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i", - "\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r", - "\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij", - "\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(du(n)&&!of(n)&&!(n instanceof Un)){if(n instanceof On)return n;if(ii.call(n,"__wrapped__"))return $e(n)}return new On(n)}function En(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Un(n){this.__wrapped__=n, - this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!gu(n))return n;if(u=of(n)){if(f=me(n),!c)return Ur(n,f)}else{var s=_o(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(cf(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Ln[s])return i?n:{};f=Ee(n,s,c)}}if(o||(o=new Zn), - i=o.get(n))return i;if(o.set(n,f),hf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(lf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Wu:zu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=zu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Yu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ni("Expected a function"); - return yo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,k(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&ii.call(n,t)}function zt(n,t){return null!=n&&t in Yu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Vu(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,k(t))),s=Ui(p.length,s), - l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:kt(t,hr(r,0,-1)),r=null==t?t:t[De(qe(r))],null==r?T:n(r,t,e)}function Ut(n){return du(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ - return du(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return du(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)t=true;else if(null==n||null==t||!du(n)&&!du(t))t=n!==n&&t!==t;else n:{var i=of(n),o=of(t),f=i?"[object Array]":_o(n),c=o?"[object Array]":_o(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&cf(n)){if(!cf(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||pf(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ - if(!(1&r)&&(i=a&&ii.call(n,"__wrapped__"),f=o&&ii.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:ii.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[Tu],k(ye())), - n=Gt(n,function(n){return{a:c(t,function(t){return t(n)}),b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return Ru(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Vu(u);++e=u){for(;e>>1,o=n[i];null!==o&&!ju(o)&&(r?o<=t:ot.length?n:kt(n,hr(t,0,-1)),null==n||delete n[De(qe(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Vu(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=vi?vi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new _i(t).set(new _i(n)), - t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length)}function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=ju(n),o=t!==T,f=null===t,c=t===t,a=ju(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Yu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:L(f,a), - o-=c.length,or?r?or(t,n):t:(r=or(t,Si(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Vu(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Br(e,r,h[4]):r,i[4]=e?L(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Lr(e,r,h[6]):r,i[6]=e?L(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ui(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1], - r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),Le((h?fo:go)(t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),i),n,t)}function ce(n,t,r,e){return n===T||au(n,ri[r])&&!ii.call(e,r)?t:n}function ae(n,t,r,e,u,i){return gu(n)&&gu(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return bu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t;var c=-1,a=true,l=2&r?new Nn:T; - for(i.set(n,t),i.set(t,n);++cr&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Ne(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=Au(r),u=0>r?Li(e+u,0):Ui(u,e-1)),_(n,ye(t,3),u,true)}function Pe(n){return(null==n?0:n.length)?wt(n,1):[]}function Ze(n){ - return n&&n.length?n[0]:T}function qe(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ve(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ke(n){return null==n?n:Ti.call(n)}function Ge(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(su(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function He(t,r){if(!t||!t.length)return[];var e=Ge(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Je(n){return n=An(n),n.__chain__=true,n}function Ye(n,t){ - return t(n)}function Qe(){return this}function Xe(n,t){return(of(n)?r:eo)(n,ye(t,3))}function nu(n,t){return(of(n)?e:uo)(n,ye(t,3))}function tu(n,t){return(of(n)?c:Gt)(n,ye(t,3))}function ru(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function eu(n,t){var r;if(typeof t!="function")throw new ni("Expected a function");return n=Au(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function uu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=uu.placeholder, - n}function iu(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=iu.placeholder,n}function ou(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Ko();if(u(n))return o(n);var r,e=yo;r=n-_,n=t-(n-p),r=g?Ui(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Ko(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=yo(i,t),v?e(n):s;if(g)return h=yo(i,t),e(p)}return h===T&&(h=yo(i,t)), - s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ni("Expected a function");return t=ku(t)||0,gu(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(ku(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&ao(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Ko())},f}function fu(n,t){function r(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e),r.cache=i.set(u,e)||i,e)}if(typeof n!="function"||null!=t&&typeof t!="function")throw new ni("Expected a function"); - return r.cache=new(fu.Cache||Fn),r}function cu(n){if(typeof n!="function")throw new ni("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function au(n,t){return n===t||n!==n&&t!==t}function lu(n){return null!=n&&vu(n.length)&&!pu(n)}function su(n){return du(n)&&lu(n)}function hu(n){if(!du(n))return false;var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!bu(n); - }function pu(n){return!!gu(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function _u(n){return typeof n=="number"&&n==Au(n)}function vu(n){return typeof n=="number"&&-1=n}function gu(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function du(n){return null!=n&&typeof n=="object"}function yu(n){return typeof n=="number"||du(n)&&"[object Number]"==Ot(n)}function bu(n){return!(!du(n)||"[object Object]"!=Ot(n))&&(n=gi(n), - null===n||(n=ii.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ui.call(n)==ai))}function xu(n){return typeof n=="string"||!of(n)&&du(n)&&"[object String]"==Ot(n)}function ju(n){return typeof n=="symbol"||du(n)&&"[object Symbol]"==Ot(n)}function wu(n){if(!n)return[];if(lu(n))return xu(n)?M(n):Ur(n);if(ji&&n[ji]){n=n[ji]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}return t=_o(n),("[object Map]"==t?W:"[object Set]"==t?U:Lu)(n)}function mu(n){return n?(n=ku(n), - n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function Au(n){n=mu(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(Au(n),0,4294967295):0}function ku(n){if(typeof n=="number")return n;if(ju(n))return F;if(gu(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=gu(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n}function Su(n){return Cr(n,Wu(n))}function Ou(n){return null==n?"":yr(n); - }function Iu(n,t,r){return n=null==n?T:kt(n,t),n===T?r:n}function Ru(n,t){return null!=n&&we(n,t,zt)}function zu(n){return lu(n)?qn(n):Vt(n)}function Wu(n){if(lu(n))n=qn(n,true);else if(gu(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&ii.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Yu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,zu(n)); - }function Uu(n){return Tf(Ou(n).toLowerCase())}function Cu(n){return(n=Ou(n))&&n.replace(xn,Xn).replace(Sn,"")}function Du(n,t,r){return n=Ou(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Mu(n){return function(){return n}}function Tu(n){return n}function $u(n){return qt(typeof n=="function"?n:_t(n,1))}function Fu(n,t,e){var u=zu(t),i=Et(t,u);null!=e||gu(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=Et(t,zu(t)));var o=!(gu(e)&&"chain"in e&&!e.chain),f=pu(n);return r(i,function(r){ - var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Ur(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Nu(){}function Pu(n){return Ie(n)?b(De(n)):rr(n)}function Zu(){return[]}function qu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Vu=mn.Array,Ku=mn.Date,Gu=mn.Error,Hu=mn.Function,Ju=mn.Math,Yu=mn.Object,Qu=mn.RegExp,Xu=mn.String,ni=mn.TypeError,ti=Vu.prototype,ri=Yu.prototype,ei=mn["__core-js_shared__"],ui=Hu.prototype.toString,ii=ri.hasOwnProperty,oi=0,fi=function(){ - var n=/[^.]+$/.exec(ei&&ei.keys&&ei.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ci=ri.toString,ai=ui.call(Yu),li=$n._,si=Qu("^"+ui.call(ii).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hi=Pn?mn.Buffer:T,pi=mn.Symbol,_i=mn.Uint8Array,vi=hi?hi.g:T,gi=B(Yu.getPrototypeOf,Yu),di=Yu.create,yi=ri.propertyIsEnumerable,bi=ti.splice,xi=pi?pi.isConcatSpreadable:T,ji=pi?pi.iterator:T,wi=pi?pi.toStringTag:T,mi=function(){try{var n=je(Yu,"defineProperty"); - return n({},"",{}),n}catch(n){}}(),Ai=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Ku&&Ku.now!==$n.Date.now&&Ku.now,ki=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Si=Ju.ceil,Oi=Ju.floor,Ii=Yu.getOwnPropertySymbols,Ri=hi?hi.isBuffer:T,zi=mn.isFinite,Wi=ti.join,Bi=B(Yu.keys,Yu),Li=Ju.max,Ui=Ju.min,Ci=Ku.now,Di=mn.parseInt,Mi=Ju.random,Ti=ti.reverse,$i=je(mn,"DataView"),Fi=je(mn,"Map"),Ni=je(mn,"Promise"),Pi=je(mn,"Set"),Zi=je(mn,"WeakMap"),qi=je(Yu,"create"),Vi=Zi&&new Zi,Ki={},Gi=Me($i),Hi=Me(Fi),Ji=Me(Ni),Yi=Me(Pi),Qi=Me(Zi),Xi=pi?pi.prototype:T,no=Xi?Xi.valueOf:T,to=Xi?Xi.toString:T,ro=function(){ - function n(){}return function(t){return gu(t)?di?di(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=En.prototype,An.prototype.constructor=An,On.prototype=ro(En.prototype),On.prototype.constructor=On,Un.prototype=ro(En.prototype),Un.prototype.constructor=Un,Mn.prototype.clear=function(){this.__data__=qi?qi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], - this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return qi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):ii.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return qi?t[n]!==T:ii.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=qi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():bi.call(t,n,1), - --this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Fi||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); +}function A(n,t){for(var r=-1,e=Array(n);++r"']/g,G=RegExp(V.source),H=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nn=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,en=RegExp(rn.source),un=/^\s+|\s+$/g,on=/^\s+/,fn=/\s+$/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,ln=/,? & /,sn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,hn=/\\(\\)?/g,pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,vn=/^[-+]0x[0-9a-f]+$/i,gn=/^0b[01]+$/i,dn=/^\[object .+?Constructor\]$/,yn=/^0o[0-7]+$/i,bn=/^(?:0|[1-9]\d*)$/,xn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jn=/($^)/,wn=/['\n\r\u2028\u2029\\]/g,mn="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",An="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+mn,kn="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",En=RegExp("['\u2019]","g"),Sn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),On=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kn+mn,"g"),In=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",An].join("|"),"g"),Rn=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),zn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wn="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Un={}; + Un["[object Float32Array]"]=Un["[object Float64Array]"]=Un["[object Int8Array]"]=Un["[object Int16Array]"]=Un["[object Int32Array]"]=Un["[object Uint8Array]"]=Un["[object Uint8ClampedArray]"]=Un["[object Uint16Array]"]=Un["[object Uint32Array]"]=true,Un["[object Arguments]"]=Un["[object Array]"]=Un["[object ArrayBuffer]"]=Un["[object Boolean]"]=Un["[object DataView]"]=Un["[object Date]"]=Un["[object Error]"]=Un["[object Function]"]=Un["[object Map]"]=Un["[object Number]"]=Un["[object Object]"]=Un["[object RegExp]"]=Un["[object Set]"]=Un["[object String]"]=Un["[object WeakMap]"]=false; + var Bn={};Bn["[object Arguments]"]=Bn["[object Array]"]=Bn["[object ArrayBuffer]"]=Bn["[object DataView]"]=Bn["[object Boolean]"]=Bn["[object Date]"]=Bn["[object Float32Array]"]=Bn["[object Float64Array]"]=Bn["[object Int8Array]"]=Bn["[object Int16Array]"]=Bn["[object Int32Array]"]=Bn["[object Map]"]=Bn["[object Number]"]=Bn["[object Object]"]=Bn["[object RegExp]"]=Bn["[object Set]"]=Bn["[object String]"]=Bn["[object Symbol]"]=Bn["[object Uint8Array]"]=Bn["[object Uint8ClampedArray]"]=Bn["[object Uint16Array]"]=Bn["[object Uint32Array]"]=true, + Bn["[object Error]"]=Bn["[object Function]"]=Bn["[object WeakMap]"]=false;var Ln={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Cn=parseFloat,Dn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,Tn=typeof self=="object"&&self&&self.Object===Object&&self,$n=Mn||Tn||Function("return this")(),Fn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Nn=Fn&&typeof module=="object"&&module&&!module.nodeType&&module,Pn=Nn&&Nn.exports===Fn,Zn=Pn&&Mn.process,qn=function(){ + try{var n=Nn&&Nn.require&&Nn.require("util").types;return n?n:Zn&&Zn.binding&&Zn.binding("util")}catch(n){}}(),Vn=qn&&qn.isArrayBuffer,Kn=qn&&qn.isDate,Gn=qn&&qn.isMap,Hn=qn&&qn.isRegExp,Jn=qn&&qn.isSet,Yn=qn&&qn.isTypedArray,Qn=b("length"),Xn=x({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e", + "\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a", + "\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I", + "\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r", + "\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ", + "\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),nt=x({"&":"&","<":"<",">":">",'"':""","'":"'"}),tt=x({"&":"&","<":"<",">":">",""":'"',"'":"'"}),rt=function x(mn){function An(n){if(yu(n)&&!ff(n)&&!(n instanceof Ln)){if(n instanceof On)return n;if(oi.call(n,"__wrapped__"))return Fe(n)}return new On(n)}function kn(){}function On(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=T}function Ln(n){ + this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=false,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mn(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t=t?n:t)),n}function _t(n,t,e,u,i,o){var f,c=1&t,a=2&t,l=4&t;if(e&&(f=i?e(n,u,i,o):e(n)),f!==T)return f;if(!du(n))return n;if(u=ff(n)){if(f=me(n),!c)return Lr(n,f)}else{var s=vo(n),h="[object Function]"==s||"[object GeneratorFunction]"==s;if(af(n))return Ir(n,c);if("[object Object]"==s||"[object Arguments]"==s||h&&!i){if(f=a||h?{}:Ae(n),!c)return a?Mr(n,lt(f,n)):Dr(n,at(f,n))}else{if(!Bn[s])return i?n:{};f=ke(n,s,c)}}if(o||(o=new Zn), + i=o.get(n))return i;if(o.set(n,f),pf(n))return n.forEach(function(r){f.add(_t(r,t,e,r,n,o))}),f;if(sf(n))return n.forEach(function(r,u){f.set(u,_t(r,t,e,u,n,o))}),f;var a=l?a?ve:_e:a?Uu:Wu,p=u?T:a(n);return r(p||n,function(r,u){p&&(u=r,r=n[u]),ot(f,u,_t(r,t,e,u,n,o))}),f}function vt(n){var t=Wu(n);return function(r){return gt(r,n,t)}}function gt(n,t,r){var e=r.length;if(null==n)return!e;for(n=Qu(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===T&&!(u in n)||!i(o))return false}return true}function dt(n,t,r){if(typeof n!="function")throw new ti("Expected a function"); + return bo(function(){n.apply(T,r)},t)}function yt(n,t,r,e){var u=-1,i=o,a=true,l=n.length,s=[],h=t.length;if(!l)return s;r&&(t=c(t,E(r))),e?(i=f,a=false):200<=t.length&&(i=O,a=false,t=new Nn(t));n:for(;++ut}function Rt(n,t){return null!=n&&oi.call(n,t)}function zt(n,t){return null!=n&&t in Qu(n)}function Wt(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=Ku(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,E(t))),s=Ci(p.length,s), + l[a]=!r&&(t||120<=u&&120<=p.length)?new Nn(a&&p):T}var p=n[0],_=-1,v=l[0];n:for(;++_r.length?t:Et(t,hr(r,0,-1)),r=null==t?t:t[Me(Ve(r))],null==r?T:n(r,t,e)}function Lt(n){return yu(n)&&"[object Arguments]"==Ot(n)}function Ct(n){ + return yu(n)&&"[object ArrayBuffer]"==Ot(n)}function Dt(n){return yu(n)&&"[object Date]"==Ot(n)}function Mt(n,t,r,e,u){if(n===t)return true;if(null==n||null==t||!yu(n)&&!yu(t))return n!==n&&t!==t;n:{var i=ff(n),o=ff(t),f=i?"[object Array]":vo(n),c=o?"[object Array]":vo(t),f="[object Arguments]"==f?"[object Object]":f,c="[object Arguments]"==c?"[object Object]":c,a="[object Object]"==f,o="[object Object]"==c;if((c=f==c)&&af(n)){if(!af(t)){t=false;break n}i=true,a=false}if(c&&!a)u||(u=new Zn),t=i||_f(n)?se(n,t,r,e,Mt,u):he(n,t,f,r,e,Mt,u);else{ + if(!(1&r)&&(i=a&&oi.call(n,"__wrapped__"),f=o&&oi.call(t,"__wrapped__"),i||f)){n=i?n.value():n,t=f?t.value():t,u||(u=new Zn),t=Mt(n,t,r,e,u);break n}if(c)t:if(u||(u=new Zn),i=1&r,f=_e(n),o=f.length,c=_e(t).length,o==c||i){for(a=o;a--;){var l=f[a];if(!(i?l in t:oi.call(t,l))){t=false;break t}}if((c=u.get(n))&&u.get(t))t=c==t;else{c=true,u.set(n,t),u.set(t,n);for(var s=i;++at?r:0,Se(t,r)?n[t]:T}function Xt(n,t,r){var e=-1;return t=c(t.length?t:[$u],E(ye())),n=Gt(n,function(n,r,u){return{a:c(t,function(t){return t(n)}), + b:++e,c:n}}),w(n,function(n,t){var e;n:{e=-1;for(var u=n.a,i=t.a,o=u.length,f=r.length;++e=f){e=c;break n}e=c*("desc"==r[e]?-1:1);break n}}e=n.b-t.b}return e})}function nr(n,t){return tr(n,t,function(t,r){return zu(n,r)})}function tr(n,t,r){for(var e=-1,u=t.length,i={};++et||9007199254740991t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ku(u);++e=u){for(;e>>1,o=n[i];null!==o&&!wu(o)&&(r?o<=t:ot.length?n:Et(n,hr(t,0,-1)),null==n||delete n[Me(Ve(t))]}function jr(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++ie)return e?br(n[0]):[];for(var u=-1,i=Ku(e);++u=e?n:hr(n,t,r)}function Ir(n,t){if(t)return n.slice();var r=n.length,r=gi?gi(r):new n.constructor(r);return n.copy(r),r}function Rr(n){var t=new n.constructor(n.byteLength);return new vi(t).set(new vi(n)),t}function zr(n,t){return new n.constructor(t?Rr(n.buffer):n.buffer,n.byteOffset,n.length); + }function Wr(n,t){if(n!==t){var r=n!==T,e=null===n,u=n===n,i=wu(n),o=t!==T,f=null===t,c=t===t,a=wu(t);if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&nu?T:i,u=1),t=Qu(t);++eo&&f[0]!==a&&f[o-1]!==a?[]:B(f,a),o-=c.length,or?r?or(t,n):t:(r=or(t,Oi(n/D(t))),Rn.test(t)?Or(M(r),0,n).join(""):r.slice(0,n))}function te(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=Ku(l+c),h=this&&this!==$n&&this instanceof i?f:t;++at||e)&&(1&n&&(i[2]=h[2],t|=1&r?0:4),(r=h[3])&&(e=i[3],i[3]=e?Ur(e,r,h[4]):r,i[4]=e?B(i[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=i[5],i[5]=e?Br(e,r,h[6]):r,i[6]=e?B(i[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(i[7]=r),128&n&&(i[8]=null==i[8]?h[8]:Ci(i[8],h[8])),null==i[9]&&(i[9]=h[9]),i[0]=h[0],i[1]=t),n=i[0],t=i[1], + r=i[2],e=i[3],u=i[4],f=i[9]=i[9]===T?c?0:n.length:Li(i[9]-a,0),!f&&24&t&&(t&=-25),c=t&&1!=t?8==t||16==t?Kr(n,t,f):32!=t&&33!=t||u.length?Jr.apply(T,i):te(n,t,r,e):Pr(n,t,r),Le((h?co:yo)(c,i),n,t)}function ce(n,t,r,e){return n===T||lu(n,ei[r])&&!oi.call(e,r)?t:n}function ae(n,t,r,e,u,i){return du(n)&&du(t)&&(i.set(t,n),Yt(n,t,T,ae,i),i.delete(t)),n}function le(n){return xu(n)?T:n}function se(n,t,r,e,u,i){var o=1&r,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return false;if((c=i.get(n))&&i.get(t))return c==t; + var c=-1,a=true,l=2&r?new Nn:T;for(i.set(n,t),i.set(t,n);++cr&&(r=Li(e+r,0)),_(n,ye(t,3),r)):-1}function Pe(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==T&&(u=ku(r),u=0>r?Li(e+u,0):Ci(u,e-1)),_(n,ye(t,3),u,true)}function Ze(n){return(null==n?0:n.length)?wt(n,1):[]; + }function qe(n){return n&&n.length?n[0]:T}function Ve(n){var t=null==n?0:n.length;return t?n[t-1]:T}function Ke(n,t){return n&&n.length&&t&&t.length?er(n,t):n}function Ge(n){return null==n?n:$i.call(n)}function He(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){if(hu(n))return t=Li(n.length,t),true}),A(t,function(t){return c(n,b(t))})}function Je(t,r){if(!t||!t.length)return[];var e=He(t);return null==r?e:c(e,function(t){return n(r,T,t)})}function Ye(n){return n=An(n),n.__chain__=true,n; + }function Qe(n,t){return t(n)}function Xe(){return this}function nu(n,t){return(ff(n)?r:uo)(n,ye(t,3))}function tu(n,t){return(ff(n)?e:io)(n,ye(t,3))}function ru(n,t){return(ff(n)?c:Gt)(n,ye(t,3))}function eu(n,t,r){return t=r?T:t,t=n&&null==t?n.length:t,fe(n,128,T,T,T,T,t)}function uu(n,t){var r;if(typeof t!="function")throw new ti("Expected a function");return n=ku(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=T),r}}function iu(n,t,r){return t=r?T:t,n=fe(n,8,T,T,T,T,T,t),n.placeholder=iu.placeholder, + n}function ou(n,t,r){return t=r?T:t,n=fe(n,16,T,T,T,T,T,t),n.placeholder=ou.placeholder,n}function fu(n,t,r){function e(t){var r=c,e=a;return c=a=T,_=t,s=n.apply(e,r)}function u(n){var r=n-p;return n-=_,p===T||r>=t||0>r||g&&n>=l}function i(){var n=Go();if(u(n))return o(n);var r,e=bo;r=n-_,n=t-(n-p),r=g?Ci(n,l-r):n,h=e(i,r)}function o(n){return h=T,d&&c?e(n):(c=a=T,s)}function f(){var n=Go(),r=u(n);if(c=arguments,a=this,p=n,r){if(h===T)return _=n=p,h=bo(i,t),v?e(n):s;if(g)return h=bo(i,t),e(p)}return h===T&&(h=bo(i,t)), + s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof n!="function")throw new ti("Expected a function");return t=Su(t)||0,du(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Li(Su(r.maxWait)||0,t):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&lo(h),_=0,c=p=a=h=T},f.flush=function(){return h===T?s:o(Go())},f}function cu(n,t){if(typeof n!="function"||null!=t&&typeof t!="function")throw new ti("Expected a function");var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;return i.has(u)?i.get(u):(e=n.apply(this,e), + r.cache=i.set(u,e)||i,e)};return r.cache=new(cu.Cache||Fn),r}function au(n){if(typeof n!="function")throw new ti("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function lu(n,t){return n===t||n!==n&&t!==t}function su(n){return null!=n&&gu(n.length)&&!_u(n)}function hu(n){return yu(n)&&su(n)}function pu(n){if(!yu(n))return false; + var t=Ot(n);return"[object Error]"==t||"[object DOMException]"==t||typeof n.message=="string"&&typeof n.name=="string"&&!xu(n)}function _u(n){return!!du(n)&&(n=Ot(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function vu(n){return typeof n=="number"&&n==ku(n)}function gu(n){return typeof n=="number"&&-1=n}function du(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function yu(n){return null!=n&&typeof n=="object"; + }function bu(n){return typeof n=="number"||yu(n)&&"[object Number]"==Ot(n)}function xu(n){return!(!yu(n)||"[object Object]"!=Ot(n))&&(n=di(n),null===n||(n=oi.call(n,"constructor")&&n.constructor,typeof n=="function"&&n instanceof n&&ii.call(n)==li))}function ju(n){return typeof n=="string"||!ff(n)&&yu(n)&&"[object String]"==Ot(n)}function wu(n){return typeof n=="symbol"||yu(n)&&"[object Symbol]"==Ot(n)}function mu(n){if(!n)return[];if(su(n))return ju(n)?M(n):Lr(n);if(wi&&n[wi]){n=n[wi]();for(var t,r=[];!(t=n.next()).done;)r.push(t.value); + return r}return t=vo(n),("[object Map]"==t?W:"[object Set]"==t?L:Lu)(n)}function Au(n){return n?(n=Su(n),n===$||n===-$?1.7976931348623157e308*(0>n?-1:1):n===n?n:0):0===n?n:0}function ku(n){n=Au(n);var t=n%1;return n===n?t?n-t:n:0}function Eu(n){return n?pt(ku(n),0,4294967295):0}function Su(n){if(typeof n=="number")return n;if(wu(n))return F;if(du(n)&&(n=typeof n.valueOf=="function"?n.valueOf():n,n=du(n)?n+"":n),typeof n!="string")return 0===n?n:+n;n=n.replace(un,"");var t=gn.test(n);return t||yn.test(n)?Dn(n.slice(2),t?2:8):vn.test(n)?F:+n; + }function Ou(n){return Cr(n,Uu(n))}function Iu(n){return null==n?"":yr(n)}function Ru(n,t,r){return n=null==n?T:Et(n,t),n===T?r:n}function zu(n,t){return null!=n&&we(n,t,zt)}function Wu(n){return su(n)?qn(n):Vt(n)}function Uu(n){if(su(n))n=qn(n,true);else if(du(n)){var t,r=ze(n),e=[];for(t in n)("constructor"!=t||!r&&oi.call(n,t))&&e.push(t);n=e}else{if(t=[],null!=n)for(r in Qu(n))t.push(r);n=t}return n}function Bu(n,t){if(null==n)return{};var r=c(ve(n),function(n){return[n]});return t=ye(t),tr(n,r,function(n,r){ + return t(n,r[0])})}function Lu(n){return null==n?[]:S(n,Wu(n))}function Cu(n){return $f(Iu(n).toLowerCase())}function Du(n){return(n=Iu(n))&&n.replace(xn,Xn).replace(Sn,"")}function Mu(n,t,r){return n=Iu(n),t=r?T:t,t===T?zn.test(n)?n.match(In)||[]:n.match(sn)||[]:n.match(t)||[]}function Tu(n){return function(){return n}}function $u(n){return n}function Fu(n){return qt(typeof n=="function"?n:_t(n,1))}function Nu(n,t,e){var u=Wu(t),i=kt(t,u);null!=e||du(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=kt(t,Wu(t))); + var o=!(du(e)&&"chain"in e&&!e.chain),f=_u(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Lr(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function Pu(){}function Zu(n){return Ie(n)?b(Me(n)):rr(n)}function qu(){return[]}function Vu(){return false}mn=null==mn?$n:rt.defaults($n.Object(),mn,rt.pick($n,Wn));var Ku=mn.Array,Gu=mn.Date,Hu=mn.Error,Ju=mn.Function,Yu=mn.Math,Qu=mn.Object,Xu=mn.RegExp,ni=mn.String,ti=mn.TypeError,ri=Ku.prototype,ei=Qu.prototype,ui=mn["__core-js_shared__"],ii=Ju.prototype.toString,oi=ei.hasOwnProperty,fi=0,ci=function(){ + var n=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),ai=ei.toString,li=ii.call(Qu),si=$n._,hi=Xu("^"+ii.call(oi).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pi=Pn?mn.Buffer:T,_i=mn.Symbol,vi=mn.Uint8Array,gi=pi?pi.allocUnsafe:T,di=U(Qu.getPrototypeOf,Qu),yi=Qu.create,bi=ei.propertyIsEnumerable,xi=ri.splice,ji=_i?_i.isConcatSpreadable:T,wi=_i?_i.iterator:T,mi=_i?_i.toStringTag:T,Ai=function(){try{var n=je(Qu,"defineProperty"); + return n({},"",{}),n}catch(n){}}(),ki=mn.clearTimeout!==$n.clearTimeout&&mn.clearTimeout,Ei=Gu&&Gu.now!==$n.Date.now&&Gu.now,Si=mn.setTimeout!==$n.setTimeout&&mn.setTimeout,Oi=Yu.ceil,Ii=Yu.floor,Ri=Qu.getOwnPropertySymbols,zi=pi?pi.isBuffer:T,Wi=mn.isFinite,Ui=ri.join,Bi=U(Qu.keys,Qu),Li=Yu.max,Ci=Yu.min,Di=Gu.now,Mi=mn.parseInt,Ti=Yu.random,$i=ri.reverse,Fi=je(mn,"DataView"),Ni=je(mn,"Map"),Pi=je(mn,"Promise"),Zi=je(mn,"Set"),qi=je(mn,"WeakMap"),Vi=je(Qu,"create"),Ki=qi&&new qi,Gi={},Hi=Te(Fi),Ji=Te(Ni),Yi=Te(Pi),Qi=Te(Zi),Xi=Te(qi),no=_i?_i.prototype:T,to=no?no.valueOf:T,ro=no?no.toString:T,eo=function(){ + function n(){}return function(t){return du(t)?yi?yi(t):(n.prototype=t,t=new n,n.prototype=T,t):{}}}();An.templateSettings={escape:J,evaluate:Y,interpolate:Q,variable:"",imports:{_:An}},An.prototype=kn.prototype,An.prototype.constructor=An,On.prototype=eo(kn.prototype),On.prototype.constructor=On,Ln.prototype=eo(kn.prototype),Ln.prototype.constructor=Ln,Mn.prototype.clear=function(){this.__data__=Vi?Vi(null):{},this.size=0},Mn.prototype.delete=function(n){return n=this.has(n)&&delete this.__data__[n], + this.size-=n?1:0,n},Mn.prototype.get=function(n){var t=this.__data__;return Vi?(n=t[n],"__lodash_hash_undefined__"===n?T:n):oi.call(t,n)?t[n]:T},Mn.prototype.has=function(n){var t=this.__data__;return Vi?t[n]!==T:oi.call(t,n)},Mn.prototype.set=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Vi&&t===T?"__lodash_hash_undefined__":t,this},Tn.prototype.clear=function(){this.__data__=[],this.size=0},Tn.prototype.delete=function(n){var t=this.__data__;return n=ft(t,n),!(0>n)&&(n==t.length-1?t.pop():xi.call(t,n,1), + --this.size,true)},Tn.prototype.get=function(n){var t=this.__data__;return n=ft(t,n),0>n?T:t[n][1]},Tn.prototype.has=function(n){return-1e?(++this.size,r.push([n,t])):r[e][1]=t,this},Fn.prototype.clear=function(){this.size=0,this.__data__={hash:new Mn,map:new(Ni||Tn),string:new Mn}},Fn.prototype.delete=function(n){return n=be(this,n).delete(n),this.size-=n?1:0,n},Fn.prototype.get=function(n){return be(this,n).get(n); },Fn.prototype.has=function(n){return be(this,n).has(n)},Fn.prototype.set=function(n,t){var r=be(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},Nn.prototype.add=Nn.prototype.push=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this},Nn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.clear=function(){this.__data__=new Tn,this.size=0},Zn.prototype.delete=function(n){var t=this.__data__;return n=t.delete(n),this.size=t.size,n},Zn.prototype.get=function(n){ - return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Fi||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var eo=Fr(mt),uo=Fr(At,true),io=Nr(),oo=Nr(true),fo=Vi?function(n,t){return Vi.set(n,t),n}:Tu,co=mi?function(n,t){return mi(n,"toString",{configurable:true,enumerable:false,value:Mu(t),writable:true})}:Tu,ao=Ai||function(n){ - return $n.clearTimeout(n)},lo=Pi&&1/U(new Pi([,-0]))[1]==$?function(n){return new Pi(n)}:Nu,so=Vi?function(n){return Vi.get(n)}:Nu,ho=Ii?function(n){return null==n?[]:(n=Yu(n),i(Ii(n),function(t){return yi.call(n,t)}))}:Zu,po=Ii?function(n){for(var t=[];n;)a(t,ho(n)),n=gi(n);return t}:Zu,_o=Ot;($i&&"[object DataView]"!=_o(new $i(new ArrayBuffer(1)))||Fi&&"[object Map]"!=_o(new Fi)||Ni&&"[object Promise]"!=_o(Ni.resolve())||Pi&&"[object Set]"!=_o(new Pi)||Zi&&"[object WeakMap]"!=_o(new Zi))&&(_o=function(n){ - var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Me(n):"")switch(n){case Gi:return"[object DataView]";case Hi:return"[object Map]";case Ji:return"[object Promise]";case Yi:return"[object Set]";case Qi:return"[object WeakMap]"}return t});var vo=ei?pu:qu,go=Ue(fo),yo=ki||function(n,t){return $n.setTimeout(n,t)},bo=Ue(co),xo=function(n){n=fu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ - t.push(e?u.replace(hn,"$1"):r||n)}),t}),jo=fr(function(n,t){return su(n)?yt(n,wt(t,1,su,true)):[]}),wo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),ye(r,2)):[]}),mo=fr(function(n,t){var r=qe(t);return su(r)&&(r=T),su(n)?yt(n,wt(t,1,su,true),T,r):[]}),Ao=fr(function(n){var t=c(n,Er);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=qe(n),r=c(n,Er);return t===qe(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),ko=fr(function(n){var t=qe(n),r=c(n,Er);return(t=typeof t=="function"?t:T)&&r.pop(), - r.length&&r[0]===n[0]?Wt(r,T,t):[]}),So=fr(Ve),Oo=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Io=fr(function(n){return br(wt(n,1,su,true))}),Ro=fr(function(n){var t=qe(n);return su(t)&&(t=T),br(wt(n,1,su,true),ye(t,2))}),zo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return br(wt(n,1,su,true),T,t)}),Wo=fr(function(n,t){return su(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,su))}),Lo=fr(function(n){var t=qe(n);return su(t)&&(t=T), - mr(i(n,su),ye(t,2))}),Uo=fr(function(n){var t=qe(n),t=typeof t=="function"?t:T;return mr(i(n,su),T,t)}),Co=fr(Ge),Do=fr(function(n){var t=n.length,t=1=t}),uf=Ut(function(){return arguments}())?Ut:function(n){return du(n)&&ii.call(n,"callee")&&!yi.call(n,"callee")},of=Vu.isArray,ff=Vn?k(Vn):Ct,cf=Ri||qu,af=Kn?k(Kn):Dt,lf=Gn?k(Gn):Tt,sf=Hn?k(Hn):Nt,hf=Jn?k(Jn):Pt,pf=Yn?k(Yn):Zt,_f=ee(Kt),vf=ee(function(n,t){return n<=t}),gf=$r(function(n,t){ - if(ze(t)||lu(t))Cr(t,zu(t),n);else for(var r in t)ii.call(t,r)&&ot(n,r,t[r])}),df=$r(function(n,t){Cr(t,Wu(t),n)}),yf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),bf=$r(function(n,t,r,e){Cr(t,zu(t),n,e)}),xf=pe(ht),jf=fr(function(n,t){n=Yu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=ru,An.assign=gf,An.assignIn=df,An.assignInWith=yf,An.assignWith=bf,An.at=xf,An.before=eu,An.bind=Go,An.bindAll=Ff,An.bindKey=Ho,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return of(n)?n:[n]},An.chain=Je,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(Au(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Vu(Si(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; - },An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=Au(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:Au(e),0>e&&(e+=u),e=r>e?0:Eu(e);r>>0,r?(n=Ou(n))&&(typeof t=="string"||null!=t&&!sf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ni("Expected a function");return r=null==r?0:Li(Au(r),0), - fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:Au(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:Au(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), - n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ni("Expected a function");return gu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ou(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Ye,An.toArray=wu,An.toPairs=Rf,An.toPairsIn=zf,An.toPath=function(n){return of(n)?c(n,De):ju(n)?[n]:Ur(xo(Ou(n)))},An.toPlainObject=Su,An.transform=function(n,t,e){var u=of(n),i=u||cf(n)||pf(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:gu(n)&&pu(o)?ro(gi(n)):{}; - }return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return ru(n,1)},An.union=Io,An.unionBy=Ro,An.unionWith=zo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=Ge,An.unzipWith=He,An.update=function(n,t,r){return null==n?n:lr(n,t,kr(r)(kt(n,t)),void 0)},An.updateWith=function(n,t,r,e){ - return e=typeof e=="function"?e:T,null!=n&&(n=lr(n,t,kr(r)(kt(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Wu(n))},An.without=Wo,An.words=Du,An.wrap=function(n,t){return Xo(kr(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Uo,An.zip=Co,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Do,An.entries=Rf,An.entriesIn=zf,An.extend=df,An.extendWith=yf,Fu(An,An),An.add=Yf,An.attempt=$f,An.camelCase=Wf,An.capitalize=Uu, - An.ceil=Qf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=ku(r),r=r===r?r:0),t!==T&&(t=ku(t),t=t===t?t:0),pt(ku(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,zu(t))},An.deburr=Cu,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=Xf,An.endsWith=function(n,t,r){ - n=Ou(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(Au(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=au,An.escape=function(n){return(n=Ou(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Ou(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=of(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=$o,An.findIndex=Fe,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=Fo,An.findLastIndex=Ne,An.findLastKey=function(n,t){return p(n,ye(t,3),At); - },An.floor=nc,An.forEach=Xe,An.forEachRight=nu,An.forIn=function(n,t){return null==n?n:io(n,ye(t,3),Wu)},An.forInRight=function(n,t){return null==n?n:oo(n,ye(t,3),Wu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Iu,An.gt=rf,An.gte=ef,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=Ru,An.head=Ze,An.identity=Tu,An.includes=function(n,t,r,e){return n=lu(n)?n:Lu(n),r=r&&!e?Au(r):0,e=n.length,0>r&&(r=Li(e+r,0)),xu(n)?r<=e&&-1r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=mu(t),r===T?(r=t,t=0):r=mu(r),n=ku(n),n>=Ui(t,r)&&n=n},An.isSet=hf,An.isString=xu,An.isSymbol=ju,An.isTypedArray=pf,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return du(n)&&"[object WeakMap]"==_o(n)},An.isWeakSet=function(n){return du(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Wi.call(n,t)},An.kebabCase=Bf,An.last=qe,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=Au(r),u=0>u?Li(e+u,0):Ui(u,e-1)), - t===t){for(r=u+1;r--&&n[r]!==t;);n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Uf,An.lt=_f,An.lte=vf,An.max=function(n){return n&&n.length?xt(n,Tu,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,Tu)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,Tu,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=Zu,An.stubFalse=qu,An.stubObject=function(){return{}},An.stubString=function(){ - return""},An.stubTrue=function(){return true},An.multiply=tc,An.nth=function(n,t){return n&&n.length?Qt(n,Au(t)):T},An.noConflict=function(){return $n._===this&&($n._=li),this},An.noop=Nu,An.now=Ko,An.pad=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Oi(t),r)+n+ne(Si(t),r))},An.padEnd=function(n,t,r){n=Ou(n);var e=(t=Au(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Mi(),Ui(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=of(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,eo)},An.reduceRight=function(n,t,r){var e=of(n)?s:j,u=3>arguments.length; - return e(n,ye(t,4),r,u,uo)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:Au(t),or(Ou(n),t)},An.replace=function(){var n=arguments,t=Ou(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),sf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Qu(u.source,Ou(_n.exec(u))+"g")), - u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Un.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Un.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({ - iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Un.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Un.prototype[n]=function(){return this.__filtered__?new Un(this):this[r](1)}}),Un.prototype.compact=function(){return this.filter(Tu)},Un.prototype.find=function(n){return this.filter(n).head()},Un.prototype.findLast=function(n){return this.reverse().find(n); - },Un.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Un(this):this.map(function(r){return Lt(r,n,t)})}),Un.prototype.reject=function(n){return this.filter(cu(ye(n)))},Un.prototype.slice=function(n,t){n=Au(n);var r=this;return r.__filtered__&&(0t)?new Un(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=Au(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Un.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Un.prototype.toArray=function(){return this.take(4294967295); - },mt(Un.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){function t(n){return n=u.apply(An,a([n],f)),e&&h?n[0]:n}var o=this.__wrapped__,f=e?[1]:arguments,c=o instanceof Un,l=f[0],s=c||of(o);s&&r&&typeof l=="function"&&1!=l.length&&(c=s=false);var h=this.__chain__,p=!!this.__actions__.length,l=i&&!h,c=c&&!p;return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({ - func:Ye,args:[t],thisArg:T}),new On(o,h)):l&&c?n.apply(this,f):(o=this.thru(t),l?e?o.value()[0]:o.value():o)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ti[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(of(u)?u:[],n)}return this[r](function(r){return t.apply(of(r)?r:[],n)})}}),mt(Un.prototype,function(n,t){var r=An[t];if(r){var e=r.name+""; - (Ki[e]||(Ki[e]=[])).push({name:t,func:r})}}),Ki[Jr(T,2).name]=[{name:"wrapper",func:T}],Un.prototype.clone=function(){var n=new Un(this.__wrapped__);return n.__actions__=Ur(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Ur(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Ur(this.__views__),n},Un.prototype.reverse=function(){if(this.__filtered__){var n=new Un(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n; - },Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=of(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof En;){ - var e=$e(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Ye,args:[Ke],thisArg:T}),new On(n,this.__chain__)):this.thru(Ke)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,ji&&(An.prototype[ji]=Qe), + return this.__data__.get(n)},Zn.prototype.has=function(n){return this.__data__.has(n)},Zn.prototype.set=function(n,t){var r=this.__data__;if(r instanceof Tn){var e=r.__data__;if(!Ni||199>e.length)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new Fn(e)}return r.set(n,t),this.size=r.size,this};var uo=Fr(mt),io=Fr(At,true),oo=Nr(),fo=Nr(true),co=Ki?function(n,t){return Ki.set(n,t),n}:$u,ao=Ai?function(n,t){return Ai(n,"toString",{configurable:true,enumerable:false,value:Tu(t),writable:true})}:$u,lo=ki||function(n){ + return $n.clearTimeout(n)},so=Zi&&1/L(new Zi([,-0]))[1]==$?function(n){return new Zi(n)}:Pu,ho=Ki?function(n){return Ki.get(n)}:Pu,po=Ri?function(n){return null==n?[]:(n=Qu(n),i(Ri(n),function(t){return bi.call(n,t)}))}:qu,_o=Ri?function(n){for(var t=[];n;)a(t,po(n)),n=di(n);return t}:qu,vo=Ot;(Fi&&"[object DataView]"!=vo(new Fi(new ArrayBuffer(1)))||Ni&&"[object Map]"!=vo(new Ni)||Pi&&"[object Promise]"!=vo(Pi.resolve())||Zi&&"[object Set]"!=vo(new Zi)||qi&&"[object WeakMap]"!=vo(new qi))&&(vo=function(n){ + var t=Ot(n);if(n=(n="[object Object]"==t?n.constructor:T)?Te(n):"")switch(n){case Hi:return"[object DataView]";case Ji:return"[object Map]";case Yi:return"[object Promise]";case Qi:return"[object Set]";case Xi:return"[object WeakMap]"}return t});var go=ui?_u:Vu,yo=Ce(co),bo=Si||function(n,t){return $n.setTimeout(n,t)},xo=Ce(ao),jo=function(n){n=cu(n,function(n){return 500===t.size&&t.clear(),n});var t=n.cache;return n}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(tn,function(n,r,e,u){ + t.push(e?u.replace(hn,"$1"):r||n)}),t}),wo=fr(function(n,t){return hu(n)?yt(n,wt(t,1,hu,true)):[]}),mo=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),ye(r,2)):[]}),Ao=fr(function(n,t){var r=Ve(t);return hu(r)&&(r=T),hu(n)?yt(n,wt(t,1,hu,true),T,r):[]}),ko=fr(function(n){var t=c(n,kr);return t.length&&t[0]===n[0]?Wt(t):[]}),Eo=fr(function(n){var t=Ve(n),r=c(n,kr);return t===Ve(r)?t=T:r.pop(),r.length&&r[0]===n[0]?Wt(r,ye(t,2)):[]}),So=fr(function(n){var t=Ve(n),r=c(n,kr);return(t=typeof t=="function"?t:T)&&r.pop(), + r.length&&r[0]===n[0]?Wt(r,T,t):[]}),Oo=fr(Ke),Io=pe(function(n,t){var r=null==n?0:n.length,e=ht(n,t);return ur(n,c(t,function(n){return Se(n,r)?+n:n}).sort(Wr)),e}),Ro=fr(function(n){return br(wt(n,1,hu,true))}),zo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T),br(wt(n,1,hu,true),ye(t,2))}),Wo=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return br(wt(n,1,hu,true),T,t)}),Uo=fr(function(n,t){return hu(n)?yt(n,t):[]}),Bo=fr(function(n){return mr(i(n,hu))}),Lo=fr(function(n){var t=Ve(n);return hu(t)&&(t=T), + mr(i(n,hu),ye(t,2))}),Co=fr(function(n){var t=Ve(n),t=typeof t=="function"?t:T;return mr(i(n,hu),T,t)}),Do=fr(He),Mo=fr(function(n){var t=n.length,t=1=t}),of=Lt(function(){return arguments}())?Lt:function(n){return yu(n)&&oi.call(n,"callee")&&!bi.call(n,"callee")},ff=Ku.isArray,cf=Vn?E(Vn):Ct,af=zi||Vu,lf=Kn?E(Kn):Dt,sf=Gn?E(Gn):Tt,hf=Hn?E(Hn):Nt,pf=Jn?E(Jn):Pt,_f=Yn?E(Yn):Zt,vf=ee(Kt),gf=ee(function(n,t){return n<=t}),df=$r(function(n,t){ + if(ze(t)||su(t))Cr(t,Wu(t),n);else for(var r in t)oi.call(t,r)&&ot(n,r,t[r])}),yf=$r(function(n,t){Cr(t,Uu(t),n)}),bf=$r(function(n,t,r,e){Cr(t,Uu(t),n,e)}),xf=$r(function(n,t,r,e){Cr(t,Wu(t),n,e)}),jf=pe(ht),wf=fr(function(n,t){n=Qu(n);var r=-1,e=t.length,u=2--n)return t.apply(this,arguments)}},An.ary=eu,An.assign=df,An.assignIn=yf,An.assignInWith=bf,An.assignWith=xf,An.at=jf,An.before=uu,An.bind=Ho,An.bindAll=Nf,An.bindKey=Jo,An.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return ff(n)?n:[n]},An.chain=Ye,An.chunk=function(n,t,r){if(t=(r?Oe(n,t,r):t===T)?1:Li(ku(t),0),r=null==n?0:n.length,!r||1>t)return[];for(var e=0,u=0,i=Ku(Oi(r/t));et?0:t,e)):[]},An.dropRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0,0>t?0:t)):[]},An.dropRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true,true):[]; + },An.dropWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),true):[]},An.fill=function(n,t,r,e){var u=null==n?0:n.length;if(!u)return[];for(r&&typeof r!="number"&&Oe(n,t,r)&&(r=0,e=u),u=n.length,r=ku(r),0>r&&(r=-r>u?0:u+r),e=e===T||e>u?u:ku(e),0>e&&(e+=u),e=r>e?0:Eu(e);r>>0,r?(n=Iu(n))&&(typeof t=="string"||null!=t&&!hf(t))&&(t=yr(t),!t&&Rn.test(n))?Or(M(n),0,r):n.split(t,r):[]},An.spread=function(t,r){if(typeof t!="function")throw new ti("Expected a function");return r=null==r?0:Li(ku(r),0), + fr(function(e){var u=e[r];return e=Or(e,0,r),u&&a(e,u),n(t,this,e)})},An.tail=function(n){var t=null==n?0:n.length;return t?hr(n,1,t):[]},An.take=function(n,t,r){return n&&n.length?(t=r||t===T?1:ku(t),hr(n,0,0>t?0:t)):[]},An.takeRight=function(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===T?1:ku(t),t=e-t,hr(n,0>t?0:t,e)):[]},An.takeRightWhile=function(n,t){return n&&n.length?jr(n,ye(t,3),false,true):[]},An.takeWhile=function(n,t){return n&&n.length?jr(n,ye(t,3)):[]},An.tap=function(n,t){return t(n), + n},An.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new ti("Expected a function");return du(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),fu(n,t,{leading:e,maxWait:t,trailing:u})},An.thru=Qe,An.toArray=mu,An.toPairs=zf,An.toPairsIn=Wf,An.toPath=function(n){return ff(n)?c(n,Me):wu(n)?[n]:Lr(jo(Iu(n)))},An.toPlainObject=Ou,An.transform=function(n,t,e){var u=ff(n),i=u||af(n)||_f(n);if(t=ye(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:du(n)&&_u(o)?eo(di(n)):{}; + }return(i?r:mt)(n,function(n,r,u){return t(e,n,r,u)}),e},An.unary=function(n){return eu(n,1)},An.union=Ro,An.unionBy=zo,An.unionWith=Wo,An.uniq=function(n){return n&&n.length?br(n):[]},An.uniqBy=function(n,t){return n&&n.length?br(n,ye(t,2)):[]},An.uniqWith=function(n,t){return t=typeof t=="function"?t:T,n&&n.length?br(n,T,t):[]},An.unset=function(n,t){return null==n||xr(n,t)},An.unzip=He,An.unzipWith=Je,An.update=function(n,t,r){return null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),void 0)),n},An.updateWith=function(n,t,r,e){ + return e=typeof e=="function"?e:T,null!=n&&(r=Er(r),n=lr(n,t,r(Et(n,t)),e)),n},An.values=Lu,An.valuesIn=function(n){return null==n?[]:S(n,Uu(n))},An.without=Uo,An.words=Mu,An.wrap=function(n,t){return nf(Er(t),n)},An.xor=Bo,An.xorBy=Lo,An.xorWith=Co,An.zip=Do,An.zipObject=function(n,t){return Ar(n||[],t||[],ot)},An.zipObjectDeep=function(n,t){return Ar(n||[],t||[],lr)},An.zipWith=Mo,An.entries=zf,An.entriesIn=Wf,An.extend=yf,An.extendWith=bf,Nu(An,An),An.add=Qf,An.attempt=Ff,An.camelCase=Uf,An.capitalize=Cu, + An.ceil=Xf,An.clamp=function(n,t,r){return r===T&&(r=t,t=T),r!==T&&(r=Su(r),r=r===r?r:0),t!==T&&(t=Su(t),t=t===t?t:0),pt(Su(n),t,r)},An.clone=function(n){return _t(n,4)},An.cloneDeep=function(n){return _t(n,5)},An.cloneDeepWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,5,t)},An.cloneWith=function(n,t){return t=typeof t=="function"?t:T,_t(n,4,t)},An.conformsTo=function(n,t){return null==t||gt(n,t,Wu(t))},An.deburr=Du,An.defaultTo=function(n,t){return null==n||n!==n?t:n},An.divide=nc,An.endsWith=function(n,t,r){ + n=Iu(n),t=yr(t);var e=n.length,e=r=r===T?e:pt(ku(r),0,e);return r-=t.length,0<=r&&n.slice(r,e)==t},An.eq=lu,An.escape=function(n){return(n=Iu(n))&&H.test(n)?n.replace(K,nt):n},An.escapeRegExp=function(n){return(n=Iu(n))&&en.test(n)?n.replace(rn,"\\$&"):n},An.every=function(n,t,r){var e=ff(n)?u:bt;return r&&Oe(n,t,r)&&(t=T),e(n,ye(t,3))},An.find=Fo,An.findIndex=Ne,An.findKey=function(n,t){return p(n,ye(t,3),mt)},An.findLast=No,An.findLastIndex=Pe,An.findLastKey=function(n,t){return p(n,ye(t,3),At); + },An.floor=tc,An.forEach=nu,An.forEachRight=tu,An.forIn=function(n,t){return null==n?n:oo(n,ye(t,3),Uu)},An.forInRight=function(n,t){return null==n?n:fo(n,ye(t,3),Uu)},An.forOwn=function(n,t){return n&&mt(n,ye(t,3))},An.forOwnRight=function(n,t){return n&&At(n,ye(t,3))},An.get=Ru,An.gt=ef,An.gte=uf,An.has=function(n,t){return null!=n&&we(n,t,Rt)},An.hasIn=zu,An.head=qe,An.identity=$u,An.includes=function(n,t,r,e){return n=su(n)?n:Lu(n),r=r&&!e?ku(r):0,e=n.length,0>r&&(r=Li(e+r,0)),ju(n)?r<=e&&-1r&&(r=Li(e+r,0)),v(n,t,r)):-1},An.inRange=function(n,t,r){return t=Au(t),r===T?(r=t,t=0):r=Au(r),n=Su(n),n>=Ci(t,r)&&n=n},An.isSet=pf,An.isString=ju,An.isSymbol=wu,An.isTypedArray=_f,An.isUndefined=function(n){return n===T},An.isWeakMap=function(n){return yu(n)&&"[object WeakMap]"==vo(n)},An.isWeakSet=function(n){return yu(n)&&"[object WeakSet]"==Ot(n)},An.join=function(n,t){return null==n?"":Ui.call(n,t)},An.kebabCase=Bf,An.last=Ve,An.lastIndexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;if(r!==T&&(u=ku(r),u=0>u?Li(e+u,0):Ci(u,e-1)), + t===t)n:{for(r=u+1;r--;)if(n[r]===t){n=r;break n}n=r}else n=_(n,d,u,true);return n},An.lowerCase=Lf,An.lowerFirst=Cf,An.lt=vf,An.lte=gf,An.max=function(n){return n&&n.length?xt(n,$u,It):T},An.maxBy=function(n,t){return n&&n.length?xt(n,ye(t,2),It):T},An.mean=function(n){return y(n,$u)},An.meanBy=function(n,t){return y(n,ye(t,2))},An.min=function(n){return n&&n.length?xt(n,$u,Kt):T},An.minBy=function(n,t){return n&&n.length?xt(n,ye(t,2),Kt):T},An.stubArray=qu,An.stubFalse=Vu,An.stubObject=function(){ + return{}},An.stubString=function(){return""},An.stubTrue=function(){return true},An.multiply=rc,An.nth=function(n,t){return n&&n.length?Qt(n,ku(t)):T},An.noConflict=function(){return $n._===this&&($n._=si),this},An.noop=Pu,An.now=Go,An.pad=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return!t||e>=t?n:(t=(t-e)/2,ne(Ii(t),r)+n+ne(Oi(t),r))},An.padEnd=function(n,t,r){n=Iu(n);var e=(t=ku(t))?D(n):0;return t&&et){var e=n;n=t,t=e}return r||n%1||t%1?(r=Ti(),Ci(n+r*(t-n+Cn("1e-"+((r+"").length-1))),t)):ir(n,t)},An.reduce=function(n,t,r){var e=ff(n)?l:j,u=3>arguments.length;return e(n,ye(t,4),r,u,uo)},An.reduceRight=function(n,t,r){ + var e=ff(n)?s:j,u=3>arguments.length;return e(n,ye(t,4),r,u,io)},An.repeat=function(n,t,r){return t=(r?Oe(n,t,r):t===T)?1:ku(t),or(Iu(n),t)},An.replace=function(){var n=arguments,t=Iu(n[0]);return 3>n.length?t:t.replace(n[1],n[2])},An.result=function(n,t,r){t=Sr(t,n);var e=-1,u=t.length;for(u||(u=1,n=T);++en||9007199254740991=i)return n;if(i=r-D(e),1>i)return e;if(r=o?Or(o,0,i).join(""):n.slice(0,i),u===T)return r+e;if(o&&(i+=r.length-i),hf(u)){if(n.slice(i).search(u)){var f=r;for(u.global||(u=Xu(u.source,Iu(_n.exec(u))+"g")), + u.lastIndex=0;o=u.exec(f);)var c=o.index;r=r.slice(0,c===T?i:c)}}else n.indexOf(yr(u),i)!=i&&(u=r.lastIndexOf(u),-1e.__dir__?"Right":"")}),e},Ln.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=1==r||3==r;Ln.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({ + iteratee:ye(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){var r="take"+(t?"Right":"");Ln.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ln.prototype[n]=function(){return this.__filtered__?new Ln(this):this[r](1)}}),Ln.prototype.compact=function(){return this.filter($u)},Ln.prototype.find=function(n){return this.filter(n).head()},Ln.prototype.findLast=function(n){return this.reverse().find(n); + },Ln.prototype.invokeMap=fr(function(n,t){return typeof n=="function"?new Ln(this):this.map(function(r){return Bt(r,n,t)})}),Ln.prototype.reject=function(n){return this.filter(au(ye(n)))},Ln.prototype.slice=function(n,t){n=ku(n);var r=this;return r.__filtered__&&(0t)?new Ln(r):(0>n?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==T&&(t=ku(t),r=0>t?r.dropRight(-t):r.take(t-n)),r)},Ln.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ln.prototype.toArray=function(){return this.take(4294967295); + },mt(Ln.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=An[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);u&&(An.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ln,c=o[0],l=f||ff(t),s=function(n){return n=u.apply(An,a([n],o)),e&&h?n[0]:n};l&&r&&typeof c=="function"&&1!=c.length&&(f=l=false);var h=this.__chain__,p=!!this.__actions__.length,c=i&&!h,f=f&&!p;return!i&&l?(t=f?t:new Ln(this),t=n.apply(t,o),t.__actions__.push({ + func:Qe,args:[s],thisArg:T}),new On(t,h)):c&&f?n.apply(this,o):(t=this.thru(s),c?e?t.value()[0]:t.value():t)})}),r("pop push shift sort splice unshift".split(" "),function(n){var t=ri[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);An.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(ff(u)?u:[],n)}return this[r](function(r){return t.apply(ff(r)?r:[],n)})}}),mt(Ln.prototype,function(n,t){var r=An[t];if(r){var e=r.name+""; + (Gi[e]||(Gi[e]=[])).push({name:t,func:r})}}),Gi[Jr(T,2).name]=[{name:"wrapper",func:T}],Ln.prototype.clone=function(){var n=new Ln(this.__wrapped__);return n.__actions__=Lr(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Lr(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Lr(this.__views__),n},Ln.prototype.reverse=function(){if(this.__filtered__){var n=new Ln(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n; + },Ln.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=0;for(var o=i,f=this.__views__,c=-1,a=f.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){for(var t,r=this;r instanceof kn;){ + var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ln?(this.__actions__.length&&(n=new Ln(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head,wi&&(An.prototype[wi]=Xe), An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); /* eslint-enable */ diff --git a/src/DKTools/overrides.js b/src/DKTools/overrides.js index 8babd86..2a4db2e 100644 --- a/src/DKTools/overrides.js +++ b/src/DKTools/overrides.js @@ -30,7 +30,7 @@ ImageCache.prototype._truncateCache = function() { Object.keys(items).map(key => items[key]) .filter(item => !this._mustBeHeld(item)) .sort((a, b) => b.touch - a.touch) - .forEach(item => { + .forEach((item) => { if (sizeLeft > 0 && !DKTools.PreloadManager.isImageCachedByKey(item.key)) { const bitmap = item.bitmap; @@ -92,15 +92,137 @@ Graphics._createFPSMeter = function() { const param = DKToolsParam.get('FPS Meter'); if (param.Enabled) { - const options = { toggleOn: null, graph: 1, decimals: 0, theme: param.Theme, history: param.History }; + this._fpsMeter = new FPSMeter({ + theme: param.Theme, + history: param.History, + toggleOn: null, + graph: 1, + decimals: 0 + }); - this._fpsMeter = new FPSMeter(options); this._fpsMeter.hide(); } else { DKTools_Graphics_createFPSMeter.call(this); } }; +Graphics.printDetailedError = function(error) { + if (!this._errorPrinter) { + return; + } + + const stack = error.stack.split(/(?:\r\n|\r|\n)/).map((value) => { + return value.replace(/[\(](.*[\/])/, '('); + }); + + this._errorPrinter.innerHTML = this._makeDetailedErrorHtml(error.name, error.message, stack); + + this._applyCanvasFilter(); + this._clearUpperCanvas(); +}; + +Graphics._getErrorReferenceInfo = function() { + const scene = SceneManager._scene; + const data = {}; + + if (scene && scene.constructor.name) { + data['Scene'] = scene.constructor.name; + + if (SceneManager.isCurrentScene(Scene_Map)) { + const interpreter = $gameMap._interpreter; + + if (interpreter) { + if (interpreter._mapId > 0) { + data['Map ID'] = interpreter._mapId; + } + + if (interpreter._eventId > 0) { + data['Event ID'] = interpreter._eventId; + + const event = $gameMap.event(interpreter._eventId); + + if (event) { + data['Event Page'] = event._pageIndex + 1; + } + } + + if (interpreter._list && interpreter._list.length > 0) { + let command = interpreter._list[interpreter._index]; + + if (command && command.code === 0 && interpreter._index > 0) { + command = interpreter._list[interpreter._index - 1]; + } + + if (command && command.code > 0) { + data['Last Event Command'] = command.code; + } + } + + if (interpreter._params && interpreter._params.length > 0) { + data['Params'] = JSON.stringify(interpreter._params); + } + } + } + } + + return data; +}; + +Graphics._getErrorMessageForErrorPrint = function() { + return DKToolsParam.get('Print Detailed Error', 'Error Message'); +}; + +Graphics._getRestartMessageForErrorPrint = function() { + return DKToolsParam.get('Print Detailed Error', 'Restart Message'); +}; + +Graphics._makeDetailedErrorHtml = function(name, message, stack) { + const errorMessage = this._getErrorMessageForErrorPrint(); + const restartMessage = this._getRestartMessageForErrorPrint(); + const referenceInfo = this._getErrorReferenceInfo(); + let text = ''; + + if (errorMessage) { + text = '' + errorMessage + '
' + '

'; + } + + if (Object.keys(referenceInfo).length > 0) { + text += '' + 'Reference Information' + '
'; + + _.forEach(referenceInfo, (value, key) => { + text += '' + key + ': ' + value + '
'; + }); + + text += '
'; + } + + text += '' + message + '
'; + + _.forEach(stack, (value) => { + text += '' + value + '
'; + }); + + if (restartMessage) { + text += '
' + restartMessage + '

'; + } + + return text; +}; + +const DKTools_Graphics_updateErrorPrinter = Graphics._updateErrorPrinter; +Graphics._updateErrorPrinter = function() { + DKTools_Graphics_updateErrorPrinter.call(this); + + if (!this._errorPrinter || !DKToolsParam.get('Print Detailed Error', 'Enabled')) { + return; + } + + this._errorPrinter.style.textAlign = 'left'; + this._errorPrinter.height = this._height * 0.8; + + this._centerElement(this._errorPrinter); +}; + @@ -362,6 +484,8 @@ TouchInput._onMouseMove = function(event) { if (this._mouseX !== x || this._mouseY !== y) { this._events.mouseMoved = true; + + this._date = Date.now(); this._mouseX = x; this._mouseY = y; } @@ -427,6 +551,7 @@ Object.defineProperties(TouchInput, { + //=========================================================================== // Tilemap //=========================================================================== @@ -528,10 +653,11 @@ SceneManager.initialize = async function() { const DKTools_SceneManager_initGraphics = SceneManager.initGraphics; SceneManager.initGraphics = function() { const param = DKToolsParam.get('Screen Resolution'); - const width = param.Width; - const height = param.Height; if (param.Enabled) { + const width = param.Width; + const height = param.Height; + this._boxWidth = width; this._screenWidth = width; this._boxHeight = height; @@ -551,7 +677,7 @@ SceneManager.updateResolution = function() { const resizeWidth = this._screenWidth - window.innerWidth; const resizeHeight = this._screenHeight - window.innerHeight; - if (!Imported.ScreenResolution && resizeWidth > 0 && resizeHeight > 0) { + if (resizeWidth > 0 && resizeHeight > 0) { window.moveBy(-1 * resizeWidth / 2, -1 * resizeHeight / 2); window.resizeBy(resizeWidth, resizeHeight); } @@ -594,10 +720,14 @@ SceneManager.onKeyDown = function(event) { }; const DKTools_SceneManager_catchException = SceneManager.catchException; -SceneManager.catchException = function(e) { - DKTools_SceneManager_catchException.call(this, e); +SceneManager.catchException = function(error) { + DKTools_SceneManager_catchException.call(this, error); - DKTools.Utils.logError(e); + if (error instanceof Error && DKToolsParam.get('Print Detailed Error', 'Enabled')) { + Graphics.printDetailedError(error); + } + + DKTools.Utils.logError(error); if (DKToolsParam.get('Debugging Console', 'Open On Error')) { DKTools.Utils.openConsole(); @@ -620,6 +750,7 @@ SceneManager.changeScene = function() { if (this._scene) { this._scene.terminate(); this._scene.detachReservation(); + this._previousClass = this._scene.constructor; } @@ -636,6 +767,7 @@ SceneManager.changeScene = function() { if (this._scene.isPreloaded()) { this._scene.create(); this._sceneCreated = true; + this.onSceneCreate(); } } @@ -651,6 +783,7 @@ SceneManager.updateScene = function() { if (!this._sceneCreated && this._scene.isPreloaded()) { this._scene.create(); this._sceneCreated = true; + this.onSceneCreate(); } @@ -659,11 +792,17 @@ SceneManager.updateScene = function() { if (this._scene.isReady()) { this._scene.start(); this._sceneStarted = true; + this.onSceneStart(); } } catch (e) { + console.error(e); + + DKTools.Utils.logError(e); + this._scene.start(); this._sceneStarted = true; + this.onSceneStart(); } } @@ -675,12 +814,13 @@ SceneManager.updateScene = function() { }; /** + * @version 8.0.0 * @since 6.1.0 * * @returns {Boolean} */ SceneManager.isCurrentScene = function(sceneClass) { - return this._scene instanceof sceneClass; + return !!this._scene && this._scene.constructor === sceneClass; }; const DKTools_SceneManager_goto = SceneManager.goto; @@ -701,9 +841,32 @@ const DKTools_Scene_Base_initialize = Scene_Base.prototype.initialize; Scene_Base.prototype.initialize = function() { DKTools_Scene_Base_initialize.call(this); + /** + * @private + * @readonly + * @type {DKTools.Scene.Preloader} + */ this._preloader = new DKTools.Scene.Preloader(); }; +/** + * Activates the scene + * + * @since 8.0.0 + */ +Scene_Base.prototype.activate = function() { + this._active = true; +}; + +/** + * Deactivates the scene + * + * @since 8.0.0 + */ +Scene_Base.prototype.deactivate = function() { + this._active = false; +}; + /** * Returns true if the scene is preloaded * @@ -745,6 +908,13 @@ Scene_Base.prototype.startPreloading = function() { this._preloader.start(); }; +const DKTools_Scene_Base_terminate = Scene_Base.prototype.terminate; +Scene_Base.prototype.terminate = function() { + DKTools_Scene_Base_terminate.call(this); + + this._preloader.finish(); +}; +