JSON Viewer

格式化显示 JSON 使数据看起来更加漂亮。支持 JSON 主题色切换。支持 JSON 脑图,清晰明了的查看 JSON 层级。支持通过 JSON Crack 查看 JSON。支持手动输入 JSON,HTTP 请求获取 JSON

目前為 2025-01-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.8
  5. // @author Feny
  6. // @description 格式化显示 JSON 使数据看起来更加漂亮。支持 JSON 主题色切换。支持 JSON 脑图,清晰明了的查看 JSON 层级。支持通过 JSON Crack 查看 JSON。支持手动输入 JSON,HTTP 请求获取 JSON
  7. // @license MIT
  8. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAeAB4AAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAgACADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9wvjF8bLX4ZrHZx+XNqlwnmKjH5YUyRvb6kEAd8H058d1b47XV5Ir3eoN++bagaXYrN6KOBn2FfPPx5/aEutX8a+KNWhIubhruZLSNj8u1WMcIOP4QoXOOwNS/wDBM79lDTfjh8YNe+IXj63TxRdeHfKjsE1KMTxtdSbmMmxvlAiVV2IBsUybgAyKR9ZTy6lhsM69Xovm2+iPmKmOqYjEKjT6v5WXU9e8beKrjxZpp/s/xFrfhjWIwWs9X0q42z2kmPlZo2zDcxjqYZ0eNv7obDDf/YL/AG8L745eJNc+G3xCttP0n4qeEWZZ2sVZNP8AENsu0rd2ysS0ZKPG7RMSQsisCcukWd+3x4RtfhpqGk+JNPjS0g1mV7a8iT5UM4XesgHYsofdjglQepJPxwPE1x4V/au8LePtNkeK40ma0lmdDgyorvHMhPo9uxjP+y1bUcHRxmGbS1adn1TXT0/4fcipiqmExCi3pfVdGn19f+GLni/w7ceGf2wPFXga+Vo5rW/vDbI3WWI/v4HA/wBqBg3tk+lfWX7AXia1+F/iDV9B1CRbWHXjFLayyHannpuUxk+rqy4zxlMdWAPQft7fsL33x91nQfiD4DutP0r4oeDXVrT7cWWx1y3UsTZ3LKCyAh5FEigkLLIpHzBk5vwj4JuvE2kLJfeHdY8N6lGAl5pepwBZrOT+JRIuYp0ByBNCzxPg4bIICqYyljMKot62Sa6prr6P/gBDC1MLiHJLS90+jT6ev/Dnmn/BVP8Aaw0nxv4/8P8Aw18KXK69qmk3MlxqEdiRMwuivlpbrtPLopkMnZNy5IIYLyPwa/Z8vvEmv+HtHu4/Ovr+5iS6KDcqAtukwe6om7nuEJxX0XoH7PK/bJG0vRoY5rr/AFslvbLGZf8AfcAf+PGvafgv8CbX4byNqFyI5tWmXYCoytsh6qvqx7t+A4yWiWYUsLhlRpbr72318kVHA1MTiHVqbP7kl0P/2Q==
  9. // @homepage https://github.com/xFeny/monkey-jsonviewer
  10. // @match *://*/*
  11. // @require https://unpkg.com/jsmind@0.8.5/es6/jsmind.js
  12. // @require data:application/javascript,%3Bwindow.jsmind%3DjsMind%3B
  13. // @require https://unpkg.com/dom-to-image@2.6.0/src/dom-to-image.js
  14. // @require data:application/javascript,%3Bwindow.domtoimage%3Ddomtoimage%3B
  15. // @require https://unpkg.com/beautifier@0.1.7
  16. // @require data:application/javascript,%3Bwindow.beautifier%3Djs_beautify%3Bwindow.js_beautify%3Djs_beautify%3Bwindow.css_beautify%3Dcss_beautify%3B
  17. // @require https://unpkg.com/@highlightjs/cdn-assets@11.10.0/highlight.min.js
  18. // @require data:application/javascript,%3Bwindow.hljs%3Dhljs%3B
  19. // @grant GM_addStyle
  20. // @grant GM_getValue
  21. // @grant GM_openInTab
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_setClipboard
  24. // @grant GM_setValue
  25. // @grant unsafeWindow
  26. // ==/UserScript==
  27.  
  28. (o=>{window.addEventListener("message",r=>{const{data:t}=r;if(!t?.addStyle)return;if(typeof GM_addStyle=="function")return GM_addStyle(o);const e=document.createElement("style");e.textContent=o,document.head.append(e)})})(` @charset "UTF-8";.monkey-script body,.monkey-script iframe,.monkey-script ul{margin:0;padding:0}.monkey-script iframe{border:0}.monkey-script input:focus,.monkey-script select:focus,.monkey-script textarea:focus{outline:0}.monkey-script .jsonp{color:#657b83}.monkey-script #jsoncrackEmbed{border:0;width:100%;height:100%}.monkey-script .tippy-box[data-theme~=layer]{color:#fff;padding:5px;font-size:12px;line-height:20px;background-color:#2e59a7}.monkey-script .tippy-box[data-theme~=layer] .tippy-arrow{color:#2e59a7}.monkey-script .tippy-box[data-theme~=imagebox]{background-color:#d9d9d9}.monkey-script .tippy-box[data-theme~=imagebox] .tippy-arrow{color:#d9d9d9}@media screen and (max-width: 640px){.monkey-script .rightbox{right:0!important}.monkey-script .rightbox .tools{display:none!important}}@media screen and (max-width: 400px){.monkey-script .searchbox{display:none!important}}.monkey-script .json-viewer-layout{top:0;left:0;z-index:10;width:100vw;height:100vh;display:flex;position:fixed;flex-direction:column}.monkey-script .json-viewer-layout .panel{display:flex;line-height:28px;user-select:none;flex-direction:column;background-color:#ececec}.monkey-script .json-viewer-layout .tabs,.monkey-script .json-viewer-layout .toolbar{display:flex;border-bottom:1px solid #ccc}.monkey-script .json-viewer-layout .tabs>div,.monkey-script .json-viewer-layout .toolbar>div{cursor:pointer;padding:0 10px;font-size:12px;transition:background-color .2s ease}.monkey-script .json-viewer-layout .tabs>div:hover,.monkey-script .json-viewer-layout .toolbar>div:hover{background-color:#d4d4d4}.monkey-script .json-viewer-layout .tabs-item{border-top:3px solid #ececec}.monkey-script .json-viewer-layout .tabs-item:hover{border-top-color:#c3c3c6}.monkey-script .json-viewer-layout .tabs-item.active{color:#0060df;border-top-color:#0060df;background-color:#f1f1f1}.monkey-script .json-viewer-layout .toolbar{line-height:23px}.monkey-script .json-viewer-layout .toolbar .searchbox{padding:0;display:flex;flex-grow:1}.monkey-script .json-viewer-layout .toolbar .searchbox:hover{background-color:transparent}.monkey-script .json-viewer-layout .toolbar .searchbox input{flex-grow:1;border:none;outline:none;font-size:12px;padding-left:23px;border-left:1.5px solid #ccc;background-size:14px;background-repeat:no-repeat;background-position:7px center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAipJREFUWEftljuIE1EUhv8zpJB0FqugItiIdmKnnQ+wjPhq3EILRYt1JTDnDvhgUJG55zY+ELO7hRZupYWCCIK6nXYiNoqlrIUKaxes5siFBGKYSSbJTnaLTDMwl/Ofj8Pc/z+ENX5ojftjfQFYay8AuEFEU2VMRlV/A7hujGm09f+bgIj8APCtjOYdmjuZeWsewCMAZwBcYub7qwkiIjMA7gF4zMxnMwHiOK5Wq9UXAA6r6kljzLPVgLDWniCipwDeNJvNWhzHzUwA/zFJku1BEHiIPUS0PwzDD6NAOOf2qep7AJ/SNK1FUfS9Uy/zFojIXgAeYhsRbQ7D8NcwEM65Tar6E8AygBozf+zWyb2GSZIcCYLgORH9DcNw45AAf1R1Q5qmR6Moep2l0dMHrLWniegJgK/MvHsQCBH5AmCXqk4bYxbzavsakYjMArgD4B0zHyoCISJvARwEcJmZ7/aq6Qvgi0XkJoCrqrpgjDnfS9BaO09E5wDcYuZr/YALAbQgHgLwTpnrER13vcHMF/s19+eFAVoQS/7NzAeyxJ1zS6qaez7wT9hdICITgMkEJhOYTMCq6jEimmXmV90+UboRtdzQ7wZ+aW1UKpUr9Xp9pQ0yFoCuXFhW1agdt2MD8BDOOb83zgPYAWAxCILbqvqg1CzIChMRmQPgI3qFiD773Z+ZTxVJwoHTME9URI4TUV1VtwCYYeaXYwUo2mzkOB6l0dA7YRlNOzX/ATTlNjBwsoHnAAAAAElFTkSuQmCC)}.monkey-script .json-viewer-layout .toolbar .searchbox .clear{flex:0 0 auto;align-self:center;margin:0 4px;padding:0;border:0;width:16px;height:16px;background-color:transparent;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAANZJREFUOE+t0zFKg0EQhuEndbpgIVZ26eIJFK1SeQcPYKuWmlJIb6lHkJRpFFKnE2zTpBAknaUgA/+Q5SfBwGaaZWfne3dmdraj0job9Ae4wwAn+MUcn3jCotS0Aad4RW9LYj+4xkuel4ArPO9Y0RlmEZuAY3ygi/cGct6Clf4V+vhOwCNuG0EEXuAB941v1OzfkOAxbhIwwWVxYwoCEhZrCQzfFMMELHHUSjkhCchsMuwLh3sDVJfwXxOj/ihpaxOrnzEaUzVI2dmqUU5I1Wfa8Susw/4A1fw8ES1B6icAAAAASUVORK5CYII=)}.monkey-script .json-viewer-layout .rightbox{right:200px;display:flex;font-size:12px;position:absolute}.monkey-script .json-viewer-layout .rightbox>div{padding:0 5px;margin-top:2px}.monkey-script .json-viewer-layout .rightbox>div span{cursor:pointer;display:inline;padding:5px 10px;border-radius:3px;transition:background-color .2s ease}.monkey-script .json-viewer-layout .rightbox>div span:hover{background-color:#ccc}.monkey-script .json-viewer-layout .rightbox>div span:after{content:"";width:0;height:0;right:-5px;position:relative;border-style:solid;display:inline-block;vertical-align:middle;border-width:7px 5px 0 5px;border-color:#999 transparent transparent transparent;transform:rotate(0);transition:transform .3s ease}.monkey-script .json-viewer-layout .rightbox>div span.active:after{transform:rotate(180deg)}.monkey-script .json-viewer-layout .rightbox>div ul{color:#333;cursor:pointer;text-align:center;border-radius:3px}.monkey-script .json-viewer-layout .rightbox>div ul li{font-size:12px;padding:5px 20px;list-style-type:none;background-color:#dfdfdf;transition:background-color .2s ease}.monkey-script .json-viewer-layout .rightbox>div ul li:hover{border-radius:3px;background-color:#ccc}.monkey-script .json-viewer-layout .rightbox>div ul li.active:before{left:15px;content:"\u221A";display:inline;position:absolute}.monkey-script .json-viewer-layout .rightbox>div .tippy-box{background-color:#dfdfdf!important}.monkey-script .json-viewer-layout .rightbox>div .tippy-box .tippy-content{padding:5px}.monkey-script .json-viewer-layout .rightbox>div .tippy-box .tippy-arrow{color:#dfdfdf!important}.monkey-script .json-viewer-layout .container{flex-grow:1;overflow:auto;line-height:1.4;font-size:13.5px;font-family:monospace}.monkey-script .json-viewer-layout .container>div{height:100%;display:none}.monkey-script .json-viewer-layout .container>div.active{display:block}.monkey-script .json-viewer-layout .container #formatBox{padding:5px 8px}.monkey-script .json-viewer-layout .container #rawTextBox{font-size:13px;padding:5px 8px}.monkey-script .json-viewer-layout .container #rawTextBox pre{margin:0;padding:0;white-space:pre-wrap;overflow-wrap:break-word}.monkey-script .json-viewer-layout #mindBox{width:100vw;height:calc(100vh - 57px)}.monkey-script .json-viewer-layout #mindBox jmnode{display:flex;align-items:center;padding:0 7px 0 22px;color:#475872!important;box-shadow:none!important;background-color:transparent!important}.monkey-script .json-viewer-layout #mindBox jmnode.root{padding:0;color:transparent!important}.monkey-script .json-viewer-layout #mindBox jmnode:before{content:"";margin-top:1px;position:absolute;border-radius:50%;top:50%!important;transform:translateY(-50%);background-color:#8149bf80}.monkey-script .json-viewer-layout #mindBox jmnode.root:before{left:50%;width:18px;height:18px;transform:translate(-18px,-50%)}.monkey-script .json-viewer-layout #mindBox jmnode:hover{text-shadow:0px 0px 1px currentColor}.monkey-script .json-viewer-layout #mindBox jmnode:not(.root):before{left:0;width:15px;height:15px}.monkey-script .json-viewer-layout #mindBox jmexpander{margin-top:1px;line-height:9px}.monkey-script .json-viewer-layout #mindBox .datatype{opacity:.6;font-size:12px;margin-top:2px;padding-left:5px}.monkey-script .httpRequest{padding:30px 20px;width:700px}.monkey-script .httpRequest>div{display:flex;height:35px;margin-bottom:20px}.monkey-script .httpRequest input,.monkey-script .httpRequest select{border-radius:0;padding-left:10px;border:1px solid #ccc}.monkey-script .httpRequest input{flex-grow:1}.monkey-script .httpRequest input[name=url],.monkey-script .httpRequest input:first-child,.monkey-script .httpRequest select{border-right:none}.monkey-script .httpRequest button{cursor:pointer;padding:0 15px;border:1px solid #ccc}.monkey-script .httpRequest button:active{background-color:#cfcfcf}.monkey-script .dark-theme .json-viewer-layout li,.monkey-script .dark-theme .json-viewer-layout pre,.monkey-script .dark-theme .json-viewer-layout td:first-child,.monkey-script .dark-plus-theme .json-viewer-layout li,.monkey-script .dark-plus-theme .json-viewer-layout pre,.monkey-script .dark-plus-theme .json-viewer-layout td:first-child{color:#ccc}.monkey-script .dark-theme .json-viewer-layout .panel,.monkey-script .dark-plus-theme .json-viewer-layout .panel{color:#c4c4c4;background-color:#333}.monkey-script .dark-theme .json-viewer-layout .panel>div,.monkey-script .dark-plus-theme .json-viewer-layout .panel>div{border-bottom-color:#464646}.monkey-script .dark-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-script .dark-theme .json-viewer-layout .panel .toolbar-item:hover,.monkey-script .dark-plus-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-script .dark-plus-theme .json-viewer-layout .panel .toolbar-item:hover{background-color:#464646}.monkey-script .dark-theme .json-viewer-layout .panel .tabs-item,.monkey-script .dark-plus-theme .json-viewer-layout .panel .tabs-item{border-top-color:#333}.monkey-script .dark-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-script .dark-plus-theme .json-viewer-layout .panel .tabs-item:hover{border-top-color:#c3c3c6}.monkey-script .dark-theme .json-viewer-layout .panel .tabs-item.active,.monkey-script .dark-plus-theme .json-viewer-layout .panel .tabs-item.active{color:#c4c4c4;border-top-color:#64b7ff;background-color:#464646}.monkey-script .dark-theme .json-viewer-layout .searchbox input,.monkey-script .dark-plus-theme .json-viewer-layout .searchbox input{color:#ccc;background-color:#464646;border-left-color:#333}.monkey-script .dark-theme .json-viewer-layout .searchbox .clear,.monkey-script .dark-plus-theme .json-viewer-layout .searchbox .clear{filter:invert(.8)}.monkey-script .dark-theme .json-viewer-layout .rightbox>div span:hover,.monkey-script .dark-plus-theme .json-viewer-layout .rightbox>div span:hover{background-color:#464646}.monkey-script .dark-theme .json-viewer-layout .rightbox .tippy-box,.monkey-script .dark-plus-theme .json-viewer-layout .rightbox .tippy-box{background-color:#4e4e4e!important}.monkey-script .dark-theme .json-viewer-layout .rightbox .tippy-box .tippy-arrow,.monkey-script .dark-plus-theme .json-viewer-layout .rightbox .tippy-box .tippy-arrow{color:#4e4e4e!important}.monkey-script .dark-theme .json-viewer-layout .rightbox .tippy-box li,.monkey-script .dark-plus-theme .json-viewer-layout .rightbox .tippy-box li{background-color:#4e4e4e!important}.monkey-script .dark-theme .json-viewer-layout .rightbox .tippy-box li:hover,.monkey-script .dark-plus-theme .json-viewer-layout .rightbox .tippy-box li:hover{background-color:#464646!important}.monkey-script .dark-theme .json-viewer-layout jmnode,.monkey-script .dark-plus-theme .json-viewer-layout jmnode{filter:brightness(2)}.monkey-script .dark-theme .json-viewer-layout jmexpander,.monkey-script .dark-plus-theme .json-viewer-layout jmexpander{background-color:#dfdfdf}.js-mind-child-node{width:300px;height:300px;margin:10px;overflow-y:scroll;position:relative;padding:5px 20px;background-color:#f8f9fa}.js-mind-child-node div{color:#475872;line-height:25px}.js-mind-copy{top:5px;right:10px;width:20px;height:20px;cursor:pointer;position:absolute;background-size:20px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAYRJREFUWEftlzFOw0AQRefbF+EMVJFA1kzcUNGRW8ABkFBASBQgUZAiLSUiHb29W1DTQUFFzxFQvGglO8JW1uuElQIGl8545/n/0eQbtOELG+5PNYA8z28AHIaAMsZMhsPhke+sBYDW+mE+nz9FUaR9D3X5vSgKjuN4m5n32+oXAEopQ0QiIkEAlFJMREpEWm3uP0BD/ndjzAzArFLaq0Appdf2pnWVBdbWLw9vEdEYwJSZL+39VoA8z3cAPHq7Ez3HcTxKkuSlqnXNQJZlp1EU7YnIwAvQobGzxAXQvO+1YF2I/gBYz7qokKZprS6YAhsH6PL2y2qCKfC3AbTWB8aY+y4qABgx88y3iFbeA99dxc1/w5UBurz9/xD2Q4EqEzZX6rozYDfoskzYNoS7RHRORDbLhbhstjwRkVqecAI4fFREdBYqqNoevw7gCsAHMx+H8MSe4YxkDgsGAC6KorgD8BoAogql18w8qWVC1+GlZ+NAw/lWztRt1e9nfZwGkHjlIz4Bw1VmMCtaHCkAAAAASUVORK5CYII=)}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.monkey-js-css-beautify body{padding-top:20px;padding-left:5px}.monkey-js-css-beautify body .beautify_checkbox{top:0;left:0;z-index:999;width:100vw;display:flex;position:fixed;padding:5px 10px;user-select:none;align-items:center;background-color:#f3f3f3;border-bottom:1px solid #ccc}.monkey-js-css-beautify body .beautify_checkbox label{font-size:13px}.monkey-js-css-beautify body .beautify_checkbox input[type=checkbox]{top:1.5px;width:14px;height:14px;margin-right:5px;position:relative}.format-container{flex-grow:1}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#fff;color:#000}.xml .hljs-meta{color:silver}.hljs-comment,.hljs-quote{color:#007400}.hljs-attribute,.hljs-keyword,.hljs-literal,.hljs-name,.hljs-selector-tag,.hljs-tag{color:#aa0d91}.hljs-template-variable,.hljs-variable{color:#3f6e74}.hljs-code,.hljs-meta .hljs-string,.hljs-string{color:#c41a16}.hljs-link,.hljs-regexp{color:#0e0eff}.hljs-bullet,.hljs-number,.hljs-symbol,.hljs-title{color:#1c00cf}.hljs-meta,.hljs-section{color:#643820}.hljs-built_in,.hljs-class .hljs-title,.hljs-params,.hljs-title.class_,.hljs-type{color:#5c2699}.hljs-attr{color:#836c28}.hljs-subst{color:#000}.hljs-formula{background-color:#eee;font-style:italic}.hljs-addition{background-color:#baeeba}.hljs-deletion{background-color:#ffc8bd}.hljs-selector-class,.hljs-selector-id{color:#9b703f}.hljs-doctag,.hljs-strong{font-weight:700}.hljs-emphasis{font-style:italic}ul,li{list-style-type:none}wrapper{display:contents}.hidden{display:none!important}.json-viewer ul{border-left:.5px dotted #ccc}.json-copy{width:13px;height:13px;cursor:pointer;margin-left:.15em;display:inline-block;background-size:13px;vertical-align:text-bottom;background-repeat:no-repeat;transition:background-image ease .3s;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAYRJREFUWEftlzFOw0AQRefbF+EMVJFA1kzcUNGRW8ABkFBASBQgUZAiLSUiHb29W1DTQUFFzxFQvGglO8JW1uuElQIGl8545/n/0eQbtOELG+5PNYA8z28AHIaAMsZMhsPhke+sBYDW+mE+nz9FUaR9D3X5vSgKjuN4m5n32+oXAEopQ0QiIkEAlFJMREpEWm3uP0BD/ndjzAzArFLaq0Appdf2pnWVBdbWLw9vEdEYwJSZL+39VoA8z3cAPHq7Ez3HcTxKkuSlqnXNQJZlp1EU7YnIwAvQobGzxAXQvO+1YF2I/gBYz7qokKZprS6YAhsH6PL2y2qCKfC3AbTWB8aY+y4qABgx88y3iFbeA99dxc1/w5UBurz9/xD2Q4EqEzZX6rozYDfoskzYNoS7RHRORDbLhbhstjwRkVqecAI4fFREdBYqqNoevw7gCsAHMx+H8MSe4YxkDgsGAC6KorgD8BoAogql18w8qWVC1+GlZ+NAw/lWztRt1e9nfZwGkHjlIz4Bw1VmMCtaHCkAAAAASUVORK5CYII=)}.json-copy.success{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAhZJREFUWEftlU1IFGEYx//Pu2R0kLrYwUMg7M5EHjwklNUOLoInxYMg7W6HTkEIgkLMLF6CsllDokN4Vfy4SnSqk+7sRghBFBT7IWKHQATFSxCLM09sabjjO/thLnuZ9zjPx//3/t9n3pfQ5EVN1ocP4DvgO9AwB/RMsJNYjAF4wEwz01rukeyXbwjAZEbttpmXAKhHokQ8bN4prLghzhwgkVHCzLQE8JUyMeblpFa411AAIxXshxCLAC6fFOKbZriw3jAA3VKHiLgk3uoS+UWMqKnlX9c8AwkreA0i0GM7vFu0i2svI1v7ld4M3VLuEmEBwLnjeQTsMyiaDOfeetVLZ8BIhz4CdP2w6CuxM2JqG99kTYz3oftwaE4S23Zsij3vza1Wgj8BYKSDvYBwF0khdEt9SMSzEoHvJETUvJ39UO219XBA2QHQ5iougzAsZRyEFxKBHAJONHlr41M18VLc6wgmAXoqafAHgoUYAuOZJP6Z2Il5HVfNQ1hK1NPKKAGvZBAAOiXf1wGOJcOFzVp2/u+CqpRsZNQ4/t5oVRalAkWOT/Xlf1TLrPseSKRDAw7TIhEuyS3kd2gJxM0b2d16xT1nwN1IT4U0IWiegY6yGPObg4sXYjNdX36eRrxmgMOZ6CLQE4AHGdgTjOXzdvvE48jawWnF6wI4EkmsKlfNSD77P6LHa8/8NawXzAfwHfAdaLoDvwHyYK0h/tY7mwAAAABJRU5ErkJggg==)}.json-arrow{width:0;opacity:.2;display:inline-block}.json-arrow:hover{opacity:.35}.json-arrow:before{width:0;height:0;left:-13px;content:"";cursor:pointer;position:relative;border-style:solid;display:inline-block;vertical-align:middle;transform:rotate(90deg);border-width:5px 0 5px 8px;transition:transform .3s ease;border-color:transparent transparent transparent currentColor}.collapsed .json-arrow:before{transform:rotate(0)}.json-placeholder{display:none;cursor:pointer;font-size:12px;color:#859900;user-select:none;margin-left:.3em}.json-placeholder span{margin:0 .5em}.json-placeholder span:hover{text-decoration:underline}.json-color{width:.7em;height:.7em;margin-right:.3em;display:inline-block;vertical-align:middle;border:1px solid #ccc}.json-comma{margin-left:.15em;font-family:Courier New,monospace}.json-colon{margin:0 .3em 0 .15em}.default-theme{background-color:#fefefe}.default-theme .json-object-bracket{color:#6d9331;font-weight:700}.default-theme .json-array-bracket{color:#8e9331;font-weight:700}.default-theme .json-key{color:#910f93;cursor:pointer}.default-theme .json-string,.default-theme .json-string a{color:#2e7c16}.default-theme .json-bigint,.default-theme .json-number{color:#164ff1}.default-theme .json-boolean{color:#c41a16}.default-theme .json-null{color:#228fec}.light-theme{background-color:#fefefe}.light-theme .json-object-bracket{color:#6d9331;font-weight:700}.light-theme .json-array-bracket{color:#8e9331;font-weight:700}.light-theme .json-key{color:#0040cf;cursor:pointer}.light-theme .json-string,.light-theme .json-string a{color:#a31515}.light-theme .json-bigint,.light-theme .json-number{color:#0b7500}.light-theme .json-boolean{color:#00f}.light-theme .json-null{color:#05f}.dark-theme{background-color:#252526}.dark-theme .json-object-bracket{color:#ce70d6;font-weight:700}.dark-theme .json-array-bracket{color:#f1d700;font-weight:700}.dark-theme .json-key{color:#9cdcfe;cursor:pointer}.dark-theme .json-string,.dark-theme .json-string a{color:#ce9178}.dark-theme .json-bigint,.dark-theme .json-number{color:#b5cea8}.dark-theme .json-boolean{color:#358cd6}.dark-theme .json-null{color:#569cd6}.dark-plus-theme{background-color:#1e1f22}.dark-plus-theme .json-object-bracket{color:#bb9667;font-weight:700}.dark-plus-theme .json-array-bracket{color:#bbbda3;font-weight:700}.dark-plus-theme .json-key{color:#c77dbb;cursor:pointer}.dark-plus-theme .json-string,.dark-plus-theme .json-string a{color:#6aab73}.dark-plus-theme .json-bigint,.dark-plus-theme .json-number{color:#28aab4}.dark-plus-theme .json-boolean{color:#ce8951}.dark-plus-theme .json-null{color:#c78d61}.dark-theme .json-view ul,.dark-plus-theme .json-view ul{border-left:.5px dotted #5e5e5e}.dark-theme .json-colon,.dark-theme .json-comma,.dark-plus-theme .json-colon,.dark-plus-theme .json-comma{color:#ccc}.dark-theme .json-arrow,.dark-plus-theme .json-arrow{color:#fff;opacity:.35}.dark-theme .json-arrow:hover,.dark-plus-theme .json-arrow:hover{opacity:.5}.json-tree-table{border-collapse:collapse;width:-webkit-fill-available}.json-tree-table tr.selected *{color:#fff!important;background-color:#3875d7}.json-tree-table tr:hover{background-color:#f0f9fe}.json-tree-table tr td:first-child{width:120px}.dark-theme .json-tree-table tr:hover,.dark-plus-theme .json-tree-table tr:hover{background-color:#353b48}/**
  29. * @license BSD
  30. * @copyright 2014-2023 hizzgdev@163.com
  31. *
  32. * Project Home:
  33. * https://github.com/hizzgdev/jsmind/
  34. */.jsmind-inner{position:relative;overflow:auto;width:100%;height:100%;outline:none}.jsmind-inner{moz-user-select:-moz-none;-moz-user-select:none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.jsmind-inner canvas{position:absolute}svg.jsmind{position:absolute;z-index:1}canvas.jsmind{position:absolute;z-index:1}jmnodes{position:absolute;z-index:2;background-color:#0000}jmnode{position:absolute;cursor:default;max-width:400px}jmexpander{position:absolute;width:11px;height:11px;display:block;overflow:hidden;line-height:12px;font-size:10px;text-align:center;border-radius:6px;border-width:1px;border-style:solid;cursor:pointer}.jmnode-overflow-wrap jmnodes{min-width:420px}.jmnode-overflow-hidden jmnode{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}jmnode{padding:10px;background-color:#fff;color:#333;border-radius:5px;box-shadow:1px 1px 1px #666;font:16px/1.125 Verdana,Arial,Helvetica,sans-serif}jmnode:hover{box-shadow:2px 2px 8px #000;background-color:#ebebeb;color:#333}jmnode.selected{background-color:#11f;color:#fff;box-shadow:2px 2px 8px #000}jmnode.root{font-size:24px}jmexpander{border-color:gray}jmexpander:hover{border-color:#000}@media screen and (max-device-width: 1024px){jmnode{padding:5px;border-radius:3px;font-size:14px}jmnode.root{font-size:21px}}jmnodes.theme-primary jmnode{background-color:#428bca;color:#fff;border-color:#357ebd}jmnodes.theme-primary jmnode:hover{background-color:#3276b1;border-color:#285e8e}jmnodes.theme-primary jmnode.selected{background-color:#f1c40f;color:#fff}jmnodes.theme-warning jmnode{background-color:#f0ad4e;border-color:#eea236;color:#fff}jmnodes.theme-warning jmnode:hover{background-color:#ed9c28;border-color:#d58512}jmnodes.theme-warning jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-danger jmnode{background-color:#d9534f;border-color:#d43f3a;color:#fff}jmnodes.theme-danger jmnode:hover{background-color:#d2322d;border-color:#ac2925}jmnodes.theme-danger jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-success jmnode{background-color:#5cb85c;border-color:#4cae4c;color:#fff}jmnodes.theme-success jmnode:hover{background-color:#47a447;border-color:#398439}jmnodes.theme-success jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-info jmnode{background-color:#5dc0de;border-color:#46b8da;color:#fff}jmnodes.theme-info jmnode:hover{background-color:#39b3d7;border-color:#269abc}jmnodes.theme-info jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-greensea jmnode{background-color:#1abc9c;color:#fff}jmnodes.theme-greensea jmnode:hover{background-color:#16a085}jmnodes.theme-greensea jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-nephrite jmnode{background-color:#2ecc71;color:#fff}jmnodes.theme-nephrite jmnode:hover{background-color:#27ae60}jmnodes.theme-nephrite jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-belizehole jmnode{background-color:#3498db;color:#fff}jmnodes.theme-belizehole jmnode:hover{background-color:#2980b9}jmnodes.theme-belizehole jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-wisteria jmnode{background-color:#9b59b6;color:#fff}jmnodes.theme-wisteria jmnode:hover{background-color:#8e44ad}jmnodes.theme-wisteria jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asphalt jmnode{background-color:#34495e;color:#fff}jmnodes.theme-asphalt jmnode:hover{background-color:#2c3e50}jmnodes.theme-asphalt jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-orange jmnode{background-color:#f1c40f;color:#fff}jmnodes.theme-orange jmnode:hover{background-color:#f39c12}jmnodes.theme-orange jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pumpkin jmnode{background-color:#e67e22;color:#fff}jmnodes.theme-pumpkin jmnode:hover{background-color:#d35400}jmnodes.theme-pumpkin jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pomegranate jmnode{background-color:#e74c3c;color:#fff}jmnodes.theme-pomegranate jmnode:hover{background-color:#c0392b}jmnodes.theme-pomegranate jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-clouds jmnode{background-color:#ecf0f1;color:#333}jmnodes.theme-clouds jmnode:hover{background-color:#bdc3c7}jmnodes.theme-clouds jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asbestos jmnode{background-color:#95a5a6;color:#fff}jmnodes.theme-asbestos jmnode:hover{background-color:#7f8c8d}jmnodes.theme-asbestos jmnode.selected{background-color:#11f;color:#fff}.scroll-top{right:15px;width:45px;height:45px;z-index:999;bottom:30px;display:none;font-size:12px;cursor:pointer;position:fixed;border-radius:50%;background-size:30px;background-color:#fff;background-position:center;background-repeat:no-repeat;box-shadow:0 0 5px #3eaf7c4d;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJmaWxsOiMzZWFmN2MiIGNsYXNzPSJpY29uIGJhY2stdG8tdG9wLWljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIGZpbGw9ImN1cnJlbnRDb2xvciIgYXJpYS1sYWJlbD0iYmFjay10by10b3AgaWNvbiI+PHBhdGggZD0iTTUxMiA4NDMuMmMtMzYuMiAwLTY2LjQtMTMuNi04NS44LTIxLjgtMTAuOC00LjYtMjIuNiAzLjYtMjEuOCAxNS4ybDcgMTAyYy40IDYuMiA3LjYgOS40IDEyLjYgNS42bDI5LTIyYzMuNi0yLjggOS0xLjggMTEuNCAybDQxIDY0LjJjMyA0LjggMTAuMiA0LjggMTMuMiAwbDQxLTY0LjJjMi40LTMuOCA3LjgtNC44IDExLjQtMmwyOSAyMmM1IDMuOCAxMi4yLjYgMTIuNi01LjZsNy0xMDJjLjgtMTEuNi0xMS0yMC0yMS44LTE1LjItMTkuNiA4LjItNDkuNiAyMS44LTg1LjggMjEuOHoiPjwvcGF0aD48cGF0aCBkPSJtNzk1LjQgNTg2LjItOTYtOTguMkM2OTkuNCAxNzIgNTEzIDMyIDUxMyAzMlMzMjQuOCAxNzIgMzI0LjggNDg4bC05NiA5OC4yYy0zLjYgMy42LTUuMiA5LTQuNCAxNC4yTDI2MS4yIDgyNGMxLjggMTEuNCAxNC4yIDE3IDIzLjYgMTAuOEw0MTkgNzQ0czQxLjQgNDAgOTQuMiA0MGM1Mi44IDAgOTIuMi00MCA5Mi4yLTQwbDEzNC4yIDkwLjhjOS4yIDYuMiAyMS42LjYgMjMuNi0xMC44bDM3LTIyMy44Yy40LTUuMi0xLjItMTAuNC00LjgtMTR6TTUxMyAzODRjLTM0IDAtNjEuNC0yOC42LTYxLjQtNjRzMjcuNi02NCA2MS40LTY0YzM0IDAgNjEuNCAyOC42IDYxLjQgNjRTNTQ3IDM4NCA1MTMgMzg0eiI+PC9wYXRoPjwvc3ZnPg==)}.scroll-top:hover{background-color:#f9f9f9}.dark-theme .scroll-top,.dark-plus-theme .scroll-top{background-color:#464646;box-shadow:0 0 5px #505050}.tippy-box[data-theme~=scroll]{font-size:12px} `);
  35.  
  36. !function(){function e(e,t){return(t||"")+" (SystemJS Error#"+e+" https://github.com/systemjs/systemjs/blob/main/docs/errors.md#"+e+")"}function t(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(j,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){var n,r=t.slice(0,t.indexOf(":")+1);if(n="/"===t[r.length+1]?"file:"!==r?(n=t.slice(r.length+2)).slice(n.indexOf("/")+1):t.slice(8):t.slice(r.length+("/"===t[r.length])),"/"===e[0])return t.slice(0,t.length-n.length-1)+e;for(var i=n.slice(0,n.lastIndexOf("/")+1)+e,o=[],s=-1,u=0;u<i.length;u++)-1!==s?"/"===i[u]&&(o.push(i.slice(s,u+1)),s=-1):"."===i[u]?"."!==i[u+1]||"/"!==i[u+2]&&u+2!==i.length?"/"===i[u+1]||u+1===i.length?u+=1:s=u:(o.pop(),u+=2):s=u;return-1!==s&&o.push(i.slice(s)),t.slice(0,t.length-n.length)+o.join("")}}function n(e,n){return t(e,n)||(-1!==e.indexOf(":")?e:t("./"+e,n))}function r(e,n,r,i,o){for(var s in e){var a=t(s,r)||s,f=e[s];if("string"==typeof f){var l=c(i,t(f,r)||f,o);l?n[a]=l:u("W1",s,f,"bare specifier did not resolve")}}}function i(e,t,i){var o;for(o in e.imports&&r(e.imports,i.imports,t,i,null),e.scopes||{}){var s=n(o,t);r(e.scopes[o],i.scopes[s]||(i.scopes[s]={}),t,i,s)}for(o in e.depcache||{})i.depcache[n(o,t)]=e.depcache[o];for(o in e.integrity||{})i.integrity[n(o,t)]=e.integrity[o]}function o(e,t){if(t[e])return e;var n=e.length;do{var r=e.slice(0,n+1);if(r in t)return r}while(-1!==(n=e.lastIndexOf("/",n-1)))}function s(e,t){var n=o(e,t);if(n){var r=t[n];if(null===r)return;if(!(e.length>n.length&&"/"!==r[r.length-1]))return r+e.slice(n.length);u("W2",n,r,"should have a trailing '/'")}}function u(t,n,r,i){console.warn(e(t,"Package target "+i+", resolving target '"+r+"' for "+n))}function c(e,t,n){for(var r=e.scopes,i=n&&o(n,r);i;){var u=s(t,r[i]);if(u)return u;i=o(i.slice(0,i.lastIndexOf("/")),r)}return s(t,e.imports)||-1!==t.indexOf(":")&&t}function a(){this[M]={}}function f(e){return e.id}function l(e,t,n,r){if(e.onload(n,t.id,t.d&&t.d.map(f),!!r),n)throw n}function d(t,n,r,i){var o=t[M][n];if(o)return o;var s=[],u=Object.create(null);P&&Object.defineProperty(u,P,{value:"Module"});var c=Promise.resolve().then((function(){return t.instantiate(n,r,i)})).then((function(r){if(!r)throw Error(e(2,"Module "+n+" did not instantiate"));var i=r[1]((function(e,t){o.h=!0;var n=!1;if("string"==typeof e)e in u&&u[e]===t||(u[e]=t,n=!0);else{for(var r in e)t=e[r],r in u&&u[r]===t||(u[r]=t,n=!0);e&&e.__esModule&&(u.__esModule=e.__esModule)}if(n)for(var i=0;i<s.length;i++){var c=s[i];c&&c(u)}return t}),2===r[1].length?{import:function(e,r){return t.import(e,n,r)},meta:t.createContext(n)}:void 0);return o.e=i.execute||function(){},[r[0],i.setters||[],r[2]||[]]}),(function(e){throw o.e=null,o.er=e,l(t,o,e,!0),e})),a=c.then((function(e){return Promise.all(e[0].map((function(r,i){var o=e[1][i],s=e[2][i];return Promise.resolve(t.resolve(r,n)).then((function(e){var r=d(t,e,n,s);return Promise.resolve(r.I).then((function(){return o&&(r.i.push(o),!r.h&&r.I||o(r.n)),r}))}))}))).then((function(e){o.d=e}))}));return o=t[M][n]={id:n,i:s,n:u,m:i,I:c,L:a,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0,p:void 0}}function h(e,t,n,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then((function(){return t.p&&null!==t.p.e||(t.p=n),Promise.all(t.d.map((function(t){return h(e,t,n,r)})))})).catch((function(n){if(t.er)throw n;throw t.e=null,l(e,t,n,!1),n}))}function p(e,t){return t.C=h(e,t,t,{}).then((function(){return v(e,t,{})})).then((function(){return t.n}))}function v(e,t,n){function r(){try{var n=o.call(L);if(n)return n=n.then((function(){t.C=t.n,t.E=null,l(e,t,null,!0)}),(function(n){throw t.er=n,t.E=null,l(e,t,n,!0),n})),t.E=n;t.C=t.n,t.L=t.I=void 0}catch(r){throw t.er=r,r}finally{l(e,t,t.er,!0)}}if(!n[t.id]){if(n[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}var i,o=t.e;return t.e=null,t.d.forEach((function(r){try{var o=v(e,r,n);o&&(i=i||[]).push(o)}catch(s){throw t.er=s,l(e,t,s,!1),s}})),i?Promise.all(i).then(r):r()}}function m(){[].forEach.call(document.querySelectorAll("script"),(function(t){if(!t.sp)if("systemjs-module"===t.type){if(t.sp=!0,!t.src)return;System.import("import:"===t.src.slice(0,7)?t.src.slice(7):n(t.src,g)).catch((function(e){if(e.message.indexOf("https://github.com/systemjs/systemjs/blob/main/docs/errors.md#3")>-1){var n=document.createEvent("Event");n.initEvent("error",!1,!1),t.dispatchEvent(n)}return Promise.reject(e)}))}else if("systemjs-importmap"===t.type){t.sp=!0;var r=t.src?(System.fetch||fetch)(t.src,{integrity:t.integrity,priority:t.fetchPriority,passThrough:!0}).then((function(e){if(!e.ok)throw Error("Invalid status code: "+e.status);return e.text()})).catch((function(n){return n.message=e("W4","Error fetching systemjs-import map "+t.src)+"\n"+n.message,console.warn(n),"function"==typeof t.onerror&&t.onerror(),"{}"})):t.innerHTML;W=W.then((function(){return r})).then((function(n){!function(t,n,r){var o={};try{o=JSON.parse(n)}catch(s){console.warn(Error(e("W5","systemjs-importmap contains invalid JSON")+"\n\n"+n+"\n"))}i(o,r,t)}(N,n,t.src||g)}))}}))}var g,y="undefined"!=typeof Symbol,b="undefined"!=typeof self,S="undefined"!=typeof document,w=b?self:global;if(S){var O=document.querySelector("base[href]");O&&(g=O.href)}if(!g&&"undefined"!=typeof location){var E=(g=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==E&&(g=g.slice(0,E+1))}var x,j=/\\/g,P=y&&Symbol.toStringTag,M=y?Symbol():"@",I=a.prototype;I.import=function(e,t,n){var r=this;return t&&"object"==typeof t&&(n=t,t=void 0),Promise.resolve(r.prepareImport()).then((function(){return r.resolve(e,t,n)})).then((function(e){var t=d(r,e,void 0,n);return t.C||p(r,t)}))},I.createContext=function(e){var t=this;return{url:e,resolve:function(n,r){return Promise.resolve(t.resolve(n,r||e))}}},I.onload=function(){},I.register=function(e,t,n){x=[e,t,n]},I.getRegister=function(){var e=x;return x=void 0,e};var L=Object.freeze(Object.create(null));w.System=new a;var C,R,W=Promise.resolve(),N={imports:{},scopes:{},depcache:{},integrity:{}},T=S;if(I.prepareImport=function(e){return(T||e)&&(m(),T=!1),W},I.getImportMap=function(){return JSON.parse(JSON.stringify(N))},S&&(m(),window.addEventListener("DOMContentLoaded",m)),I.addImportMap=function(e,t){i(e,t||g,N)},S){window.addEventListener("error",(function(e){J=e.filename,_=e.error}));var A=location.origin}I.createScript=function(e){var t=document.createElement("script");t.async=!0,e.indexOf(A+"/")&&(t.crossOrigin="anonymous");var n=N.integrity[e];return n&&(t.integrity=n),t.src=e,t};var J,_,k={},U=I.register;I.register=function(e,t){if(S&&"loading"===document.readyState&&"string"!=typeof e){var n=document.querySelectorAll("script[src]"),r=n[n.length-1];if(r){C=e;var i=this;R=setTimeout((function(){k[r.src]=[e,t],i.import(r.src)}))}}else C=void 0;return U.call(this,e,t)},I.instantiate=function(t,n){var r=k[t];if(r)return delete k[t],r;var i=this;return Promise.resolve(I.createScript(t)).then((function(r){return new Promise((function(o,s){r.addEventListener("error",(function(){s(Error(e(3,"Error loading "+t+(n?" from "+n:""))))})),r.addEventListener("load",(function(){if(document.head.removeChild(r),J===t)s(_);else{var e=i.getRegister(t);e&&e[0]===C&&clearTimeout(R),o(e)}})),document.head.appendChild(r)}))}))},I.shouldFetch=function(){return!1},"undefined"!=typeof fetch&&(I.fetch=fetch);var $=I.instantiate,B=/^(text|application)\/(x-)?javascript(;|$)/;I.instantiate=function(t,n,r){var i=this;return this.shouldFetch(t,n,r)?this.fetch(t,{credentials:"same-origin",integrity:N.integrity[t],meta:r}).then((function(r){if(!r.ok)throw Error(e(7,r.status+" "+r.statusText+", loading "+t+(n?" from "+n:"")));var o=r.headers.get("content-type");if(!o||!B.test(o))throw Error(e(4,'Unknown Content-Type "'+o+'", loading '+t+(n?" from "+n:"")));return r.text().then((function(e){return e.indexOf("//# sourceURL=")<0&&(e+="\n//# sourceURL="+t),(0,eval)(e),i.getRegister(t)}))})):$.apply(this,arguments)},I.resolve=function(n,r){return c(N,t(n,r=r||g)||n,r)||function(t,n){throw Error(e(8,"Unable to resolve bare specifier '"+t+(n?"' from "+n:"'")))}(n,r)};var F=I.instantiate;I.instantiate=function(e,t,n){var r=N.depcache[e];if(r)for(var i=0;i<r.length;i++)d(this,this.resolve(r[i],e),e);return F.call(this,e,t,n)},b&&"function"==typeof importScripts&&(I.instantiate=function(e){var t=this;return Promise.resolve().then((function(){return importScripts(e),t.getRegister(e)}))}),function(e){function t(t){return!e.hasOwnProperty(t)||!isNaN(t)&&t<e.length||a&&e[t]&&"undefined"!=typeof window&&e[t].parent===window}var n,r,i,o=e.System.constructor.prototype,s=o.import;o.import=function(o,u,c){return function(){for(var o in n=r=void 0,e)t(o)||(n?r||(r=o):n=o,i=o)}(),s.call(this,o,u,c)};var u=[[],function(){return{}}],c=o.getRegister;o.getRegister=function(){var o=c.call(this);if(o)return o;var s,a=function(o){var s,u,c=0;for(var a in e)if(!t(a)){if(0===c&&a!==n||1===c&&a!==r)return a;s?(i=a,u=o&&u||a):s=a===i,c++}return u}(this.firstGlobalProp);if(!a)return u;try{s=e[a]}catch(f){return u}return[[],function(e){return{execute:function(){e(s),e({default:s,__useDefault:!0})}}}]};var a="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Trident")}("undefined"!=typeof self?self:global),function(e){var t=e.System.constructor.prototype,r=/^[^#?]+\.(css|html|json|wasm)([?#].*)?$/,i=t.shouldFetch.bind(t);t.shouldFetch=function(e){return i(e)||r.test(e)};var o=/^application\/json(;|$)/,s=/^text\/css(;|$)/,u=/^application\/wasm(;|$)/,c=t.fetch;t.fetch=function(t,r){return c(t,r).then((function(i){if(r.passThrough)return i;if(!i.ok)return i;var c=i.headers.get("content-type");return o.test(c)?i.json().then((function(e){return new Response(new Blob(['System.register([],function(e){return{execute:function(){e("default",'+JSON.stringify(e)+")}}})"],{type:"application/javascript"}))})):s.test(c)?i.text().then((function(e){return e=e.replace(/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g,(function(e,r,i,o){return["url(",r,n(i||o,t),r,")"].join("")})),new Response(new Blob(["System.register([],function(e){return{execute:function(){var s=new CSSStyleSheet();s.replaceSync("+JSON.stringify(e)+');e("default",s)}}})'],{type:"application/javascript"}))})):u.test(c)?(WebAssembly.compileStreaming?WebAssembly.compileStreaming(i):i.arrayBuffer().then(WebAssembly.compile)).then((function(n){e.System.wasmModules||(e.System.wasmModules=Object.create(null)),e.System.wasmModules[t]=n;var r=[],i=[];return WebAssembly.Module.imports&&WebAssembly.Module.imports(n).forEach((function(e){var t=JSON.stringify(e.module);-1===r.indexOf(t)&&(r.push(t),i.push("function(m){i["+t+"]=m}"))})),new Response(new Blob(["System.register(["+r.join(",")+"],function(e){var i={};return{setters:["+i.join(",")+"],execute:function(){return WebAssembly.instantiate(System.wasmModules["+JSON.stringify(t)+"],i).then(function(m){e(m.exports)})}}})"],{type:"application/javascript"}))})):i}))}}("undefined"!=typeof self?self:global);var q="undefined"!=typeof Symbol&&Symbol.toStringTag;I.get=function(e){var t=this[M][e];if(t&&null===t.e&&!t.E)return t.er?null:t.n},I.set=function(t,n){try{new URL(t)}catch(s){console.warn(Error(e("W3",'"'+t+'" is not a valid URL to set in the module registry')))}var r;q&&"Module"===n[q]?r=n:(r=Object.assign(Object.create(null),n),q&&Object.defineProperty(r,q,{value:"Module"}));var i=Promise.resolve(r),o=this[M][t]||(this[M][t]={id:t,i:[],h:!1,d:[],e:null,er:void 0,E:void 0});return!o.e&&!o.E&&(Object.assign(o,{n:r,I:void 0,L:void 0,C:i}),r)},I.has=function(e){return!!this[M][e]},I.delete=function(e){var t=this[M],n=t[e];if(!n||n.p&&null!==n.p.e||n.E)return!1;var r=n.i;return n.d&&n.d.forEach((function(e){var t=e.i.indexOf(n);-1!==t&&e.i.splice(t,1)})),delete t[e],function(){var n=t[e];if(!n||!r||null!==n.e||n.E)return!1;r.forEach((function(e){n.i.push(e),e(n.n)})),r=null}};var D="undefined"!=typeof Symbol&&Symbol.iterator;I.entries=function(){var e,t,n=this,r=Object.keys(n[M]),i=0,o={next:function(){for(;void 0!==(t=r[i++])&&void 0===(e=n.get(t)););return{done:void 0===t,value:void 0!==t&&[t,e]}}};return o[D]=function(){return this},o}}();
  37. !function(t){function e(t){t.registerRegistry=Object.create(null),t.namedRegisterAliases=Object.create(null)}var r=t.System;e(r);var i,s,n=r.constructor.prototype,l=r.constructor,a=function(){l.call(this),e(this)};a.prototype=n,r.constructor=a;var o=n.register;n.register=function(t,e,r,n){if("string"!=typeof t)return o.apply(this,arguments);var l=[e,r,n];return this.registerRegistry[t]=l,i||(i=l,s=t),Promise.resolve().then((function(){i=null,s=null})),o.apply(this,[e,r,n])};var u=n.resolve;n.resolve=function(t,e){try{return u.call(this,t,e)}catch(r){if(t in this.registerRegistry)return this.namedRegisterAliases[t]||t;throw r}};var c=n.instantiate;n.instantiate=function(t,e,r){var i=this.registerRegistry[t];return i?(this.registerRegistry[t]=null,i):c.call(this,t,e,r)};var g=n.getRegister;n.getRegister=function(t){var e=g.call(this,t);s&&t&&(this.namedRegisterAliases[s]=t);var r=i||e;return i=null,s=null,r}}("undefined"!=typeof self?self:global);
  38. ;(typeof System!='undefined')&&(System=new System.constructor());
  39. System.addImportMap({ imports: {"highlight.js":"user:highlight.js","beautifier":"user:beautifier","jsmind":"user:jsmind","dom-to-image":"user:dom-to-image"} });
  40. System.set("user:highlight.js", (()=>{const _=hljs;('default' in _)||(_.default=_);return _})());
  41. System.set("user:beautifier", (()=>{const _=beautifier;('default' in _)||(_.default=_);return _})());
  42. System.set("user:jsmind", (()=>{const _=jsmind;('default' in _)||(_.default=_);return _})());
  43. System.set("user:dom-to-image", (()=>{const _=domtoimage;('default' in _)||(_.default=_);return _})());
  44.  
  45. System.register("./__entry.js", ['./__monkey.entry-D38Pz7Rd.js'], (function (exports, module) {
  46. 'use strict';
  47. return {
  48. setters: [null],
  49. execute: (function () {
  50.  
  51.  
  52.  
  53. })
  54. };
  55. }));
  56.  
  57. System.register("./__monkey.entry-D38Pz7Rd.js", [], (function (exports, module) {
  58. 'use strict';
  59. return {
  60. execute: (function () {
  61.  
  62. const scriptRel = function detectScriptRel() {
  63. const relList = typeof document !== "undefined" && document.createElement("link").relList;
  64. return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
  65. }();
  66. const assetsURL = function(dep) {
  67. return "/" + dep;
  68. };
  69. const seen = {};
  70. const __vitePreload = function preload(baseModule, deps, importerUrl) {
  71. let promise = Promise.resolve();
  72. if (deps && deps.length > 0) {
  73. document.getElementsByTagName("link");
  74. const cspNonceMeta = document.querySelector(
  75. "meta[property=csp-nonce]"
  76. );
  77. const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
  78. promise = Promise.allSettled(
  79. deps.map((dep) => {
  80. dep = assetsURL(dep);
  81. if (dep in seen) return;
  82. seen[dep] = true;
  83. const isCss = dep.endsWith(".css");
  84. const cssSelector = isCss ? '[rel="stylesheet"]' : "";
  85. if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
  86. return;
  87. }
  88. const link = document.createElement("link");
  89. link.rel = isCss ? "stylesheet" : scriptRel;
  90. if (!isCss) {
  91. link.as = "script";
  92. }
  93. link.crossOrigin = "";
  94. link.href = dep;
  95. if (cspNonce) {
  96. link.setAttribute("nonce", cspNonce);
  97. }
  98. document.head.appendChild(link);
  99. if (isCss) {
  100. return new Promise((res, rej) => {
  101. link.addEventListener("load", res);
  102. link.addEventListener(
  103. "error",
  104. () => rej(new Error(`Unable to preload CSS for ${dep}`))
  105. );
  106. });
  107. }
  108. })
  109. );
  110. }
  111. function handlePreloadError(err) {
  112. const e = new Event("vite:preloadError", {
  113. cancelable: true
  114. });
  115. e.payload = err;
  116. window.dispatchEvent(e);
  117. if (!e.defaultPrevented) {
  118. throw err;
  119. }
  120. }
  121. return promise.then((res) => {
  122. for (const item of res || []) {
  123. if (item.status !== "rejected") continue;
  124. handlePreloadError(item.reason);
  125. }
  126. return baseModule().catch(handlePreloadError);
  127. });
  128. };
  129. var commonjsGlobal = exports("d", typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {});
  130. function getDefaultExportFromCjs(x) {
  131. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  132. }
  133. var jsonBigint = { exports: {} };
  134. var stringify = { exports: {} };
  135. var bignumber = { exports: {} };
  136. (function(module) {
  137. (function(globalObject) {
  138. var BigNumber2, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
  139. function clone(configObject) {
  140. var div, convertBase, parseNumeric, P = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
  141. prefix: "",
  142. groupSize: 3,
  143. secondaryGroupSize: 0,
  144. groupSeparator: ",",
  145. decimalSeparator: ".",
  146. fractionGroupSize: 0,
  147. fractionGroupSeparator: " ",
  148. // non-breaking space
  149. suffix: ""
  150. }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
  151. function BigNumber3(v, b) {
  152. var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
  153. if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
  154. if (b == null) {
  155. if (v && v._isBigNumber === true) {
  156. x.s = v.s;
  157. if (!v.c || v.e > MAX_EXP) {
  158. x.c = x.e = null;
  159. } else if (v.e < MIN_EXP) {
  160. x.c = [x.e = 0];
  161. } else {
  162. x.e = v.e;
  163. x.c = v.c.slice();
  164. }
  165. return;
  166. }
  167. if ((isNum = typeof v == "number") && v * 0 == 0) {
  168. x.s = 1 / v < 0 ? (v = -v, -1) : 1;
  169. if (v === ~~v) {
  170. for (e = 0, i = v; i >= 10; i /= 10, e++) ;
  171. if (e > MAX_EXP) {
  172. x.c = x.e = null;
  173. } else {
  174. x.e = e;
  175. x.c = [v];
  176. }
  177. return;
  178. }
  179. str = String(v);
  180. } else {
  181. if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
  182. x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
  183. }
  184. if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
  185. if ((i = str.search(/e/i)) > 0) {
  186. if (e < 0) e = i;
  187. e += +str.slice(i + 1);
  188. str = str.substring(0, i);
  189. } else if (e < 0) {
  190. e = str.length;
  191. }
  192. } else {
  193. intCheck(b, 2, ALPHABET.length, "Base");
  194. if (b == 10 && alphabetHasNormalDecimalDigits) {
  195. x = new BigNumber3(v);
  196. return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
  197. }
  198. str = String(v);
  199. if (isNum = typeof v == "number") {
  200. if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
  201. x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
  202. if (BigNumber3.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
  203. throw Error(tooManyDigits + v);
  204. }
  205. } else {
  206. x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
  207. }
  208. alphabet = ALPHABET.slice(0, b);
  209. e = i = 0;
  210. for (len = str.length; i < len; i++) {
  211. if (alphabet.indexOf(c = str.charAt(i)) < 0) {
  212. if (c == ".") {
  213. if (i > e) {
  214. e = len;
  215. continue;
  216. }
  217. } else if (!caseChanged) {
  218. if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
  219. caseChanged = true;
  220. i = -1;
  221. e = 0;
  222. continue;
  223. }
  224. }
  225. return parseNumeric(x, String(v), isNum, b);
  226. }
  227. }
  228. isNum = false;
  229. str = convertBase(str, b, 10, x.s);
  230. if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
  231. else e = str.length;
  232. }
  233. for (i = 0; str.charCodeAt(i) === 48; i++) ;
  234. for (len = str.length; str.charCodeAt(--len) === 48; ) ;
  235. if (str = str.slice(i, ++len)) {
  236. len -= i;
  237. if (isNum && BigNumber3.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
  238. throw Error(tooManyDigits + x.s * v);
  239. }
  240. if ((e = e - i - 1) > MAX_EXP) {
  241. x.c = x.e = null;
  242. } else if (e < MIN_EXP) {
  243. x.c = [x.e = 0];
  244. } else {
  245. x.e = e;
  246. x.c = [];
  247. i = (e + 1) % LOG_BASE;
  248. if (e < 0) i += LOG_BASE;
  249. if (i < len) {
  250. if (i) x.c.push(+str.slice(0, i));
  251. for (len -= LOG_BASE; i < len; ) {
  252. x.c.push(+str.slice(i, i += LOG_BASE));
  253. }
  254. i = LOG_BASE - (str = str.slice(i)).length;
  255. } else {
  256. i -= len;
  257. }
  258. for (; i--; str += "0") ;
  259. x.c.push(+str);
  260. }
  261. } else {
  262. x.c = [x.e = 0];
  263. }
  264. }
  265. BigNumber3.clone = clone;
  266. BigNumber3.ROUND_UP = 0;
  267. BigNumber3.ROUND_DOWN = 1;
  268. BigNumber3.ROUND_CEIL = 2;
  269. BigNumber3.ROUND_FLOOR = 3;
  270. BigNumber3.ROUND_HALF_UP = 4;
  271. BigNumber3.ROUND_HALF_DOWN = 5;
  272. BigNumber3.ROUND_HALF_EVEN = 6;
  273. BigNumber3.ROUND_HALF_CEIL = 7;
  274. BigNumber3.ROUND_HALF_FLOOR = 8;
  275. BigNumber3.EUCLID = 9;
  276. BigNumber3.config = BigNumber3.set = function(obj) {
  277. var p, v;
  278. if (obj != null) {
  279. if (typeof obj == "object") {
  280. if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
  281. v = obj[p];
  282. intCheck(v, 0, MAX, p);
  283. DECIMAL_PLACES = v;
  284. }
  285. if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
  286. v = obj[p];
  287. intCheck(v, 0, 8, p);
  288. ROUNDING_MODE = v;
  289. }
  290. if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
  291. v = obj[p];
  292. if (v && v.pop) {
  293. intCheck(v[0], -MAX, 0, p);
  294. intCheck(v[1], 0, MAX, p);
  295. TO_EXP_NEG = v[0];
  296. TO_EXP_POS = v[1];
  297. } else {
  298. intCheck(v, -MAX, MAX, p);
  299. TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
  300. }
  301. }
  302. if (obj.hasOwnProperty(p = "RANGE")) {
  303. v = obj[p];
  304. if (v && v.pop) {
  305. intCheck(v[0], -MAX, -1, p);
  306. intCheck(v[1], 1, MAX, p);
  307. MIN_EXP = v[0];
  308. MAX_EXP = v[1];
  309. } else {
  310. intCheck(v, -MAX, MAX, p);
  311. if (v) {
  312. MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
  313. } else {
  314. throw Error(bignumberError + p + " cannot be zero: " + v);
  315. }
  316. }
  317. }
  318. if (obj.hasOwnProperty(p = "CRYPTO")) {
  319. v = obj[p];
  320. if (v === !!v) {
  321. if (v) {
  322. if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  323. CRYPTO = v;
  324. } else {
  325. CRYPTO = !v;
  326. throw Error(bignumberError + "crypto unavailable");
  327. }
  328. } else {
  329. CRYPTO = v;
  330. }
  331. } else {
  332. throw Error(bignumberError + p + " not true or false: " + v);
  333. }
  334. }
  335. if (obj.hasOwnProperty(p = "MODULO_MODE")) {
  336. v = obj[p];
  337. intCheck(v, 0, 9, p);
  338. MODULO_MODE = v;
  339. }
  340. if (obj.hasOwnProperty(p = "POW_PRECISION")) {
  341. v = obj[p];
  342. intCheck(v, 0, MAX, p);
  343. POW_PRECISION = v;
  344. }
  345. if (obj.hasOwnProperty(p = "FORMAT")) {
  346. v = obj[p];
  347. if (typeof v == "object") FORMAT = v;
  348. else throw Error(bignumberError + p + " not an object: " + v);
  349. }
  350. if (obj.hasOwnProperty(p = "ALPHABET")) {
  351. v = obj[p];
  352. if (typeof v == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) {
  353. alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
  354. ALPHABET = v;
  355. } else {
  356. throw Error(bignumberError + p + " invalid: " + v);
  357. }
  358. }
  359. } else {
  360. throw Error(bignumberError + "Object expected: " + obj);
  361. }
  362. }
  363. return {
  364. DECIMAL_PLACES,
  365. ROUNDING_MODE,
  366. EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
  367. RANGE: [MIN_EXP, MAX_EXP],
  368. CRYPTO,
  369. MODULO_MODE,
  370. POW_PRECISION,
  371. FORMAT,
  372. ALPHABET
  373. };
  374. };
  375. BigNumber3.isBigNumber = function(v) {
  376. if (!v || v._isBigNumber !== true) return false;
  377. if (!BigNumber3.DEBUG) return true;
  378. var i, n, c = v.c, e = v.e, s = v.s;
  379. out: if ({}.toString.call(c) == "[object Array]") {
  380. if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
  381. if (c[0] === 0) {
  382. if (e === 0 && c.length === 1) return true;
  383. break out;
  384. }
  385. i = (e + 1) % LOG_BASE;
  386. if (i < 1) i += LOG_BASE;
  387. if (String(c[0]).length == i) {
  388. for (i = 0; i < c.length; i++) {
  389. n = c[i];
  390. if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
  391. }
  392. if (n !== 0) return true;
  393. }
  394. }
  395. } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
  396. return true;
  397. }
  398. throw Error(bignumberError + "Invalid BigNumber: " + v);
  399. };
  400. BigNumber3.maximum = BigNumber3.max = function() {
  401. return maxOrMin(arguments, -1);
  402. };
  403. BigNumber3.minimum = BigNumber3.min = function() {
  404. return maxOrMin(arguments, 1);
  405. };
  406. BigNumber3.random = function() {
  407. var pow2_53 = 9007199254740992;
  408. var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
  409. return mathfloor(Math.random() * pow2_53);
  410. } : function() {
  411. return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
  412. };
  413. return function(dp) {
  414. var a, b, e, k, v, i = 0, c = [], rand = new BigNumber3(ONE);
  415. if (dp == null) dp = DECIMAL_PLACES;
  416. else intCheck(dp, 0, MAX);
  417. k = mathceil(dp / LOG_BASE);
  418. if (CRYPTO) {
  419. if (crypto.getRandomValues) {
  420. a = crypto.getRandomValues(new Uint32Array(k *= 2));
  421. for (; i < k; ) {
  422. v = a[i] * 131072 + (a[i + 1] >>> 11);
  423. if (v >= 9e15) {
  424. b = crypto.getRandomValues(new Uint32Array(2));
  425. a[i] = b[0];
  426. a[i + 1] = b[1];
  427. } else {
  428. c.push(v % 1e14);
  429. i += 2;
  430. }
  431. }
  432. i = k / 2;
  433. } else if (crypto.randomBytes) {
  434. a = crypto.randomBytes(k *= 7);
  435. for (; i < k; ) {
  436. v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
  437. if (v >= 9e15) {
  438. crypto.randomBytes(7).copy(a, i);
  439. } else {
  440. c.push(v % 1e14);
  441. i += 7;
  442. }
  443. }
  444. i = k / 7;
  445. } else {
  446. CRYPTO = false;
  447. throw Error(bignumberError + "crypto unavailable");
  448. }
  449. }
  450. if (!CRYPTO) {
  451. for (; i < k; ) {
  452. v = random53bitInt();
  453. if (v < 9e15) c[i++] = v % 1e14;
  454. }
  455. }
  456. k = c[--i];
  457. dp %= LOG_BASE;
  458. if (k && dp) {
  459. v = POWS_TEN[LOG_BASE - dp];
  460. c[i] = mathfloor(k / v) * v;
  461. }
  462. for (; c[i] === 0; c.pop(), i--) ;
  463. if (i < 0) {
  464. c = [e = 0];
  465. } else {
  466. for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
  467. for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
  468. if (i < LOG_BASE) e -= LOG_BASE - i;
  469. }
  470. rand.e = e;
  471. rand.c = c;
  472. return rand;
  473. };
  474. }();
  475. BigNumber3.sum = function() {
  476. var i = 1, args = arguments, sum = new BigNumber3(args[0]);
  477. for (; i < args.length; ) sum = sum.plus(args[i++]);
  478. return sum;
  479. };
  480. convertBase = /* @__PURE__ */ function() {
  481. var decimal = "0123456789";
  482. function toBaseOut(str, baseIn, baseOut, alphabet) {
  483. var j, arr = [0], arrL, i = 0, len = str.length;
  484. for (; i < len; ) {
  485. for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
  486. arr[0] += alphabet.indexOf(str.charAt(i++));
  487. for (j = 0; j < arr.length; j++) {
  488. if (arr[j] > baseOut - 1) {
  489. if (arr[j + 1] == null) arr[j + 1] = 0;
  490. arr[j + 1] += arr[j] / baseOut | 0;
  491. arr[j] %= baseOut;
  492. }
  493. }
  494. }
  495. return arr.reverse();
  496. }
  497. return function(str, baseIn, baseOut, sign, callerIsToString) {
  498. var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
  499. if (i >= 0) {
  500. k = POW_PRECISION;
  501. POW_PRECISION = 0;
  502. str = str.replace(".", "");
  503. y = new BigNumber3(baseIn);
  504. x = y.pow(str.length - i);
  505. POW_PRECISION = k;
  506. y.c = toBaseOut(
  507. toFixedPoint(coeffToString(x.c), x.e, "0"),
  508. 10,
  509. baseOut,
  510. decimal
  511. );
  512. y.e = y.c.length;
  513. }
  514. xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
  515. e = k = xc.length;
  516. for (; xc[--k] == 0; xc.pop()) ;
  517. if (!xc[0]) return alphabet.charAt(0);
  518. if (i < 0) {
  519. --e;
  520. } else {
  521. x.c = xc;
  522. x.e = e;
  523. x.s = sign;
  524. x = div(x, y, dp, rm, baseOut);
  525. xc = x.c;
  526. r = x.r;
  527. e = x.e;
  528. }
  529. d = e + dp + 1;
  530. i = xc[d];
  531. k = baseOut / 2;
  532. r = r || d < 0 || xc[d + 1] != null;
  533. r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
  534. if (d < 1 || !xc[0]) {
  535. str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
  536. } else {
  537. xc.length = d;
  538. if (r) {
  539. for (--baseOut; ++xc[--d] > baseOut; ) {
  540. xc[d] = 0;
  541. if (!d) {
  542. ++e;
  543. xc = [1].concat(xc);
  544. }
  545. }
  546. }
  547. for (k = xc.length; !xc[--k]; ) ;
  548. for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
  549. str = toFixedPoint(str, e, alphabet.charAt(0));
  550. }
  551. return str;
  552. };
  553. }();
  554. div = /* @__PURE__ */ function() {
  555. function multiply(x, k, base) {
  556. var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
  557. for (x = x.slice(); i--; ) {
  558. xlo = x[i] % SQRT_BASE;
  559. xhi = x[i] / SQRT_BASE | 0;
  560. m = khi * xlo + xhi * klo;
  561. temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
  562. carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
  563. x[i] = temp % base;
  564. }
  565. if (carry) x = [carry].concat(x);
  566. return x;
  567. }
  568. function compare2(a, b, aL, bL) {
  569. var i, cmp;
  570. if (aL != bL) {
  571. cmp = aL > bL ? 1 : -1;
  572. } else {
  573. for (i = cmp = 0; i < aL; i++) {
  574. if (a[i] != b[i]) {
  575. cmp = a[i] > b[i] ? 1 : -1;
  576. break;
  577. }
  578. }
  579. }
  580. return cmp;
  581. }
  582. function subtract(a, b, aL, base) {
  583. var i = 0;
  584. for (; aL--; ) {
  585. a[aL] -= i;
  586. i = a[aL] < b[aL] ? 1 : 0;
  587. a[aL] = i * base + a[aL] - b[aL];
  588. }
  589. for (; !a[0] && a.length > 1; a.splice(0, 1)) ;
  590. }
  591. return function(x, y, dp, rm, base) {
  592. var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
  593. if (!xc || !xc[0] || !yc || !yc[0]) {
  594. return new BigNumber3(
  595. // Return NaN if either NaN, or both Infinity or 0.
  596. !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
  597. // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
  598. xc && xc[0] == 0 || !yc ? s * 0 : s / 0
  599. )
  600. );
  601. }
  602. q = new BigNumber3(s);
  603. qc = q.c = [];
  604. e = x.e - y.e;
  605. s = dp + e + 1;
  606. if (!base) {
  607. base = BASE;
  608. e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
  609. s = s / LOG_BASE | 0;
  610. }
  611. for (i = 0; yc[i] == (xc[i] || 0); i++) ;
  612. if (yc[i] > (xc[i] || 0)) e--;
  613. if (s < 0) {
  614. qc.push(1);
  615. more = true;
  616. } else {
  617. xL = xc.length;
  618. yL = yc.length;
  619. i = 0;
  620. s += 2;
  621. n = mathfloor(base / (yc[0] + 1));
  622. if (n > 1) {
  623. yc = multiply(yc, n, base);
  624. xc = multiply(xc, n, base);
  625. yL = yc.length;
  626. xL = xc.length;
  627. }
  628. xi = yL;
  629. rem = xc.slice(0, yL);
  630. remL = rem.length;
  631. for (; remL < yL; rem[remL++] = 0) ;
  632. yz = yc.slice();
  633. yz = [0].concat(yz);
  634. yc0 = yc[0];
  635. if (yc[1] >= base / 2) yc0++;
  636. do {
  637. n = 0;
  638. cmp = compare2(yc, rem, yL, remL);
  639. if (cmp < 0) {
  640. rem0 = rem[0];
  641. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  642. n = mathfloor(rem0 / yc0);
  643. if (n > 1) {
  644. if (n >= base) n = base - 1;
  645. prod = multiply(yc, n, base);
  646. prodL = prod.length;
  647. remL = rem.length;
  648. while (compare2(prod, rem, prodL, remL) == 1) {
  649. n--;
  650. subtract(prod, yL < prodL ? yz : yc, prodL, base);
  651. prodL = prod.length;
  652. cmp = 1;
  653. }
  654. } else {
  655. if (n == 0) {
  656. cmp = n = 1;
  657. }
  658. prod = yc.slice();
  659. prodL = prod.length;
  660. }
  661. if (prodL < remL) prod = [0].concat(prod);
  662. subtract(rem, prod, remL, base);
  663. remL = rem.length;
  664. if (cmp == -1) {
  665. while (compare2(yc, rem, yL, remL) < 1) {
  666. n++;
  667. subtract(rem, yL < remL ? yz : yc, remL, base);
  668. remL = rem.length;
  669. }
  670. }
  671. } else if (cmp === 0) {
  672. n++;
  673. rem = [0];
  674. }
  675. qc[i++] = n;
  676. if (rem[0]) {
  677. rem[remL++] = xc[xi] || 0;
  678. } else {
  679. rem = [xc[xi]];
  680. remL = 1;
  681. }
  682. } while ((xi++ < xL || rem[0] != null) && s--);
  683. more = rem[0] != null;
  684. if (!qc[0]) qc.splice(0, 1);
  685. }
  686. if (base == BASE) {
  687. for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
  688. round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
  689. } else {
  690. q.e = e;
  691. q.r = +more;
  692. }
  693. return q;
  694. };
  695. }();
  696. function format(n, i, rm, id) {
  697. var c0, e, ne, len, str;
  698. if (rm == null) rm = ROUNDING_MODE;
  699. else intCheck(rm, 0, 8);
  700. if (!n.c) return n.toString();
  701. c0 = n.c[0];
  702. ne = n.e;
  703. if (i == null) {
  704. str = coeffToString(n.c);
  705. str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
  706. } else {
  707. n = round(new BigNumber3(n), i, rm);
  708. e = n.e;
  709. str = coeffToString(n.c);
  710. len = str.length;
  711. if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
  712. for (; len < i; str += "0", len++) ;
  713. str = toExponential(str, e);
  714. } else {
  715. i -= ne;
  716. str = toFixedPoint(str, e, "0");
  717. if (e + 1 > len) {
  718. if (--i > 0) for (str += "."; i--; str += "0") ;
  719. } else {
  720. i += e - len;
  721. if (i > 0) {
  722. if (e + 1 == len) str += ".";
  723. for (; i--; str += "0") ;
  724. }
  725. }
  726. }
  727. }
  728. return n.s < 0 && c0 ? "-" + str : str;
  729. }
  730. function maxOrMin(args, n) {
  731. var k, y, i = 1, x = new BigNumber3(args[0]);
  732. for (; i < args.length; i++) {
  733. y = new BigNumber3(args[i]);
  734. if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
  735. x = y;
  736. }
  737. }
  738. return x;
  739. }
  740. function normalise(n, c, e) {
  741. var i = 1, j = c.length;
  742. for (; !c[--j]; c.pop()) ;
  743. for (j = c[0]; j >= 10; j /= 10, i++) ;
  744. if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
  745. n.c = n.e = null;
  746. } else if (e < MIN_EXP) {
  747. n.c = [n.e = 0];
  748. } else {
  749. n.e = e;
  750. n.c = c;
  751. }
  752. return n;
  753. }
  754. parseNumeric = /* @__PURE__ */ function() {
  755. var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
  756. return function(x, str, isNum, b) {
  757. var base, s = isNum ? str : str.replace(whitespaceOrPlus, "");
  758. if (isInfinityOrNaN.test(s)) {
  759. x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
  760. } else {
  761. if (!isNum) {
  762. s = s.replace(basePrefix, function(m, p1, p2) {
  763. base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
  764. return !b || b == base ? p1 : m;
  765. });
  766. if (b) {
  767. base = b;
  768. s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
  769. }
  770. if (str != s) return new BigNumber3(s, base);
  771. }
  772. if (BigNumber3.DEBUG) {
  773. throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
  774. }
  775. x.s = null;
  776. }
  777. x.c = x.e = null;
  778. };
  779. }();
  780. function round(x, sd, rm, r) {
  781. var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
  782. if (xc) {
  783. out: {
  784. for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
  785. i = sd - d;
  786. if (i < 0) {
  787. i += LOG_BASE;
  788. j = sd;
  789. n = xc[ni = 0];
  790. rd = mathfloor(n / pows10[d - j - 1] % 10);
  791. } else {
  792. ni = mathceil((i + 1) / LOG_BASE);
  793. if (ni >= xc.length) {
  794. if (r) {
  795. for (; xc.length <= ni; xc.push(0)) ;
  796. n = rd = 0;
  797. d = 1;
  798. i %= LOG_BASE;
  799. j = i - LOG_BASE + 1;
  800. } else {
  801. break out;
  802. }
  803. } else {
  804. n = k = xc[ni];
  805. for (d = 1; k >= 10; k /= 10, d++) ;
  806. i %= LOG_BASE;
  807. j = i - LOG_BASE + d;
  808. rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
  809. }
  810. }
  811. r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
  812. // The expression n % pows10[d - j - 1] returns all digits of n to the right
  813. // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
  814. xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
  815. r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
  816. (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  817. if (sd < 1 || !xc[0]) {
  818. xc.length = 0;
  819. if (r) {
  820. sd -= x.e + 1;
  821. xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
  822. x.e = -sd || 0;
  823. } else {
  824. xc[0] = x.e = 0;
  825. }
  826. return x;
  827. }
  828. if (i == 0) {
  829. xc.length = ni;
  830. k = 1;
  831. ni--;
  832. } else {
  833. xc.length = ni + 1;
  834. k = pows10[LOG_BASE - i];
  835. xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
  836. }
  837. if (r) {
  838. for (; ; ) {
  839. if (ni == 0) {
  840. for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) ;
  841. j = xc[0] += k;
  842. for (k = 1; j >= 10; j /= 10, k++) ;
  843. if (i != k) {
  844. x.e++;
  845. if (xc[0] == BASE) xc[0] = 1;
  846. }
  847. break;
  848. } else {
  849. xc[ni] += k;
  850. if (xc[ni] != BASE) break;
  851. xc[ni--] = 0;
  852. k = 1;
  853. }
  854. }
  855. }
  856. for (i = xc.length; xc[--i] === 0; xc.pop()) ;
  857. }
  858. if (x.e > MAX_EXP) {
  859. x.c = x.e = null;
  860. } else if (x.e < MIN_EXP) {
  861. x.c = [x.e = 0];
  862. }
  863. }
  864. return x;
  865. }
  866. function valueOf(n) {
  867. var str, e = n.e;
  868. if (e === null) return n.toString();
  869. str = coeffToString(n.c);
  870. str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
  871. return n.s < 0 ? "-" + str : str;
  872. }
  873. P.absoluteValue = P.abs = function() {
  874. var x = new BigNumber3(this);
  875. if (x.s < 0) x.s = 1;
  876. return x;
  877. };
  878. P.comparedTo = function(y, b) {
  879. return compare(this, new BigNumber3(y, b));
  880. };
  881. P.decimalPlaces = P.dp = function(dp, rm) {
  882. var c, n, v, x = this;
  883. if (dp != null) {
  884. intCheck(dp, 0, MAX);
  885. if (rm == null) rm = ROUNDING_MODE;
  886. else intCheck(rm, 0, 8);
  887. return round(new BigNumber3(x), dp + x.e + 1, rm);
  888. }
  889. if (!(c = x.c)) return null;
  890. n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
  891. if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
  892. if (n < 0) n = 0;
  893. return n;
  894. };
  895. P.dividedBy = P.div = function(y, b) {
  896. return div(this, new BigNumber3(y, b), DECIMAL_PLACES, ROUNDING_MODE);
  897. };
  898. P.dividedToIntegerBy = P.idiv = function(y, b) {
  899. return div(this, new BigNumber3(y, b), 0, 1);
  900. };
  901. P.exponentiatedBy = P.pow = function(n, m) {
  902. var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
  903. n = new BigNumber3(n);
  904. if (n.c && !n.isInteger()) {
  905. throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
  906. }
  907. if (m != null) m = new BigNumber3(m);
  908. nIsBig = n.e > 14;
  909. if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
  910. y = new BigNumber3(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
  911. return m ? y.mod(m) : y;
  912. }
  913. nIsNeg = n.s < 0;
  914. if (m) {
  915. if (m.c ? !m.c[0] : !m.s) return new BigNumber3(NaN);
  916. isModExp = !nIsNeg && x.isInteger() && m.isInteger();
  917. if (isModExp) x = x.mod(m);
  918. } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
  919. k = x.s < 0 && isOdd(n) ? -0 : 0;
  920. if (x.e > -1) k = 1 / k;
  921. return new BigNumber3(nIsNeg ? 1 / k : k);
  922. } else if (POW_PRECISION) {
  923. k = mathceil(POW_PRECISION / LOG_BASE + 2);
  924. }
  925. if (nIsBig) {
  926. half = new BigNumber3(0.5);
  927. if (nIsNeg) n.s = 1;
  928. nIsOdd = isOdd(n);
  929. } else {
  930. i = Math.abs(+valueOf(n));
  931. nIsOdd = i % 2;
  932. }
  933. y = new BigNumber3(ONE);
  934. for (; ; ) {
  935. if (nIsOdd) {
  936. y = y.times(x);
  937. if (!y.c) break;
  938. if (k) {
  939. if (y.c.length > k) y.c.length = k;
  940. } else if (isModExp) {
  941. y = y.mod(m);
  942. }
  943. }
  944. if (i) {
  945. i = mathfloor(i / 2);
  946. if (i === 0) break;
  947. nIsOdd = i % 2;
  948. } else {
  949. n = n.times(half);
  950. round(n, n.e + 1, 1);
  951. if (n.e > 14) {
  952. nIsOdd = isOdd(n);
  953. } else {
  954. i = +valueOf(n);
  955. if (i === 0) break;
  956. nIsOdd = i % 2;
  957. }
  958. }
  959. x = x.times(x);
  960. if (k) {
  961. if (x.c && x.c.length > k) x.c.length = k;
  962. } else if (isModExp) {
  963. x = x.mod(m);
  964. }
  965. }
  966. if (isModExp) return y;
  967. if (nIsNeg) y = ONE.div(y);
  968. return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
  969. };
  970. P.integerValue = function(rm) {
  971. var n = new BigNumber3(this);
  972. if (rm == null) rm = ROUNDING_MODE;
  973. else intCheck(rm, 0, 8);
  974. return round(n, n.e + 1, rm);
  975. };
  976. P.isEqualTo = P.eq = function(y, b) {
  977. return compare(this, new BigNumber3(y, b)) === 0;
  978. };
  979. P.isFinite = function() {
  980. return !!this.c;
  981. };
  982. P.isGreaterThan = P.gt = function(y, b) {
  983. return compare(this, new BigNumber3(y, b)) > 0;
  984. };
  985. P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
  986. return (b = compare(this, new BigNumber3(y, b))) === 1 || b === 0;
  987. };
  988. P.isInteger = function() {
  989. return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
  990. };
  991. P.isLessThan = P.lt = function(y, b) {
  992. return compare(this, new BigNumber3(y, b)) < 0;
  993. };
  994. P.isLessThanOrEqualTo = P.lte = function(y, b) {
  995. return (b = compare(this, new BigNumber3(y, b))) === -1 || b === 0;
  996. };
  997. P.isNaN = function() {
  998. return !this.s;
  999. };
  1000. P.isNegative = function() {
  1001. return this.s < 0;
  1002. };
  1003. P.isPositive = function() {
  1004. return this.s > 0;
  1005. };
  1006. P.isZero = function() {
  1007. return !!this.c && this.c[0] == 0;
  1008. };
  1009. P.minus = function(y, b) {
  1010. var i, j, t, xLTy, x = this, a = x.s;
  1011. y = new BigNumber3(y, b);
  1012. b = y.s;
  1013. if (!a || !b) return new BigNumber3(NaN);
  1014. if (a != b) {
  1015. y.s = -b;
  1016. return x.plus(y);
  1017. }
  1018. var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
  1019. if (!xe || !ye) {
  1020. if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber3(yc ? x : NaN);
  1021. if (!xc[0] || !yc[0]) {
  1022. return yc[0] ? (y.s = -b, y) : new BigNumber3(xc[0] ? x : (
  1023. // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
  1024. ROUNDING_MODE == 3 ? -0 : 0
  1025. ));
  1026. }
  1027. }
  1028. xe = bitFloor(xe);
  1029. ye = bitFloor(ye);
  1030. xc = xc.slice();
  1031. if (a = xe - ye) {
  1032. if (xLTy = a < 0) {
  1033. a = -a;
  1034. t = xc;
  1035. } else {
  1036. ye = xe;
  1037. t = yc;
  1038. }
  1039. t.reverse();
  1040. for (b = a; b--; t.push(0)) ;
  1041. t.reverse();
  1042. } else {
  1043. j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
  1044. for (a = b = 0; b < j; b++) {
  1045. if (xc[b] != yc[b]) {
  1046. xLTy = xc[b] < yc[b];
  1047. break;
  1048. }
  1049. }
  1050. }
  1051. if (xLTy) {
  1052. t = xc;
  1053. xc = yc;
  1054. yc = t;
  1055. y.s = -y.s;
  1056. }
  1057. b = (j = yc.length) - (i = xc.length);
  1058. if (b > 0) for (; b--; xc[i++] = 0) ;
  1059. b = BASE - 1;
  1060. for (; j > a; ) {
  1061. if (xc[--j] < yc[j]) {
  1062. for (i = j; i && !xc[--i]; xc[i] = b) ;
  1063. --xc[i];
  1064. xc[j] += BASE;
  1065. }
  1066. xc[j] -= yc[j];
  1067. }
  1068. for (; xc[0] == 0; xc.splice(0, 1), --ye) ;
  1069. if (!xc[0]) {
  1070. y.s = ROUNDING_MODE == 3 ? -1 : 1;
  1071. y.c = [y.e = 0];
  1072. return y;
  1073. }
  1074. return normalise(y, xc, ye);
  1075. };
  1076. P.modulo = P.mod = function(y, b) {
  1077. var q, s, x = this;
  1078. y = new BigNumber3(y, b);
  1079. if (!x.c || !y.s || y.c && !y.c[0]) {
  1080. return new BigNumber3(NaN);
  1081. } else if (!y.c || x.c && !x.c[0]) {
  1082. return new BigNumber3(x);
  1083. }
  1084. if (MODULO_MODE == 9) {
  1085. s = y.s;
  1086. y.s = 1;
  1087. q = div(x, y, 0, 3);
  1088. y.s = s;
  1089. q.s *= s;
  1090. } else {
  1091. q = div(x, y, 0, MODULO_MODE);
  1092. }
  1093. y = x.minus(q.times(y));
  1094. if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
  1095. return y;
  1096. };
  1097. P.multipliedBy = P.times = function(y, b) {
  1098. var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber3(y, b)).c;
  1099. if (!xc || !yc || !xc[0] || !yc[0]) {
  1100. if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
  1101. y.c = y.e = y.s = null;
  1102. } else {
  1103. y.s *= x.s;
  1104. if (!xc || !yc) {
  1105. y.c = y.e = null;
  1106. } else {
  1107. y.c = [0];
  1108. y.e = 0;
  1109. }
  1110. }
  1111. return y;
  1112. }
  1113. e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
  1114. y.s *= x.s;
  1115. xcL = xc.length;
  1116. ycL = yc.length;
  1117. if (xcL < ycL) {
  1118. zc = xc;
  1119. xc = yc;
  1120. yc = zc;
  1121. i = xcL;
  1122. xcL = ycL;
  1123. ycL = i;
  1124. }
  1125. for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
  1126. base = BASE;
  1127. sqrtBase = SQRT_BASE;
  1128. for (i = ycL; --i >= 0; ) {
  1129. c = 0;
  1130. ylo = yc[i] % sqrtBase;
  1131. yhi = yc[i] / sqrtBase | 0;
  1132. for (k = xcL, j = i + k; j > i; ) {
  1133. xlo = xc[--k] % sqrtBase;
  1134. xhi = xc[k] / sqrtBase | 0;
  1135. m = yhi * xlo + xhi * ylo;
  1136. xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;
  1137. c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
  1138. zc[j--] = xlo % base;
  1139. }
  1140. zc[j] = c;
  1141. }
  1142. if (c) {
  1143. ++e;
  1144. } else {
  1145. zc.splice(0, 1);
  1146. }
  1147. return normalise(y, zc, e);
  1148. };
  1149. P.negated = function() {
  1150. var x = new BigNumber3(this);
  1151. x.s = -x.s || null;
  1152. return x;
  1153. };
  1154. P.plus = function(y, b) {
  1155. var t, x = this, a = x.s;
  1156. y = new BigNumber3(y, b);
  1157. b = y.s;
  1158. if (!a || !b) return new BigNumber3(NaN);
  1159. if (a != b) {
  1160. y.s = -b;
  1161. return x.minus(y);
  1162. }
  1163. var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
  1164. if (!xe || !ye) {
  1165. if (!xc || !yc) return new BigNumber3(a / 0);
  1166. if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber3(xc[0] ? x : a * 0);
  1167. }
  1168. xe = bitFloor(xe);
  1169. ye = bitFloor(ye);
  1170. xc = xc.slice();
  1171. if (a = xe - ye) {
  1172. if (a > 0) {
  1173. ye = xe;
  1174. t = yc;
  1175. } else {
  1176. a = -a;
  1177. t = xc;
  1178. }
  1179. t.reverse();
  1180. for (; a--; t.push(0)) ;
  1181. t.reverse();
  1182. }
  1183. a = xc.length;
  1184. b = yc.length;
  1185. if (a - b < 0) {
  1186. t = yc;
  1187. yc = xc;
  1188. xc = t;
  1189. b = a;
  1190. }
  1191. for (a = 0; b; ) {
  1192. a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
  1193. xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
  1194. }
  1195. if (a) {
  1196. xc = [a].concat(xc);
  1197. ++ye;
  1198. }
  1199. return normalise(y, xc, ye);
  1200. };
  1201. P.precision = P.sd = function(sd, rm) {
  1202. var c, n, v, x = this;
  1203. if (sd != null && sd !== !!sd) {
  1204. intCheck(sd, 1, MAX);
  1205. if (rm == null) rm = ROUNDING_MODE;
  1206. else intCheck(rm, 0, 8);
  1207. return round(new BigNumber3(x), sd, rm);
  1208. }
  1209. if (!(c = x.c)) return null;
  1210. v = c.length - 1;
  1211. n = v * LOG_BASE + 1;
  1212. if (v = c[v]) {
  1213. for (; v % 10 == 0; v /= 10, n--) ;
  1214. for (v = c[0]; v >= 10; v /= 10, n++) ;
  1215. }
  1216. if (sd && x.e + 1 > n) n = x.e + 1;
  1217. return n;
  1218. };
  1219. P.shiftedBy = function(k) {
  1220. intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
  1221. return this.times("1e" + k);
  1222. };
  1223. P.squareRoot = P.sqrt = function() {
  1224. var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber3("0.5");
  1225. if (s !== 1 || !c || !c[0]) {
  1226. return new BigNumber3(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
  1227. }
  1228. s = Math.sqrt(+valueOf(x));
  1229. if (s == 0 || s == 1 / 0) {
  1230. n = coeffToString(c);
  1231. if ((n.length + e) % 2 == 0) n += "0";
  1232. s = Math.sqrt(+n);
  1233. e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
  1234. if (s == 1 / 0) {
  1235. n = "5e" + e;
  1236. } else {
  1237. n = s.toExponential();
  1238. n = n.slice(0, n.indexOf("e") + 1) + e;
  1239. }
  1240. r = new BigNumber3(n);
  1241. } else {
  1242. r = new BigNumber3(s + "");
  1243. }
  1244. if (r.c[0]) {
  1245. e = r.e;
  1246. s = e + dp;
  1247. if (s < 3) s = 0;
  1248. for (; ; ) {
  1249. t = r;
  1250. r = half.times(t.plus(div(x, t, dp, 1)));
  1251. if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
  1252. if (r.e < e) --s;
  1253. n = n.slice(s - 3, s + 1);
  1254. if (n == "9999" || !rep && n == "4999") {
  1255. if (!rep) {
  1256. round(t, t.e + DECIMAL_PLACES + 2, 0);
  1257. if (t.times(t).eq(x)) {
  1258. r = t;
  1259. break;
  1260. }
  1261. }
  1262. dp += 4;
  1263. s += 4;
  1264. rep = 1;
  1265. } else {
  1266. if (!+n || !+n.slice(1) && n.charAt(0) == "5") {
  1267. round(r, r.e + DECIMAL_PLACES + 2, 1);
  1268. m = !r.times(r).eq(x);
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. }
  1274. }
  1275. return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
  1276. };
  1277. P.toExponential = function(dp, rm) {
  1278. if (dp != null) {
  1279. intCheck(dp, 0, MAX);
  1280. dp++;
  1281. }
  1282. return format(this, dp, rm, 1);
  1283. };
  1284. P.toFixed = function(dp, rm) {
  1285. if (dp != null) {
  1286. intCheck(dp, 0, MAX);
  1287. dp = dp + this.e + 1;
  1288. }
  1289. return format(this, dp, rm);
  1290. };
  1291. P.toFormat = function(dp, rm, format2) {
  1292. var str, x = this;
  1293. if (format2 == null) {
  1294. if (dp != null && rm && typeof rm == "object") {
  1295. format2 = rm;
  1296. rm = null;
  1297. } else if (dp && typeof dp == "object") {
  1298. format2 = dp;
  1299. dp = rm = null;
  1300. } else {
  1301. format2 = FORMAT;
  1302. }
  1303. } else if (typeof format2 != "object") {
  1304. throw Error(bignumberError + "Argument not an object: " + format2);
  1305. }
  1306. str = x.toFixed(dp, rm);
  1307. if (x.c) {
  1308. var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
  1309. if (g2) {
  1310. i = g1;
  1311. g1 = g2;
  1312. g2 = i;
  1313. len -= i;
  1314. }
  1315. if (g1 > 0 && len > 0) {
  1316. i = len % g1 || g1;
  1317. intPart = intDigits.substr(0, i);
  1318. for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
  1319. if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
  1320. if (isNeg) intPart = "-" + intPart;
  1321. }
  1322. str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace(
  1323. new RegExp("\\d{" + g2 + "}\\B", "g"),
  1324. "$&" + (format2.fractionGroupSeparator || "")
  1325. ) : fractionPart) : intPart;
  1326. }
  1327. return (format2.prefix || "") + str + (format2.suffix || "");
  1328. };
  1329. P.toFraction = function(md) {
  1330. var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
  1331. if (md != null) {
  1332. n = new BigNumber3(md);
  1333. if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
  1334. throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
  1335. }
  1336. }
  1337. if (!xc) return new BigNumber3(x);
  1338. d = new BigNumber3(ONE);
  1339. n1 = d0 = new BigNumber3(ONE);
  1340. d1 = n0 = new BigNumber3(ONE);
  1341. s = coeffToString(xc);
  1342. e = d.e = s.length - x.e - 1;
  1343. d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
  1344. md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
  1345. exp = MAX_EXP;
  1346. MAX_EXP = 1 / 0;
  1347. n = new BigNumber3(s);
  1348. n0.c[0] = 0;
  1349. for (; ; ) {
  1350. q = div(n, d, 0, 1);
  1351. d2 = d0.plus(q.times(d1));
  1352. if (d2.comparedTo(md) == 1) break;
  1353. d0 = d1;
  1354. d1 = d2;
  1355. n1 = n0.plus(q.times(d2 = n1));
  1356. n0 = d2;
  1357. d = n.minus(q.times(d2 = d));
  1358. n = d2;
  1359. }
  1360. d2 = div(md.minus(d0), d1, 0, 1);
  1361. n0 = n0.plus(d2.times(n1));
  1362. d0 = d0.plus(d2.times(d1));
  1363. n0.s = n1.s = x.s;
  1364. e = e * 2;
  1365. r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
  1366. div(n0, d0, e, ROUNDING_MODE).minus(x).abs()
  1367. ) < 1 ? [n1, d1] : [n0, d0];
  1368. MAX_EXP = exp;
  1369. return r;
  1370. };
  1371. P.toNumber = function() {
  1372. return +valueOf(this);
  1373. };
  1374. P.toPrecision = function(sd, rm) {
  1375. if (sd != null) intCheck(sd, 1, MAX);
  1376. return format(this, sd, rm, 2);
  1377. };
  1378. P.toString = function(b) {
  1379. var str, n = this, s = n.s, e = n.e;
  1380. if (e === null) {
  1381. if (s) {
  1382. str = "Infinity";
  1383. if (s < 0) str = "-" + str;
  1384. } else {
  1385. str = "NaN";
  1386. }
  1387. } else {
  1388. if (b == null) {
  1389. str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
  1390. } else if (b === 10 && alphabetHasNormalDecimalDigits) {
  1391. n = round(new BigNumber3(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
  1392. str = toFixedPoint(coeffToString(n.c), n.e, "0");
  1393. } else {
  1394. intCheck(b, 2, ALPHABET.length, "Base");
  1395. str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
  1396. }
  1397. if (s < 0 && n.c[0]) str = "-" + str;
  1398. }
  1399. return str;
  1400. };
  1401. P.valueOf = P.toJSON = function() {
  1402. return valueOf(this);
  1403. };
  1404. P._isBigNumber = true;
  1405. if (configObject != null) BigNumber3.set(configObject);
  1406. return BigNumber3;
  1407. }
  1408. function bitFloor(n) {
  1409. var i = n | 0;
  1410. return n > 0 || n === i ? i : i - 1;
  1411. }
  1412. function coeffToString(a) {
  1413. var s, z, i = 1, j = a.length, r = a[0] + "";
  1414. for (; i < j; ) {
  1415. s = a[i++] + "";
  1416. z = LOG_BASE - s.length;
  1417. for (; z--; s = "0" + s) ;
  1418. r += s;
  1419. }
  1420. for (j = r.length; r.charCodeAt(--j) === 48; ) ;
  1421. return r.slice(0, j + 1 || 1);
  1422. }
  1423. function compare(x, y) {
  1424. var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
  1425. if (!i || !j) return null;
  1426. a = xc && !xc[0];
  1427. b = yc && !yc[0];
  1428. if (a || b) return a ? b ? 0 : -j : i;
  1429. if (i != j) return i;
  1430. a = i < 0;
  1431. b = k == l;
  1432. if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
  1433. if (!b) return k > l ^ a ? 1 : -1;
  1434. j = (k = xc.length) < (l = yc.length) ? k : l;
  1435. for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
  1436. return k == l ? 0 : k > l ^ a ? 1 : -1;
  1437. }
  1438. function intCheck(n, min, max, name) {
  1439. if (n < min || n > max || n !== mathfloor(n)) {
  1440. throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
  1441. }
  1442. }
  1443. function isOdd(n) {
  1444. var k = n.c.length - 1;
  1445. return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
  1446. }
  1447. function toExponential(str, e) {
  1448. return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
  1449. }
  1450. function toFixedPoint(str, e, z) {
  1451. var len, zs;
  1452. if (e < 0) {
  1453. for (zs = z + "."; ++e; zs += z) ;
  1454. str = zs + str;
  1455. } else {
  1456. len = str.length;
  1457. if (++e > len) {
  1458. for (zs = z, e -= len; --e; zs += z) ;
  1459. str += zs;
  1460. } else if (e < len) {
  1461. str = str.slice(0, e) + "." + str.slice(e);
  1462. }
  1463. }
  1464. return str;
  1465. }
  1466. BigNumber2 = clone();
  1467. BigNumber2["default"] = BigNumber2.BigNumber = BigNumber2;
  1468. if (module.exports) {
  1469. module.exports = BigNumber2;
  1470. } else {
  1471. if (!globalObject) {
  1472. globalObject = typeof self != "undefined" && self ? self : window;
  1473. }
  1474. globalObject.BigNumber = BigNumber2;
  1475. }
  1476. })(commonjsGlobal);
  1477. })(bignumber);
  1478. var bignumberExports = bignumber.exports;
  1479. (function(module) {
  1480. var BigNumber2 = bignumberExports;
  1481. var JSON2 = module.exports;
  1482. (function() {
  1483. var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = {
  1484. // table of character substitutions
  1485. "\b": "\\b",
  1486. " ": "\\t",
  1487. "\n": "\\n",
  1488. "\f": "\\f",
  1489. "\r": "\\r",
  1490. '"': '\\"',
  1491. "\\": "\\\\"
  1492. }, rep;
  1493. function quote(string) {
  1494. escapable.lastIndex = 0;
  1495. return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
  1496. var c = meta[a];
  1497. return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
  1498. }) + '"' : '"' + string + '"';
  1499. }
  1500. function str(key, holder) {
  1501. var i, k, v, length, mind = gap, partial, value = holder[key], isBigNumber = value != null && (value instanceof BigNumber2 || BigNumber2.isBigNumber(value));
  1502. if (value && typeof value === "object" && typeof value.toJSON === "function") {
  1503. value = value.toJSON(key);
  1504. }
  1505. if (typeof rep === "function") {
  1506. value = rep.call(holder, key, value);
  1507. }
  1508. switch (typeof value) {
  1509. case "string":
  1510. if (isBigNumber) {
  1511. return value;
  1512. } else {
  1513. return quote(value);
  1514. }
  1515. case "number":
  1516. return isFinite(value) ? String(value) : "null";
  1517. case "boolean":
  1518. case "null":
  1519. case "bigint":
  1520. return String(value);
  1521. case "object":
  1522. if (!value) {
  1523. return "null";
  1524. }
  1525. gap += indent;
  1526. partial = [];
  1527. if (Object.prototype.toString.apply(value) === "[object Array]") {
  1528. length = value.length;
  1529. for (i = 0; i < length; i += 1) {
  1530. partial[i] = str(i, value) || "null";
  1531. }
  1532. v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
  1533. gap = mind;
  1534. return v;
  1535. }
  1536. if (rep && typeof rep === "object") {
  1537. length = rep.length;
  1538. for (i = 0; i < length; i += 1) {
  1539. if (typeof rep[i] === "string") {
  1540. k = rep[i];
  1541. v = str(k, value);
  1542. if (v) {
  1543. partial.push(quote(k) + (gap ? ": " : ":") + v);
  1544. }
  1545. }
  1546. }
  1547. } else {
  1548. Object.keys(value).forEach(function(k2) {
  1549. var v2 = str(k2, value);
  1550. if (v2) {
  1551. partial.push(quote(k2) + (gap ? ": " : ":") + v2);
  1552. }
  1553. });
  1554. }
  1555. v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
  1556. gap = mind;
  1557. return v;
  1558. }
  1559. }
  1560. if (typeof JSON2.stringify !== "function") {
  1561. JSON2.stringify = function(value, replacer, space) {
  1562. var i;
  1563. gap = "";
  1564. indent = "";
  1565. if (typeof space === "number") {
  1566. for (i = 0; i < space; i += 1) {
  1567. indent += " ";
  1568. }
  1569. } else if (typeof space === "string") {
  1570. indent = space;
  1571. }
  1572. rep = replacer;
  1573. if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
  1574. throw new Error("JSON.stringify");
  1575. }
  1576. return str("", { "": value });
  1577. };
  1578. }
  1579. })();
  1580. })(stringify);
  1581. var stringifyExports = stringify.exports;
  1582. var BigNumber = null;
  1583. const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
  1584. const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
  1585. var json_parse$1 = function(options) {
  1586. var _options = {
  1587. strict: false,
  1588. // not being strict means do not generate syntax errors for "duplicate key"
  1589. storeAsString: false,
  1590. // toggles whether the values should be stored as BigNumber (default) or a string
  1591. alwaysParseAsBig: false,
  1592. // toggles whether all numbers should be Big
  1593. useNativeBigInt: false,
  1594. // toggles whether to use native BigInt instead of bignumber.js
  1595. protoAction: "error",
  1596. constructorAction: "error"
  1597. };
  1598. if (options !== void 0 && options !== null) {
  1599. if (options.strict === true) {
  1600. _options.strict = true;
  1601. }
  1602. if (options.storeAsString === true) {
  1603. _options.storeAsString = true;
  1604. }
  1605. _options.alwaysParseAsBig = options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false;
  1606. _options.useNativeBigInt = options.useNativeBigInt === true ? options.useNativeBigInt : false;
  1607. if (typeof options.constructorAction !== "undefined") {
  1608. if (options.constructorAction === "error" || options.constructorAction === "ignore" || options.constructorAction === "preserve") {
  1609. _options.constructorAction = options.constructorAction;
  1610. } else {
  1611. throw new Error(
  1612. `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}`
  1613. );
  1614. }
  1615. }
  1616. if (typeof options.protoAction !== "undefined") {
  1617. if (options.protoAction === "error" || options.protoAction === "ignore" || options.protoAction === "preserve") {
  1618. _options.protoAction = options.protoAction;
  1619. } else {
  1620. throw new Error(
  1621. `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}`
  1622. );
  1623. }
  1624. }
  1625. }
  1626. var at, ch, escapee = {
  1627. '"': '"',
  1628. "\\": "\\",
  1629. "/": "/",
  1630. b: "\b",
  1631. f: "\f",
  1632. n: "\n",
  1633. r: "\r",
  1634. t: " "
  1635. }, text, error = function(m) {
  1636. throw {
  1637. name: "SyntaxError",
  1638. message: m,
  1639. at,
  1640. text
  1641. };
  1642. }, next = function(c) {
  1643. if (c && c !== ch) {
  1644. error("Expected '" + c + "' instead of '" + ch + "'");
  1645. }
  1646. ch = text.charAt(at);
  1647. at += 1;
  1648. return ch;
  1649. }, number = function() {
  1650. var number2, string2 = "";
  1651. if (ch === "-") {
  1652. string2 = "-";
  1653. next("-");
  1654. }
  1655. while (ch >= "0" && ch <= "9") {
  1656. string2 += ch;
  1657. next();
  1658. }
  1659. if (ch === ".") {
  1660. string2 += ".";
  1661. while (next() && ch >= "0" && ch <= "9") {
  1662. string2 += ch;
  1663. }
  1664. }
  1665. if (ch === "e" || ch === "E") {
  1666. string2 += ch;
  1667. next();
  1668. if (ch === "-" || ch === "+") {
  1669. string2 += ch;
  1670. next();
  1671. }
  1672. while (ch >= "0" && ch <= "9") {
  1673. string2 += ch;
  1674. next();
  1675. }
  1676. }
  1677. number2 = +string2;
  1678. if (!isFinite(number2)) {
  1679. error("Bad number");
  1680. } else {
  1681. if (BigNumber == null) BigNumber = bignumberExports;
  1682. if (string2.length > 15)
  1683. return _options.storeAsString ? string2 : _options.useNativeBigInt ? BigInt(string2) : new BigNumber(string2);
  1684. else
  1685. return !_options.alwaysParseAsBig ? number2 : _options.useNativeBigInt ? BigInt(number2) : new BigNumber(number2);
  1686. }
  1687. }, string = function() {
  1688. var hex, i, string2 = "", uffff;
  1689. if (ch === '"') {
  1690. var startAt = at;
  1691. while (next()) {
  1692. if (ch === '"') {
  1693. if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
  1694. next();
  1695. return string2;
  1696. }
  1697. if (ch === "\\") {
  1698. if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
  1699. next();
  1700. if (ch === "u") {
  1701. uffff = 0;
  1702. for (i = 0; i < 4; i += 1) {
  1703. hex = parseInt(next(), 16);
  1704. if (!isFinite(hex)) {
  1705. break;
  1706. }
  1707. uffff = uffff * 16 + hex;
  1708. }
  1709. string2 += String.fromCharCode(uffff);
  1710. } else if (typeof escapee[ch] === "string") {
  1711. string2 += escapee[ch];
  1712. } else {
  1713. break;
  1714. }
  1715. startAt = at;
  1716. }
  1717. }
  1718. }
  1719. error("Bad string");
  1720. }, white = function() {
  1721. while (ch && ch <= " ") {
  1722. next();
  1723. }
  1724. }, word = function() {
  1725. switch (ch) {
  1726. case "t":
  1727. next("t");
  1728. next("r");
  1729. next("u");
  1730. next("e");
  1731. return true;
  1732. case "f":
  1733. next("f");
  1734. next("a");
  1735. next("l");
  1736. next("s");
  1737. next("e");
  1738. return false;
  1739. case "n":
  1740. next("n");
  1741. next("u");
  1742. next("l");
  1743. next("l");
  1744. return null;
  1745. }
  1746. error("Unexpected '" + ch + "'");
  1747. }, value, array = function() {
  1748. var array2 = [];
  1749. if (ch === "[") {
  1750. next("[");
  1751. white();
  1752. if (ch === "]") {
  1753. next("]");
  1754. return array2;
  1755. }
  1756. while (ch) {
  1757. array2.push(value());
  1758. white();
  1759. if (ch === "]") {
  1760. next("]");
  1761. return array2;
  1762. }
  1763. next(",");
  1764. white();
  1765. }
  1766. }
  1767. error("Bad array");
  1768. }, object = function() {
  1769. var key, object2 = /* @__PURE__ */ Object.create(null);
  1770. if (ch === "{") {
  1771. next("{");
  1772. white();
  1773. if (ch === "}") {
  1774. next("}");
  1775. return object2;
  1776. }
  1777. while (ch) {
  1778. key = string();
  1779. white();
  1780. next(":");
  1781. if (_options.strict === true && Object.hasOwnProperty.call(object2, key)) {
  1782. error('Duplicate key "' + key + '"');
  1783. }
  1784. if (suspectProtoRx.test(key) === true) {
  1785. if (_options.protoAction === "error") {
  1786. error("Object contains forbidden prototype property");
  1787. } else if (_options.protoAction === "ignore") {
  1788. value();
  1789. } else {
  1790. object2[key] = value();
  1791. }
  1792. } else if (suspectConstructorRx.test(key) === true) {
  1793. if (_options.constructorAction === "error") {
  1794. error("Object contains forbidden constructor property");
  1795. } else if (_options.constructorAction === "ignore") {
  1796. value();
  1797. } else {
  1798. object2[key] = value();
  1799. }
  1800. } else {
  1801. object2[key] = value();
  1802. }
  1803. white();
  1804. if (ch === "}") {
  1805. next("}");
  1806. return object2;
  1807. }
  1808. next(",");
  1809. white();
  1810. }
  1811. }
  1812. error("Bad object");
  1813. };
  1814. value = function() {
  1815. white();
  1816. switch (ch) {
  1817. case "{":
  1818. return object();
  1819. case "[":
  1820. return array();
  1821. case '"':
  1822. return string();
  1823. case "-":
  1824. return number();
  1825. default:
  1826. return ch >= "0" && ch <= "9" ? number() : word();
  1827. }
  1828. };
  1829. return function(source, reviver) {
  1830. var result;
  1831. text = source + "";
  1832. at = 0;
  1833. ch = " ";
  1834. result = value();
  1835. white();
  1836. if (ch) {
  1837. error("Syntax error");
  1838. }
  1839. return typeof reviver === "function" ? function walk(holder, key) {
  1840. var v, value2 = holder[key];
  1841. if (value2 && typeof value2 === "object") {
  1842. Object.keys(value2).forEach(function(k) {
  1843. v = walk(value2, k);
  1844. if (v !== void 0) {
  1845. value2[k] = v;
  1846. } else {
  1847. delete value2[k];
  1848. }
  1849. });
  1850. }
  1851. return reviver.call(holder, key, value2);
  1852. }({ "": result }, "") : result;
  1853. };
  1854. };
  1855. var parse = json_parse$1;
  1856. var json_stringify = stringifyExports.stringify;
  1857. var json_parse = parse;
  1858. jsonBigint.exports = function(options) {
  1859. return {
  1860. parse: json_parse(options),
  1861. stringify: json_stringify
  1862. };
  1863. };
  1864. jsonBigint.exports.parse = json_parse();
  1865. jsonBigint.exports.stringify = json_stringify;
  1866. var jsonBigintExports = jsonBigint.exports;
  1867. const JSONbig = /* @__PURE__ */ getDefaultExportFromCjs(jsonBigintExports);
  1868. var _GM_getValue = exports("b", /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)());
  1869. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  1870. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  1871. var _GM_setClipboard = exports("c", /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)());
  1872. var _GM_setValue = exports("_", /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)());
  1873. var _unsafeWindow = exports("a", /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)());
  1874. const JSON = JSONbig({ useNativeBigInt: true });
  1875. NodeList.prototype.filter = Array.prototype.filter;
  1876. NodeList.prototype.some = Array.prototype.some;
  1877. NodeList.prototype.map = Array.prototype.map;
  1878. function getDefaultDisplay(ele) {
  1879. let display = ele.defaultDisplay;
  1880. const doc = ele.ownerDocument;
  1881. if (display) return display;
  1882. const temp = doc.body.appendChild(doc.createElement(ele.nodeName));
  1883. display = getComputedStyle(temp).display;
  1884. temp.parentNode.removeChild(temp);
  1885. if (display === "none") display = "block";
  1886. ele.defaultDisplay = display;
  1887. return display;
  1888. }
  1889. function getMaxKeysAndDepthObject(list) {
  1890. function getObjectDepth(obj) {
  1891. if (typeof obj !== "object" || obj === null) return 0;
  1892. let maxDepth2 = 0;
  1893. for (let key in obj) {
  1894. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1895. const depth = getObjectDepth(obj[key]);
  1896. maxDepth2 = Math.max(maxDepth2, depth);
  1897. }
  1898. }
  1899. return maxDepth2 + 1;
  1900. }
  1901. function countKeys(obj) {
  1902. if (typeof obj !== "object" || obj === null) return 0;
  1903. let keyCount = Object.keys(obj).length;
  1904. for (let key in obj) {
  1905. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1906. keyCount += countKeys(obj[key]);
  1907. }
  1908. }
  1909. return keyCount;
  1910. }
  1911. let maxKeys = 0;
  1912. let maxDepth = 0;
  1913. let result = null;
  1914. for (let item of list) {
  1915. const keys = countKeys(item);
  1916. const depth = getObjectDepth(item);
  1917. if (keys > maxKeys || keys === maxKeys && depth > maxDepth) {
  1918. maxKeys = keys;
  1919. maxDepth = depth;
  1920. result = item;
  1921. }
  1922. }
  1923. return result;
  1924. }
  1925. const Utils = exports("U", {
  1926. getMaxKeysAndDepthObject,
  1927. isImg(str) {
  1928. const regexp = /\.(ico|bmp|gif|jpg|jpeg|png|svg|webp|GIF|JPG|PNG|WEBP|SVG)([\w#!:.?+=&%@!\-\/])?/i;
  1929. return regexp.test(str);
  1930. },
  1931. isJSON(str) {
  1932. try {
  1933. JSON.parse(str);
  1934. return true;
  1935. } catch (e) {
  1936. return false;
  1937. }
  1938. },
  1939. parse(text, reviver) {
  1940. return JSON.parse(text, reviver);
  1941. },
  1942. stringify(value, replacer, space) {
  1943. return JSON.stringify(value, replacer, space);
  1944. },
  1945. isObject(o) {
  1946. return Object.is(typeof o, "object");
  1947. },
  1948. getType(o) {
  1949. return this.getPropType(o).toLowerCase();
  1950. },
  1951. getPropType(o) {
  1952. return Object.prototype.toString.call(o).match(/\s(.+)]/)[1];
  1953. },
  1954. downloadText(content, filename) {
  1955. const blob = new Blob([content], { type: "application/json;charset=utf-8" });
  1956. const url = URL.createObjectURL(blob);
  1957. this.createElement("a", { href: url, download: filename }).click();
  1958. URL.revokeObjectURL(url);
  1959. },
  1960. matchJsonp(rawText) {
  1961. const tokens = rawText.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  1962. if (tokens && tokens[1] && tokens[2]) {
  1963. return { rawText: tokens[2], jsonpFun: tokens[1] };
  1964. }
  1965. return { rawText, jsonpFun: null };
  1966. },
  1967. debounce(fn, delay = 300) {
  1968. let timer;
  1969. return function() {
  1970. if (timer) clearTimeout(timer);
  1971. timer = setTimeout(() => fn.apply(this, arguments), delay);
  1972. };
  1973. },
  1974. setClipboard(text) {
  1975. if (_GM_setClipboard) {
  1976. _GM_setClipboard(text);
  1977. } else if (navigator.clipboard) {
  1978. navigator.clipboard.writeText(text);
  1979. } else {
  1980. console.error("复制内容失败");
  1981. }
  1982. },
  1983. addEvent(eventType, selector, callback) {
  1984. const types = eventType.split(" ");
  1985. types.forEach((type) => {
  1986. function handler(event) {
  1987. let target = event.target;
  1988. if (!target.matches) return;
  1989. while (!target.matches(selector)) {
  1990. target = target.parentNode;
  1991. if (!target || !target.matches) return;
  1992. }
  1993. Object.defineProperty(event, "currentTarget", {
  1994. configurable: true,
  1995. get() {
  1996. return target;
  1997. }
  1998. });
  1999. const returnValue = callback.call(target, event);
  2000. if (returnValue === false) {
  2001. event.preventDefault();
  2002. event.stopPropagation();
  2003. }
  2004. event.stopImmediatePropagation();
  2005. }
  2006. document.addEventListener(type, handler, true);
  2007. });
  2008. },
  2009. isVisible(ele) {
  2010. return !!(ele.offsetWidth || ele.offsetHeight || ele.getClientRects().length);
  2011. },
  2012. createElement(name, attrs) {
  2013. const element = document.createElement(name);
  2014. if (attrs) this.attr(element, attrs);
  2015. return element;
  2016. },
  2017. attr(ele, attrs, value) {
  2018. if (!ele) return;
  2019. if (typeof attrs === "object") {
  2020. for (const name in attrs) ele.setAttribute(name, attrs[name]);
  2021. return;
  2022. }
  2023. if (value === void 0) return ele.getAttribute(attrs);
  2024. if (value === false || value === null) return ele.removeAttribute(attrs);
  2025. ele.setAttribute(attrs, value);
  2026. },
  2027. query(selector, context) {
  2028. const ctx = context || document;
  2029. if (selector instanceof HTMLElement) return selector;
  2030. return ctx.querySelector(selector);
  2031. },
  2032. queryAll(selector, context) {
  2033. const ctx = context || document;
  2034. if (selector instanceof HTMLElement) return new NodeList(selector);
  2035. if (selector instanceof NodeList) return selector;
  2036. return ctx.querySelectorAll(selector);
  2037. },
  2038. closest(element, selector) {
  2039. while (element) {
  2040. if (element.matches(selector)) return element;
  2041. element = element.parentElement;
  2042. }
  2043. return null;
  2044. },
  2045. addClass(ele, className) {
  2046. if (!ele) return;
  2047. if (ele instanceof HTMLElement) return ele.classList.add(className);
  2048. if (ele instanceof NodeList || ele instanceof Array) {
  2049. ele.forEach((el) => this.addClass(el, className));
  2050. }
  2051. },
  2052. removeClass(ele, className) {
  2053. if (!ele) return;
  2054. if (ele instanceof HTMLElement) {
  2055. const classList = ele.classList;
  2056. if (className === void 0) {
  2057. while (classList.length > 0) {
  2058. classList.remove(classList.item(0));
  2059. }
  2060. return;
  2061. }
  2062. return classList.remove(className);
  2063. }
  2064. if (ele instanceof NodeList || ele instanceof Array) {
  2065. ele.forEach((el) => this.removeClass(el, className));
  2066. }
  2067. },
  2068. toggleClass(ele, className) {
  2069. if (!ele) return;
  2070. this.hasClass(ele, className) ? this.removeClass(ele, className) : this.addClass(ele, className);
  2071. },
  2072. hasClass(ele, className) {
  2073. if (!ele) return false;
  2074. if (ele instanceof HTMLElement) return ele.classList.contains(className);
  2075. if (ele instanceof NodeList) {
  2076. return ele.some((el) => this.hasClass(el, className));
  2077. }
  2078. },
  2079. show(ele) {
  2080. if (!ele) return;
  2081. const style = ele.style;
  2082. const display = getComputedStyle(ele).display;
  2083. if (style.display === "none") style.display = "";
  2084. if (style.display === "" && display === "none") {
  2085. style.display = getDefaultDisplay(ele);
  2086. }
  2087. },
  2088. hide(ele) {
  2089. if (ele.defaultDisplay === void 0) {
  2090. const computedDisplay = getComputedStyle(ele).display;
  2091. if (!Object.is(computedDisplay, "none")) {
  2092. ele.defaultDisplay = computedDisplay;
  2093. }
  2094. }
  2095. ele.style.display = "none";
  2096. }
  2097. });
  2098. const URL$1 = exports("e", {
  2099. JSON_CRACK_WIDGET: "https://jsoncrack.feny.ink/widget",
  2100. EXAMPLE_JSON: "https://fetch-api.feny.ink/example.json",
  2101. ONLINE_REQUEST: "https://fetch-api.feny.ink/httpRequest",
  2102. LAYUI_JS: "https://unpkg.com/layui@2.7.6/dist/layui.js"
  2103. });
  2104. const layout = `
  2105. <template data-for="viewFormater">
  2106. <div class="toolbar-item btn" id="saveJson">保存</div>
  2107. <div class="toolbar-item btn" id="copyJson">复制</div>
  2108. <div class="toolbar-item btn" id="sorted">排序</div>
  2109. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2110. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2111. <div class="searchbox">
  2112. <input class="filter" type="text" placeholder="JSON 过滤" />
  2113. <button class="clear" hidden></button>
  2114. </div>
  2115. </template>
  2116. <template data-for="viewMind">
  2117. <div class="toolbar-item btn" id="saveJson">保存</div>
  2118. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2119. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2120. <div class="toolbar-item btn" id="jsoncrack">JSON Crack</div>
  2121. </template>
  2122. <template data-for="viewRawText">
  2123. <div class="toolbar-item btn" id="saveJson">保存</div>
  2124. <div class="toolbar-item btn" id="copyJson">复制</div>
  2125. <div class="toolbar-item btn" id="beautify">美化输出</div>
  2126. </template>
  2127. <div class="json-viewer-layout">
  2128. <div class="panel">
  2129. <div class="tabs">
  2130. <div class="tabs-item btn active" id="viewFormater">JSON 格式化</div>
  2131. <div class="tabs-item btn" id="viewMind">JSON 脑图</div>
  2132. <div class="tabs-item btn" id="viewRawText">原始数据</div>
  2133. </div>
  2134. <div class="toolbar"></div>
  2135. <div class="rightbox">
  2136. <div class="style">
  2137. <span>风格</span>
  2138. <template data-type="style">
  2139. <ul>
  2140. <li data-type="style" data-value="default">默认</li>
  2141. <li data-type="style" data-value="table">表格</li>
  2142. </ul>
  2143. </template>
  2144. </div>
  2145. <div class="theme">
  2146. <span>主题</span>
  2147. <template data-type="theme">
  2148. <ul>
  2149. <li data-type="theme" data-value="default">默认</li>
  2150. <li data-type="theme" data-value="light">浅色</li>
  2151. <li data-type="theme" data-value="dark">暗黑</li>
  2152. <li data-type="theme" data-value="dark-plus">暗黑+</li>
  2153. </ul>
  2154. </template>
  2155. </div>
  2156. <div class="tools">
  2157. <span>工具</span>
  2158. <template data-type="tools">
  2159. <ul>
  2160. <li data-type="tools" data-value="inputJson">JSON 输入</li>
  2161. <li data-type="tools" data-value="fetchJson">HTTP 请求</li>
  2162. </ul>
  2163. </template>
  2164. </div>
  2165. </div>
  2166. </div>
  2167. <div class="container">
  2168. <div class="active" data-for="viewFormater" id="formatBox"></div>
  2169. <div data-for="viewMind" id="mindBox"></div>
  2170. <div data-for="viewRawText" id="rawTextBox">
  2171. <pre></pre>
  2172. </div>
  2173. </div>
  2174. </div>
  2175. `;
  2176. const { EXAMPLE_JSON, LAYUI_JS } = URL$1;
  2177. (function() {
  2178. const openInTab = () => _GM_openInTab(EXAMPLE_JSON);
  2179. _GM_registerMenuCommand("测试JSON( Alt + j )", openInTab);
  2180. window.addEventListener("keydown", function(event) {
  2181. const { key, altKey } = event;
  2182. if (altKey && key.toLowerCase() === "j") openInTab();
  2183. });
  2184. const innerText = document.body.innerText;
  2185. const { rawText, jsonpFun } = Utils.matchJsonp(innerText);
  2186. if (!Utils.isJSON(rawText)) return __vitePreload(() => module.import('./index-CW-bKdx7-B-0jv6sj.js'), void 0 );
  2187. _unsafeWindow.RAW_TEXT = rawText;
  2188. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  2189. _unsafeWindow.GLOBAL_JSON = Utils.parse(_unsafeWindow.RAW_TEXT);
  2190. Utils.hide(Utils.query("pre"));
  2191. Utils.addClass(Utils.query("html"), "monkey-script");
  2192. window.postMessage({ addStyle: true });
  2193. const meta = Utils.createElement("meta", {
  2194. name: "viewport",
  2195. content: "width=device-width, initial-scale=1.0"
  2196. });
  2197. document.head.appendChild(meta);
  2198. const script = Utils.createElement("script", { src: LAYUI_JS, type: "text/javascript" });
  2199. document.head.appendChild(script);
  2200. setTimeout(() => {
  2201. document.body.insertAdjacentHTML("afterbegin", layout);
  2202. const temp = Utils.query('template[data-for="viewFormater"]');
  2203. Utils.query(".toolbar").innerHTML = temp.innerHTML;
  2204. __vitePreload(() => module.import('./index-CEkM4Nbd-BIf2ryV4.js'), void 0 ).then(() => {
  2205. __vitePreload(() => module.import('./index-D5Od81As-JI_oA2jj.js'), void 0 );
  2206. __vitePreload(() => module.import('./index-CwrJ66RK-Dv5nmPjd.js'), void 0 );
  2207. });
  2208. });
  2209. })();
  2210.  
  2211. })
  2212. };
  2213. }));
  2214.  
  2215. System.register("./index-CW-bKdx7-B-0jv6sj.js", ['highlight.js', 'beautifier', './__monkey.entry-D38Pz7Rd.js'], (function (exports, module) {
  2216. 'use strict';
  2217. var hljs, css_beautify, js_beautify, Utils;
  2218. return {
  2219. setters: [module => {
  2220. hljs = module.default;
  2221. }, module => {
  2222. css_beautify = module.css_beautify;
  2223. js_beautify = module.js_beautify;
  2224. }, module => {
  2225. Utils = module.U;
  2226. }],
  2227. execute: (function () {
  2228.  
  2229. const layout = `
  2230. <div class="beautify_checkbox">
  2231. <input type="checkbox" id="beautify" />
  2232. <label for="beautify">美化输出</label>
  2233. </div>
  2234. `;
  2235. (function() {
  2236. const docType = ["application/x-javascript", "application/javascript", "text/javascript", "text/css"];
  2237. const contentType = document.contentType;
  2238. if (!docType.includes(contentType)) return;
  2239. const preElement = Utils.query("pre");
  2240. if (!preElement) return;
  2241. window.postMessage({ addStyle: true });
  2242. Utils.addClass(Utils.query("html"), "monkey-js-css-beautify");
  2243. setTimeout(() => {
  2244. const rawText = preElement.innerText;
  2245. document.body.insertAdjacentHTML("afterbegin", layout);
  2246. const checkbox = Utils.query(".beautify_checkbox input");
  2247. checkbox.addEventListener("click", function() {
  2248. if (this.checked) {
  2249. beautifyCode(contentType, preElement, rawText);
  2250. } else {
  2251. preElement.innerText = rawText;
  2252. }
  2253. });
  2254. });
  2255. })();
  2256. function beautifyCode(contentType, element, rawText) {
  2257. const language = contentType.substring(contentType.indexOf("/") + 1);
  2258. if (!["css", "javascript", "x-javascript"].includes(language)) {
  2259. return;
  2260. }
  2261. let beautifyCode2;
  2262. if ("css" === language) {
  2263. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  2264. beautifyCode2 = cssBeautify(rawText);
  2265. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2266. language
  2267. }).value;
  2268. } else {
  2269. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  2270. beautifyCode2 = jsBeautify(rawText);
  2271. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2272. language: "javascript"
  2273. }).value;
  2274. }
  2275. element.innerHTML = `<code>${beautifyCode2}</code>`;
  2276. }
  2277.  
  2278. })
  2279. };
  2280. }));
  2281.  
  2282. System.register("./index-CEkM4Nbd-BIf2ryV4.js", ['./__monkey.entry-D38Pz7Rd.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js'], (function (exports, module) {
  2283. 'use strict';
  2284. var _GM_setValue, _unsafeWindow, Utils, _GM_getValue, _GM_setClipboard, tippy;
  2285. return {
  2286. setters: [module => {
  2287. _GM_setValue = module._;
  2288. _unsafeWindow = module.a;
  2289. Utils = module.U;
  2290. _GM_getValue = module.b;
  2291. _GM_setClipboard = module.c;
  2292. }, module => {
  2293. tippy = module.t;
  2294. }],
  2295. execute: (function () {
  2296.  
  2297. var __defProp = Object.defineProperty;
  2298. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  2299. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  2300. const SORTED = { ASC: "ASC", DESC: "DESC" };
  2301. const STYLE = { TABLE: "table", VIEWER: "viewer" };
  2302. class JsonFormat {
  2303. constructor(options, tag, clazz) {
  2304. __publicField(this, "Root", "Root");
  2305. __publicField(this, "DEFAULTS", {
  2306. sort: null,
  2307. json: null,
  2308. style: null,
  2309. container: null,
  2310. theme: "default"
  2311. });
  2312. this.options = Object.assign(this.DEFAULTS, options);
  2313. if (!options.container) throw new Error("Container is required");
  2314. if (!options.json) throw new Error("json is required");
  2315. this.render(tag, clazz);
  2316. this.setTheme(this.options.theme);
  2317. this.bindEvent();
  2318. }
  2319. render(tag, clazz) {
  2320. this.$container = Utils.query(this.options.container);
  2321. this.$container.innerHTML = "";
  2322. const box = Utils.createElement(tag, { class: clazz });
  2323. this.createNode(box, this.options.json, this.Root, this.Root, 1);
  2324. this.$container.appendChild(box);
  2325. }
  2326. setTheme(theme) {
  2327. const classList = document.body.classList;
  2328. classList.forEach((clas) => {
  2329. if (clas.includes("theme")) classList.remove(clas);
  2330. });
  2331. classList.add(`${theme}-theme`);
  2332. }
  2333. keySort(json) {
  2334. const { sort } = this.options;
  2335. if (sort === null) return json;
  2336. if (Array.isArray(json)) return json;
  2337. const entries = Object.entries(json);
  2338. const asc = ([prev], [next]) => prev.localeCompare(next);
  2339. const desc = ([prev], [next]) => next.localeCompare(prev);
  2340. const result = Object.is(SORTED.ASC, sort) ? entries.sort(asc) : entries.sort(desc);
  2341. return Object.fromEntries(result);
  2342. }
  2343. sorted() {
  2344. if (this.options.sort === null) {
  2345. this.options.sort = SORTED.ASC;
  2346. this.reload();
  2347. return "升序";
  2348. }
  2349. if (SORTED.ASC === this.options.sort) {
  2350. this.options.sort = SORTED.DESC;
  2351. this.reload();
  2352. return "降序";
  2353. }
  2354. if (SORTED.DESC === this.options.sort) {
  2355. this.options.sort = null;
  2356. this.reload();
  2357. return "排序";
  2358. }
  2359. }
  2360. reload() {
  2361. const box = this.$container.firstChild;
  2362. box.innerHTML = "";
  2363. this.createNode(box, this.options.json, this.Root, this.Root, 1);
  2364. this.$container.appendChild(box);
  2365. this.bindEvent();
  2366. }
  2367. creatValueNode(type, value) {
  2368. const node = Utils.createElement("span", { class: `json-${type}` });
  2369. node.textContent = `${value}`;
  2370. if (Object.is("string", type)) {
  2371. value = this.escape(value);
  2372. node.textContent = `"${value}"`;
  2373. }
  2374. if (this.isUrl(value)) {
  2375. node.textContent = "";
  2376. const a = Utils.createElement("a", { target: "_blank", href: value });
  2377. a.textContent = `"${value}"`;
  2378. node.appendChild(a);
  2379. }
  2380. if (this.isColor(value)) {
  2381. const span = Utils.createElement("span", {
  2382. class: "json-color",
  2383. style: `background-color: ${value}`
  2384. });
  2385. node.prepend(span);
  2386. }
  2387. return node;
  2388. }
  2389. creatOtherNodes(node, json) {
  2390. if (!this.canIterate(json)) return;
  2391. node.prepend(this.creatArrowElement());
  2392. node.appendChild(this.creatCopyElement(json));
  2393. node.appendChild(this.creatPlaceholder(json));
  2394. }
  2395. creatArrowElement() {
  2396. return Utils.createElement("span", { class: "json-arrow" });
  2397. }
  2398. creatCopyElement(json) {
  2399. const copy = Utils.createElement("span", { title: "复制", class: "json-copy" });
  2400. copy.json = json;
  2401. return copy;
  2402. }
  2403. creatPlaceholder(json) {
  2404. const placeholder = Utils.createElement("span", { class: "json-placeholder" });
  2405. const type = Utils.getType(json);
  2406. const length = Object.keys(json).length;
  2407. const span = Utils.createElement("span");
  2408. span.textContent = `${length}${length > 1 ? " items" : " item"}`;
  2409. if (Object.is(type, "object")) {
  2410. span.textContent = `${length}${length > 1 ? " keys" : " key"}`;
  2411. }
  2412. placeholder.appendChild(span);
  2413. if (STYLE.TABLE === this.options.style) {
  2414. let text = document.createTextNode(Object.is(type, "object") ? "{" : "[");
  2415. placeholder.prepend(text);
  2416. text = document.createTextNode(Object.is(type, "object") ? "}" : "]");
  2417. placeholder.appendChild(text);
  2418. }
  2419. return placeholder;
  2420. }
  2421. createBracket(type) {
  2422. const node = Utils.createElement("span", { class: `json-${type}-bracket` });
  2423. node.textContent = Object.is(type, "array") ? "[]" : "{}";
  2424. return node;
  2425. }
  2426. bindEvent() {
  2427. this.addEvent("click", ".json-copy", (e) => {
  2428. const className = "success";
  2429. const target = e.currentTarget;
  2430. if (!target.json || Utils.hasClass(target, className)) return;
  2431. Utils.addClass(target, className);
  2432. Utils.setClipboard(Utils.stringify(target.json, null, 2));
  2433. setTimeout(() => Utils.removeClass(target, className), 1500);
  2434. });
  2435. this.addEvent("click", ".json-placeholder", (e) => {
  2436. const node = Utils.closest(e.currentTarget, ".json-item");
  2437. this.expand(node);
  2438. });
  2439. this.addEvent("click", ".json-arrow", (e) => {
  2440. const node = Utils.closest(e.currentTarget, ".json-item");
  2441. const expanded = Utils.hasClass(node, "expanded");
  2442. expanded ? this.collapse(node) : this.expand(node);
  2443. });
  2444. }
  2445. expandAll() {
  2446. this.nodes().forEach((node) => this.expand(node));
  2447. }
  2448. collapseAll() {
  2449. this.nodes().forEach((node) => this.collapse(node));
  2450. }
  2451. expand(node) {
  2452. this.toggleDescs(node, false);
  2453. Utils.hide(this.getPlaceNode(node));
  2454. Utils.addClass(node, "expanded");
  2455. Utils.removeClass(node, "collapsed");
  2456. }
  2457. collapse(node) {
  2458. this.toggleDescs(node, true);
  2459. Utils.show(this.getPlaceNode(node));
  2460. Utils.addClass(node, "collapsed");
  2461. Utils.removeClass(node, "expanded");
  2462. }
  2463. toggleDescs(node, hidden) {
  2464. const target = Utils.query(`#${node.dataset.nodeId}`);
  2465. hidden ? Utils.addClass(target, "hidden") : Utils.removeClass(target, "hidden");
  2466. }
  2467. getPlaceNode(node) {
  2468. return Utils.query(`*[data-node-id="${node.dataset.nodeId}"] .json-placeholder`, node);
  2469. }
  2470. findChildren(node) {
  2471. return Utils.queryAll(`*[data-node-pid="${node.dataset.nodeId}"]`, this.$container);
  2472. }
  2473. findByID(id) {
  2474. return Utils.query(`*[data-node-id="${id}"]`, this.$container);
  2475. }
  2476. expandByID(id) {
  2477. this.expand(this.findByID(id));
  2478. }
  2479. collapseByID(id) {
  2480. this.collapse(this.findByID(id));
  2481. }
  2482. nodes() {
  2483. return Utils.queryAll(".collapsible", this.$container);
  2484. }
  2485. addEvent(type, selector, fn) {
  2486. Utils.queryAll(selector).forEach((el) => el.addEventListener(type, fn));
  2487. }
  2488. JSONPath(path, key) {
  2489. if (this.isNumber(key)) return `${path}[${key}]`;
  2490. if (key.includes(".")) return `${path}["${key}"]`;
  2491. return `${path}.${key}`;
  2492. }
  2493. isNumber(str) {
  2494. return /^\d+$/.test(str);
  2495. }
  2496. isIterate(data) {
  2497. const type = Utils.getType(data);
  2498. return ["array", "object"].includes(type);
  2499. }
  2500. canIterate(data) {
  2501. if (!this.isIterate(data)) return false;
  2502. return Object.keys(data).length > 0;
  2503. }
  2504. isUrl(str) {
  2505. const regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  2506. return regexp.test(str);
  2507. }
  2508. escape(str) {
  2509. return str.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  2510. }
  2511. isColor(str) {
  2512. const hexCodeRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
  2513. const rgbRegex = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/;
  2514. const rgbaRegex = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0\.\d+)\s*\)$/;
  2515. return hexCodeRegex.test(str) || rgbRegex.test(str) || rgbaRegex.test(str);
  2516. }
  2517. random() {
  2518. let randomStr = "";
  2519. const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  2520. for (let i = 0; i < 10; i++) {
  2521. const randomIndex = Math.floor(Math.random() * characters.length);
  2522. randomStr += characters.charAt(randomIndex);
  2523. }
  2524. return randomStr;
  2525. }
  2526. }
  2527. __publicField(JsonFormat, "STYLE", STYLE);
  2528. class JsonViewer extends JsonFormat {
  2529. constructor(options) {
  2530. options.style = JsonFormat.STYLE.VIEWER;
  2531. super(options, "div", "json-viewer");
  2532. }
  2533. createNode(box, json, JSONPath, pid) {
  2534. const type = Utils.getType(json);
  2535. const isIterate = this.isIterate(json);
  2536. const canIterate = this.canIterate(json);
  2537. if (canIterate) {
  2538. if (this.Root !== pid) box.prepend(this.creatArrowElement());
  2539. const fragment = this.depthNode(json, JSONPath, pid);
  2540. box.appendChild(fragment);
  2541. } else if (isIterate) {
  2542. const bracket = this.createBracket(type);
  2543. box.appendChild(bracket);
  2544. } else {
  2545. const valueNode = this.creatValueNode(type, json);
  2546. box.appendChild(valueNode);
  2547. }
  2548. }
  2549. depthNode(json, path, pid) {
  2550. json = this.keySort(json);
  2551. const fragment = document.createDocumentFragment();
  2552. fragment.appendChild(this.startBracket(Utils.getType(json)));
  2553. if (this.Root !== pid) {
  2554. fragment.appendChild(this.creatCopyElement(json));
  2555. fragment.appendChild(this.creatPlaceholder(json));
  2556. }
  2557. const ul = Utils.createElement("ul", { id: pid });
  2558. fragment.appendChild(ul);
  2559. let length = Object.keys(json).length;
  2560. for (var key in json) {
  2561. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2562. const value = json[key];
  2563. const id = this.random();
  2564. const needComma = --length > 0;
  2565. const JSONPath = this.JSONPath(path, key);
  2566. const canIterate = this.canIterate(value);
  2567. const node = Utils.createElement("li", {
  2568. path: JSONPath,
  2569. "data-node-id": id,
  2570. "data-node-pid": pid,
  2571. style: `padding-left: 20px`,
  2572. "data-type": Utils.getType(value),
  2573. class: `json-item${canIterate ? " collapsible expanded" : ""}`
  2574. });
  2575. this.createKeyNode(node, key);
  2576. this.createNode(node, value, JSONPath, id);
  2577. if (needComma) {
  2578. const comma = Utils.createElement("span", { class: "json-comma" });
  2579. comma.textContent = ",";
  2580. node.appendChild(comma);
  2581. }
  2582. ul.appendChild(node);
  2583. fragment.appendChild(ul);
  2584. }
  2585. }
  2586. fragment.appendChild(this.endBracket(Utils.getType(json)));
  2587. return fragment;
  2588. }
  2589. startBracket(type) {
  2590. const span = Utils.createElement("span", { class: `json-${type}-bracket` });
  2591. span.textContent = Object.is(type, "array") ? "[" : "{";
  2592. return span;
  2593. }
  2594. endBracket(type) {
  2595. const span = Utils.createElement("span", { class: `json-${type}-bracket` });
  2596. span.textContent = Object.is(type, "array") ? "]" : "}";
  2597. return span;
  2598. }
  2599. createKeyNode(node, key) {
  2600. if (this.isNumber(key)) return;
  2601. const span = Utils.createElement("span", { class: "json-key" });
  2602. span.textContent = `"${key}"`;
  2603. node.appendChild(span);
  2604. const colon = Utils.createElement("span", { class: "json-colon" });
  2605. colon.textContent = ":";
  2606. node.appendChild(colon);
  2607. }
  2608. creatOther(node, json) {
  2609. if (!node.dataset.nodeId) return;
  2610. this.creatOtherNodes(node, json);
  2611. }
  2612. }
  2613. class JsonToTable extends JsonFormat {
  2614. constructor(options) {
  2615. options.style = JsonFormat.STYLE.TABLE;
  2616. super(options, "table", "json-tree-table");
  2617. }
  2618. createNode(table, json, path, pid, depth) {
  2619. json = this.keySort(json);
  2620. const fragment = document.createDocumentFragment();
  2621. const customElement = Utils.createElement("wrapper", { id: pid });
  2622. for (const key in json) {
  2623. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2624. let value = json[key];
  2625. const type = Utils.getType(value);
  2626. const JSONPath = this.JSONPath(path, key);
  2627. const args = { key, value, type, depth, JSONPath, pid };
  2628. const item = this.createItem(args);
  2629. fragment.appendChild(item);
  2630. if (this.canIterate(value)) {
  2631. const nodeId = item.dataset.nodeId;
  2632. this.createNode(fragment, value, JSONPath, nodeId, depth + 1);
  2633. }
  2634. }
  2635. }
  2636. customElement.appendChild(fragment);
  2637. table.appendChild(customElement);
  2638. }
  2639. createItem(args) {
  2640. const { key, value, type, depth, JSONPath, pid } = args;
  2641. const id = this.random();
  2642. const isIterate = this.isIterate(value);
  2643. const canIterate = this.canIterate(value);
  2644. const node = Utils.createElement("tr", {
  2645. path: JSONPath,
  2646. "data-type": type,
  2647. "data-node-id": id,
  2648. "data-node-pid": pid,
  2649. class: `json-item${canIterate ? " collapsible expanded" : ""}`
  2650. });
  2651. const keyNode = this.createKeyNode(key, value, depth);
  2652. node.appendChild(keyNode);
  2653. const td = Utils.createElement("td");
  2654. if (!isIterate) {
  2655. td.appendChild(this.creatValueNode(type, value));
  2656. node.appendChild(td);
  2657. }
  2658. if (isIterate && !canIterate) {
  2659. td.appendChild(this.createBracket(type));
  2660. node.appendChild(td);
  2661. }
  2662. return node;
  2663. }
  2664. createKeyNode(key, value, depth) {
  2665. const node = Utils.createElement("td", {
  2666. colspan: this.canIterate(value) ? 2 : 0,
  2667. style: `padding-left: ${depth * 20}px`
  2668. });
  2669. const span = Utils.createElement("span", { class: "json-key" });
  2670. span.textContent = `${key}`;
  2671. node.appendChild(span);
  2672. const colon = Utils.createElement("span", { class: "json-colon" });
  2673. colon.textContent = ":";
  2674. node.appendChild(colon);
  2675. this.creatOtherNodes(node, value);
  2676. return node;
  2677. }
  2678. bindEvent() {
  2679. super.bindEvent();
  2680. Utils.addEvent("mousedown", "table tr", function(event) {
  2681. const { tagName, className } = event.target;
  2682. if (event.ctrlKey || tagName === "A" || tagName === "SPAN" && className !== "json-key") {
  2683. return;
  2684. }
  2685. const filter = Utils.queryAll(".selected").filter((ele) => ele !== this);
  2686. Utils.removeClass(filter, "selected");
  2687. Utils.toggleClass(this, "selected");
  2688. });
  2689. }
  2690. }
  2691. class FormaterFactory {
  2692. static getInstance(options) {
  2693. return Object.is(JsonToTable.STYLE.TABLE, options.style) ? new JsonToTable(options) : new JsonViewer(options);
  2694. }
  2695. }
  2696. const evnet = {
  2697. urlHover() {
  2698. Utils.addEvent("mouseenter", "a[href]", function() {
  2699. const href = Utils.attr(this, "href");
  2700. if (!Utils.isImg(href)) return;
  2701. tippy(this, {
  2702. duration: 800,
  2703. allowHTML: true,
  2704. theme: "imagebox",
  2705. content: `<img style="max-width: 500px;" src="${href}" />`
  2706. }).show();
  2707. });
  2708. return this;
  2709. },
  2710. eventPath() {
  2711. Utils.addEvent("click mouseenter", ".json-key", (event) => {
  2712. const target = event.target;
  2713. const path = Utils.closest(target, ".json-item").getAttribute("path");
  2714. if (Object.is(event.type, "click") && event.ctrlKey) {
  2715. return _GM_setClipboard(path) & layer.msg("复制成功", { time: 1500 });
  2716. }
  2717. tippy(target, {
  2718. duration: 800,
  2719. theme: "layer",
  2720. allowHTML: true,
  2721. content: `<i>ctrlclick 复制</i><br/><b>路径:</b>${path}`
  2722. }).show();
  2723. });
  2724. return this;
  2725. },
  2726. init() {
  2727. this.urlHover().eventPath();
  2728. }
  2729. };
  2730. const format = exports("default", {
  2731. changeStyle(style) {
  2732. _GM_setValue("style", style) & this.setStyle();
  2733. return this;
  2734. },
  2735. setStyle() {
  2736. _unsafeWindow.FILTER_VALUE = "";
  2737. Utils.query(".filter").value = "";
  2738. Utils.attr(Utils.query(".clear"), "hidden", true);
  2739. this.render(_unsafeWindow.GLOBAL_JSON);
  2740. return this;
  2741. },
  2742. render(json) {
  2743. const container = Utils.query("#formatBox");
  2744. const style = _GM_getValue("style") || "default";
  2745. const theme = _GM_getValue("theme") || "default";
  2746. const options = { json, style, theme, container };
  2747. _unsafeWindow.JSON_FORMATER = FormaterFactory.getInstance(options);
  2748. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2749. const start = Utils.createElement("div", { class: "jsonp" });
  2750. start.textContent = `${_unsafeWindow.GLOBAL_JSONP_FUN}(`;
  2751. container.prepend(start);
  2752. const end = start.cloneNode(true);
  2753. end.textContent = ")";
  2754. container.append(end);
  2755. }
  2756. return this;
  2757. },
  2758. filter(json, text) {
  2759. text = text.toLowerCase();
  2760. function match(json2, text2) {
  2761. const newJson = Array.isArray(json2) ? new Array() : new Object();
  2762. for (const key in json2) {
  2763. if (Object.prototype.hasOwnProperty.call(json2, key)) {
  2764. const value = json2[key];
  2765. const type = Utils.getType(value);
  2766. const _key = key.toLowerCase();
  2767. const _value = Utils.stringify(value).toLowerCase();
  2768. if (!_key.includes(text2) && !_value.includes(text2)) continue;
  2769. if (["array", "object"].includes(type)) {
  2770. const result = match(value, text2);
  2771. const _result = Utils.stringify(result).toLowerCase();
  2772. if (_key.includes(text2) || _result.includes(text2)) {
  2773. newJson[key] = result;
  2774. }
  2775. } else {
  2776. newJson[key] = value;
  2777. }
  2778. }
  2779. }
  2780. return newJson;
  2781. }
  2782. return match(json, text);
  2783. },
  2784. input() {
  2785. const debounceInput = Utils.debounce((event) => {
  2786. const value = event.target.value;
  2787. _unsafeWindow.FILTER_VALUE = value;
  2788. const clear = Utils.query(".clear");
  2789. Utils.attr(clear, "hidden", !value);
  2790. const newJson = this.filter(_unsafeWindow.GLOBAL_JSON, value);
  2791. this.render(newJson);
  2792. }, 400);
  2793. Utils.addEvent("input", ".filter", debounceInput);
  2794. return this;
  2795. },
  2796. clear() {
  2797. Utils.addEvent("click", ".clear", () => this.setStyle());
  2798. return this;
  2799. },
  2800. init() {
  2801. this.setStyle().input().clear();
  2802. evnet.init();
  2803. }
  2804. });
  2805. window.addEventListener("message", function(event) {
  2806. const { data } = event;
  2807. if (!data) return;
  2808. if (data.reload) return format.setStyle();
  2809. const { type, value } = data;
  2810. if (Object.is(type, "style")) format.changeStyle(value);
  2811. });
  2812. format.init();
  2813.  
  2814. })
  2815. };
  2816. }));
  2817.  
  2818. System.register("./index-D5Od81As-JI_oA2jj.js", ['./tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind', './__monkey.entry-D38Pz7Rd.js', 'dom-to-image'], (function (exports, module) {
  2819. 'use strict';
  2820. var tippy, require$$0, commonjsGlobal, Utils, _unsafeWindow, _GM_setClipboard, _GM_getValue, URL$1, _GM_setValue, require$$1;
  2821. return {
  2822. setters: [module => {
  2823. tippy = module.t;
  2824. }, module => {
  2825. require$$0 = module.default;
  2826. }, module => {
  2827. commonjsGlobal = module.d;
  2828. Utils = module.U;
  2829. _unsafeWindow = module.a;
  2830. _GM_setClipboard = module.c;
  2831. _GM_getValue = module.b;
  2832. URL$1 = module.e;
  2833. _GM_setValue = module._;
  2834. }, module => {
  2835. require$$1 = module.default;
  2836. }],
  2837. execute: (function () {
  2838.  
  2839. /**
  2840. * @license BSD-3-Clause
  2841. * @copyright 2014-2023 hizzgdev@163.com
  2842. *
  2843. * Project Home:
  2844. * https://github.com/hizzgdev/jsmind/
  2845. */
  2846. (function(module, exports) {
  2847. !function(e, t) {
  2848. t(require$$0, require$$1);
  2849. }(commonjsGlobal, function(e, t) {
  2850. function i(e2) {
  2851. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  2852. }
  2853. var n = i(e), o = i(t);
  2854. if (!n.default) throw new Error("jsMind is not defined");
  2855. if (!o.default) throw new Error("dom-to-image is required");
  2856. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  2857. class a {
  2858. constructor(e2, t2) {
  2859. var i2 = {};
  2860. n.default.util.json.merge(i2, s), n.default.util.json.merge(i2, t2), this.version = "0.2.0", this.jm = e2, this.options = i2, this.dpr = e2.view.device_pixel_ratio;
  2861. }
  2862. shoot() {
  2863. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  2864. t2.scale(this.dpr, this.dpr), Promise.resolve(t2).then(() => this.draw_background(t2)).then(() => this.draw_lines(t2)).then(() => this.draw_nodes(t2)).then(() => this.draw_watermark(e2, t2)).then(() => this.download(e2)).then(() => this.clear(e2));
  2865. }
  2866. create_canvas() {
  2867. let e2 = r.c("canvas");
  2868. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  2869. return e2.width = t2 * this.dpr, e2.height = i2 * this.dpr, e2.style.width = t2 + "px", e2.style.height = i2 + "px", e2.style.visibility = "hidden", this.jm.view.e_panel.appendChild(e2), e2;
  2870. }
  2871. clear(e2) {
  2872. e2.parentNode.removeChild(e2);
  2873. }
  2874. draw_background(e2) {
  2875. return new Promise(function(t2, i2) {
  2876. const n2 = this.options.background;
  2877. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  2878. }.bind(this));
  2879. }
  2880. draw_lines(e2) {
  2881. return new Promise(function(t2, i2) {
  2882. this.jm.view.graph.copy_to(e2, function() {
  2883. t2(e2);
  2884. });
  2885. }.bind(this));
  2886. }
  2887. draw_nodes(e2) {
  2888. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  2889. return e2.drawImage(t2, 0, 0), e2;
  2890. });
  2891. }
  2892. draw_watermark(e2, t2) {
  2893. return t2.textBaseline = "bottom", t2.fillStyle = "#000", t2.font = "11px Verdana,Arial,Helvetica,sans-serif", this.options.watermark.left && (t2.textAlign = "left", t2.fillText(this.options.watermark.left, 5.5, e2.height - 2.5)), this.options.watermark.right && (t2.textAlign = "right", t2.fillText(this.options.watermark.right, e2.width - 5.5, e2.height - 2.5)), t2;
  2894. }
  2895. load_image(e2) {
  2896. return new Promise(function(t2, i2) {
  2897. let n2 = new Image();
  2898. n2.onload = function() {
  2899. t2(n2);
  2900. }, n2.onerror = i2, n2.src = e2;
  2901. });
  2902. }
  2903. download(e2) {
  2904. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  2905. if (navigator.msSaveBlob && e2.msToBlob) {
  2906. var i2 = e2.msToBlob();
  2907. navigator.msSaveBlob(i2, t2);
  2908. } else {
  2909. var n2 = e2.toDataURL(), o2 = r.c("a");
  2910. if ("download" in o2) {
  2911. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  2912. var s2 = r.d.createEvent("MouseEvents");
  2913. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  2914. } else location.href = n2;
  2915. }
  2916. }
  2917. }
  2918. let d = new n.default.plugin("screenshot", function(e2, t2) {
  2919. var i2 = new a(e2, t2);
  2920. e2.screenshot = i2, e2.shoot = function() {
  2921. i2.shoot();
  2922. };
  2923. });
  2924. n.default.register_plugin(d);
  2925. });
  2926. })();
  2927. const jsonMind = {
  2928. isFirst: true,
  2929. transform(json) {
  2930. const children = [];
  2931. if (Utils.isObject(json)) {
  2932. for (const key in json) {
  2933. let val = json[key];
  2934. const isArray = Array.isArray(val);
  2935. const type = Utils.getPropType(val);
  2936. if (isArray && val.length > 0) val = Utils.getMaxKeysAndDepthObject(val);
  2937. const isObject = Object.is(Utils.getType(val), "object");
  2938. const keys = isObject ? Object.keys(val) : null;
  2939. children.push({
  2940. keys,
  2941. isArray,
  2942. chain: key,
  2943. id: key + "_" + Math.random(),
  2944. topic: `${key}<span class="datatype">${type}</span>`,
  2945. children: this.transform(val)
  2946. });
  2947. }
  2948. }
  2949. return children;
  2950. },
  2951. getChain(node) {
  2952. let chain = node?.data?.chain;
  2953. if (!node?.parent) return chain;
  2954. const parent = node.parent;
  2955. const parentChain = this.getChain(parent);
  2956. if (parent.data.isArray) return `${parentChain}[i].${chain}`;
  2957. if (chain.includes(".")) return `${parentChain}["${chain}"]`;
  2958. return `${parentChain}.${chain}`;
  2959. },
  2960. show(json) {
  2961. let isArray = Array.isArray(json);
  2962. if (isArray) {
  2963. if (typeof json[0] !== "object") {
  2964. layer.msg("无法生成脑图", { time: 1e3 });
  2965. return this;
  2966. }
  2967. json = Utils.getMaxKeysAndDepthObject(json);
  2968. }
  2969. if (!this.isFirst) return this;
  2970. _unsafeWindow.GLOBAL_JSMIND.show({
  2971. meta: {
  2972. version: "1.0",
  2973. name: "JSON脑图",
  2974. author: "1220301855@qq.com"
  2975. },
  2976. format: "node_tree",
  2977. data: {
  2978. isArray,
  2979. id: "root",
  2980. chain: "Root",
  2981. topic: "Root",
  2982. direction: "left",
  2983. keys: Object.keys(json),
  2984. children: this.transform(json)
  2985. }
  2986. });
  2987. this.isFirst = false;
  2988. return this;
  2989. },
  2990. event() {
  2991. Utils.addEvent("click mouseover", "jmnode", (event) => {
  2992. const target = event.target;
  2993. const nodeid = Utils.attr(target, "nodeid");
  2994. const node = _unsafeWindow.GLOBAL_JSMIND.get_node(nodeid);
  2995. const chain = this.getChain(node);
  2996. if (!chain) return;
  2997. if (event.type === "click") {
  2998. if (event.ctrlKey) {
  2999. _GM_setClipboard(chain);
  3000. layer.msg("复制成功", { time: 1500 });
  3001. return;
  3002. }
  3003. const keys = node.data.keys;
  3004. if (!keys || keys.length === 0) return;
  3005. this.popup(chain, keys);
  3006. } else {
  3007. const content = `<i>ctrlclick 复制</i><br/><b>路径:</b>${chain}`;
  3008. tippy(target, {
  3009. content,
  3010. duration: 800,
  3011. allowHTML: true,
  3012. theme: "layer"
  3013. }).show();
  3014. }
  3015. });
  3016. return this;
  3017. },
  3018. popup(chain, keys) {
  3019. layer.open({
  3020. type: 1,
  3021. move: false,
  3022. shadeClose: true,
  3023. title: " 节点",
  3024. content: function() {
  3025. const chain2 = Utils.createElement("div");
  3026. const chainCon = Utils.createElement("div");
  3027. chain2.appendChild(chainCon);
  3028. const content = Utils.createElement("div", { class: "js-mind-child-node" });
  3029. const copy = Utils.createElement("div", { title: "复制", class: "js-mind-copy" });
  3030. content.appendChild(copy);
  3031. keys.forEach((i) => {
  3032. const child = Utils.createElement("div");
  3033. child.textContent = i;
  3034. content.appendChild(child);
  3035. });
  3036. return content.outerHTML;
  3037. }(),
  3038. success(layero) {
  3039. layero.on("click", ".js-mind-copy", function() {
  3040. _GM_setClipboard(chain + "\n\n" + keys.join("\n"));
  3041. layer.msg("复制成功", { time: 1500 });
  3042. });
  3043. }
  3044. });
  3045. },
  3046. init(json) {
  3047. if (_unsafeWindow.GLOBAL_JSMIND) return;
  3048. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  3049. mode: "side",
  3050. editable: false,
  3051. container: "mindBox",
  3052. view: {
  3053. hmargin: 50,
  3054. vmargin: 50,
  3055. engine: "svg",
  3056. draggable: true,
  3057. support_html: false,
  3058. line_color: "#C4C9D0"
  3059. },
  3060. layout: {
  3061. vspace: 5,
  3062. hspace: 130
  3063. }
  3064. });
  3065. this.show(json).event();
  3066. }
  3067. };
  3068. const mindBox = Utils.query("#mindBox");
  3069. const formatBox = Utils.query("#formatBox");
  3070. const rawTextBox = Utils.query("#rawTextBox");
  3071. const rawTextPre = Utils.query("pre", rawTextBox);
  3072. const tabs = {
  3073. viewFormater() {
  3074. const value = _unsafeWindow.FILTER_VALUE || "";
  3075. Utils.query(".filter").value = value;
  3076. Utils.attr(Utils.query(".clear"), "hidden", !value);
  3077. },
  3078. saveJson() {
  3079. if (Utils.isVisible(mindBox)) return _unsafeWindow.GLOBAL_JSMIND.shoot();
  3080. const content = rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3081. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  3082. Utils.downloadText(content, filename);
  3083. },
  3084. copyJson() {
  3085. const content = rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3086. _GM_setClipboard(content);
  3087. layer.msg("复制成功", { time: 1500 });
  3088. },
  3089. sorted(el) {
  3090. const text = _unsafeWindow.JSON_FORMATER.sorted();
  3091. el.textContent = text;
  3092. },
  3093. collapseAll() {
  3094. Utils.isVisible(formatBox) ? _unsafeWindow.JSON_FORMATER.collapseAll() : _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  3095. },
  3096. expandAll() {
  3097. if (Utils.isVisible(formatBox)) return _unsafeWindow.JSON_FORMATER.expandAll();
  3098. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  3099. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(_unsafeWindow.GLOBAL_JSMIND?.get_root());
  3100. },
  3101. viewMind() {
  3102. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3103. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(_unsafeWindow.GLOBAL_JSMIND.get_root());
  3104. },
  3105. jsoncrack() {
  3106. const theme2 = (_GM_getValue("theme") || "light").replace(/-.*/, "");
  3107. layer.closeAll();
  3108. layer.open({
  3109. type: 1,
  3110. move: false,
  3111. title: false,
  3112. area: ["100vw", "100vh"],
  3113. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  3114. success() {
  3115. const jsonCrackEmbed = Utils.query("#jsoncrackEmbed");
  3116. window?.addEventListener("message", () => {
  3117. const msg = { options: { theme: theme2 }, json: _unsafeWindow.RAW_TEXT };
  3118. jsonCrackEmbed?.contentWindow?.postMessage(msg, "*");
  3119. });
  3120. }
  3121. });
  3122. },
  3123. _setRawText() {
  3124. let rawText = _unsafeWindow.RAW_TEXT;
  3125. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3126. rawText = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${rawText})`;
  3127. }
  3128. rawTextPre.textContent = rawText;
  3129. },
  3130. firstFormat: true,
  3131. viewRawText() {
  3132. if (!this.firstFormat) return;
  3133. this.firstFormat = false;
  3134. this._setRawText();
  3135. },
  3136. isBeautify: false,
  3137. beautify() {
  3138. this.isBeautify = !this.isBeautify;
  3139. if (!this.isBeautify) return this._setRawText();
  3140. let str = Utils.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  3141. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3142. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  3143. }
  3144. rawTextPre.textContent = str;
  3145. },
  3146. init() {
  3147. Utils.addEvent("click", ".btn", (e) => {
  3148. const target = e.target;
  3149. const id = target.id;
  3150. if (Utils.hasClass(target, "tabs-item")) {
  3151. const clas = "active";
  3152. Utils.removeClass(Utils.queryAll(".tabs-item"), clas);
  3153. Utils.addClass(target, clas);
  3154. Utils.removeClass(Utils.queryAll("div[data-for]"), clas);
  3155. Utils.addClass(Utils.query(`div[data-for="${id}"]`), clas);
  3156. const template = Utils.query(`template[data-for='${id}']`);
  3157. Utils.query(".toolbar").innerHTML = template.innerHTML;
  3158. }
  3159. this[id](target);
  3160. });
  3161. }
  3162. };
  3163. window.addEventListener("message", function(event) {
  3164. const { data } = event;
  3165. if (!data?.reload) return;
  3166. mindBox.innerHTML = "";
  3167. jsonMind.isFirst = true;
  3168. tabs.isBeautify = false;
  3169. tabs.firstFormat = true;
  3170. _unsafeWindow.GLOBAL_JSMIND = void 0;
  3171. if (Utils.isVisible(rawTextBox)) return tabs.viewRawText();
  3172. if (Utils.isVisible(mindBox)) return jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3173. });
  3174. const theme = {
  3175. changeTheme(theme2) {
  3176. _GM_setValue("theme", theme2) & this.setTheme();
  3177. },
  3178. setTheme() {
  3179. const theme2 = _GM_getValue("theme") || "default";
  3180. _unsafeWindow.JSON_FORMATER.setTheme(theme2);
  3181. }
  3182. };
  3183. const http_form = `
  3184. <form class="httpRequest">
  3185. <div class="requestbox">
  3186. <select name="method">
  3187. <option value="POST">POST</option>
  3188. <option value="GET">GET</option>
  3189. <option value="PUT">PUT</option>
  3190. <option value="DELETE">DELETE</option>
  3191. </select>
  3192. <input name="url" placeholder="请求地址" />
  3193. <select name="contentType">
  3194. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  3195. <option value="application/json;charset=UTF-8">application/json</option>
  3196. </select>
  3197. <button type="submit">发送</button>
  3198. </div>
  3199. <div class="textarea">
  3200. <input name="headers" placeholder='请求头 {"token": "test"}' />
  3201. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  3202. </div>
  3203. </form>
  3204. `;
  3205. const tools = {
  3206. inputJson() {
  3207. layer.prompt(
  3208. {
  3209. move: false,
  3210. formType: 2,
  3211. btn: ["确认"],
  3212. shadeClose: true,
  3213. title: "JSON 输入",
  3214. area: ["400px", "300px"],
  3215. maxlength: Number.MAX_VALUE
  3216. },
  3217. (text) => {
  3218. if (!text) return layer.msg("内容不能为空", { time: 1500 });
  3219. const { rawText, jsonpFun } = Utils.matchJsonp(text);
  3220. try {
  3221. const json = Utils.parse(rawText);
  3222. this.reload(json, rawText, jsonpFun);
  3223. } catch (e) {
  3224. layer.msg("JSON格式不正确", { time: 1500 });
  3225. console.log("格式化异常: ", e);
  3226. }
  3227. }
  3228. );
  3229. return this;
  3230. },
  3231. fetchJson() {
  3232. const success = () => {
  3233. const formElem = Utils.query("form");
  3234. formElem.addEventListener("submit", (event) => {
  3235. event.preventDefault();
  3236. const formData = new FormData(formElem);
  3237. const submitData = {};
  3238. for (const [name, value] of formData) {
  3239. submitData[name] = value;
  3240. }
  3241. this._submit(submitData);
  3242. });
  3243. };
  3244. layer.open({
  3245. success,
  3246. type: 1,
  3247. shadeClose: true,
  3248. title: "HTTP 请求",
  3249. content: http_form
  3250. });
  3251. return this;
  3252. },
  3253. async _submit(submitData) {
  3254. if (!submitData.url) return layer.msg("请求地址不能为空");
  3255. let params = submitData.params;
  3256. let headers = submitData.headers;
  3257. if (headers && !(headers.startsWith("{") && headers.endsWith("}"))) {
  3258. return layer.msg("请求头 格式不合法");
  3259. }
  3260. if (params && !(params.startsWith("{") && params.endsWith("}"))) {
  3261. return layer.msg("请求参数 格式不合法");
  3262. }
  3263. try {
  3264. layer.load();
  3265. const response = await fetch(URL$1.ONLINE_REQUEST, {
  3266. method: "POST",
  3267. body: Utils.stringify(submitData),
  3268. headers: { "Content-Type": "application/json" }
  3269. });
  3270. let result = await response.json();
  3271. if (Utils.isObject(result)) result = Utils.stringify(result);
  3272. const { rawText, jsonpFun } = Utils.matchJsonp(result);
  3273. const json = Utils.parse(rawText);
  3274. this.reload(json, rawText, jsonpFun);
  3275. } catch (e) {
  3276. layer.closeAll();
  3277. layer.msg("请求异常:" + e.message);
  3278. console.log("HTTP 请求异常:", e);
  3279. }
  3280. },
  3281. reload(json, rawText, jsonpFun) {
  3282. layer.closeAll();
  3283. _unsafeWindow.RAW_TEXT = rawText;
  3284. _unsafeWindow.GLOBAL_JSON = json;
  3285. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  3286. window.postMessage({ reload: true });
  3287. }
  3288. };
  3289. const active = "active";
  3290. const handleBar = {
  3291. currentTippy: null,
  3292. handle() {
  3293. const tagName = "span";
  3294. [".style", ".theme", ".tools"].forEach((selector) => {
  3295. tippy(selector, {
  3296. duration: 500,
  3297. allowHTML: true,
  3298. interactive: true,
  3299. trigger: "click",
  3300. appendTo: Utils.query(selector).parentNode,
  3301. onTrigger: (instance) => {
  3302. this.currentTippy = instance;
  3303. const target = instance.reference;
  3304. Utils.addClass(Utils.query(tagName, target), active);
  3305. const template = Utils.query("template", target);
  3306. const ul = template.content.cloneNode(true);
  3307. const type = template.dataset.type;
  3308. const value = _GM_getValue(type) || "default";
  3309. const current = Utils.query(`li[data-value=${value}]`, ul);
  3310. Utils.addClass(current, active);
  3311. const tempDiv = Utils.createElement("div");
  3312. while (ul.firstChild) tempDiv.appendChild(ul.firstChild);
  3313. instance.setContent(tempDiv.innerHTML);
  3314. },
  3315. onHide(instance) {
  3316. Utils.removeClass(Utils.query(tagName, instance.reference));
  3317. }
  3318. });
  3319. });
  3320. return this;
  3321. },
  3322. checked() {
  3323. const selector = ".rightbox li";
  3324. Utils.addEvent("click", selector, (event) => {
  3325. const target = event.target;
  3326. if (Utils.hasClass(target, active)) return;
  3327. const type = target.dataset.type;
  3328. const value = target.dataset.value;
  3329. window.postMessage({ type, value });
  3330. if (Object.is(type, "tools")) return this.currentTippy.hide();
  3331. Utils.removeClass(Utils.queryAll(selector));
  3332. Utils.addClass(target, active);
  3333. });
  3334. return this;
  3335. },
  3336. init() {
  3337. this.handle().checked();
  3338. }
  3339. };
  3340. tabs.init();
  3341. theme.setTheme();
  3342. handleBar.init();
  3343. window.addEventListener("message", function(event) {
  3344. const { data } = event;
  3345. if (!data) return;
  3346. const { type, value } = data;
  3347. if (!type && !value) return;
  3348. if (Object.is(type, "tools")) return tools[value]();
  3349. if (Object.is(type, "theme")) return theme.changeTheme(value);
  3350. });
  3351.  
  3352. })
  3353. };
  3354. }));
  3355.  
  3356. System.register("./index-CwrJ66RK-Dv5nmPjd.js", ['./tippy.esm-Ot9MORvr-DNGa7Opj.js', './__monkey.entry-D38Pz7Rd.js'], (function (exports, module) {
  3357. 'use strict';
  3358. var tippy, Utils;
  3359. return {
  3360. setters: [module => {
  3361. tippy = module.t;
  3362. }, module => {
  3363. Utils = module.U;
  3364. }],
  3365. execute: (function () {
  3366.  
  3367. const scroll = Utils.createElement("div", { class: "scroll-top" });
  3368. document.body.appendChild(scroll);
  3369. tippy(scroll, { theme: "scroll", placement: "left", content: "返回顶部" });
  3370. const $container = Utils.query(".container");
  3371. $container.addEventListener("scroll", function() {
  3372. this.scrollTop > 500 ? Utils.show(scroll) : Utils.hide(scroll);
  3373. });
  3374. scroll.addEventListener("click", function() {
  3375. $container.scrollTop = 0;
  3376. });
  3377.  
  3378. })
  3379. };
  3380. }));
  3381.  
  3382. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  3383. 'use strict';
  3384. return {
  3385. execute: (function () {
  3386.  
  3387. exports("t", tippy);
  3388.  
  3389. var top = "top";
  3390. var bottom = "bottom";
  3391. var right = "right";
  3392. var left = "left";
  3393. var auto = "auto";
  3394. var basePlacements = [top, bottom, right, left];
  3395. var start = "start";
  3396. var end = "end";
  3397. var clippingParents = "clippingParents";
  3398. var viewport = "viewport";
  3399. var popper = "popper";
  3400. var reference = "reference";
  3401. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  3402. return acc.concat([placement + "-" + start, placement + "-" + end]);
  3403. }, []);
  3404. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  3405. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  3406. }, []);
  3407. var beforeRead = "beforeRead";
  3408. var read = "read";
  3409. var afterRead = "afterRead";
  3410. var beforeMain = "beforeMain";
  3411. var main = "main";
  3412. var afterMain = "afterMain";
  3413. var beforeWrite = "beforeWrite";
  3414. var write = "write";
  3415. var afterWrite = "afterWrite";
  3416. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  3417. function getNodeName(element) {
  3418. return element ? (element.nodeName || "").toLowerCase() : null;
  3419. }
  3420. function getWindow(node) {
  3421. if (node == null) {
  3422. return window;
  3423. }
  3424. if (node.toString() !== "[object Window]") {
  3425. var ownerDocument = node.ownerDocument;
  3426. return ownerDocument ? ownerDocument.defaultView || window : window;
  3427. }
  3428. return node;
  3429. }
  3430. function isElement$1(node) {
  3431. var OwnElement = getWindow(node).Element;
  3432. return node instanceof OwnElement || node instanceof Element;
  3433. }
  3434. function isHTMLElement(node) {
  3435. var OwnElement = getWindow(node).HTMLElement;
  3436. return node instanceof OwnElement || node instanceof HTMLElement;
  3437. }
  3438. function isShadowRoot(node) {
  3439. if (typeof ShadowRoot === "undefined") {
  3440. return false;
  3441. }
  3442. var OwnElement = getWindow(node).ShadowRoot;
  3443. return node instanceof OwnElement || node instanceof ShadowRoot;
  3444. }
  3445. function applyStyles(_ref) {
  3446. var state = _ref.state;
  3447. Object.keys(state.elements).forEach(function(name) {
  3448. var style = state.styles[name] || {};
  3449. var attributes = state.attributes[name] || {};
  3450. var element = state.elements[name];
  3451. if (!isHTMLElement(element) || !getNodeName(element)) {
  3452. return;
  3453. }
  3454. Object.assign(element.style, style);
  3455. Object.keys(attributes).forEach(function(name2) {
  3456. var value = attributes[name2];
  3457. if (value === false) {
  3458. element.removeAttribute(name2);
  3459. } else {
  3460. element.setAttribute(name2, value === true ? "" : value);
  3461. }
  3462. });
  3463. });
  3464. }
  3465. function effect$2(_ref2) {
  3466. var state = _ref2.state;
  3467. var initialStyles = {
  3468. popper: {
  3469. position: state.options.strategy,
  3470. left: "0",
  3471. top: "0",
  3472. margin: "0"
  3473. },
  3474. arrow: {
  3475. position: "absolute"
  3476. },
  3477. reference: {}
  3478. };
  3479. Object.assign(state.elements.popper.style, initialStyles.popper);
  3480. state.styles = initialStyles;
  3481. if (state.elements.arrow) {
  3482. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  3483. }
  3484. return function() {
  3485. Object.keys(state.elements).forEach(function(name) {
  3486. var element = state.elements[name];
  3487. var attributes = state.attributes[name] || {};
  3488. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  3489. var style = styleProperties.reduce(function(style2, property) {
  3490. style2[property] = "";
  3491. return style2;
  3492. }, {});
  3493. if (!isHTMLElement(element) || !getNodeName(element)) {
  3494. return;
  3495. }
  3496. Object.assign(element.style, style);
  3497. Object.keys(attributes).forEach(function(attribute) {
  3498. element.removeAttribute(attribute);
  3499. });
  3500. });
  3501. };
  3502. }
  3503. const applyStyles$1 = {
  3504. name: "applyStyles",
  3505. enabled: true,
  3506. phase: "write",
  3507. fn: applyStyles,
  3508. effect: effect$2,
  3509. requires: ["computeStyles"]
  3510. };
  3511. function getBasePlacement$1(placement) {
  3512. return placement.split("-")[0];
  3513. }
  3514. var max = Math.max;
  3515. var min = Math.min;
  3516. var round = Math.round;
  3517. function getUAString() {
  3518. var uaData = navigator.userAgentData;
  3519. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  3520. return uaData.brands.map(function(item) {
  3521. return item.brand + "/" + item.version;
  3522. }).join(" ");
  3523. }
  3524. return navigator.userAgent;
  3525. }
  3526. function isLayoutViewport() {
  3527. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  3528. }
  3529. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  3530. if (includeScale === void 0) {
  3531. includeScale = false;
  3532. }
  3533. if (isFixedStrategy === void 0) {
  3534. isFixedStrategy = false;
  3535. }
  3536. var clientRect = element.getBoundingClientRect();
  3537. var scaleX = 1;
  3538. var scaleY = 1;
  3539. if (includeScale && isHTMLElement(element)) {
  3540. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  3541. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  3542. }
  3543. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  3544. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  3545. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  3546. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  3547. var width = clientRect.width / scaleX;
  3548. var height = clientRect.height / scaleY;
  3549. return {
  3550. width,
  3551. height,
  3552. top: y,
  3553. right: x + width,
  3554. bottom: y + height,
  3555. left: x,
  3556. x,
  3557. y
  3558. };
  3559. }
  3560. function getLayoutRect(element) {
  3561. var clientRect = getBoundingClientRect(element);
  3562. var width = element.offsetWidth;
  3563. var height = element.offsetHeight;
  3564. if (Math.abs(clientRect.width - width) <= 1) {
  3565. width = clientRect.width;
  3566. }
  3567. if (Math.abs(clientRect.height - height) <= 1) {
  3568. height = clientRect.height;
  3569. }
  3570. return {
  3571. x: element.offsetLeft,
  3572. y: element.offsetTop,
  3573. width,
  3574. height
  3575. };
  3576. }
  3577. function contains(parent, child) {
  3578. var rootNode = child.getRootNode && child.getRootNode();
  3579. if (parent.contains(child)) {
  3580. return true;
  3581. } else if (rootNode && isShadowRoot(rootNode)) {
  3582. var next = child;
  3583. do {
  3584. if (next && parent.isSameNode(next)) {
  3585. return true;
  3586. }
  3587. next = next.parentNode || next.host;
  3588. } while (next);
  3589. }
  3590. return false;
  3591. }
  3592. function getComputedStyle(element) {
  3593. return getWindow(element).getComputedStyle(element);
  3594. }
  3595. function isTableElement(element) {
  3596. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  3597. }
  3598. function getDocumentElement(element) {
  3599. return ((isElement$1(element) ? element.ownerDocument : (
  3600. // $FlowFixMe[prop-missing]
  3601. element.document
  3602. )) || window.document).documentElement;
  3603. }
  3604. function getParentNode(element) {
  3605. if (getNodeName(element) === "html") {
  3606. return element;
  3607. }
  3608. return (
  3609. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  3610. // $FlowFixMe[incompatible-return]
  3611. // $FlowFixMe[prop-missing]
  3612. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  3613. element.parentNode || // DOM Element detected
  3614. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  3615. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  3616. getDocumentElement(element)
  3617. );
  3618. }
  3619. function getTrueOffsetParent(element) {
  3620. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  3621. getComputedStyle(element).position === "fixed") {
  3622. return null;
  3623. }
  3624. return element.offsetParent;
  3625. }
  3626. function getContainingBlock(element) {
  3627. var isFirefox = /firefox/i.test(getUAString());
  3628. var isIE = /Trident/i.test(getUAString());
  3629. if (isIE && isHTMLElement(element)) {
  3630. var elementCss = getComputedStyle(element);
  3631. if (elementCss.position === "fixed") {
  3632. return null;
  3633. }
  3634. }
  3635. var currentNode = getParentNode(element);
  3636. if (isShadowRoot(currentNode)) {
  3637. currentNode = currentNode.host;
  3638. }
  3639. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  3640. var css = getComputedStyle(currentNode);
  3641. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
  3642. return currentNode;
  3643. } else {
  3644. currentNode = currentNode.parentNode;
  3645. }
  3646. }
  3647. return null;
  3648. }
  3649. function getOffsetParent(element) {
  3650. var window2 = getWindow(element);
  3651. var offsetParent = getTrueOffsetParent(element);
  3652. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  3653. offsetParent = getTrueOffsetParent(offsetParent);
  3654. }
  3655. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  3656. return window2;
  3657. }
  3658. return offsetParent || getContainingBlock(element) || window2;
  3659. }
  3660. function getMainAxisFromPlacement(placement) {
  3661. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  3662. }
  3663. function within(min$1, value, max$1) {
  3664. return max(min$1, min(value, max$1));
  3665. }
  3666. function withinMaxClamp(min2, value, max2) {
  3667. var v = within(min2, value, max2);
  3668. return v > max2 ? max2 : v;
  3669. }
  3670. function getFreshSideObject() {
  3671. return {
  3672. top: 0,
  3673. right: 0,
  3674. bottom: 0,
  3675. left: 0
  3676. };
  3677. }
  3678. function mergePaddingObject(paddingObject) {
  3679. return Object.assign({}, getFreshSideObject(), paddingObject);
  3680. }
  3681. function expandToHashMap(value, keys) {
  3682. return keys.reduce(function(hashMap, key) {
  3683. hashMap[key] = value;
  3684. return hashMap;
  3685. }, {});
  3686. }
  3687. var toPaddingObject = function toPaddingObject2(padding, state) {
  3688. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  3689. placement: state.placement
  3690. })) : padding;
  3691. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  3692. };
  3693. function arrow(_ref) {
  3694. var _state$modifiersData$;
  3695. var state = _ref.state, name = _ref.name, options = _ref.options;
  3696. var arrowElement = state.elements.arrow;
  3697. var popperOffsets2 = state.modifiersData.popperOffsets;
  3698. var basePlacement = getBasePlacement$1(state.placement);
  3699. var axis = getMainAxisFromPlacement(basePlacement);
  3700. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  3701. var len = isVertical ? "height" : "width";
  3702. if (!arrowElement || !popperOffsets2) {
  3703. return;
  3704. }
  3705. var paddingObject = toPaddingObject(options.padding, state);
  3706. var arrowRect = getLayoutRect(arrowElement);
  3707. var minProp = axis === "y" ? top : left;
  3708. var maxProp = axis === "y" ? bottom : right;
  3709. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  3710. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  3711. var arrowOffsetParent = getOffsetParent(arrowElement);
  3712. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  3713. var centerToReference = endDiff / 2 - startDiff / 2;
  3714. var min2 = paddingObject[minProp];
  3715. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  3716. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  3717. var offset2 = within(min2, center, max2);
  3718. var axisProp = axis;
  3719. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  3720. }
  3721. function effect$1(_ref2) {
  3722. var state = _ref2.state, options = _ref2.options;
  3723. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  3724. if (arrowElement == null) {
  3725. return;
  3726. }
  3727. if (typeof arrowElement === "string") {
  3728. arrowElement = state.elements.popper.querySelector(arrowElement);
  3729. if (!arrowElement) {
  3730. return;
  3731. }
  3732. }
  3733. if (!contains(state.elements.popper, arrowElement)) {
  3734. return;
  3735. }
  3736. state.elements.arrow = arrowElement;
  3737. }
  3738. const arrow$1 = {
  3739. name: "arrow",
  3740. enabled: true,
  3741. phase: "main",
  3742. fn: arrow,
  3743. effect: effect$1,
  3744. requires: ["popperOffsets"],
  3745. requiresIfExists: ["preventOverflow"]
  3746. };
  3747. function getVariation(placement) {
  3748. return placement.split("-")[1];
  3749. }
  3750. var unsetSides = {
  3751. top: "auto",
  3752. right: "auto",
  3753. bottom: "auto",
  3754. left: "auto"
  3755. };
  3756. function roundOffsetsByDPR(_ref, win) {
  3757. var x = _ref.x, y = _ref.y;
  3758. var dpr = win.devicePixelRatio || 1;
  3759. return {
  3760. x: round(x * dpr) / dpr || 0,
  3761. y: round(y * dpr) / dpr || 0
  3762. };
  3763. }
  3764. function mapToStyles(_ref2) {
  3765. var _Object$assign2;
  3766. var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  3767. var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  3768. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  3769. x,
  3770. y
  3771. }) : {
  3772. x,
  3773. y
  3774. };
  3775. x = _ref3.x;
  3776. y = _ref3.y;
  3777. var hasX = offsets.hasOwnProperty("x");
  3778. var hasY = offsets.hasOwnProperty("y");
  3779. var sideX = left;
  3780. var sideY = top;
  3781. var win = window;
  3782. if (adaptive) {
  3783. var offsetParent = getOffsetParent(popper2);
  3784. var heightProp = "clientHeight";
  3785. var widthProp = "clientWidth";
  3786. if (offsetParent === getWindow(popper2)) {
  3787. offsetParent = getDocumentElement(popper2);
  3788. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  3789. heightProp = "scrollHeight";
  3790. widthProp = "scrollWidth";
  3791. }
  3792. }
  3793. offsetParent = offsetParent;
  3794. if (placement === top || (placement === left || placement === right) && variation === end) {
  3795. sideY = bottom;
  3796. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  3797. // $FlowFixMe[prop-missing]
  3798. offsetParent[heightProp]
  3799. );
  3800. y -= offsetY - popperRect.height;
  3801. y *= gpuAcceleration ? 1 : -1;
  3802. }
  3803. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  3804. sideX = right;
  3805. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  3806. // $FlowFixMe[prop-missing]
  3807. offsetParent[widthProp]
  3808. );
  3809. x -= offsetX - popperRect.width;
  3810. x *= gpuAcceleration ? 1 : -1;
  3811. }
  3812. }
  3813. var commonStyles = Object.assign({
  3814. position
  3815. }, adaptive && unsetSides);
  3816. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  3817. x,
  3818. y
  3819. }, getWindow(popper2)) : {
  3820. x,
  3821. y
  3822. };
  3823. x = _ref4.x;
  3824. y = _ref4.y;
  3825. if (gpuAcceleration) {
  3826. var _Object$assign;
  3827. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  3828. }
  3829. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  3830. }
  3831. function computeStyles(_ref5) {
  3832. var state = _ref5.state, options = _ref5.options;
  3833. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  3834. var commonStyles = {
  3835. placement: getBasePlacement$1(state.placement),
  3836. variation: getVariation(state.placement),
  3837. popper: state.elements.popper,
  3838. popperRect: state.rects.popper,
  3839. gpuAcceleration,
  3840. isFixed: state.options.strategy === "fixed"
  3841. };
  3842. if (state.modifiersData.popperOffsets != null) {
  3843. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  3844. offsets: state.modifiersData.popperOffsets,
  3845. position: state.options.strategy,
  3846. adaptive,
  3847. roundOffsets
  3848. })));
  3849. }
  3850. if (state.modifiersData.arrow != null) {
  3851. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  3852. offsets: state.modifiersData.arrow,
  3853. position: "absolute",
  3854. adaptive: false,
  3855. roundOffsets
  3856. })));
  3857. }
  3858. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  3859. "data-popper-placement": state.placement
  3860. });
  3861. }
  3862. const computeStyles$1 = {
  3863. name: "computeStyles",
  3864. enabled: true,
  3865. phase: "beforeWrite",
  3866. fn: computeStyles,
  3867. data: {}
  3868. };
  3869. var passive = {
  3870. passive: true
  3871. };
  3872. function effect(_ref) {
  3873. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  3874. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  3875. var window2 = getWindow(state.elements.popper);
  3876. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  3877. if (scroll) {
  3878. scrollParents.forEach(function(scrollParent) {
  3879. scrollParent.addEventListener("scroll", instance.update, passive);
  3880. });
  3881. }
  3882. if (resize) {
  3883. window2.addEventListener("resize", instance.update, passive);
  3884. }
  3885. return function() {
  3886. if (scroll) {
  3887. scrollParents.forEach(function(scrollParent) {
  3888. scrollParent.removeEventListener("scroll", instance.update, passive);
  3889. });
  3890. }
  3891. if (resize) {
  3892. window2.removeEventListener("resize", instance.update, passive);
  3893. }
  3894. };
  3895. }
  3896. const eventListeners = {
  3897. name: "eventListeners",
  3898. enabled: true,
  3899. phase: "write",
  3900. fn: function fn() {
  3901. },
  3902. effect,
  3903. data: {}
  3904. };
  3905. var hash$1 = {
  3906. left: "right",
  3907. right: "left",
  3908. bottom: "top",
  3909. top: "bottom"
  3910. };
  3911. function getOppositePlacement(placement) {
  3912. return placement.replace(/left|right|bottom|top/g, function(matched) {
  3913. return hash$1[matched];
  3914. });
  3915. }
  3916. var hash = {
  3917. start: "end",
  3918. end: "start"
  3919. };
  3920. function getOppositeVariationPlacement(placement) {
  3921. return placement.replace(/start|end/g, function(matched) {
  3922. return hash[matched];
  3923. });
  3924. }
  3925. function getWindowScroll(node) {
  3926. var win = getWindow(node);
  3927. var scrollLeft = win.pageXOffset;
  3928. var scrollTop = win.pageYOffset;
  3929. return {
  3930. scrollLeft,
  3931. scrollTop
  3932. };
  3933. }
  3934. function getWindowScrollBarX(element) {
  3935. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  3936. }
  3937. function getViewportRect(element, strategy) {
  3938. var win = getWindow(element);
  3939. var html = getDocumentElement(element);
  3940. var visualViewport = win.visualViewport;
  3941. var width = html.clientWidth;
  3942. var height = html.clientHeight;
  3943. var x = 0;
  3944. var y = 0;
  3945. if (visualViewport) {
  3946. width = visualViewport.width;
  3947. height = visualViewport.height;
  3948. var layoutViewport = isLayoutViewport();
  3949. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  3950. x = visualViewport.offsetLeft;
  3951. y = visualViewport.offsetTop;
  3952. }
  3953. }
  3954. return {
  3955. width,
  3956. height,
  3957. x: x + getWindowScrollBarX(element),
  3958. y
  3959. };
  3960. }
  3961. function getDocumentRect(element) {
  3962. var _element$ownerDocumen;
  3963. var html = getDocumentElement(element);
  3964. var winScroll = getWindowScroll(element);
  3965. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  3966. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  3967. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  3968. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  3969. var y = -winScroll.scrollTop;
  3970. if (getComputedStyle(body || html).direction === "rtl") {
  3971. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  3972. }
  3973. return {
  3974. width,
  3975. height,
  3976. x,
  3977. y
  3978. };
  3979. }
  3980. function isScrollParent(element) {
  3981. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  3982. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  3983. }
  3984. function getScrollParent(node) {
  3985. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  3986. return node.ownerDocument.body;
  3987. }
  3988. if (isHTMLElement(node) && isScrollParent(node)) {
  3989. return node;
  3990. }
  3991. return getScrollParent(getParentNode(node));
  3992. }
  3993. function listScrollParents(element, list) {
  3994. var _element$ownerDocumen;
  3995. if (list === void 0) {
  3996. list = [];
  3997. }
  3998. var scrollParent = getScrollParent(element);
  3999. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  4000. var win = getWindow(scrollParent);
  4001. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  4002. var updatedList = list.concat(target);
  4003. return isBody ? updatedList : (
  4004. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  4005. updatedList.concat(listScrollParents(getParentNode(target)))
  4006. );
  4007. }
  4008. function rectToClientRect(rect) {
  4009. return Object.assign({}, rect, {
  4010. left: rect.x,
  4011. top: rect.y,
  4012. right: rect.x + rect.width,
  4013. bottom: rect.y + rect.height
  4014. });
  4015. }
  4016. function getInnerBoundingClientRect(element, strategy) {
  4017. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  4018. rect.top = rect.top + element.clientTop;
  4019. rect.left = rect.left + element.clientLeft;
  4020. rect.bottom = rect.top + element.clientHeight;
  4021. rect.right = rect.left + element.clientWidth;
  4022. rect.width = element.clientWidth;
  4023. rect.height = element.clientHeight;
  4024. rect.x = rect.left;
  4025. rect.y = rect.top;
  4026. return rect;
  4027. }
  4028. function getClientRectFromMixedType(element, clippingParent, strategy) {
  4029. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  4030. }
  4031. function getClippingParents(element) {
  4032. var clippingParents2 = listScrollParents(getParentNode(element));
  4033. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  4034. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  4035. if (!isElement$1(clipperElement)) {
  4036. return [];
  4037. }
  4038. return clippingParents2.filter(function(clippingParent) {
  4039. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  4040. });
  4041. }
  4042. function getClippingRect(element, boundary, rootBoundary, strategy) {
  4043. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  4044. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  4045. var firstClippingParent = clippingParents2[0];
  4046. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  4047. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  4048. accRect.top = max(rect.top, accRect.top);
  4049. accRect.right = min(rect.right, accRect.right);
  4050. accRect.bottom = min(rect.bottom, accRect.bottom);
  4051. accRect.left = max(rect.left, accRect.left);
  4052. return accRect;
  4053. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  4054. clippingRect.width = clippingRect.right - clippingRect.left;
  4055. clippingRect.height = clippingRect.bottom - clippingRect.top;
  4056. clippingRect.x = clippingRect.left;
  4057. clippingRect.y = clippingRect.top;
  4058. return clippingRect;
  4059. }
  4060. function computeOffsets(_ref) {
  4061. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  4062. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  4063. var variation = placement ? getVariation(placement) : null;
  4064. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  4065. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  4066. var offsets;
  4067. switch (basePlacement) {
  4068. case top:
  4069. offsets = {
  4070. x: commonX,
  4071. y: reference2.y - element.height
  4072. };
  4073. break;
  4074. case bottom:
  4075. offsets = {
  4076. x: commonX,
  4077. y: reference2.y + reference2.height
  4078. };
  4079. break;
  4080. case right:
  4081. offsets = {
  4082. x: reference2.x + reference2.width,
  4083. y: commonY
  4084. };
  4085. break;
  4086. case left:
  4087. offsets = {
  4088. x: reference2.x - element.width,
  4089. y: commonY
  4090. };
  4091. break;
  4092. default:
  4093. offsets = {
  4094. x: reference2.x,
  4095. y: reference2.y
  4096. };
  4097. }
  4098. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  4099. if (mainAxis != null) {
  4100. var len = mainAxis === "y" ? "height" : "width";
  4101. switch (variation) {
  4102. case start:
  4103. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  4104. break;
  4105. case end:
  4106. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  4107. break;
  4108. }
  4109. }
  4110. return offsets;
  4111. }
  4112. function detectOverflow(state, options) {
  4113. if (options === void 0) {
  4114. options = {};
  4115. }
  4116. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  4117. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  4118. var altContext = elementContext === popper ? reference : popper;
  4119. var popperRect = state.rects.popper;
  4120. var element = state.elements[altBoundary ? altContext : elementContext];
  4121. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  4122. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  4123. var popperOffsets2 = computeOffsets({
  4124. reference: referenceClientRect,
  4125. element: popperRect,
  4126. strategy: "absolute",
  4127. placement
  4128. });
  4129. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  4130. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  4131. var overflowOffsets = {
  4132. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  4133. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  4134. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  4135. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  4136. };
  4137. var offsetData = state.modifiersData.offset;
  4138. if (elementContext === popper && offsetData) {
  4139. var offset2 = offsetData[placement];
  4140. Object.keys(overflowOffsets).forEach(function(key) {
  4141. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  4142. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  4143. overflowOffsets[key] += offset2[axis] * multiply;
  4144. });
  4145. }
  4146. return overflowOffsets;
  4147. }
  4148. function computeAutoPlacement(state, options) {
  4149. if (options === void 0) {
  4150. options = {};
  4151. }
  4152. var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  4153. var variation = getVariation(placement);
  4154. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  4155. return getVariation(placement2) === variation;
  4156. }) : basePlacements;
  4157. var allowedPlacements = placements$1.filter(function(placement2) {
  4158. return allowedAutoPlacements.indexOf(placement2) >= 0;
  4159. });
  4160. if (allowedPlacements.length === 0) {
  4161. allowedPlacements = placements$1;
  4162. }
  4163. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  4164. acc[placement2] = detectOverflow(state, {
  4165. placement: placement2,
  4166. boundary,
  4167. rootBoundary,
  4168. padding
  4169. })[getBasePlacement$1(placement2)];
  4170. return acc;
  4171. }, {});
  4172. return Object.keys(overflows).sort(function(a, b) {
  4173. return overflows[a] - overflows[b];
  4174. });
  4175. }
  4176. function getExpandedFallbackPlacements(placement) {
  4177. if (getBasePlacement$1(placement) === auto) {
  4178. return [];
  4179. }
  4180. var oppositePlacement = getOppositePlacement(placement);
  4181. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  4182. }
  4183. function flip(_ref) {
  4184. var state = _ref.state, options = _ref.options, name = _ref.name;
  4185. if (state.modifiersData[name]._skip) {
  4186. return;
  4187. }
  4188. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  4189. var preferredPlacement = state.options.placement;
  4190. var basePlacement = getBasePlacement$1(preferredPlacement);
  4191. var isBasePlacement = basePlacement === preferredPlacement;
  4192. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  4193. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  4194. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  4195. placement: placement2,
  4196. boundary,
  4197. rootBoundary,
  4198. padding,
  4199. flipVariations,
  4200. allowedAutoPlacements
  4201. }) : placement2);
  4202. }, []);
  4203. var referenceRect = state.rects.reference;
  4204. var popperRect = state.rects.popper;
  4205. var checksMap = /* @__PURE__ */ new Map();
  4206. var makeFallbackChecks = true;
  4207. var firstFittingPlacement = placements2[0];
  4208. for (var i = 0; i < placements2.length; i++) {
  4209. var placement = placements2[i];
  4210. var _basePlacement = getBasePlacement$1(placement);
  4211. var isStartVariation = getVariation(placement) === start;
  4212. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  4213. var len = isVertical ? "width" : "height";
  4214. var overflow = detectOverflow(state, {
  4215. placement,
  4216. boundary,
  4217. rootBoundary,
  4218. altBoundary,
  4219. padding
  4220. });
  4221. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  4222. if (referenceRect[len] > popperRect[len]) {
  4223. mainVariationSide = getOppositePlacement(mainVariationSide);
  4224. }
  4225. var altVariationSide = getOppositePlacement(mainVariationSide);
  4226. var checks = [];
  4227. if (checkMainAxis) {
  4228. checks.push(overflow[_basePlacement] <= 0);
  4229. }
  4230. if (checkAltAxis) {
  4231. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  4232. }
  4233. if (checks.every(function(check) {
  4234. return check;
  4235. })) {
  4236. firstFittingPlacement = placement;
  4237. makeFallbackChecks = false;
  4238. break;
  4239. }
  4240. checksMap.set(placement, checks);
  4241. }
  4242. if (makeFallbackChecks) {
  4243. var numberOfChecks = flipVariations ? 3 : 1;
  4244. var _loop = function _loop2(_i2) {
  4245. var fittingPlacement = placements2.find(function(placement2) {
  4246. var checks2 = checksMap.get(placement2);
  4247. if (checks2) {
  4248. return checks2.slice(0, _i2).every(function(check) {
  4249. return check;
  4250. });
  4251. }
  4252. });
  4253. if (fittingPlacement) {
  4254. firstFittingPlacement = fittingPlacement;
  4255. return "break";
  4256. }
  4257. };
  4258. for (var _i = numberOfChecks; _i > 0; _i--) {
  4259. var _ret = _loop(_i);
  4260. if (_ret === "break") break;
  4261. }
  4262. }
  4263. if (state.placement !== firstFittingPlacement) {
  4264. state.modifiersData[name]._skip = true;
  4265. state.placement = firstFittingPlacement;
  4266. state.reset = true;
  4267. }
  4268. }
  4269. const flip$1 = {
  4270. name: "flip",
  4271. enabled: true,
  4272. phase: "main",
  4273. fn: flip,
  4274. requiresIfExists: ["offset"],
  4275. data: {
  4276. _skip: false
  4277. }
  4278. };
  4279. function getSideOffsets(overflow, rect, preventedOffsets) {
  4280. if (preventedOffsets === void 0) {
  4281. preventedOffsets = {
  4282. x: 0,
  4283. y: 0
  4284. };
  4285. }
  4286. return {
  4287. top: overflow.top - rect.height - preventedOffsets.y,
  4288. right: overflow.right - rect.width + preventedOffsets.x,
  4289. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  4290. left: overflow.left - rect.width - preventedOffsets.x
  4291. };
  4292. }
  4293. function isAnySideFullyClipped(overflow) {
  4294. return [top, right, bottom, left].some(function(side) {
  4295. return overflow[side] >= 0;
  4296. });
  4297. }
  4298. function hide(_ref) {
  4299. var state = _ref.state, name = _ref.name;
  4300. var referenceRect = state.rects.reference;
  4301. var popperRect = state.rects.popper;
  4302. var preventedOffsets = state.modifiersData.preventOverflow;
  4303. var referenceOverflow = detectOverflow(state, {
  4304. elementContext: "reference"
  4305. });
  4306. var popperAltOverflow = detectOverflow(state, {
  4307. altBoundary: true
  4308. });
  4309. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  4310. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  4311. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  4312. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  4313. state.modifiersData[name] = {
  4314. referenceClippingOffsets,
  4315. popperEscapeOffsets,
  4316. isReferenceHidden,
  4317. hasPopperEscaped
  4318. };
  4319. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  4320. "data-popper-reference-hidden": isReferenceHidden,
  4321. "data-popper-escaped": hasPopperEscaped
  4322. });
  4323. }
  4324. const hide$1 = {
  4325. name: "hide",
  4326. enabled: true,
  4327. phase: "main",
  4328. requiresIfExists: ["preventOverflow"],
  4329. fn: hide
  4330. };
  4331. function distanceAndSkiddingToXY(placement, rects, offset2) {
  4332. var basePlacement = getBasePlacement$1(placement);
  4333. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  4334. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  4335. placement
  4336. })) : offset2, skidding = _ref[0], distance = _ref[1];
  4337. skidding = skidding || 0;
  4338. distance = (distance || 0) * invertDistance;
  4339. return [left, right].indexOf(basePlacement) >= 0 ? {
  4340. x: distance,
  4341. y: skidding
  4342. } : {
  4343. x: skidding,
  4344. y: distance
  4345. };
  4346. }
  4347. function offset(_ref2) {
  4348. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  4349. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  4350. var data = placements.reduce(function(acc, placement) {
  4351. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  4352. return acc;
  4353. }, {});
  4354. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  4355. if (state.modifiersData.popperOffsets != null) {
  4356. state.modifiersData.popperOffsets.x += x;
  4357. state.modifiersData.popperOffsets.y += y;
  4358. }
  4359. state.modifiersData[name] = data;
  4360. }
  4361. const offset$1 = {
  4362. name: "offset",
  4363. enabled: true,
  4364. phase: "main",
  4365. requires: ["popperOffsets"],
  4366. fn: offset
  4367. };
  4368. function popperOffsets(_ref) {
  4369. var state = _ref.state, name = _ref.name;
  4370. state.modifiersData[name] = computeOffsets({
  4371. reference: state.rects.reference,
  4372. element: state.rects.popper,
  4373. strategy: "absolute",
  4374. placement: state.placement
  4375. });
  4376. }
  4377. const popperOffsets$1 = {
  4378. name: "popperOffsets",
  4379. enabled: true,
  4380. phase: "read",
  4381. fn: popperOffsets,
  4382. data: {}
  4383. };
  4384. function getAltAxis(axis) {
  4385. return axis === "x" ? "y" : "x";
  4386. }
  4387. function preventOverflow(_ref) {
  4388. var state = _ref.state, options = _ref.options, name = _ref.name;
  4389. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  4390. var overflow = detectOverflow(state, {
  4391. boundary,
  4392. rootBoundary,
  4393. padding,
  4394. altBoundary
  4395. });
  4396. var basePlacement = getBasePlacement$1(state.placement);
  4397. var variation = getVariation(state.placement);
  4398. var isBasePlacement = !variation;
  4399. var mainAxis = getMainAxisFromPlacement(basePlacement);
  4400. var altAxis = getAltAxis(mainAxis);
  4401. var popperOffsets2 = state.modifiersData.popperOffsets;
  4402. var referenceRect = state.rects.reference;
  4403. var popperRect = state.rects.popper;
  4404. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  4405. placement: state.placement
  4406. })) : tetherOffset;
  4407. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  4408. mainAxis: tetherOffsetValue,
  4409. altAxis: tetherOffsetValue
  4410. } : Object.assign({
  4411. mainAxis: 0,
  4412. altAxis: 0
  4413. }, tetherOffsetValue);
  4414. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  4415. var data = {
  4416. x: 0,
  4417. y: 0
  4418. };
  4419. if (!popperOffsets2) {
  4420. return;
  4421. }
  4422. if (checkMainAxis) {
  4423. var _offsetModifierState$;
  4424. var mainSide = mainAxis === "y" ? top : left;
  4425. var altSide = mainAxis === "y" ? bottom : right;
  4426. var len = mainAxis === "y" ? "height" : "width";
  4427. var offset2 = popperOffsets2[mainAxis];
  4428. var min$1 = offset2 + overflow[mainSide];
  4429. var max$1 = offset2 - overflow[altSide];
  4430. var additive = tether ? -popperRect[len] / 2 : 0;
  4431. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  4432. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  4433. var arrowElement = state.elements.arrow;
  4434. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  4435. width: 0,
  4436. height: 0
  4437. };
  4438. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  4439. var arrowPaddingMin = arrowPaddingObject[mainSide];
  4440. var arrowPaddingMax = arrowPaddingObject[altSide];
  4441. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  4442. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  4443. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  4444. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  4445. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  4446. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  4447. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  4448. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  4449. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  4450. popperOffsets2[mainAxis] = preventedOffset;
  4451. data[mainAxis] = preventedOffset - offset2;
  4452. }
  4453. if (checkAltAxis) {
  4454. var _offsetModifierState$2;
  4455. var _mainSide = mainAxis === "x" ? top : left;
  4456. var _altSide = mainAxis === "x" ? bottom : right;
  4457. var _offset = popperOffsets2[altAxis];
  4458. var _len = altAxis === "y" ? "height" : "width";
  4459. var _min = _offset + overflow[_mainSide];
  4460. var _max = _offset - overflow[_altSide];
  4461. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  4462. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  4463. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  4464. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  4465. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  4466. popperOffsets2[altAxis] = _preventedOffset;
  4467. data[altAxis] = _preventedOffset - _offset;
  4468. }
  4469. state.modifiersData[name] = data;
  4470. }
  4471. const preventOverflow$1 = {
  4472. name: "preventOverflow",
  4473. enabled: true,
  4474. phase: "main",
  4475. fn: preventOverflow,
  4476. requiresIfExists: ["offset"]
  4477. };
  4478. function getHTMLElementScroll(element) {
  4479. return {
  4480. scrollLeft: element.scrollLeft,
  4481. scrollTop: element.scrollTop
  4482. };
  4483. }
  4484. function getNodeScroll(node) {
  4485. if (node === getWindow(node) || !isHTMLElement(node)) {
  4486. return getWindowScroll(node);
  4487. } else {
  4488. return getHTMLElementScroll(node);
  4489. }
  4490. }
  4491. function isElementScaled(element) {
  4492. var rect = element.getBoundingClientRect();
  4493. var scaleX = round(rect.width) / element.offsetWidth || 1;
  4494. var scaleY = round(rect.height) / element.offsetHeight || 1;
  4495. return scaleX !== 1 || scaleY !== 1;
  4496. }
  4497. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  4498. if (isFixed === void 0) {
  4499. isFixed = false;
  4500. }
  4501. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  4502. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  4503. var documentElement = getDocumentElement(offsetParent);
  4504. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  4505. var scroll = {
  4506. scrollLeft: 0,
  4507. scrollTop: 0
  4508. };
  4509. var offsets = {
  4510. x: 0,
  4511. y: 0
  4512. };
  4513. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  4514. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  4515. isScrollParent(documentElement)) {
  4516. scroll = getNodeScroll(offsetParent);
  4517. }
  4518. if (isHTMLElement(offsetParent)) {
  4519. offsets = getBoundingClientRect(offsetParent, true);
  4520. offsets.x += offsetParent.clientLeft;
  4521. offsets.y += offsetParent.clientTop;
  4522. } else if (documentElement) {
  4523. offsets.x = getWindowScrollBarX(documentElement);
  4524. }
  4525. }
  4526. return {
  4527. x: rect.left + scroll.scrollLeft - offsets.x,
  4528. y: rect.top + scroll.scrollTop - offsets.y,
  4529. width: rect.width,
  4530. height: rect.height
  4531. };
  4532. }
  4533. function order(modifiers) {
  4534. var map = /* @__PURE__ */ new Map();
  4535. var visited = /* @__PURE__ */ new Set();
  4536. var result = [];
  4537. modifiers.forEach(function(modifier) {
  4538. map.set(modifier.name, modifier);
  4539. });
  4540. function sort(modifier) {
  4541. visited.add(modifier.name);
  4542. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  4543. requires.forEach(function(dep) {
  4544. if (!visited.has(dep)) {
  4545. var depModifier = map.get(dep);
  4546. if (depModifier) {
  4547. sort(depModifier);
  4548. }
  4549. }
  4550. });
  4551. result.push(modifier);
  4552. }
  4553. modifiers.forEach(function(modifier) {
  4554. if (!visited.has(modifier.name)) {
  4555. sort(modifier);
  4556. }
  4557. });
  4558. return result;
  4559. }
  4560. function orderModifiers(modifiers) {
  4561. var orderedModifiers = order(modifiers);
  4562. return modifierPhases.reduce(function(acc, phase) {
  4563. return acc.concat(orderedModifiers.filter(function(modifier) {
  4564. return modifier.phase === phase;
  4565. }));
  4566. }, []);
  4567. }
  4568. function debounce$1(fn2) {
  4569. var pending;
  4570. return function() {
  4571. if (!pending) {
  4572. pending = new Promise(function(resolve) {
  4573. Promise.resolve().then(function() {
  4574. pending = void 0;
  4575. resolve(fn2());
  4576. });
  4577. });
  4578. }
  4579. return pending;
  4580. };
  4581. }
  4582. function mergeByName(modifiers) {
  4583. var merged = modifiers.reduce(function(merged2, current) {
  4584. var existing = merged2[current.name];
  4585. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  4586. options: Object.assign({}, existing.options, current.options),
  4587. data: Object.assign({}, existing.data, current.data)
  4588. }) : current;
  4589. return merged2;
  4590. }, {});
  4591. return Object.keys(merged).map(function(key) {
  4592. return merged[key];
  4593. });
  4594. }
  4595. var DEFAULT_OPTIONS = {
  4596. placement: "bottom",
  4597. modifiers: [],
  4598. strategy: "absolute"
  4599. };
  4600. function areValidElements() {
  4601. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  4602. args[_key] = arguments[_key];
  4603. }
  4604. return !args.some(function(element) {
  4605. return !(element && typeof element.getBoundingClientRect === "function");
  4606. });
  4607. }
  4608. function popperGenerator(generatorOptions) {
  4609. if (generatorOptions === void 0) {
  4610. generatorOptions = {};
  4611. }
  4612. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  4613. return function createPopper2(reference2, popper2, options) {
  4614. if (options === void 0) {
  4615. options = defaultOptions;
  4616. }
  4617. var state = {
  4618. placement: "bottom",
  4619. orderedModifiers: [],
  4620. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  4621. modifiersData: {},
  4622. elements: {
  4623. reference: reference2,
  4624. popper: popper2
  4625. },
  4626. attributes: {},
  4627. styles: {}
  4628. };
  4629. var effectCleanupFns = [];
  4630. var isDestroyed = false;
  4631. var instance = {
  4632. state,
  4633. setOptions: function setOptions(setOptionsAction) {
  4634. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  4635. cleanupModifierEffects();
  4636. state.options = Object.assign({}, defaultOptions, state.options, options2);
  4637. state.scrollParents = {
  4638. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  4639. popper: listScrollParents(popper2)
  4640. };
  4641. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  4642. state.orderedModifiers = orderedModifiers.filter(function(m) {
  4643. return m.enabled;
  4644. });
  4645. runModifierEffects();
  4646. return instance.update();
  4647. },
  4648. // Sync update – it will always be executed, even if not necessary. This
  4649. // is useful for low frequency updates where sync behavior simplifies the
  4650. // logic.
  4651. // For high frequency updates (e.g. `resize` and `scroll` events), always
  4652. // prefer the async Popper#update method
  4653. forceUpdate: function forceUpdate() {
  4654. if (isDestroyed) {
  4655. return;
  4656. }
  4657. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  4658. if (!areValidElements(reference3, popper3)) {
  4659. return;
  4660. }
  4661. state.rects = {
  4662. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  4663. popper: getLayoutRect(popper3)
  4664. };
  4665. state.reset = false;
  4666. state.placement = state.options.placement;
  4667. state.orderedModifiers.forEach(function(modifier) {
  4668. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  4669. });
  4670. for (var index = 0; index < state.orderedModifiers.length; index++) {
  4671. if (state.reset === true) {
  4672. state.reset = false;
  4673. index = -1;
  4674. continue;
  4675. }
  4676. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
  4677. if (typeof fn2 === "function") {
  4678. state = fn2({
  4679. state,
  4680. options: _options,
  4681. name,
  4682. instance
  4683. }) || state;
  4684. }
  4685. }
  4686. },
  4687. // Async and optimistically optimized update – it will not be executed if
  4688. // not necessary (debounced to run at most once-per-tick)
  4689. update: debounce$1(function() {
  4690. return new Promise(function(resolve) {
  4691. instance.forceUpdate();
  4692. resolve(state);
  4693. });
  4694. }),
  4695. destroy: function destroy() {
  4696. cleanupModifierEffects();
  4697. isDestroyed = true;
  4698. }
  4699. };
  4700. if (!areValidElements(reference2, popper2)) {
  4701. return instance;
  4702. }
  4703. instance.setOptions(options).then(function(state2) {
  4704. if (!isDestroyed && options.onFirstUpdate) {
  4705. options.onFirstUpdate(state2);
  4706. }
  4707. });
  4708. function runModifierEffects() {
  4709. state.orderedModifiers.forEach(function(_ref) {
  4710. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  4711. if (typeof effect3 === "function") {
  4712. var cleanupFn = effect3({
  4713. state,
  4714. name,
  4715. instance,
  4716. options: options2
  4717. });
  4718. var noopFn = function noopFn2() {
  4719. };
  4720. effectCleanupFns.push(cleanupFn || noopFn);
  4721. }
  4722. });
  4723. }
  4724. function cleanupModifierEffects() {
  4725. effectCleanupFns.forEach(function(fn2) {
  4726. return fn2();
  4727. });
  4728. effectCleanupFns = [];
  4729. }
  4730. return instance;
  4731. };
  4732. }
  4733. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  4734. var createPopper = /* @__PURE__ */ popperGenerator({
  4735. defaultModifiers
  4736. });
  4737. var BOX_CLASS = "tippy-box";
  4738. var CONTENT_CLASS = "tippy-content";
  4739. var BACKDROP_CLASS = "tippy-backdrop";
  4740. var ARROW_CLASS = "tippy-arrow";
  4741. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  4742. var TOUCH_OPTIONS = {
  4743. passive: true,
  4744. capture: true
  4745. };
  4746. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  4747. return document.body;
  4748. };
  4749. function getValueAtIndexOrReturn(value, index, defaultValue) {
  4750. if (Array.isArray(value)) {
  4751. var v = value[index];
  4752. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  4753. }
  4754. return value;
  4755. }
  4756. function isType(value, type) {
  4757. var str = {}.toString.call(value);
  4758. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  4759. }
  4760. function invokeWithArgsOrReturn(value, args) {
  4761. return typeof value === "function" ? value.apply(void 0, args) : value;
  4762. }
  4763. function debounce(fn5, ms) {
  4764. if (ms === 0) {
  4765. return fn5;
  4766. }
  4767. var timeout;
  4768. return function(arg) {
  4769. clearTimeout(timeout);
  4770. timeout = setTimeout(function() {
  4771. fn5(arg);
  4772. }, ms);
  4773. };
  4774. }
  4775. function splitBySpaces(value) {
  4776. return value.split(/\s+/).filter(Boolean);
  4777. }
  4778. function normalizeToArray(value) {
  4779. return [].concat(value);
  4780. }
  4781. function pushIfUnique(arr, value) {
  4782. if (arr.indexOf(value) === -1) {
  4783. arr.push(value);
  4784. }
  4785. }
  4786. function unique(arr) {
  4787. return arr.filter(function(item, index) {
  4788. return arr.indexOf(item) === index;
  4789. });
  4790. }
  4791. function getBasePlacement(placement) {
  4792. return placement.split("-")[0];
  4793. }
  4794. function arrayFrom(value) {
  4795. return [].slice.call(value);
  4796. }
  4797. function removeUndefinedProps(obj) {
  4798. return Object.keys(obj).reduce(function(acc, key) {
  4799. if (obj[key] !== void 0) {
  4800. acc[key] = obj[key];
  4801. }
  4802. return acc;
  4803. }, {});
  4804. }
  4805. function div() {
  4806. return document.createElement("div");
  4807. }
  4808. function isElement(value) {
  4809. return ["Element", "Fragment"].some(function(type) {
  4810. return isType(value, type);
  4811. });
  4812. }
  4813. function isNodeList(value) {
  4814. return isType(value, "NodeList");
  4815. }
  4816. function isMouseEvent(value) {
  4817. return isType(value, "MouseEvent");
  4818. }
  4819. function isReferenceElement(value) {
  4820. return !!(value && value._tippy && value._tippy.reference === value);
  4821. }
  4822. function getArrayOfElements(value) {
  4823. if (isElement(value)) {
  4824. return [value];
  4825. }
  4826. if (isNodeList(value)) {
  4827. return arrayFrom(value);
  4828. }
  4829. if (Array.isArray(value)) {
  4830. return value;
  4831. }
  4832. return arrayFrom(document.querySelectorAll(value));
  4833. }
  4834. function setTransitionDuration(els, value) {
  4835. els.forEach(function(el) {
  4836. if (el) {
  4837. el.style.transitionDuration = value + "ms";
  4838. }
  4839. });
  4840. }
  4841. function setVisibilityState(els, state) {
  4842. els.forEach(function(el) {
  4843. if (el) {
  4844. el.setAttribute("data-state", state);
  4845. }
  4846. });
  4847. }
  4848. function getOwnerDocument(elementOrElements) {
  4849. var _element$ownerDocumen;
  4850. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  4851. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  4852. }
  4853. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  4854. var clientX = event.clientX, clientY = event.clientY;
  4855. return popperTreeData.every(function(_ref) {
  4856. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  4857. var interactiveBorder = props.interactiveBorder;
  4858. var basePlacement = getBasePlacement(popperState.placement);
  4859. var offsetData = popperState.modifiersData.offset;
  4860. if (!offsetData) {
  4861. return true;
  4862. }
  4863. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  4864. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  4865. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  4866. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  4867. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  4868. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  4869. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  4870. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  4871. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  4872. });
  4873. }
  4874. function updateTransitionEndListener(box, action, listener) {
  4875. var method = action + "EventListener";
  4876. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  4877. box[method](event, listener);
  4878. });
  4879. }
  4880. function actualContains(parent, child) {
  4881. var target = child;
  4882. while (target) {
  4883. var _target$getRootNode;
  4884. if (parent.contains(target)) {
  4885. return true;
  4886. }
  4887. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  4888. }
  4889. return false;
  4890. }
  4891. var currentInput = {
  4892. isTouch: false
  4893. };
  4894. var lastMouseMoveTime = 0;
  4895. function onDocumentTouchStart() {
  4896. if (currentInput.isTouch) {
  4897. return;
  4898. }
  4899. currentInput.isTouch = true;
  4900. if (window.performance) {
  4901. document.addEventListener("mousemove", onDocumentMouseMove);
  4902. }
  4903. }
  4904. function onDocumentMouseMove() {
  4905. var now = performance.now();
  4906. if (now - lastMouseMoveTime < 20) {
  4907. currentInput.isTouch = false;
  4908. document.removeEventListener("mousemove", onDocumentMouseMove);
  4909. }
  4910. lastMouseMoveTime = now;
  4911. }
  4912. function onWindowBlur() {
  4913. var activeElement = document.activeElement;
  4914. if (isReferenceElement(activeElement)) {
  4915. var instance = activeElement._tippy;
  4916. if (activeElement.blur && !instance.state.isVisible) {
  4917. activeElement.blur();
  4918. }
  4919. }
  4920. }
  4921. function bindGlobalEventListeners() {
  4922. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  4923. window.addEventListener("blur", onWindowBlur);
  4924. }
  4925. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  4926. var isIE11 = isBrowser ? (
  4927. // @ts-ignore
  4928. !!window.msCrypto
  4929. ) : false;
  4930. var pluginProps = {
  4931. animateFill: false,
  4932. followCursor: false,
  4933. inlinePositioning: false,
  4934. sticky: false
  4935. };
  4936. var renderProps = {
  4937. allowHTML: false,
  4938. animation: "fade",
  4939. arrow: true,
  4940. content: "",
  4941. inertia: false,
  4942. maxWidth: 350,
  4943. role: "tooltip",
  4944. theme: "",
  4945. zIndex: 9999
  4946. };
  4947. var defaultProps = Object.assign({
  4948. appendTo: TIPPY_DEFAULT_APPEND_TO,
  4949. aria: {
  4950. content: "auto",
  4951. expanded: "auto"
  4952. },
  4953. delay: 0,
  4954. duration: [300, 250],
  4955. getReferenceClientRect: null,
  4956. hideOnClick: true,
  4957. ignoreAttributes: false,
  4958. interactive: false,
  4959. interactiveBorder: 2,
  4960. interactiveDebounce: 0,
  4961. moveTransition: "",
  4962. offset: [0, 10],
  4963. onAfterUpdate: function onAfterUpdate() {
  4964. },
  4965. onBeforeUpdate: function onBeforeUpdate() {
  4966. },
  4967. onCreate: function onCreate() {
  4968. },
  4969. onDestroy: function onDestroy() {
  4970. },
  4971. onHidden: function onHidden() {
  4972. },
  4973. onHide: function onHide() {
  4974. },
  4975. onMount: function onMount() {
  4976. },
  4977. onShow: function onShow() {
  4978. },
  4979. onShown: function onShown() {
  4980. },
  4981. onTrigger: function onTrigger() {
  4982. },
  4983. onUntrigger: function onUntrigger() {
  4984. },
  4985. onClickOutside: function onClickOutside() {
  4986. },
  4987. placement: "top",
  4988. plugins: [],
  4989. popperOptions: {},
  4990. render: null,
  4991. showOnCreate: false,
  4992. touch: true,
  4993. trigger: "mouseenter focus",
  4994. triggerTarget: null
  4995. }, pluginProps, renderProps);
  4996. var defaultKeys = Object.keys(defaultProps);
  4997. var setDefaultProps = function setDefaultProps2(partialProps) {
  4998. var keys = Object.keys(partialProps);
  4999. keys.forEach(function(key) {
  5000. defaultProps[key] = partialProps[key];
  5001. });
  5002. };
  5003. function getExtendedPassedProps(passedProps) {
  5004. var plugins = passedProps.plugins || [];
  5005. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  5006. var name = plugin.name, defaultValue = plugin.defaultValue;
  5007. if (name) {
  5008. var _name;
  5009. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  5010. }
  5011. return acc;
  5012. }, {});
  5013. return Object.assign({}, passedProps, pluginProps2);
  5014. }
  5015. function getDataAttributeProps(reference2, plugins) {
  5016. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  5017. plugins
  5018. }))) : defaultKeys;
  5019. var props = propKeys.reduce(function(acc, key) {
  5020. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  5021. if (!valueAsString) {
  5022. return acc;
  5023. }
  5024. if (key === "content") {
  5025. acc[key] = valueAsString;
  5026. } else {
  5027. try {
  5028. acc[key] = JSON.parse(valueAsString);
  5029. } catch (e) {
  5030. acc[key] = valueAsString;
  5031. }
  5032. }
  5033. return acc;
  5034. }, {});
  5035. return props;
  5036. }
  5037. function evaluateProps(reference2, props) {
  5038. var out = Object.assign({}, props, {
  5039. content: invokeWithArgsOrReturn(props.content, [reference2])
  5040. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  5041. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  5042. out.aria = {
  5043. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  5044. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  5045. };
  5046. return out;
  5047. }
  5048. var innerHTML = function innerHTML2() {
  5049. return "innerHTML";
  5050. };
  5051. function dangerouslySetInnerHTML(element, html) {
  5052. element[innerHTML()] = html;
  5053. }
  5054. function createArrowElement(value) {
  5055. var arrow2 = div();
  5056. if (value === true) {
  5057. arrow2.className = ARROW_CLASS;
  5058. } else {
  5059. arrow2.className = SVG_ARROW_CLASS;
  5060. if (isElement(value)) {
  5061. arrow2.appendChild(value);
  5062. } else {
  5063. dangerouslySetInnerHTML(arrow2, value);
  5064. }
  5065. }
  5066. return arrow2;
  5067. }
  5068. function setContent(content, props) {
  5069. if (isElement(props.content)) {
  5070. dangerouslySetInnerHTML(content, "");
  5071. content.appendChild(props.content);
  5072. } else if (typeof props.content !== "function") {
  5073. if (props.allowHTML) {
  5074. dangerouslySetInnerHTML(content, props.content);
  5075. } else {
  5076. content.textContent = props.content;
  5077. }
  5078. }
  5079. }
  5080. function getChildren(popper2) {
  5081. var box = popper2.firstElementChild;
  5082. var boxChildren = arrayFrom(box.children);
  5083. return {
  5084. box,
  5085. content: boxChildren.find(function(node) {
  5086. return node.classList.contains(CONTENT_CLASS);
  5087. }),
  5088. arrow: boxChildren.find(function(node) {
  5089. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  5090. }),
  5091. backdrop: boxChildren.find(function(node) {
  5092. return node.classList.contains(BACKDROP_CLASS);
  5093. })
  5094. };
  5095. }
  5096. function render(instance) {
  5097. var popper2 = div();
  5098. var box = div();
  5099. box.className = BOX_CLASS;
  5100. box.setAttribute("data-state", "hidden");
  5101. box.setAttribute("tabindex", "-1");
  5102. var content = div();
  5103. content.className = CONTENT_CLASS;
  5104. content.setAttribute("data-state", "hidden");
  5105. setContent(content, instance.props);
  5106. popper2.appendChild(box);
  5107. box.appendChild(content);
  5108. onUpdate(instance.props, instance.props);
  5109. function onUpdate(prevProps, nextProps) {
  5110. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  5111. if (nextProps.theme) {
  5112. box2.setAttribute("data-theme", nextProps.theme);
  5113. } else {
  5114. box2.removeAttribute("data-theme");
  5115. }
  5116. if (typeof nextProps.animation === "string") {
  5117. box2.setAttribute("data-animation", nextProps.animation);
  5118. } else {
  5119. box2.removeAttribute("data-animation");
  5120. }
  5121. if (nextProps.inertia) {
  5122. box2.setAttribute("data-inertia", "");
  5123. } else {
  5124. box2.removeAttribute("data-inertia");
  5125. }
  5126. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  5127. if (nextProps.role) {
  5128. box2.setAttribute("role", nextProps.role);
  5129. } else {
  5130. box2.removeAttribute("role");
  5131. }
  5132. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  5133. setContent(content2, instance.props);
  5134. }
  5135. if (nextProps.arrow) {
  5136. if (!arrow2) {
  5137. box2.appendChild(createArrowElement(nextProps.arrow));
  5138. } else if (prevProps.arrow !== nextProps.arrow) {
  5139. box2.removeChild(arrow2);
  5140. box2.appendChild(createArrowElement(nextProps.arrow));
  5141. }
  5142. } else if (arrow2) {
  5143. box2.removeChild(arrow2);
  5144. }
  5145. }
  5146. return {
  5147. popper: popper2,
  5148. onUpdate
  5149. };
  5150. }
  5151. render.$$tippy = true;
  5152. var idCounter = 1;
  5153. var mouseMoveListeners = [];
  5154. var mountedInstances = [];
  5155. function createTippy(reference2, passedProps) {
  5156. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  5157. var showTimeout;
  5158. var hideTimeout;
  5159. var scheduleHideAnimationFrame;
  5160. var isVisibleFromClick = false;
  5161. var didHideDueToDocumentMouseDown = false;
  5162. var didTouchMove = false;
  5163. var ignoreOnFirstUpdate = false;
  5164. var lastTriggerEvent;
  5165. var currentTransitionEndListener;
  5166. var onFirstUpdate;
  5167. var listeners = [];
  5168. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  5169. var currentTarget;
  5170. var id = idCounter++;
  5171. var popperInstance = null;
  5172. var plugins = unique(props.plugins);
  5173. var state = {
  5174. // Is the instance currently enabled?
  5175. isEnabled: true,
  5176. // Is the tippy currently showing and not transitioning out?
  5177. isVisible: false,
  5178. // Has the instance been destroyed?
  5179. isDestroyed: false,
  5180. // Is the tippy currently mounted to the DOM?
  5181. isMounted: false,
  5182. // Has the tippy finished transitioning in?
  5183. isShown: false
  5184. };
  5185. var instance = {
  5186. // properties
  5187. id,
  5188. reference: reference2,
  5189. popper: div(),
  5190. popperInstance,
  5191. props,
  5192. state,
  5193. plugins,
  5194. // methods
  5195. clearDelayTimeouts,
  5196. setProps,
  5197. setContent: setContent2,
  5198. show,
  5199. hide: hide2,
  5200. hideWithInteractivity,
  5201. enable,
  5202. disable,
  5203. unmount,
  5204. destroy
  5205. };
  5206. if (!props.render) {
  5207. return instance;
  5208. }
  5209. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  5210. popper2.setAttribute("data-tippy-root", "");
  5211. popper2.id = "tippy-" + instance.id;
  5212. instance.popper = popper2;
  5213. reference2._tippy = instance;
  5214. popper2._tippy = instance;
  5215. var pluginsHooks = plugins.map(function(plugin) {
  5216. return plugin.fn(instance);
  5217. });
  5218. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  5219. addListeners();
  5220. handleAriaExpandedAttribute();
  5221. handleStyles();
  5222. invokeHook("onCreate", [instance]);
  5223. if (props.showOnCreate) {
  5224. scheduleShow();
  5225. }
  5226. popper2.addEventListener("mouseenter", function() {
  5227. if (instance.props.interactive && instance.state.isVisible) {
  5228. instance.clearDelayTimeouts();
  5229. }
  5230. });
  5231. popper2.addEventListener("mouseleave", function() {
  5232. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  5233. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5234. }
  5235. });
  5236. return instance;
  5237. function getNormalizedTouchSettings() {
  5238. var touch = instance.props.touch;
  5239. return Array.isArray(touch) ? touch : [touch, 0];
  5240. }
  5241. function getIsCustomTouchBehavior() {
  5242. return getNormalizedTouchSettings()[0] === "hold";
  5243. }
  5244. function getIsDefaultRenderFn() {
  5245. var _instance$props$rende;
  5246. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  5247. }
  5248. function getCurrentTarget() {
  5249. return currentTarget || reference2;
  5250. }
  5251. function getDocument() {
  5252. var parent = getCurrentTarget().parentNode;
  5253. return parent ? getOwnerDocument(parent) : document;
  5254. }
  5255. function getDefaultTemplateChildren() {
  5256. return getChildren(popper2);
  5257. }
  5258. function getDelay(isShow) {
  5259. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  5260. return 0;
  5261. }
  5262. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  5263. }
  5264. function handleStyles(fromHide) {
  5265. if (fromHide === void 0) {
  5266. fromHide = false;
  5267. }
  5268. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  5269. popper2.style.zIndex = "" + instance.props.zIndex;
  5270. }
  5271. function invokeHook(hook, args, shouldInvokePropsHook) {
  5272. if (shouldInvokePropsHook === void 0) {
  5273. shouldInvokePropsHook = true;
  5274. }
  5275. pluginsHooks.forEach(function(pluginHooks) {
  5276. if (pluginHooks[hook]) {
  5277. pluginHooks[hook].apply(pluginHooks, args);
  5278. }
  5279. });
  5280. if (shouldInvokePropsHook) {
  5281. var _instance$props;
  5282. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  5283. }
  5284. }
  5285. function handleAriaContentAttribute() {
  5286. var aria = instance.props.aria;
  5287. if (!aria.content) {
  5288. return;
  5289. }
  5290. var attr = "aria-" + aria.content;
  5291. var id2 = popper2.id;
  5292. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5293. nodes.forEach(function(node) {
  5294. var currentValue = node.getAttribute(attr);
  5295. if (instance.state.isVisible) {
  5296. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  5297. } else {
  5298. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  5299. if (nextValue) {
  5300. node.setAttribute(attr, nextValue);
  5301. } else {
  5302. node.removeAttribute(attr);
  5303. }
  5304. }
  5305. });
  5306. }
  5307. function handleAriaExpandedAttribute() {
  5308. if (hasAriaExpanded || !instance.props.aria.expanded) {
  5309. return;
  5310. }
  5311. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5312. nodes.forEach(function(node) {
  5313. if (instance.props.interactive) {
  5314. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  5315. } else {
  5316. node.removeAttribute("aria-expanded");
  5317. }
  5318. });
  5319. }
  5320. function cleanupInteractiveMouseListeners() {
  5321. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  5322. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  5323. return listener !== debouncedOnMouseMove;
  5324. });
  5325. }
  5326. function onDocumentPress(event) {
  5327. if (currentInput.isTouch) {
  5328. if (didTouchMove || event.type === "mousedown") {
  5329. return;
  5330. }
  5331. }
  5332. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  5333. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  5334. return;
  5335. }
  5336. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  5337. return actualContains(el, actualTarget);
  5338. })) {
  5339. if (currentInput.isTouch) {
  5340. return;
  5341. }
  5342. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  5343. return;
  5344. }
  5345. } else {
  5346. invokeHook("onClickOutside", [instance, event]);
  5347. }
  5348. if (instance.props.hideOnClick === true) {
  5349. instance.clearDelayTimeouts();
  5350. instance.hide();
  5351. didHideDueToDocumentMouseDown = true;
  5352. setTimeout(function() {
  5353. didHideDueToDocumentMouseDown = false;
  5354. });
  5355. if (!instance.state.isMounted) {
  5356. removeDocumentPress();
  5357. }
  5358. }
  5359. }
  5360. function onTouchMove() {
  5361. didTouchMove = true;
  5362. }
  5363. function onTouchStart() {
  5364. didTouchMove = false;
  5365. }
  5366. function addDocumentPress() {
  5367. var doc = getDocument();
  5368. doc.addEventListener("mousedown", onDocumentPress, true);
  5369. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5370. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5371. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5372. }
  5373. function removeDocumentPress() {
  5374. var doc = getDocument();
  5375. doc.removeEventListener("mousedown", onDocumentPress, true);
  5376. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5377. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5378. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5379. }
  5380. function onTransitionedOut(duration, callback) {
  5381. onTransitionEnd(duration, function() {
  5382. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  5383. callback();
  5384. }
  5385. });
  5386. }
  5387. function onTransitionedIn(duration, callback) {
  5388. onTransitionEnd(duration, callback);
  5389. }
  5390. function onTransitionEnd(duration, callback) {
  5391. var box = getDefaultTemplateChildren().box;
  5392. function listener(event) {
  5393. if (event.target === box) {
  5394. updateTransitionEndListener(box, "remove", listener);
  5395. callback();
  5396. }
  5397. }
  5398. if (duration === 0) {
  5399. return callback();
  5400. }
  5401. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  5402. updateTransitionEndListener(box, "add", listener);
  5403. currentTransitionEndListener = listener;
  5404. }
  5405. function on(eventType, handler, options) {
  5406. if (options === void 0) {
  5407. options = false;
  5408. }
  5409. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5410. nodes.forEach(function(node) {
  5411. node.addEventListener(eventType, handler, options);
  5412. listeners.push({
  5413. node,
  5414. eventType,
  5415. handler,
  5416. options
  5417. });
  5418. });
  5419. }
  5420. function addListeners() {
  5421. if (getIsCustomTouchBehavior()) {
  5422. on("touchstart", onTrigger2, {
  5423. passive: true
  5424. });
  5425. on("touchend", onMouseLeave, {
  5426. passive: true
  5427. });
  5428. }
  5429. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  5430. if (eventType === "manual") {
  5431. return;
  5432. }
  5433. on(eventType, onTrigger2);
  5434. switch (eventType) {
  5435. case "mouseenter":
  5436. on("mouseleave", onMouseLeave);
  5437. break;
  5438. case "focus":
  5439. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  5440. break;
  5441. case "focusin":
  5442. on("focusout", onBlurOrFocusOut);
  5443. break;
  5444. }
  5445. });
  5446. }
  5447. function removeListeners() {
  5448. listeners.forEach(function(_ref) {
  5449. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  5450. node.removeEventListener(eventType, handler, options);
  5451. });
  5452. listeners = [];
  5453. }
  5454. function onTrigger2(event) {
  5455. var _lastTriggerEvent;
  5456. var shouldScheduleClickHide = false;
  5457. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  5458. return;
  5459. }
  5460. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  5461. lastTriggerEvent = event;
  5462. currentTarget = event.currentTarget;
  5463. handleAriaExpandedAttribute();
  5464. if (!instance.state.isVisible && isMouseEvent(event)) {
  5465. mouseMoveListeners.forEach(function(listener) {
  5466. return listener(event);
  5467. });
  5468. }
  5469. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  5470. shouldScheduleClickHide = true;
  5471. } else {
  5472. scheduleShow(event);
  5473. }
  5474. if (event.type === "click") {
  5475. isVisibleFromClick = !shouldScheduleClickHide;
  5476. }
  5477. if (shouldScheduleClickHide && !wasFocused) {
  5478. scheduleHide(event);
  5479. }
  5480. }
  5481. function onMouseMove(event) {
  5482. var target = event.target;
  5483. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  5484. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  5485. return;
  5486. }
  5487. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  5488. var _instance$popperInsta;
  5489. var instance2 = popper22._tippy;
  5490. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  5491. if (state2) {
  5492. return {
  5493. popperRect: popper22.getBoundingClientRect(),
  5494. popperState: state2,
  5495. props
  5496. };
  5497. }
  5498. return null;
  5499. }).filter(Boolean);
  5500. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  5501. cleanupInteractiveMouseListeners();
  5502. scheduleHide(event);
  5503. }
  5504. }
  5505. function onMouseLeave(event) {
  5506. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  5507. if (shouldBail) {
  5508. return;
  5509. }
  5510. if (instance.props.interactive) {
  5511. instance.hideWithInteractivity(event);
  5512. return;
  5513. }
  5514. scheduleHide(event);
  5515. }
  5516. function onBlurOrFocusOut(event) {
  5517. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  5518. return;
  5519. }
  5520. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  5521. return;
  5522. }
  5523. scheduleHide(event);
  5524. }
  5525. function isEventListenerStopped(event) {
  5526. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  5527. }
  5528. function createPopperInstance() {
  5529. destroyPopperInstance();
  5530. var _instance$props2 = instance.props, popperOptions = _instance$props2.popperOptions, placement = _instance$props2.placement, offset2 = _instance$props2.offset, getReferenceClientRect = _instance$props2.getReferenceClientRect, moveTransition = _instance$props2.moveTransition;
  5531. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  5532. var computedReference = getReferenceClientRect ? {
  5533. getBoundingClientRect: getReferenceClientRect,
  5534. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  5535. } : reference2;
  5536. var tippyModifier = {
  5537. name: "$$tippy",
  5538. enabled: true,
  5539. phase: "beforeWrite",
  5540. requires: ["computeStyles"],
  5541. fn: function fn5(_ref2) {
  5542. var state2 = _ref2.state;
  5543. if (getIsDefaultRenderFn()) {
  5544. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  5545. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  5546. if (attr === "placement") {
  5547. box.setAttribute("data-placement", state2.placement);
  5548. } else {
  5549. if (state2.attributes.popper["data-popper-" + attr]) {
  5550. box.setAttribute("data-" + attr, "");
  5551. } else {
  5552. box.removeAttribute("data-" + attr);
  5553. }
  5554. }
  5555. });
  5556. state2.attributes.popper = {};
  5557. }
  5558. }
  5559. };
  5560. var modifiers = [{
  5561. name: "offset",
  5562. options: {
  5563. offset: offset2
  5564. }
  5565. }, {
  5566. name: "preventOverflow",
  5567. options: {
  5568. padding: {
  5569. top: 2,
  5570. bottom: 2,
  5571. left: 5,
  5572. right: 5
  5573. }
  5574. }
  5575. }, {
  5576. name: "flip",
  5577. options: {
  5578. padding: 5
  5579. }
  5580. }, {
  5581. name: "computeStyles",
  5582. options: {
  5583. adaptive: !moveTransition
  5584. }
  5585. }, tippyModifier];
  5586. if (getIsDefaultRenderFn() && arrow2) {
  5587. modifiers.push({
  5588. name: "arrow",
  5589. options: {
  5590. element: arrow2,
  5591. padding: 3
  5592. }
  5593. });
  5594. }
  5595. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  5596. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  5597. placement,
  5598. onFirstUpdate,
  5599. modifiers
  5600. }));
  5601. }
  5602. function destroyPopperInstance() {
  5603. if (instance.popperInstance) {
  5604. instance.popperInstance.destroy();
  5605. instance.popperInstance = null;
  5606. }
  5607. }
  5608. function mount() {
  5609. var appendTo = instance.props.appendTo;
  5610. var parentNode;
  5611. var node = getCurrentTarget();
  5612. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  5613. parentNode = node.parentNode;
  5614. } else {
  5615. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  5616. }
  5617. if (!parentNode.contains(popper2)) {
  5618. parentNode.appendChild(popper2);
  5619. }
  5620. instance.state.isMounted = true;
  5621. createPopperInstance();
  5622. }
  5623. function getNestedPopperTree() {
  5624. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  5625. }
  5626. function scheduleShow(event) {
  5627. instance.clearDelayTimeouts();
  5628. if (event) {
  5629. invokeHook("onTrigger", [instance, event]);
  5630. }
  5631. addDocumentPress();
  5632. var delay = getDelay(true);
  5633. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  5634. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  5635. delay = touchDelay;
  5636. }
  5637. if (delay) {
  5638. showTimeout = setTimeout(function() {
  5639. instance.show();
  5640. }, delay);
  5641. } else {
  5642. instance.show();
  5643. }
  5644. }
  5645. function scheduleHide(event) {
  5646. instance.clearDelayTimeouts();
  5647. invokeHook("onUntrigger", [instance, event]);
  5648. if (!instance.state.isVisible) {
  5649. removeDocumentPress();
  5650. return;
  5651. }
  5652. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  5653. return;
  5654. }
  5655. var delay = getDelay(false);
  5656. if (delay) {
  5657. hideTimeout = setTimeout(function() {
  5658. if (instance.state.isVisible) {
  5659. instance.hide();
  5660. }
  5661. }, delay);
  5662. } else {
  5663. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  5664. instance.hide();
  5665. });
  5666. }
  5667. }
  5668. function enable() {
  5669. instance.state.isEnabled = true;
  5670. }
  5671. function disable() {
  5672. instance.hide();
  5673. instance.state.isEnabled = false;
  5674. }
  5675. function clearDelayTimeouts() {
  5676. clearTimeout(showTimeout);
  5677. clearTimeout(hideTimeout);
  5678. cancelAnimationFrame(scheduleHideAnimationFrame);
  5679. }
  5680. function setProps(partialProps) {
  5681. if (instance.state.isDestroyed) {
  5682. return;
  5683. }
  5684. invokeHook("onBeforeUpdate", [instance, partialProps]);
  5685. removeListeners();
  5686. var prevProps = instance.props;
  5687. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  5688. ignoreAttributes: true
  5689. }));
  5690. instance.props = nextProps;
  5691. addListeners();
  5692. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  5693. cleanupInteractiveMouseListeners();
  5694. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  5695. }
  5696. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  5697. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  5698. node.removeAttribute("aria-expanded");
  5699. });
  5700. } else if (nextProps.triggerTarget) {
  5701. reference2.removeAttribute("aria-expanded");
  5702. }
  5703. handleAriaExpandedAttribute();
  5704. handleStyles();
  5705. if (onUpdate) {
  5706. onUpdate(prevProps, nextProps);
  5707. }
  5708. if (instance.popperInstance) {
  5709. createPopperInstance();
  5710. getNestedPopperTree().forEach(function(nestedPopper) {
  5711. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  5712. });
  5713. }
  5714. invokeHook("onAfterUpdate", [instance, partialProps]);
  5715. }
  5716. function setContent2(content) {
  5717. instance.setProps({
  5718. content
  5719. });
  5720. }
  5721. function show() {
  5722. var isAlreadyVisible = instance.state.isVisible;
  5723. var isDestroyed = instance.state.isDestroyed;
  5724. var isDisabled = !instance.state.isEnabled;
  5725. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  5726. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  5727. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  5728. return;
  5729. }
  5730. if (getCurrentTarget().hasAttribute("disabled")) {
  5731. return;
  5732. }
  5733. invokeHook("onShow", [instance], false);
  5734. if (instance.props.onShow(instance) === false) {
  5735. return;
  5736. }
  5737. instance.state.isVisible = true;
  5738. if (getIsDefaultRenderFn()) {
  5739. popper2.style.visibility = "visible";
  5740. }
  5741. handleStyles();
  5742. addDocumentPress();
  5743. if (!instance.state.isMounted) {
  5744. popper2.style.transition = "none";
  5745. }
  5746. if (getIsDefaultRenderFn()) {
  5747. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  5748. setTransitionDuration([box, content], 0);
  5749. }
  5750. onFirstUpdate = function onFirstUpdate2() {
  5751. var _instance$popperInsta2;
  5752. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  5753. return;
  5754. }
  5755. ignoreOnFirstUpdate = true;
  5756. void popper2.offsetHeight;
  5757. popper2.style.transition = instance.props.moveTransition;
  5758. if (getIsDefaultRenderFn() && instance.props.animation) {
  5759. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  5760. setTransitionDuration([_box, _content], duration);
  5761. setVisibilityState([_box, _content], "visible");
  5762. }
  5763. handleAriaContentAttribute();
  5764. handleAriaExpandedAttribute();
  5765. pushIfUnique(mountedInstances, instance);
  5766. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  5767. invokeHook("onMount", [instance]);
  5768. if (instance.props.animation && getIsDefaultRenderFn()) {
  5769. onTransitionedIn(duration, function() {
  5770. instance.state.isShown = true;
  5771. invokeHook("onShown", [instance]);
  5772. });
  5773. }
  5774. };
  5775. mount();
  5776. }
  5777. function hide2() {
  5778. var isAlreadyHidden = !instance.state.isVisible;
  5779. var isDestroyed = instance.state.isDestroyed;
  5780. var isDisabled = !instance.state.isEnabled;
  5781. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  5782. if (isAlreadyHidden || isDestroyed || isDisabled) {
  5783. return;
  5784. }
  5785. invokeHook("onHide", [instance], false);
  5786. if (instance.props.onHide(instance) === false) {
  5787. return;
  5788. }
  5789. instance.state.isVisible = false;
  5790. instance.state.isShown = false;
  5791. ignoreOnFirstUpdate = false;
  5792. isVisibleFromClick = false;
  5793. if (getIsDefaultRenderFn()) {
  5794. popper2.style.visibility = "hidden";
  5795. }
  5796. cleanupInteractiveMouseListeners();
  5797. removeDocumentPress();
  5798. handleStyles(true);
  5799. if (getIsDefaultRenderFn()) {
  5800. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  5801. if (instance.props.animation) {
  5802. setTransitionDuration([box, content], duration);
  5803. setVisibilityState([box, content], "hidden");
  5804. }
  5805. }
  5806. handleAriaContentAttribute();
  5807. handleAriaExpandedAttribute();
  5808. if (instance.props.animation) {
  5809. if (getIsDefaultRenderFn()) {
  5810. onTransitionedOut(duration, instance.unmount);
  5811. }
  5812. } else {
  5813. instance.unmount();
  5814. }
  5815. }
  5816. function hideWithInteractivity(event) {
  5817. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5818. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  5819. debouncedOnMouseMove(event);
  5820. }
  5821. function unmount() {
  5822. if (instance.state.isVisible) {
  5823. instance.hide();
  5824. }
  5825. if (!instance.state.isMounted) {
  5826. return;
  5827. }
  5828. destroyPopperInstance();
  5829. getNestedPopperTree().forEach(function(nestedPopper) {
  5830. nestedPopper._tippy.unmount();
  5831. });
  5832. if (popper2.parentNode) {
  5833. popper2.parentNode.removeChild(popper2);
  5834. }
  5835. mountedInstances = mountedInstances.filter(function(i) {
  5836. return i !== instance;
  5837. });
  5838. instance.state.isMounted = false;
  5839. invokeHook("onHidden", [instance]);
  5840. }
  5841. function destroy() {
  5842. if (instance.state.isDestroyed) {
  5843. return;
  5844. }
  5845. instance.clearDelayTimeouts();
  5846. instance.unmount();
  5847. removeListeners();
  5848. delete reference2._tippy;
  5849. instance.state.isDestroyed = true;
  5850. invokeHook("onDestroy", [instance]);
  5851. }
  5852. }
  5853. function tippy(targets, optionalProps) {
  5854. if (optionalProps === void 0) {
  5855. optionalProps = {};
  5856. }
  5857. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  5858. bindGlobalEventListeners();
  5859. var passedProps = Object.assign({}, optionalProps, {
  5860. plugins
  5861. });
  5862. var elements = getArrayOfElements(targets);
  5863. var instances = elements.reduce(function(acc, reference2) {
  5864. var instance = reference2 && createTippy(reference2, passedProps);
  5865. if (instance) {
  5866. acc.push(instance);
  5867. }
  5868. return acc;
  5869. }, []);
  5870. return isElement(targets) ? instances[0] : instances;
  5871. }
  5872. tippy.defaultProps = defaultProps;
  5873. tippy.setDefaultProps = setDefaultProps;
  5874. tippy.currentInput = currentInput;
  5875. Object.assign({}, applyStyles$1, {
  5876. effect: function effect2(_ref) {
  5877. var state = _ref.state;
  5878. var initialStyles = {
  5879. popper: {
  5880. position: state.options.strategy,
  5881. left: "0",
  5882. top: "0",
  5883. margin: "0"
  5884. },
  5885. arrow: {
  5886. position: "absolute"
  5887. },
  5888. reference: {}
  5889. };
  5890. Object.assign(state.elements.popper.style, initialStyles.popper);
  5891. state.styles = initialStyles;
  5892. if (state.elements.arrow) {
  5893. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5894. }
  5895. }
  5896. });
  5897. tippy.setDefaultProps({
  5898. render
  5899. });
  5900.  
  5901. })
  5902. };
  5903. }));
  5904.  
  5905. System.import("./__entry.js", "./");