diff --git a/assets/TT Squares Condensed Black Italic-5672aa6e.otf b/assets/TT Squares Condensed Black Italic-5672aa6e.otf new file mode 100644 index 00000000..5c5e07da Binary files /dev/null and b/assets/TT Squares Condensed Black Italic-5672aa6e.otf differ diff --git a/assets/TT Squares Condensed Black-221a58ab.otf b/assets/TT Squares Condensed Black-221a58ab.otf new file mode 100644 index 00000000..44aea456 Binary files /dev/null and b/assets/TT Squares Condensed Black-221a58ab.otf differ diff --git a/assets/TT Squares Condensed Bold Italic-906bdd16.otf b/assets/TT Squares Condensed Bold Italic-906bdd16.otf new file mode 100644 index 00000000..2e92be21 Binary files /dev/null and b/assets/TT Squares Condensed Bold Italic-906bdd16.otf differ diff --git a/assets/TT Squares Condensed Bold-7edd675d.otf b/assets/TT Squares Condensed Bold-7edd675d.otf new file mode 100644 index 00000000..03196d24 Binary files /dev/null and b/assets/TT Squares Condensed Bold-7edd675d.otf differ diff --git a/assets/TT Squares Condensed Light Italic-da726055.otf b/assets/TT Squares Condensed Light Italic-da726055.otf new file mode 100644 index 00000000..44422dff Binary files /dev/null and b/assets/TT Squares Condensed Light Italic-da726055.otf differ diff --git a/assets/TT Squares Condensed Light-cc406c21.otf b/assets/TT Squares Condensed Light-cc406c21.otf new file mode 100644 index 00000000..db624b16 Binary files /dev/null and b/assets/TT Squares Condensed Light-cc406c21.otf differ diff --git a/assets/TT Squares Condensed Regular Italic-e5fdfada.otf b/assets/TT Squares Condensed Regular Italic-e5fdfada.otf new file mode 100644 index 00000000..e374a1f2 Binary files /dev/null and b/assets/TT Squares Condensed Regular Italic-e5fdfada.otf differ diff --git a/assets/TT Squares Condensed Regular-9a6ac9aa.otf b/assets/TT Squares Condensed Regular-9a6ac9aa.otf new file mode 100644 index 00000000..3e3e2f94 Binary files /dev/null and b/assets/TT Squares Condensed Regular-9a6ac9aa.otf differ diff --git a/assets/TT Squares Condensed Thin italic-550453e0.otf b/assets/TT Squares Condensed Thin italic-550453e0.otf new file mode 100644 index 00000000..fa085399 Binary files /dev/null and b/assets/TT Squares Condensed Thin italic-550453e0.otf differ diff --git a/assets/TT Squares Condensed Thin-1f34237c.otf b/assets/TT Squares Condensed Thin-1f34237c.otf new file mode 100644 index 00000000..a61817f4 Binary files /dev/null and b/assets/TT Squares Condensed Thin-1f34237c.otf differ diff --git a/assets/howler-b02193e5.js b/assets/howler-9ba4aca9.js similarity index 99% rename from assets/howler-b02193e5.js rename to assets/howler-9ba4aca9.js index 7950fd69..6bf5b8a4 100644 --- a/assets/howler-b02193e5.js +++ b/assets/howler-9ba4aca9.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-0f03996f.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! +import{g as L,c as S}from"./index-83fac15e.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! * howler.js v2.2.3 * howlerjs.com * diff --git a/assets/index-32c23222.css b/assets/index-32c23222.css deleted file mode 100644 index af7dae4b..00000000 --- a/assets/index-32c23222.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:TTSC-Black-Italic;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Black Italic.otf")}@font-face{font-family:TTSC-Black;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Black.otf")}@font-face{font-family:TTSC-Bold-Italic;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Bold Italic.otf")}@font-face{font-family:TTSC-Bold;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Bold.otf")}@font-face{font-family:TTSC-Light-Italic;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Light Italic.otf")}@font-face{font-family:TTSC-Light;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Light.otf")}@font-face{font-family:TTSC-Regular-Italic;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Regular Italic.otf")}@font-face{font-family:TTSC-Regular;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Regular.otf")}@font-face{font-family:TTSC-Thin-Italic;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Thin italic.otf")}@font-face{font-family:TTSC-Thin;src:url("/CharacterStudio/fonts/tt-squares/TT Squares Condensed Thin.otf")}html,body{margin:0;padding:0;height:100%;font-family:TTSC-Regular}#root{height:100%;overflow:hidden}::-webkit-scrollbar{width:.1em}::-webkit-scrollbar-track{box-shadow:transparent}::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.horizontalScroll ::-webkit-scrollbar{height:.1em}.horizontalScroll ::-webkit-scrollbar-track{box-shadow:transparent}.horizontalScroll ::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.root{overflow:hidden;margin:0;padding:0}#editor-scene{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.loadingIndicator{display:none;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0;width:80px;height:80px;margin:auto;border-radius:10px;filter:drop-shadow(1px 1px 2px black)}.loadingIndicator.active{display:block}.loadingIndicator>img{position:absolute;left:0;right:0;top:0;bottom:0;width:65%;height:65%;margin:auto}.rotate{animation:rotate 2.2s linear infinite}.sectionTitle{position:absolute;top:34px;left:32px;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px}.generalTitle{position:absolute;top:16px;left:32px;color:#fff;opacity:.7;font-size:12px;padding:0;text-shadow:1px 1px 2px black;text-transform:uppercase}@keyframes rotate{to{transform:rotate(360deg)}}._container_1fjfz_1{width:100vw;height:100vh;margin:auto;position:absolute;display:flex;justify-content:center;align-items:center}._messageWindow_1fjfz_11{width:500px;height:150px;margin:auto;display:flex;padding:0 0 10px;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);justify-content:space-around;align-items:center;flex-direction:column}._messageTitle_1fjfz_25{font-family:TTSC-Bold;font-weight:800;text-transform:uppercase!important;line-height:106%;color:#5eb086;height:40px;display:flex;align-items:center}._buttonContainer_1fjfz_36{width:100%;display:flex;height:40px;justify-content:space-around;-webkit-user-select:none;user-select:none}._iconButtonWrap_1fm7l_1{display:inline-block;position:relative;z-index:1;cursor:pointer}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8{height:100%;width:auto!important}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16,._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13{fill:#eaf4ef}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16{fill:#000}._iconButtonWrap_1fm7l_1 ._iconWrap_1fm7l_28{display:block;position:absolute;left:0;top:0;z-index:1;height:100%;width:100%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1{top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;height:46%!important;max-width:46%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1 *{fill:#000}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._icon_1fm7l_1 *{fill:#fff}._iconButtonWrap_1fm7l_1:hover ._buttonBackgroundColor_1fm7l_13{fill:#ffc000!important;stroke:#000!important}._iconButtonWrap_1fm7l_1:hover ._innerBackgroundColor_1fm7l_16{fill:#ffc000!important}._iconButtonWrap_1fm7l_1:hover ._icon_1fm7l_1 *{fill:#eaf4ef!important}._iconButtonWrap_1fm7l_1:active ._buttonBackgroundColor_1fm7l_13{fill:#fdc503!important}._iconButtonWrap_1fm7l_1:active ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1:active ._icon_1fm7l_1 *{fill:#fdc503}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._icon_1fm7l_1 *{fill:#fdc503}._buttonWrap_1fm7l_95{border:1px solid #000000;background:#000000;padding:0;margin:0;display:inline-block;cursor:pointer}._buttonWrap_1fm7l_95 ._icon_1fm7l_1{top:40%!important}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108{vertical-align:middle;size:inherit;margin-right:18px;position:relative;display:inline-block}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108 svg{width:auto;height:120%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute}._buttonWrap_1fm7l_95 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;font-weight:800;background:#FFFFFF;color:#000;padding:8px 14px 6px!important;text-transform:uppercase!important;line-height:106%}._buttonWrap_1fm7l_95:disabled ._innerWrap_1fm7l_127{color:#7e7e7e}._buttonWrap_1fm7l_95._dark_1fm7l_20 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;background:#000000;color:#fff;text-transform:uppercase!important;padding:8px 14px 6px!important}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#FFC000;color:#efefef}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127 *{fill:#efefef!important}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#000000;color:#ffc000}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127 *{fill:#ffc000!important}._backgroundImg_iv22q_1{background-image:url(./assets/backgrounds/background4.jpg);background-attachment:fixed;background-repeat:no-repeat;background-position:center center;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._darkBackground_iv22q_16{background-color:#1e2530;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._Background_iv22q_29{background:url(./assets/backgrounds/background4.jpg);background-position:center;background-repeat:no-repeat;background-size:cover;overflow:hidden}._webamark_iv22q_37{position:absolute;left:0;top:0;width:100vw;height:100vh}._logo_iv22q_45{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:auto;height:100vh;opacity:.3}._chatContainer_1659d_1{position:absolute;width:100%;max-width:50%;top:50%;right:32px;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:-webkit-calc(100vh - 266px);height:calc(100vh - 266px);background:rgba(5,11,14,.8);color:#f0f8ff}._scrollContainer_1659d_16{height:98%;width:99%;position:absolute;left:0;top:2px;overflow-x:hidden;overflow-y:scroll}._topLine_1659d_26{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._bottomLine_1659d_54{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_1659d_82{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1659d_82 ._buttonLeft_1659d_91{float:left}._buttonContainer_1659d_82 ._buttonRight_1659d_95{float:Right}._buttonContainer_1659d_82 ._buttonCenter_1659d_99{margin:0 8px}._buttonContainer_1659d_82:after{content:" ";display:block;clear:both}._buttonContainer_1659d_82 button{min-width:120px}._chatBox_1fp89_1{width:100%;height:100%;font-size:.875rem;color:#fff;text-align:left;box-sizing:border-box;padding:24px}._chatBox_1fp89_1 *{outline:none!important}._chatBox_1fp89_1>label,._chatBox_1fp89_1>span>label{display:block;width:100%;color:#99abb2;margin-bottom:8px}._chatBox_1fp89_1>input,._chatBox_1fp89_1>span>input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;display:block}._chatBox_1fp89_1>textarea{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:calc(100% - 1em);display:block}._chatBox_1fp89_1>select{background-color:#000;color:#fff;border-radius:5px;border:1px solid #fff;margin:.5em;padding:.5em;width:calc(100% - 1em)}._messages_1fp89_50{display:flex;flex-direction:column;height:100%;height:180px;overflow:auto;margin-bottom:20px;background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:16px 8px 16px 16px;box-sizing:border-box;width:100%;height:calc(100% - 142px);height:-webkit-calc(100% - 142px)}._messages_1fp89_50 ._scrollBox_1fp89_67{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding-right:8px;box-sizing:border-box;padding-top:14px}._send_1fp89_78 input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:calc(100% - 214px);margin-left:10px;margin-right:8px;height:18px;display:inline-block}._mic_1fp89_90{vertical-align:middle}._sendButton_1fp89_94{vertical-align:bottom;float:right;width:140px}._speaker_1fp89_100{width:100%}._speaker_1fp89_100>label{display:block;color:#99abb2;margin-bottom:8px}._speaker_1fp89_100 input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:100%;height:100%;box-sizing:border-box;margin-bottom:8px}._warning_1fp89_121{display:inline-block;position:absolute;right:24px;top:9px;font-size:14px;color:#deb887}._isTyping_1fp89_130{padding:0;margin:4px 0 0 45px;display:none}._isTyping_1fp89_130._show_1fp89_136{display:inline-block}._message_1mjdp_1 ._chat-bubble_1mjdp_1{display:inline-block;padding:8px 12px;max-width:60%;border-radius:4px;background:rgba(255,255,255,.05);box-shadow:0 1px 1px #0006;position:relative;margin-bottom:8px;font-size:16px}._message_1mjdp_1 ._chat-bubble_1mjdp_1 ._colorBg_1mjdp_13{background:#aaa;position:absolute;left:0;top:0;width:100%;height:100%;opacity:.2;border-radius:4px}._message_1mjdp_1 ._name_1mjdp_24{margin-bottom:8px;padding-left:4px;margin-top:-16px;font-size:14px}._message_1mjdp_1 span{font-size:10px;margin-left:4px;margin-right:4px;display:inline-block;color:#fff6}._speaker_1mjdp_39{text-align:right}._buttonContainer_1fd4o_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1fd4o_1 ._buttonLeft_1fd4o_10{float:left}._buttonContainer_1fd4o_1 ._buttonRight_1fd4o_14{float:Right}._buttonContainer_1fd4o_1 ._buttonCenter_1fd4o_18{margin:0 8px}._buttonContainer_1fd4o_1:after{content:" ";display:block;clear:both}._buttonContainer_1fd4o_1 button{min-width:120px}._button_13dfi_1{margin:0 8px}._InformationContainerPos_1a3zv_1{position:fixed;left:32px;top:98px;width:300px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_1a3zv_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:center}._traitInfoText_1a3zv_22{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;display:flex;justify-content:center}._flexSelect_1a3zv_33{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1a3zv_40{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1a3zv_54{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1a3zv_61{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_1a3zv_68{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_1a3zv_79 input[type=checkbox]{display:none}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84._checked_1a3zv_93{background-color:#5eb086}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84 ._checkmark_1a3zv_97{display:none}._custom-checkbox_1a3zv_79 input[type=checkbox]:checked+._checkbox-container_1a3zv_84{background-color:#5eb086}._custom-checkbox_1a3zv_79 input[type=checkbox]:checked+._checkbox-container_1a3zv_84 ._checkmark_1a3zv_97{display:block}._checkboxHolder_1a3zv_110{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._mainTitleWrap_4fb0s_1{background:rgba(5,11,14,.8);position:absolute;top:-28px;padding:8px 0 6px;font-size:12px;width:104px;text-align:center;color:#5eb086;text-transform:uppercase}._mainTitleWrap_4fb0s_1 ._mainTitle_4fb0s_1{font-size:12px;text-transform:uppercase}._topLine_4fb0s_18{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._slider-container_1y6nx_1{display:flex;align-items:center;text-align:center;margin-top:10px}._slider_1y6nx_1{width:100%;margin-right:10px}._infoContainer_1y6nx_13{display:flex;justify-content:space-between}._input-box_1y6nx_18{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1y6nx_18:focus{outline:none}._input-box_1y6nx_18::selection{background-color:#111f17;color:#5eb086}._dropArea_1a0z4_1{height:100vh;width:100vw;border:"2px dashed #aaa";background-size:cover;text-align:"center";display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:10000}._container_q73cc_1{display:flex;height:inherit;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6{width:100%;margin:auto;height:250px;max-width:350px;position:relative;text-align:center;z-index:1;display:flex;color:#f0f8ff;-webkit-user-select:none;user-select:none;align-items:center;flex-direction:column;justify-content:center}._container_q73cc_1 ._mintContainer_q73cc_6:before{top:0;left:0;right:0;bottom:0;content:"";z-index:-1;position:absolute;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,90% 100%,9% 100%);clip-path:polygon(0 0,100% 0,90% 100%,9% 100%)}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33{z-index:0;width:100px;color:#5eb086;font-size:24px;text-align:center;padding:8px 0;background:rgb(12,20,24);margin:-24px auto;position:relative}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33 ._mainTitle_q73cc_33{text-transform:uppercase}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49{width:100%;display:flex;margin-top:auto;margin-bottom:15px;align-items:center;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._mintButton_q73cc_49>div{padding:16px!important}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60{opacity:.4;margin-top:5px}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60 ._required_q73cc_64:after{content:"*";color:red}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._divider_q73cc_68{width:80%;height:1px;margin:8px 0;opacity:.2;background:#e0e6e5}._container_q73cc_1 ._bottomContainer_q73cc_75{z-index:0;display:flex;padding:20px 32px;justify-content:space-between}._container_q73cc_1 ._bottomContainer_q73cc_75 button{min-width:120px}._mintInfo_q73cc_85{height:15px;padding-bottom:25px;opacity:.5}._topLine_q73cc_91{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);top:0;left:0;width:100%;height:1px;position:absolute;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}._bottomLine_q73cc_104{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._inner-container_bgujb_1{z-index:1000000;opacity:.8;padding:16px;min-height:200px;font-size:.875rem;top:0;color:#fff}._bioContainer_bgujb_22{position:absolute;width:100%;max-width:50%;top:50%;right:32px;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:left;height:-webkit-calc(100vh - 266px);height:calc(100vh - 266px);background:rgba(5,11,14,.8);color:#f0f8ff}._scrollContainer_bgujb_37{height:98%;width:99%;position:absolute;left:0;top:2px;overflow-x:hidden;overflow-y:scroll}._topLine_bgujb_47{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._bottomLine_bgujb_69{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_bgujb_91{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_bgujb_91 ._buttonLeft_bgujb_100{float:left}._buttonContainer_bgujb_91 ._buttonRight_bgujb_104{float:Right}._buttonContainer_bgujb_91 ._buttonCenter_bgujb_108{margin:0 8px}._buttonContainer_bgujb_91:after{content:" ";display:block;clear:both}._buttonContainer_bgujb_91 button{min-width:120px}._container_bgujb_122{z-index:1000000;opacity:.8;position:absolute;width:100%;height:100%;min-height:200px;font-size:.875rem;top:0;color:#fff;box-sizing:border-box;padding:24px;text-align:left}._container_bgujb_122 *{outline:none!important}._button_bgujb_14{opacity:1}._buttonInactive_bgujb_18{opacity:.5}._input_bgujb_158{background-color:#193234;border:1px solid #C5DCD0;box-sizing:border-box;color:#fff;display:block;padding:8px;width:100%}._label_bgujb_168{color:#99abb2;display:block;margin-bottom:8px;width:100%}._section_bgujb_175{width:100%;margin-bottom:12px}._select_bgujb_180{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:8px;width:100%;margin-bottom:8px}._classdisabled_ecnty_1{pointer-events:none;opacity:.5}._container_ecnty_6{display:flex;height:inherit;justify-content:center;align-items:center;flex-direction:column}._classContainer_ecnty_14{text-align:center;background:rgba(5,11,14,.8);color:#f0f8ff;overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding:2em;display:flex;justify-content:center;align-items:center;z-index:10}._classContainer_ecnty_14 ._class_ecnty_1,._classContainer_ecnty_14 ._classdisabled_ecnty_1{flex:1;display:flex;cursor:pointer;width:15em;flex-direction:column;margin:24px 8px 8px;align-items:center;justify-content:center}._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-4vh}@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-1.5vh}}@media only screen and (min-device-width: 0) and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-1vh}}._classContainer_ecnty_14 ._icon_ecnty_40 img{background:#000;width:100%;height:auto;max-width:3em}._classContainer_ecnty_14 ._name_ecnty_71{font-size:1.5em;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;margin-top:1vh}._classContainer_ecnty_14 ._description_ecnty_80{font-size:1em;flex:1}._classContainer_ecnty_14 ._classFrame_ecnty_85{flex:1;width:100%;display:flex;align-items:center;justify-content:center;position:relative;z-index:0;overflow:hidden;background-size:contain;background-position:center;background-repeat:no-repeat;mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-image:url(./assets/backgrounds/class-mask.svg);-webkit-mask-image:url(./assets/backgrounds/class-mask.svg)}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._frameContainer_ecnty_107{width:100%;flex:1}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._frame_ecnty_107{width:100%;height:auto}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._image_ecnty_117{width:100%;height:auto;max-width:230px}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._lockedContainer_ecnty_123{position:absolute}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._locked_ecnty_123{width:100%;height:auto;max-width:2vw}._classContainer_ecnty_14 ._class_ecnty_1:hover ._name_ecnty_71{color:#fcc000}._buttonContainer_ecnty_137{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_ecnty_137 ._buttonLeft_ecnty_146{float:left}._buttonContainer_ecnty_137 ._buttonRight_ecnty_150{float:Right}._buttonContainer_ecnty_137 ._buttonCenter_ecnty_154{margin:0 8px}._buttonContainer_ecnty_137:after{content:" ";display:block;clear:both}._buttonContainer_ecnty_137 button{min-width:120px}._topLine_ecnty_168,._bottomLine_ecnty_194{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);width:100%;height:1px;z-index:10}._buttonContainer_1ueuk_1{position:absolute;left:0;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);top:50%;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:320px}._buttonContainer_1ueuk_1 ._button_1ueuk_1{background:none!important;border:none!important;cursor:pointer;margin:0 32px;height:320px;width:126px;position:relative}._buttonContainer_1ueuk_1 ._button_1ueuk_1 img{height:100%;transition:all .3s ease-in-out;position:absolute;left:0;top:0}._buttonContainer_1ueuk_1 ._button_1ueuk_1:hover img{top:-8px}._buttonContainer_19n2w_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_19n2w_1 ._buttonLeft_19n2w_10{float:left}._buttonContainer_19n2w_1 ._buttonRight_19n2w_14{float:Right}._buttonContainer_19n2w_1 ._buttonCenter_19n2w_18{margin:0 8px}._buttonContainer_19n2w_1:after{content:" ";display:block;clear:both}._buttonContainer_19n2w_1 button{min-width:120px}._sideMenu_19n2w_33{position:fixed;left:32px;top:98px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_19n2w_44{width:90%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 40px)}._scrollContainerOptions_19n2w_52{width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 100px)}._bottomLine_19n2w_60{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._editor-container_19n2w_87{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._editorButton_19n2w_94{padding:.15em;display:flex;position:relative;align-items:center;gap:10px;cursor:pointer}._editorText_19n2w_102{color:#fff;text-transform:capitalize;max-width:100px;white-space:normal;word-wrap:break-word;text-align:left}._selectorContainerPos_19n2w_112{position:absolute;top:98px;left:280px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000}._selector-container_19n2w_123{-webkit-user-select:none;user-select:none;flex:1;width:140px;position:relative}._selectorButton_19n2w_129{padding:.25em;display:block;position:relative;opacity:1;float:left;width:62px;text-align:center}._selectorColorPickerUI_19n2w_138{position:absolute;right:-30px;width:30px;top:55px}._selectorColorPickerButton_19n2w_144{-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);width:40px;height:40px;position:absolute;right:-40px;top:15px;display:flex;align-items:center;border-radius:0 8px 8px 0;cursor:pointer}._selectorColorPickerImg_19n2w_157{width:20px;height:20px;position:relative;margin:auto}._uploadContainer_19n2w_163{text-align:center;width:80%;position:relative;margin:16px 10px 16px 16px;padding-right:6px;height:40px;display:flex;align-items:center;justify-content:center}._uploadButton_19n2w_176{margin:auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._ContainerPosition_ss7yg_2{padding:0;margin:0 0 20px;width:300px;height:80px;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._Container_ss7yg_2{display:flex;min-height:100vh;margin:0;align-items:flex-end;justify-content:center}._arrow-button_ss7yg_23{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_ss7yg_39{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_ss7yg_46{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._topLine_ss7yg_52{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._traitInfoTitle_ss7yg_80{color:#fff;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_ss7yg_89{display:flex;justify-content:space-between;width:95%;height:40px;margin:5px auto;align-items:center}._flexButtons_ss7yg_98{display:flex;justify-content:space-between;width:100px;height:25px;margin:0 auto;align-items:center}._optionButtons_ss7yg_106{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px;text-align:center;align-items:center;background-color:#1e2530}._optionButtons_ss7yg_106 img{width:80%;height:80%}._InformationContainerPos_198k1_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_198k1_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_198k1_26{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_198k1_34{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_198k1_42{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_198k1_42:focus{outline:none}._input-box_198k1_42::selection{background-color:#111f17;color:#5eb086}._flexSelect_198k1_61{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_198k1_69{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_198k1_85{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_198k1_92{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_198k1_99:hover{opacity:1}._custom-checkbox_198k1_104 input[type=checkbox]{display:none}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109._checked_198k1_118{background-color:#5eb086}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109 ._checkmark_198k1_122{display:none}._custom-checkbox_198k1_104 input[type=checkbox]:checked+._checkbox-container_198k1_109{background-color:#5eb086}._custom-checkbox_198k1_104 input[type=checkbox]:checked+._checkbox-container_198k1_109 ._checkmark_198k1_122{display:block}._checkboxHolder_198k1_135{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._actionButton_198k1_144{margin:30px auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tokenBoxWrap_q4pvo_1{position:relative!important;cursor:pointer;display:inline-block}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7{width:91%;height:80%;overflow:hidden;-webkit-mask-image:url(./assets/backgrounds/token-frame-empty.svg);mask-image:url(./assets/backgrounds/token-frame-empty.svg);-webkit-mask-size:100%;mask-size:100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;z-index:0}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7 canvas{width:100%!important;height:100%!important}._tokenBoxWrap_q4pvo_1 ._timer_q4pvo_31{color:#fff;position:absolute;width:100%;text-align:center;bottom:2px;left:0;font-size:9px;font-family:TTSC-Bold}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42{position:absolute;bottom:-6px;width:30px;background-color:#303746;padding:0;font-family:TTSC-Bold;color:#ededed;text-align:center;font-size:10px;left:9px}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._mythic_q4pvo_55{background-color:#ffb65d;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._epic_q4pvo_60{background-color:#a885f0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._rare_q4pvo_65{background-color:#3b9de3;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._uncommon_q4pvo_70{background-color:#04e2b9;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._common_q4pvo_75{background-color:#c5dcd0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._none_q4pvo_80{background-color:#303746;color:#ededed}._tokenBoxWrap_q4pvo_1 ._value_q4pvo_85{position:absolute;top:0;left:0;padding:2px 4px;background-color:#091218;color:#efefef;font-size:7px}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95{background-size:100%;background-position:center;background-repeat:no-repeat;height:100%;width:100%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;display:block;background-image:url(./assets/backgrounds/token-box-none.svg)}._tokenBoxWrap_q4pvo_1 ._emptyIcon_q4pvo_111{position:absolute;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);height:100%;max-width:60%;max-height:60%}._tokenBoxWrap_q4pvo_1 ._badge_q4pvo_123{width:20%;top:4px;right:1px;position:absolute}._tokenBoxWrap_q4pvo_1 ._frameActive_q4pvo_131{background-image:url(./assets/backgrounds/token-box-uncommon.svg);height:116%;width:116%;top:50%!important}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._mythic_q4pvo_55{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._epic_q4pvo_60{background-image:url(./assets/backgrounds/token-box-epic.svg);z-index:1}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._rare_q4pvo_65{background-image:url(./assets/backgrounds/token-box-rare.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._uncommon_q4pvo_70{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._common_q4pvo_75{background-image:url(./assets/backgrounds/token-box-common.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._default_q4pvo_159{background-image:url(./assets/backgrounds/token-box-none.svg)}._InformationContainerPos_72ckd_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_72ckd_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px);padding-top:5px}._traitInfoTitle_72ckd_27{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_72ckd_35{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_72ckd_43{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_72ckd_43:focus{outline:none}._input-box_72ckd_43::selection{background-color:#111f17;color:#5eb086}._flexSelect_72ckd_62{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_72ckd_70{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_72ckd_86{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_72ckd_93{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_72ckd_100:hover{opacity:1}._custom-checkbox_72ckd_105 input[type=checkbox]{display:none}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110._checked_72ckd_119{background-color:#5eb086}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:none}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110{background-color:#5eb086}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:block}._checkboxHolder_72ckd_136{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_rgqwy_1{position:fixed;left:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_rgqwy_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_rgqwy_21{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_rgqwy_30{display:flex;justify-content:space-between;width:90%;height:40px;align-items:center}._arrow-button_rgqwy_37{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_rgqwy_51{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_rgqwy_58{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_rgqwy_65{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_rgqwy_76 input[type=checkbox]{display:none}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81._checked_rgqwy_90{background-color:#5eb086}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:none}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81{background-color:#5eb086}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:block}._checkboxHolder_rgqwy_107{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._buttonContainer_rgqwy_114{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_rgqwy_114 ._buttonLeft_rgqwy_123{float:left}._buttonContainer_rgqwy_114 ._buttonRight_rgqwy_127{float:Right}._buttonContainer_rgqwy_114 ._buttonCenter_rgqwy_131{margin:0 8px}._buttonContainer_rgqwy_114:after{content:" ";display:block;clear:both}._buttonContainer_rgqwy_114 button{min-width:120px}._InformationContainerPos_1cryw_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;text-align:right}._scrollContainer_1cryw_16{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_1cryw_28{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:right}._traitInfoText_1cryw_38{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px;text-align:right}._input-box_1cryw_47{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1cryw_47:focus{outline:none}._input-box_1cryw_47::selection{background-color:#111f17;color:#5eb086}._flexSelect_1cryw_66{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1cryw_74{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1cryw_90{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1cryw_97{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_1cryw_104:hover{opacity:1}._custom-checkbox_1cryw_109 input[type=checkbox]{display:none}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114._checked_1cryw_123{background-color:#5eb086}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114 ._checkmark_1cryw_127{display:none}._custom-checkbox_1cryw_109 input[type=checkbox]:checked+._checkbox-container_1cryw_114{background-color:#5eb086}._custom-checkbox_1cryw_109 input[type=checkbox]:checked+._checkbox-container_1cryw_114 ._checkmark_1cryw_127{display:block}._checkboxHolder_1cryw_140{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._languageSwitchWrap_83v6a_1{position:absolute;z-index:10000000;top:26px;right:32px;color:#fff}._languageSwitchWrap_83v6a_1 select{background:none!important;color:#fff;border:none;font-size:16px;padding-right:8px;box-shadow:0 5px 25px #0003;-webkit-appearance:button;-moz-appearance:button;appearance:button;outline:none;text-align:right} diff --git a/assets/index-6f33b33f.css b/assets/index-6f33b33f.css new file mode 100644 index 00000000..4b753b3a --- /dev/null +++ b/assets/index-6f33b33f.css @@ -0,0 +1 @@ +@font-face{font-family:TTSC-Black-Italic;src:url("/CharacterStudio/assets/TT Squares Condensed Black Italic-5672aa6e.otf")}@font-face{font-family:TTSC-Black;src:url("/CharacterStudio/assets/TT Squares Condensed Black-221a58ab.otf")}@font-face{font-family:TTSC-Bold-Italic;src:url("/CharacterStudio/assets/TT Squares Condensed Bold Italic-906bdd16.otf")}@font-face{font-family:TTSC-Bold;src:url("/CharacterStudio/assets/TT Squares Condensed Bold-7edd675d.otf")}@font-face{font-family:TTSC-Light-Italic;src:url("/CharacterStudio/assets/TT Squares Condensed Light Italic-da726055.otf")}@font-face{font-family:TTSC-Light;src:url("/CharacterStudio/assets/TT Squares Condensed Light-cc406c21.otf")}@font-face{font-family:TTSC-Regular-Italic;src:url("/CharacterStudio/assets/TT Squares Condensed Regular Italic-e5fdfada.otf")}@font-face{font-family:TTSC-Regular;src:url("/CharacterStudio/assets/TT Squares Condensed Regular-9a6ac9aa.otf")}@font-face{font-family:TTSC-Thin-Italic;src:url("/CharacterStudio/assets/TT Squares Condensed Thin italic-550453e0.otf")}@font-face{font-family:TTSC-Thin;src:url("/CharacterStudio/assets/TT Squares Condensed Thin-1f34237c.otf")}html,body{margin:0;padding:0;height:100%;font-family:TTSC-Regular}#root{height:100%;overflow:hidden}::-webkit-scrollbar{width:.1em}::-webkit-scrollbar-track{box-shadow:transparent}::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.horizontalScroll ::-webkit-scrollbar{height:.1em}.horizontalScroll ::-webkit-scrollbar-track{box-shadow:transparent}.horizontalScroll ::-webkit-scrollbar-thumb{background:rgb(0,149,100);background:-moz-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(180deg,rgba(0,149,100,0) 0%,rgba(8,234,160,.6) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}.root{overflow:hidden;margin:0;padding:0}#editor-scene{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.loadingIndicator{display:none;pointer-events:none;position:absolute;left:0;right:0;top:0;bottom:0;width:80px;height:80px;margin:auto;border-radius:10px;filter:drop-shadow(1px 1px 2px black)}.loadingIndicator.active{display:block}.loadingIndicator>img{position:absolute;left:0;right:0;top:0;bottom:0;width:65%;height:65%;margin:auto}.rotate{animation:rotate 2.2s linear infinite}.sectionTitle{position:absolute;top:34px;left:32px;color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px}.generalTitle{position:absolute;top:16px;left:32px;color:#fff;opacity:.7;font-size:12px;padding:0;text-shadow:1px 1px 2px black;text-transform:uppercase}@keyframes rotate{to{transform:rotate(360deg)}}._container_1fjfz_1{width:100vw;height:100vh;margin:auto;position:absolute;display:flex;justify-content:center;align-items:center}._messageWindow_1fjfz_11{width:500px;height:150px;margin:auto;display:flex;padding:0 0 10px;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);clip-path:polygon(0 0,100% 0,95% 100%,4% 100%);justify-content:space-around;align-items:center;flex-direction:column}._messageTitle_1fjfz_25{font-family:TTSC-Bold;font-weight:800;text-transform:uppercase!important;line-height:106%;color:#5eb086;height:40px;display:flex;align-items:center}._buttonContainer_1fjfz_36{width:100%;display:flex;height:40px;justify-content:space-around;-webkit-user-select:none;user-select:none}._iconButtonWrap_1fm7l_1{display:inline-block;position:relative;z-index:1;cursor:pointer}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8{height:100%;width:auto!important}._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16,._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._buttonBackgroundColor_1fm7l_13{fill:#eaf4ef}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._buttonBackground_1fm7l_8 ._innerBackgroundColor_1fm7l_16{fill:#000}._iconButtonWrap_1fm7l_1 ._iconWrap_1fm7l_28{display:block;position:absolute;left:0;top:0;z-index:1;height:100%;width:100%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1{top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;height:46%!important;max-width:46%}._iconButtonWrap_1fm7l_1 ._icon_1fm7l_1 *{fill:#000}._iconButtonWrap_1fm7l_1._dark_1fm7l_20 ._icon_1fm7l_1 *{fill:#fff}._iconButtonWrap_1fm7l_1:hover ._buttonBackgroundColor_1fm7l_13{fill:#ffc000!important;stroke:#000!important}._iconButtonWrap_1fm7l_1:hover ._innerBackgroundColor_1fm7l_16{fill:#ffc000!important}._iconButtonWrap_1fm7l_1:hover ._icon_1fm7l_1 *{fill:#eaf4ef!important}._iconButtonWrap_1fm7l_1:active ._buttonBackgroundColor_1fm7l_13{fill:#fdc503!important}._iconButtonWrap_1fm7l_1:active ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1:active ._icon_1fm7l_1 *{fill:#fdc503}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._buttonBackgroundColor_1fm7l_13,._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._innerBackgroundColor_1fm7l_16{fill:#000!important}._iconButtonWrap_1fm7l_1._active_1fm7l_83 ._icon_1fm7l_1 *{fill:#fdc503}._buttonWrap_1fm7l_95{border:1px solid #000000;background:#000000;padding:0;margin:0;display:inline-block;cursor:pointer}._buttonWrap_1fm7l_95 ._icon_1fm7l_1{top:40%!important}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108{vertical-align:middle;size:inherit;margin-right:18px;position:relative;display:inline-block}._buttonWrap_1fm7l_95 ._buttonIconWrap_1fm7l_108 svg{width:auto;height:120%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute}._buttonWrap_1fm7l_95 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;font-weight:800;background:#FFFFFF;color:#000;padding:8px 14px 6px!important;text-transform:uppercase!important;line-height:106%}._buttonWrap_1fm7l_95:disabled ._innerWrap_1fm7l_127{color:#7e7e7e}._buttonWrap_1fm7l_95._dark_1fm7l_20 ._innerWrap_1fm7l_127{border:1px solid #FFFFFF;font-family:TTSC-Bold;background:#000000;color:#fff;text-transform:uppercase!important;padding:8px 14px 6px!important}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#FFC000;color:#efefef}._buttonWrap_1fm7l_95:hover:enabled ._innerWrap_1fm7l_127 *{fill:#efefef!important}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127{border:1px solid #FFC000;font-family:TTSC-Bold;background:#000000;color:#ffc000}._buttonWrap_1fm7l_95:active:enabled ._innerWrap_1fm7l_127 *{fill:#ffc000!important}._backgroundImg_iv22q_1{background-image:url(./assets/backgrounds/background4.jpg);background-attachment:fixed;background-repeat:no-repeat;background-position:center center;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._darkBackground_iv22q_16{background-color:#1e2530;height:100vh;width:100vw;background-size:cover;display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:-100}._Background_iv22q_29{background:url(./assets/backgrounds/background4.jpg);background-position:center;background-repeat:no-repeat;background-size:cover;overflow:hidden}._webamark_iv22q_37{position:absolute;left:0;top:0;width:100vw;height:100vh}._logo_iv22q_45{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:auto;height:100vh;opacity:.3}._chatContainer_1659d_1{position:absolute;width:100%;max-width:50%;top:50%;right:32px;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:-webkit-calc(100vh - 266px);height:calc(100vh - 266px);background:rgba(5,11,14,.8);color:#f0f8ff}._scrollContainer_1659d_16{height:98%;width:99%;position:absolute;left:0;top:2px;overflow-x:hidden;overflow-y:scroll}._topLine_1659d_26{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._bottomLine_1659d_54{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_1659d_82{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1659d_82 ._buttonLeft_1659d_91{float:left}._buttonContainer_1659d_82 ._buttonRight_1659d_95{float:Right}._buttonContainer_1659d_82 ._buttonCenter_1659d_99{margin:0 8px}._buttonContainer_1659d_82:after{content:" ";display:block;clear:both}._buttonContainer_1659d_82 button{min-width:120px}._chatBox_1fp89_1{width:100%;height:100%;font-size:.875rem;color:#fff;text-align:left;box-sizing:border-box;padding:24px}._chatBox_1fp89_1 *{outline:none!important}._chatBox_1fp89_1>label,._chatBox_1fp89_1>span>label{display:block;width:100%;color:#99abb2;margin-bottom:8px}._chatBox_1fp89_1>input,._chatBox_1fp89_1>span>input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;display:block}._chatBox_1fp89_1>textarea{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:calc(100% - 1em);display:block}._chatBox_1fp89_1>select{background-color:#000;color:#fff;border-radius:5px;border:1px solid #fff;margin:.5em;padding:.5em;width:calc(100% - 1em)}._messages_1fp89_50{display:flex;flex-direction:column;height:100%;height:180px;overflow:auto;margin-bottom:20px;background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:16px 8px 16px 16px;box-sizing:border-box;width:100%;height:calc(100% - 142px);height:-webkit-calc(100% - 142px)}._messages_1fp89_50 ._scrollBox_1fp89_67{overflow-y:scroll;overflow-x:hidden;height:100%;width:100%;padding-right:8px;box-sizing:border-box;padding-top:14px}._send_1fp89_78 input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:calc(100% - 214px);margin-left:10px;margin-right:8px;height:18px;display:inline-block}._mic_1fp89_90{vertical-align:middle}._sendButton_1fp89_94{vertical-align:bottom;float:right;width:140px}._speaker_1fp89_100{width:100%}._speaker_1fp89_100>label{display:block;color:#99abb2;margin-bottom:8px}._speaker_1fp89_100 input{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:.5em;width:100%;height:100%;box-sizing:border-box;margin-bottom:8px}._warning_1fp89_121{display:inline-block;position:absolute;right:24px;top:9px;font-size:14px;color:#deb887}._isTyping_1fp89_130{padding:0;margin:4px 0 0 45px;display:none}._isTyping_1fp89_130._show_1fp89_136{display:inline-block}._message_1mjdp_1 ._chat-bubble_1mjdp_1{display:inline-block;padding:8px 12px;max-width:60%;border-radius:4px;background:rgba(255,255,255,.05);box-shadow:0 1px 1px #0006;position:relative;margin-bottom:8px;font-size:16px}._message_1mjdp_1 ._chat-bubble_1mjdp_1 ._colorBg_1mjdp_13{background:#aaa;position:absolute;left:0;top:0;width:100%;height:100%;opacity:.2;border-radius:4px}._message_1mjdp_1 ._name_1mjdp_24{margin-bottom:8px;padding-left:4px;margin-top:-16px;font-size:14px}._message_1mjdp_1 span{font-size:10px;margin-left:4px;margin-right:4px;display:inline-block;color:#fff6}._speaker_1mjdp_39{text-align:right}._buttonContainer_1fd4o_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_1fd4o_1 ._buttonLeft_1fd4o_10{float:left}._buttonContainer_1fd4o_1 ._buttonRight_1fd4o_14{float:Right}._buttonContainer_1fd4o_1 ._buttonCenter_1fd4o_18{margin:0 8px}._buttonContainer_1fd4o_1:after{content:" ";display:block;clear:both}._buttonContainer_1fd4o_1 button{min-width:120px}._button_13dfi_1{margin:0 8px}._InformationContainerPos_1a3zv_1{position:fixed;left:32px;top:98px;width:300px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_1a3zv_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:center}._traitInfoText_1a3zv_22{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;display:flex;justify-content:center}._flexSelect_1a3zv_33{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1a3zv_40{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1a3zv_54{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1a3zv_61{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_1a3zv_68{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_1a3zv_79 input[type=checkbox]{display:none}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84._checked_1a3zv_93{background-color:#5eb086}._custom-checkbox_1a3zv_79 ._checkbox-container_1a3zv_84 ._checkmark_1a3zv_97{display:none}._custom-checkbox_1a3zv_79 input[type=checkbox]:checked+._checkbox-container_1a3zv_84{background-color:#5eb086}._custom-checkbox_1a3zv_79 input[type=checkbox]:checked+._checkbox-container_1a3zv_84 ._checkmark_1a3zv_97{display:block}._checkboxHolder_1a3zv_110{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._mainTitleWrap_4fb0s_1{background:rgba(5,11,14,.8);position:absolute;top:-28px;padding:8px 0 6px;font-size:12px;width:104px;text-align:center;color:#5eb086;text-transform:uppercase}._mainTitleWrap_4fb0s_1 ._mainTitle_4fb0s_1{font-size:12px;text-transform:uppercase}._topLine_4fb0s_18{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._slider-container_1y6nx_1{display:flex;align-items:center;text-align:center;margin-top:10px}._slider_1y6nx_1{width:100%;margin-right:10px}._infoContainer_1y6nx_13{display:flex;justify-content:space-between}._input-box_1y6nx_18{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1y6nx_18:focus{outline:none}._input-box_1y6nx_18::selection{background-color:#111f17;color:#5eb086}._dropArea_1a0z4_1{height:100vh;width:100vw;border:"2px dashed #aaa";background-size:cover;text-align:"center";display:fixed;flex-direction:column;align-items:center;overflow:hidden;position:absolute;z-index:10000}._container_q73cc_1{display:flex;height:inherit;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6{width:100%;margin:auto;height:250px;max-width:350px;position:relative;text-align:center;z-index:1;display:flex;color:#f0f8ff;-webkit-user-select:none;user-select:none;align-items:center;flex-direction:column;justify-content:center}._container_q73cc_1 ._mintContainer_q73cc_6:before{top:0;left:0;right:0;bottom:0;content:"";z-index:-1;position:absolute;background:rgb(4,17,22);-webkit-clip-path:polygon(0 0,100% 0,90% 100%,9% 100%);clip-path:polygon(0 0,100% 0,90% 100%,9% 100%)}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33{z-index:0;width:100px;color:#5eb086;font-size:24px;text-align:center;padding:8px 0;background:rgb(12,20,24);margin:-24px auto;position:relative}._container_q73cc_1 ._mintContainer_q73cc_6 ._mainTitleWrap_q73cc_33 ._mainTitle_q73cc_33{text-transform:uppercase}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49{width:100%;display:flex;margin-top:auto;margin-bottom:15px;align-items:center;flex-direction:column}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._mintButton_q73cc_49>div{padding:16px!important}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60{opacity:.4;margin-top:5px}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._genesisText_q73cc_60 ._required_q73cc_64:after{content:"*";color:red}._container_q73cc_1 ._mintContainer_q73cc_6 ._mintButtonContainer_q73cc_49 ._divider_q73cc_68{width:80%;height:1px;margin:8px 0;opacity:.2;background:#e0e6e5}._container_q73cc_1 ._bottomContainer_q73cc_75{z-index:0;display:flex;padding:20px 32px;justify-content:space-between}._container_q73cc_1 ._bottomContainer_q73cc_75 button{min-width:120px}._mintInfo_q73cc_85{height:15px;padding-bottom:25px;opacity:.5}._topLine_q73cc_91{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);top:0;left:0;width:100%;height:1px;position:absolute;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1)}._bottomLine_q73cc_104{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgb(8,234,160) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._inner-container_bgujb_1{z-index:1000000;opacity:.8;padding:16px;min-height:200px;font-size:.875rem;top:0;color:#fff}._bioContainer_bgujb_22{position:absolute;width:100%;max-width:50%;top:50%;right:32px;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:left;height:-webkit-calc(100vh - 266px);height:calc(100vh - 266px);background:rgba(5,11,14,.8);color:#f0f8ff}._scrollContainer_bgujb_37{height:98%;width:99%;position:absolute;left:0;top:2px;overflow-x:hidden;overflow-y:scroll}._topLine_bgujb_47{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._bottomLine_bgujb_69{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._buttonContainer_bgujb_91{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_bgujb_91 ._buttonLeft_bgujb_100{float:left}._buttonContainer_bgujb_91 ._buttonRight_bgujb_104{float:Right}._buttonContainer_bgujb_91 ._buttonCenter_bgujb_108{margin:0 8px}._buttonContainer_bgujb_91:after{content:" ";display:block;clear:both}._buttonContainer_bgujb_91 button{min-width:120px}._container_bgujb_122{z-index:1000000;opacity:.8;position:absolute;width:100%;height:100%;min-height:200px;font-size:.875rem;top:0;color:#fff;box-sizing:border-box;padding:24px;text-align:left}._container_bgujb_122 *{outline:none!important}._button_bgujb_14{opacity:1}._buttonInactive_bgujb_18{opacity:.5}._input_bgujb_158{background-color:#193234;border:1px solid #C5DCD0;box-sizing:border-box;color:#fff;display:block;padding:8px;width:100%}._label_bgujb_168{color:#99abb2;display:block;margin-bottom:8px;width:100%}._section_bgujb_175{width:100%;margin-bottom:12px}._select_bgujb_180{background-color:#193234;color:#fff;border:1px solid #C5DCD0;padding:8px;width:100%;margin-bottom:8px}._classdisabled_ecnty_1{pointer-events:none;opacity:.5}._container_ecnty_6{display:flex;height:inherit;justify-content:center;align-items:center;flex-direction:column}._classContainer_ecnty_14{text-align:center;background:rgba(5,11,14,.8);color:#f0f8ff;overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding:2em;display:flex;justify-content:center;align-items:center;z-index:10}._classContainer_ecnty_14 ._class_ecnty_1,._classContainer_ecnty_14 ._classdisabled_ecnty_1{flex:1;display:flex;cursor:pointer;width:15em;flex-direction:column;margin:24px 8px 8px;align-items:center;justify-content:center}._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-4vh}@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-1.5vh}}@media only screen and (min-device-width: 0) and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2){._classContainer_ecnty_14 ._icon_ecnty_40{flex:1;z-index:2;margin-top:-1vh}}._classContainer_ecnty_14 ._icon_ecnty_40 img{background:#000;width:100%;height:auto;max-width:3em}._classContainer_ecnty_14 ._name_ecnty_71{font-size:1.5em;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;margin-top:1vh}._classContainer_ecnty_14 ._description_ecnty_80{font-size:1em;flex:1}._classContainer_ecnty_14 ._classFrame_ecnty_85{flex:1;width:100%;display:flex;align-items:center;justify-content:center;position:relative;z-index:0;overflow:hidden;background-size:contain;background-position:center;background-repeat:no-repeat;mask-size:100%;-webkit-mask-size:100%;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-image:url(./assets/backgrounds/class-mask.svg);-webkit-mask-image:url(./assets/backgrounds/class-mask.svg)}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._frameContainer_ecnty_107{width:100%;flex:1}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._frame_ecnty_107{width:100%;height:auto}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._image_ecnty_117{width:100%;height:auto;max-width:230px}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._lockedContainer_ecnty_123{position:absolute}._classContainer_ecnty_14 ._classFrame_ecnty_85 ._locked_ecnty_123{width:100%;height:auto;max-width:2vw}._classContainer_ecnty_14 ._class_ecnty_1:hover ._name_ecnty_71{color:#fcc000}._buttonContainer_ecnty_137{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_ecnty_137 ._buttonLeft_ecnty_146{float:left}._buttonContainer_ecnty_137 ._buttonRight_ecnty_150{float:Right}._buttonContainer_ecnty_137 ._buttonCenter_ecnty_154{margin:0 8px}._buttonContainer_ecnty_137:after{content:" ";display:block;clear:both}._buttonContainer_ecnty_137 button{min-width:120px}._topLine_ecnty_168,._bottomLine_ecnty_194{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);width:100%;height:1px;z-index:10}._buttonContainer_1ueuk_1{position:absolute;left:0;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);top:50%;transform:translateY(-50%);-webkit-transform:translateY(-50%);text-align:center;height:320px}._buttonContainer_1ueuk_1 ._button_1ueuk_1{background:none!important;border:none!important;cursor:pointer;margin:0 32px;height:320px;width:126px;position:relative}._buttonContainer_1ueuk_1 ._button_1ueuk_1 img{height:100%;transition:all .3s ease-in-out;position:absolute;left:0;top:0}._buttonContainer_1ueuk_1 ._button_1ueuk_1:hover img{top:-8px}._buttonContainer_19n2w_1{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_19n2w_1 ._buttonLeft_19n2w_10{float:left}._buttonContainer_19n2w_1 ._buttonRight_19n2w_14{float:Right}._buttonContainer_19n2w_1 ._buttonCenter_19n2w_18{margin:0 8px}._buttonContainer_19n2w_1:after{content:" ";display:block;clear:both}._buttonContainer_19n2w_1 button{min-width:120px}._sideMenu_19n2w_33{position:fixed;left:32px;top:98px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_19n2w_44{width:90%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 40px)}._scrollContainerOptions_19n2w_52{width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:16px;height:calc(100% - 100px)}._bottomLine_19n2w_60{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;bottom:0;left:0;width:100%;height:1px}._editor-container_19n2w_87{-webkit-user-select:none;user-select:none;flex:1;width:200px;position:relative;text-align:center}._editorButton_19n2w_94{padding:.15em;display:flex;position:relative;align-items:center;gap:10px;cursor:pointer}._editorText_19n2w_102{color:#fff;text-transform:capitalize;max-width:100px;white-space:normal;word-wrap:break-word;text-align:left}._selectorContainerPos_19n2w_112{position:absolute;top:98px;left:280px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000}._selector-container_19n2w_123{-webkit-user-select:none;user-select:none;flex:1;width:140px;position:relative}._selectorButton_19n2w_129{padding:.25em;display:block;position:relative;opacity:1;float:left;width:62px;text-align:center}._selectorColorPickerUI_19n2w_138{position:absolute;right:-30px;width:30px;top:55px}._selectorColorPickerButton_19n2w_144{-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);width:40px;height:40px;position:absolute;right:-40px;top:15px;display:flex;align-items:center;border-radius:0 8px 8px 0;cursor:pointer}._selectorColorPickerImg_19n2w_157{width:20px;height:20px;position:relative;margin:auto}._uploadContainer_19n2w_163{text-align:center;width:80%;position:relative;margin:16px 10px 16px 16px;padding-right:6px;height:40px;display:flex;align-items:center;justify-content:center}._uploadButton_19n2w_176{margin:auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._ContainerPosition_ss7yg_2{padding:0;margin:0 0 20px;width:300px;height:80px;-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._Container_ss7yg_2{display:flex;min-height:100vh;margin:0;align-items:flex-end;justify-content:center}._arrow-button_ss7yg_23{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_ss7yg_39{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_ss7yg_46{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._topLine_ss7yg_52{background:rgb(0,149,100);background:-moz-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:-webkit-linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);background:linear-gradient(90deg,rgba(0,149,100,0) 0%,rgba(8,234,160,1) 50%,rgba(0,149,100,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endColorstr="#009564",GradientType=1);position:absolute;top:0;left:0;width:100%;height:1px}._traitInfoTitle_ss7yg_80{color:#fff;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_ss7yg_89{display:flex;justify-content:space-between;width:95%;height:40px;margin:5px auto;align-items:center}._flexButtons_ss7yg_98{display:flex;justify-content:space-between;width:100px;height:25px;margin:0 auto;align-items:center}._optionButtons_ss7yg_106{cursor:pointer;overflow:hidden;opacity:.8;width:25px;height:25px;margin:2px;text-align:center;align-items:center;background-color:#1e2530}._optionButtons_ss7yg_106 img{width:80%;height:80%}._InformationContainerPos_198k1_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_198k1_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_198k1_26{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_198k1_34{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_198k1_42{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_198k1_42:focus{outline:none}._input-box_198k1_42::selection{background-color:#111f17;color:#5eb086}._flexSelect_198k1_61{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_198k1_69{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_198k1_85{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_198k1_92{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_198k1_99:hover{opacity:1}._custom-checkbox_198k1_104 input[type=checkbox]{display:none}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109._checked_198k1_118{background-color:#5eb086}._custom-checkbox_198k1_104 ._checkbox-container_198k1_109 ._checkmark_198k1_122{display:none}._custom-checkbox_198k1_104 input[type=checkbox]:checked+._checkbox-container_198k1_109{background-color:#5eb086}._custom-checkbox_198k1_104 input[type=checkbox]:checked+._checkbox-container_198k1_109 ._checkmark_198k1_122{display:block}._checkboxHolder_198k1_135{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._actionButton_198k1_144{margin:30px auto;text-align:center;outline-color:#3b434f;color:#d1d7df;outline-width:2px;outline-style:solid;background-color:#1e2530;height:30px;width:80%;font-family:TTSC-Bold;text-transform:uppercase!important;font-size:x-small;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;cursor:pointer}._tokenBoxWrap_q4pvo_1{position:relative!important;cursor:pointer;display:inline-block}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7{width:91%;height:80%;overflow:hidden;-webkit-mask-image:url(./assets/backgrounds/token-frame-empty.svg);mask-image:url(./assets/backgrounds/token-frame-empty.svg);-webkit-mask-size:100%;mask-size:100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;z-index:0}._tokenBoxWrap_q4pvo_1 ._mask_q4pvo_7 canvas{width:100%!important;height:100%!important}._tokenBoxWrap_q4pvo_1 ._timer_q4pvo_31{color:#fff;position:absolute;width:100%;text-align:center;bottom:2px;left:0;font-size:9px;font-family:TTSC-Bold}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42{position:absolute;bottom:-6px;width:30px;background-color:#303746;padding:0;font-family:TTSC-Bold;color:#ededed;text-align:center;font-size:10px;left:9px}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._mythic_q4pvo_55{background-color:#ffb65d;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._epic_q4pvo_60{background-color:#a885f0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._rare_q4pvo_65{background-color:#3b9de3;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._uncommon_q4pvo_70{background-color:#04e2b9;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._common_q4pvo_75{background-color:#c5dcd0;color:#000}._tokenBoxWrap_q4pvo_1 ._level_q4pvo_42._none_q4pvo_80{background-color:#303746;color:#ededed}._tokenBoxWrap_q4pvo_1 ._value_q4pvo_85{position:absolute;top:0;left:0;padding:2px 4px;background-color:#091218;color:#efefef;font-size:7px}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95{background-size:100%;background-position:center;background-repeat:no-repeat;height:100%;width:100%;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);position:absolute;display:block;background-image:url(./assets/backgrounds/token-box-none.svg)}._tokenBoxWrap_q4pvo_1 ._emptyIcon_q4pvo_111{position:absolute;top:50%;left:50%;-ms-transform:translateX(-50%) translateY(-50%);-webkit-transform:translateX(-50%) translateY(-50%);transform:translate(-50%) translateY(-50%);height:100%;max-width:60%;max-height:60%}._tokenBoxWrap_q4pvo_1 ._badge_q4pvo_123{width:20%;top:4px;right:1px;position:absolute}._tokenBoxWrap_q4pvo_1 ._frameActive_q4pvo_131{background-image:url(./assets/backgrounds/token-box-uncommon.svg);height:116%;width:116%;top:50%!important}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._mythic_q4pvo_55{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._epic_q4pvo_60{background-image:url(./assets/backgrounds/token-box-epic.svg);z-index:1}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._rare_q4pvo_65{background-image:url(./assets/backgrounds/token-box-rare.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._uncommon_q4pvo_70{background-image:url(./assets/backgrounds/token-box-uncommon.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._common_q4pvo_75{background-image:url(./assets/backgrounds/token-box-common.svg)}._tokenBoxWrap_q4pvo_1 ._frame_q4pvo_95._default_q4pvo_159{background-image:url(./assets/backgrounds/token-box-none.svg)}._InformationContainerPos_72ckd_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._scrollContainer_72ckd_15{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px);padding-top:5px}._traitInfoTitle_72ckd_27{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_72ckd_35{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px}._input-box_72ckd_43{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_72ckd_43:focus{outline:none}._input-box_72ckd_43::selection{background-color:#111f17;color:#5eb086}._flexSelect_72ckd_62{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_72ckd_70{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 10px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_72ckd_86{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_72ckd_93{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_72ckd_100:hover{opacity:1}._custom-checkbox_72ckd_105 input[type=checkbox]{display:none}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110._checked_72ckd_119{background-color:#5eb086}._custom-checkbox_72ckd_105 ._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:none}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110{background-color:#5eb086}._custom-checkbox_72ckd_105 input[type=checkbox]:checked+._checkbox-container_72ckd_110 ._checkmark_72ckd_123{display:block}._checkboxHolder_72ckd_136{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._InformationContainerPos_rgqwy_1{position:fixed;left:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none}._traitInfoTitle_rgqwy_13{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._traitInfoText_rgqwy_21{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px}._flexSelect_rgqwy_30{display:flex;justify-content:space-between;width:90%;height:40px;align-items:center}._arrow-button_rgqwy_37{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_rgqwy_51{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_rgqwy_58{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._scrollContainer_rgqwy_65{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._custom-checkbox_rgqwy_76 input[type=checkbox]{display:none}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81._checked_rgqwy_90{background-color:#5eb086}._custom-checkbox_rgqwy_76 ._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:none}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81{background-color:#5eb086}._custom-checkbox_rgqwy_76 input[type=checkbox]:checked+._checkbox-container_rgqwy_81 ._checkmark_rgqwy_94{display:block}._checkboxHolder_rgqwy_107{display:flex;gap:5px;align-items:center;justify-content:left;height:40px}._buttonContainer_rgqwy_114{position:absolute;bottom:20px;left:32px;width:calc(100% - 64px);width:-webkit-calc(100% - 64px);text-align:center}._buttonContainer_rgqwy_114 ._buttonLeft_rgqwy_123{float:left}._buttonContainer_rgqwy_114 ._buttonRight_rgqwy_127{float:Right}._buttonContainer_rgqwy_114 ._buttonCenter_rgqwy_131{margin:0 8px}._buttonContainer_rgqwy_114:after{content:" ";display:block;clear:both}._buttonContainer_rgqwy_114 button{min-width:120px}._InformationContainerPos_1cryw_2{position:fixed;right:32px;top:98px;width:350px;height:-webkit-calc(100vh - 176px);height:calc(100vh - 176px);-webkit-backdrop-filter:blur(22.5px);backdrop-filter:blur(22.5px);background:rgba(5,11,14,.8);z-index:1000;-webkit-user-select:none;user-select:none;text-align:right}._scrollContainer_1cryw_16{height:100%;width:80%;overflow-y:scroll;position:relative;overflow-x:hidden!important;margin:30px;height:-webkit-calc(100% - 40px);height:calc(100% - 40px)}._traitInfoTitle_1cryw_28{color:#fff;text-transform:uppercase;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:10px;text-align:right}._traitInfoText_1cryw_38{color:#b3b3b3;text-shadow:1px 1px 2px black;font-size:16px;word-spacing:2px;margin-bottom:30px;text-align:right}._input-box_1cryw_47{width:60px;height:20px;color:#5eb086;background-color:#050b0e80;border:none;font-size:medium;font-weight:500;margin-left:15px}._input-box_1cryw_47:focus{outline:none}._input-box_1cryw_47::selection{background-color:#111f17;color:#5eb086}._flexSelect_1cryw_66{display:flex;justify-content:space-between;width:100%;height:40px;align-items:center}._arrow-button_1cryw_74{cursor:pointer;overflow:hidden;opacity:.8;width:32px;height:32px;margin:2px 2px 30px;text-align:center;outline-color:#3b434f;outline-width:2px;outline-style:solid;align-items:center;background-color:#1e2530}._left-button_1cryw_90{background:url(./ui/backButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._right-button_1cryw_97{background:url(./ui/nextButton_small.png);background-position:center;background-repeat:no-repeat;background-size:cover}._anim-button_1cryw_104:hover{opacity:1}._custom-checkbox_1cryw_109 input[type=checkbox]{display:none}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114{display:inline-block;width:20px;height:20px;border:2px solid #284b39;border-radius:5px;cursor:pointer}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114._checked_1cryw_123{background-color:#5eb086}._custom-checkbox_1cryw_109 ._checkbox-container_1cryw_114 ._checkmark_1cryw_127{display:none}._custom-checkbox_1cryw_109 input[type=checkbox]:checked+._checkbox-container_1cryw_114{background-color:#5eb086}._custom-checkbox_1cryw_109 input[type=checkbox]:checked+._checkbox-container_1cryw_114 ._checkmark_1cryw_127{display:block}._checkboxHolder_1cryw_140{display:flex;gap:30px;align-items:center;justify-content:center;align-content:center;height:40px}._languageSwitchWrap_83v6a_1{position:absolute;z-index:10000000;top:26px;right:32px;color:#fff}._languageSwitchWrap_83v6a_1 select{background:none!important;color:#fff;border:none;font-size:16px;padding-right:8px;box-shadow:0 5px 25px #0003;-webkit-appearance:button;-moz-appearance:button;appearance:button;outline:none;text-align:right} diff --git a/assets/index-0f03996f.js b/assets/index-83fac15e.js similarity index 99% rename from assets/index-0f03996f.js rename to assets/index-83fac15e.js index 86722901..f28f681a 100644 --- a/assets/index-0f03996f.js +++ b/assets/index-83fac15e.js @@ -4104,7 +4104,7 @@ void main() { * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */class lH{}const e1=new X,Fc=new X;class AH extends lH{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new X(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new X(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){e1.copy(this.offset).applyMatrix4(e),Fc.copy(this.tail).applyMatrix4(e),Fc.sub(e1);const s=Fc.lengthSq();i.copy(t).sub(e1);const o=Fc.dot(i);o<=0||(s<=o||Fc.multiplyScalar(o/s),i.sub(Fc));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class cH extends lH{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new X(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const zo=new X;class Afe extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=e,this._attrPos=new At(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=zo.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){zo.copy(this._currentTail).sub(this._currentOffset);const e=zo.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(zo.y,Math.sqrt(zo.x*zo.x+zo.z*zo.z)),r=-Math.atan2(zo.z,zo.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class cfe extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const ufe=new X;class JD extends Qr{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof cH)this._geometry=new cfe(this.collider.shape);else if(this.collider.shape instanceof AH)this._geometry=new Afe(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Pl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new A0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ufe.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class ffe extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const dfe=new X;class hfe extends Qr{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new ffe(this.springBone);const t=new Pl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new A0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=dfe.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class HD extends Nt{constructor(e){super(),this.shape=e}}const pfe=new Le;function uH(n){return n.invert?n.invert():n.getInverse(pfe.copy(n)),n}class gfe{constructor(e){this._inverseCache=new Le,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),uH(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const mfe=new Le,Ka=new X,Dp=new X,vfe=new X,mf=new X,zD=new X,kp=new X,YD=new et,vf=new Le,yfe=new Le;class Bfe{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Le,this._initialLocalRotation=new et,this._initialLocalChildPosition=new X,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new X(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new gfe(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:mfe}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(vf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(vf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),mf.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(vf);zD.copy(mf).applyMatrix4(t);const r=YD.setFromRotationMatrix(t),i=yfe.copy(t).multiply(this._parentMatrixWorld),s=Dp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(zD).normalize(),o=vfe.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(vf);kp.copy(this._currentTail).add(Ka.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Ka.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Ka.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),kp.sub(mf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(mf),this._collision(kp),t=this._getMatrixWorldToCenter(vf),this._prevTail.copy(this._currentTail),this._currentTail.copy(Ka.copy(kp).applyMatrix4(t));const l=uH(vf.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=YD.setFromUnitVectors(this._boneAxis,Ka.copy(kp).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Ka);i<0&&(e.add(Ka.multiplyScalar(-i)),e.sub(mf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(mf))})})}_calcWorldSpaceBoneLength(){Ka.setFromMatrixPosition(this.bone.matrixWorld),this.child?Dp.setFromMatrixPosition(this.child.matrixWorld):(Dp.copy(this._initialLocalChildPosition),Dp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Ka.sub(Dp).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function ty(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function wfe(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function fH(n,e){n.children.forEach(t=>{e(t)||fH(t,e)})}class XD{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),fH(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)wfe(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const Cfe=new Set(["1.0","1.0-beta"]);class Xc{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Xc.EXTENSION_NAME}afterRoot(e){return ty(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return ty(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return ty(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Xc.EXTENSION_NAME))!==-1))return null;const A=new XD,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Xc.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!Cfe.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Xc.EXTENSION_NAME} specVersion "${f}"`),null;const d=(i=u.colliders)===null||i===void 0?void 0:i.map((p,m)=>{var g,v,y,w,C;const b=c[p.node],F=p.shape;if(F.sphere)return this._importSphereCollider(b,{offset:new X().fromArray((g=F.sphere.offset)!==null&&g!==void 0?g:[0,0,0]),radius:(v=F.sphere.radius)!==null&&v!==void 0?v:0});if(F.capsule)return this._importCapsuleCollider(b,{offset:new X().fromArray((y=F.capsule.offset)!==null&&y!==void 0?y:[0,0,0]),radius:(w=F.capsule.radius)!==null&&w!==void 0?w:0,tail:new X().fromArray((C=F.capsule.tail)!==null&&C!==void 0?C:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${m} has no valid shape`)}),h=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((p,m)=>{var g;return{colliders:((g=p.colliders)!==null&&g!==void 0?g:[]).map(y=>{const w=d==null?void 0:d[y];if(w==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${m} attempted to use a collider #${y} but not found`);return w}),name:p.name}});return(o=u.springs)===null||o===void 0||o.forEach((p,m)=>{var g;const v=p.joints,y=(g=p.colliderGroups)===null||g===void 0?void 0:g.map(b=>{const F=h==null?void 0:h[b];if(F==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${b} but not found`);return F}),w=p.center!=null?c[p.center]:void 0;let C;v.forEach(b=>{if(C){const F=C.node,x=c[F],S=b.node,R=c[S],Z={hitRadius:C.hitRadius,dragForce:C.dragForce,gravityPower:C.gravityPower,stiffness:C.stiffness,gravityDir:C.gravityDir!=null?new X().fromArray(C.gravityDir):void 0},Y=this._importJoint(x,R,Z,y);w&&(Y.center=w),A.addJoint(Y)}C=b})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return ty(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new XD,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(d=>{var h;const p=u[d.node];return{colliders:((h=d.colliders)!==null&&h!==void 0?h:[]).map((g,v)=>{var y,w,C;const b=new X(0,0,0);return g.offset&&b.set((y=g.offset.x)!==null&&y!==void 0?y:0,(w=g.offset.y)!==null&&w!==void 0?w:0,g.offset.z?-g.offset.z:0),this._importSphereCollider(p,{offset:b,radius:(C=g.radius)!==null&&C!==void 0?C:0})})}});return A==null||A.forEach((d,h)=>{const p=d.bones;p&&p.forEach(m=>{var g,v,y,w;const C=u[m],b=new X;d.gravityDir?b.set((g=d.gravityDir.x)!==null&&g!==void 0?g:0,(v=d.gravityDir.y)!==null&&v!==void 0?v:0,(y=d.gravityDir.z)!==null&&y!==void 0?y:0):b.set(0,-1,0);const F=d.center!=null?u[d.center]:void 0,x={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:b},S=(w=d.colliderGroups)===null||w===void 0?void 0:w.map(R=>{const Z=f==null?void 0:f[R];if(Z==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${h} attempted to use a colliderGroup ${R} but not found`);return Z});C.traverse(R=>{var Z;const Y=(Z=R.children[0])!==null&&Z!==void 0?Z:null,Q=this._importJoint(R,Y,x,S);F&&(Q.center=F),c.addJoint(Q)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Bfe(e,t,r,i);if(this.jointHelperRoot){const o=new hfe(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new cH({offset:r,radius:i}),o=new HD(s);if(e.add(o),this.colliderHelperRoot){const a=new JD(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new AH({offset:r,radius:i,tail:s}),a=new HD(o);if(e.add(a),this.colliderHelperRoot){const l=new JD(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Xc.EXTENSION_NAME="VRMC_springBone";class bfe{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const d=t==null?void 0:t.helperRoot,h=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new lb(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new nue(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new Aue(e,{helperRoot:d,autoUpdateHumanBones:h}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new bue(e,{helperRoot:d}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new Fue(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new Wd(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new Vm(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new Oue(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Xc(e,{colliderHelperRoot:d,jointHelperRoot:d}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Yc(e,{helperRoot:d})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return ey(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return ey(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return ey(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return ey(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new Uue({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function KD(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function xfe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>KD(i)):r&&KD(r))}function Ife(n){n.traverse(xfe)}function Ffe(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(p=>{u.addGroup(p.start,p.count,p.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],d=[];{const p=A.array,m=new p.constructor(p.length);let g=0;for(let v=0;v{const m=l.attributes[p];if(m.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const g=m.array,{itemSize:v,normalized:y}=m,w=new g.constructor(d.length*v);d.forEach((C,b)=>{for(let F=0;F{u.morphAttributes[p]=[];const m=l.morphAttributes[p];for(let g=0;g{for(let S=0;SF===0),u.morphAttributes[p][g]=new At(b,w,C)}}),h&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function Ufe(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Yh{constructor(){}}Yh.deepDispose=Ife;Yh.removeUnnecessaryJoints=Ffe;Yh.removeUnnecessaryVertices=Efe;Yh.rotateVRM0=Ufe;var Xn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Xn||(Xn={}));const kw="blend_",jD="vrmColliderSphere";class Sfe{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=a.filter((j,se,ce)=>ce.findIndex(Be=>Be.name===j.name.replace(" (Outline)",""))===se).map(j=>j),h=d.map(j=>j.name),p=r?{name:"icon",imageBitmap:r.image}:null,m=d.filter(j=>j.map).map(j=>{if(!j.map)throw new Error(j.name+" map is null");return{name:j.name,imageBitmap:j.map.image}}),g=d.filter(j=>j.userData.shadeTexture).map(j=>{if(!j.userData.shadeTexture)throw new Error(j.userData.shadeTexture+" map is null");return{name:j.name+"_shade",imageBitmap:j.userData.shadeTexture.image}}),v=m.concat(g),y=Tfe(v,p),w=Nfe(y),C=Dfe(y),b=Mfe(d,v),F=t.children.filter(j=>j.children.length>0&&j.children[0].type===li.Bone)[0],x=dH(F).filter(j=>j.name!==jD),S=x.map(j=>j.name),R=x.map(j=>({children:j.children.filter(se=>se.name!==jD).map(se=>S.indexOf(se.name)),name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],translation:[j.position.x,j.position.y,j.position.z]})),Z=[],Y=t.children.filter(j=>j.type===li.Group||j.type===li.SkinnedMesh),Q=[];Y.forEach(j=>{const se=j.type===li.Group?j.children[0]:j,ce=se.geometry.attributes;Q.push(new ja(ce.position,Xn.FLOAT,Kt.POSITION,xo.VEC3,se.name,void 0)),Q.push(new ja(ce.normal,Xn.FLOAT,Kt.NORMAL,xo.VEC3,se.name,void 0)),Q.push(new ja(ce.uv,Xn.FLOAT,Kt.UV,xo.VEC2,se.name,void 0)),Q.push(new ja(ce.skinWeight,Xn.FLOAT,Kt.SKIN_WEIGHT,xo.VEC4,se.name,void 0)),Q.push(new ja(ce.skinIndex,Xn.UNSIGNED_SHORT,Kt.SKIN_INDEX,xo.VEC4,se.name,void 0)),(j.type===li.Group?j.children.map(ge=>ge):[j]).forEach(ge=>{if(!ge.geometry.index)throw new Error(ge.name+" geometry.index is null");Q.push(new ja(ge.geometry.index,Xn.UNSIGNED_INT,Kt.INDEX,xo.SCALAR,se.name,ge.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];for(const ge in e.expressionManager.expressionMap){const Fe=e.expressionManager.expressionMap[ge],nt=Fe._binds.map(Te=>({node:x.length,index:Te.index,weight:Te.weight}));let We=!1;for(const Te in ai)if(ge.toLowerCase()===ai[Te].toLowerCase()){l[ai[Te]]={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth},We=!0;break}!We&&ge.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth},We=!0),We===!1&&(A[ge]={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth})}for(const ge in se.morphTargetDictionary){se.geometry.userData.targetNames.push(ge);const Fe=se.morphTargetDictionary[ge],nt=se.geometry.morphAttributes;Q.push(new ja(nt.position[Fe],Xn.FLOAT,Kt.BLEND_POSITION,xo.VEC3,se.name,kw+ge)),Q.push(new ja(nt.normal[Fe],Xn.FLOAT,Kt.BLEND_NORMAL,xo.VEC3,se.name,kw+ge))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),Y.forEach(j=>{const se=j.type===li.Group?j.children[0]:j,ce=new Float32Array(se.skeleton.boneInverses.map(Be=>Be.elements).flat());Q.push(new ja(new At(ce,16),Xn.FLOAT,Kt.BIND_MATRIX,xo.MAT4,se.name,se.name))}),Z.push(...Q.map(j=>({bufferView:-1,byteOffset:0,componentType:j.valueType,count:j.attribute.count,max:j.max,min:j.min,normalized:!1,type:j.accessorsType})));const B=Qfe(Y,Q,h);Y.forEach((j,se)=>{R.push({mesh:se,name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],skin:se,translation:[j.position.x,j.position.y,j.position.z]})});const E=Rfe(Y,Q,S),M={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},D={humanBones:{}};for(const j in s.humanBones)D.humanBones[j]={node:S.indexOf(s.humanBones[j].node.name)};const T=o,V=[];V.push(...v.map(j=>({buffer:$D(j.imageBitmap),type:Kt.IMAGE}))),V.push(...Q.map(j=>({buffer:j.buffer,type:j.type}))),p&&V.push({buffer:$D(p.imageBitmap),type:Kt.IMAGE});let G=0,P=0,U=0;const H=V.map((j,se)=>{const ce={buffer:0,byteLength:j.buffer.byteLength,byteOffset:G,target:j.type===Kt.IMAGE||j.type===Kt.BIND_MATRIX?void 0:j.type===Kt.INDEX?Xn.ELEMENT_ARRAY_BUFFER:Xn.ARRAY_BUFFER};return G+=j.buffer.byteLength,j.type===Kt.IMAGE?y[P++].bufferView=se:Z[U++].bufferView=se,ce}),oe=kfe(t,R),k={accessors:Z,asset:f,buffers:[{byteLength:G}],bufferViews:H,extensions:{VRMC_vrm:{expressions:c,humanoid:D,lookAt:M,meta:T,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:y,materials:b,meshes:B,nodes:R,samplers:w,avatar:0,scenes:oe,skins:E,textures:C},K=new qD(XE(JSON.stringify(k,void 0,2)),"JSON"),ne=new qD(vg(V.map(j=>j.buffer)),"BIN\0"),ie=vg([K.buffer,ne.buffer]),ue=vg([XE("glTF"),YE(2,4),YE(ie.byteLength+12,4)]);i(vg([ue,ie]))}}function dH(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>dH(e)).flat())}function $D(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Xn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Xn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let qD=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=vg([YE(r.byteLength,4),XE(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===Kt.POSITION||r===Kt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Bd;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Bd||(Bd={}));var xo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(xo||(xo={}));var Kt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(Kt||(Kt={}));var li;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(li||(li={}));const Qfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r,s=r.type===li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Kt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(kw+A),POSITION:e.map(c=>c.type===Kt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(kw+A)})):void 0}})}}),Rfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Mfe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Bd.MeshStandardMaterial:return t.metalness;case Bd.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Bd.MeshStandardMaterial:return t.roughness;case Bd.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Tfe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Nfe=n=>n.map(()=>({magFilter:Xn.LINEAR,minFilter:Xn.LINEAR,wrapS:Xn.REPEAT,wrapT:Xn.REPEAT})),Dfe=n=>n.map((e,t)=>({sampler:0,source:t})),kfe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===li.Object3D||r.type===li.SkinnedMesh||r.type===li.Group||r.type===li.Bone).map(r=>t.indexOf(r.name))}]},hH=0,Vfe=1,pH=2,ek=2,t1=1.25,tk=1,uB=6*4+4+4,KE=65535,Lfe=Math.pow(2,-24);class ny{constructor(){}}function ua(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function nk(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function rk(n,e){e.set(n)}function ik(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function ry(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Vp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Pfe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=F),g&&wh&&(h=w);const x=n[v+2],S=n[v+3],R=x-S,Z=x+S;RA&&(A=Z),g&&xp&&(p=x);const Y=n[v+4],Q=n[v+5],B=Y-Q,E=Y+Q;Bc&&(c=E),g&&Ym&&(m=Y)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,g&&(i[0]=u,i[1]=f,i[2]=d,i[3]=h,i[4]=p,i[5]=m)}function Ofe(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const d=n[c+2];dl&&(l=d);const h=n[c+4];hA&&(A=h)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Gfe(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,sA=new Array(nl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),iy=new Float32Array(6);function Jfe(n,e,t,r,i,s){let o=-1,a=0;if(s===hH)o=nk(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Vfe)o=nk(n),o!==-1&&(a=Hfe(t,r,i,o));else if(s===pH){const l=Vp(n);let A=t1*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const d=e[f],m=(e[f+3]-d)/nl;if(i=F.candidate?ry(w,t,F.rightCacheBounds):(ry(w,t,F.leftCacheBounds),F.count++)}}for(let w=0;w=nl&&(b=nl-1);const F=sA[b];F.count++,ry(y,t,F.bounds)}const g=sA[nl-1];rk(g.bounds,g.rightCacheBounds);for(let y=nl-2;y>=0;y--){const w=sA[y],C=sA[y+1];ik(w.bounds,C.rightCacheBounds,w.rightCacheBounds)}let v=0;for(let y=0;yb&&(b=y),w>b&&(b=w);const F=(b-C)/2,x=g*2;s[d+x+0]=C+F,s[d+x+1]=F+(Math.abs(C)+F)*Lfe,Ce[g+3]&&(e[g+3]=b)}}return s}function Yfe(n,e){function t(g){f&&f(g/d)}function r(g,v,y,w=null,C=0){if(!h&&C>=l&&(h=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),y<=c||C>=l)return t(v+y),g.offset=v,g.count=y,g;const b=Jfe(g.boundingData,w,o,v,y,u);if(b.axis===-1)return t(v+y),g.offset=v,g.count=y,g;const F=Gfe(a,o,v,y,b);if(F===v||F===v+y)t(v+y),g.offset=v,g.count=y;else{g.splitAxis=b.axis;const x=new ny,S=v,R=F-v;g.left=x,x.boundingData=new Float32Array(6),n1(o,S,R,x.boundingData,s),r(x,S,R,s,C+1);const Z=new ny,Y=F,Q=y-R;g.right=Z,Z.boundingData=new Float32Array(6),n1(o,Y,Q,Z.boundingData,s),r(Z,Y,Q,s,C+1)}return g}Pfe(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=zfe(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,d=n.index.count/3;let h=!1;const p=[],m=Wfe(n);if(m.length===1){const g=m[0],v=new ny;v.boundingData=i,Ofe(o,g.offset,g.count,s),r(v,g.offset,g.count,s),p.push(v)}else for(let g of m){const v=new ny;v.boundingData=new Float32Array(6),n1(o,g.offset,g.count,v.boundingData,s),r(v,g.offset,g.count,s),p.push(v)}return p}function Xfe(n,e){const t=Yfe(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=y/4,y=A(y,g),i[f+7]=v,y}}}class Dl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Dl.prototype.setFromBox=function(){const n=new X;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Kfe=function(){const n=new X,e=new X,t=new X;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),d=c.dot(c),h=t.dot(l),m=l.dot(l)*d-f*f;let g,v;m!==0?g=(u*f-h*d)/m:g=0,v=(u+g*f)/d,o.x=g,o.y=v}}(),J_=function(){const n=new Oe,e=new X,t=new X;return function(i,s,o,a){Kfe(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,d=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=d.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(d);return}}}}(),jfe=function(){const n=new X,e=new X,t=new dl,r=new xl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const p=o.getPlane(t);if(Math.abs(p.distanceToPoint(l))<=a){const g=p.projectPoint(l,e);if(o.containsPoint(g))return!0}return!1}}(),$fe=1e-15;function yf(n){return Math.abs(n)<$fe}class kl extends ts{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new X),this.satBounds=new Array(4).fill().map(()=>new Dl),this.points=[this.a,this.b,this.c],this.sphere=new Su,this.plane=new dl,this.needsUpdate=!0}intersectsSphere(e){return jfe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const d=s[3],h=o[3];d.subVectors(r,e),h.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}kl.prototype.closestPointToSegment=function(){const n=new X,e=new X,t=new xl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const d=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[d]),J_(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const v=this.satBounds,y=this.satAxes;t[0]=d.a,t[1]=d.b,t[2]=d.c;for(let b=0;b<4;b++){const F=v[b],x=y[b];if(r.setFromPoints(x,t),F.isSeparated(r))return!1}const w=d.satBounds,C=d.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let b=0;b<4;b++){const F=w[b],x=C[b];if(r.setFromPoints(x,e),F.isSeparated(r))return!1}for(let b=0;b<4;b++){const F=y[b];for(let x=0;x<4;x++){const S=C[x];if(s.crossVectors(F,S),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return h&&(p||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),h.start.set(0,0,0),h.end.set(0,0,0)),!0}else{const v=this.points;let y=!1,w=0;for(let B=0;B<3;B++){const E=v[B],M=v[(B+1)%3];A.start.copy(E),A.end.copy(M),A.delta(o);const D=y?c.start:c.end,T=yf(g.distanceToPoint(E));if(yf(g.normal.dot(o))&&T){c.copy(A),w=2;break}if((g.intersectLine(A,D)||T)&&!yf(D.distanceTo(M))){if(w++,y)break;y=!0}}if(w===1&&d.containsPoint(c.end))return h&&(h.start.copy(c.end),h.end.copy(c.end)),!0;if(w!==2)return!1;const C=d.points;let b=!1,F=0;for(let B=0;B<3;B++){const E=C[B],M=C[(B+1)%3];A.start.copy(E),A.end.copy(M),A.delta(a);const D=b?u.start:u.end,T=yf(m.distanceToPoint(E));if(yf(m.normal.dot(a))&&T){u.copy(A),F=2;break}if((m.intersectLine(A,D)||T)&&!yf(D.distanceTo(M))){if(F++,b)break;b=!0}}if(F===1&&this.containsPoint(u.end))return h&&(h.start.copy(u.end),h.end.copy(u.end)),!0;if(F!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let B=u.start;u.start=u.end,u.end=B}const x=c.start.dot(o),S=c.end.dot(o),R=u.start.dot(o),Z=u.end.dot(o),Y=S0?h.start.copy(c.start):h.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?h.end.copy(c.end):h.end.copy(u.end)),!0)}}}();kl.prototype.distanceToPoint=function(){const n=new X;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();kl.prototype.distanceToTriangle=function(){const n=new X,e=new X,t=["a","b","c"],r=new xl,i=new xl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const d=t[u],h=o[d];this.closestPointToPoint(h,n),f=h.distanceToSquared(n),fnew X),this.satAxes=new Array(3).fill().map(()=>new X),this.satBounds=new Array(3).fill().map(()=>new Dl),this.alignedSatBounds=new Array(3).fill().map(()=>new Dl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ra.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,d=i[f];d.x=A?r.x:t.x,d.y=c?r.y:t.y,d.z=u?r.z:t.z,d.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],f=1<new xl),t=new Array(12).fill().map(()=>new xl),r=new X,i=new X;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,d=this.points;let h=1/0;for(let m=0;m<8;m++){const g=d[m];i.copy(g).clamp(u,f);const v=g.distanceToSquared(i);if(vt.far)?null:n}function oa(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function ck(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let d,h;f?(d=Pm(n),h=Wm(n,a)):(d=Wm(n,a),h=Pm(n));const m=Lw(d,s,r,Vw)?$E(d,e,t,r):null;if(m){const y=m.point[c];if(f?y<=s[h+A]:y>=s[h+A+3])return m}const v=Lw(h,s,r,Vw)?$E(h,e,t,r):null;return m&&v?m.distance<=v.distance?m:v:m||v||null}}const sde=function(){let n,e;const t=[],r=new mH(()=>new ao);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(y){let w=y*2,C=GA,b=ZA;for(;!vA(w,C);)y=Pm(y),w=y*2;return Od(y,b)}function d(y){let w=y*2,C=GA,b=ZA;for(;!vA(w,C);)y=Wm(y,b),w=y*2;return Od(y,b)+Lm(w,C)}let h=s*2,p=Xh,m=GA,g=ZA;if(vA(h,m)){const y=Od(s,g),w=Lm(h,m);return ua(s,p,n),l(y,w,!1,u,c+s,n)}else{const y=Pm(s),w=Wm(s,g);let C=y,b=w,F,x,S,R;if(A&&(S=n,R=e,ua(C,p,S),ua(b,p,R),F=A(S),x=A(R),xi.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(A),x.b.applyMatrix4(A),x.c.applyMatrix4(A),x.needsUpdate=!0;for(let S=C*3,R=(b+C)*3;Snew kl);class Jg{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),Jg.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),Jg.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new Jg(t,{...r,[r1]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:hH,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[r1]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[r1]||(this._roots=Xfe(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ao))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,d=c.length;fb&&(b=Y),QF&&(F=Q),Bx&&(x=B)}return l[f+0]!==y||l[f+1]!==w||l[f+2]!==C||l[f+3]!==b||l[f+4]!==F||l[f+5]!==x?(l[f+0]=y,l[f+1]=w,l[f+2]=C,l[f+3]=b,l[f+4]=F,l[f+5]=x,!0):!1}else{const g=f+8,v=o[f+6],y=g+d,w=v+d;let C=h,b=!1,F=!1;e?C||(b=e.has(y),F=e.has(w),C=!b&&!F):(b=!0,F=!0);const x=C||b,S=C||F;let R=!1;x&&(R=u(g,d,C));let Z=!1;S&&(Z=u(v,d,C));const Y=R||Z;if(Y)for(let Q=0;Q<3;Q++){const B=g+Q,E=v+Q,M=l[B],D=l[B+3],T=l[E],V=l[E+3];l[f+Q]=MV?D:V}return Y}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===KE;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+uB/4,f=i[a+6],d=i[a+7];e(l,c,new Float32Array(r,a*4,6),d)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=Sa){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const g=h*3;return f(d,g,g+1,g+2,p,m)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Yo.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(d,h,p,m,g)=>f(d,h,p,m,g)?!0:ck(d,h,i,A,p,m,s)}else l||(A?l=(f,d,h,p)=>ck(f,d,i,A,h,p,s):l=(f,d,h)=>h);let c=!1,u=0;for(const f of this._roots){if(yg(f),c=sde(0,i,a,l,o,u),ly(),c)break;u+=f.byteLength}return Yo.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Bf.copy(t).invert();const c=Yo.getPrimitive(),u=Yo.getPrimitive();if(s){let d=function(h,p,m,g,v,y,w,C){for(let b=m,F=m+g;bs1.intersectsBox(d),intersectsRange:(d,h,p,m,g,v)=>(i1.copy(v),i1.applyMatrix4(Bf),e.shapecast({intersectsBounds:y=>i1.intersectsBox(y),intersectsRange:(y,w,C,b,F)=>i(d,h,y,w,m,g,b,F)}))});return Yo.releasePrimitive(c),Yo.releasePrimitive(u),f}intersectsBox(e,t){return Ec.set(e.min,e.max,t),Ec.needsUpdate=!0,this.shapecast({intersectsBounds:r=>Ec.intersectsBox(r),intersectsTriangle:r=>Ec.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),Ec.set(e.boundingBox.min,e.boundingBox.max,t),Ec.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Yo.getPrimitive(),d=Yo.getPrimitive();let h=Ay,p=ade,m=null,g=null;i&&(m=lde,g=Ade);let v=1/0,y=null,w=null;return Bf.copy(t).invert(),Lp.matrix.copy(Bf),this.shapecast({boundsTraverseOrder:C=>Ec.distanceToBox(C),intersectsBounds:(C,b,F)=>F{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:F=>Lp.distanceToBox(F),intersectsBounds:(F,x,S)=>S{for(let S=F*3,R=(F+x)*3;S(Pp.copy(e).clamp(c.min,c.max),Pp.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,Pp);const f=e.distanceToSquared(Pp);return f{ua(0,new Float32Array(r),uk),e.union(uk)}),e}}const o1=new o0,fk=new Le,cde=Vn.prototype.raycast;function ude(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;fk.copy(this.matrixWorld).invert(),o1.copy(n.ray).applyMatrix4(fk);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=Ak(t.raycastFirst(o1,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(o1,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new ts,i=new X,s=new X,o=new X,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&dB(n.userData.cancelMesh))},vH=n=>{var e,t;n.userData.cullingClone&&(dB(n.userData.cullingClone),n.userData.cullingClone=null,dB(n.userData.cullingCloneP),n.userData.cullingCloneP=null,dB(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Bde=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Bg=n[0].parent,Bg.lines!=null&&(Bg.lines.forEach(i=>{i.visible=!1}),Bg.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=yde(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=gde,a.userData.cancelMesh=o,a.material=mde,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},wde=n=>{let e=hde,t=pde;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Cde=(n,e,t,r,i,s,o=!1)=>{const a=[],l=wde(s);let A=l[0],c=l[1];cy.far=A+c;for(let f=0;f=0;v--)A-g[v].distance>=g[v].object.userData.maxCullDistance&&g.splice(v,1);if(g.length===0){for(let v=0;v<3;v++)a.push(n[d+v]);break}else{const v=g.map(y=>y.object);for(let y=0;yy).length===0){for(let y=0;y<3;y++)a.push(n[d+y]);break}if(p===0)h=g.map(y=>y.object);else if(h=g.map(y=>{if(h.indexOf(y.object)!==-1)return y.object}),h=h.filter(y=>y),p===2&&h.filter(y=>y).length===0)for(let y=0;y<3;y++)a.push(n[d+y]);o&&bde(a1,Wp.clone().multiplyScalar(-1),cy.far,16711680,Bg)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function bde(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new X;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Re(0)),l.push(new Re(16777215));let A=new Pl({color:r});var c=new Dh(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}function yH(n){let e,t,r,i=0;for(let a=0;atypeof window>"u"?await Ude({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await Sde({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}),Ude=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(F=>{const x=F.material;let S=a.find(R=>R.material===x);if(!S)a.push({material:x,mesh:F});else{const{dest:R}=H_({meshes:[S.mesh,F]});S.mesh.geometry=R}});const l=Object.fromEntries(o.map(F=>[F,BH({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((F,x)=>{const S=new Oe(x%A,Math.floor(x/A)).multiplyScalar(1/A),R=new Oe(S.x+1/A,S.y+1/A);return[F.mesh,{min:S,max:R}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},d=[],h=[];a.forEach(F=>{const{min:x,max:S}=u.get(F.mesh);h.push(S),d.push(x)});const p=new Oe(Math.max(...h.map(F=>F.x)),Math.max(...h.map(F=>F.y))),m=new Oe(Math.min(...d.map(F=>F.x)),Math.min(...d.map(F=>F.y))),g=1/(p.x-m.x),v=1/(p.y-m.y),y=c*g,w=c*v,C=new Map(a.map(F=>{let{min:x,max:S}=u.get(F.mesh);return x.x=x.x*g,x.y=x.y*v,S.x=S.x*g,S.y=S.y*v,[F.mesh,{min:x,max:S}]}));a.forEach(F=>{const{material:x,mesh:S}=F,{min:R,max:Z}=C.get(S);o.forEach(E=>{const M=l[E];M.globalCompositeOperation="source-over";let D=eU(x,f[E].find(T=>eU(x,T)));if(D!==""&&D!==void 0)try{const T=new Uint8ClampedArray(D.data),V=new ImageData(T,y,w),G=document.createElement("canvas");G.width=y,G.height=w;const P=G.getContext("2d");P.putImageData(V,0,0),P.save(),M.drawImage(G,R.x*s,R.y*s,y,w)}catch(T){console.error("error",T)}else M.fillStyle=E==="diffuse"?`#${x.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Re(x.aoMapIntensity,x.roughness,x.metalness).getHexString()}`:"#7F7F7F",M.fillRect(R.x*s,R.y*s,y,w)});const Y=S.geometry,Q=Y.attributes.uv;if(Q)for(let E=0;E{const x=new nr(l[F].canvas);return x.flipY=!1,[F,x]})));return{bakeObjects:a,textures:b,uvs:C}},Sde=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s})=>{xde();const o=t,a=r?["diffuse"]:["diffuse","orm"],l=[];let A=null;e.forEach(Z=>{Z=Z.clone();const Y=Z.material.length==null?Z.material:Z.material[0];r&&A==null&&Y.type=="ShaderMaterial"&&(A=Y.clone());let Q=l.find(B=>{B.material});if(!Q)l.push({material:Y,mesh:Z});else{const{dest:B}=H_({meshes:[Q.mesh,Z]});Q.mesh.geometry=B}});const c=Object.fromEntries(a.map(Z=>[Z,BH({width:o,height:o,transparent:s})])),u=Math.floor(Math.sqrt(e.length)+1),f=o/u,d=new Map(l.map((Z,Y)=>{const Q=new Oe(Y%u,Math.floor(Y/u)).multiplyScalar(1/u),B=new Oe(Q.x+1/u,Q.y+1/u);return[Z.mesh,{min:Q,max:B}]})),h={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},p=[],m=[];l.forEach(Z=>{const{min:Y,max:Q}=d.get(Z.mesh);m.push(Q),p.push(Y)});const g=new Oe(Math.max(...m.map(Z=>Z.x)),Math.max(...m.map(Z=>Z.y))),v=new Oe(Math.min(...p.map(Z=>Z.x)),Math.min(...p.map(Z=>Z.y))),y=1/(g.x-v.x),w=1/(g.y-v.y),C=f*y,b=f*w,F=new Map(l.map(Z=>{let{min:Y,max:Q}=d.get(Z.mesh);return Y.x=Y.x*y,Y.y=Y.y*w,Q.x=Q.x*y,Q.y=Q.y*w,[Z.mesh,{min:Y,max:Q}]}));l.forEach(Z=>{const{material:Y,mesh:Q}=Z,{min:B,max:E}=F.get(Q);a.forEach(V=>{var k;const G=c[V];G.globalCompositeOperation="source-over";let P,U=new Re(1,1,1);switch(V){case"diffuse":P=Y.color||n,(k=Y.uniforms)!=null&&k.litFactor&&(U=Y.uniforms.litFactor.value);break;case"normal":P=new Re(8421631);break;case"orm":P=new Re(Y.aoMapIntensity,Y.roughness,Y.metalness);break;default:P=new Re(1,1,1);break}let H=Fde(Y,h[V].find(K=>eU(Y,K)));const oe=Ide(H,U,P,o,o,s);createImageBitmap(oe).then(K=>G.drawImage(K,B.x*o,B.y*o,C,b))});const M=Q.geometry.clone();Q.geometry=M;const D=M.attributes.uv.clone();if(M.attributes.uv=D,D)for(let V=0;V{const Y=new nr(c[Z].canvas);return Y.flipY=!1,[Z,Y]})));let S;const R=i?"transparent":"opaque";return r?(S=new gu({map:x.diffuse,transparent:i}),A==null&&(A=new cB),A.uniforms.map=x.diffuse,A.uniforms.shadeMultiplyTexture=x.diffuse,A.transparent=i,s&&!i&&(S.alphaTest=.5,A.alphaTest=.5),S.userData.vrmMaterial=A,S.userData.shadeTexture=x.uniformColor,S.name="mToon_"+R,S.map.name=S.name):(S=new gu({map:x.diffuse,roughnessMap:x.orm,metalnessMap:x.orm,normalMap:x.normal,transparent:i}),s&&!i&&(S.alphaTest=.5),S.name="standard_"+R,S.roughnessMap!=null&&(S.roughnessMap.name=S.name+"_orm"),S.normalMap!=null&&(S.normalMap.name=S.name+"_normal")),{bakeObjects:l,material:S}};function wH(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new dc(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function CH(n,e){const t=new Map;new X(-1,1,-1),new Le,new X;let r=0;n.forEach(l=>{if(l.skeleton){var A=wH(l);const c=A.bones;A.bones.forEach((u,f)=>{var d;if(c.indexOf(u)!==-1){const h=t.get(u.name);if(h==null){const p={index:r,boneInverses:A.boneInverses[f],bone:u.clone(!1),parentName:((d=u.parent)==null?void 0:d.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,p)}else u.userData.VRMcolliders!=null&&(h.bone.userData.VRMcolliders==null?h.bone.userData.VRMcolliders=u.userData.VRMcolliders:h.bone.userData.VRMcolliders=[...h.bone.userData.VRMcolliders,...u.userData.VRMcolliders])}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new dc(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _de(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function Qde(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function Pw(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Tde(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];wh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=CH(i,t),l=new Nt;return l.name="AvatarRoot",i.forEach(A=>{var b;const c=new $t,u={};for(const F in A.geometry.attributes){const x=A.geometry.attributes[F];u[F]=x.clone()}if((b=A.userData)!=null&&b.isVRM0)for(let F=0;F[F,F.geometry.morphAttributes])),h=new Map([A].map(F=>[F,F.morphTargetDictionary||{}]));if(f.morphAttributes=xH({meshes:[A],sourceMorphAttributes:d,sourceMorphTargetDictionaries:h,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let F=0;Fd.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new X(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new X,f=e.userData.isVRM0?-1:1;for(let d=0;d0){const{bakeObjects:S,material:R}=await Ede({transparentColor:t,atlasSize:F.size,meshes:x,mtoon:F.isMtoon,transparentMaterial:F.transparentMaterial,transparentTexture:v}),Z=S.map(D=>D.mesh),Y=[];Z.forEach(D=>{D.type=="Mesh"&&(D=Dde(w,D)),Y.push(D);const T=D.geometry,V=T.index.array,G=bH(D.geometry.index.array),P=[];for(let oe=0;oe{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Lde({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=yH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Pde({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function xH({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,d])=>{A[u][d]=[],n.forEach(h=>{let p;const m=e.get(h);if(m.hasOwnProperty(f)&&h.geometry.morphAttributes[u]){const g=m[f];p=h.geometry.morphAttributes[u][g]}else{const g=h.geometry.attributes[u],v=new g.array.constructor(new Array(g.array.length).fill(0));p=new At(v,g.itemSize,g.normalized)}A[u][d].push(p)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Lde({sourceAttributes:i.attributes});const o=Pde({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=xH({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Vde({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Wde({meshes:n}),s.animations={},{source:i,dest:s}}function Ht(n){return n==null?[]:Array.isArray(n)?n:[n]}async function Ode(n,e){const r=await new Qu().load(e);r.encoding=ht,r.flipY=!1,n.traverse(i=>{if(i instanceof Vn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Bde(e)};function Jde(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=Ht(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function Hde(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{Ht(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function hk(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function zde(n,e){if(n.data!=null)return n.data[e]}function Yde(n){const e=zde(n,"cullingMeshes");e&&(e.forEach(t=>{vH(t)}),n.data.cullingMeshes=null)}function wn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function Xde(n){const e=n.scene;Yde(n),e.traverse(t=>{t.material&&tU(t.material),t.geometry&&(vH(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Yh.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&tU(i.material)})})});for(const t in n)n[t]=null}const tU=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{var t,r,i,s,o,a,l,A,c,u,f;const e=n.humanoid.humanBones;e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let d in km)d=d.charAt(0).toLowerCase()+d.slice(1),(f=e[d])!=null&&f.node||(e[d]={node:new Fm}),e[d].node.name=d;for(const d in e){const h=oH[d];h&&e[h].node.add(e[d].node)}};function IH({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),IH({candidates:n,predicate:e}))}function FH(n,e){return IH({candidates:[n],predicate:t=>t.name===e})}function EH({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),EH({candidates:n,predicate:e,results:t})}function wh(n,e){return EH({candidates:[n],predicate:t=>Ht(e).includes(t.type)})}function jde(n,e,t){const r=wh(n,"SkinnedMesh");return{humanBones:qde(r[0]),materials:n.userData.atlasMaterial,meta:$de(e,t)}}function $de(n,e){return e=e||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:n,licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...e}}function qde(n){const e={};return n.skeleton.bones.map(t=>{for(const r in km)if(km[r]===t.name){e[t.name]={node:t};break}}),e}const ehe={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function UH(n,e,t){var p;const r=mu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new et,o=new et,a=new et,l=new X,A=e.getObjectByName("mixamorigHips").position.y,c=(p=t.humanoid)==null?void 0:p.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,d=Math.abs(c-u)/A;return r.tracks.forEach(m=>{const g=m.clone(),v=g.name.split("."),y=v[0],C=ehe[y],b=e.getObjectByName(y);if(C!=null){const F=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),g instanceof _a){for(let x=0;x{g.values[Z+x]=R})}i.push(new _a(`${C}.${F}`,g.times,g.values.map((x,S)=>{var R;return((R=t.meta)==null?void 0:R.metaVersion)==="0"&&S%2===0?-x:x})))}else if(g instanceof qA){const x=g.values.map((S,R)=>{var Z;return(((Z=t.meta)==null?void 0:Z.metaVersion)==="0"&&R%3!==1?-S:S)*d});i.push(new qA(`${C}.${F}`,g.times,x))}}}),new mu("vrmAnimation",r.duration,i)}const the=new mse,nhe=new B_,c1=.2,rhe=n=>Math.floor(Math.random()*n);class pk{constructor(e,t,r,i,s,o){var a,l,A,c;this.mixer=new uie(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(l=(a=r==null?void 0:r.humanoid)==null?void 0:a.humanBones)==null?void 0:l.neck,this.spineBone=(c=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:c.spine,this.setAnimations(i),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play()}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t,r=null){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const i=UH(e,t,this.vrm);i&&(e=[i],this.mixamoModel=t)}}else{const i=[];e.forEach(s=>{i.push(s.clone())}),e=i}r&&e[0].tracks.map((i,s)=>{(i.name==="neck.quaternion"||i.name==="spine.quaternion")&&e[0].tracks.splice(s,1)}),this.fadeOutActions=this.actions,this.actions=[],this.newAnimationWeight=0;for(let i=0;i{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}dispose(){this.animationManager.disposeAnimation(this)}}class ihe{constructor(){this.animationPaths=null,this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t=!0,r="",i=""){const s=r+(r!=""?"/":"")+Ht(e)[0];i=i==""?nc(s):i,this.currentAnimationName=i;const a=await(t?the:nhe).loadAsync(s);a.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(a.animations),mu.findByName(a.animations,"mixamo.com")!=null?(this.mixamoModel=a.clone(),this.mixamoAnimations=a.animations):(this.mixamoModel=null,this.animations=a.animations),this.mainControl==null?(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new pk(this,a,null,a.animations,this.curAnimID,this.lastAnimID),this.animationControls.push(this.mainControl)):this.animationControls.forEach(A=>{A.setAnimations(a.animations,this.mixamoModel,this.mouseLookEnabled)})}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=null,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t){const r=Ht(e);this.animationPaths=r.map(i=>`${t}/${i}`)}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=rhe(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-c1)},e*1e3)}update(){this.mainControl&&(this.animationControls.forEach(e=>{e.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*c1):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*c1):this.weightOut=0)}}const gk=4096,mk=new X;class she{constructor(){this.renderer=new HC({preserveDrawingBuffer:!0,antialias:!0}),this.renderer.outputEncoding=ht,this.renderer.setSize(gk,gk),this.camera=new _r(30,1,.1,1e3),this.textureLoader=new Qu,this.sceneBackground=new Re(.1,.1,.1)}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,mk.set(0,0,-1),this.cameraDir=mk.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){Array.isArray(e)?this.setBackgroundColor(e[0],e[1],e[2]):this.setBackgroundImage(e)}setBackgroundColor(e,t,r){this.sceneBackground=new Re(e,t,r)}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=ds,this.sceneBackground=i,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}saveAsImage(e){let t;try{this.scene.background=this.sceneBackground,this.renderer.render(this.scene,this.camera);const r="image/octet-stream",i="image/png";t=this.renderer.domElement.toDataURL(i);const s=UE.Buffer.from(t.replace(/^data:image\/\w+;base64,/,""),"base64"),o=new Blob([s],{type:"image/jpeg"});return this.saveFile(t.replace(i,r),e),this.scene.background=null,o}catch(r){return console.log(r),!1}}_createImage(e,t){const r=e/t;this.renderer.setSize(e,t),this.camera.aspect=r,this.camera.updateProjectionMatrix();try{this.scene.background=this.sceneBackground,this.renderer.render(this.scene,this.camera);const i="image/png";let s=this.renderer.domElement.toDataURL(i);return this.scene.background=null,s}catch(i){return console.log(i),null}}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new nr(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=UE.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const ohe=2;class ahe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new $re,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=ohe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ai.Blink,1-this._eyeOpen),e.expressionManager.update()})}}var Tn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Tn||(Tn={}));const nU="blend_",vk="vrmColliderSphere";function lhe(n){return{title:n.name,version:"v0",author:n.authors[0]||"",contactInformation:n.contactInformation,allowedUserName:n.allowedUserName,violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:"Disallow"}}function Ahe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function che(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function uhe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class fhe{parse(e,t,r,i,s,o,a){var qe;const l=lhe(e.meta),A=Ahe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=c.filter((O,J,ae)=>ae.findIndex(de=>de.name===O.name.replace(" (Outline)",""))===J).map(O=>O),h=d.map(O=>O.name),p=r?{name:"icon",imageBitmap:r.image}:null,m=d.filter(O=>O.map).map(O=>{if(!O.map)throw new Error(O.name+" map is null");return{name:O.name,imageBitmap:O.map.image}}),g=d.filter(O=>O.userData.shadeTexture).map(O=>{if(!O.userData.shadeTexture)throw new Error(O.userData.shadeTexture+" map is null");return{name:O.name+"_shade",imageBitmap:O.userData.shadeTexture.image}}),v=d.filter(O=>O.roughnessMap).map(O=>O.roughnessMap?{name:O.name+"_orm",imageBitmap:O.roughnessMap.image}:null),y=d.filter(O=>O.roughnessMap).map(O=>O.normalMap?{name:O.name+"_normal",imageBitmap:O.normalMap.image}:null),w=[...m,...g,...v,...y].filter(O=>O!==null),C=mhe(w,p),b=vhe(C),F=yhe(C),x=ghe(d,w),S=t.children.filter(O=>O.children.length>0&&O.children[0].type===Ai.Bone)[0],R=SH(S).filter(O=>O.name!==vk),Z=R.map(O=>O.name),Y=R.map(O=>({children:O.children.filter(J=>J.name!==vk).map(J=>Z.indexOf(J.name)),name:O.name,rotation:[O.quaternion.x,O.quaternion.y,O.quaternion.z,O.quaternion.w],scale:[O.scale.x,O.scale.y,O.scale.z],translation:[O.position.x,O.position.y,O.position.z]})),Q=[],B=t.children.filter(O=>O.type===Ai.Group||O.type===Ai.SkinnedMesh),E=[];B.forEach(O=>{const J=O.type===Ai.Group?O.children[0]:O,ae=J.geometry.attributes,de=new oA(ae.position,Tn.FLOAT,kt.POSITION,na.VEC3,J.name,void 0);E.push(de);const ve=E.length-1,L=new oA(ae.normal,Tn.FLOAT,kt.NORMAL,na.VEC3,J.name,void 0);E.push(L),E.push(new oA(ae.uv,Tn.FLOAT,kt.UV,na.VEC2,J.name,void 0)),E.push(new oA(ae.skinWeight,Tn.FLOAT,kt.SKIN_WEIGHT,na.VEC4,J.name,void 0)),E.push(new oA(ae.skinIndex,Tn.UNSIGNED_SHORT,kt.SKIN_INDEX,na.VEC4,J.name,void 0)),(O.type===Ai.Group?O.children.map(N=>N):[O]).forEach(N=>{if(!N.geometry.index)throw new Error(N.name+" geometry.index is null");E.push(new oA(N.geometry.index,Tn.UNSIGNED_INT,kt.INDEX,na.SCALAR,J.name,N.name))}),J.morphTargetDictionary||(J.morphTargetDictionary={},J.morphTargetInfluences=[],J.geometry.morphAttributes={},J.updateMorphTargets()),J.geometry.userData.targetNames=[],console.warn("taking only mesh 0 for morph targets now, take the correct mesh");for(const N in e.expressionManager.expressionMap){const $=e.expressionManager.expressionMap[N],ee=$._binds.map(te=>({mesh:0,index:te.index,weight:te.weight*100}));if(ee.length>0){let te=!1;for(const we in ai)if(N===ai[we]&&N!=="surprised"){u.push({name:N,presetName:che(N),binds:ee,isBinary:$.isBinary}),te=!0;break}te===!1&&u.push({name:N,presetName:"unknown",binds:ee,isBinary:$.isBinary})}}const I=(N,$,ee,te)=>{const we=[],Ce=[];for(let Ee=0;Ee0){const Ve=we.length%4,_e=Ve===0?0:4-Ve;if(_e>0)for(let ye=0;ye<_e;ye++)we.push(0),Ce.push(0,0,0);const re={targetMeshDataIndex:ve,count:we.length,indices:new Uint32Array(we),values:new Float32Array(Ce)};E.push(new oA(te,Tn.FLOAT,ee,na.VEC3,J.name,nU+$,re))}};for(const N in J.morphTargetDictionary){J.geometry.userData.targetNames.push(N);const $=J.morphTargetDictionary[N],ee=J.geometry.morphAttributes;I(ee.position[$].array,N,kt.BLEND_POSITION,ae.position),ee.normal&&I(ee.normal[$].array,N,kt.BLEND_NORMAL,ae.normal)}}),B.forEach(O=>{const J=O.type===Ai.Group?O.children[0]:O,ae=new Float32Array(J.skeleton.boneInverses.map(de=>de.elements).flat());E.push(new oA(new At(ae,16),Tn.FLOAT,kt.BIND_MATRIX,na.MAT4,J.name,J.name))}),Q.push(...E.map(O=>({byteOffset:0,componentType:O.valueType,count:O.attribute.count,max:O.max,min:O.min,normalized:!1,type:O.accessorsType})));const M=hhe(B,E,h);B.forEach((O,J)=>{Y.push({mesh:J,name:O.name,rotation:[O.quaternion.x,O.quaternion.y,O.quaternion.z,O.quaternion.w],scale:[O.scale.x,O.scale.y,O.scale.z],skin:J,translation:[O.position.x,O.position.y,O.position.z]})});const D=phe(B,E,Z),T={humanBones:[]};A.humanBones.forEach(O=>{Z.indexOf(O.node.name)!=-1&&T.humanBones.push({bone:uhe(O.bone),node:Z.indexOf(O.node.name),useDefaultValues:!0})});const V={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},G={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},P=[];d.forEach(O=>{O.type=="ShaderMaterial"?P.push(P.push(Object.assign({},V))):P.push(P.push(Object.assign({},G)))});const U=l;i.forEach(O=>{for(let J=0;JO.isSkinnedMesh))==null?void 0:qe.skeleton)||null;for(let O=0;O{const ve=de.sphere;ae.colliders.push({radius:ve.radius*o,offset:{x:ve.offset[0]*o,y:ve.offset[1]*o,z:ve.offset[2]*o}})}),H.push(ae)}}console.log("COLLIDER GROUPS",H);const k=O=>{for(let J=0;J{const J=k(O);if(J==-1)return[-1];{const ae=[];return R[J].traverse(ve=>{ve.isBone&&ae.push(k(ve.name))}),ae}},ne=[];i.forEach(O=>{var L;const J=K(O.name),ae=[];if(O.colliderGroups.forEach(_=>{const I=_.colliders[0];if(I!=null){const N=I.parent,$=H.findIndex(ee=>ee.name===N.name);$!=-1?ae.push($):console.warn("No collider group for bone name: ",N.name+" was found")}else console.log("No colliders definition were present in vrm file file for: ",O.name+" spring bones")}),J===[-1]){console.warn("No bone found for spring bone "+O.name);return}let de=k((L=O.center)==null?void 0:L.name);de==-1&&console.warn("no center bone for spring bone "+O.name);const ve=O.settings;ne.push({bones:J,center:de,colliderGroups:ae,dragForce:ve.dragForce,gravityDir:{x:ve.gravityDir.x,y:ve.gravityDir.y,z:ve.gravityDir.z},gravityPower:ve.gravityPower,hitRadius:ve.hitRadius,stiffiness:ve.stiffness})});const ie={boneGroups:ne,colliderGroups:H};console.log(ie),U.texture=p?C.length-1:void 0;const ue=[];ue.push(...w.map(O=>({buffer:yk(O.imageBitmap),type:kt.IMAGE}))),E.forEach((O,J)=>{O.buffer?ue.push({buffer:O.buffer,typeString:"",type:O.type}):O.sparse&&(ue.push({buffer:O.sparse.indices,typeString:"indices",type:O.type,count:O.sparse.count}),ue.push({buffer:O.sparse.values,typeString:"values",type:O.type}))}),p&&ue.push({buffer:yk(p.imageBitmap),type:kt.IMAGE});let j=0,se=0,ce=0,Be=0;const ge=ue.map(O=>{const J={buffer:0,byteLength:O.buffer.byteLength,byteOffset:j,target:O.type===kt.IMAGE||O.type===kt.BIND_MATRIX?void 0:O.type===kt.INDEX?Tn.ELEMENT_ARRAY_BUFFER:Tn.ARRAY_BUFFER};return j+=O.buffer.byteLength,O.type===kt.IMAGE?(C[se++].bufferView=Be,Be++):E[ce].sparse?(Q[ce].sparse==null&&(Q[ce].sparse={}),O.typeString==="indices"&&(Q[ce].sparse.count=O.count,Q[ce].sparse[O.typeString]={bufferView:Be,byteOffset:0,componentType:Tn.UNSIGNED_INT}),O.typeString==="values"&&(Q[ce].sparse[O.typeString]={bufferView:Be,byteOffset:0}),O.typeString==="values"&&ce++,Be++):(E[ce].bufferIndex=Be,Q[ce].bufferView=Be,ce++,Be++),J}),Fe=Bhe(t,Y);dhe(U);const nt={accessors:Q,asset:f,buffers:[{byteLength:j}],bufferViews:ge,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new X,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:P,humanoid:T,meta:U,secondaryAnimation:ie,specVersion:"0.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRM"],images:C,materials:x,meshes:M,nodes:Y,samplers:b,scenes:Fe,skins:D,textures:F};console.log(nt);const We=new Bk(iU(JSON.stringify(nt,void 0,2)),"JSON"),Te=new Bk(wg(ue.map(O=>O.buffer)),"BIN\0"),Qe=wg([We.buffer,Te.buffer]),Ge=wg([iU("glTF"),rU(2,4),rU(Qe.byteLength+12,4)]);a(wg([Ge,Qe]))}}function dhe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function SH(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>SH(e)).flat())}function yk(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Tn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Tn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Bk{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=wg([rU(r.byteLength,4),iU(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sp%3===0)),Math.max.apply(null,Array.from(A).filter((h,p)=>p%3===1)),Math.max.apply(null,Array.from(A).filter((h,p)=>p%3===2))]:void 0,this.min=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===0)),Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===1)),Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===2))]:void 0}else this.buffer=u1(this.attribute,this.valueType),this.max=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===2))]:void 0,this.min=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===2))]:void 0}}var Cd;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Cd||(Cd={}));var na;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(na||(na={}));var kt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(kt||(kt={}));var Ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Ai||(Ai={}));const hhe=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r,s=r.type===Ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(kt.SKIN_INDEX),NORMAL:a.indexOf(kt.NORMAL),POSITION:a.indexOf(kt.POSITION),TEXCOORD_0:a.indexOf(kt.UV),WEIGHTS_0:a.indexOf(kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(d=>d.type===kt.BLEND_NORMAL&&d.meshName===i.name?d.name:null).indexOf(nU+A),u=e.map(d=>d.type===kt.BLEND_POSITION&&d.meshName===i.name?d.name:null).indexOf(nU+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),phe=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),ghe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(h=>h.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const d=t;r=d.color?[d.color.r,d.color.g,d.color.b,1]:void 0}let s=-1;t.map?s=e.map(d=>d.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(d=>d.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(d=>d.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(d=>d.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const d=(()=>{switch(t.type){case Cd.MeshStandardMaterial:return t.metalness;case Cd.MeshBasicMaterial:return 0;default:return 0}})(),h=(()=>{switch(t.type){case Cd.MeshStandardMaterial:return t.roughness;case Cd.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=d,A.roughnessFactor=h}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(f.normalTexture=u),f}),mhe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),vhe=n=>n.map(()=>({magFilter:Tn.LINEAR,minFilter:Tn.LINEAR,wrapS:Tn.REPEAT,wrapT:Tn.REPEAT})),yhe=n=>n.map((e,t)=>({sampler:0,source:t})),Bhe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Ai.Object3D||r.type===Ai.SkinnedMesh||r.type===Ai.Group||r.type===Ai.Bone).map(r=>t.indexOf(r.name))}]};function _H(){return(_H=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let d=[],h=new DataView(new ArrayBuffer(24*n.levels.length)),p=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),g.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(Gp([new Uint8Array(Fr).buffer,m,h.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...d]))}var oU,aU,Ehe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},lU=new OffscreenCanvas(128,128),xk=lU.getContext("2d",{willReadFrequently:!0}),QH=typeof document>"u";function Uhe(n){return createImageBitmap(n).then(function(e){return lU.width=e.width,lU.height=e.height,xk.drawImage(e,0,0),xk.getImageData(0,0,e.width,e.height)})}function RH(n,e){return e===void 0&&(e={}),_he().then(function(t){var r=new t.BasisEncoder;return She(e,r),r.setTexType(oU.cBASISTexType2D),Che(n,ArrayBuffer)&&(n=new Blob([n])),Uhe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,aU.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=xhe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Fhe(l,{keepWriter:!0})}return a})})}function She(n,e){n===void 0&&(n={}),(n=whe({},Ehe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var f1=null;function _he(){return f1||(f1=new Promise(function(n,e){QH?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),f1}QH&&self.addEventListener("message",function(n){RH(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});function MH(n){const e=n.clone(),t=[];return n.traverse(r=>{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function Qhe(n){const e=MH(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=wH(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new gu,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Qr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Rhe(n,e,t){const r=await z_(n,t),i=await TH(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function Mhe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;The(n,e,r).then(a=>{DH(a,`${o}.vrm`),i()})})}async function The(n,e,t){const r=await z_(n,t);return TH(r,e,t)}function z_(n,e){const t=MH(n),{createTextureAtlas:r=!0}=e;return r?kde(t,e):(console.log("no atlas"),Tde(t,e))}async function Nhe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await z_(n,t):Qhe(n);Dhe(s).then(o=>{if(o instanceof ArrayBuffer)DH(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Vhe(a,`${r}.gltf`)}})}function Dhe(n){return new Promise(e=>new T_().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function khe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in km)if(s.bone.parent.name==km[o]){t.push(s);break}}),t}function TH(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1}=t;return new Promise(async a=>{const l=i?new fhe:new Sfe,A={...Phe(e),...jde(n,"CharacterCreator",s)};if(t.ktxCompression){console.log("ktx compression");for(let h=0;hw.toBlob(R)),F=await RH(b),x=new Blob(F,{type:"image/ktx2"}),S=await createImageBitmap(x);A.materials[h].map.source=S}}}}let c;n.traverse(h=>{h.isSkinnedMesh&&(c=h)}),(()=>{for(let h=0;h{h.updateMatrix(),h.updateMatrixWorld()}),c.skeleton.calculateInverses(),c.skeleton.computeBoneTexture(),c.skeleton.update()})(),c.skeleton.bones.filter(h=>h.name==="head")[0];const f=khe(e),d=[];l.parse(A,n,r,f,d,o,h=>{a(h)})})}function NH(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function Vhe(n,e){NH(new Blob([n],{type:"text/plain"}),e)}function DH(n,e){NH(Lhe(n),e)}function Lhe(n){return new Blob([n],{type:"application/octet-stream"})}function Phe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const Whe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?Ohe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Ghe(n):console.warn("No valid vrm file was provided")},Ohe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>kH(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=FH(t,u);if(f!=null){const d=c.colliders;f.userData.VRMcolliders=d.map(h=>({sphere:{radius:h.radius,offset:[h.offset.x,h.offset.y,h.offset.z]}}))}})},Ghe=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>kH(f.name,o));i!=null&&i.forEach(f=>{const d=Ht(f.colliders);let h=-1,p=null;d.forEach(m=>{if(h!=s[m].node){h=s[m].node;const g=a[h];p=FH(t,g),p.userData.VRMcolliders=[]}if(p!=null){const g=s[m].shape;for(const v in g){const y=g[v];y!=null&&y.offset&&(y.offset[0]=-y.offset[0])}p.userData.VRMcolliders.push(g)}else console.error("no node with name "+a[h]+" was found")})})},kH=(n,e)=>{const t=Bt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},Ww=[0,400,560,2400,4800],Ow=[0,500,700,3e3,6e3],AU=[],rl=[],Y_=1024,VH=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=Gw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=Y_,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Gw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ai.Oh,0),this.vrm.expressionManager.setValue(ai.Ah,0),this.vrm.expressionManager.setValue(ai.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ai.Oh,i),this.vrm.expressionManager.setValue(ai.Ah,r),this.vrm.expressionManager.setValue(ai.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=rl[A+1]-rl[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=rl[A+1]-rl[A],s[A]=s[A]/(AU[A+1]-AU[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const d1=new X;class Zhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Oe,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){d1.set(0,0,1),d1.applyQuaternion(this.camera.quaternion);const e=d1.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class h1{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:d,blinkerTraits:h,typeRestrictions:p,defaultCullingLayer:m,defaultCullingDistance:g,offset:v,vrmMeta:y,traits:w,textureCollections:C,colorCollections:b,canDownload:F=!0,downloadOptions:x={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=Ht(o),this.requiredTraits=Ht(c),this.randomTraits=Ht(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=Ht(f),this.lipSyncTraits=Ht(d),this.blinkerTraits=Ht(h),this.typeRestrictions=p,this.defaultCullingLayer=m,this.defaultCullingDistance=g,this.offset=v,this.canDownload=F,this.downloadOptions=x;const S=()=>{const Y=[];for(const Q in w)Y.push(w[Q].trait);return Y};this.allTraits=S(),S(),(()=>{if(this.typeRestrictions)for(const Y in this.typeRestrictions)Ht(this.typeRestrictions[Y]).forEach(B=>{this.typeRestrictions[B]==null&&(this.typeRestrictions[B]=[]),this.typeRestrictions[B].indexOf(Y)==-1&&this.typeRestrictions[B].push(Y)})})(),(()=>{x.vrmMeta=x.vrmMeta||y,x.scale=x.scale||a||1,x.mToonAtlasSize=x.mToonAtlasSize||2048,x.mToonAtlasSizeTransp=x.mToonAtlasSizeTransp||1024,x.stdAtlasSize=x.stdAtlasSize||2048,x.stdAtlasSizeTransp=x.stdAtlasSizeTransp||1024,x.exportStdAtlas=x.exportStdAtlas||!1,x.exportMtoonAtlas=x.exportMtoonAtlas||!0,x.screenshotFaceDistance=x.screenshotFaceDistance||1,x.screenshotFaceOffset=x.screenshotFaceOffset||[0,0,0],x.screenshotResolution=x.screenshotResolution||[512,512],x.screenshotBackground=x.screenshotBackground||[.1,.1,.1],x.screenshotFOV=x.screenshotFOV||75,!x.exportStdAtlas&&!x.exportMtoonAtlas&&(x.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(C),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(w)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=Ht(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new p1(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new p1(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new p1(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),Ht(e).forEach(r=>{this.modelTraits.push(new Jhe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),Ht(e).forEach(r=>{this.textureTraits.push(new Hhe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),Ht(e).forEach(r=>{this.colorTraits.push(new zhe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class Jhe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Ik(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Ik(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class Hhe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Yhe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class zhe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Xhe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Ik{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let h=0;h0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class Yhe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(qa)}),qa.z+=.3,qa.y+=s,this.screenshotManager.setCamera(qa,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var p,m;const u=A.object,f=A.face,d=[f.a,f.b,f.c],h=(m=(p=u.userData)==null?void 0:p.clippedIndexGeometry)==null?void 0:m.array;if(h!=null){const g=o(h,d),v=Array.from(h);if(g==-1&&!c){const y=[...v,...d];u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1)}g!=1&&c&&(v.splice(g,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(v),1,!1))}};g1.x=e,g1.y=t,i(),Fk.setFromCamera(g1,this.renderCamera);const l=Fk.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new hB({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await Mhe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Nhe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&(this.screenshotManager.scene=this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(Ht(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getTraitOption(e,t);s&&(await this._loadTraits(Ht(s)),r())}catch(s){console.error("Error loading specific trait:",s.message),i(new Error("Failed to load specific trait."))}else{const s="No manifest was loaded, specific trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(Ht(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await Ode(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Re(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Re(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new hB({traitGroupID:e,traitModel:null});this._addLoadedData(i),A1(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){A1(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new h1(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new h1(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new h1(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async _loadTraits(e,t=!1){await this.traitLoadManager.loadTraitOptions(Ht(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new hB({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),A1(this.avatar)})}async _animationManagerSetup(e,t,r){const i=Ht(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(d=>d.name==="head")[0].getWorldPosition(qa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];qa.x+=s[0],qa.y+=s[1],qa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(qa,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupScreenshotManager(){this.parentModel?this.screenshotManager.scene=this.parentModel:this.screenshotManager.scene=this.rootModel}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Re(o,a,l)},r=new ss({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;return e.userData.vrm==null?(console.error("No valid VRM was provided for "+r+" trait, skipping file."),null):(hk(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Whe(e),Kde(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Gw(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"&&o.scene.traverse(A=>{if(A.isSkinnedMesh){Yh.rotateVRM0(o),console.log("Loaded VRM0 file ",o);for(let c=0;c{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);hk(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const d=i[f]||i[0];d!=null&&(u.material.type==="MeshStandardMaterial"?Array.isArray(u.material)?u.material.forEach(h=>{h.map=d}):u.material.map=d:console.warn("XXX set material texture to shader material",u.material))}if(s){const d=s[f]||s[0];d!=null&&(u.material[0].uniforms.litFactor.value=d,u.material[0].uniforms.shadeColorFactor.value=new Re(d.r*.8,d.g*.8,d.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),Xde(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class jhe{constructor(){const e=new fZ;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new B_(e);t.crossOrigin="anonymous",t.register(i=>new bfe(i,{autoUpdateHumanBones:!0}));const r=new Qu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(Ht((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async d=>{try{return await this.gltfLoader.loadAsync(d)}catch(h){return console.error(`Error loading modelsss ${d}:`,h),null}})),l=await Promise.all(Ht((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(d=>new Promise(h=>{this.textureLoader.load(d,p=>{p.flipY=!1,p.encoding=ht,h(p)},null,p=>{console.error("error loading texture: ",p),h(null)})}))),A=Ht((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(d=>new Re(d));r[o]=new hB({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class hB{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function $he(n){const e=new gw,t=new pZ(16777215,.5);e.add(t);const r=new m_(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new Nt;e.add(i);const s=new _r(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Khe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new HC({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new die(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new X(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new X(-.5,0,-.5),u=new X(.5,1.5,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=ht;const d=()=>{requestAnimationFrame(d),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};d();const h=m=>{const g=m.ctrlKey,v=a.getBoundingClientRect(),y=(m.clientX-v.left)/v.width*2-1,w=-((m.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(y,w,g)};async function p(){const m="./3d/Platform.glb",v=await new B_().loadAsync(m);i.add(v.scene)}return p(),a.addEventListener("click",h),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}const qr=me.createContext(),qhe=n=>{const[e,t]=me.useState(null),[r,i]=me.useState(null),[s,o]=me.useState(null),[a,l]=me.useState(null),[A,c]=me.useState(null),[u,f]=me.useState(null),[d,h]=me.useState(null),[p,m]=me.useState(null),[g,v]=me.useState(!1);let y=!1,[w,C]=me.useState(!1);me.useEffect(()=>{if(y||w)return;C(!0),y=!0;const{scene:S,camera:R,controls:Z,characterManager:Y,sceneElements:Q}=$he("editor-scene");f(R),c(S),t(Y),i(Q),o(Y.animationManager),l(Y.lookAtManager),h(Z)},[]);const b=S=>{S==null&&(S=!g),v(S),A.traverse(R=>{R.isMesh&&R.setDebugMode&&R.setDebugMode(S)})},F=S=>{S?A.add(r):A.remove(r)},x=S=>{d&&(lE.to(d.target,{x:S.targetX??0,y:S.targetY??0,z:S.targetZ??0,duration:1}),lE.fromTo(d,{maxDistance:d.getDistance(),minDistance:d.getDistance(),minPolarAngle:d.getPolarAngle(),maxPolarAngle:d.getPolarAngle(),minAzimuthAngle:d.getAzimuthalAngle(),maxAzimuthAngle:d.getAzimuthalAngle()},{maxDistance:S.distance,minDistance:S.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{d.minPolarAngle=0,d.maxPolarAngle=3.1415,d.minDistance=.5,d.maxDistance=10,d.minAzimuthAngle=1/0,d.maxAzimuthAngle=1/0}))};return W.jsx(qr.Provider,{value:{manifest:p,setManifest:m,scene:A,characterManager:e,showEnvironmentModels:F,debugMode:g,toggleDebugMode:b,animationManager:s,lookAtManager:a,camera:u,moveCamera:x,controls:d},children:n.children})},epe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},st={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",BIO:"BIO",SAVE:"SAVE",MINT:"MINT",CHAT:"CHAT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},gi=z.createContext(),tpe=n=>{const[e,t]=z.useState(epe.NORMAL),[r,i]=z.useState(st.LANDING),[s,o]=z.useState(!1),[a,l]=z.useState(!1);return W.jsx(gi.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},npe="modulepreload",rpe=function(n){return"/CharacterStudio/"+n},Ek={},ipe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=rpe(s),s in Ek)return;Ek[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":npe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function Zw(){return Zw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function ope(n){me.useEffect(n,[])}function ape(n,e){e===void 0&&(e={});var t=e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,f=spe(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),d=z.useRef(null),h=z.useRef(!1),p=z.useState(null),m=p[0],g=p[1],v=z.useState(null),y=v[0],w=v[1],C=function(){typeof u=="function"&&u.call(this),h.current&&g(this.duration()*1e3),w(this)};ope(function(){return ipe(()=>import("./howler-b02193e5.js").then(R=>R.h),[]).then(function(R){if(!h.current){var Z;d.current=(Z=R.Howl)!==null&&Z!==void 0?Z:R.default.Howl,h.current=!0,new d.current(Zw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:C},f))}}),function(){h.current=!1}}),z.useEffect(function(){d.current&&y&&w(new d.current(Zw({src:Array.isArray(n)?n:[n],volume:i,onload:C},f)))},[JSON.stringify(n)]),z.useEffect(function(){y&&(y.volume(i),y.rate(o))},[i,o]);var b=z.useCallback(function(R){typeof R>"u"&&(R={}),!(!y||!l&&!R.forceSoundEnabled)&&(c&&y.stop(),R.playbackRate&&y.rate(R.playbackRate),y.play(R.id))},[y,l,c]),F=z.useCallback(function(R){y&&y.stop(R)},[y]),x=z.useCallback(function(R){y&&y.pause(R)},[y]),S=[b,{sound:y,stop:F,pause:x,duration:m}];return S}const lpe=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],Ape="/CharacterStudio/assets/sounds-3322d50e.mp3",ys=me.createContext(),cpe=n=>{const e=i=>lpe.find(s=>i.test(s.name)),[t]=ape(Ape,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return W.jsx(ys.Provider,{value:{playSound:r},children:n.children})};function Ks(n){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(n)}function lo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function upe(n,e){if(Ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function LH(n){var e=upe(n,"string");return Ks(e)=="symbol"?e:String(e)}function Uk(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){zo.copy(this._currentTail).sub(this._currentOffset);const e=zo.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(zo.y,Math.sqrt(zo.x*zo.x+zo.z*zo.z)),r=-Math.atan2(zo.z,zo.x);this.rotateZ(t),this.rotateY(r),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class cfe extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const ufe=new X;class JD extends Qr{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof cH)this._geometry=new cfe(this.collider.shape);else if(this.collider.shape instanceof AH)this._geometry=new Afe(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Pl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new A0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ufe.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class ffe extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const dfe=new X;class hfe extends Qr{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new ffe(this.springBone);const t=new Pl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new A0(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=dfe.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class HD extends Nt{constructor(e){super(),this.shape=e}}const pfe=new Le;function uH(n){return n.invert?n.invert():n.getInverse(pfe.copy(n)),n}class gfe{constructor(e){this._inverseCache=new Le,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),uH(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const mfe=new Le,Ka=new X,Dp=new X,vfe=new X,mf=new X,zD=new X,kp=new X,YD=new et,vf=new Le,yfe=new Le;class Bfe{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Le,this._initialLocalRotation=new et,this._initialLocalChildPosition=new X,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new X(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new gfe(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:mfe}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const e=this._getMatrixWorldToCenter(vf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const e=this._getMatrixWorldToCenter(vf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),mf.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(vf);zD.copy(mf).applyMatrix4(t);const r=YD.setFromRotationMatrix(t),i=yfe.copy(t).multiply(this._parentMatrixWorld),s=Dp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(zD).normalize(),o=vfe.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(vf);kp.copy(this._currentTail).add(Ka.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Ka.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Ka.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),kp.sub(mf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(mf),this._collision(kp),t=this._getMatrixWorldToCenter(vf),this._prevTail.copy(this._currentTail),this._currentTail.copy(Ka.copy(kp).applyMatrix4(t));const l=uH(vf.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=YD.setFromUnitVectors(this._boneAxis,Ka.copy(kp).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Ka);i<0&&(e.add(Ka.multiplyScalar(-i)),e.sub(mf).normalize().multiplyScalar(this._worldSpaceBoneLength).add(mf))})})}_calcWorldSpaceBoneLength(){Ka.setFromMatrixPosition(this.bone.matrixWorld),this.child?Dp.setFromMatrixPosition(this.child.matrixWorld):(Dp.copy(this._initialLocalChildPosition),Dp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Ka.sub(Dp).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function ty(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function wfe(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function fH(n,e){n.children.forEach(t=>{e(t)||fH(t,e)})}class XD{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),fH(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)wfe(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const Cfe=new Set(["1.0","1.0-beta"]);class Xc{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Xc.EXTENSION_NAME}afterRoot(e){return ty(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return ty(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return ty(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Xc.EXTENSION_NAME))!==-1))return null;const A=new XD,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Xc.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!Cfe.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Xc.EXTENSION_NAME} specVersion "${f}"`),null;const d=(i=u.colliders)===null||i===void 0?void 0:i.map((p,m)=>{var g,v,y,w,C;const b=c[p.node],F=p.shape;if(F.sphere)return this._importSphereCollider(b,{offset:new X().fromArray((g=F.sphere.offset)!==null&&g!==void 0?g:[0,0,0]),radius:(v=F.sphere.radius)!==null&&v!==void 0?v:0});if(F.capsule)return this._importCapsuleCollider(b,{offset:new X().fromArray((y=F.capsule.offset)!==null&&y!==void 0?y:[0,0,0]),radius:(w=F.capsule.radius)!==null&&w!==void 0?w:0,tail:new X().fromArray((C=F.capsule.tail)!==null&&C!==void 0?C:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${m} has no valid shape`)}),h=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((p,m)=>{var g;return{colliders:((g=p.colliders)!==null&&g!==void 0?g:[]).map(y=>{const w=d==null?void 0:d[y];if(w==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${m} attempted to use a collider #${y} but not found`);return w}),name:p.name}});return(o=u.springs)===null||o===void 0||o.forEach((p,m)=>{var g;const v=p.joints,y=(g=p.colliderGroups)===null||g===void 0?void 0:g.map(b=>{const F=h==null?void 0:h[b];if(F==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${b} but not found`);return F}),w=p.center!=null?c[p.center]:void 0;let C;v.forEach(b=>{if(C){const F=C.node,x=c[F],S=b.node,R=c[S],Z={hitRadius:C.hitRadius,dragForce:C.dragForce,gravityPower:C.gravityPower,stiffness:C.stiffness,gravityDir:C.gravityDir!=null?new X().fromArray(C.gravityDir):void 0},Y=this._importJoint(x,R,Z,y);w&&(Y.center=w),A.addJoint(Y)}C=b})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return ty(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new XD,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(d=>{var h;const p=u[d.node];return{colliders:((h=d.colliders)!==null&&h!==void 0?h:[]).map((g,v)=>{var y,w,C;const b=new X(0,0,0);return g.offset&&b.set((y=g.offset.x)!==null&&y!==void 0?y:0,(w=g.offset.y)!==null&&w!==void 0?w:0,g.offset.z?-g.offset.z:0),this._importSphereCollider(p,{offset:b,radius:(C=g.radius)!==null&&C!==void 0?C:0})})}});return A==null||A.forEach((d,h)=>{const p=d.bones;p&&p.forEach(m=>{var g,v,y,w;const C=u[m],b=new X;d.gravityDir?b.set((g=d.gravityDir.x)!==null&&g!==void 0?g:0,(v=d.gravityDir.y)!==null&&v!==void 0?v:0,(y=d.gravityDir.z)!==null&&y!==void 0?y:0):b.set(0,-1,0);const F=d.center!=null?u[d.center]:void 0,x={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:b},S=(w=d.colliderGroups)===null||w===void 0?void 0:w.map(R=>{const Z=f==null?void 0:f[R];if(Z==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${h} attempted to use a colliderGroup ${R} but not found`);return Z});C.traverse(R=>{var Z;const Y=(Z=R.children[0])!==null&&Z!==void 0?Z:null,Q=this._importJoint(R,Y,x,S);F&&(Q.center=F),c.addJoint(Q)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Bfe(e,t,r,i);if(this.jointHelperRoot){const o=new hfe(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new cH({offset:r,radius:i}),o=new HD(s);if(e.add(o),this.colliderHelperRoot){const a=new JD(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new AH({offset:r,radius:i,tail:s}),a=new HD(o);if(e.add(a),this.colliderHelperRoot){const l=new JD(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Xc.EXTENSION_NAME="VRMC_springBone";class bfe{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const d=t==null?void 0:t.helperRoot,h=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new lb(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new nue(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new Aue(e,{helperRoot:d,autoUpdateHumanBones:h}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new bue(e,{helperRoot:d}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new Fue(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new Wd(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new Vm(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new Oue(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Xc(e,{colliderHelperRoot:d,jointHelperRoot:d}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Yc(e,{helperRoot:d})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return ey(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return ey(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return ey(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return ey(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new Uue({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function KD(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function xfe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>KD(i)):r&&KD(r))}function Ife(n){n.traverse(xfe)}function Ffe(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(p=>{u.addGroup(p.start,p.count,p.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],d=[];{const p=A.array,m=new p.constructor(p.length);let g=0;for(let v=0;v{const m=l.attributes[p];if(m.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const g=m.array,{itemSize:v,normalized:y}=m,w=new g.constructor(d.length*v);d.forEach((C,b)=>{for(let F=0;F{u.morphAttributes[p]=[];const m=l.morphAttributes[p];for(let g=0;g{for(let S=0;SF===0),u.morphAttributes[p][g]=new At(b,w,C)}}),h&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function Ufe(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Yh{constructor(){}}Yh.deepDispose=Ife;Yh.removeUnnecessaryJoints=Ffe;Yh.removeUnnecessaryVertices=Efe;Yh.rotateVRM0=Ufe;var Xn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Xn||(Xn={}));const kw="blend_",jD="vrmColliderSphere";class Sfe{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=a.filter((j,se,ce)=>ce.findIndex(Be=>Be.name===j.name.replace(" (Outline)",""))===se).map(j=>j),h=d.map(j=>j.name),p=r?{name:"icon",imageBitmap:r.image}:null,m=d.filter(j=>j.map).map(j=>{if(!j.map)throw new Error(j.name+" map is null");return{name:j.name,imageBitmap:j.map.image}}),g=d.filter(j=>j.userData.shadeTexture).map(j=>{if(!j.userData.shadeTexture)throw new Error(j.userData.shadeTexture+" map is null");return{name:j.name+"_shade",imageBitmap:j.userData.shadeTexture.image}}),v=m.concat(g),y=Tfe(v,p),w=Nfe(y),C=Dfe(y),b=Mfe(d,v),F=t.children.filter(j=>j.children.length>0&&j.children[0].type===li.Bone)[0],x=dH(F).filter(j=>j.name!==jD),S=x.map(j=>j.name),R=x.map(j=>({children:j.children.filter(se=>se.name!==jD).map(se=>S.indexOf(se.name)),name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],translation:[j.position.x,j.position.y,j.position.z]})),Z=[],Y=t.children.filter(j=>j.type===li.Group||j.type===li.SkinnedMesh),Q=[];Y.forEach(j=>{const se=j.type===li.Group?j.children[0]:j,ce=se.geometry.attributes;Q.push(new ja(ce.position,Xn.FLOAT,Kt.POSITION,xo.VEC3,se.name,void 0)),Q.push(new ja(ce.normal,Xn.FLOAT,Kt.NORMAL,xo.VEC3,se.name,void 0)),Q.push(new ja(ce.uv,Xn.FLOAT,Kt.UV,xo.VEC2,se.name,void 0)),Q.push(new ja(ce.skinWeight,Xn.FLOAT,Kt.SKIN_WEIGHT,xo.VEC4,se.name,void 0)),Q.push(new ja(ce.skinIndex,Xn.UNSIGNED_SHORT,Kt.SKIN_INDEX,xo.VEC4,se.name,void 0)),(j.type===li.Group?j.children.map(ge=>ge):[j]).forEach(ge=>{if(!ge.geometry.index)throw new Error(ge.name+" geometry.index is null");Q.push(new ja(ge.geometry.index,Xn.UNSIGNED_INT,Kt.INDEX,xo.SCALAR,se.name,ge.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];for(const ge in e.expressionManager.expressionMap){const Fe=e.expressionManager.expressionMap[ge],nt=Fe._binds.map(Te=>({node:x.length,index:Te.index,weight:Te.weight}));let We=!1;for(const Te in ai)if(ge.toLowerCase()===ai[Te].toLowerCase()){l[ai[Te]]={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth},We=!0;break}!We&&ge.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth},We=!0),We===!1&&(A[ge]={morphTargetBinds:nt,isBinary:Fe.isBinary,overrideBlink:Fe.overrideBlink,overrideLookAt:Fe.overrideLookAt,overrideMouth:Fe.overrideMouth})}for(const ge in se.morphTargetDictionary){se.geometry.userData.targetNames.push(ge);const Fe=se.morphTargetDictionary[ge],nt=se.geometry.morphAttributes;Q.push(new ja(nt.position[Fe],Xn.FLOAT,Kt.BLEND_POSITION,xo.VEC3,se.name,kw+ge)),Q.push(new ja(nt.normal[Fe],Xn.FLOAT,Kt.BLEND_NORMAL,xo.VEC3,se.name,kw+ge))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),Y.forEach(j=>{const se=j.type===li.Group?j.children[0]:j,ce=new Float32Array(se.skeleton.boneInverses.map(Be=>Be.elements).flat());Q.push(new ja(new At(ce,16),Xn.FLOAT,Kt.BIND_MATRIX,xo.MAT4,se.name,se.name))}),Z.push(...Q.map(j=>({bufferView:-1,byteOffset:0,componentType:j.valueType,count:j.attribute.count,max:j.max,min:j.min,normalized:!1,type:j.accessorsType})));const B=Qfe(Y,Q,h);Y.forEach((j,se)=>{R.push({mesh:se,name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],skin:se,translation:[j.position.x,j.position.y,j.position.z]})});const E=Rfe(Y,Q,S),M={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},D={humanBones:{}};for(const j in s.humanBones)D.humanBones[j]={node:S.indexOf(s.humanBones[j].node.name)};const T=o,V=[];V.push(...v.map(j=>({buffer:$D(j.imageBitmap),type:Kt.IMAGE}))),V.push(...Q.map(j=>({buffer:j.buffer,type:j.type}))),p&&V.push({buffer:$D(p.imageBitmap),type:Kt.IMAGE});let G=0,P=0,U=0;const H=V.map((j,se)=>{const ce={buffer:0,byteLength:j.buffer.byteLength,byteOffset:G,target:j.type===Kt.IMAGE||j.type===Kt.BIND_MATRIX?void 0:j.type===Kt.INDEX?Xn.ELEMENT_ARRAY_BUFFER:Xn.ARRAY_BUFFER};return G+=j.buffer.byteLength,j.type===Kt.IMAGE?y[P++].bufferView=se:Z[U++].bufferView=se,ce}),oe=kfe(t,R),k={accessors:Z,asset:f,buffers:[{byteLength:G}],bufferViews:H,extensions:{VRMC_vrm:{expressions:c,humanoid:D,lookAt:M,meta:T,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:y,materials:b,meshes:B,nodes:R,samplers:w,avatar:0,scenes:oe,skins:E,textures:C},K=new qD(XE(JSON.stringify(k,void 0,2)),"JSON"),ne=new qD(vg(V.map(j=>j.buffer)),"BIN\0"),ie=vg([K.buffer,ne.buffer]),ue=vg([XE("glTF"),YE(2,4),YE(ie.byteLength+12,4)]);i(vg([ue,ie]))}}function dH(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>dH(e)).flat())}function $D(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Xn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Xn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let qD=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=vg([YE(r.byteLength,4),XE(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===Kt.POSITION||r===Kt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Bd;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Bd||(Bd={}));var xo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(xo||(xo={}));var Kt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(Kt||(Kt={}));var li;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(li||(li={}));const Qfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r,s=r.type===li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Kt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(kw+A),POSITION:e.map(c=>c.type===Kt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(kw+A)})):void 0}})}}),Rfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Mfe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Bd.MeshStandardMaterial:return t.metalness;case Bd.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Bd.MeshStandardMaterial:return t.roughness;case Bd.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Tfe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Nfe=n=>n.map(()=>({magFilter:Xn.LINEAR,minFilter:Xn.LINEAR,wrapS:Xn.REPEAT,wrapT:Xn.REPEAT})),Dfe=n=>n.map((e,t)=>({sampler:0,source:t})),kfe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===li.Object3D||r.type===li.SkinnedMesh||r.type===li.Group||r.type===li.Bone).map(r=>t.indexOf(r.name))}]},hH=0,Vfe=1,pH=2,ek=2,t1=1.25,tk=1,uB=6*4+4+4,KE=65535,Lfe=Math.pow(2,-24);class ny{constructor(){}}function ua(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function nk(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function rk(n,e){e.set(n)}function ik(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function ry(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Vp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}function Pfe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=F),g&&wh&&(h=w);const x=n[v+2],S=n[v+3],R=x-S,Z=x+S;RA&&(A=Z),g&&xp&&(p=x);const Y=n[v+4],Q=n[v+5],B=Y-Q,E=Y+Q;Bc&&(c=E),g&&Ym&&(m=Y)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,g&&(i[0]=u,i[1]=f,i[2]=d,i[3]=h,i[4]=p,i[5]=m)}function Ofe(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const d=n[c+2];dl&&(l=d);const h=n[c+4];hA&&(A=h)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Gfe(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,sA=new Array(nl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),iy=new Float32Array(6);function Jfe(n,e,t,r,i,s){let o=-1,a=0;if(s===hH)o=nk(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Vfe)o=nk(n),o!==-1&&(a=Hfe(t,r,i,o));else if(s===pH){const l=Vp(n);let A=t1*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const d=e[f],m=(e[f+3]-d)/nl;if(i=F.candidate?ry(w,t,F.rightCacheBounds):(ry(w,t,F.leftCacheBounds),F.count++)}}for(let w=0;w=nl&&(b=nl-1);const F=sA[b];F.count++,ry(y,t,F.bounds)}const g=sA[nl-1];rk(g.bounds,g.rightCacheBounds);for(let y=nl-2;y>=0;y--){const w=sA[y],C=sA[y+1];ik(w.bounds,C.rightCacheBounds,w.rightCacheBounds)}let v=0;for(let y=0;yb&&(b=y),w>b&&(b=w);const F=(b-C)/2,x=g*2;s[d+x+0]=C+F,s[d+x+1]=F+(Math.abs(C)+F)*Lfe,Ce[g+3]&&(e[g+3]=b)}}return s}function Yfe(n,e){function t(g){f&&f(g/d)}function r(g,v,y,w=null,C=0){if(!h&&C>=l&&(h=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),y<=c||C>=l)return t(v+y),g.offset=v,g.count=y,g;const b=Jfe(g.boundingData,w,o,v,y,u);if(b.axis===-1)return t(v+y),g.offset=v,g.count=y,g;const F=Gfe(a,o,v,y,b);if(F===v||F===v+y)t(v+y),g.offset=v,g.count=y;else{g.splitAxis=b.axis;const x=new ny,S=v,R=F-v;g.left=x,x.boundingData=new Float32Array(6),n1(o,S,R,x.boundingData,s),r(x,S,R,s,C+1);const Z=new ny,Y=F,Q=y-R;g.right=Z,Z.boundingData=new Float32Array(6),n1(o,Y,Q,Z.boundingData,s),r(Z,Y,Q,s,C+1)}return g}Pfe(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=zfe(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,d=n.index.count/3;let h=!1;const p=[],m=Wfe(n);if(m.length===1){const g=m[0],v=new ny;v.boundingData=i,Ofe(o,g.offset,g.count,s),r(v,g.offset,g.count,s),p.push(v)}else for(let g of m){const v=new ny;v.boundingData=new Float32Array(6),n1(o,g.offset,g.count,v.boundingData,s),r(v,g.offset,g.count,s),p.push(v)}return p}function Xfe(n,e){const t=Yfe(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=y/4,y=A(y,g),i[f+7]=v,y}}}class Dl{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}Dl.prototype.setFromBox=function(){const n=new X;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Kfe=function(){const n=new X,e=new X,t=new X;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),d=c.dot(c),h=t.dot(l),m=l.dot(l)*d-f*f;let g,v;m!==0?g=(u*f-h*d)/m:g=0,v=(u+g*f)/d,o.x=g,o.y=v}}(),J_=function(){const n=new Oe,e=new X,t=new X;return function(i,s,o,a){Kfe(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,d=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=d.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(d);return}}}}(),jfe=function(){const n=new X,e=new X,t=new dl,r=new xl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const p=o.getPlane(t);if(Math.abs(p.distanceToPoint(l))<=a){const g=p.projectPoint(l,e);if(o.containsPoint(g))return!0}return!1}}(),$fe=1e-15;function yf(n){return Math.abs(n)<$fe}class kl extends ts{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new X),this.satBounds=new Array(4).fill().map(()=>new Dl),this.points=[this.a,this.b,this.c],this.sphere=new Su,this.plane=new dl,this.needsUpdate=!0}intersectsSphere(e){return jfe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const d=s[3],h=o[3];d.subVectors(r,e),h.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}kl.prototype.closestPointToSegment=function(){const n=new X,e=new X,t=new xl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const d=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[d]),J_(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const v=this.satBounds,y=this.satAxes;t[0]=d.a,t[1]=d.b,t[2]=d.c;for(let b=0;b<4;b++){const F=v[b],x=y[b];if(r.setFromPoints(x,t),F.isSeparated(r))return!1}const w=d.satBounds,C=d.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let b=0;b<4;b++){const F=w[b],x=C[b];if(r.setFromPoints(x,e),F.isSeparated(r))return!1}for(let b=0;b<4;b++){const F=y[b];for(let x=0;x<4;x++){const S=C[x];if(s.crossVectors(F,S),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return h&&(p||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),h.start.set(0,0,0),h.end.set(0,0,0)),!0}else{const v=this.points;let y=!1,w=0;for(let B=0;B<3;B++){const E=v[B],M=v[(B+1)%3];A.start.copy(E),A.end.copy(M),A.delta(o);const D=y?c.start:c.end,T=yf(g.distanceToPoint(E));if(yf(g.normal.dot(o))&&T){c.copy(A),w=2;break}if((g.intersectLine(A,D)||T)&&!yf(D.distanceTo(M))){if(w++,y)break;y=!0}}if(w===1&&d.containsPoint(c.end))return h&&(h.start.copy(c.end),h.end.copy(c.end)),!0;if(w!==2)return!1;const C=d.points;let b=!1,F=0;for(let B=0;B<3;B++){const E=C[B],M=C[(B+1)%3];A.start.copy(E),A.end.copy(M),A.delta(a);const D=b?u.start:u.end,T=yf(m.distanceToPoint(E));if(yf(m.normal.dot(a))&&T){u.copy(A),F=2;break}if((m.intersectLine(A,D)||T)&&!yf(D.distanceTo(M))){if(F++,b)break;b=!0}}if(F===1&&this.containsPoint(u.end))return h&&(h.start.copy(u.end),h.end.copy(u.end)),!0;if(F!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let B=u.start;u.start=u.end,u.end=B}const x=c.start.dot(o),S=c.end.dot(o),R=u.start.dot(o),Z=u.end.dot(o),Y=S0?h.start.copy(c.start):h.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?h.end.copy(c.end):h.end.copy(u.end)),!0)}}}();kl.prototype.distanceToPoint=function(){const n=new X;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();kl.prototype.distanceToTriangle=function(){const n=new X,e=new X,t=["a","b","c"],r=new xl,i=new xl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const d=t[u],h=o[d];this.closestPointToPoint(h,n),f=h.distanceToSquared(n),fnew X),this.satAxes=new Array(3).fill().map(()=>new X),this.satBounds=new Array(3).fill().map(()=>new Dl),this.alignedSatBounds=new Array(3).fill().map(()=>new Dl),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Ra.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,d=i[f];d.x=A?r.x:t.x,d.y=c?r.y:t.y,d.z=u?r.z:t.z,d.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let A=0;A<3;A++){const c=o[A],u=s[A],f=1<new xl),t=new Array(12).fill().map(()=>new xl),r=new X,i=new X;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,d=this.points;let h=1/0;for(let m=0;m<8;m++){const g=d[m];i.copy(g).clamp(u,f);const v=g.distanceToSquared(i);if(vt.far)?null:n}function oa(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(A),o.y=r.getY(A),o.z=r.getZ(A)}function ck(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let d,h;f?(d=Pm(n),h=Wm(n,a)):(d=Wm(n,a),h=Pm(n));const m=Lw(d,s,r,Vw)?$E(d,e,t,r):null;if(m){const y=m.point[c];if(f?y<=s[h+A]:y>=s[h+A+3])return m}const v=Lw(h,s,r,Vw)?$E(h,e,t,r):null;return m&&v?m.distance<=v.distance?m:v:m||v||null}}const sde=function(){let n,e;const t=[],r=new mH(()=>new ao);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(y){let w=y*2,C=GA,b=ZA;for(;!vA(w,C);)y=Pm(y),w=y*2;return Od(y,b)}function d(y){let w=y*2,C=GA,b=ZA;for(;!vA(w,C);)y=Wm(y,b),w=y*2;return Od(y,b)+Lm(w,C)}let h=s*2,p=Xh,m=GA,g=ZA;if(vA(h,m)){const y=Od(s,g),w=Lm(h,m);return ua(s,p,n),l(y,w,!1,u,c+s,n)}else{const y=Pm(s),w=Wm(s,g);let C=y,b=w,F,x,S,R;if(A&&(S=n,R=e,ua(C,p,S),ua(b,p,R),F=A(S),x=A(R),xi.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(A),x.b.applyMatrix4(A),x.c.applyMatrix4(A),x.needsUpdate=!0;for(let S=C*3,R=(b+C)*3;Snew kl);class Jg{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),Jg.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),Jg.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new Jg(t,{...r,[r1]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:hH,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[r1]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[r1]||(this._roots=Xfe(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ao))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,d=c.length;fb&&(b=Y),QF&&(F=Q),Bx&&(x=B)}return l[f+0]!==y||l[f+1]!==w||l[f+2]!==C||l[f+3]!==b||l[f+4]!==F||l[f+5]!==x?(l[f+0]=y,l[f+1]=w,l[f+2]=C,l[f+3]=b,l[f+4]=F,l[f+5]=x,!0):!1}else{const g=f+8,v=o[f+6],y=g+d,w=v+d;let C=h,b=!1,F=!1;e?C||(b=e.has(y),F=e.has(w),C=!b&&!F):(b=!0,F=!0);const x=C||b,S=C||F;let R=!1;x&&(R=u(g,d,C));let Z=!1;S&&(Z=u(v,d,C));const Y=R||Z;if(Y)for(let Q=0;Q<3;Q++){const B=g+Q,E=v+Q,M=l[B],D=l[B+3],T=l[E],V=l[E+3];l[f+Q]=MV?D:V}return Y}}}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const A=a*2,c=s[A+15]===KE;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+uB/4,f=i[a+6],d=i[a+7];e(l,c,new Float32Array(r,a*4,6),d)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=Sa){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const g=h*3;return f(d,g,g+1,g+2,p,m)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Yo.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(d,h,p,m,g)=>f(d,h,p,m,g)?!0:ck(d,h,i,A,p,m,s)}else l||(A?l=(f,d,h,p)=>ck(f,d,i,A,h,p,s):l=(f,d,h)=>h);let c=!1,u=0;for(const f of this._roots){if(yg(f),c=sde(0,i,a,l,o,u),ly(),c)break;u+=f.byteLength}return Yo.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Bf.copy(t).invert();const c=Yo.getPrimitive(),u=Yo.getPrimitive();if(s){let d=function(h,p,m,g,v,y,w,C){for(let b=m,F=m+g;bs1.intersectsBox(d),intersectsRange:(d,h,p,m,g,v)=>(i1.copy(v),i1.applyMatrix4(Bf),e.shapecast({intersectsBounds:y=>i1.intersectsBox(y),intersectsRange:(y,w,C,b,F)=>i(d,h,y,w,m,g,b,F)}))});return Yo.releasePrimitive(c),Yo.releasePrimitive(u),f}intersectsBox(e,t){return Ec.set(e.min,e.max,t),Ec.needsUpdate=!0,this.shapecast({intersectsBounds:r=>Ec.intersectsBox(r),intersectsTriangle:r=>Ec.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){e.boundingBox||e.computeBoundingBox(),Ec.set(e.boundingBox.min,e.boundingBox.max,t),Ec.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Yo.getPrimitive(),d=Yo.getPrimitive();let h=Ay,p=ade,m=null,g=null;i&&(m=lde,g=Ade);let v=1/0,y=null,w=null;return Bf.copy(t).invert(),Lp.matrix.copy(Bf),this.shapecast({boundsTraverseOrder:C=>Ec.distanceToBox(C),intersectsBounds:(C,b,F)=>F{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:F=>Lp.distanceToBox(F),intersectsBounds:(F,x,S)=>S{for(let S=F*3,R=(F+x)*3;S(Pp.copy(e).clamp(c.min,c.max),Pp.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,Pp);const f=e.distanceToSquared(Pp);return f{ua(0,new Float32Array(r),uk),e.union(uk)}),e}}const o1=new o0,fk=new Le,cde=Vn.prototype.raycast;function ude(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;fk.copy(this.matrixWorld).invert(),o1.copy(n.ray).applyMatrix4(fk);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=Ak(t.raycastFirst(o1,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(o1,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new ts,i=new X,s=new X,o=new X,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&dB(n.userData.cancelMesh))},vH=n=>{var e,t;n.userData.cullingClone&&(dB(n.userData.cullingClone),n.userData.cullingClone=null,dB(n.userData.cullingCloneP),n.userData.cullingCloneP=null,dB(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Bde=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Bg=n[0].parent,Bg.lines!=null&&(Bg.lines.forEach(i=>{i.visible=!1}),Bg.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=yde(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=gde,a.userData.cancelMesh=o,a.material=mde,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},wde=n=>{let e=hde,t=pde;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Cde=(n,e,t,r,i,s,o=!1)=>{const a=[],l=wde(s);let A=l[0],c=l[1];cy.far=A+c;for(let f=0;f=0;v--)A-g[v].distance>=g[v].object.userData.maxCullDistance&&g.splice(v,1);if(g.length===0){for(let v=0;v<3;v++)a.push(n[d+v]);break}else{const v=g.map(y=>y.object);for(let y=0;yy).length===0){for(let y=0;y<3;y++)a.push(n[d+y]);break}if(p===0)h=g.map(y=>y.object);else if(h=g.map(y=>{if(h.indexOf(y.object)!==-1)return y.object}),h=h.filter(y=>y),p===2&&h.filter(y=>y).length===0)for(let y=0;y<3;y++)a.push(n[d+y]);o&&bde(a1,Wp.clone().multiplyScalar(-1),cy.far,16711680,Bg)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function bde(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new X;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Re(0)),l.push(new Re(16777215));let A=new Pl({color:r});var c=new Dh(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}function yH(n){let e,t,r,i=0;for(let a=0;atypeof window>"u"?await Ude({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await Sde({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}),Ude=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(F=>{const x=F.material;let S=a.find(R=>R.material===x);if(!S)a.push({material:x,mesh:F});else{const{dest:R}=H_({meshes:[S.mesh,F]});S.mesh.geometry=R}});const l=Object.fromEntries(o.map(F=>[F,BH({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((F,x)=>{const S=new Oe(x%A,Math.floor(x/A)).multiplyScalar(1/A),R=new Oe(S.x+1/A,S.y+1/A);return[F.mesh,{min:S,max:R}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},d=[],h=[];a.forEach(F=>{const{min:x,max:S}=u.get(F.mesh);h.push(S),d.push(x)});const p=new Oe(Math.max(...h.map(F=>F.x)),Math.max(...h.map(F=>F.y))),m=new Oe(Math.min(...d.map(F=>F.x)),Math.min(...d.map(F=>F.y))),g=1/(p.x-m.x),v=1/(p.y-m.y),y=c*g,w=c*v,C=new Map(a.map(F=>{let{min:x,max:S}=u.get(F.mesh);return x.x=x.x*g,x.y=x.y*v,S.x=S.x*g,S.y=S.y*v,[F.mesh,{min:x,max:S}]}));a.forEach(F=>{const{material:x,mesh:S}=F,{min:R,max:Z}=C.get(S);o.forEach(E=>{const M=l[E];M.globalCompositeOperation="source-over";let D=eU(x,f[E].find(T=>eU(x,T)));if(D!==""&&D!==void 0)try{const T=new Uint8ClampedArray(D.data),V=new ImageData(T,y,w),G=document.createElement("canvas");G.width=y,G.height=w;const P=G.getContext("2d");P.putImageData(V,0,0),P.save(),M.drawImage(G,R.x*s,R.y*s,y,w)}catch(T){console.error("error",T)}else M.fillStyle=E==="diffuse"?`#${x.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Re(x.aoMapIntensity,x.roughness,x.metalness).getHexString()}`:"#7F7F7F",M.fillRect(R.x*s,R.y*s,y,w)});const Y=S.geometry,Q=Y.attributes.uv;if(Q)for(let E=0;E{const x=new nr(l[F].canvas);return x.flipY=!1,[F,x]})));return{bakeObjects:a,textures:b,uvs:C}},Sde=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s})=>{xde();const o=t,a=r?["diffuse"]:["diffuse","orm"],l=[];let A=null;e.forEach(Z=>{Z=Z.clone();const Y=Z.material.length==null?Z.material:Z.material[0];r&&A==null&&Y.type=="ShaderMaterial"&&(A=Y.clone());let Q=l.find(B=>{B.material});if(!Q)l.push({material:Y,mesh:Z});else{const{dest:B}=H_({meshes:[Q.mesh,Z]});Q.mesh.geometry=B}});const c=Object.fromEntries(a.map(Z=>[Z,BH({width:o,height:o,transparent:s})])),u=Math.floor(Math.sqrt(e.length)+1),f=o/u,d=new Map(l.map((Z,Y)=>{const Q=new Oe(Y%u,Math.floor(Y/u)).multiplyScalar(1/u),B=new Oe(Q.x+1/u,Q.y+1/u);return[Z.mesh,{min:Q,max:B}]})),h={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},p=[],m=[];l.forEach(Z=>{const{min:Y,max:Q}=d.get(Z.mesh);m.push(Q),p.push(Y)});const g=new Oe(Math.max(...m.map(Z=>Z.x)),Math.max(...m.map(Z=>Z.y))),v=new Oe(Math.min(...p.map(Z=>Z.x)),Math.min(...p.map(Z=>Z.y))),y=1/(g.x-v.x),w=1/(g.y-v.y),C=f*y,b=f*w,F=new Map(l.map(Z=>{let{min:Y,max:Q}=d.get(Z.mesh);return Y.x=Y.x*y,Y.y=Y.y*w,Q.x=Q.x*y,Q.y=Q.y*w,[Z.mesh,{min:Y,max:Q}]}));l.forEach(Z=>{const{material:Y,mesh:Q}=Z,{min:B,max:E}=F.get(Q);a.forEach(V=>{var k;const G=c[V];G.globalCompositeOperation="source-over";let P,U=new Re(1,1,1);switch(V){case"diffuse":P=Y.color||n,(k=Y.uniforms)!=null&&k.litFactor&&(U=Y.uniforms.litFactor.value);break;case"normal":P=new Re(8421631);break;case"orm":P=new Re(Y.aoMapIntensity,Y.roughness,Y.metalness);break;default:P=new Re(1,1,1);break}let H=Fde(Y,h[V].find(K=>eU(Y,K)));const oe=Ide(H,U,P,o,o,s);createImageBitmap(oe).then(K=>G.drawImage(K,B.x*o,B.y*o,C,b))});const M=Q.geometry.clone();Q.geometry=M;const D=M.attributes.uv.clone();if(M.attributes.uv=D,D)for(let V=0;V{const Y=new nr(c[Z].canvas);return Y.flipY=!1,[Z,Y]})));let S;const R=i?"transparent":"opaque";return r?(S=new gu({map:x.diffuse,transparent:i}),A==null&&(A=new cB),A.uniforms.map=x.diffuse,A.uniforms.shadeMultiplyTexture=x.diffuse,A.transparent=i,s&&!i&&(S.alphaTest=.5,A.alphaTest=.5),S.userData.vrmMaterial=A,S.userData.shadeTexture=x.uniformColor,S.name="mToon_"+R,S.map.name=S.name):(S=new gu({map:x.diffuse,roughnessMap:x.orm,metalnessMap:x.orm,normalMap:x.normal,transparent:i}),s&&!i&&(S.alphaTest=.5),S.name="standard_"+R,S.roughnessMap!=null&&(S.roughnessMap.name=S.name+"_orm"),S.normalMap!=null&&(S.normalMap.name=S.name+"_normal")),{bakeObjects:l,material:S}};function wH(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new dc(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function CH(n,e){const t=new Map;new X(-1,1,-1),new Le,new X;let r=0;n.forEach(l=>{if(l.skeleton){var A=wH(l);const c=A.bones;A.bones.forEach((u,f)=>{var d;if(c.indexOf(u)!==-1){const h=t.get(u.name);if(h==null){const p={index:r,boneInverses:A.boneInverses[f],bone:u.clone(!1),parentName:((d=u.parent)==null?void 0:d.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,p)}else u.userData.VRMcolliders!=null&&(h.bone.userData.VRMcolliders==null?h.bone.userData.VRMcolliders=u.userData.VRMcolliders:h.bone.userData.VRMcolliders=[...h.bone.userData.VRMcolliders,...u.userData.VRMcolliders])}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new dc(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _de(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function Qde(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function Pw(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Tde(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];wh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=CH(i,t),l=new Nt;return l.name="AvatarRoot",i.forEach(A=>{var b;const c=new $t,u={};for(const F in A.geometry.attributes){const x=A.geometry.attributes[F];u[F]=x.clone()}if((b=A.userData)!=null&&b.isVRM0)for(let F=0;F[F,F.geometry.morphAttributes])),h=new Map([A].map(F=>[F,F.morphTargetDictionary||{}]));if(f.morphAttributes=xH({meshes:[A],sourceMorphAttributes:d,sourceMorphTargetDictionaries:h,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let F=0;Fd.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new X(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new X,f=e.userData.isVRM0?-1:1;for(let d=0;d0){const{bakeObjects:S,material:R}=await Ede({transparentColor:t,atlasSize:F.size,meshes:x,mtoon:F.isMtoon,transparentMaterial:F.transparentMaterial,transparentTexture:v}),Z=S.map(D=>D.mesh),Y=[];Z.forEach(D=>{D.type=="Mesh"&&(D=Dde(w,D)),Y.push(D);const T=D.geometry,V=T.index.array,G=bH(D.geometry.index.array),P=[];for(let oe=0;oe{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Lde({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=yH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Pde({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function xH({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,d])=>{A[u][d]=[],n.forEach(h=>{let p;const m=e.get(h);if(m.hasOwnProperty(f)&&h.geometry.morphAttributes[u]){const g=m[f];p=h.geometry.morphAttributes[u][g]}else{const g=h.geometry.attributes[u],v=new g.array.constructor(new Array(g.array.length).fill(0));p=new At(v,g.itemSize,g.normalized)}A[u][d].push(p)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Lde({sourceAttributes:i.attributes});const o=Pde({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=xH({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Vde({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Wde({meshes:n}),s.animations={},{source:i,dest:s}}function Ht(n){return n==null?[]:Array.isArray(n)?n:[n]}async function Ode(n,e){const r=await new Qu().load(e);r.encoding=ht,r.flipY=!1,n.traverse(i=>{if(i instanceof Vn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Bde(e)};function Jde(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=Ht(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function Hde(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{Ht(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function hk(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function zde(n,e){if(n.data!=null)return n.data[e]}function Yde(n){const e=zde(n,"cullingMeshes");e&&(e.forEach(t=>{vH(t)}),n.data.cullingMeshes=null)}function wn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function Xde(n){const e=n.scene;Yde(n),e.traverse(t=>{t.material&&tU(t.material),t.geometry&&(vH(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Yh.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&tU(i.material)})})});for(const t in n)n[t]=null}const tU=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{var t,r,i,s,o,a,l,A,c,u,f;const e=n.humanoid.humanBones;e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let d in km)d=d.charAt(0).toLowerCase()+d.slice(1),(f=e[d])!=null&&f.node||(e[d]={node:new Fm}),e[d].node.name=d;for(const d in e){const h=oH[d];h&&e[h].node.add(e[d].node)}};function IH({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),IH({candidates:n,predicate:e}))}function FH(n,e){return IH({candidates:[n],predicate:t=>t.name===e})}function EH({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),EH({candidates:n,predicate:e,results:t})}function wh(n,e){return EH({candidates:[n],predicate:t=>Ht(e).includes(t.type)})}function jde(n,e,t){const r=wh(n,"SkinnedMesh");return{humanBones:qde(r[0]),materials:n.userData.atlasMaterial,meta:$de(e,t)}}function $de(n,e){return e=e||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:n,licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...e}}function qde(n){const e={};return n.skeleton.bones.map(t=>{for(const r in km)if(km[r]===t.name){e[t.name]={node:t};break}}),e}const ehe={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function UH(n,e,t){var p;const r=mu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new et,o=new et,a=new et,l=new X,A=e.getObjectByName("mixamorigHips").position.y,c=(p=t.humanoid)==null?void 0:p.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,d=Math.abs(c-u)/A;return r.tracks.forEach(m=>{const g=m.clone(),v=g.name.split("."),y=v[0],C=ehe[y],b=e.getObjectByName(y);if(C!=null){const F=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),g instanceof _a){for(let x=0;x{g.values[Z+x]=R})}i.push(new _a(`${C}.${F}`,g.times,g.values.map((x,S)=>{var R;return((R=t.meta)==null?void 0:R.metaVersion)==="0"&&S%2===0?-x:x})))}else if(g instanceof qA){const x=g.values.map((S,R)=>{var Z;return(((Z=t.meta)==null?void 0:Z.metaVersion)==="0"&&R%3!==1?-S:S)*d});i.push(new qA(`${C}.${F}`,g.times,x))}}}),new mu("vrmAnimation",r.duration,i)}const the=new mse,nhe=new B_,c1=.2,rhe=n=>Math.floor(Math.random()*n);class pk{constructor(e,t,r,i,s,o){var a,l,A,c;this.mixer=new uie(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(l=(a=r==null?void 0:r.humanoid)==null?void 0:a.humanBones)==null?void 0:l.neck,this.spineBone=(c=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:c.spine,this.setAnimations(i),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play()}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t,r=null){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const i=UH(e,t,this.vrm);i&&(e=[i],this.mixamoModel=t)}}else{const i=[];e.forEach(s=>{i.push(s.clone())}),e=i}r&&e[0].tracks.map((i,s)=>{(i.name==="neck.quaternion"||i.name==="spine.quaternion")&&e[0].tracks.splice(s,1)}),this.fadeOutActions=this.actions,this.actions=[],this.newAnimationWeight=0;for(let i=0;i{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}dispose(){this.animationManager.disposeAnimation(this)}}class ihe{constructor(){this.animationPaths=null,this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t=!0,r="",i=""){const s=r+(r!=""?"/":"")+Ht(e)[0];i=i==""?nc(s):i,this.currentAnimationName=i;const a=await(t?the:nhe).loadAsync(s);a.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(a.animations),mu.findByName(a.animations,"mixamo.com")!=null?(this.mixamoModel=a.clone(),this.mixamoAnimations=a.animations):(this.mixamoModel=null,this.animations=a.animations),this.mainControl==null?(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new pk(this,a,null,a.animations,this.curAnimID,this.lastAnimID),this.animationControls.push(this.mainControl)):this.animationControls.forEach(A=>{A.setAnimations(a.animations,this.mixamoModel,this.mouseLookEnabled)})}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=null,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t){const r=Ht(e);this.animationPaths=r.map(i=>`${t}/${i}`)}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=rhe(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-c1)},e*1e3)}update(){this.mainControl&&(this.animationControls.forEach(e=>{e.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*c1):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*c1):this.weightOut=0)}}const gk=4096,mk=new X;class she{constructor(){this.renderer=new HC({preserveDrawingBuffer:!0,antialias:!0}),this.renderer.outputEncoding=ht,this.renderer.setSize(gk,gk),this.camera=new _r(30,1,.1,1e3),this.textureLoader=new Qu,this.sceneBackground=new Re(.1,.1,.1)}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,mk.set(0,0,-1),this.cameraDir=mk.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setBackground(e){Array.isArray(e)?this.setBackgroundColor(e[0],e[1],e[2]):this.setBackgroundImage(e)}setBackgroundColor(e,t,r){this.sceneBackground=new Re(e,t,r)}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=ds,this.sceneBackground=i,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}saveAsImage(e){let t;try{this.scene.background=this.sceneBackground,this.renderer.render(this.scene,this.camera);const r="image/octet-stream",i="image/png";t=this.renderer.domElement.toDataURL(i);const s=UE.Buffer.from(t.replace(/^data:image\/\w+;base64,/,""),"base64"),o=new Blob([s],{type:"image/jpeg"});return this.saveFile(t.replace(i,r),e),this.scene.background=null,o}catch(r){return console.log(r),!1}}_createImage(e,t){const r=e/t;this.renderer.setSize(e,t),this.camera.aspect=r,this.camera.updateProjectionMatrix();try{this.scene.background=this.sceneBackground,this.renderer.render(this.scene,this.camera);const i="image/png";let s=this.renderer.domElement.toDataURL(i);return this.scene.background=null,s}catch(i){return console.log(i),null}}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new nr(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=UE.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const ohe=2;class ahe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new $re,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=ohe,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ai.Blink,1-this._eyeOpen),e.expressionManager.update()})}}var Tn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(Tn||(Tn={}));const nU="blend_",vk="vrmColliderSphere";function lhe(n){return{title:n.name,version:"v0",author:n.authors[0]||"",contactInformation:n.contactInformation,allowedUserName:n.allowedUserName,violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:"Disallow"}}function Ahe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function che(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function uhe(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class fhe{parse(e,t,r,i,s,o,a){var qe;const l=lhe(e.meta),A=Ahe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const d=c.filter((O,J,ae)=>ae.findIndex(de=>de.name===O.name.replace(" (Outline)",""))===J).map(O=>O),h=d.map(O=>O.name),p=r?{name:"icon",imageBitmap:r.image}:null,m=d.filter(O=>O.map).map(O=>{if(!O.map)throw new Error(O.name+" map is null");return{name:O.name,imageBitmap:O.map.image}}),g=d.filter(O=>O.userData.shadeTexture).map(O=>{if(!O.userData.shadeTexture)throw new Error(O.userData.shadeTexture+" map is null");return{name:O.name+"_shade",imageBitmap:O.userData.shadeTexture.image}}),v=d.filter(O=>O.roughnessMap).map(O=>O.roughnessMap?{name:O.name+"_orm",imageBitmap:O.roughnessMap.image}:null),y=d.filter(O=>O.roughnessMap).map(O=>O.normalMap?{name:O.name+"_normal",imageBitmap:O.normalMap.image}:null),w=[...m,...g,...v,...y].filter(O=>O!==null),C=mhe(w,p),b=vhe(C),F=yhe(C),x=ghe(d,w),S=t.children.filter(O=>O.children.length>0&&O.children[0].type===Ai.Bone)[0],R=SH(S).filter(O=>O.name!==vk),Z=R.map(O=>O.name),Y=R.map(O=>({children:O.children.filter(J=>J.name!==vk).map(J=>Z.indexOf(J.name)),name:O.name,rotation:[O.quaternion.x,O.quaternion.y,O.quaternion.z,O.quaternion.w],scale:[O.scale.x,O.scale.y,O.scale.z],translation:[O.position.x,O.position.y,O.position.z]})),Q=[],B=t.children.filter(O=>O.type===Ai.Group||O.type===Ai.SkinnedMesh),E=[];B.forEach(O=>{const J=O.type===Ai.Group?O.children[0]:O,ae=J.geometry.attributes,de=new oA(ae.position,Tn.FLOAT,kt.POSITION,na.VEC3,J.name,void 0);E.push(de);const ve=E.length-1,L=new oA(ae.normal,Tn.FLOAT,kt.NORMAL,na.VEC3,J.name,void 0);E.push(L),E.push(new oA(ae.uv,Tn.FLOAT,kt.UV,na.VEC2,J.name,void 0)),E.push(new oA(ae.skinWeight,Tn.FLOAT,kt.SKIN_WEIGHT,na.VEC4,J.name,void 0)),E.push(new oA(ae.skinIndex,Tn.UNSIGNED_SHORT,kt.SKIN_INDEX,na.VEC4,J.name,void 0)),(O.type===Ai.Group?O.children.map(N=>N):[O]).forEach(N=>{if(!N.geometry.index)throw new Error(N.name+" geometry.index is null");E.push(new oA(N.geometry.index,Tn.UNSIGNED_INT,kt.INDEX,na.SCALAR,J.name,N.name))}),J.morphTargetDictionary||(J.morphTargetDictionary={},J.morphTargetInfluences=[],J.geometry.morphAttributes={},J.updateMorphTargets()),J.geometry.userData.targetNames=[],console.warn("taking only mesh 0 for morph targets now, take the correct mesh");for(const N in e.expressionManager.expressionMap){const $=e.expressionManager.expressionMap[N],ee=$._binds.map(te=>({mesh:0,index:te.index,weight:te.weight*100}));if(ee.length>0){let te=!1;for(const we in ai)if(N===ai[we]&&N!=="surprised"){u.push({name:N,presetName:che(N),binds:ee,isBinary:$.isBinary}),te=!0;break}te===!1&&u.push({name:N,presetName:"unknown",binds:ee,isBinary:$.isBinary})}}const I=(N,$,ee,te)=>{const we=[],Ce=[];for(let Ee=0;Ee0){const Ve=we.length%4,_e=Ve===0?0:4-Ve;if(_e>0)for(let ye=0;ye<_e;ye++)we.push(0),Ce.push(0,0,0);const re={targetMeshDataIndex:ve,count:we.length,indices:new Uint32Array(we),values:new Float32Array(Ce)};E.push(new oA(te,Tn.FLOAT,ee,na.VEC3,J.name,nU+$,re))}};for(const N in J.morphTargetDictionary){J.geometry.userData.targetNames.push(N);const $=J.morphTargetDictionary[N],ee=J.geometry.morphAttributes;I(ee.position[$].array,N,kt.BLEND_POSITION,ae.position),ee.normal&&I(ee.normal[$].array,N,kt.BLEND_NORMAL,ae.normal)}}),B.forEach(O=>{const J=O.type===Ai.Group?O.children[0]:O,ae=new Float32Array(J.skeleton.boneInverses.map(de=>de.elements).flat());E.push(new oA(new At(ae,16),Tn.FLOAT,kt.BIND_MATRIX,na.MAT4,J.name,J.name))}),Q.push(...E.map(O=>({byteOffset:0,componentType:O.valueType,count:O.attribute.count,max:O.max,min:O.min,normalized:!1,type:O.accessorsType})));const M=hhe(B,E,h);B.forEach((O,J)=>{Y.push({mesh:J,name:O.name,rotation:[O.quaternion.x,O.quaternion.y,O.quaternion.z,O.quaternion.w],scale:[O.scale.x,O.scale.y,O.scale.z],skin:J,translation:[O.position.x,O.position.y,O.position.z]})});const D=phe(B,E,Z),T={humanBones:[]};A.humanBones.forEach(O=>{Z.indexOf(O.node.name)!=-1&&T.humanBones.push({bone:uhe(O.bone),node:Z.indexOf(O.node.name),useDefaultValues:!0})});const V={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},G={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},P=[];d.forEach(O=>{O.type=="ShaderMaterial"?P.push(P.push(Object.assign({},V))):P.push(P.push(Object.assign({},G)))});const U=l;i.forEach(O=>{for(let J=0;JO.isSkinnedMesh))==null?void 0:qe.skeleton)||null;for(let O=0;O{const ve=de.sphere;ae.colliders.push({radius:ve.radius*o,offset:{x:ve.offset[0]*o,y:ve.offset[1]*o,z:ve.offset[2]*o}})}),H.push(ae)}}console.log("COLLIDER GROUPS",H);const k=O=>{for(let J=0;J{const J=k(O);if(J==-1)return[-1];{const ae=[];return R[J].traverse(ve=>{ve.isBone&&ae.push(k(ve.name))}),ae}},ne=[];i.forEach(O=>{var L;const J=K(O.name),ae=[];if(O.colliderGroups.forEach(_=>{const I=_.colliders[0];if(I!=null){const N=I.parent,$=H.findIndex(ee=>ee.name===N.name);$!=-1?ae.push($):console.warn("No collider group for bone name: ",N.name+" was found")}else console.log("No colliders definition were present in vrm file file for: ",O.name+" spring bones")}),J===[-1]){console.warn("No bone found for spring bone "+O.name);return}let de=k((L=O.center)==null?void 0:L.name);de==-1&&console.warn("no center bone for spring bone "+O.name);const ve=O.settings;ne.push({bones:J,center:de,colliderGroups:ae,dragForce:ve.dragForce,gravityDir:{x:ve.gravityDir.x,y:ve.gravityDir.y,z:ve.gravityDir.z},gravityPower:ve.gravityPower,hitRadius:ve.hitRadius,stiffiness:ve.stiffness})});const ie={boneGroups:ne,colliderGroups:H};console.log(ie),U.texture=p?C.length-1:void 0;const ue=[];ue.push(...w.map(O=>({buffer:yk(O.imageBitmap),type:kt.IMAGE}))),E.forEach((O,J)=>{O.buffer?ue.push({buffer:O.buffer,typeString:"",type:O.type}):O.sparse&&(ue.push({buffer:O.sparse.indices,typeString:"indices",type:O.type,count:O.sparse.count}),ue.push({buffer:O.sparse.values,typeString:"values",type:O.type}))}),p&&ue.push({buffer:yk(p.imageBitmap),type:kt.IMAGE});let j=0,se=0,ce=0,Be=0;const ge=ue.map(O=>{const J={buffer:0,byteLength:O.buffer.byteLength,byteOffset:j,target:O.type===kt.IMAGE||O.type===kt.BIND_MATRIX?void 0:O.type===kt.INDEX?Tn.ELEMENT_ARRAY_BUFFER:Tn.ARRAY_BUFFER};return j+=O.buffer.byteLength,O.type===kt.IMAGE?(C[se++].bufferView=Be,Be++):E[ce].sparse?(Q[ce].sparse==null&&(Q[ce].sparse={}),O.typeString==="indices"&&(Q[ce].sparse.count=O.count,Q[ce].sparse[O.typeString]={bufferView:Be,byteOffset:0,componentType:Tn.UNSIGNED_INT}),O.typeString==="values"&&(Q[ce].sparse[O.typeString]={bufferView:Be,byteOffset:0}),O.typeString==="values"&&ce++,Be++):(E[ce].bufferIndex=Be,Q[ce].bufferView=Be,ce++,Be++),J}),Fe=Bhe(t,Y);dhe(U);const nt={accessors:Q,asset:f,buffers:[{byteLength:j}],bufferViews:ge,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new X,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:P,humanoid:T,meta:U,secondaryAnimation:ie,specVersion:"0.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRM"],images:C,materials:x,meshes:M,nodes:Y,samplers:b,scenes:Fe,skins:D,textures:F};console.log(nt);const We=new Bk(iU(JSON.stringify(nt,void 0,2)),"JSON"),Te=new Bk(wg(ue.map(O=>O.buffer)),"BIN\0"),Qe=wg([We.buffer,Te.buffer]),Ge=wg([iU("glTF"),rU(2,4),rU(Qe.byteLength+12,4)]);a(wg([Ge,Qe]))}}function dhe(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function SH(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>SH(e)).flat())}function yk(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Tn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Tn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Bk{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=wg([rU(r.byteLength,4),iU(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sp%3===0)),Math.max.apply(null,Array.from(A).filter((h,p)=>p%3===1)),Math.max.apply(null,Array.from(A).filter((h,p)=>p%3===2))]:void 0,this.min=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===0)),Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===1)),Math.min.apply(null,Array.from(A).filter((h,p)=>p%3===2))]:void 0}else this.buffer=u1(this.attribute,this.valueType),this.max=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===2))]:void 0,this.min=r===kt.POSITION||r===kt.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((l,A)=>A%3===2))]:void 0}}var Cd;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Cd||(Cd={}));var na;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(na||(na={}));var kt;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(kt||(kt={}));var Ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Ai||(Ai={}));const hhe=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r,s=r.type===Ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(kt.SKIN_INDEX),NORMAL:a.indexOf(kt.NORMAL),POSITION:a.indexOf(kt.POSITION),TEXCOORD_0:a.indexOf(kt.UV),WEIGHTS_0:a.indexOf(kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(d=>d.type===kt.BLEND_NORMAL&&d.meshName===i.name?d.name:null).indexOf(nU+A),u=e.map(d=>d.type===kt.BLEND_POSITION&&d.meshName===i.name?d.name:null).indexOf(nU+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),phe=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===kt.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),ghe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(h=>h.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const d=t;r=d.color?[d.color.r,d.color.g,d.color.b,1]:void 0}let s=-1;t.map?s=e.map(d=>d.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(d=>d.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(d=>d.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(d=>d.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const d=(()=>{switch(t.type){case Cd.MeshStandardMaterial:return t.metalness;case Cd.MeshBasicMaterial:return 0;default:return 0}})(),h=(()=>{switch(t.type){case Cd.MeshStandardMaterial:return t.roughness;case Cd.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=d,A.roughnessFactor=h}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:A};return u&&(f.normalTexture=u),f}),mhe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),vhe=n=>n.map(()=>({magFilter:Tn.LINEAR,minFilter:Tn.LINEAR,wrapS:Tn.REPEAT,wrapT:Tn.REPEAT})),yhe=n=>n.map((e,t)=>({sampler:0,source:t})),Bhe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Ai.Object3D||r.type===Ai.SkinnedMesh||r.type===Ai.Group||r.type===Ai.Bone).map(r=>t.indexOf(r.name))}]};function _H(){return(_H=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let d=[],h=new DataView(new ArrayBuffer(24*n.levels.length)),p=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),g.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(Gp([new Uint8Array(Fr).buffer,m,h.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...d]))}var oU,aU,Ehe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},lU=new OffscreenCanvas(128,128),xk=lU.getContext("2d",{willReadFrequently:!0}),QH=typeof document>"u";function Uhe(n){return createImageBitmap(n).then(function(e){return lU.width=e.width,lU.height=e.height,xk.drawImage(e,0,0),xk.getImageData(0,0,e.width,e.height)})}function RH(n,e){return e===void 0&&(e={}),_he().then(function(t){var r=new t.BasisEncoder;return She(e,r),r.setTexType(oU.cBASISTexType2D),Che(n,ArrayBuffer)&&(n=new Blob([n])),Uhe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,aU.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=xhe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Fhe(l,{keepWriter:!0})}return a})})}function She(n,e){n===void 0&&(n={}),(n=whe({},Ehe,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var f1=null;function _he(){return f1||(f1=new Promise(function(n,e){QH?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),f1}QH&&self.addEventListener("message",function(n){RH(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});function MH(n){const e=n.clone(),t=[];return n.traverse(r=>{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function Qhe(n){const e=MH(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=wH(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new gu,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Qr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Rhe(n,e,t){const r=await z_(n,t),i=await TH(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function Mhe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;The(n,e,r).then(a=>{DH(a,`${o}.vrm`),i()})})}async function The(n,e,t){const r=await z_(n,t);return TH(r,e,t)}function z_(n,e){const t=MH(n),{createTextureAtlas:r=!0}=e;return r?kde(t,e):(console.log("no atlas"),Tde(t,e))}async function Nhe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await z_(n,t):Qhe(n);Dhe(s).then(o=>{if(o instanceof ArrayBuffer)DH(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Vhe(a,`${r}.gltf`)}})}function Dhe(n){return new Promise(e=>new T_().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function khe(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(A=>A.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in km)if(s.bone.parent.name==km[o]){t.push(s);break}}),t}function TH(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1}=t;return new Promise(async a=>{const l=i?new fhe:new Sfe,A={...Phe(e),...jde(n,"CharacterCreator",s)};if(t.ktxCompression){console.log("ktx compression");for(let h=0;hw.toBlob(R)),F=await RH(b),x=new Blob(F,{type:"image/ktx2"}),S=await createImageBitmap(x);A.materials[h].map.source=S}}}}let c;n.traverse(h=>{h.isSkinnedMesh&&(c=h)}),(()=>{for(let h=0;h{h.updateMatrix(),h.updateMatrixWorld()}),c.skeleton.calculateInverses(),c.skeleton.computeBoneTexture(),c.skeleton.update()})(),c.skeleton.bones.filter(h=>h.name==="head")[0];const f=khe(e),d=[];l.parse(A,n,r,f,d,o,h=>{a(h)})})}function NH(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function Vhe(n,e){NH(new Blob([n],{type:"text/plain"}),e)}function DH(n,e){NH(Lhe(n),e)}function Lhe(n){return new Blob([n],{type:"application/octet-stream"})}function Phe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const Whe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?Ohe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Ghe(n):console.warn("No valid vrm file was provided")},Ohe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>kH(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=FH(t,u);if(f!=null){const d=c.colliders;f.userData.VRMcolliders=d.map(h=>({sphere:{radius:h.radius,offset:[h.offset.x,h.offset.y,h.offset.z]}}))}})},Ghe=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>kH(f.name,o));i!=null&&i.forEach(f=>{const d=Ht(f.colliders);let h=-1,p=null;d.forEach(m=>{if(h!=s[m].node){h=s[m].node;const g=a[h];p=FH(t,g),p.userData.VRMcolliders=[]}if(p!=null){const g=s[m].shape;for(const v in g){const y=g[v];y!=null&&y.offset&&(y.offset[0]=-y.offset[0])}p.userData.VRMcolliders.push(g)}else console.error("no node with name "+a[h]+" was found")})})},kH=(n,e)=>{const t=Bt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},Ww=[0,400,560,2400,4800],Ow=[0,500,700,3e3,6e3],AU=[],rl=[],Y_=1024,VH=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=Gw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=Y_,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Gw.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ai.Oh,0),this.vrm.expressionManager.setValue(ai.Ah,0),this.vrm.expressionManager.setValue(ai.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ai.Oh,i),this.vrm.expressionManager.setValue(ai.Ah,r),this.vrm.expressionManager.setValue(ai.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=rl[A+1]-rl[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=rl[A+1]-rl[A],s[A]=s[A]/(AU[A+1]-AU[A])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let A=0;A=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const d1=new X;class Zhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Oe,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){d1.set(0,0,1),d1.applyQuaternion(this.camera.quaternion);const e=d1.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class h1{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:d,blinkerTraits:h,typeRestrictions:p,defaultCullingLayer:m,defaultCullingDistance:g,offset:v,vrmMeta:y,traits:w,textureCollections:C,colorCollections:b,canDownload:F=!0,downloadOptions:x={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=Ht(o),this.requiredTraits=Ht(c),this.randomTraits=Ht(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=Ht(f),this.lipSyncTraits=Ht(d),this.blinkerTraits=Ht(h),this.typeRestrictions=p,this.defaultCullingLayer=m,this.defaultCullingDistance=g,this.offset=v,this.canDownload=F,this.downloadOptions=x;const S=()=>{const Y=[];for(const Q in w)Y.push(w[Q].trait);return Y};this.allTraits=S(),S(),(()=>{if(this.typeRestrictions)for(const Y in this.typeRestrictions)Ht(this.typeRestrictions[Y]).forEach(B=>{this.typeRestrictions[B]==null&&(this.typeRestrictions[B]=[]),this.typeRestrictions[B].indexOf(Y)==-1&&this.typeRestrictions[B].push(Y)})})(),(()=>{x.vrmMeta=x.vrmMeta||y,x.scale=x.scale||a||1,x.mToonAtlasSize=x.mToonAtlasSize||2048,x.mToonAtlasSizeTransp=x.mToonAtlasSizeTransp||1024,x.stdAtlasSize=x.stdAtlasSize||2048,x.stdAtlasSizeTransp=x.stdAtlasSizeTransp||1024,x.exportStdAtlas=x.exportStdAtlas||!1,x.exportMtoonAtlas=x.exportMtoonAtlas||!0,x.screenshotFaceDistance=x.screenshotFaceDistance||1,x.screenshotFaceOffset=x.screenshotFaceOffset||[0,0,0],x.screenshotResolution=x.screenshotResolution||[512,512],x.screenshotBackground=x.screenshotBackground||[.1,.1,.1],x.screenshotFOV=x.screenshotFOV||75,!x.exportStdAtlas&&!x.exportMtoonAtlas&&(x.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(C),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(w)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=Ht(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new p1(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new p1(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new p1(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),Ht(e).forEach(r=>{this.modelTraits.push(new Jhe(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),Ht(e).forEach(r=>{this.textureTraits.push(new Hhe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),Ht(e).forEach(r=>{this.colorTraits.push(new zhe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class Jhe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Ik(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Ik(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class Hhe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Yhe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class zhe{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),Ht(e).forEach(r=>{this.collection.push(new Xhe(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Ik{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let h=0;h0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class Yhe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(qa)}),qa.z+=.3,qa.y+=s,this.screenshotManager.setCamera(qa,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var p,m;const u=A.object,f=A.face,d=[f.a,f.b,f.c],h=(m=(p=u.userData)==null?void 0:p.clippedIndexGeometry)==null?void 0:m.array;if(h!=null){const g=o(h,d),v=Array.from(h);if(g==-1&&!c){const y=[...v,...d];u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1)}g!=1&&c&&(v.splice(g,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(v),1,!1))}};g1.x=e,g1.y=t,i(),Fk.setFromCamera(g1,this.renderCamera);const l=Fk.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new hB({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await Mhe(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};Nhe(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&(this.screenshotManager.scene=this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(Ht(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getTraitOption(e,t);s&&(await this._loadTraits(Ht(s)),r())}catch(s){console.error("Error loading specific trait:",s.message),i(new Error("Failed to load specific trait."))}else{const s="No manifest was loaded, specific trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(Ht(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await Ode(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new Re(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new Re(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new hB({traitGroupID:e,traitModel:null});this._addLoadedData(i),A1(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){A1(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new h1(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new h1(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new h1(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async _loadTraits(e,t=!1){await this.traitLoadManager.loadTraitOptions(Ht(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new hB({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),A1(this.avatar)})}async _animationManagerSetup(e,t,r){const i=Ht(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(d=>d.name==="head")[0].getWorldPosition(qa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];qa.x+=s[0],qa.y+=s[1],qa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(qa,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_setupScreenshotManager(){this.parentModel?this.screenshotManager.scene=this.parentModel:this.screenshotManager.scene=this.rootModel}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new Re(o,a,l)},r=new ss({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;return e.userData.vrm==null?(console.error("No valid VRM was provided for "+r+" trait, skipping file."),null):(hk(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Whe(e),Kde(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Gw(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"&&o.scene.traverse(A=>{if(A.isSkinnedMesh){Yh.rotateVRM0(o),console.log("Loaded VRM0 file ",o);for(let c=0;c{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const A=this.manifest,c=this.manifestData.getModelGroup(r);hk(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const d=i[f]||i[0];d!=null&&(u.material.type==="MeshStandardMaterial"?Array.isArray(u.material)?u.material.forEach(h=>{h.map=d}):u.material.map=d:console.warn("XXX set material texture to shader material",u.material))}if(s){const d=s[f]||s[0];d!=null&&(u.material[0].uniforms.litFactor.value=d,u.material[0].uniforms.shadeColorFactor.value=new Re(d.r*.8,d.g*.8,d.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),Xde(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class jhe{constructor(){const e=new fZ;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new B_(e);t.crossOrigin="anonymous",t.register(i=>new bfe(i,{autoUpdateHumanBones:!0}));const r=new Qu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(Ht((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async d=>{try{return await this.gltfLoader.loadAsync(d)}catch(h){return console.error(`Error loading modelsss ${d}:`,h),null}})),l=await Promise.all(Ht((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(d=>new Promise(h=>{this.textureLoader.load(d,p=>{p.flipY=!1,p.encoding=ht,h(p)},null,p=>{console.error("error loading texture: ",p),h(null)})}))),A=Ht((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(d=>new Re(d));r[o]=new hB({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:A})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class hB{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function $he(n){const e=new gw,t=new pZ(16777215,.5);e.add(t);const r=new m_(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new Nt;e.add(i);const s=new _r(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Khe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new HC({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new die(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new X(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new X(-.5,0,-.5),u=new X(.5,1.5,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=ht;const d=()=>{requestAnimationFrame(d),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};d();const h=m=>{const g=m.ctrlKey,v=a.getBoundingClientRect(),y=(m.clientX-v.left)/v.width*2-1,w=-((m.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(y,w,g)};async function p(){const m="./3d/Platform.glb",v=await new B_().loadAsync(m);i.add(v.scene)}return p(),a.addEventListener("click",h),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}const qr=me.createContext(),qhe=n=>{const[e,t]=me.useState(null),[r,i]=me.useState(null),[s,o]=me.useState(null),[a,l]=me.useState(null),[A,c]=me.useState(null),[u,f]=me.useState(null),[d,h]=me.useState(null),[p,m]=me.useState(null),[g,v]=me.useState(!1);let y=!1,[w,C]=me.useState(!1);me.useEffect(()=>{if(y||w)return;C(!0),y=!0;const{scene:S,camera:R,controls:Z,characterManager:Y,sceneElements:Q}=$he("editor-scene");f(R),c(S),t(Y),i(Q),o(Y.animationManager),l(Y.lookAtManager),h(Z)},[]);const b=S=>{S==null&&(S=!g),v(S),A.traverse(R=>{R.isMesh&&R.setDebugMode&&R.setDebugMode(S)})},F=S=>{S?A.add(r):A.remove(r)},x=S=>{d&&(lE.to(d.target,{x:S.targetX??0,y:S.targetY??0,z:S.targetZ??0,duration:1}),lE.fromTo(d,{maxDistance:d.getDistance(),minDistance:d.getDistance(),minPolarAngle:d.getPolarAngle(),maxPolarAngle:d.getPolarAngle(),minAzimuthAngle:d.getAzimuthalAngle(),maxAzimuthAngle:d.getAzimuthalAngle()},{maxDistance:S.distance,minDistance:S.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{d.minPolarAngle=0,d.maxPolarAngle=3.1415,d.minDistance=.5,d.maxDistance=10,d.minAzimuthAngle=1/0,d.maxAzimuthAngle=1/0}))};return W.jsx(qr.Provider,{value:{manifest:p,setManifest:m,scene:A,characterManager:e,showEnvironmentModels:F,debugMode:g,toggleDebugMode:b,animationManager:s,lookAtManager:a,camera:u,moveCamera:x,controls:d},children:n.children})},epe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},st={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",BIO:"BIO",SAVE:"SAVE",MINT:"MINT",CHAT:"CHAT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},gi=z.createContext(),tpe=n=>{const[e,t]=z.useState(epe.NORMAL),[r,i]=z.useState(st.LANDING),[s,o]=z.useState(!1),[a,l]=z.useState(!1);return W.jsx(gi.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},npe="modulepreload",rpe=function(n){return"/CharacterStudio/"+n},Ek={},ipe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=rpe(s),s in Ek)return;Ek[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":npe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function Zw(){return Zw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function ope(n){me.useEffect(n,[])}function ape(n,e){e===void 0&&(e={});var t=e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,f=spe(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),d=z.useRef(null),h=z.useRef(!1),p=z.useState(null),m=p[0],g=p[1],v=z.useState(null),y=v[0],w=v[1],C=function(){typeof u=="function"&&u.call(this),h.current&&g(this.duration()*1e3),w(this)};ope(function(){return ipe(()=>import("./howler-9ba4aca9.js").then(R=>R.h),[]).then(function(R){if(!h.current){var Z;d.current=(Z=R.Howl)!==null&&Z!==void 0?Z:R.default.Howl,h.current=!0,new d.current(Zw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:C},f))}}),function(){h.current=!1}}),z.useEffect(function(){d.current&&y&&w(new d.current(Zw({src:Array.isArray(n)?n:[n],volume:i,onload:C},f)))},[JSON.stringify(n)]),z.useEffect(function(){y&&(y.volume(i),y.rate(o))},[i,o]);var b=z.useCallback(function(R){typeof R>"u"&&(R={}),!(!y||!l&&!R.forceSoundEnabled)&&(c&&y.stop(),R.playbackRate&&y.rate(R.playbackRate),y.play(R.id))},[y,l,c]),F=z.useCallback(function(R){y&&y.stop(R)},[y]),x=z.useCallback(function(R){y&&y.pause(R)},[y]),S=[b,{sound:y,stop:F,pause:x,duration:m}];return S}const lpe=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],Ape="/CharacterStudio/assets/sounds-3322d50e.mp3",ys=me.createContext(),cpe=n=>{const e=i=>lpe.find(s=>i.test(s.name)),[t]=ape(Ape,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return W.jsx(ys.Provider,{value:{playSound:r},children:n.children})};function Ks(n){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(n)}function lo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function upe(n,e){if(Ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function LH(n){var e=upe(n,"string");return Ks(e)=="symbol"?e:String(e)}function Uk(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||hpe,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function Mk(n,e,t){var r=X_(n,e,Object),i=r.obj,s=r.k;i[s]=t}function mpe(n,e,t,r){var i=X_(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function Jw(n,e){var t=X_(n,e),r=t.obj,i=t.k;if(r)return r[i]}function Tk(n,e,t){var r=Jw(n,t);return r!==void 0?r:Jw(e,t)}function GH(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):GH(n[r],e[r],t):n[r]=e[r]);return n}function Cf(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var vpe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function ype(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return vpe[e]}):n}var ub=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Bpe=[" ",",","?","!",";"];function wpe(n,e,t){e=e||"",t=t||"";var r=Bpe.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function Nk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function hy(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ZH(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var A=r.slice(s+o).join(t);return A?ZH(l,A,t):void 0}i=i[r[s]]}return i}}var xpe=function(n){cb(t,n);var e=Cpe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return lo(this,t),i=e.call(this),ub&&rc.call(JA(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Ao(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,A=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[i,s];o&&typeof o!="string"&&(c=c.concat(o)),o&&typeof o=="string"&&(c=c.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(c=i.split("."));var u=Jw(this.data,c);return u||!A||typeof o!="string"?u:ZH(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},A=this.options.keySeparator;A===void 0&&(A=".");var c=[i,s];o&&(c=c.concat(A?o.split(A):o)),i.indexOf(".")>-1&&(c=i.split("."),a=s,s=c[1]),this.addNamespaces(s),Mk(this.data,c,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[i,s];i.indexOf(".")>-1&&(c=i.split("."),a=o,o=s,s=c[1]),this.addNamespaces(s);var u=Jw(this.data,c)||{};a?GH(u,o,l):u=hy(hy({},u),o),Mk(this.data,c,u),A.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?hy(hy({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(rc),JH={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function Dk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ni(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var kk={},Vk=function(n){cb(t,n);var e=Ipe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return lo(this,t),i=e.call(this),ub&&rc.call(JA(i)),gpe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,JA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ha.create("translator"),i}return Ao(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],A=o&&i.indexOf(o)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!wpe(i,o,a);if(A&&!c){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(Ks(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,A=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=this.extractFromKey(i[i.length-1],s),u=c.key,f=c.namespaces,d=f[f.length-1],h=s.lng||this.language,p=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h&&h.toLowerCase()==="cimode"){if(p){var m=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(d).concat(m).concat(u),usedKey:u,exactUsedKey:u,usedLng:h,usedNS:d}:"".concat(d).concat(m).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:h,usedNS:d}:u}var g=this.resolve(i,s),v=g&&g.res,y=g&&g.usedKey||u,w=g&&g.exactUsedKey||u,C=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],F=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,S=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(x&&v&&S&&b.indexOf(C)<0&&!(typeof F=="string"&&C==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var R=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,v,ni(ni({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(g.res=R,g):R}if(A){var Z=C==="[object Array]",Y=Z?[]:{},Q=Z?w:y;for(var B in v)if(Object.prototype.hasOwnProperty.call(v,B)){var E="".concat(Q).concat(A).concat(B);Y[B]=this.translate(E,ni(ni({},s),{joinArrays:!1,ns:f})),Y[B]===E&&(Y[B]=v[B])}v=Y}}else if(x&&typeof F=="string"&&C==="[object Array]")v=v.join(F),v&&(v=this.extendTranslation(v,i,s,o));else{var M=!1,D=!1,T=s.count!==void 0&&typeof s.count!="string",V=t.hasDefaultValue(s),G=T?this.pluralResolver.getSuffix(h,s.count,s):"",P=s["defaultValue".concat(G)]||s.defaultValue;!this.isValidLookup(v)&&V&&(M=!0,v=P),this.isValidLookup(v)||(D=!0,v=u);var U=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,H=U&&D?void 0:v,oe=V&&P!==v&&this.options.updateMissing;if(D||M||oe){if(this.logger.log(oe?"updateKey":"missingKey",h,d,u,oe?P:v),A){var k=this.resolve(u,ni(ni({},s),{},{keySeparator:!1}));k&&k.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var K=[],ne=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ne&&ne[0])for(var ie=0;ie1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var d=s.extractFromKey(f,o),h=d.key;l=h;var p=d.namespaces;s.options.fallbackNS&&(p=p.concat(s.options.fallbackNS));var m=o.count!==void 0&&typeof o.count!="string",g=m&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",y=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);p.forEach(function(w){s.isValidLookup(a)||(u=w,!kk["".concat(y[0],"-").concat(w)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(kk["".concat(y[0],"-").concat(w)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(y.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(function(C){if(!s.isValidLookup(a)){c=C;var b=[h];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,h,C,w,o);else{var F;m&&(F=s.pluralResolver.getSuffix(C,o.count,o));var x="".concat(s.options.pluralSeparator,"zero");if(m&&(b.push(h+F),g&&b.push(h+x)),v){var S="".concat(h).concat(s.options.contextSeparator).concat(o.context);b.push(S),m&&(b.push(S+F),g&&b.push(S+x))}}for(var R;R=b.pop();)s.isValidLookup(a)||(A=R,a=s.getResource(C,w,R,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:A,usedLng:c,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(rc);function m1(n){return n.charAt(0).toUpperCase()+n.slice(1)}var Lk=function(){function n(e){lo(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ha.create("languageUtils")}return Ao(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=m1(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=m1(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=m1(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(A){A&&(i.isSupportedCode(A)?o.push(A):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(A)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),Epe=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Upe={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},Spe=["v1","v2","v3"],Pk={zero:0,one:1,two:2,few:3,many:4,other:5};function _pe(){var n={};return Epe.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Upe[e.fc]}})}),n}var Qpe=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.languageUtils=e,this.options=t,this.logger=ha.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=_pe()}return Ao(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return Pk[o]-Pk[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Spe.includes(this.options.compatibilityJSON)}}]),n}();function Wk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Bo(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ha.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Ao(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:ype,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Cf(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Cf(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Cf(r.nestingPrefix):r.nestingPrefixEscaped||Cf("$t("),this.nestingSuffix=r.nestingSuffix?Cf(r.nestingSuffix):r.nestingSuffixEscaped||Cf(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,A,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(m){return m.replace(/\$/g,"$$$$")}var f=function(g){if(g.indexOf(o.formatSeparator)<0){var v=Tk(r,c,g);return o.alwaysFormat?o.format(v,void 0,i,Bo(Bo(Bo({},s),r),{},{interpolationkey:g})):v}var y=g.split(o.formatSeparator),w=y.shift().trim(),C=y.join(o.formatSeparator).trim();return o.format(Tk(r,c,w),C,i,Bo(Bo(Bo({},s),r),{},{interpolationkey:w}))};this.resetRegExp();var d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,p=[{regex:this.regexpUnescape,safeValue:function(g){return u(g)}},{regex:this.regexp,safeValue:function(g){return o.escapeValue?u(o.escape(g)):u(g)}}];return p.forEach(function(m){for(A=0;a=m.regex.exec(t);){var g=a[1].trim();if(l=f(g),l===void 0)if(typeof d=="function"){var v=d(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))l="";else if(h){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(g," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=Rk(l));var y=m.safeValue(l);if(t=t.replace(a[0],y),h?(m.regex.lastIndex+=l.length,m.regex.lastIndex-=a[0].length):m.regex.lastIndex=0,A++,A>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function A(d,h){var p=this.nestingOptionsSeparator;if(d.indexOf(p)<0)return d;var m=d.split(new RegExp("".concat(p,"[ ]*{"))),g="{".concat(m[1]);d=m[0],g=this.interpolate(g,l);var v=g.match(/'/g),y=g.match(/"/g);(v&&v.length%2===0&&!y||y.length%2!==0)&&(g=g.replace(/'/g,'"'));try{l=JSON.parse(g),h&&(l=Bo(Bo({},h),l))}catch(w){return this.logger.warn("failed parsing options string in nesting for key ".concat(d),w),"".concat(d).concat(p).concat(g)}return delete l.defaultValue,d}for(;o=this.nestingRegexp.exec(t);){var c=[];l=Bo({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var f=o[1].split(this.formatSeparator).map(function(d){return d.trim()});o[1]=f.shift(),c=f,u=!0}if(a=r(A.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=Rk(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(d,h){return i.format(d,h,s.lng,Bo(Bo({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function Ok(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function el(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=dpe(a),A=l[0],c=l.slice(1),u=c.join(":").trim().replace(/^'+|'+$/g,"");t[A.trim()]||(t[A.trim()]=u),u==="false"&&(t[A.trim()]=!1),u==="true"&&(t[A.trim()]=!0),isNaN(u)||(t[A.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function bf(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Tpe=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lo(this,n),this.logger=ha.create("formatter"),this.options=e,this.formats={number:bf(function(t,r){var i=new Intl.NumberFormat(t,el({},r));return function(s){return i.format(s)}}),currency:bf(function(t,r){var i=new Intl.NumberFormat(t,el(el({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:bf(function(t,r){var i=new Intl.DateTimeFormat(t,el({},r));return function(s){return i.format(s)}}),relativetime:bf(function(t,r){var i=new Intl.RelativeTimeFormat(t,el({},r));return function(s){return i.format(s,r.range||"day")}}),list:bf(function(t,r){var i=new Intl.ListFormat(t,el({},r));return function(s){return i.format(s)}})},this.init(e)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=bf(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(A,c){var u=Mpe(c),f=u.formatName,d=u.formatOptions;if(s.formats[f]){var h=A;try{var p=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},m=p.locale||p.lng||o.locale||o.lng||i;h=s.formats[f](A,m,el(el(el({},d),o),p))}catch(g){s.logger.warn(g)}return h}else s.logger.warn("there was no format function for ".concat(f));return A},t);return l}}]),n}();function Gk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Zk(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function kpe(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Vpe=function(n){cb(t,n);var e=Npe(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return lo(this,t),o=e.call(this),ub&&rc.call(JA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ha.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Ao(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},f={};return i.forEach(function(d){var h=!0;s.forEach(function(p){var m="".concat(d,"|").concat(p);!o.reload&&l.store.hasResourceBundle(d,p)?l.state[m]=2:l.state[m]<0||(l.state[m]===1?c[m]===void 0&&(c[m]=!0):(l.state[m]=1,h=!1,c[m]===void 0&&(c[m]=!0),A[m]===void 0&&(A[m]=!0),f[p]===void 0&&(f[p]=!0)))}),h||(u[d]=!0)}),(Object.keys(A).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(A),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],A=a[1];s&&this.emit("failedLoading",l,A,s),o&&this.store.addResourceBundle(l,A,o),this.state[i]=s?-1:2;var c={};this.queue.forEach(function(u){mpe(u.loaded,[l],A),kpe(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){c[f]||(c[f]={});var d=u.loaded[f];d.length&&d.forEach(function(h){c[f][h]===void 0&&(c[f][h]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!i.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:A,callback:c});return}this.readingCalls++;var u=function(p,m){if(a.readingCalls--,a.waitingReads.length>0){var g=a.waitingReads.shift();a.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}if(p&&m&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var A=this.queueLoad(i,s,a,l);if(!A.toLoad.length)return A.pending.length||l(),null;A.toLoad.forEach(function(c){o.loadOne(c)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],A=a[1];this.read(l,A,"read",void 0,void 0,function(c,u){c&&s.logger.warn("".concat(o,"loading namespace ").concat(A," for language ").concat(l," failed"),c),!c&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(A," for language ").concat(l),u),s.loaded(i,c,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=Zk(Zk({},A),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var d;f.length===5?d=f(i,s,o,a,u):d=f(i,s,o,a),d&&typeof d.then=="function"?d.then(function(h){return c(null,h)}).catch(c):c(null,d)}catch(h){c(h)}else f(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(rc);function Jk(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(Ks(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ks(e[2])==="object"||Ks(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Hk(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function zk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Xo(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function py(){}function Wpe(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Hw=function(n){cb(t,n);var e=Lpe(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(lo(this,t),r=e.call(this),ub&&rc.call(JA(r)),r.options=Hk(i),r.services={},r.logger=ha,r.modules={external:[]},Wpe(JA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),m0(r,JA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Ao(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=Jk();this.options=Xo(Xo(Xo({},a),this.options),Hk(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Xo(Xo({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(g){return g?typeof g=="function"?new g:g:null}if(!this.options.isClone){this.modules.logger?ha.init(l(this.modules.logger),this.options):ha.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Tpe);var c=new Lk(this.options);this.store=new xpe(this.options.resources,this.options);var u=this.services;u.logger=ha,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Qpe(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),A&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(A),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Rpe(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Vpe(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(g){for(var v=arguments.length,y=new Array(v>1?v-1:0),w=1;w1?v-1:0),w=1;w0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var d=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];d.forEach(function(g){i[g]=function(){var v;return(v=i.store)[g].apply(v,arguments)}});var h=["addResource","addResources","addResourceBundle","removeResourceBundle"];h.forEach(function(g){i[g]=function(){var v;return(v=i.store)[g].apply(v,arguments),i}});var p=Zp(),m=function(){var v=function(w,C){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),p.resolve(C),o(w,C)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?m():setTimeout(m,0),p}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:py,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var A=[],c=function(d){if(d){var h=s.services.languageUtils.toResolveHierarchy(d);h.forEach(function(p){A.indexOf(p)<0&&A.push(p)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return c(f)})}this.options.preload&&this.options.preload.forEach(function(f){return c(f)}),this.services.backendConnector.load(A,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=Zp();return i||(i=this.languages),s||(s=this.options.ns),o||(o=py),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&JH.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=Zp();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},A=function(f,d){d?(l(d),o.translator.changeLanguage(d),o.isLanguageChangingTo=void 0,o.emit("languageChanged",d),o.logger.log("languageChanged",d)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},c=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var d=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);d&&(o.language||l(d),o.translator.language||o.translator.changeLanguage(d),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(d)),o.loadResources(d,function(h){A(h,d)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function A(c,u){var f;if(Ks(u)!=="object"){for(var d=arguments.length,h=new Array(d>2?d-2:0),p=2;p1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,A=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var c=function(d,h){var p=s.services.backendConnector.state["".concat(d,"|").concat(h)];return p===-1||p===2};if(o.precheck){var u=o.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(a,i)&&(!l||c(A,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=Zp();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=Zp();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(A){return a.indexOf(A)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(A){o.resolve(),s&&s(A)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new Lk(Jk());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:py,a=Xo(Xo(Xo({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var A=["store","services","language"];return A.forEach(function(c){l[c]=i[c]}),l.services=Xo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new Vk(l.services,l.options),l.translator.on("*",function(c){for(var u=arguments.length,f=new Array(u>1?u-1:0),d=1;d0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new Hw(n,e)});var ei=Hw.createInstance();ei.createInstance=Hw.createInstance;ei.createInstance;ei.dir;ei.init;ei.loadResources;ei.reloadResources;ei.use;ei.changeLanguage;ei.getFixedT;ei.t;ei.exists;ei.setDefaultNamespace;ei.hasLoadedNamespace;ei.loadNamespaces;ei.loadLanguages;function Ope(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,A){var c=e.services.backendConnector.state["".concat(l,"|").concat(A)];return c===-1||c===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function Zpe(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return uU("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):Gpe(n,e,t)}var Jpe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Hpe={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},zpe=function(e){return Hpe[e]},Ype=function(e){return e.replace(Jpe,zpe)};function Kk(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jk(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};fU=jk(jk({},fU),n)}function Kpe(){return fU}var HH;function jpe(n){HH=n}function $pe(){return HH}var qpe={type:"3rdParty",init:function(e){Xpe(e.options.react),jpe(e)}},ege=me.createContext(),tge=function(){function n(){lo(this,n),this.usedNamespaces={}}return Ao(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function nge(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,A=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(c){A=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(A)throw i}}return a}}function rge(n,e){return PH(n)||nge(n,e)||WH(n,e)||OH()}function $k(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function v1(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=me.useContext(ege)||{},i=r.i18n,s=r.defaultNS,o=t||i||$pe();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new tge),!o){uU("You will need to pass in an i18next instance by using initReactI18next");var a=function(S,R){return typeof R=="string"?R:R&&Ks(R)==="object"&&typeof R.defaultValue=="string"?R.defaultValue:Array.isArray(S)?S[S.length-1]:S},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&uU("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=v1(v1(v1({},Kpe()),o.options.react),e),c=A.useSuspense,u=A.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var d=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(x){return Zpe(x,o,A)});function h(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var p=me.useState(h),m=rge(p,2),g=m[0],v=m[1],y=f.join(),w=ige(y),C=me.useRef(!0);me.useEffect(function(){var x=A.bindI18n,S=A.bindI18nStore;C.current=!0,!d&&!c&&Xk(o,f,function(){C.current&&v(h)}),d&&w&&w!==y&&C.current&&v(h);function R(){C.current&&v(h)}return x&&o&&o.on(x,R),S&&o&&o.store.on(S,R),function(){C.current=!1,x&&o&&x.split(" ").forEach(function(Z){return o.off(Z,R)}),S&&o&&S.split(" ").forEach(function(Z){return o.store.off(Z,R)})}},[o,y]);var b=me.useRef(!0);me.useEffect(function(){C.current&&!b.current&&v(h),b.current=!1},[o,u]);var F=[g,o,d];if(F.t=g,F.i18n=o,F.ready=d,d||!d&&!c)return F;throw new Promise(function(x){Xk(o,f,function(){x()})})}var YH=[],sge=YH.forEach,oge=YH.slice;function age(n){return sge.call(oge.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var qk=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,lge=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!qk.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!qk.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},eV={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=lge(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},Jp=null,tV=function(){if(Jp!==null)return Jp;try{Jp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Jp=!1}return Jp},uge={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&tV()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&tV()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Hp=null,nV=function(){if(Hp!==null)return Hp;try{Hp=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Hp=!1}return Hp},fge={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&nV()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&nV()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},dge={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},hge={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},pge={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},gge={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function mge(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var XH=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};lo(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Ao(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=age(r,this.options||{},mge()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Age),this.addDetector(cge),this.addDetector(uge),this.addDetector(fge),this.addDetector(dge),this.addDetector(hge),this.addDetector(pge),this.addDetector(gge)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();XH.type="languageDetector";const vge={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",createBio:"Create Bio",saveCharacter:"Save Your Character",chat:"Chat With Your Character"},classes:{beastPainter:{name:"Beast Painter",description:"Paints beasts"},engineer:{name:"Engineer",description:"Builds things"},dropHunter:{name:"Drop Hunter",description:"Hunts drops"},theDegen:{name:"The Degen",description:"Degens"},neuralHacker:{name:"Neural Hacker",description:"Hacks neural networks"},liskWitch:{name:"Lisk Witch",description:"Witches lisk"},bruiser:{name:"Bruiser",description:"Bruises things"}},callToAction:{next:"Next",back:"Back",randomize:"Randomize",chat:"Chat",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",bio:"Bio",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},yge={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",createBio:"Создать Биографию",saveCharacter:"Сохранить Персонажа",chat:"Общаться Со Своим Персонажем"},classes:{beastPainter:{name:"Анималист",description:"Рисует зверей"},engineer:{name:"Инженер",description:"Строит вещи"},dropHunter:{name:"Охотник за дропами",description:"Охотится на дропы"},theDegen:{name:"Деген",description:"Дегены"},neuralHacker:{name:"Нейронный Хакер",description:"Взламывает нейр. сети"},liskWitch:{name:"Лиск Ведьма",description:"Лиск Ведьмы"},bruiser:{name:"Громила",description:"Громит вещи"}},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",chat:"Чат",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",bio:"Биография",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},Bge={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",createBio:"创建简介",saveCharacter:"保存角色",chat:"与你的角色聊天"},classes:{beastPainter:{name:"野兽画家",description:"画野兽"},engineer:{name:"工程师",description:"建造物品"},dropHunter:{name:"投放猎手",description:"猎取投放品"},theDegen:{name:"豪赌家",description:"资深赌徒"},neuralHacker:{name:"神经黑客",description:"侵入神经网络"},liskWitch:{name:"Lisk 巫师",description:"施法于 Lisk"},bruiser:{name:"碾压者",description:"碾碎一切"}},callToAction:{next:"下一步",back:"返回",randomize:"随机",chat:"聊天",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",bio:"简介",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},wge={en:vge,ru:yge,zh:Bge};ei.use(XH).use(qpe).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:wge});const Bs=me.createContext(),Cge=n=>{const{t:e}=zH();return W.jsx(Bs.Provider,{value:{t:e},children:n.children})},bge=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4902,4 +4902,4 @@ ${F}:`,max_tokens:250,temperature:.9,top_p:1,frequency_penalty:0,presence_penalt background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0)); background: linear-gradient(to top, #000, rgba(0,0,0,0)); } - `),z.createElement("div",{style:c.white,className:"saturation-white"},z.createElement("div",{style:c.black,className:"saturation-black"}),z.createElement("div",{style:c.pointer},this.props.pointer?z.createElement(this.props.pointer,this.props):z.createElement("div",{style:c.circle}))))}}]),e}(me.PureComponent||me.Component);function TDe(n,e){for(var t=-1,r=n==null?0:n.length;++t=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return Ke(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(tke,arguments)},brighten:function(){return this._applyModification(nke,arguments)},darken:function(){return this._applyModification(rke,arguments)},desaturate:function(){return this._applyModification($De,arguments)},saturate:function(){return this._applyModification(qDe,arguments)},greyscale:function(){return this._applyModification(eke,arguments)},spin:function(){return this._applyModification(ike,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(ake,arguments)},complement:function(){return this._applyCombination(ske,arguments)},monochromatic:function(){return this._applyCombination(lke,arguments)},splitcomplement:function(){return this._applyCombination(oke,arguments)},triad:function(){return this._applyCombination(GL,[3])},tetrad:function(){return this._applyCombination(GL,[4])}};Ke.fromRatio=function(n,e){if(AC(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Cg(n[r]));n=t}return Ke(n,e)};function zDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=dke(n)),AC(n)=="object"&&(tl(n.r)&&tl(n.g)&&tl(n.b)?(e=YDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):tl(n.h)&&tl(n.s)&&tl(n.v)?(r=Cg(n.s),i=Cg(n.v),e=KDe(n.h,r,i),o=!0,a="hsv"):tl(n.h)&&tl(n.s)&&tl(n.l)&&(r=Cg(n.s),s=Cg(n.l),e=XDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=O5(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function YDe(n,e,t){return{r:Bn(n,255)*255,g:Bn(e,255)*255,b:Bn(t,255)*255}}function LL(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function PL(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(Ke(r));return s}function lke(n,e){e=e||6;for(var t=Ke(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(Ke({h:r,s:i,v:s})),s=(s+a)%1;return o}Ke.mix=function(n,e,t){t=t===0?0:t||50;var r=Ke(n).toRgb(),i=Ke(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return Ke(o)};Ke.readability=function(n,e){var t=Ke(n),r=Ke(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};Ke.isReadable=function(n,e,t){var r=Ke.readability(n,e),i,s;switch(s=!1,i=hke(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};Ke.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var A=0;Ai&&(i=s,r=Ke(e[A]));return Ke.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,Ke.mostReadable(n,["#fff","#000"],t))};var MU=Ke.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Ake=Ke.hexNames=cke(MU);function cke(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function O5(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Bn(n,e){uke(n)&&(n="100%");var t=fke(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function Nb(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function uke(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function fke(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Qo(n){return n.length==1?"0"+n:""+n}function Cg(n){return n<=1&&(n=n*100+"%"),n}function G5(n){return Math.round(parseFloat(n)*255).toString(16)}function ZL(n){return Hi(n)/255}var bo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function tl(n){return!!bo.CSS_UNIT.exec(n)}function dke(n){n=n.replace(JDe,"").replace(HDe,"").toLowerCase();var e=!1;if(MU[n])n=MU[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=bo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=bo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=bo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bo.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:ZL(t[4]),format:e?"name":"hex8"}:(t=bo.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=bo.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:ZL(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bo.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function hke(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var JL=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return ZDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},bg=function(e,t){var r=e.hex?Ke(e.hex):Ke(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},pc=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&Ke(e).isValid()},NQ=function(e){if(!e)return"#fff";var t=bg(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},V1=function(e,t){var r=e.replace("°","");return Ke(t+" ("+r+")")._ok},$p=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){Cke(i,r);function i(){var s,o,a,l;wke(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,d=t&Tke?new cC:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Uy=24,nLe=q5.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Uy:r,s=n.height,o=s===void 0?Uy:s,a=n.style,l=a===void 0?{}:a,A=tLe(n,["fill","width","height","style"]);return c3.default.createElement("svg",A3({viewBox:"0 0 "+Uy+" "+Uy,style:A3({fill:t,width:i,height:o},l)},A),c3.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},rLe=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(l3(i.s)?r.props.hsl.s:i.s),l:Number(l3(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return rLe(e,[{key:"render",value:function(){var r=this,i=ut({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),z.createElement("div",{style:i.alpha},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),z.createElement("div",{style:i.alpha},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),z.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,z.createElement("div",{style:i.toggle},z.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},z.createElement(nLe,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(z.Component);ez.defaultProps={view:"hex"};var u3=function(){var e=ut({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return z.createElement("div",{style:e.picker})},aLe=function(){var e=ut({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return z.createElement("div",{style:e.picker})},WQ=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,f=e.className,d=f===void 0?"":f,h=e.defaultView,p=ut(Vi({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return z.createElement("div",{style:p.picker,className:"chrome-picker "+d},z.createElement("div",{style:p.saturation},z.createElement(Tb,{style:p.Saturation,hsl:o,hsv:a,pointer:aLe,onChange:r})),z.createElement("div",{style:p.body},z.createElement("div",{style:p.controls,className:"flexbox-fix"},z.createElement("div",{style:p.color},z.createElement("div",{style:p.swatch},z.createElement("div",{style:p.active}),z.createElement(ip,{renderers:A}))),z.createElement("div",{style:p.toggles},z.createElement("div",{style:p.hue},z.createElement(sp,{style:p.Hue,hsl:o,pointer:u3,onChange:r})),z.createElement("div",{style:p.alpha},z.createElement(EQ,{style:p.Alpha,rgb:s,hsl:o,pointer:u3,renderers:A,onChange:r})))),z.createElement(ez,{rgb:s,hsl:o,hex:l,view:h,onChange:r,disableAlpha:i})))};WQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),disableAlpha:Ne.bool,styles:Ne.object,defaultView:Ne.oneOf(["hex","rgb","hsl"])};WQ.defaultProps={width:225,disableAlpha:!1,styles:{}};const lLe=Li(WQ);var ALe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ut({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:NQ(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return z.createElement(Vu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},z.createElement("div",{style:a.dot}))},cLe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ut({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return z.createElement("div",{style:s.fields,className:"flexbox-fix"},z.createElement("div",{style:s.active}),z.createElement(Rt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},OQ=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ut(Vi({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(h,p){h.hex?pc(h.hex)&&t({hex:h.hex,source:"hex"},p):t(h,p)};return z.createElement(_0,{style:u.Compact,styles:l},z.createElement("div",{style:u.compact,className:"compact-picker "+c},z.createElement("div",null,Lu(i,function(d){return z.createElement(ALe,{key:d,color:d,active:d.toLowerCase()===s,onClick:f,onSwatchHover:r})}),z.createElement("div",{style:u.clear})),z.createElement(cLe,{hex:s,rgb:o,onChange:f})))};OQ.propTypes={colors:Ne.arrayOf(Ne.string),styles:Ne.object};OQ.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};Li(OQ);var uLe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=ut({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return z.createElement("div",{style:a.swatch},z.createElement(Vu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const fLe=FQ(uLe);var GQ=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ut(Vi({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(h,p){return i({hex:h,source:"hex"},p)};return z.createElement("div",{style:u.card,className:"github-picker "+c},z.createElement("div",{style:u.triangleShadow}),z.createElement("div",{style:u.triangle}),Lu(r,function(d){return z.createElement(fLe,{color:d,key:d,onClick:f,onSwatchHover:s})}))};GQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),colors:Ne.arrayOf(Ne.string),triangle:Ne.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ne.object};GQ.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Li(GQ);var dLe=function(e){var t=e.direction,r=ut({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return z.createElement("div",{style:r.picker})},hLe=Object.assign||function(n){for(var e=1;e.5});return z.createElement("div",{style:r.picker})},vLe=function(){var e=ut({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return z.createElement("div",{style:e.pointer},z.createElement("div",{style:e.left},z.createElement("div",{style:e.leftInside})),z.createElement("div",{style:e.right},z.createElement("div",{style:e.rightInside})))},f3=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ut({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return z.createElement("div",{style:o.button,onClick:t},r||i)},yLe=function(e){var t=e.rgb,r=e.currentColor,i=ut({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return z.createElement("div",null,z.createElement("div",{style:i.label},"new"),z.createElement("div",{style:i.swatches},z.createElement("div",{style:i.new}),z.createElement("div",{style:i.current})),z.createElement("div",{style:i.label},"current"))},BLe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return z.createElement("div",{style:a.fields,className:"flexbox-fix"},z.createElement("div",{style:a.double},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.alpha},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},ILe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Sy=24,RLe=nz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Sy:r,s=n.height,o=s===void 0?Sy:s,a=n.style,l=a===void 0?{}:a,A=QLe(n,["fill","width","height","style"]);return h3.default.createElement("svg",d3({viewBox:"0 0 "+Sy+" "+Sy,style:d3({fill:t,width:i,height:o},l)},A),h3.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},MLe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,A=ut({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:NQ(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return z.createElement(Vu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},z.createElement("div",{style:A.check},z.createElement(RLe,null)))},TLe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ut({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return z.createElement("div",{style:o.group},Lu(i,function(a,l){return z.createElement(MLe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},YQ=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ut(Vi({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),d=function(p,m){return i({hex:p,source:"hex"},m)};return z.createElement("div",{style:f.picker,className:"swatches-picker "+u},z.createElement(_0,null,z.createElement("div",{style:f.overflow},z.createElement("div",{style:f.body},Lu(o,function(h){return z.createElement(TLe,{key:h.toString(),group:h,active:a,onClick:d,onSwatchHover:s})}),z.createElement("div",{style:f.clear})))))};YQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),height:Ne.oneOfType([Ne.string,Ne.number]),colors:Ne.arrayOf(Ne.arrayOf(Ne.string)),styles:Ne.object};YQ.defaultProps={width:320,height:240,colors:[[Tf[900],Tf[700],Tf[500],Tf[300],Tf[100]],[Nf[900],Nf[700],Nf[500],Nf[300],Nf[100]],[Df[900],Df[700],Df[500],Df[300],Df[100]],[kf[900],kf[700],kf[500],kf[300],kf[100]],[Vf[900],Vf[700],Vf[500],Vf[300],Vf[100]],[Lf[900],Lf[700],Lf[500],Lf[300],Lf[100]],[Pf[900],Pf[700],Pf[500],Pf[300],Pf[100]],[Wf[900],Wf[700],Wf[500],Wf[300],Wf[100]],[Of[900],Of[700],Of[500],Of[300],Of[100]],["#194D33",xg[700],xg[500],xg[300],xg[100]],[Gf[900],Gf[700],Gf[500],Gf[300],Gf[100]],[Zf[900],Zf[700],Zf[500],Zf[300],Zf[100]],[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[Hf[900],Hf[700],Hf[500],Hf[300],Hf[100]],[zf[900],zf[700],zf[500],zf[300],zf[100]],[Yf[900],Yf[700],Yf[500],Yf[300],Yf[100]],[Xf[900],Xf[700],Xf[500],Xf[300],Xf[100]],[Kf[900],Kf[700],Kf[500],Kf[300],Kf[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Li(YQ);var XQ=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ut(Vi({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),d=function(p,m){pc(p)&&t({hex:p,source:"hex"},m)};return z.createElement("div",{style:f.card,className:"twitter-picker "+u},z.createElement("div",{style:f.triangleShadow}),z.createElement("div",{style:f.triangle}),z.createElement("div",{style:f.body},Lu(s,function(h,p){return z.createElement(Vu,{key:p,color:h,hex:h,style:f.swatch,onClick:d,onHover:r,focusStyle:{boxShadow:"0 0 4px "+h}})}),z.createElement("div",{style:f.hash},"#"),z.createElement(Rt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:d}),z.createElement("div",{style:f.clear})))};XQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),triangle:Ne.oneOf(["hide","top-left","top-right"]),colors:Ne.arrayOf(Ne.string),styles:Ne.object};XQ.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Li(XQ);var KQ=function(e){var t=ut({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return z.createElement("div",{style:t.picker})};KQ.propTypes={hsl:Ne.shape({h:Ne.number,s:Ne.number,l:Ne.number,a:Ne.number})};KQ.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var jQ=function(e){var t=ut({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return z.createElement("div",{style:t.picker})};jQ.propTypes={hsl:Ne.shape({h:Ne.number,s:Ne.number,l:Ne.number,a:Ne.number})};jQ.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var NLe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(d,h){if(d.hex)pc(d.hex)&&t({hex:d.hex,source:"hex"},h);else if(d.rgb){var p=d.rgb.split(",");V1(d.rgb,"rgb")&&t({r:p[0],g:p[1],b:p[2],a:1,source:"rgb"},h)}else if(d.hsv){var m=d.hsv.split(",");V1(d.hsv,"hsv")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),m[1]==1?m[1]=.01:m[2]==1&&(m[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsv"},h))}else if(d.hsl){var g=d.hsl.split(",");V1(d.hsl,"hsl")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsl"},h))}},l=ut({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),A=r.r+", "+r.g+", "+r.b,c=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return z.createElement("div",{style:l.wrap,className:"flexbox-fix"},z.createElement("div",{style:l.fields},z.createElement("div",{style:l.double},z.createElement(Rt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),z.createElement("div",{style:l.column},z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},$Q=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,f=u===void 0?"":u,d=ut(Vi({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},c));return z.createElement("div",{style:d.picker,className:"google-picker "+f},z.createElement("div",{style:d.head},l),z.createElement("div",{style:d.swatch}),z.createElement("div",{style:d.saturation},z.createElement(Tb,{hsl:s,hsv:o,pointer:KQ,onChange:r})),z.createElement("div",{style:d.body},z.createElement("div",{style:d.controls,className:"flexbox-fix"},z.createElement("div",{style:d.hue},z.createElement(sp,{style:d.Hue,hsl:s,radius:"4px",pointer:jQ,onChange:r}))),z.createElement(NLe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};$Q.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),styles:Ne.object,header:Ne.string};$Q.defaultProps={width:652,styles:{},header:"Color picker"};Li($Q);function DLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,debugMode:a}=z.useContext(qr),{playSound:l}=z.useContext(ys),{isMute:A}=z.useContext(vs),{t:c}=me.useContext(Bs),u=()=>{!A&&l("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(st.CREATE),r(!1)},[f,d]=z.useState(null),[h,p]=z.useState(null),[m,g]=z.useState(""),[v,y]=z.useState(null),[w,C]=z.useState(null),[b,F]=z.useState(""),[x,S]=z.useState(!1),[R,Z]=z.useState({background:"#ffffff"}),Y=()=>{!A&&l("backNextButton"),e(st.SAVE),r(!1)},Q=()=>{t(!0),d(null),i.loadRandomTraits().then(()=>{console.log("success"),m!=""&&y(i.getCurrentTraitData(m)),t(!1)}).catch(ne=>{t(!1),console.error("Error loading random traits:",ne.message)})},B=ne=>{Z({background:ne.hex})},E=ne=>{Z({background:ne.hex}),i.setTraitColor(m,ne.hex)},M=()=>{r()},D=async ne=>{const ie=nc(ne.name),ue=URL.createObjectURL(ne);await s.loadAnimation(ue,!0,"",ie),F(s.getCurrentAnimationName())},T=ne=>{if(S(!1),m!=""){t(!0);const ie=URL.createObjectURL(ne);i.loadCustomTexture(m,ie).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},V=ne=>{if(S(!1),m!=""){t(!0);const ie=URL.createObjectURL(ne);i.loadCustomTrait(m,ie).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},G=ne=>{S(!1),t(!0),i.loadTrait(ne.traitGroup.trait,ne.id).then(()=>{t(!1),y(ne)})},P=ne=>{S(!1),i.removeTrait(ne),y(null)},U=ne=>{S(!1),t(!0),i.loadRandomTrait(ne).then(()=>{t(!1),y(i.getCurrentTraitData(ne))})},H=ne=>{S(!1);const ie=Array.from(ne),ue=[],j=se=>new Promise((ce,Be)=>{var ge;if(se&&se.name.toLowerCase().endsWith(".json")){const Fe=new FileReader,nt=`${(ge=i.manifestData)==null?void 0:ge.getAssetsDirectory()}/anata/_thumbnails/t_${se.name.split("_")[0]}.jpg`;console.log(nt),Fe.onload=function(We){try{const Te=JSON.parse(We.target.result);Te.thumb=nt,ue.push(Te),ce()}catch(Te){console.error("Error parsing the JSON file:",Te),Be(Te)}},Fe.readAsText(se)}});Promise.all(ie.map(j)).then(()=>{ue.length>0&&(d(ue),t(!0),i.loadTraitsFromNFTObject(ue[0]).then(()=>{t(!1)}))}).catch(se=>{console.error("Error processing files:",se)})},oe=async ne=>{const ie=ne[0];ie&&ie.name.toLowerCase().endsWith(".fbx")&&D(ie),ie&&(ie.name.toLowerCase().endsWith(".png")||ie.name.toLowerCase().endsWith(".jpg"))&&T(ie),ie&&ie.name.toLowerCase().endsWith(".vrm")&&V(ie),ie&&ie.name.toLowerCase().endsWith(".json")&&H(ne)},k=ne=>{!A&&l("optionClick"),S(!1),m!==ne.trait?(p(i.getTraits(ne.trait)),g(ne.trait),y(i.getCurrentTraitData(ne.trait)),C(i.getCurrentTraitVRM(ne.trait)),o({targetY:ne.cameraTarget.height,distance:ne.cameraTarget.distance})):(p(null),g(""),y(null),o({targetY:.8,distance:3.2}))},K=()=>{S(!1);var ne=document.createElement("input");ne.type="file",ne.accept=".vrm",ne.onchange=ie=>{var ue=ie.target.files[0];if(ue.name.endsWith(".vrm")){const j=URL.createObjectURL(ue);t(!0),i.loadCustomTrait(m,j).then(()=>{t(!1)})}},ne.click()};return W.jsxs("div",{className:yn.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:c("pageTitles.chooseAppearance")}),W.jsx(B0,{onFilesDrop:oe}),W.jsxs("div",{className:yn.sideMenu,children:[W.jsx(bh,{title:"Appearance",left:20}),W.jsx("div",{className:yn.bottomLine}),W.jsx("div",{className:yn.scrollContainer,children:W.jsx("div",{className:yn["editor-container"],children:i.getGroupTraits().map((ne,ie)=>W.jsxs("div",{className:yn.editorButton,onClick:()=>{k(ne)},children:[W.jsx(Iy,{size:56,icon:ne.fullIconSvg,rarity:m!==ne.trait?"none":"mythic"}),W.jsx("div",{className:yn.editorText,children:ne.name})]},"options_"+ie))})})]}),!!h&&W.jsxs("div",{className:yn.selectorContainerPos,children:[W.jsx(bh,{title:m,width:130,left:20}),v&&W.jsx("div",{className:yn.selectorColorPickerButton,onClick:()=>{S(!x)},children:W.jsx("img",{className:yn.selectorColorPickerImg,src:Jwe})}),!!x&&W.jsx("div",{draggable:!1,className:yn.selectorColorPickerUI,children:W.jsx(lLe,{draggable:!1,width:"200px",color:R.background,onChange:B,onChangeComplete:E})}),W.jsx("div",{className:yn.bottomLine}),W.jsx("div",{className:yn.scrollContainerOptions,children:W.jsxs("div",{className:yn["selector-container"],children:[W.jsx("div",{className:`${yn.selectorButton}`,onClick:()=>{U(m)},children:W.jsx(Iy,{size:56,icon:Zwe,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(m)?W.jsx(W.Fragment,{}):W.jsx("div",{className:`${yn.selectorButton}`,icon:MV,onClick:()=>{P(m)},children:W.jsx(Iy,{size:56,icon:MV,rarity:v==null?"mythic":"none"})},"no-trait"),h.map(ne=>{let ie=ne.id===(v==null?void 0:v.id);return W.jsx("div",{className:`${yn.selectorButton}`,onClick:()=>{G(ne)},children:W.jsx(Iy,{size:56,icon:ne.fullThumbnail,rarity:ie?"mythic":"none"})},ne.id)})]})}),W.jsx("div",{className:yn.uploadContainer,children:W.jsx("div",{className:yn.uploadButton,onClick:K,children:W.jsx("div",{children:"Upload "})})})]}),W.jsx(aQ,{jsonSelectionArray:f}),W.jsx(ywe,{selectedTrait:v,selectedVRM:w,animationName:b,setAnimationName:F}),W.jsx(Awe,{loadedAnimationName:b,randomize:Q}),W.jsxs("div",{className:yn.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:c("callToAction.back"),size:14,className:yn.buttonLeft,onClick:u}),i.canDownload()&&W.jsx(Zt,{theme:"light",text:c("callToAction.next"),size:14,className:yn.buttonRight,onClick:Y}),W.jsx(Zt,{theme:"light",text:c("callToAction.randomize"),size:14,className:yn.buttonCenter,onClick:Q}),W.jsx(Zt,{theme:"light",text:a?"normal":"debug",size:14,className:yn.buttonCenter,onClick:M})]})]})}const kLe="_InformationContainerPos_rgqwy_1",VLe="_traitInfoTitle_rgqwy_13",LLe="_traitInfoText_rgqwy_21",PLe="_flexSelect_rgqwy_30",WLe="_scrollContainer_rgqwy_65",OLe="_checked_rgqwy_90",GLe="_checkmark_rgqwy_94",ZLe="_checkboxHolder_rgqwy_107",JLe="_buttonContainer_rgqwy_114",HLe="_buttonLeft_rgqwy_123",zLe="_buttonRight_rgqwy_127",YLe="_buttonCenter_rgqwy_131",Ur={InformationContainerPos:kLe,traitInfoTitle:VLe,traitInfoText:LLe,flexSelect:PLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:WLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:OLe,checkmark:GLe,checkboxHolder:ZLe,buttonContainer:JLe,buttonLeft:HLe,buttonRight:zLe,buttonCenter:YLe},XLe="_InformationContainerPos_1cryw_2",KLe="_scrollContainer_1cryw_16",jLe="_traitInfoTitle_1cryw_28",$Le="_traitInfoText_1cryw_38",qLe="_flexSelect_1cryw_66",e3e="_checked_1cryw_123",t3e="_checkmark_1cryw_127",n3e="_checkboxHolder_1cryw_140",yi={InformationContainerPos:XLe,scrollContainer:KLe,traitInfoTitle:jLe,traitInfoText:$Le,"input-box":"_input-box_1cryw_47",flexSelect:qLe,"arrow-button":"_arrow-button_1cryw_74","left-button":"_left-button_1cryw_90","right-button":"_right-button_1cryw_97","anim-button":"_anim-button_1cryw_104","custom-checkbox":"_custom-checkbox_1cryw_109","checkbox-container":"_checkbox-container_1cryw_114",checked:e3e,checkmark:t3e,checkboxHolder:n3e};function qQ({model:n}){const[e,t]=me.useState(0),[r,i]=me.useState(0),[s,o]=me.useState(0),[a,l]=me.useState(0),[A,c]=me.useState(0),[u,f]=me.useState(0),[d,h]=me.useState(0),[p,m]=me.useState(0);return me.useEffect(()=>{if(n!=null){const g=wh(n,"Mesh"),v=wh(n,"SkinnedMesh");t(g.length),i(v.length);const y=g.concat(v),{stdMats:w,stdCutoutpMats:C,stdTranspMats:b,mToonMats:F,mToonCutoutMats:x,mToonTranspMats:S}=Hde(y);o(w.length),l(b.length),c(C.length),f(F.length),h(S.length),m(x.length)}},[n]),n!=null?W.jsx("div",{children:W.jsxs("div",{className:yi.InformationContainerPos,children:[W.jsx(bh,{title:"Model Information",width:180,right:20}),W.jsxs("div",{className:yi.scrollContainer,children:[W.jsx("div",{className:yi.traitInfoTitle,children:"Meshes:"}),W.jsx("div",{className:yi.traitInfoText,children:e}),W.jsx("div",{className:yi.traitInfoTitle,children:"SkinnedMeshes:"}),W.jsx("div",{className:yi.traitInfoText,children:r}),W.jsx("div",{className:yi.traitInfoTitle,children:"Standard Material Count:"}),W.jsxs("div",{className:yi.traitInfoText,children:["opaque: ",s]}),W.jsxs("div",{className:yi.traitInfoText,children:["cutout: ",A]}),W.jsxs("div",{className:yi.traitInfoText,children:["transparent: ",a]}),W.jsx("div",{className:yi.traitInfoTitle,children:"MToon Material Count:"}),W.jsxs("div",{className:yi.traitInfoText,children:["opaque: ",u]}),W.jsxs("div",{className:yi.traitInfoText,children:["cutout: ",p]}),W.jsxs("div",{className:yi.traitInfoText,children:["transparent: ",d]})]})]})}):W.jsx(W.Fragment,{})}function r3e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{characterManager:r,animationManager:i}=z.useContext(qr),[s,o]=me.useState(null),[a,l]=me.useState(""),{playSound:A}=z.useContext(ys),{isMute:c}=z.useContext(vs),[u,f]=z.useState(null),d=()=>{!c&&A("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(st.LANDING)},h=()=>{const b=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:b===0||b==2,exportMtoonAtlas:b===1||b==2,ktxCompression:at.merge_options_ktx_compression||!1}},p=b=>{r.loadTraitsFromNFTObject(u[b]).then(()=>{r.downloadVRM(u[b].name,h()).then(()=>{b{t(!0),p(0)},{t:g}=me.useContext(Bs),v=async b=>{if(r.getCurrentOptimizerCharacterModel()){const x=nc(b.name),S=URL.createObjectURL(b);await i.loadAnimation(S,!0,"",x),i.addVRM(r.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(S)}else console.warn("Please load a vrm model to test animations.")},y=async b=>{const F=URL.createObjectURL(b);await r.loadOptimizerCharacter(F),URL.revokeObjectURL(F);const x=nc(b.name);l(x),o(r.getCurrentCharacterModel())},w=b=>{const F=Array.from(b),x=[],S=R=>new Promise((Z,Y)=>{var Q;if(R&&R.name.toLowerCase().endsWith(".json")){const B=new FileReader,E=`${(Q=r.manifestData)==null?void 0:Q.getAssetsDirectory()}/anata/_thumbnails/t_${R.name.split("_")[0]}.jpg`;B.onload=function(M){try{const D=JSON.parse(M.target.result);D.thumb=E,x.push(D),Z()}catch(D){console.error("Error parsing the JSON file:",D),Y(D)}},B.readAsText(R)}});Promise.all(F.map(S)).then(()=>{x.length>0&&(f(x),t(!0),r.loadTraitsFromNFTObject(x[0]).then(()=>{t(!1)}))}).catch(R=>{console.error("Error processing files:",R)})},C=async b=>{const F=b[0];console.log("anim"),F&&F.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),v(F)),F&&F.name.toLowerCase().endsWith(".vrm")&&y(F),F&&F.name.toLowerCase().endsWith(".json")&&w(b)};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"Batch Download"}),W.jsx(B0,{onFilesDrop:C}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),W.jsx(qQ,{model:s}),W.jsx(aQ,{jsonSelectionArray:u}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:g("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:d}),(u==null?void 0:u.length)==1&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:m}),(u==null?void 0:u.length)>1&&W.jsx(Zt,{theme:"light",text:"Download All",size:14,className:Ur.buttonRight,onClick:m})]})]})}function i3e(){const{isLoading:n,setViewMode:e}=z.useContext(gi),{characterManager:t,animationManager:r}=z.useContext(qr),[i,s]=me.useState(null),[o,a]=me.useState(""),{playSound:l}=z.useContext(ys),{isMute:A}=z.useContext(vs),c=()=>{!A&&l("backNextButton"),t.removeCurrentCharacter(),t.removeCurrentManifest(),e(st.LANDING)},u=()=>{const g=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:g===0||g==2,exportMtoonAtlas:g===1||g==2,ktxCompression:at.merge_options_ktx_compression||!1}},f=()=>{t.downloadVRM(o+"_merged",u())},{t:d}=me.useContext(Bs),h=async g=>{if(t.getCurrentOptimizerCharacterModel()){const y=nc(g.name),w=URL.createObjectURL(g);await r.loadAnimation(w,!0,"",y),r.addVRM(t.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(w)}else console.warn("Please load a vrm model to test animations.")},p=async g=>{const v=URL.createObjectURL(g);await t.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const y=nc(g.name);a(y),s(t.getCurrentCharacterModel())},m=async g=>{const v=g[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),h(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&p(v)};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),W.jsx(B0,{onFilesDrop:m}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),W.jsx(qQ,{model:i}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:d("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:c}),i!=""&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:f})]})]})}const s3e="_languageSwitchWrap_83v6a_1",o3e={languageSwitchWrap:s3e},p3={en:{nativeName:"English"},ru:{nativeName:"Русский"},zh:{nativeName:"中文"}};function a3e(){const{t:n,i18n:e}=zH();return W.jsx("div",{className:o3e.languageSwitchWrap,children:W.jsx("select",{onChange:t=>e.changeLanguage(t.target.value),value:e.resolvedLanguage,children:Object.keys(p3).map(t=>W.jsx("option",{value:t,children:p3[t].nativeName},t))})})}function l3e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{characterManager:r,animationManager:i,toggleDebugMode:s,debugMode:o}=z.useContext(qr),[a,l]=me.useState(null),[A,c]=me.useState(""),{playSound:u}=z.useContext(ys),{isMute:f}=z.useContext(vs);z.useState(null);const[d,h]=z.useState(null),p=()=>{!f&&u("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(st.LANDING)},m=()=>{const R=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:R===0||R==2,exportMtoonAtlas:R===1||R==2,ktxCompression:at.merge_options_ktx_compression||!1}},g=async(R,Z=!1)=>{await r.setManifest(d[R]);const Y=d[R].manifestName;t(!0),r.loadInitialTraits().then(()=>{r.savePortraitScreenshot(Y,512,1024,1.5,-.1),Z?R{R{t(!0),g(0)},y=()=>{t(!0),g(0,!0)},{t:w}=me.useContext(Bs),C=async R=>{if(r.getCurrentOptimizerCharacterModel()){const Y=nc(R.name),Q=URL.createObjectURL(R);await i.loadAnimation(Q,!0,"",Y),i.addVRM(r.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(Q)}else console.warn("Please load a vrm model to test animations.")},b=async R=>{const Z=URL.createObjectURL(R);await r.loadOptimizerCharacter(Z),URL.revokeObjectURL(Z);const Y=nc(R.name);c(Y),l(r.getCurrentCharacterModel())},F=R=>{const Z=Array.from(R),Y=[],Q=B=>new Promise((E,M)=>{if(B&&B.name.toLowerCase().endsWith(".json")){const D=new FileReader,T=B.name.replace(/\.[^/.]+$/,"");D.onload=function(V){try{const G=JSON.parse(V.target.result),P=G.thumbnail;G.manifestName=T,Y.push(G),E()}catch(G){console.error("Error parsing the JSON file:",G),M(G)}},D.readAsText(B)}});Promise.all(Z.map(Q)).then(()=>{Y.length>0&&(h(Y),r.setManifest(Y[0]),t(!0),r.loadInitialTraits().then(()=>{t(!1)}))}).catch(B=>{console.error("Error processing files:",B)})},x=async R=>{const Z=R[0];Z&&Z.name.toLowerCase().endsWith(".fbx")&&C(Z),Z&&Z.name.toLowerCase().endsWith(".vrm")&&b(Z),Z&&Z.name.toLowerCase().endsWith(".json")&&F(R)},S=()=>{s()};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),W.jsx(B0,{onFilesDrop:x}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),W.jsx(qQ,{model:a}),W.jsx(aQ,{jsonSelectionArray:d,byManifest:!0}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:w("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:p}),W.jsx(Zt,{theme:"light",text:o?"normal":"debug",size:14,className:Ur.buttonCenter,onClick:S}),(d==null?void 0:d.length)==1&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:v}),(d==null?void 0:d.length)>1&&W.jsx(Zt,{theme:"light",text:"Download All",size:14,className:Ur.buttonRight,onClick:v}),(d==null?void 0:d.length)==1&&W.jsx(Zt,{theme:"light",text:"Get Image",size:14,className:Ur.buttonRight,onClick:y}),(d==null?void 0:d.length)>1&&W.jsx(Zt,{theme:"light",text:"Get All Images",size:14,className:Ur.buttonRight,onClick:y})]})]})}function A3e(){const{t:n}=me.useContext(Bs),{setViewMode:e,setIsLoading:t,isLoading:r}=z.useContext(gi),{playSound:i}=z.useContext(ys),{isMute:s}=z.useContext(vs),{manifest:o,characterManager:a}=z.useContext(qr);me.useState([]);const[l,A]=me.useState([]);me.useEffect(()=>{c()},[]);const c=async()=>{const p=await oQ();oBe(p,"the-anata-nft").then(m=>{A(m.nfts),console.log(m.nfts)})},u=()=>{e(st.LANDING),!s&&i("backNextButton")},f=async p=>{t(!0),a.loadManifest(o[p].manifest).then(()=>{e(st.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},d=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},h=()=>{!s&&i("classMouseOver")};return W.jsxs("div",{className:`${rt.container} horizontalScroll`,children:[W.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),W.jsx("div",{className:rt.vrmOptimizerButton}),W.jsx("div",{className:rt.topLine}),W.jsx("div",{className:rt.classContainer,children:l.map((p,m)=>W.jsxs("div",{className:rt.class,onClick:()=>f(m),onMouseOver:()=>h(),children:[W.jsx("div",{className:rt.classFrame,style:{backgroundImage:`url(${p.image_url})`},children:W.jsx("div",{className:rt.frameContainer,children:W.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:rt.frame})})}),W.jsx("div",{className:rt.name,children:p.name})]},m))}),W.jsx("div",{className:rt.bottomLine}),W.jsxs("div",{className:rt.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:n("callToAction.back"),size:14,className:rt.buttonLeft,onClick:u}),W.jsx(Zt,{theme:"light",text:"test",size:14,className:rt.buttonLeft,onClick:d})]})]})}const c3e="https://beta.anata.dev/character-assets/manifest.json";let P1;const W1=new X,_y=new X;let O1,G1;const u3e=1.4,f3e=new X(0,1.25,0),rz=new X(-.9786403788721187,1.4036900759197288,.9892635490125085),d3e=rz.length(),h3e=.35,g3=6,m3=new X(0,.8,0),iz=new X(-2.2367993753934425,1.1512971720174363,2.2612065299409223),p3e=iz.length(),g3e=.5,Ef=new X,Gi=new Pt,m3e=new Pt,v3e=new X(1,0,0),y3e=new X(0,1,0);async function B3e(n){return await(await fetch(n)).json()}async function w3e(){const n=await B3e(c3e),e=new Zge;return{initialManifest:n,effectManager:e}}const C3e=()=>{let n,e;const r=w3e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},b3e=C3e();function x3e(){const{initialManifest:n,effectManager:e}=b3e.read(),[t,r]=me.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=me.useContext(qr),{viewMode:u}=me.useContext(gi);e.camera=i,e.scene=o;const f=()=>{if(e.camera){if([st.BIO,st.CHAT].includes(u)){u===st.CHAT?(P1=u3e,W1.copy(f3e),_y.copy(rz),O1=d3e,G1=h3e):(P1=g3,W1.copy(m3),_y.copy(iz),O1=p3e,G1=g3e),Gi.set(0,0,O1,1).applyMatrix4(e.camera.projectionMatrix),Gi.x/=Gi.w,Gi.y/=Gi.w,Gi.z/=Gi.w;const b=m3e.set(G1*Gi.w,Gi.y*Gi.w,Gi.z*Gi.w,Gi.w).applyMatrix4(e.camera.projectionMatrixInverse).x,F=Ef.set(_y.x,0,_y.z).angleTo(v3e);Ef.set(b,0,0).applyAxisAngle(y3e,F),Ef.add(W1),a({targetX:Ef.x,targetY:Ef.y,targetZ:Ef.z,distance:P1})}else a({targetX:0,targetY:m3.y,targetZ:0,distance:g3});s&&([st.APPEARANCE,st.SAVE,st.OPTIMIZER,st.BATCHDOWNLOAD,st.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1)}},[d,h]=me.useState(!1),[p,m]=me.useState(""),[g,v]=me.useState([]),y=(b,F)=>{m(b),h(!0),v([F])},w={[st.LANDING]:W.jsx(MBe,{}),[st.APPEARANCE]:W.jsx(DLe,{confirmDialog:y}),[st.OPTIMIZER]:W.jsx(i3e,{}),[st.CREATE]:W.jsx(SBe,{}),[st.WALLET]:W.jsx(A3e,{}),[st.CLAIM]:W.jsx(_Be,{}),[st.BATCHMANIFEST]:W.jsx(l3e,{}),[st.BATCHDOWNLOAD]:W.jsx(r3e,{}),[st.LOAD]:W.jsx(Wye,{}),[st.MINT]:W.jsx(cBe,{}),[st.SAVE]:W.jsx(jve,{}),[st.CHAT]:W.jsx(Uve,{})};let C=0;return me.useEffect(()=>{const b=F=>{const x=new Date().getTime(),S=x-C;S<300&&S>10&&F.target.id=="editor-scene"&&r(!t),C=x};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),me.useEffect(()=>(f(),[st.BIO,st.MINT,st.CHAT].includes(u)?A.enabled=!1:A.enabled=!0,[st.LANDING,st.CREATE,st.CLAIM,st.LOAD,st.CLAIM,st.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[u]),me.useEffect(()=>{l(n)},[n]),me.useContext(Bs),W.jsxs(me.Fragment,{children:[W.jsx("div",{className:"generalTitle",children:"Character Studio"}),W.jsx(a3e,{}),W.jsx(Ame,{confirmDialogText:p,confirmDialogCallback:g,confirmDialogWindow:d,setConfirmDialogWindow:h}),W.jsx(gme,{}),w[u]]})}const I3e=n=>{const e=new qU(n);return e.pollingInterval=12e3,e};eF.createRoot(document.getElementById("root")).render(W.jsx(z.StrictMode,{children:W.jsx(Y6,{getLibrary:I3e,children:W.jsx(ij,{children:W.jsx(Cge,{children:W.jsx(nj,{children:W.jsx(tpe,{children:W.jsx(qhe,{children:W.jsx(cpe,{children:W.jsx(me.Suspense,{children:W.jsx(x3e,{})})})})})})})})})}));export{jf as c,Cu as g}; + `),z.createElement("div",{style:c.white,className:"saturation-white"},z.createElement("div",{style:c.black,className:"saturation-black"}),z.createElement("div",{style:c.pointer},this.props.pointer?z.createElement(this.props.pointer,this.props):z.createElement("div",{style:c.circle}))))}}]),e}(me.PureComponent||me.Component);function TDe(n,e){for(var t=-1,r=n==null?0:n.length;++t=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return Ke(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(tke,arguments)},brighten:function(){return this._applyModification(nke,arguments)},darken:function(){return this._applyModification(rke,arguments)},desaturate:function(){return this._applyModification($De,arguments)},saturate:function(){return this._applyModification(qDe,arguments)},greyscale:function(){return this._applyModification(eke,arguments)},spin:function(){return this._applyModification(ike,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(ake,arguments)},complement:function(){return this._applyCombination(ske,arguments)},monochromatic:function(){return this._applyCombination(lke,arguments)},splitcomplement:function(){return this._applyCombination(oke,arguments)},triad:function(){return this._applyCombination(GL,[3])},tetrad:function(){return this._applyCombination(GL,[4])}};Ke.fromRatio=function(n,e){if(AC(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Cg(n[r]));n=t}return Ke(n,e)};function zDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=dke(n)),AC(n)=="object"&&(tl(n.r)&&tl(n.g)&&tl(n.b)?(e=YDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):tl(n.h)&&tl(n.s)&&tl(n.v)?(r=Cg(n.s),i=Cg(n.v),e=KDe(n.h,r,i),o=!0,a="hsv"):tl(n.h)&&tl(n.s)&&tl(n.l)&&(r=Cg(n.s),s=Cg(n.l),e=XDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=O5(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function YDe(n,e,t){return{r:Bn(n,255)*255,g:Bn(e,255)*255,b:Bn(t,255)*255}}function LL(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function PL(n,e,t){n=Bn(n,255),e=Bn(e,255),t=Bn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(Ke(r));return s}function lke(n,e){e=e||6;for(var t=Ke(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(Ke({h:r,s:i,v:s})),s=(s+a)%1;return o}Ke.mix=function(n,e,t){t=t===0?0:t||50;var r=Ke(n).toRgb(),i=Ke(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return Ke(o)};Ke.readability=function(n,e){var t=Ke(n),r=Ke(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};Ke.isReadable=function(n,e,t){var r=Ke.readability(n,e),i,s;switch(s=!1,i=hke(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};Ke.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var A=0;Ai&&(i=s,r=Ke(e[A]));return Ke.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,Ke.mostReadable(n,["#fff","#000"],t))};var MU=Ke.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Ake=Ke.hexNames=cke(MU);function cke(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function O5(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Bn(n,e){uke(n)&&(n="100%");var t=fke(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function Nb(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function uke(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function fke(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Qo(n){return n.length==1?"0"+n:""+n}function Cg(n){return n<=1&&(n=n*100+"%"),n}function G5(n){return Math.round(parseFloat(n)*255).toString(16)}function ZL(n){return Hi(n)/255}var bo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function tl(n){return!!bo.CSS_UNIT.exec(n)}function dke(n){n=n.replace(JDe,"").replace(HDe,"").toLowerCase();var e=!1;if(MU[n])n=MU[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=bo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=bo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=bo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=bo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=bo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=bo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=bo.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:ZL(t[4]),format:e?"name":"hex8"}:(t=bo.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=bo.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:ZL(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=bo.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function hke(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var JL=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return ZDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},bg=function(e,t){var r=e.hex?Ke(e.hex):Ke(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},pc=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&Ke(e).isValid()},NQ=function(e){if(!e)return"#fff";var t=bg(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},V1=function(e,t){var r=e.replace("°","");return Ke(t+" ("+r+")")._ok},$p=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){Cke(i,r);function i(){var s,o,a,l;wke(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,d=t&Tke?new cC:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Uy=24,nLe=q5.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Uy:r,s=n.height,o=s===void 0?Uy:s,a=n.style,l=a===void 0?{}:a,A=tLe(n,["fill","width","height","style"]);return c3.default.createElement("svg",A3({viewBox:"0 0 "+Uy+" "+Uy,style:A3({fill:t,width:i,height:o},l)},A),c3.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},rLe=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(l3(i.s)?r.props.hsl.s:i.s),l:Number(l3(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return rLe(e,[{key:"render",value:function(){var r=this,i=ut({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),z.createElement("div",{style:i.alpha},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=z.createElement("div",{style:i.fields,className:"flexbox-fix"},z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),z.createElement("div",{style:i.field},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),z.createElement("div",{style:i.alpha},z.createElement(Rt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),z.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,z.createElement("div",{style:i.toggle},z.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},z.createElement(nLe,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(z.Component);ez.defaultProps={view:"hex"};var u3=function(){var e=ut({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return z.createElement("div",{style:e.picker})},aLe=function(){var e=ut({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return z.createElement("div",{style:e.picker})},WQ=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,f=e.className,d=f===void 0?"":f,h=e.defaultView,p=ut(Vi({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return z.createElement("div",{style:p.picker,className:"chrome-picker "+d},z.createElement("div",{style:p.saturation},z.createElement(Tb,{style:p.Saturation,hsl:o,hsv:a,pointer:aLe,onChange:r})),z.createElement("div",{style:p.body},z.createElement("div",{style:p.controls,className:"flexbox-fix"},z.createElement("div",{style:p.color},z.createElement("div",{style:p.swatch},z.createElement("div",{style:p.active}),z.createElement(ip,{renderers:A}))),z.createElement("div",{style:p.toggles},z.createElement("div",{style:p.hue},z.createElement(sp,{style:p.Hue,hsl:o,pointer:u3,onChange:r})),z.createElement("div",{style:p.alpha},z.createElement(EQ,{style:p.Alpha,rgb:s,hsl:o,pointer:u3,renderers:A,onChange:r})))),z.createElement(ez,{rgb:s,hsl:o,hex:l,view:h,onChange:r,disableAlpha:i})))};WQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),disableAlpha:Ne.bool,styles:Ne.object,defaultView:Ne.oneOf(["hex","rgb","hsl"])};WQ.defaultProps={width:225,disableAlpha:!1,styles:{}};const lLe=Li(WQ);var ALe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ut({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:NQ(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return z.createElement(Vu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},z.createElement("div",{style:a.dot}))},cLe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ut({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return z.createElement("div",{style:s.fields,className:"flexbox-fix"},z.createElement("div",{style:s.active}),z.createElement(Rt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),z.createElement(Rt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},OQ=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ut(Vi({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(h,p){h.hex?pc(h.hex)&&t({hex:h.hex,source:"hex"},p):t(h,p)};return z.createElement(_0,{style:u.Compact,styles:l},z.createElement("div",{style:u.compact,className:"compact-picker "+c},z.createElement("div",null,Lu(i,function(d){return z.createElement(ALe,{key:d,color:d,active:d.toLowerCase()===s,onClick:f,onSwatchHover:r})}),z.createElement("div",{style:u.clear})),z.createElement(cLe,{hex:s,rgb:o,onChange:f})))};OQ.propTypes={colors:Ne.arrayOf(Ne.string),styles:Ne.object};OQ.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};Li(OQ);var uLe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=ut({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return z.createElement("div",{style:a.swatch},z.createElement(Vu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const fLe=FQ(uLe);var GQ=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,A=e.className,c=A===void 0?"":A,u=ut(Vi({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(h,p){return i({hex:h,source:"hex"},p)};return z.createElement("div",{style:u.card,className:"github-picker "+c},z.createElement("div",{style:u.triangleShadow}),z.createElement("div",{style:u.triangle}),Lu(r,function(d){return z.createElement(fLe,{color:d,key:d,onClick:f,onSwatchHover:s})}))};GQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),colors:Ne.arrayOf(Ne.string),triangle:Ne.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ne.object};GQ.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Li(GQ);var dLe=function(e){var t=e.direction,r=ut({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return z.createElement("div",{style:r.picker})},hLe=Object.assign||function(n){for(var e=1;e.5});return z.createElement("div",{style:r.picker})},vLe=function(){var e=ut({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return z.createElement("div",{style:e.pointer},z.createElement("div",{style:e.left},z.createElement("div",{style:e.leftInside})),z.createElement("div",{style:e.right},z.createElement("div",{style:e.rightInside})))},f3=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ut({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return z.createElement("div",{style:o.button,onClick:t},r||i)},yLe=function(e){var t=e.rgb,r=e.currentColor,i=ut({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return z.createElement("div",null,z.createElement("div",{style:i.label},"new"),z.createElement("div",{style:i.swatches},z.createElement("div",{style:i.new}),z.createElement("div",{style:i.current})),z.createElement("div",{style:i.label},"current"))},BLe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return z.createElement("div",{style:a.fields,className:"flexbox-fix"},z.createElement("div",{style:a.double},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.single},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),z.createElement("div",{style:a.alpha},z.createElement(Rt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},ILe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Sy=24,RLe=nz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Sy:r,s=n.height,o=s===void 0?Sy:s,a=n.style,l=a===void 0?{}:a,A=QLe(n,["fill","width","height","style"]);return h3.default.createElement("svg",d3({viewBox:"0 0 "+Sy+" "+Sy,style:d3({fill:t,width:i,height:o},l)},A),h3.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},MLe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,A=ut({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:NQ(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return z.createElement(Vu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},z.createElement("div",{style:A.check},z.createElement(RLe,null)))},TLe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ut({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return z.createElement("div",{style:o.group},Lu(i,function(a,l){return z.createElement(MLe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},YQ=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ut(Vi({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),d=function(p,m){return i({hex:p,source:"hex"},m)};return z.createElement("div",{style:f.picker,className:"swatches-picker "+u},z.createElement(_0,null,z.createElement("div",{style:f.overflow},z.createElement("div",{style:f.body},Lu(o,function(h){return z.createElement(TLe,{key:h.toString(),group:h,active:a,onClick:d,onSwatchHover:s})}),z.createElement("div",{style:f.clear})))))};YQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),height:Ne.oneOfType([Ne.string,Ne.number]),colors:Ne.arrayOf(Ne.arrayOf(Ne.string)),styles:Ne.object};YQ.defaultProps={width:320,height:240,colors:[[Tf[900],Tf[700],Tf[500],Tf[300],Tf[100]],[Nf[900],Nf[700],Nf[500],Nf[300],Nf[100]],[Df[900],Df[700],Df[500],Df[300],Df[100]],[kf[900],kf[700],kf[500],kf[300],kf[100]],[Vf[900],Vf[700],Vf[500],Vf[300],Vf[100]],[Lf[900],Lf[700],Lf[500],Lf[300],Lf[100]],[Pf[900],Pf[700],Pf[500],Pf[300],Pf[100]],[Wf[900],Wf[700],Wf[500],Wf[300],Wf[100]],[Of[900],Of[700],Of[500],Of[300],Of[100]],["#194D33",xg[700],xg[500],xg[300],xg[100]],[Gf[900],Gf[700],Gf[500],Gf[300],Gf[100]],[Zf[900],Zf[700],Zf[500],Zf[300],Zf[100]],[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[Hf[900],Hf[700],Hf[500],Hf[300],Hf[100]],[zf[900],zf[700],zf[500],zf[300],zf[100]],[Yf[900],Yf[700],Yf[500],Yf[300],Yf[100]],[Xf[900],Xf[700],Xf[500],Xf[300],Xf[100]],[Kf[900],Kf[700],Kf[500],Kf[300],Kf[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Li(YQ);var XQ=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ut(Vi({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),d=function(p,m){pc(p)&&t({hex:p,source:"hex"},m)};return z.createElement("div",{style:f.card,className:"twitter-picker "+u},z.createElement("div",{style:f.triangleShadow}),z.createElement("div",{style:f.triangle}),z.createElement("div",{style:f.body},Lu(s,function(h,p){return z.createElement(Vu,{key:p,color:h,hex:h,style:f.swatch,onClick:d,onHover:r,focusStyle:{boxShadow:"0 0 4px "+h}})}),z.createElement("div",{style:f.hash},"#"),z.createElement(Rt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:d}),z.createElement("div",{style:f.clear})))};XQ.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),triangle:Ne.oneOf(["hide","top-left","top-right"]),colors:Ne.arrayOf(Ne.string),styles:Ne.object};XQ.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Li(XQ);var KQ=function(e){var t=ut({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return z.createElement("div",{style:t.picker})};KQ.propTypes={hsl:Ne.shape({h:Ne.number,s:Ne.number,l:Ne.number,a:Ne.number})};KQ.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var jQ=function(e){var t=ut({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return z.createElement("div",{style:t.picker})};jQ.propTypes={hsl:Ne.shape({h:Ne.number,s:Ne.number,l:Ne.number,a:Ne.number})};jQ.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var NLe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(d,h){if(d.hex)pc(d.hex)&&t({hex:d.hex,source:"hex"},h);else if(d.rgb){var p=d.rgb.split(",");V1(d.rgb,"rgb")&&t({r:p[0],g:p[1],b:p[2],a:1,source:"rgb"},h)}else if(d.hsv){var m=d.hsv.split(",");V1(d.hsv,"hsv")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),m[1]==1?m[1]=.01:m[2]==1&&(m[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsv"},h))}else if(d.hsl){var g=d.hsl.split(",");V1(d.hsl,"hsl")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsl"},h))}},l=ut({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),A=r.r+", "+r.g+", "+r.b,c=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return z.createElement("div",{style:l.wrap,className:"flexbox-fix"},z.createElement("div",{style:l.fields},z.createElement("div",{style:l.double},z.createElement(Rt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),z.createElement("div",{style:l.column},z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),z.createElement("div",{style:l.single},z.createElement(Rt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},$Q=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,f=u===void 0?"":u,d=ut(Vi({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},c));return z.createElement("div",{style:d.picker,className:"google-picker "+f},z.createElement("div",{style:d.head},l),z.createElement("div",{style:d.swatch}),z.createElement("div",{style:d.saturation},z.createElement(Tb,{hsl:s,hsv:o,pointer:KQ,onChange:r})),z.createElement("div",{style:d.body},z.createElement("div",{style:d.controls,className:"flexbox-fix"},z.createElement("div",{style:d.hue},z.createElement(sp,{style:d.Hue,hsl:s,radius:"4px",pointer:jQ,onChange:r}))),z.createElement(NLe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};$Q.propTypes={width:Ne.oneOfType([Ne.string,Ne.number]),styles:Ne.object,header:Ne.string};$Q.defaultProps={width:652,styles:{},header:"Color picker"};Li($Q);function DLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,debugMode:a}=z.useContext(qr),{playSound:l}=z.useContext(ys),{isMute:A}=z.useContext(vs),{t:c}=me.useContext(Bs),u=()=>{!A&&l("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(st.CREATE),r(!1)},[f,d]=z.useState(null),[h,p]=z.useState(null),[m,g]=z.useState(""),[v,y]=z.useState(null),[w,C]=z.useState(null),[b,F]=z.useState(""),[x,S]=z.useState(!1),[R,Z]=z.useState({background:"#ffffff"}),Y=()=>{!A&&l("backNextButton"),e(st.SAVE),r(!1)},Q=()=>{t(!0),d(null),i.loadRandomTraits().then(()=>{console.log("success"),m!=""&&y(i.getCurrentTraitData(m)),t(!1)}).catch(ne=>{t(!1),console.error("Error loading random traits:",ne.message)})},B=ne=>{Z({background:ne.hex})},E=ne=>{Z({background:ne.hex}),i.setTraitColor(m,ne.hex)},M=()=>{r()},D=async ne=>{const ie=nc(ne.name),ue=URL.createObjectURL(ne);await s.loadAnimation(ue,!0,"",ie),F(s.getCurrentAnimationName())},T=ne=>{if(S(!1),m!=""){t(!0);const ie=URL.createObjectURL(ne);i.loadCustomTexture(m,ie).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},V=ne=>{if(S(!1),m!=""){t(!0);const ie=URL.createObjectURL(ne);i.loadCustomTrait(m,ie).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},G=ne=>{S(!1),t(!0),i.loadTrait(ne.traitGroup.trait,ne.id).then(()=>{t(!1),y(ne)})},P=ne=>{S(!1),i.removeTrait(ne),y(null)},U=ne=>{S(!1),t(!0),i.loadRandomTrait(ne).then(()=>{t(!1),y(i.getCurrentTraitData(ne))})},H=ne=>{S(!1);const ie=Array.from(ne),ue=[],j=se=>new Promise((ce,Be)=>{var ge;if(se&&se.name.toLowerCase().endsWith(".json")){const Fe=new FileReader,nt=`${(ge=i.manifestData)==null?void 0:ge.getAssetsDirectory()}/anata/_thumbnails/t_${se.name.split("_")[0]}.jpg`;console.log(nt),Fe.onload=function(We){try{const Te=JSON.parse(We.target.result);Te.thumb=nt,ue.push(Te),ce()}catch(Te){console.error("Error parsing the JSON file:",Te),Be(Te)}},Fe.readAsText(se)}});Promise.all(ie.map(j)).then(()=>{ue.length>0&&(d(ue),t(!0),i.loadTraitsFromNFTObject(ue[0]).then(()=>{t(!1)}))}).catch(se=>{console.error("Error processing files:",se)})},oe=async ne=>{const ie=ne[0];ie&&ie.name.toLowerCase().endsWith(".fbx")&&D(ie),ie&&(ie.name.toLowerCase().endsWith(".png")||ie.name.toLowerCase().endsWith(".jpg"))&&T(ie),ie&&ie.name.toLowerCase().endsWith(".vrm")&&V(ie),ie&&ie.name.toLowerCase().endsWith(".json")&&H(ne)},k=ne=>{!A&&l("optionClick"),S(!1),m!==ne.trait?(p(i.getTraits(ne.trait)),g(ne.trait),y(i.getCurrentTraitData(ne.trait)),C(i.getCurrentTraitVRM(ne.trait)),o({targetY:ne.cameraTarget.height,distance:ne.cameraTarget.distance})):(p(null),g(""),y(null),o({targetY:.8,distance:3.2}))},K=()=>{S(!1);var ne=document.createElement("input");ne.type="file",ne.accept=".vrm",ne.onchange=ie=>{var ue=ie.target.files[0];if(ue.name.endsWith(".vrm")){const j=URL.createObjectURL(ue);t(!0),i.loadCustomTrait(m,j).then(()=>{t(!1)})}},ne.click()};return W.jsxs("div",{className:yn.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:c("pageTitles.chooseAppearance")}),W.jsx(B0,{onFilesDrop:oe}),W.jsxs("div",{className:yn.sideMenu,children:[W.jsx(bh,{title:"Appearance",left:20}),W.jsx("div",{className:yn.bottomLine}),W.jsx("div",{className:yn.scrollContainer,children:W.jsx("div",{className:yn["editor-container"],children:i.getGroupTraits().map((ne,ie)=>W.jsxs("div",{className:yn.editorButton,onClick:()=>{k(ne)},children:[W.jsx(Iy,{size:56,icon:ne.fullIconSvg,rarity:m!==ne.trait?"none":"mythic"}),W.jsx("div",{className:yn.editorText,children:ne.name})]},"options_"+ie))})})]}),!!h&&W.jsxs("div",{className:yn.selectorContainerPos,children:[W.jsx(bh,{title:m,width:130,left:20}),v&&W.jsx("div",{className:yn.selectorColorPickerButton,onClick:()=>{S(!x)},children:W.jsx("img",{className:yn.selectorColorPickerImg,src:Jwe})}),!!x&&W.jsx("div",{draggable:!1,className:yn.selectorColorPickerUI,children:W.jsx(lLe,{draggable:!1,width:"200px",color:R.background,onChange:B,onChangeComplete:E})}),W.jsx("div",{className:yn.bottomLine}),W.jsx("div",{className:yn.scrollContainerOptions,children:W.jsxs("div",{className:yn["selector-container"],children:[W.jsx("div",{className:`${yn.selectorButton}`,onClick:()=>{U(m)},children:W.jsx(Iy,{size:56,icon:Zwe,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(m)?W.jsx(W.Fragment,{}):W.jsx("div",{className:`${yn.selectorButton}`,icon:MV,onClick:()=>{P(m)},children:W.jsx(Iy,{size:56,icon:MV,rarity:v==null?"mythic":"none"})},"no-trait"),h.map(ne=>{let ie=ne.id===(v==null?void 0:v.id);return W.jsx("div",{className:`${yn.selectorButton}`,onClick:()=>{G(ne)},children:W.jsx(Iy,{size:56,icon:ne.fullThumbnail,rarity:ie?"mythic":"none"})},ne.id)})]})}),W.jsx("div",{className:yn.uploadContainer,children:W.jsx("div",{className:yn.uploadButton,onClick:K,children:W.jsx("div",{children:"Upload "})})})]}),W.jsx(aQ,{jsonSelectionArray:f}),W.jsx(ywe,{selectedTrait:v,selectedVRM:w,animationName:b,setAnimationName:F}),W.jsx(Awe,{loadedAnimationName:b,randomize:Q}),W.jsxs("div",{className:yn.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:c("callToAction.back"),size:14,className:yn.buttonLeft,onClick:u}),i.canDownload()&&W.jsx(Zt,{theme:"light",text:c("callToAction.next"),size:14,className:yn.buttonRight,onClick:Y}),W.jsx(Zt,{theme:"light",text:c("callToAction.randomize"),size:14,className:yn.buttonCenter,onClick:Q}),W.jsx(Zt,{theme:"light",text:a?"normal":"debug",size:14,className:yn.buttonCenter,onClick:M})]})]})}const kLe="_InformationContainerPos_rgqwy_1",VLe="_traitInfoTitle_rgqwy_13",LLe="_traitInfoText_rgqwy_21",PLe="_flexSelect_rgqwy_30",WLe="_scrollContainer_rgqwy_65",OLe="_checked_rgqwy_90",GLe="_checkmark_rgqwy_94",ZLe="_checkboxHolder_rgqwy_107",JLe="_buttonContainer_rgqwy_114",HLe="_buttonLeft_rgqwy_123",zLe="_buttonRight_rgqwy_127",YLe="_buttonCenter_rgqwy_131",Ur={InformationContainerPos:kLe,traitInfoTitle:VLe,traitInfoText:LLe,flexSelect:PLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:WLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:OLe,checkmark:GLe,checkboxHolder:ZLe,buttonContainer:JLe,buttonLeft:HLe,buttonRight:zLe,buttonCenter:YLe},XLe="_InformationContainerPos_1cryw_2",KLe="_scrollContainer_1cryw_16",jLe="_traitInfoTitle_1cryw_28",$Le="_traitInfoText_1cryw_38",qLe="_flexSelect_1cryw_66",e3e="_checked_1cryw_123",t3e="_checkmark_1cryw_127",n3e="_checkboxHolder_1cryw_140",yi={InformationContainerPos:XLe,scrollContainer:KLe,traitInfoTitle:jLe,traitInfoText:$Le,"input-box":"_input-box_1cryw_47",flexSelect:qLe,"arrow-button":"_arrow-button_1cryw_74","left-button":"_left-button_1cryw_90","right-button":"_right-button_1cryw_97","anim-button":"_anim-button_1cryw_104","custom-checkbox":"_custom-checkbox_1cryw_109","checkbox-container":"_checkbox-container_1cryw_114",checked:e3e,checkmark:t3e,checkboxHolder:n3e};function qQ({model:n}){const[e,t]=me.useState(0),[r,i]=me.useState(0),[s,o]=me.useState(0),[a,l]=me.useState(0),[A,c]=me.useState(0),[u,f]=me.useState(0),[d,h]=me.useState(0),[p,m]=me.useState(0);return me.useEffect(()=>{if(n!=null){const g=wh(n,"Mesh"),v=wh(n,"SkinnedMesh");t(g.length),i(v.length);const y=g.concat(v),{stdMats:w,stdCutoutpMats:C,stdTranspMats:b,mToonMats:F,mToonCutoutMats:x,mToonTranspMats:S}=Hde(y);o(w.length),l(b.length),c(C.length),f(F.length),h(S.length),m(x.length)}},[n]),n!=null?W.jsx("div",{children:W.jsxs("div",{className:yi.InformationContainerPos,children:[W.jsx(bh,{title:"Model Information",width:180,right:20}),W.jsxs("div",{className:yi.scrollContainer,children:[W.jsx("div",{className:yi.traitInfoTitle,children:"Meshes:"}),W.jsx("div",{className:yi.traitInfoText,children:e}),W.jsx("div",{className:yi.traitInfoTitle,children:"SkinnedMeshes:"}),W.jsx("div",{className:yi.traitInfoText,children:r}),W.jsx("div",{className:yi.traitInfoTitle,children:"Standard Material Count:"}),W.jsxs("div",{className:yi.traitInfoText,children:["opaque: ",s]}),W.jsxs("div",{className:yi.traitInfoText,children:["cutout: ",A]}),W.jsxs("div",{className:yi.traitInfoText,children:["transparent: ",a]}),W.jsx("div",{className:yi.traitInfoTitle,children:"MToon Material Count:"}),W.jsxs("div",{className:yi.traitInfoText,children:["opaque: ",u]}),W.jsxs("div",{className:yi.traitInfoText,children:["cutout: ",p]}),W.jsxs("div",{className:yi.traitInfoText,children:["transparent: ",d]})]})]})}):W.jsx(W.Fragment,{})}function r3e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{characterManager:r,animationManager:i}=z.useContext(qr),[s,o]=me.useState(null),[a,l]=me.useState(""),{playSound:A}=z.useContext(ys),{isMute:c}=z.useContext(vs),[u,f]=z.useState(null),d=()=>{!c&&A("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(st.LANDING)},h=()=>{const b=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:b===0||b==2,exportMtoonAtlas:b===1||b==2,ktxCompression:at.merge_options_ktx_compression||!1}},p=b=>{r.loadTraitsFromNFTObject(u[b]).then(()=>{r.downloadVRM(u[b].name,h()).then(()=>{b{t(!0),p(0)},{t:g}=me.useContext(Bs),v=async b=>{if(r.getCurrentOptimizerCharacterModel()){const x=nc(b.name),S=URL.createObjectURL(b);await i.loadAnimation(S,!0,"",x),i.addVRM(r.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(S)}else console.warn("Please load a vrm model to test animations.")},y=async b=>{const F=URL.createObjectURL(b);await r.loadOptimizerCharacter(F),URL.revokeObjectURL(F);const x=nc(b.name);l(x),o(r.getCurrentCharacterModel())},w=b=>{const F=Array.from(b),x=[],S=R=>new Promise((Z,Y)=>{var Q;if(R&&R.name.toLowerCase().endsWith(".json")){const B=new FileReader,E=`${(Q=r.manifestData)==null?void 0:Q.getAssetsDirectory()}/anata/_thumbnails/t_${R.name.split("_")[0]}.jpg`;B.onload=function(M){try{const D=JSON.parse(M.target.result);D.thumb=E,x.push(D),Z()}catch(D){console.error("Error parsing the JSON file:",D),Y(D)}},B.readAsText(R)}});Promise.all(F.map(S)).then(()=>{x.length>0&&(f(x),t(!0),r.loadTraitsFromNFTObject(x[0]).then(()=>{t(!1)}))}).catch(R=>{console.error("Error processing files:",R)})},C=async b=>{const F=b[0];console.log("anim"),F&&F.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),v(F)),F&&F.name.toLowerCase().endsWith(".vrm")&&y(F),F&&F.name.toLowerCase().endsWith(".json")&&w(b)};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"Batch Download"}),W.jsx(B0,{onFilesDrop:C}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),W.jsx(qQ,{model:s}),W.jsx(aQ,{jsonSelectionArray:u}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:g("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:d}),(u==null?void 0:u.length)==1&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:m}),(u==null?void 0:u.length)>1&&W.jsx(Zt,{theme:"light",text:"Download All",size:14,className:Ur.buttonRight,onClick:m})]})]})}function i3e(){const{isLoading:n,setViewMode:e}=z.useContext(gi),{characterManager:t,animationManager:r}=z.useContext(qr),[i,s]=me.useState(null),[o,a]=me.useState(""),{playSound:l}=z.useContext(ys),{isMute:A}=z.useContext(vs),c=()=>{!A&&l("backNextButton"),t.removeCurrentCharacter(),t.removeCurrentManifest(),e(st.LANDING)},u=()=>{const g=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:g===0||g==2,exportMtoonAtlas:g===1||g==2,ktxCompression:at.merge_options_ktx_compression||!1}},f=()=>{t.downloadVRM(o+"_merged",u())},{t:d}=me.useContext(Bs),h=async g=>{if(t.getCurrentOptimizerCharacterModel()){const y=nc(g.name),w=URL.createObjectURL(g);await r.loadAnimation(w,!0,"",y),r.addVRM(t.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(w)}else console.warn("Please load a vrm model to test animations.")},p=async g=>{const v=URL.createObjectURL(g);await t.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const y=nc(g.name);a(y),s(t.getCurrentCharacterModel())},m=async g=>{const v=g[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),h(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&p(v)};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),W.jsx(B0,{onFilesDrop:m}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),W.jsx(qQ,{model:i}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:d("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:c}),i!=""&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:f})]})]})}const s3e="_languageSwitchWrap_83v6a_1",o3e={languageSwitchWrap:s3e},p3={en:{nativeName:"English"},ru:{nativeName:"Русский"},zh:{nativeName:"中文"}};function a3e(){const{t:n,i18n:e}=zH();return W.jsx("div",{className:o3e.languageSwitchWrap,children:W.jsx("select",{onChange:t=>e.changeLanguage(t.target.value),value:e.resolvedLanguage,children:Object.keys(p3).map(t=>W.jsx("option",{value:t,children:p3[t].nativeName},t))})})}function l3e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=z.useContext(gi),{characterManager:r,animationManager:i,toggleDebugMode:s,debugMode:o}=z.useContext(qr),[a,l]=me.useState(null),[A,c]=me.useState(""),{playSound:u}=z.useContext(ys),{isMute:f}=z.useContext(vs);z.useState(null);const[d,h]=z.useState(null),p=()=>{!f&&u("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(st.LANDING)},m=()=>{const R=at.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:wn(at.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:wn(at.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:wn(at.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:wn(at.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:R===0||R==2,exportMtoonAtlas:R===1||R==2,ktxCompression:at.merge_options_ktx_compression||!1}},g=async(R,Z=!1)=>{await r.setManifest(d[R]);const Y=d[R].manifestName;t(!0),r.loadInitialTraits().then(()=>{r.savePortraitScreenshot(Y,512,1024,1.5,-.1),Z?R{R{t(!0),g(0)},y=()=>{t(!0),g(0,!0)},{t:w}=me.useContext(Bs),C=async R=>{if(r.getCurrentOptimizerCharacterModel()){const Y=nc(R.name),Q=URL.createObjectURL(R);await i.loadAnimation(Q,!0,"",Y),i.addVRM(r.getCurrentOptimizerCharacterModel()),URL.revokeObjectURL(Q)}else console.warn("Please load a vrm model to test animations.")},b=async R=>{const Z=URL.createObjectURL(R);await r.loadOptimizerCharacter(Z),URL.revokeObjectURL(Z);const Y=nc(R.name);c(Y),l(r.getCurrentCharacterModel())},F=R=>{const Z=Array.from(R),Y=[],Q=B=>new Promise((E,M)=>{if(B&&B.name.toLowerCase().endsWith(".json")){const D=new FileReader,T=B.name.replace(/\.[^/.]+$/,"");D.onload=function(V){try{const G=JSON.parse(V.target.result),P=G.thumbnail;G.manifestName=T,Y.push(G),E()}catch(G){console.error("Error parsing the JSON file:",G),M(G)}},D.readAsText(B)}});Promise.all(Z.map(Q)).then(()=>{Y.length>0&&(h(Y),r.setManifest(Y[0]),t(!0),r.loadInitialTraits().then(()=>{t(!1)}))}).catch(B=>{console.error("Error processing files:",B)})},x=async R=>{const Z=R[0];Z&&Z.name.toLowerCase().endsWith(".fbx")&&C(Z),Z&&Z.name.toLowerCase().endsWith(".vrm")&&b(Z),Z&&Z.name.toLowerCase().endsWith(".json")&&F(R)},S=()=>{s()};return W.jsxs("div",{className:Ur.container,children:[W.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:W.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),W.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),W.jsx(B0,{onFilesDrop:x}),W.jsx(mb,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),W.jsx(qQ,{model:a}),W.jsx(aQ,{jsonSelectionArray:d,byManifest:!0}),W.jsxs("div",{className:Ur.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:w("callToAction.back"),size:14,className:Ur.buttonLeft,onClick:p}),W.jsx(Zt,{theme:"light",text:o?"normal":"debug",size:14,className:Ur.buttonCenter,onClick:S}),(d==null?void 0:d.length)==1&&W.jsx(Zt,{theme:"light",text:"Download",size:14,className:Ur.buttonRight,onClick:v}),(d==null?void 0:d.length)>1&&W.jsx(Zt,{theme:"light",text:"Download All",size:14,className:Ur.buttonRight,onClick:v}),(d==null?void 0:d.length)==1&&W.jsx(Zt,{theme:"light",text:"Get Image",size:14,className:Ur.buttonRight,onClick:y}),(d==null?void 0:d.length)>1&&W.jsx(Zt,{theme:"light",text:"Get All Images",size:14,className:Ur.buttonRight,onClick:y})]})]})}function A3e(){const{t:n}=me.useContext(Bs),{setViewMode:e,setIsLoading:t,isLoading:r}=z.useContext(gi),{playSound:i}=z.useContext(ys),{isMute:s}=z.useContext(vs),{manifest:o,characterManager:a}=z.useContext(qr);me.useState([]);const[l,A]=me.useState([]);me.useEffect(()=>{c()},[]);const c=async()=>{const p=await oQ();oBe(p,"the-anata-nft").then(m=>{A(m.nfts),console.log(m.nfts)})},u=()=>{e(st.LANDING),!s&&i("backNextButton")},f=async p=>{t(!0),a.loadManifest(o[p].manifest).then(()=>{e(st.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},d=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},h=()=>{!s&&i("classMouseOver")};return W.jsxs("div",{className:`${rt.container} horizontalScroll`,children:[W.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),W.jsx("div",{className:rt.vrmOptimizerButton}),W.jsx("div",{className:rt.topLine}),W.jsx("div",{className:rt.classContainer,children:l.map((p,m)=>W.jsxs("div",{className:rt.class,onClick:()=>f(m),onMouseOver:()=>h(),children:[W.jsx("div",{className:rt.classFrame,style:{backgroundImage:`url(${p.image_url})`},children:W.jsx("div",{className:rt.frameContainer,children:W.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:rt.frame})})}),W.jsx("div",{className:rt.name,children:p.name})]},m))}),W.jsx("div",{className:rt.bottomLine}),W.jsxs("div",{className:rt.buttonContainer,children:[W.jsx(Zt,{theme:"light",text:n("callToAction.back"),size:14,className:rt.buttonLeft,onClick:u}),W.jsx(Zt,{theme:"light",text:"test",size:14,className:rt.buttonLeft,onClick:d})]})]})}const c3e="https://beta.anata.dev/character-assets./manifest.json";let P1;const W1=new X,_y=new X;let O1,G1;const u3e=1.4,f3e=new X(0,1.25,0),rz=new X(-.9786403788721187,1.4036900759197288,.9892635490125085),d3e=rz.length(),h3e=.35,g3=6,m3=new X(0,.8,0),iz=new X(-2.2367993753934425,1.1512971720174363,2.2612065299409223),p3e=iz.length(),g3e=.5,Ef=new X,Gi=new Pt,m3e=new Pt,v3e=new X(1,0,0),y3e=new X(0,1,0);async function B3e(n){return await(await fetch(n)).json()}async function w3e(){const n=await B3e(c3e),e=new Zge;return{initialManifest:n,effectManager:e}}const C3e=()=>{let n,e;const r=w3e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},b3e=C3e();function x3e(){const{initialManifest:n,effectManager:e}=b3e.read(),[t,r]=me.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=me.useContext(qr),{viewMode:u}=me.useContext(gi);e.camera=i,e.scene=o;const f=()=>{if(e.camera){if([st.BIO,st.CHAT].includes(u)){u===st.CHAT?(P1=u3e,W1.copy(f3e),_y.copy(rz),O1=d3e,G1=h3e):(P1=g3,W1.copy(m3),_y.copy(iz),O1=p3e,G1=g3e),Gi.set(0,0,O1,1).applyMatrix4(e.camera.projectionMatrix),Gi.x/=Gi.w,Gi.y/=Gi.w,Gi.z/=Gi.w;const b=m3e.set(G1*Gi.w,Gi.y*Gi.w,Gi.z*Gi.w,Gi.w).applyMatrix4(e.camera.projectionMatrixInverse).x,F=Ef.set(_y.x,0,_y.z).angleTo(v3e);Ef.set(b,0,0).applyAxisAngle(y3e,F),Ef.add(W1),a({targetX:Ef.x,targetY:Ef.y,targetZ:Ef.z,distance:P1})}else a({targetX:0,targetY:m3.y,targetZ:0,distance:g3});s&&([st.APPEARANCE,st.SAVE,st.OPTIMIZER,st.BATCHDOWNLOAD,st.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1)}},[d,h]=me.useState(!1),[p,m]=me.useState(""),[g,v]=me.useState([]),y=(b,F)=>{m(b),h(!0),v([F])},w={[st.LANDING]:W.jsx(MBe,{}),[st.APPEARANCE]:W.jsx(DLe,{confirmDialog:y}),[st.OPTIMIZER]:W.jsx(i3e,{}),[st.CREATE]:W.jsx(SBe,{}),[st.WALLET]:W.jsx(A3e,{}),[st.CLAIM]:W.jsx(_Be,{}),[st.BATCHMANIFEST]:W.jsx(l3e,{}),[st.BATCHDOWNLOAD]:W.jsx(r3e,{}),[st.LOAD]:W.jsx(Wye,{}),[st.MINT]:W.jsx(cBe,{}),[st.SAVE]:W.jsx(jve,{}),[st.CHAT]:W.jsx(Uve,{})};let C=0;return me.useEffect(()=>{const b=F=>{const x=new Date().getTime(),S=x-C;S<300&&S>10&&F.target.id=="editor-scene"&&r(!t),C=x};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),me.useEffect(()=>(f(),[st.BIO,st.MINT,st.CHAT].includes(u)?A.enabled=!1:A.enabled=!0,[st.LANDING,st.CREATE,st.CLAIM,st.LOAD,st.CLAIM,st.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}),[u]),me.useEffect(()=>{l(n)},[n]),me.useContext(Bs),W.jsxs(me.Fragment,{children:[W.jsx("div",{className:"generalTitle",children:"Character Studio"}),W.jsx(a3e,{}),W.jsx(Ame,{confirmDialogText:p,confirmDialogCallback:g,confirmDialogWindow:d,setConfirmDialogWindow:h}),W.jsx(gme,{}),w[u]]})}const I3e=n=>{const e=new qU(n);return e.pollingInterval=12e3,e};eF.createRoot(document.getElementById("root")).render(W.jsx(z.StrictMode,{children:W.jsx(Y6,{getLibrary:I3e,children:W.jsx(ij,{children:W.jsx(Cge,{children:W.jsx(nj,{children:W.jsx(tpe,{children:W.jsx(qhe,{children:W.jsx(cpe,{children:W.jsx(me.Suspense,{children:W.jsx(x3e,{})})})})})})})})})}));export{jf as c,Cu as g}; diff --git a/index.html b/index.html index 9423c06f..a82e29f7 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,8 @@ Character Studio - - + + diff --git a/style.css b/style.css index d1d43421..6e07fca3 100644 --- a/style.css +++ b/style.css @@ -1,43 +1,43 @@ /* New UI: TT Squares Condensed Font */ @font-face { font-family: "TTSC-Black-Italic"; - src: url("/fonts/tt-squares/TT Squares Condensed Black Italic.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Black Italic.otf"); } @font-face { font-family: "TTSC-Black"; - src: url("/fonts/tt-squares/TT Squares Condensed Black.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Black.otf"); } @font-face { font-family: "TTSC-Bold-Italic"; - src: url("/fonts/tt-squares/TT Squares Condensed Bold Italic.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Bold Italic.otf"); } @font-face { font-family: "TTSC-Bold"; - src: url("/fonts/tt-squares/TT Squares Condensed Bold.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Bold.otf"); } @font-face { font-family: "TTSC-Light-Italic"; - src: url("/fonts/tt-squares/TT Squares Condensed Light Italic.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Light Italic.otf"); } @font-face { font-family: "TTSC-Light"; - src: url("/fonts/tt-squares/TT Squares Condensed Light.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Light.otf"); } @font-face { font-family: "TTSC-Regular-Italic"; - src: url("/fonts/tt-squares/TT Squares Condensed Regular Italic.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Regular Italic.otf"); } @font-face { font-family: "TTSC-Regular"; - src: url("/fonts/tt-squares/TT Squares Condensed Regular.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Regular.otf"); } @font-face { font-family: "TTSC-Thin-Italic"; - src: url("/fonts/tt-squares/TT Squares Condensed Thin italic.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Thin italic.otf"); } @font-face { font-family: "TTSC-Thin"; - src: url("/fonts/tt-squares/TT Squares Condensed Thin.otf"); + src: url("./fonts/tt-squares/TT Squares Condensed Thin.otf"); } html, @@ -154,4 +154,4 @@ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#009564",endCo @keyframes rotate{ to{ transform: rotate(360deg); } -} \ No newline at end of file +}