JSON Viewer

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

当前为 2024-11-04 提交的版本,查看 最新版本

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