JSON Viewer

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

当前为 2024-10-26 提交的版本,查看 最新版本

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址