JSON Viewer

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

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

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version v0.9.2
  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:12px;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:12px;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}@media screen and (max-width: 640px){.rightbox{right:0!important}.rightbox .tools{display:none!important}}@media screen and (max-width: 400px){.searchbox{display:none!important}}.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-CQv26x-w.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-CQv26x-w.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. const viewport = '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
  2079. $(document.head).append(`<link href="${LAYUI_CSS}" rel="stylesheet"/>`).append(`<script src="${LAYUI_JS}" type="text/javascript"><\/script>`).append(viewport);
  2080. _GM_addStyle(`
  2081. jmnode.root::before{background-color: ${Utils.randomColor(0.5)}}
  2082. jmnode:not(.root)::before{background-color: ${Utils.randomColor(0.5)}}
  2083. `);
  2084. setTimeout(() => {
  2085. _unsafeWindow.GLOBAL_JSON = JSONbig({ useNativeBigInt: true }).parse(
  2086. _unsafeWindow.RAW_TEXT
  2087. );
  2088. document.body.insertAdjacentHTML("afterbegin", layout);
  2089. __vitePreload(() => module.import('./index-D82bj0yN-BQ2fmGNf.js'), void 0 ).then((format) => format.default.init()).then(() => __vitePreload(() => module.import('./index-BD0UcGGX-SFPCM2-n.js'), void 0 )).then(() => __vitePreload(() => module.import('./index-D3l8MoSf-Dhsxm64a.js'), void 0 ));
  2090. });
  2091. })();
  2092.  
  2093. })
  2094. };
  2095. }));
  2096.  
  2097. System.register("./index-mjXXc9V1-CzTRTL8e.js", ['highlight.js', 'beautifier'], (function (exports, module) {
  2098. 'use strict';
  2099. var hljs, css_beautify, js_beautify;
  2100. return {
  2101. setters: [module => {
  2102. hljs = module.default;
  2103. }, module => {
  2104. css_beautify = module.css_beautify;
  2105. js_beautify = module.js_beautify;
  2106. }],
  2107. execute: (function () {
  2108.  
  2109. const layout = `
  2110. <div class="beautify_checkbox">
  2111. <input type="checkbox" id="beautify"/>
  2112. <label for="beautify">美化输出</label>
  2113. </div>`;
  2114. (function() {
  2115. const docType = [
  2116. "application/x-javascript",
  2117. "application/javascript",
  2118. "text/javascript",
  2119. "text/css"
  2120. ];
  2121. const contentType = document.contentType;
  2122. if (!docType.includes(contentType)) {
  2123. return;
  2124. }
  2125. const preElement = document.querySelector("pre");
  2126. if (!preElement) {
  2127. return;
  2128. }
  2129. window.postMessage({ addStyle: true });
  2130. document.querySelector("html").classList.add("monkey-js-css-beautify");
  2131. setTimeout(() => {
  2132. const rawText = preElement.innerText;
  2133. document.body.insertAdjacentHTML("afterbegin", layout);
  2134. const checkbox = document.querySelector(".beautify_checkbox input");
  2135. checkbox.addEventListener("click", function() {
  2136. if (this.checked) {
  2137. beautifyCode(contentType, preElement, rawText);
  2138. } else {
  2139. preElement.innerText = rawText;
  2140. }
  2141. });
  2142. });
  2143. })();
  2144. function beautifyCode(contentType, element, rawText) {
  2145. const language = contentType.substring(contentType.indexOf("/") + 1);
  2146. if (!["css", "javascript", "x-javascript"].includes(language)) {
  2147. return;
  2148. }
  2149. let beautifyCode2;
  2150. if ("css" === language) {
  2151. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  2152. beautifyCode2 = cssBeautify(rawText);
  2153. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2154. language
  2155. }).value;
  2156. } else {
  2157. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  2158. beautifyCode2 = jsBeautify(rawText);
  2159. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2160. language: "javascript"
  2161. }).value;
  2162. }
  2163. element.innerHTML = `<code>${beautifyCode2}</code>`;
  2164. }
  2165.  
  2166. })
  2167. };
  2168. }));
  2169.  
  2170. System.register("./index-D82bj0yN-BQ2fmGNf.js", ['jquery', './__monkey.entry-CQv26x-w.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js'], (function (exports, module) {
  2171. 'use strict';
  2172. var $, _GM_setValue, _GM_getValue, _unsafeWindow, Utils, _GM_setClipboard, tippy;
  2173. return {
  2174. setters: [module => {
  2175. $ = module.default;
  2176. }, module => {
  2177. _GM_setValue = module._;
  2178. _GM_getValue = module.a;
  2179. _unsafeWindow = module.b;
  2180. Utils = module.U;
  2181. _GM_setClipboard = module.c;
  2182. }, module => {
  2183. tippy = module.t;
  2184. }],
  2185. execute: (function () {
  2186.  
  2187. (function($2) {
  2188. function isCollapsable(arg) {
  2189. return arg && typeof arg === "object" && Object.keys(arg).length > 0;
  2190. }
  2191. function json2html(json, parentPath = "") {
  2192. let html = "";
  2193. const type = Utils.getType(json);
  2194. switch (type) {
  2195. case "array":
  2196. case "object":
  2197. let len = json.length || Object.keys(json).length;
  2198. if (len > 0) {
  2199. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  2200. html += type === "array" ? '[</span><ol class="json-array">' : '{</span><ul class="json-object">';
  2201. for (var key in json) {
  2202. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2203. const comma = --len > 0 ? "," : "";
  2204. const jsonPath = parentPath + "." + key;
  2205. const collapse = isCollapsable(json[key]) ? '<a href class="json-toggle"></a>' : "";
  2206. const res = json2html(json[key], jsonPath);
  2207. let toHtml = res;
  2208. if (type !== "array") {
  2209. toHtml = `<span class="json-key">"${key}"</span>: ${res}`;
  2210. }
  2211. html += [
  2212. `<li json-path="${jsonPath}">`,
  2213. collapse,
  2214. toHtml,
  2215. comma,
  2216. "</li>"
  2217. ].join("");
  2218. }
  2219. }
  2220. if (type === "array") {
  2221. html += `</ol><span class="json-brackets json-square-brackets">]</span>`;
  2222. } else {
  2223. html += `</ul><span class="json-brackets json-curly-brackets">}</span>`;
  2224. }
  2225. } else {
  2226. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  2227. html += type === "array" ? "[]" : "{}";
  2228. html += "</span>";
  2229. }
  2230. break;
  2231. default:
  2232. if (type === "string") {
  2233. json = json.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  2234. }
  2235. if (Utils.isUrl(json)) {
  2236. html += `<a target="_blank" href="${json}" class="json-string">"${json}"</a>`;
  2237. } else {
  2238. json = type === "string" ? `"${json}"` : json;
  2239. html += `<span class="json-${type}">${json}</span>`;
  2240. }
  2241. break;
  2242. }
  2243. return html;
  2244. }
  2245. $2.fn.jsonViewer = function(json, jsonpFn) {
  2246. return this.each(function() {
  2247. var html = json2html(json);
  2248. if (jsonpFn !== void 0 && jsonpFn !== null) {
  2249. html = `<div class="jsonp">${jsonpFn}(</div>${html}<div class="jsonp">)</div>`;
  2250. }
  2251. $2(this).html(html);
  2252. $2(this).off("click");
  2253. $2(this).on("click", "a.json-toggle", function() {
  2254. var target = $2(this).toggleClass("collapsed").siblings("ul.json-object, ol.json-array");
  2255. target.toggle();
  2256. if (target.is(":visible")) {
  2257. target.siblings(".json-placeholder").remove();
  2258. } else {
  2259. let clas = target.attr("class");
  2260. clas = clas.substring(clas.indexOf("-") + 1);
  2261. var count = target.children('li:not([class*="hidden"])').length;
  2262. var placeholder = count + (count > 1 ? " items" : " item");
  2263. if (clas === "object") {
  2264. placeholder = count + (count > 1 ? " keys" : " key");
  2265. }
  2266. target.after(`<a href class="json-placeholder">${placeholder}</a>`);
  2267. }
  2268. return false;
  2269. });
  2270. $2(this).on("click", "a.json-placeholder", function() {
  2271. $2(this).siblings("a.json-toggle").trigger("click");
  2272. $2(this).siblings("a.json-placeholder").remove();
  2273. return false;
  2274. });
  2275. });
  2276. };
  2277. })($);
  2278. !function(e) {
  2279. var t = {};
  2280. function n(o) {
  2281. if (t[o]) return t[o].exports;
  2282. var i = t[o] = { i: o, l: false, exports: {} };
  2283. return e[o].call(i.exports, i, i.exports, n), i.l = true, i.exports;
  2284. }
  2285. n.m = e, n.c = t, n.d = function(e2, t2, o) {
  2286. n.o(e2, t2) || Object.defineProperty(e2, t2, { enumerable: true, get: o });
  2287. }, n.r = function(e2) {
  2288. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
  2289. }, n.t = function(e2, t2) {
  2290. if (1 & t2 && (e2 = n(e2)), 8 & t2) return e2;
  2291. if (4 & t2 && "object" == typeof e2 && e2 && e2.__esModule) return e2;
  2292. var o = /* @__PURE__ */ Object.create(null);
  2293. 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) {
  2294. return e2[t3];
  2295. }).bind(null, i));
  2296. return o;
  2297. }, n.n = function(e2) {
  2298. var t2 = e2 && e2.__esModule ? function() {
  2299. return e2.default;
  2300. } : function() {
  2301. return e2;
  2302. };
  2303. return n.d(t2, "a", t2), t2;
  2304. }, n.o = function(e2, t2) {
  2305. return Object.prototype.hasOwnProperty.call(e2, t2);
  2306. }, n.p = "/dist", n(n.s = 5);
  2307. }([function(e, t) {
  2308. e.exports = $;
  2309. }, function(e, t, n) {
  2310. var o = n(2), i = n(3);
  2311. "string" == typeof (i = i.__esModule ? i.default : i) && (i = [[e.i, i, ""]]);
  2312. var a = { insert: "head", singleton: false };
  2313. o(i, a);
  2314. e.exports = i.locals || {};
  2315. }, function(e, t, n) {
  2316. var o, i = function() {
  2317. return void 0 === o && (o = Boolean(window && document && document.all && !window.atob)), o;
  2318. }, a = /* @__PURE__ */ function() {
  2319. var e2 = {};
  2320. return function(t2) {
  2321. if (void 0 === e2[t2]) {
  2322. var n2 = document.querySelector(t2);
  2323. if (window.HTMLIFrameElement && n2 instanceof window.HTMLIFrameElement) try {
  2324. n2 = n2.contentDocument.head;
  2325. } catch (e3) {
  2326. n2 = null;
  2327. }
  2328. e2[t2] = n2;
  2329. }
  2330. return e2[t2];
  2331. };
  2332. }(), r = [];
  2333. function s(e2) {
  2334. for (var t2 = -1, n2 = 0; n2 < r.length; n2++) if (r[n2].identifier === e2) {
  2335. t2 = n2;
  2336. break;
  2337. }
  2338. return t2;
  2339. }
  2340. function c(e2, t2) {
  2341. for (var n2 = {}, o2 = [], i2 = 0; i2 < e2.length; i2++) {
  2342. var a2 = e2[i2], c2 = t2.base ? a2[0] + t2.base : a2[0], l2 = n2[c2] || 0, u2 = "".concat(c2, " ").concat(l2);
  2343. n2[c2] = l2 + 1;
  2344. var d2 = s(u2), f2 = { css: a2[1], media: a2[2], sourceMap: a2[3] };
  2345. -1 !== d2 ? (r[d2].references++, r[d2].updater(f2)) : r.push({ identifier: u2, updater: y(f2, t2), references: 1 }), o2.push(u2);
  2346. }
  2347. return o2;
  2348. }
  2349. function l(e2) {
  2350. var t2 = document.createElement("style"), o2 = e2.attributes || {};
  2351. if (void 0 === o2.nonce) {
  2352. var i2 = n.nc;
  2353. i2 && (o2.nonce = i2);
  2354. }
  2355. if (Object.keys(o2).forEach(function(e3) {
  2356. t2.setAttribute(e3, o2[e3]);
  2357. }), "function" == typeof e2.insert) e2.insert(t2);
  2358. else {
  2359. var r2 = a(e2.insert || "head");
  2360. if (!r2) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  2361. r2.appendChild(t2);
  2362. }
  2363. return t2;
  2364. }
  2365. var u, d = (u = [], function(e2, t2) {
  2366. return u[e2] = t2, u.filter(Boolean).join("\n");
  2367. });
  2368. function f(e2, t2, n2, o2) {
  2369. var i2 = n2 ? "" : o2.media ? "@media ".concat(o2.media, " {").concat(o2.css, "}") : o2.css;
  2370. if (e2.styleSheet) e2.styleSheet.cssText = d(t2, i2);
  2371. else {
  2372. var a2 = document.createTextNode(i2), r2 = e2.childNodes;
  2373. r2[t2] && e2.removeChild(r2[t2]), r2.length ? e2.insertBefore(a2, r2[t2]) : e2.appendChild(a2);
  2374. }
  2375. }
  2376. function h(e2, t2, n2) {
  2377. var o2 = n2.css, i2 = n2.media, a2 = n2.sourceMap;
  2378. 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;
  2379. else {
  2380. for (; e2.firstChild; ) e2.removeChild(e2.firstChild);
  2381. e2.appendChild(document.createTextNode(o2));
  2382. }
  2383. }
  2384. var p = null, v = 0;
  2385. function y(e2, t2) {
  2386. var n2, o2, i2;
  2387. if (t2.singleton) {
  2388. var a2 = v++;
  2389. n2 = p || (p = l(t2)), o2 = f.bind(null, n2, a2, false), i2 = f.bind(null, n2, a2, true);
  2390. } else n2 = l(t2), o2 = h.bind(null, n2, t2), i2 = function() {
  2391. !function(e3) {
  2392. if (null === e3.parentNode) return false;
  2393. e3.parentNode.removeChild(e3);
  2394. }(n2);
  2395. };
  2396. return o2(e2), function(t3) {
  2397. if (t3) {
  2398. if (t3.css === e2.css && t3.media === e2.media && t3.sourceMap === e2.sourceMap) return;
  2399. o2(e2 = t3);
  2400. } else i2();
  2401. };
  2402. }
  2403. e.exports = function(e2, t2) {
  2404. (t2 = t2 || {}).singleton || "boolean" == typeof t2.singleton || (t2.singleton = i());
  2405. var n2 = c(e2 = e2 || [], t2);
  2406. return function(e3) {
  2407. if (e3 = e3 || [], "[object Array]" === Object.prototype.toString.call(e3)) {
  2408. for (var o2 = 0; o2 < n2.length; o2++) {
  2409. var i2 = s(n2[o2]);
  2410. r[i2].references--;
  2411. }
  2412. for (var a2 = c(e3, t2), l2 = 0; l2 < n2.length; l2++) {
  2413. var u2 = s(n2[l2]);
  2414. 0 === r[u2].references && (r[u2].updater(), r.splice(u2, 1));
  2415. }
  2416. n2 = a2;
  2417. }
  2418. };
  2419. };
  2420. }, function(e, t, n) {
  2421. (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;
  2422. }, function(e, t, n) {
  2423. e.exports = function(e2) {
  2424. var t2 = [];
  2425. return t2.toString = function() {
  2426. return this.map(function(t3) {
  2427. var n2 = function(e3, t4) {
  2428. var n3 = e3[1] || "", o = e3[3];
  2429. if (!o) return n3;
  2430. if (t4 && "function" == typeof btoa) {
  2431. 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) {
  2432. return "/*# sourceURL=".concat(o.sourceRoot || "").concat(e4, " */");
  2433. });
  2434. return [n3].concat(a).concat([i]).join("\n");
  2435. }
  2436. var r, s, c;
  2437. return [n3].join("\n");
  2438. }(t3, e2);
  2439. return t3[2] ? "@media ".concat(t3[2], " {").concat(n2, "}") : n2;
  2440. }).join("");
  2441. }, t2.i = function(e3, n2, o) {
  2442. "string" == typeof e3 && (e3 = [[null, e3, ""]]);
  2443. var i = {};
  2444. if (o) for (var a = 0; a < this.length; a++) {
  2445. var r = this[a][0];
  2446. null != r && (i[r] = true);
  2447. }
  2448. for (var s = 0; s < e3.length; s++) {
  2449. var c = [].concat(e3[s]);
  2450. o && i[c[0]] || (n2 && (c[2] ? c[2] = "".concat(n2, " and ").concat(c[2]) : c[2] = n2), t2.push(c));
  2451. }
  2452. }, t2;
  2453. };
  2454. }, function(e, t, n) {
  2455. n.r(t);
  2456. var o = n(0), i = n.n(o);
  2457. function a(e2, t2) {
  2458. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  2459. }
  2460. function r(e2, t2) {
  2461. for (var n2 = 0; n2 < t2.length; n2++) {
  2462. var o2 = t2[n2];
  2463. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  2464. }
  2465. }
  2466. function s(e2, t2, n2) {
  2467. return t2 && r(e2.prototype, t2), e2;
  2468. }
  2469. var c = function() {
  2470. function e2() {
  2471. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  2472. a(this, e2), this.opts = { type: t2.type || "session", key: t2.key }, this.inst = new l(this.opts);
  2473. }
  2474. return s(e2, [{ key: "get", value: function() {
  2475. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
  2476. return this.inst.get(this.opts.key) || e3;
  2477. } }, { key: "set", value: function(e3) {
  2478. this.inst.set(this.opts.key, e3);
  2479. } }, { key: "remove", value: function() {
  2480. this.inst.remove(this.opts.key);
  2481. } }]), e2;
  2482. }(), l = function() {
  2483. function e2() {
  2484. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  2485. a(this, e2), this.storage = { local: window.localStorage, session: window.sessionStorage }[t2.type];
  2486. }
  2487. return s(e2, [{ key: "get", value: function(e3) {
  2488. try {
  2489. var t2 = this.storage.getItem(e3);
  2490. return t2 ? JSON.parse(t2) : null;
  2491. } catch (e4) {
  2492. return console.log(e4), null;
  2493. }
  2494. } }, { key: "set", value: function(e3, t2) {
  2495. try {
  2496. this.storage.setItem(e3, JSON.stringify(t2));
  2497. } catch (e4) {
  2498. console.log(e4);
  2499. }
  2500. } }, { key: "remove", value: function(e3) {
  2501. this.storage.removeItem(e3);
  2502. } }]), e2;
  2503. }(), u = (n(1), "simple-tree-table");
  2504. function d(e2, t2) {
  2505. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  2506. }
  2507. function f(e2, t2) {
  2508. for (var n2 = 0; n2 < t2.length; n2++) {
  2509. var o2 = t2[n2];
  2510. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  2511. }
  2512. }
  2513. var h = { expander: null, collapser: null, opened: "all", margin: 20, iconPosition: "> :first-child", iconTemplate: "<span />", store: null, storeKey: null }, p = function() {
  2514. function e2(t3) {
  2515. var n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  2516. 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();
  2517. }
  2518. var t2, n2, o2;
  2519. return t2 = e2, o2 = [{ key: "getDefaults", value: function() {
  2520. return h;
  2521. } }, { key: "setDefaults", value: function(e3) {
  2522. return i.a.extend(h, e3);
  2523. } }], (n2 = [{ key: "init", value: function() {
  2524. this.$table.addClass(u), this.build(), this.unbind(), this.bind();
  2525. } }, { key: "destroy", value: function() {
  2526. var e3 = function(e4, t3) {
  2527. var n3 = new RegExp("".concat(u, "(-\\S+)?"), "g");
  2528. return (t3.match(n3) || []).join(" ");
  2529. };
  2530. this.$table.removeClass(e3), this.nodes().removeClass(e3), this.$table.find(".".concat(u, "-icon")).remove(), this.unbind();
  2531. } }, { key: "build", value: function() {
  2532. var e3 = this;
  2533. this.nodes().not("[data-node-depth]").each(function(t3, n3) {
  2534. var o3 = i()(n3), a2 = e3.depth(o3);
  2535. o3.data("node-depth", a2), 1 == a2 && o3.addClass("".concat(u, "-root"));
  2536. }), this.nodes().filter(function(t3, n3) {
  2537. return 0 == i()(n3).find(e3.options.iconPosition).find(".".concat(u, "-handler")).length;
  2538. }).each(function(t3, n3) {
  2539. 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"));
  2540. o3.find(e3.options.iconPosition).prepend(s2);
  2541. }), this.nodes().not(".".concat(u, "-empty, .").concat(u, "-opened, .").concat(u, "-closed")).each(function(t3, n3) {
  2542. var o3 = i()(n3);
  2543. e3.hasChildren(o3) ? e3.opensDefault(o3) ? o3.addClass("".concat(u, "-opened")) : o3.addClass("".concat(u, "-closed")) : o3.addClass("".concat(u, "-empty"));
  2544. }), this.nodes().filter(".".concat(u, "-opened")).each(function(t3, n3) {
  2545. e3.show(i()(n3));
  2546. }), this.nodes().filter(".".concat(u, "-closed")).each(function(t3, n3) {
  2547. e3.hide(i()(n3));
  2548. });
  2549. } }, { key: "opensDefault", value: function(e3) {
  2550. var t3 = this.options.opened;
  2551. return t3 && ("all" == t3 || -1 != t3.indexOf(e3.data("node-id")));
  2552. } }, { key: "bind", value: function() {
  2553. var e3 = this;
  2554. this.$expander.on("click.".concat(u), function(t3) {
  2555. e3.expand();
  2556. }), this.$collapser.on("click.".concat(u), function(t3) {
  2557. e3.collapse();
  2558. }), this.$table.on("click.".concat(u), "tr .".concat(u, "-handler"), function(t3) {
  2559. var n3 = i()(t3.currentTarget).closest("tr");
  2560. n3.hasClass("".concat(u, "-opened")) ? e3.close(n3) : e3.open(n3);
  2561. });
  2562. } }, { key: "unbind", value: function() {
  2563. this.$expander.off(".".concat(u)), this.$collapser.off(".".concat(u)), this.$table.off(".".concat(u, " node:open node:close"));
  2564. } }, { key: "expand", value: function() {
  2565. var e3 = this;
  2566. this.nodes().each(function(t3, n3) {
  2567. e3.show(i()(n3));
  2568. }), this.save();
  2569. } }, { key: "collapse", value: function() {
  2570. var e3 = this;
  2571. this.nodes().each(function(t3, n3) {
  2572. e3.hide(i()(n3));
  2573. }), this.save();
  2574. } }, { key: "nodes", value: function() {
  2575. return this.$table.find("tr[data-node-id]");
  2576. } }, { key: "depth", value: function(e3) {
  2577. var t3 = e3.data("node-depth");
  2578. if (t3) return t3;
  2579. var n3 = this.findByID(e3.data("node-pid"));
  2580. return 0 != n3.length ? this.depth(n3) + 1 : 1;
  2581. } }, { key: "open", value: function(e3) {
  2582. this.show(e3), this.save(), e3.trigger("node:open", [e3]);
  2583. } }, { key: "show", value: function(e3) {
  2584. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-closed")).addClass("".concat(u, "-opened")), this.showDescs(e3));
  2585. } }, { key: "showDescs", value: function(e3) {
  2586. var t3 = this;
  2587. this.findChildren(e3).each(function(e4, n3) {
  2588. var o3 = i()(n3);
  2589. o3.show(), o3.hasClass("".concat(u, "-opened")) && t3.showDescs(o3);
  2590. });
  2591. } }, { key: "close", value: function(e3) {
  2592. this.hide(e3), this.save(), e3.trigger("node:close", [e3]);
  2593. } }, { key: "hide", value: function(e3) {
  2594. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-opened")).addClass("".concat(u, "-closed")), this.hideDescs(e3));
  2595. } }, { key: "hideDescs", value: function(e3) {
  2596. var t3 = this;
  2597. this.findChildren(e3).each(function(e4, n3) {
  2598. var o3 = i()(n3);
  2599. o3.hide(), t3.hideDescs(o3);
  2600. });
  2601. } }, { key: "hasChildren", value: function(e3) {
  2602. return 0 != this.findChildren(e3).length;
  2603. } }, { key: "findChildren", value: function(e3) {
  2604. var t3 = e3.data("node-id");
  2605. return this.$table.find('tr[data-node-pid="'.concat(t3, '"]'));
  2606. } }, { key: "findDescendants", value: function(e3) {
  2607. var t3 = this, n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], o3 = this.findChildren(e3);
  2608. return n3.push(o3), o3.each(function(e4, o4) {
  2609. t3.findDescendants(i()(o4), n3);
  2610. }), n3;
  2611. } }, { key: "findByID", value: function(e3) {
  2612. return this.$table.find('tr[data-node-id="'.concat(e3, '"]'));
  2613. } }, { key: "openByID", value: function(e3) {
  2614. this.open(this.findByID(e3));
  2615. } }, { key: "closeByID", value: function(e3) {
  2616. this.close(this.findByID(e3));
  2617. } }, { key: "load", value: function() {
  2618. var e3 = this;
  2619. if (this.store) {
  2620. var t3 = this.store.get();
  2621. t3 && (this.nodes().each(function(t4, n3) {
  2622. e3.show(i()(n3));
  2623. }), this.nodes().filter(function(e4, n3) {
  2624. return -1 != t3.indexOf(i()(n3).data("node-id"));
  2625. }).each(function(t4, n3) {
  2626. e3.hide(i()(n3));
  2627. }));
  2628. }
  2629. } }, { key: "save", value: function() {
  2630. if (this.store) {
  2631. var e3 = this.nodes().filter(".".concat(u, "-closed")).map(function(e4, t3) {
  2632. return i()(t3).data("node-id");
  2633. }).get();
  2634. this.store.set(e3);
  2635. }
  2636. } }]) && f(t2.prototype, n2), o2 && f(t2, o2), e2;
  2637. }();
  2638. i.a.fn.simpleTreeTable = function(e2) {
  2639. return this.each(function(t2, n2) {
  2640. var o2 = i()(n2);
  2641. o2.data(u) && o2.data(u).destroy(), o2.data(u, new p(o2, e2));
  2642. });
  2643. }, i.a.SimpleTreeTable = p;
  2644. }]);
  2645. function generateTrHtml(json, level = 0, pId = "", pChain = "") {
  2646. let tr = "";
  2647. for (const key in json) {
  2648. let val = json[key];
  2649. const type = Utils.getType(val);
  2650. const chain = pChain + "." + key;
  2651. const tId = key + "_" + Math.random();
  2652. if (["array", "object"].includes(type)) {
  2653. const res = generateTrHtml(val, level + 1, tId, chain);
  2654. let brackets = "";
  2655. if (!res) {
  2656. if (type === "array") {
  2657. brackets = `<span class="json-brackets json-square-brackets">[]</span>`;
  2658. } else {
  2659. brackets = `<span class="json-brackets json-curly-brackets">{}</span>`;
  2660. }
  2661. }
  2662. tr += `
  2663. <tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  2664. <td colspan="${res ? 2 : ""}"
  2665. json-path="${chain}"
  2666. style="padding-left: ${level * 19}px">
  2667. <b class="json-key">${key}:</b>
  2668. <span class="node-len"></span>
  2669. </td>
  2670. <td>${brackets}</td>
  2671. </tr>`;
  2672. tr += res;
  2673. } else {
  2674. if (type === "string") {
  2675. val = val.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  2676. }
  2677. tr += `<tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  2678. <td json-path="${chain}"
  2679. style="padding-left: ${level * 19}px">
  2680. <b class="json-key">${key}:</b>
  2681. </td>`;
  2682. if (Utils.isUrl(val)) {
  2683. tr += `<td class="json-${type}"><a target="_blank" href="${val}">"${val}"</a></td>`;
  2684. } else {
  2685. val = type === "string" ? `"${val}"` : val;
  2686. tr += `<td class="json-${type}">${val}</td>`;
  2687. }
  2688. tr += "</tr>";
  2689. }
  2690. }
  2691. return tr;
  2692. }
  2693. const evnet = {
  2694. /**
  2695. * a标签鼠标移入,看是否是图片,是图片生成预览图
  2696. * @returns this
  2697. */
  2698. urlHover: function() {
  2699. $(document.body).on("mouseenter", "a[href]", function() {
  2700. const href = $(this).attr("href");
  2701. if (Utils.isImg(href)) {
  2702. tippy(this, {
  2703. duration: 800,
  2704. content: `<img style="max-width: 500px;" src="${href}" />`,
  2705. allowHTML: true,
  2706. theme: "imagebox"
  2707. }).show();
  2708. }
  2709. });
  2710. return this;
  2711. },
  2712. /**
  2713. * 鼠标移入key提示JSONPath
  2714. * @returns this
  2715. */
  2716. tipsJsonPath: function() {
  2717. const that = this;
  2718. $(document.body).on("mouseenter", ".json-key", function() {
  2719. const jsonPath = that.getJsonPath(this);
  2720. const content = `<b>ctrl + 点击复制</b><br/>${jsonPath}`;
  2721. tippy(this, {
  2722. content,
  2723. duration: 800,
  2724. allowHTML: true,
  2725. theme: "layer"
  2726. }).show();
  2727. });
  2728. return that;
  2729. },
  2730. /**
  2731. * 复制key的JSONPath
  2732. * @returns
  2733. */
  2734. copyJsonPath: function() {
  2735. const that = this;
  2736. $(document.body).on("click", ".json-key", function(event) {
  2737. if (event.ctrlKey) {
  2738. const jsonPath = that.getJsonPath(this);
  2739. _GM_setClipboard(jsonPath);
  2740. layer.msg("复制成功", { time: 1500 });
  2741. }
  2742. });
  2743. return that;
  2744. },
  2745. /**
  2746. * 给定HtmlElement获取JSONPath
  2747. * @param {*} element
  2748. * @returns
  2749. */
  2750. getJsonPath: function(element) {
  2751. const jsonPath = $(element).parent().attr("json-path");
  2752. const path = jsonPath.split(".");
  2753. path.splice(0, 1);
  2754. return path.reduce((prev, next) => {
  2755. return /^\d+$/.test(next) ? prev + `[${next}]` : prev + "." + next;
  2756. }, "Root");
  2757. },
  2758. init: function() {
  2759. this.urlHover().tipsJsonPath().copyJsonPath();
  2760. }
  2761. };
  2762. const $formatContainer = $("#formatContainer");
  2763. function onNodeOpen($node) {
  2764. $node.find(".node-len").html("");
  2765. }
  2766. function onNodeClose($node) {
  2767. const type = $node.attr("type");
  2768. const id = $node.data("node-id");
  2769. const length = $(`tr[data-node-pid="${id}"]:not(.hidden)`).length;
  2770. let content = `[ <span>${length}${length > 1 ? " items" : " item"}</span> ]`;
  2771. if (type === "object") {
  2772. content = `{ <span>${length}${length > 1 ? " keys" : " key"}</span> }`;
  2773. }
  2774. $node.find(".node-len").html(content);
  2775. }
  2776. const format_style = exports("default", {
  2777. /**
  2778. * 切换JSON 格式化风格
  2779. * @param {*} style 格式化风格,default/table
  2780. * @returns
  2781. */
  2782. changeStyle: function(style) {
  2783. layer.load(0, { shade: false });
  2784. _GM_setValue("style", style);
  2785. this.setStyle();
  2786. return this;
  2787. },
  2788. /**
  2789. * 设置JSON 格式化风格
  2790. * @returns
  2791. */
  2792. setStyle: function() {
  2793. const style = _GM_getValue("style") || "default";
  2794. $("input").val("");
  2795. $formatContainer.html("");
  2796. try {
  2797. if (style === "default") {
  2798. $formatContainer.jsonViewer(
  2799. _unsafeWindow.GLOBAL_JSON,
  2800. _unsafeWindow.GLOBAL_JSONP_FUN
  2801. );
  2802. return this;
  2803. }
  2804. this.tableFormat();
  2805. } finally {
  2806. try {
  2807. layer.closeAll();
  2808. } catch (error) {
  2809. }
  2810. }
  2811. },
  2812. /**
  2813. * JSON 表格格式化
  2814. */
  2815. tableFormat: function() {
  2816. const trHTML = generateTrHtml(_unsafeWindow.GLOBAL_JSON);
  2817. let appendHtml = `<table id="treeTable">${trHTML}</table>`;
  2818. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2819. appendHtml = `
  2820. <div class="jsonp">${_unsafeWindow.GLOBAL_JSONP_FUN}(</div>
  2821. ${appendHtml}
  2822. <div class="jsonp">)</div>`;
  2823. }
  2824. $formatContainer.append(appendHtml);
  2825. setTimeout(() => {
  2826. const simpleTreeTable = $("#treeTable").simpleTreeTable({
  2827. expander: "#expandAll",
  2828. collapser: "#collapseAll"
  2829. }).on("node:open", (e, $node) => onNodeOpen($node)).on("node:close", (e, $node) => onNodeClose($node));
  2830. const arrow = $("tr:not(.simple-tree-table-empty)");
  2831. $(document.body).on("click", "#expandAll", function() {
  2832. arrow.each((i, node) => onNodeOpen($(node)));
  2833. });
  2834. $(document.body).on("click", "#collapseAll", function() {
  2835. arrow.each((i, node) => onNodeClose($(node)));
  2836. });
  2837. simpleTreeTable.on("click", ".node-len", function() {
  2838. const id = $(this).closest("tr").data("node-id");
  2839. simpleTreeTable.data("simple-tree-table").openByID(id);
  2840. });
  2841. });
  2842. $("#treeTable").on("mousedown", "tr", function(event) {
  2843. const { tagName } = event.target;
  2844. if (tagName === "A" || tagName === "SPAN" || event.ctrlKey) {
  2845. return;
  2846. }
  2847. $(".selected").not(this).removeClass("selected");
  2848. $(this).toggleClass("selected");
  2849. });
  2850. return this;
  2851. },
  2852. init: function() {
  2853. const that = this;
  2854. that.setStyle();
  2855. evnet.init();
  2856. window.addEventListener("message", function(event) {
  2857. const { data } = event;
  2858. if (!data) {
  2859. return;
  2860. }
  2861. if (data.reload) {
  2862. that.setStyle();
  2863. return;
  2864. }
  2865. const { type, value } = data;
  2866. if (type === "style") {
  2867. that.changeStyle(value);
  2868. return;
  2869. }
  2870. });
  2871. }
  2872. });
  2873.  
  2874. })
  2875. };
  2876. }));
  2877.  
  2878. System.register("./index-BD0UcGGX-SFPCM2-n.js", ['jquery', './__monkey.entry-CQv26x-w.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind'], (function (exports, module) {
  2879. 'use strict';
  2880. var $, commonjsGlobal, _unsafeWindow, Utils, _GM_setClipboard, JSONbig, _GM_getValue, URL$1, _GM_setValue, tippy, require$$0;
  2881. return {
  2882. setters: [module => {
  2883. $ = module.default;
  2884. }, module => {
  2885. commonjsGlobal = module.d;
  2886. _unsafeWindow = module.b;
  2887. Utils = module.U;
  2888. _GM_setClipboard = module.c;
  2889. JSONbig = module.J;
  2890. _GM_getValue = module.a;
  2891. URL$1 = module.e;
  2892. _GM_setValue = module._;
  2893. }, module => {
  2894. tippy = module.t;
  2895. }, module => {
  2896. require$$0 = module.default;
  2897. }],
  2898. execute: (function () {
  2899.  
  2900. var domToImage = { exports: {} };
  2901. var hasRequiredDomToImage;
  2902. function requireDomToImage() {
  2903. if (hasRequiredDomToImage) return domToImage.exports;
  2904. hasRequiredDomToImage = 1;
  2905. (function(module) {
  2906. (function(global) {
  2907. var util = newUtil();
  2908. var inliner = newInliner();
  2909. var fontFaces = newFontFaces();
  2910. var images = newImages();
  2911. var defaultOptions = {
  2912. // Default is to fail on error, no placeholder
  2913. imagePlaceholder: void 0,
  2914. // Default cache bust is false, it will use the cache
  2915. cacheBust: false
  2916. };
  2917. var domtoimage = {
  2918. toSvg,
  2919. toPng,
  2920. toJpeg,
  2921. toBlob,
  2922. toPixelData,
  2923. impl: {
  2924. fontFaces,
  2925. images,
  2926. util,
  2927. inliner,
  2928. options: {}
  2929. }
  2930. };
  2931. module.exports = domtoimage;
  2932. function toSvg(node, options) {
  2933. options = options || {};
  2934. copyOptions(options);
  2935. return Promise.resolve(node).then(function(node2) {
  2936. return cloneNode(node2, options.filter, true);
  2937. }).then(embedFonts).then(inlineImages).then(applyOptions).then(function(clone) {
  2938. return makeSvgDataUri(
  2939. clone,
  2940. options.width || util.width(node),
  2941. options.height || util.height(node)
  2942. );
  2943. });
  2944. function applyOptions(clone) {
  2945. if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
  2946. if (options.width) clone.style.width = options.width + "px";
  2947. if (options.height) clone.style.height = options.height + "px";
  2948. if (options.style)
  2949. Object.keys(options.style).forEach(function(property) {
  2950. clone.style[property] = options.style[property];
  2951. });
  2952. return clone;
  2953. }
  2954. }
  2955. function toPixelData(node, options) {
  2956. return draw(node, options || {}).then(function(canvas) {
  2957. return canvas.getContext("2d").getImageData(
  2958. 0,
  2959. 0,
  2960. util.width(node),
  2961. util.height(node)
  2962. ).data;
  2963. });
  2964. }
  2965. function toPng(node, options) {
  2966. return draw(node, options || {}).then(function(canvas) {
  2967. return canvas.toDataURL();
  2968. });
  2969. }
  2970. function toJpeg(node, options) {
  2971. options = options || {};
  2972. return draw(node, options).then(function(canvas) {
  2973. return canvas.toDataURL("image/jpeg", options.quality || 1);
  2974. });
  2975. }
  2976. function toBlob(node, options) {
  2977. return draw(node, options || {}).then(util.canvasToBlob);
  2978. }
  2979. function copyOptions(options) {
  2980. if (typeof options.imagePlaceholder === "undefined") {
  2981. domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
  2982. } else {
  2983. domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
  2984. }
  2985. if (typeof options.cacheBust === "undefined") {
  2986. domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
  2987. } else {
  2988. domtoimage.impl.options.cacheBust = options.cacheBust;
  2989. }
  2990. }
  2991. function draw(domNode, options) {
  2992. return toSvg(domNode, options).then(util.makeImage).then(util.delay(100)).then(function(image) {
  2993. var canvas = newCanvas(domNode);
  2994. canvas.getContext("2d").drawImage(image, 0, 0);
  2995. return canvas;
  2996. });
  2997. function newCanvas(domNode2) {
  2998. var canvas = document.createElement("canvas");
  2999. canvas.width = options.width || util.width(domNode2);
  3000. canvas.height = options.height || util.height(domNode2);
  3001. if (options.bgcolor) {
  3002. var ctx = canvas.getContext("2d");
  3003. ctx.fillStyle = options.bgcolor;
  3004. ctx.fillRect(0, 0, canvas.width, canvas.height);
  3005. }
  3006. return canvas;
  3007. }
  3008. }
  3009. function cloneNode(node, filter2, root) {
  3010. if (!root && filter2 && !filter2(node)) return Promise.resolve();
  3011. return Promise.resolve(node).then(makeNodeCopy).then(function(clone) {
  3012. return cloneChildren(node, clone, filter2);
  3013. }).then(function(clone) {
  3014. return processClone(node, clone);
  3015. });
  3016. function makeNodeCopy(node2) {
  3017. if (node2 instanceof HTMLCanvasElement) return util.makeImage(node2.toDataURL());
  3018. return node2.cloneNode(false);
  3019. }
  3020. function cloneChildren(original, clone, filter3) {
  3021. var children = original.childNodes;
  3022. if (children.length === 0) return Promise.resolve(clone);
  3023. return cloneChildrenInOrder(clone, util.asArray(children), filter3).then(function() {
  3024. return clone;
  3025. });
  3026. function cloneChildrenInOrder(parent, children2, filter4) {
  3027. var done = Promise.resolve();
  3028. children2.forEach(function(child) {
  3029. done = done.then(function() {
  3030. return cloneNode(child, filter4);
  3031. }).then(function(childClone) {
  3032. if (childClone) parent.appendChild(childClone);
  3033. });
  3034. });
  3035. return done;
  3036. }
  3037. }
  3038. function processClone(original, clone) {
  3039. if (!(clone instanceof Element)) return clone;
  3040. return Promise.resolve().then(cloneStyle).then(clonePseudoElements).then(copyUserInput).then(fixSvg).then(function() {
  3041. return clone;
  3042. });
  3043. function cloneStyle() {
  3044. copyStyle(window.getComputedStyle(original), clone.style);
  3045. function copyStyle(source, target) {
  3046. if (source.cssText) target.cssText = source.cssText;
  3047. else copyProperties(source, target);
  3048. function copyProperties(source2, target2) {
  3049. util.asArray(source2).forEach(function(name) {
  3050. target2.setProperty(
  3051. name,
  3052. source2.getPropertyValue(name),
  3053. source2.getPropertyPriority(name)
  3054. );
  3055. });
  3056. }
  3057. }
  3058. }
  3059. function clonePseudoElements() {
  3060. [":before", ":after"].forEach(function(element) {
  3061. clonePseudoElement(element);
  3062. });
  3063. function clonePseudoElement(element) {
  3064. var style = window.getComputedStyle(original, element);
  3065. var content = style.getPropertyValue("content");
  3066. if (content === "" || content === "none") return;
  3067. var className = util.uid();
  3068. clone.className = clone.className + " " + className;
  3069. var styleElement = document.createElement("style");
  3070. styleElement.appendChild(formatPseudoElementStyle(className, element, style));
  3071. clone.appendChild(styleElement);
  3072. function formatPseudoElementStyle(className2, element2, style2) {
  3073. var selector = "." + className2 + ":" + element2;
  3074. var cssText = style2.cssText ? formatCssText(style2) : formatCssProperties(style2);
  3075. return document.createTextNode(selector + "{" + cssText + "}");
  3076. function formatCssText(style3) {
  3077. var content2 = style3.getPropertyValue("content");
  3078. return style3.cssText + " content: " + content2 + ";";
  3079. }
  3080. function formatCssProperties(style3) {
  3081. return util.asArray(style3).map(formatProperty).join("; ") + ";";
  3082. function formatProperty(name) {
  3083. return name + ": " + style3.getPropertyValue(name) + (style3.getPropertyPriority(name) ? " !important" : "");
  3084. }
  3085. }
  3086. }
  3087. }
  3088. }
  3089. function copyUserInput() {
  3090. if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
  3091. if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
  3092. }
  3093. function fixSvg() {
  3094. if (!(clone instanceof SVGElement)) return;
  3095. clone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
  3096. if (!(clone instanceof SVGRectElement)) return;
  3097. ["width", "height"].forEach(function(attribute) {
  3098. var value = clone.getAttribute(attribute);
  3099. if (!value) return;
  3100. clone.style.setProperty(attribute, value);
  3101. });
  3102. }
  3103. }
  3104. }
  3105. function embedFonts(node) {
  3106. return fontFaces.resolveAll().then(function(cssText) {
  3107. var styleNode = document.createElement("style");
  3108. node.appendChild(styleNode);
  3109. styleNode.appendChild(document.createTextNode(cssText));
  3110. return node;
  3111. });
  3112. }
  3113. function inlineImages(node) {
  3114. return images.inlineAll(node).then(function() {
  3115. return node;
  3116. });
  3117. }
  3118. function makeSvgDataUri(node, width, height) {
  3119. return Promise.resolve(node).then(function(node2) {
  3120. node2.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  3121. return new XMLSerializer().serializeToString(node2);
  3122. }).then(util.escapeXhtml).then(function(xhtml) {
  3123. return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + "</foreignObject>";
  3124. }).then(function(foreignObject) {
  3125. return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' + foreignObject + "</svg>";
  3126. }).then(function(svg) {
  3127. return "data:image/svg+xml;charset=utf-8," + svg;
  3128. });
  3129. }
  3130. function newUtil() {
  3131. return {
  3132. escape,
  3133. parseExtension,
  3134. mimeType,
  3135. dataAsUrl,
  3136. isDataUrl,
  3137. canvasToBlob,
  3138. resolveUrl,
  3139. getAndEncode,
  3140. uid: uid(),
  3141. delay,
  3142. asArray,
  3143. escapeXhtml,
  3144. makeImage,
  3145. width,
  3146. height
  3147. };
  3148. function mimes() {
  3149. var WOFF = "application/font-woff";
  3150. var JPEG = "image/jpeg";
  3151. return {
  3152. "woff": WOFF,
  3153. "woff2": WOFF,
  3154. "ttf": "application/font-truetype",
  3155. "eot": "application/vnd.ms-fontobject",
  3156. "png": "image/png",
  3157. "jpg": JPEG,
  3158. "jpeg": JPEG,
  3159. "gif": "image/gif",
  3160. "tiff": "image/tiff",
  3161. "svg": "image/svg+xml"
  3162. };
  3163. }
  3164. function parseExtension(url) {
  3165. var match = /\.([^\.\/]*?)$/g.exec(url);
  3166. if (match) return match[1];
  3167. else return "";
  3168. }
  3169. function mimeType(url) {
  3170. var extension = parseExtension(url).toLowerCase();
  3171. return mimes()[extension] || "";
  3172. }
  3173. function isDataUrl(url) {
  3174. return url.search(/^(data:)/) !== -1;
  3175. }
  3176. function toBlob2(canvas) {
  3177. return new Promise(function(resolve) {
  3178. var binaryString = window.atob(canvas.toDataURL().split(",")[1]);
  3179. var length = binaryString.length;
  3180. var binaryArray = new Uint8Array(length);
  3181. for (var i = 0; i < length; i++)
  3182. binaryArray[i] = binaryString.charCodeAt(i);
  3183. resolve(new Blob([binaryArray], {
  3184. type: "image/png"
  3185. }));
  3186. });
  3187. }
  3188. function canvasToBlob(canvas) {
  3189. if (canvas.toBlob)
  3190. return new Promise(function(resolve) {
  3191. canvas.toBlob(resolve);
  3192. });
  3193. return toBlob2(canvas);
  3194. }
  3195. function resolveUrl(url, baseUrl) {
  3196. var doc = document.implementation.createHTMLDocument();
  3197. var base = doc.createElement("base");
  3198. doc.head.appendChild(base);
  3199. var a = doc.createElement("a");
  3200. doc.body.appendChild(a);
  3201. base.href = baseUrl;
  3202. a.href = url;
  3203. return a.href;
  3204. }
  3205. function uid() {
  3206. var index = 0;
  3207. return function() {
  3208. return "u" + fourRandomChars() + index++;
  3209. function fourRandomChars() {
  3210. return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
  3211. }
  3212. };
  3213. }
  3214. function makeImage(uri) {
  3215. return new Promise(function(resolve, reject) {
  3216. var image = new Image();
  3217. image.onload = function() {
  3218. resolve(image);
  3219. };
  3220. image.onerror = reject;
  3221. image.src = uri;
  3222. });
  3223. }
  3224. function getAndEncode(url) {
  3225. var TIMEOUT = 3e4;
  3226. if (domtoimage.impl.options.cacheBust) {
  3227. url += (/\?/.test(url) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
  3228. }
  3229. return new Promise(function(resolve) {
  3230. var request = new XMLHttpRequest();
  3231. request.onreadystatechange = done;
  3232. request.ontimeout = timeout;
  3233. request.responseType = "blob";
  3234. request.timeout = TIMEOUT;
  3235. request.open("GET", url, true);
  3236. request.send();
  3237. var placeholder;
  3238. if (domtoimage.impl.options.imagePlaceholder) {
  3239. var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
  3240. if (split && split[1]) {
  3241. placeholder = split[1];
  3242. }
  3243. }
  3244. function done() {
  3245. if (request.readyState !== 4) return;
  3246. if (request.status !== 200) {
  3247. if (placeholder) {
  3248. resolve(placeholder);
  3249. } else {
  3250. fail("cannot fetch resource: " + url + ", status: " + request.status);
  3251. }
  3252. return;
  3253. }
  3254. var encoder = new FileReader();
  3255. encoder.onloadend = function() {
  3256. var content = encoder.result.split(/,/)[1];
  3257. resolve(content);
  3258. };
  3259. encoder.readAsDataURL(request.response);
  3260. }
  3261. function timeout() {
  3262. if (placeholder) {
  3263. resolve(placeholder);
  3264. } else {
  3265. fail("timeout of " + TIMEOUT + "ms occured while fetching resource: " + url);
  3266. }
  3267. }
  3268. function fail(message) {
  3269. console.error(message);
  3270. resolve("");
  3271. }
  3272. });
  3273. }
  3274. function dataAsUrl(content, type) {
  3275. return "data:" + type + ";base64," + content;
  3276. }
  3277. function escape(string) {
  3278. return string.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
  3279. }
  3280. function delay(ms) {
  3281. return function(arg) {
  3282. return new Promise(function(resolve) {
  3283. setTimeout(function() {
  3284. resolve(arg);
  3285. }, ms);
  3286. });
  3287. };
  3288. }
  3289. function asArray(arrayLike) {
  3290. var array = [];
  3291. var length = arrayLike.length;
  3292. for (var i = 0; i < length; i++) array.push(arrayLike[i]);
  3293. return array;
  3294. }
  3295. function escapeXhtml(string) {
  3296. return string.replace(/#/g, "%23").replace(/\n/g, "%0A");
  3297. }
  3298. function width(node) {
  3299. var leftBorder = px(node, "border-left-width");
  3300. var rightBorder = px(node, "border-right-width");
  3301. return node.scrollWidth + leftBorder + rightBorder;
  3302. }
  3303. function height(node) {
  3304. var topBorder = px(node, "border-top-width");
  3305. var bottomBorder = px(node, "border-bottom-width");
  3306. return node.scrollHeight + topBorder + bottomBorder;
  3307. }
  3308. function px(node, styleProperty) {
  3309. var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
  3310. return parseFloat(value.replace("px", ""));
  3311. }
  3312. }
  3313. function newInliner() {
  3314. var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
  3315. return {
  3316. inlineAll,
  3317. shouldProcess,
  3318. impl: {
  3319. readUrls,
  3320. inline
  3321. }
  3322. };
  3323. function shouldProcess(string) {
  3324. return string.search(URL_REGEX) !== -1;
  3325. }
  3326. function readUrls(string) {
  3327. var result = [];
  3328. var match;
  3329. while ((match = URL_REGEX.exec(string)) !== null) {
  3330. result.push(match[1]);
  3331. }
  3332. return result.filter(function(url) {
  3333. return !util.isDataUrl(url);
  3334. });
  3335. }
  3336. function inline(string, url, baseUrl, get) {
  3337. return Promise.resolve(url).then(function(url2) {
  3338. return baseUrl ? util.resolveUrl(url2, baseUrl) : url2;
  3339. }).then(get || util.getAndEncode).then(function(data) {
  3340. return util.dataAsUrl(data, util.mimeType(url));
  3341. }).then(function(dataUrl) {
  3342. return string.replace(urlAsRegex(url), "$1" + dataUrl + "$3");
  3343. });
  3344. function urlAsRegex(url2) {
  3345. return new RegExp(`(url\\(['"]?)(` + util.escape(url2) + `)(['"]?\\))`, "g");
  3346. }
  3347. }
  3348. function inlineAll(string, baseUrl, get) {
  3349. if (nothingToInline()) return Promise.resolve(string);
  3350. return Promise.resolve(string).then(readUrls).then(function(urls) {
  3351. var done = Promise.resolve(string);
  3352. urls.forEach(function(url) {
  3353. done = done.then(function(string2) {
  3354. return inline(string2, url, baseUrl, get);
  3355. });
  3356. });
  3357. return done;
  3358. });
  3359. function nothingToInline() {
  3360. return !shouldProcess(string);
  3361. }
  3362. }
  3363. }
  3364. function newFontFaces() {
  3365. return {
  3366. resolveAll,
  3367. impl: {
  3368. readAll
  3369. }
  3370. };
  3371. function resolveAll() {
  3372. return readAll().then(function(webFonts) {
  3373. return Promise.all(
  3374. webFonts.map(function(webFont) {
  3375. return webFont.resolve();
  3376. })
  3377. );
  3378. }).then(function(cssStrings) {
  3379. return cssStrings.join("\n");
  3380. });
  3381. }
  3382. function readAll() {
  3383. return Promise.resolve(util.asArray(document.styleSheets)).then(getCssRules).then(selectWebFontRules).then(function(rules) {
  3384. return rules.map(newWebFont);
  3385. });
  3386. function selectWebFontRules(cssRules) {
  3387. return cssRules.filter(function(rule) {
  3388. return rule.type === CSSRule.FONT_FACE_RULE;
  3389. }).filter(function(rule) {
  3390. return inliner.shouldProcess(rule.style.getPropertyValue("src"));
  3391. });
  3392. }
  3393. function getCssRules(styleSheets) {
  3394. var cssRules = [];
  3395. styleSheets.forEach(function(sheet) {
  3396. try {
  3397. util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
  3398. } catch (e) {
  3399. console.log("Error while reading CSS rules from " + sheet.href, e.toString());
  3400. }
  3401. });
  3402. return cssRules;
  3403. }
  3404. function newWebFont(webFontRule) {
  3405. return {
  3406. resolve: function resolve() {
  3407. var baseUrl = (webFontRule.parentStyleSheet || {}).href;
  3408. return inliner.inlineAll(webFontRule.cssText, baseUrl);
  3409. },
  3410. src: function() {
  3411. return webFontRule.style.getPropertyValue("src");
  3412. }
  3413. };
  3414. }
  3415. }
  3416. }
  3417. function newImages() {
  3418. return {
  3419. inlineAll,
  3420. impl: {
  3421. newImage
  3422. }
  3423. };
  3424. function newImage(element) {
  3425. return {
  3426. inline
  3427. };
  3428. function inline(get) {
  3429. if (util.isDataUrl(element.src)) return Promise.resolve();
  3430. return Promise.resolve(element.src).then(get || util.getAndEncode).then(function(data) {
  3431. return util.dataAsUrl(data, util.mimeType(element.src));
  3432. }).then(function(dataUrl) {
  3433. return new Promise(function(resolve, reject) {
  3434. element.onload = resolve;
  3435. element.onerror = reject;
  3436. element.src = dataUrl;
  3437. });
  3438. });
  3439. }
  3440. }
  3441. function inlineAll(node) {
  3442. if (!(node instanceof Element)) return Promise.resolve(node);
  3443. return inlineBackground(node).then(function() {
  3444. if (node instanceof HTMLImageElement)
  3445. return newImage(node).inline();
  3446. else
  3447. return Promise.all(
  3448. util.asArray(node.childNodes).map(function(child) {
  3449. return inlineAll(child);
  3450. })
  3451. );
  3452. });
  3453. function inlineBackground(node2) {
  3454. var background = node2.style.getPropertyValue("background");
  3455. if (!background) return Promise.resolve(node2);
  3456. return inliner.inlineAll(background).then(function(inlined) {
  3457. node2.style.setProperty(
  3458. "background",
  3459. inlined,
  3460. node2.style.getPropertyPriority("background")
  3461. );
  3462. }).then(function() {
  3463. return node2;
  3464. });
  3465. }
  3466. }
  3467. }
  3468. })();
  3469. })(domToImage);
  3470. return domToImage.exports;
  3471. }
  3472. /**
  3473. * @license BSD-3-Clause
  3474. * @copyright 2014-2023 hizzgdev@163.com
  3475. *
  3476. * Project Home:
  3477. * https://github.com/hizzgdev/jsmind/
  3478. */
  3479. (function(module, exports) {
  3480. !function(e, t) {
  3481. t(require$$0, requireDomToImage());
  3482. }(commonjsGlobal, function(e, t) {
  3483. function i(e2) {
  3484. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  3485. }
  3486. var n = i(e), o = i(t);
  3487. if (!n.default) throw new Error("jsMind is not defined");
  3488. if (!o.default) throw new Error("dom-to-image is required");
  3489. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  3490. class a {
  3491. constructor(e2, t2) {
  3492. var i2 = {};
  3493. 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;
  3494. }
  3495. shoot() {
  3496. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  3497. 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));
  3498. }
  3499. create_canvas() {
  3500. let e2 = r.c("canvas");
  3501. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  3502. 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;
  3503. }
  3504. clear(e2) {
  3505. e2.parentNode.removeChild(e2);
  3506. }
  3507. draw_background(e2) {
  3508. return new Promise((function(t2, i2) {
  3509. const n2 = this.options.background;
  3510. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  3511. }).bind(this));
  3512. }
  3513. draw_lines(e2) {
  3514. return new Promise((function(t2, i2) {
  3515. this.jm.view.graph.copy_to(e2, function() {
  3516. t2(e2);
  3517. });
  3518. }).bind(this));
  3519. }
  3520. draw_nodes(e2) {
  3521. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  3522. return e2.drawImage(t2, 0, 0), e2;
  3523. });
  3524. }
  3525. draw_watermark(e2, t2) {
  3526. 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;
  3527. }
  3528. load_image(e2) {
  3529. return new Promise(function(t2, i2) {
  3530. let n2 = new Image();
  3531. n2.onload = function() {
  3532. t2(n2);
  3533. }, n2.onerror = i2, n2.src = e2;
  3534. });
  3535. }
  3536. download(e2) {
  3537. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  3538. if (navigator.msSaveBlob && e2.msToBlob) {
  3539. var i2 = e2.msToBlob();
  3540. navigator.msSaveBlob(i2, t2);
  3541. } else {
  3542. var n2 = e2.toDataURL(), o2 = r.c("a");
  3543. if ("download" in o2) {
  3544. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  3545. var s2 = r.d.createEvent("MouseEvents");
  3546. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  3547. } else location.href = n2;
  3548. }
  3549. }
  3550. }
  3551. let d = new n.default.plugin("screenshot", function(e2, t2) {
  3552. var i2 = new a(e2, t2);
  3553. e2.screenshot = i2, e2.shoot = function() {
  3554. i2.shoot();
  3555. };
  3556. });
  3557. n.default.register_plugin(d);
  3558. });
  3559. })();
  3560. const jsonMind = {
  3561. isFirst: true,
  3562. /**
  3563. * JSON数据转换为jsMind所需要的数据结构
  3564. * @param {*} json JSON 数据
  3565. * @returns
  3566. */
  3567. convert: function(json) {
  3568. const children = [];
  3569. if (typeof json === "object") {
  3570. for (const key in json) {
  3571. let val = json[key], isArray = Array.isArray(val);
  3572. const type = Utils.getPrototype(val);
  3573. if (isArray && val.length > 0) {
  3574. val = Utils.findMaxKeysObject(val);
  3575. }
  3576. children.push({
  3577. isArray,
  3578. chain: key,
  3579. id: key + "_" + Math.random(),
  3580. topic: `${key}<span class="datatype">${type}</span>`,
  3581. children: this.convert(val)
  3582. });
  3583. }
  3584. }
  3585. return children;
  3586. },
  3587. /**
  3588. * 脑图节点调用链
  3589. * @param {*} node 脑图节点对象
  3590. * @returns
  3591. */
  3592. mindChain: function(node) {
  3593. let chain = node.data.chain;
  3594. if (!node.parent) {
  3595. return chain;
  3596. }
  3597. const parent = node.parent;
  3598. const parentChain = this.mindChain(parent);
  3599. chain = parent.data.isArray ? `${parentChain}[i].${chain}` : `${parentChain}.${chain}`;
  3600. return chain;
  3601. },
  3602. /**
  3603. * 显示脑图
  3604. * @param {*} json JSON 数据
  3605. * @returns
  3606. */
  3607. show: function(json) {
  3608. let isArr = Array.isArray(json);
  3609. if (isArr) {
  3610. if (typeof json[0] !== "object") {
  3611. layer.msg("数据结构无法生成脑图", { time: 1e3 });
  3612. return this;
  3613. }
  3614. json = Utils.findMaxKeysObject(json);
  3615. }
  3616. if (!this.isFirst) {
  3617. return this;
  3618. }
  3619. _unsafeWindow.GLOBAL_JSMIND.show({
  3620. meta: {
  3621. version: "1.0",
  3622. name: "JSON脑图",
  3623. author: "1220301855@qq.com"
  3624. },
  3625. format: "node_tree",
  3626. /* 数据内容 */
  3627. data: {
  3628. id: "root",
  3629. topic: "Root",
  3630. direction: "left",
  3631. children: this.convert(json),
  3632. chain: isArr ? "Root[i]" : "Root"
  3633. }
  3634. });
  3635. this.isFirst = false;
  3636. return this;
  3637. },
  3638. /**
  3639. * 脑图节点事件
  3640. * @returns
  3641. */
  3642. event: function() {
  3643. const jsonMind2 = this;
  3644. $(document.body).on("dblclick mouseover", "jmnode", function(event) {
  3645. const nodeid = $(this).attr("nodeid");
  3646. const node = _unsafeWindow.GLOBAL_JSMIND.get_node(nodeid);
  3647. if (!node.parent) {
  3648. return;
  3649. }
  3650. if (event.type === "dblclick") {
  3651. _GM_setClipboard(jsonMind2.mindChain(node));
  3652. layer.msg("节点路径复制成功", { time: 1500 });
  3653. } else {
  3654. const chain = jsonMind2.mindChain(node);
  3655. const content = `<b>节点路径(双击复制)</b><br/>${chain}`;
  3656. tippy(this, {
  3657. content,
  3658. duration: 800,
  3659. allowHTML: true,
  3660. theme: "layer"
  3661. }).show();
  3662. }
  3663. });
  3664. return this;
  3665. },
  3666. init: function(json) {
  3667. if (!_unsafeWindow.GLOBAL_JSMIND) {
  3668. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  3669. mode: "side",
  3670. editable: false,
  3671. container: "jmContainer",
  3672. view: {
  3673. hmargin: 50,
  3674. // 思维导图距容器外框的最小水平距离
  3675. vmargin: 50,
  3676. // 思维导图距容器外框的最小垂直距离
  3677. engine: "svg",
  3678. // 思维导图各节点之间线条的绘制引擎
  3679. draggable: true,
  3680. // 当容器不能完全容纳思维导图时,是否允许拖动画布代替鼠标滚动
  3681. support_html: false,
  3682. line_color: "#C4C9D0"
  3683. },
  3684. zoom: {
  3685. // 配置缩放
  3686. min: 0.1,
  3687. // 最小的缩放比例
  3688. max: 2.1,
  3689. // 最大的缩放比例
  3690. step: 0.1
  3691. // 缩放比例间隔
  3692. },
  3693. layout: {
  3694. vspace: 7,
  3695. // 节点之间的垂直间距
  3696. hspace: 150
  3697. // 节点之间的水平空间
  3698. }
  3699. });
  3700. }
  3701. this.show(json).event();
  3702. }
  3703. };
  3704. const $jmContainer = $("#jmContainer");
  3705. const $formatContainer = $("#formatContainer");
  3706. const $rawTextContainer = $("#rawTextContainer");
  3707. const tabsEvent = {
  3708. firstFormat: true,
  3709. isBeautify: false,
  3710. $rawTextPre: $rawTextContainer.find("pre"),
  3711. /**
  3712. * 原始数据
  3713. */
  3714. _setRawText: function() {
  3715. let rawText = _unsafeWindow.RAW_TEXT;
  3716. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3717. rawText = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${rawText})`;
  3718. }
  3719. this.$rawTextPre.text(rawText);
  3720. },
  3721. /**
  3722. * 保存为文件
  3723. * 如果是JSON 格式化可见,保存JSON数据为.json文件
  3724. * 如果是JSON 脑图可见,保存脑图为图片
  3725. */
  3726. saveJson: function() {
  3727. if ($jmContainer.is(":visible")) {
  3728. _unsafeWindow.GLOBAL_JSMIND.shoot();
  3729. return;
  3730. }
  3731. const content = this.$rawTextPre.text() || _unsafeWindow.RAW_TEXT;
  3732. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  3733. Utils.downloadText(content, filename);
  3734. },
  3735. /**
  3736. * 复制JSON文本内容
  3737. */
  3738. copyJson: function() {
  3739. const content = this.$rawTextPre.text() || _unsafeWindow.RAW_TEXT;
  3740. _GM_setClipboard(content);
  3741. layer.msg("复制成功", { time: 1500 });
  3742. },
  3743. /**
  3744. * 点击了`全部折叠`
  3745. * 如果是JSON 格式化可见,折叠JSON
  3746. * 如果是JSON 脑图可见,折叠脑图节点
  3747. */
  3748. collapseAll: function() {
  3749. if ($formatContainer.is(":visible")) {
  3750. try {
  3751. $("a.json-toggle").not(".collapsed").trigger("click");
  3752. } catch (e) {
  3753. }
  3754. return;
  3755. }
  3756. _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  3757. },
  3758. /**
  3759. * 点击了`全部展开`
  3760. * 如果是JSON 格式化可见,展开JSON
  3761. * 如果是JSON 脑图可见,展开脑图节点
  3762. */
  3763. expandAll: function() {
  3764. if ($formatContainer.is(":visible")) {
  3765. try {
  3766. $("a.json-placeholder").trigger("click").remove();
  3767. } catch (e) {
  3768. }
  3769. return;
  3770. }
  3771. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  3772. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  3773. _unsafeWindow.GLOBAL_JSMIND.get_root()
  3774. );
  3775. },
  3776. viewFormater: function() {
  3777. },
  3778. /**
  3779. * tabs点击了`JSON 脑图`
  3780. */
  3781. viewMind: function() {
  3782. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3783. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  3784. _unsafeWindow.GLOBAL_JSMIND.get_root()
  3785. );
  3786. },
  3787. /**
  3788. * tabs点击了`原始数据`
  3789. */
  3790. viewRawText: function() {
  3791. if (!this.firstFormat) {
  3792. return;
  3793. }
  3794. this.firstFormat = false;
  3795. this._setRawText();
  3796. },
  3797. /**
  3798. * 点击了`美化输出`
  3799. */
  3800. beautify: function() {
  3801. this.isBeautify = !this.isBeautify;
  3802. if (this.isBeautify) {
  3803. let str = JSONbig.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  3804. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3805. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  3806. }
  3807. this.$rawTextPre.text(str);
  3808. return;
  3809. }
  3810. this._setRawText();
  3811. },
  3812. /**
  3813. * 点击了`JSON Crack`
  3814. */
  3815. jsoncrack: function() {
  3816. let theme2 = _GM_getValue("theme") || "light";
  3817. theme2 = theme2.replace(/_.*/, "");
  3818. layer.closeAll();
  3819. layer.open({
  3820. type: 1,
  3821. title: false,
  3822. area: ["100vw", "100vh"],
  3823. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  3824. success: function(layero) {
  3825. const jsonCrackEmbed = layero.find("#jsoncrackEmbed")[0];
  3826. window == null ? void 0 : window.addEventListener("message", () => {
  3827. var _a;
  3828. (_a = jsonCrackEmbed == null ? void 0 : jsonCrackEmbed.contentWindow) == null ? void 0 : _a.postMessage(
  3829. {
  3830. options: { theme: theme2 },
  3831. json: _unsafeWindow.RAW_TEXT
  3832. },
  3833. "*"
  3834. );
  3835. });
  3836. }
  3837. });
  3838. },
  3839. init: function() {
  3840. $(document.body).on("click", ".btn", (e) => {
  3841. const target = e.target;
  3842. const id = target.id;
  3843. if (target.classList.contains("tabs-item")) {
  3844. const clas = "active";
  3845. const index = $(target).index();
  3846. $(target).addClass(clas).siblings().removeClass(clas);
  3847. $(".tabs-container > div").removeClass(clas).eq(index).addClass(clas);
  3848. const beautifyEl = $("#beautify");
  3849. const searchEl = $(".searchbox");
  3850. const copyEl = $("#copyJson");
  3851. const jsoncrackEl = $("#jsoncrack");
  3852. const aEl = $("#collapseAll, #expandAll");
  3853. id === "viewFormater" ? searchEl.show() : searchEl.hide();
  3854. id === "viewMind" ? copyEl.hide() && jsoncrackEl.show() : copyEl.show() && jsoncrackEl.hide();
  3855. id === "viewRawText" ? beautifyEl.show() && aEl.hide() : beautifyEl.hide() && aEl.show();
  3856. }
  3857. this[id](target);
  3858. });
  3859. return this;
  3860. }
  3861. };
  3862. window.addEventListener("message", function(event) {
  3863. const { data } = event;
  3864. if (!(data == null ? void 0 : data.reload)) {
  3865. return;
  3866. }
  3867. $jmContainer.html("");
  3868. jsonMind.isFirst = true;
  3869. tabsEvent.isBeautify = false;
  3870. tabsEvent.firstFormat = true;
  3871. _unsafeWindow.GLOBAL_JSMIND = void 0;
  3872. if ($rawTextContainer.is(":visible")) {
  3873. tabsEvent.viewRawText();
  3874. }
  3875. if ($jmContainer.is(":visible")) {
  3876. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3877. }
  3878. });
  3879. const filter = {
  3880. /**
  3881. * 根据`filter`过滤 JSON
  3882. * @param {*} filter 过滤值
  3883. * @returns
  3884. */
  3885. filterJSON: function(filter2) {
  3886. const style = _GM_getValue("style") || "default";
  3887. const allPath = $(`#formatContainer *[json-path]`);
  3888. if (!filter2) {
  3889. style == "default" ? allPath.removeClass("hidden") : allPath.parent().removeClass("hidden");
  3890. return;
  3891. }
  3892. const chainSet = /* @__PURE__ */ new Set();
  3893. document.querySelectorAll("#formatContainer *[json-path]").forEach((el) => {
  3894. let chain = $(el).attr("json-path");
  3895. if (!chain) {
  3896. return;
  3897. }
  3898. const newChain = chain.substring(chain.lastIndexOf("."));
  3899. if (!newChain.toLowerCase().includes(filter2.toLowerCase())) {
  3900. return;
  3901. }
  3902. chainSet.add(chain);
  3903. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  3904. chainSet.add(chain);
  3905. }
  3906. });
  3907. document.querySelectorAll(
  3908. "#formatContainer *[class*='json-']:not([class*='json-key']):not([class*='json-brackets'])"
  3909. ).forEach((el) => {
  3910. const target = $(el);
  3911. let chain = target.siblings().attr("json-path");
  3912. if (style == "default") {
  3913. chain = target.parent().attr("json-path");
  3914. }
  3915. if (!chain) {
  3916. return;
  3917. }
  3918. const text = target.text();
  3919. if (!text.toLowerCase().includes(filter2.toLowerCase())) {
  3920. return;
  3921. }
  3922. chainSet.add(chain);
  3923. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  3924. chainSet.add(chain);
  3925. }
  3926. });
  3927. style == "default" ? allPath.addClass("hidden") : allPath.parent().addClass("hidden");
  3928. chainSet.forEach((chain) => {
  3929. const path = $(`#formatContainer *[json-path="${chain}"]`);
  3930. style == "default" ? path.removeClass("hidden") : path.parent().removeClass("hidden");
  3931. });
  3932. },
  3933. /**
  3934. * JSON 过滤输入框事件监听
  3935. * @returns
  3936. */
  3937. input: function() {
  3938. const that = this;
  3939. $(document.body).on("input", ".searchbox input", function() {
  3940. const val = $(this).val();
  3941. $(".clear").attr("hidden", !val);
  3942. that.filterJSON(val);
  3943. });
  3944. return that;
  3945. },
  3946. /**
  3947. * 清空输入框内容
  3948. * @returns
  3949. */
  3950. clear: function() {
  3951. const that = this;
  3952. $(document.body).on("click", ".searchbox .clear", function() {
  3953. that.filterJSON();
  3954. $("input").val("");
  3955. $(this).attr("hidden", true);
  3956. });
  3957. return this;
  3958. },
  3959. init: function() {
  3960. this.input().clear();
  3961. }
  3962. };
  3963. const theme = {
  3964. /**
  3965. * 切换主题色
  3966. * @param {*} theme 主题色:default、light、dark、dark_plus
  3967. * @returns
  3968. */
  3969. changeTheme: function(theme2) {
  3970. _GM_setValue("theme", theme2);
  3971. this.setTheme();
  3972. return this;
  3973. },
  3974. /**
  3975. * 设置主题
  3976. * @returns
  3977. */
  3978. setTheme: function() {
  3979. const theme2 = _GM_getValue("theme") || "default";
  3980. $(document.body).removeClass().addClass(theme2);
  3981. return this;
  3982. },
  3983. init: function() {
  3984. const that = this;
  3985. that.setTheme();
  3986. window.addEventListener("message", function(event) {
  3987. const { data } = event;
  3988. if (!data) {
  3989. return;
  3990. }
  3991. const { type, value } = data;
  3992. if (type === "theme") {
  3993. that.changeTheme(value);
  3994. }
  3995. });
  3996. }
  3997. };
  3998. const http_form = `
  3999. <form class="httpRequest">
  4000. <div class="requestbox">
  4001. <select name="method">
  4002. <option value="POST">POST</option>
  4003. <option value="GET">GET</option>
  4004. <option value="PUT">PUT</option>
  4005. <option value="DELETE">DELETE</option>
  4006. </select>
  4007. <input name="url" placeholder="请求地址" />
  4008. <select name="contentType">
  4009. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  4010. <option value="application/json;charset=UTF-8">application/json</option>
  4011. </select>
  4012. <button type="submit">发送</button>
  4013. </div>
  4014. <div class="textarea">
  4015. <input name="headers" placeholder='请求头 {"token": "test"}' />
  4016. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  4017. </div>
  4018. </form>`;
  4019. const tools = {
  4020. inputJson: function() {
  4021. const that = this;
  4022. layer.prompt(
  4023. {
  4024. title: "JSON 输入",
  4025. formType: 2,
  4026. btn: ["确认"],
  4027. shadeClose: true,
  4028. maxlength: 1e6,
  4029. area: ["400px", "300px"]
  4030. },
  4031. function(text) {
  4032. if (!text) {
  4033. layer.msg("内容不能为空", { time: 1500 });
  4034. return;
  4035. }
  4036. const { rawText, jsonpFun } = Utils.jsonpMatch(text);
  4037. try {
  4038. const json = JSONbig({ useNativeBigInt: true }).parse(rawText);
  4039. that.reload(json, rawText, jsonpFun);
  4040. } catch (e) {
  4041. layer.msg("JSON格式不正确", { time: 1500 });
  4042. console.log("格式化异常: ", e);
  4043. }
  4044. }
  4045. );
  4046. return this;
  4047. },
  4048. fetchApi: function() {
  4049. const that = this;
  4050. layer.open({
  4051. type: 1,
  4052. closeBtn: 0,
  4053. shadeClose: true,
  4054. title: "HTTP 请求",
  4055. content: http_form
  4056. });
  4057. $("form").on("submit", function(event) {
  4058. event.preventDefault();
  4059. const serialize = $(this).serializeArray();
  4060. const form = {};
  4061. for (const key in serialize) {
  4062. const it = serialize[key];
  4063. form[it.name] = it.value;
  4064. }
  4065. if (form.url === "") {
  4066. layer.msg("请求URL不能为空");
  4067. return;
  4068. }
  4069. let headers = form.headers;
  4070. let params = form.params;
  4071. try {
  4072. if (headers) {
  4073. headers = JSON.parse(headers);
  4074. }
  4075. } catch (e) {
  4076. layer.msg("请求头格式不合法");
  4077. return;
  4078. }
  4079. try {
  4080. if (params) {
  4081. params = JSON.parse(params);
  4082. }
  4083. } catch (e) {
  4084. layer.msg("请求参数格式不合法");
  4085. return;
  4086. }
  4087. layer.load(0, { shade: false });
  4088. $.ajax({
  4089. type: "POST",
  4090. url: URL$1.ONLINE_REQUEST,
  4091. data: JSON.stringify(form),
  4092. contentType: "application/json"
  4093. }).then(
  4094. (response) => {
  4095. if (typeof response === "string") {
  4096. try {
  4097. const { rawText, jsonpFun } = Utils.jsonpMatch(response);
  4098. const json = JSONbig({ useNativeBigInt: true }).parse(rawText);
  4099. that.reload(json, rawText, jsonpFun);
  4100. } catch (e) {
  4101. layer.closeAll();
  4102. layer.msg("HTTP 请求JSON格式不正确", { time: 1500 });
  4103. console.log("HTTP 请求JSON格式不正确:", e);
  4104. }
  4105. } else {
  4106. that.reload(response, JSONbig.stringify(response), null);
  4107. }
  4108. },
  4109. (error) => {
  4110. layer.closeAll();
  4111. layer.msg("HTTP 请求异常", { time: 1500 });
  4112. console.log("HTTP 请求异常:", error);
  4113. }
  4114. );
  4115. });
  4116. return this;
  4117. },
  4118. reload: function(json, rawText, jsonpFun) {
  4119. _unsafeWindow.GLOBAL_JSON = json;
  4120. _unsafeWindow.RAW_TEXT = rawText;
  4121. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  4122. window.postMessage({ reload: true });
  4123. layer.closeAll();
  4124. },
  4125. init: function() {
  4126. window.addEventListener("message", (event) => {
  4127. const { data } = event;
  4128. if (!data) {
  4129. return;
  4130. }
  4131. const { type, value } = data;
  4132. if (type === "tools") {
  4133. this[value]();
  4134. }
  4135. });
  4136. }
  4137. };
  4138. const handleBar = {
  4139. instance: null,
  4140. /**
  4141. * 对右侧操作栏的点击事件初始化
  4142. * @returns
  4143. */
  4144. handle: function() {
  4145. const that = this;
  4146. const tagName = "span";
  4147. [".style", ".theme", ".tools"].forEach((selector) => {
  4148. tippy(selector, {
  4149. duration: 500,
  4150. allowHTML: true,
  4151. interactive: true,
  4152. trigger: "click",
  4153. onTrigger: function(instance) {
  4154. const tools2 = $(instance.reference);
  4155. tools2.siblings().find(tagName).removeClass();
  4156. tools2.find(tagName).addClass("active");
  4157. const template = tools2.find("template");
  4158. const type = template.data("type");
  4159. const value = _GM_getValue(type) || "default";
  4160. const ul = template.contents();
  4161. ul.find("li").removeClass();
  4162. ul.find(`li[data-value=${value}]`).addClass("active");
  4163. instance.setContent(template.html());
  4164. that.instance = instance;
  4165. },
  4166. onHide: function(instance) {
  4167. const tools2 = $(instance.reference);
  4168. tools2.find(tagName).removeClass();
  4169. }
  4170. });
  4171. });
  4172. return this;
  4173. },
  4174. /**
  4175. * 点击了对应选项
  4176. * 如点击了`主题`-`暗黑`,通过window.postMessage进行主题色更新
  4177. * @returns
  4178. */
  4179. checked: function() {
  4180. const that = this;
  4181. $(document.body).on("click", ".rightbox li", function() {
  4182. const el = $(this);
  4183. const hasClass = el.hasClass("active");
  4184. if (hasClass) {
  4185. return;
  4186. }
  4187. const type = el.data("type");
  4188. const value = el.data("value");
  4189. if (type !== "tools") {
  4190. el.addClass("active").siblings().removeClass();
  4191. } else {
  4192. that.instance.hide();
  4193. }
  4194. window.postMessage({ type, value });
  4195. });
  4196. return this;
  4197. },
  4198. init: function() {
  4199. this.handle().checked();
  4200. }
  4201. };
  4202. tabsEvent.init();
  4203. theme.init();
  4204. tools.init();
  4205. filter.init();
  4206. handleBar.init();
  4207.  
  4208. })
  4209. };
  4210. }));
  4211.  
  4212. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  4213. 'use strict';
  4214. return {
  4215. execute: (function () {
  4216.  
  4217. exports("t", tippy);
  4218.  
  4219. var top = "top";
  4220. var bottom = "bottom";
  4221. var right = "right";
  4222. var left = "left";
  4223. var auto = "auto";
  4224. var basePlacements = [top, bottom, right, left];
  4225. var start = "start";
  4226. var end = "end";
  4227. var clippingParents = "clippingParents";
  4228. var viewport = "viewport";
  4229. var popper = "popper";
  4230. var reference = "reference";
  4231. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  4232. return acc.concat([placement + "-" + start, placement + "-" + end]);
  4233. }, []);
  4234. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  4235. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  4236. }, []);
  4237. var beforeRead = "beforeRead";
  4238. var read = "read";
  4239. var afterRead = "afterRead";
  4240. var beforeMain = "beforeMain";
  4241. var main = "main";
  4242. var afterMain = "afterMain";
  4243. var beforeWrite = "beforeWrite";
  4244. var write = "write";
  4245. var afterWrite = "afterWrite";
  4246. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  4247. function getNodeName(element) {
  4248. return element ? (element.nodeName || "").toLowerCase() : null;
  4249. }
  4250. function getWindow(node) {
  4251. if (node == null) {
  4252. return window;
  4253. }
  4254. if (node.toString() !== "[object Window]") {
  4255. var ownerDocument = node.ownerDocument;
  4256. return ownerDocument ? ownerDocument.defaultView || window : window;
  4257. }
  4258. return node;
  4259. }
  4260. function isElement$1(node) {
  4261. var OwnElement = getWindow(node).Element;
  4262. return node instanceof OwnElement || node instanceof Element;
  4263. }
  4264. function isHTMLElement(node) {
  4265. var OwnElement = getWindow(node).HTMLElement;
  4266. return node instanceof OwnElement || node instanceof HTMLElement;
  4267. }
  4268. function isShadowRoot(node) {
  4269. if (typeof ShadowRoot === "undefined") {
  4270. return false;
  4271. }
  4272. var OwnElement = getWindow(node).ShadowRoot;
  4273. return node instanceof OwnElement || node instanceof ShadowRoot;
  4274. }
  4275. function applyStyles(_ref) {
  4276. var state = _ref.state;
  4277. Object.keys(state.elements).forEach(function(name) {
  4278. var style = state.styles[name] || {};
  4279. var attributes = state.attributes[name] || {};
  4280. var element = state.elements[name];
  4281. if (!isHTMLElement(element) || !getNodeName(element)) {
  4282. return;
  4283. }
  4284. Object.assign(element.style, style);
  4285. Object.keys(attributes).forEach(function(name2) {
  4286. var value = attributes[name2];
  4287. if (value === false) {
  4288. element.removeAttribute(name2);
  4289. } else {
  4290. element.setAttribute(name2, value === true ? "" : value);
  4291. }
  4292. });
  4293. });
  4294. }
  4295. function effect$2(_ref2) {
  4296. var state = _ref2.state;
  4297. var initialStyles = {
  4298. popper: {
  4299. position: state.options.strategy,
  4300. left: "0",
  4301. top: "0",
  4302. margin: "0"
  4303. },
  4304. arrow: {
  4305. position: "absolute"
  4306. },
  4307. reference: {}
  4308. };
  4309. Object.assign(state.elements.popper.style, initialStyles.popper);
  4310. state.styles = initialStyles;
  4311. if (state.elements.arrow) {
  4312. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  4313. }
  4314. return function() {
  4315. Object.keys(state.elements).forEach(function(name) {
  4316. var element = state.elements[name];
  4317. var attributes = state.attributes[name] || {};
  4318. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  4319. var style = styleProperties.reduce(function(style2, property) {
  4320. style2[property] = "";
  4321. return style2;
  4322. }, {});
  4323. if (!isHTMLElement(element) || !getNodeName(element)) {
  4324. return;
  4325. }
  4326. Object.assign(element.style, style);
  4327. Object.keys(attributes).forEach(function(attribute) {
  4328. element.removeAttribute(attribute);
  4329. });
  4330. });
  4331. };
  4332. }
  4333. const applyStyles$1 = {
  4334. name: "applyStyles",
  4335. enabled: true,
  4336. phase: "write",
  4337. fn: applyStyles,
  4338. effect: effect$2,
  4339. requires: ["computeStyles"]
  4340. };
  4341. function getBasePlacement$1(placement) {
  4342. return placement.split("-")[0];
  4343. }
  4344. var max = Math.max;
  4345. var min = Math.min;
  4346. var round = Math.round;
  4347. function getUAString() {
  4348. var uaData = navigator.userAgentData;
  4349. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  4350. return uaData.brands.map(function(item) {
  4351. return item.brand + "/" + item.version;
  4352. }).join(" ");
  4353. }
  4354. return navigator.userAgent;
  4355. }
  4356. function isLayoutViewport() {
  4357. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  4358. }
  4359. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  4360. if (includeScale === void 0) {
  4361. includeScale = false;
  4362. }
  4363. if (isFixedStrategy === void 0) {
  4364. isFixedStrategy = false;
  4365. }
  4366. var clientRect = element.getBoundingClientRect();
  4367. var scaleX = 1;
  4368. var scaleY = 1;
  4369. if (includeScale && isHTMLElement(element)) {
  4370. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  4371. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  4372. }
  4373. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  4374. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  4375. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  4376. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  4377. var width = clientRect.width / scaleX;
  4378. var height = clientRect.height / scaleY;
  4379. return {
  4380. width,
  4381. height,
  4382. top: y,
  4383. right: x + width,
  4384. bottom: y + height,
  4385. left: x,
  4386. x,
  4387. y
  4388. };
  4389. }
  4390. function getLayoutRect(element) {
  4391. var clientRect = getBoundingClientRect(element);
  4392. var width = element.offsetWidth;
  4393. var height = element.offsetHeight;
  4394. if (Math.abs(clientRect.width - width) <= 1) {
  4395. width = clientRect.width;
  4396. }
  4397. if (Math.abs(clientRect.height - height) <= 1) {
  4398. height = clientRect.height;
  4399. }
  4400. return {
  4401. x: element.offsetLeft,
  4402. y: element.offsetTop,
  4403. width,
  4404. height
  4405. };
  4406. }
  4407. function contains(parent, child) {
  4408. var rootNode = child.getRootNode && child.getRootNode();
  4409. if (parent.contains(child)) {
  4410. return true;
  4411. } else if (rootNode && isShadowRoot(rootNode)) {
  4412. var next = child;
  4413. do {
  4414. if (next && parent.isSameNode(next)) {
  4415. return true;
  4416. }
  4417. next = next.parentNode || next.host;
  4418. } while (next);
  4419. }
  4420. return false;
  4421. }
  4422. function getComputedStyle(element) {
  4423. return getWindow(element).getComputedStyle(element);
  4424. }
  4425. function isTableElement(element) {
  4426. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  4427. }
  4428. function getDocumentElement(element) {
  4429. return ((isElement$1(element) ? element.ownerDocument : (
  4430. // $FlowFixMe[prop-missing]
  4431. element.document
  4432. )) || window.document).documentElement;
  4433. }
  4434. function getParentNode(element) {
  4435. if (getNodeName(element) === "html") {
  4436. return element;
  4437. }
  4438. return (
  4439. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  4440. // $FlowFixMe[incompatible-return]
  4441. // $FlowFixMe[prop-missing]
  4442. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  4443. element.parentNode || // DOM Element detected
  4444. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  4445. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  4446. getDocumentElement(element)
  4447. );
  4448. }
  4449. function getTrueOffsetParent(element) {
  4450. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  4451. getComputedStyle(element).position === "fixed") {
  4452. return null;
  4453. }
  4454. return element.offsetParent;
  4455. }
  4456. function getContainingBlock(element) {
  4457. var isFirefox = /firefox/i.test(getUAString());
  4458. var isIE = /Trident/i.test(getUAString());
  4459. if (isIE && isHTMLElement(element)) {
  4460. var elementCss = getComputedStyle(element);
  4461. if (elementCss.position === "fixed") {
  4462. return null;
  4463. }
  4464. }
  4465. var currentNode = getParentNode(element);
  4466. if (isShadowRoot(currentNode)) {
  4467. currentNode = currentNode.host;
  4468. }
  4469. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  4470. var css = getComputedStyle(currentNode);
  4471. 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") {
  4472. return currentNode;
  4473. } else {
  4474. currentNode = currentNode.parentNode;
  4475. }
  4476. }
  4477. return null;
  4478. }
  4479. function getOffsetParent(element) {
  4480. var window2 = getWindow(element);
  4481. var offsetParent = getTrueOffsetParent(element);
  4482. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  4483. offsetParent = getTrueOffsetParent(offsetParent);
  4484. }
  4485. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  4486. return window2;
  4487. }
  4488. return offsetParent || getContainingBlock(element) || window2;
  4489. }
  4490. function getMainAxisFromPlacement(placement) {
  4491. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  4492. }
  4493. function within(min$1, value, max$1) {
  4494. return max(min$1, min(value, max$1));
  4495. }
  4496. function withinMaxClamp(min2, value, max2) {
  4497. var v = within(min2, value, max2);
  4498. return v > max2 ? max2 : v;
  4499. }
  4500. function getFreshSideObject() {
  4501. return {
  4502. top: 0,
  4503. right: 0,
  4504. bottom: 0,
  4505. left: 0
  4506. };
  4507. }
  4508. function mergePaddingObject(paddingObject) {
  4509. return Object.assign({}, getFreshSideObject(), paddingObject);
  4510. }
  4511. function expandToHashMap(value, keys) {
  4512. return keys.reduce(function(hashMap, key) {
  4513. hashMap[key] = value;
  4514. return hashMap;
  4515. }, {});
  4516. }
  4517. var toPaddingObject = function toPaddingObject2(padding, state) {
  4518. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  4519. placement: state.placement
  4520. })) : padding;
  4521. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  4522. };
  4523. function arrow(_ref) {
  4524. var _state$modifiersData$;
  4525. var state = _ref.state, name = _ref.name, options = _ref.options;
  4526. var arrowElement = state.elements.arrow;
  4527. var popperOffsets2 = state.modifiersData.popperOffsets;
  4528. var basePlacement = getBasePlacement$1(state.placement);
  4529. var axis = getMainAxisFromPlacement(basePlacement);
  4530. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  4531. var len = isVertical ? "height" : "width";
  4532. if (!arrowElement || !popperOffsets2) {
  4533. return;
  4534. }
  4535. var paddingObject = toPaddingObject(options.padding, state);
  4536. var arrowRect = getLayoutRect(arrowElement);
  4537. var minProp = axis === "y" ? top : left;
  4538. var maxProp = axis === "y" ? bottom : right;
  4539. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  4540. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  4541. var arrowOffsetParent = getOffsetParent(arrowElement);
  4542. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  4543. var centerToReference = endDiff / 2 - startDiff / 2;
  4544. var min2 = paddingObject[minProp];
  4545. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  4546. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  4547. var offset2 = within(min2, center, max2);
  4548. var axisProp = axis;
  4549. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  4550. }
  4551. function effect$1(_ref2) {
  4552. var state = _ref2.state, options = _ref2.options;
  4553. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  4554. if (arrowElement == null) {
  4555. return;
  4556. }
  4557. if (typeof arrowElement === "string") {
  4558. arrowElement = state.elements.popper.querySelector(arrowElement);
  4559. if (!arrowElement) {
  4560. return;
  4561. }
  4562. }
  4563. if (!contains(state.elements.popper, arrowElement)) {
  4564. return;
  4565. }
  4566. state.elements.arrow = arrowElement;
  4567. }
  4568. const arrow$1 = {
  4569. name: "arrow",
  4570. enabled: true,
  4571. phase: "main",
  4572. fn: arrow,
  4573. effect: effect$1,
  4574. requires: ["popperOffsets"],
  4575. requiresIfExists: ["preventOverflow"]
  4576. };
  4577. function getVariation(placement) {
  4578. return placement.split("-")[1];
  4579. }
  4580. var unsetSides = {
  4581. top: "auto",
  4582. right: "auto",
  4583. bottom: "auto",
  4584. left: "auto"
  4585. };
  4586. function roundOffsetsByDPR(_ref, win) {
  4587. var x = _ref.x, y = _ref.y;
  4588. var dpr = win.devicePixelRatio || 1;
  4589. return {
  4590. x: round(x * dpr) / dpr || 0,
  4591. y: round(y * dpr) / dpr || 0
  4592. };
  4593. }
  4594. function mapToStyles(_ref2) {
  4595. var _Object$assign2;
  4596. 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;
  4597. 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;
  4598. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  4599. x,
  4600. y
  4601. }) : {
  4602. x,
  4603. y
  4604. };
  4605. x = _ref3.x;
  4606. y = _ref3.y;
  4607. var hasX = offsets.hasOwnProperty("x");
  4608. var hasY = offsets.hasOwnProperty("y");
  4609. var sideX = left;
  4610. var sideY = top;
  4611. var win = window;
  4612. if (adaptive) {
  4613. var offsetParent = getOffsetParent(popper2);
  4614. var heightProp = "clientHeight";
  4615. var widthProp = "clientWidth";
  4616. if (offsetParent === getWindow(popper2)) {
  4617. offsetParent = getDocumentElement(popper2);
  4618. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  4619. heightProp = "scrollHeight";
  4620. widthProp = "scrollWidth";
  4621. }
  4622. }
  4623. offsetParent = offsetParent;
  4624. if (placement === top || (placement === left || placement === right) && variation === end) {
  4625. sideY = bottom;
  4626. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  4627. // $FlowFixMe[prop-missing]
  4628. offsetParent[heightProp]
  4629. );
  4630. y -= offsetY - popperRect.height;
  4631. y *= gpuAcceleration ? 1 : -1;
  4632. }
  4633. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  4634. sideX = right;
  4635. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  4636. // $FlowFixMe[prop-missing]
  4637. offsetParent[widthProp]
  4638. );
  4639. x -= offsetX - popperRect.width;
  4640. x *= gpuAcceleration ? 1 : -1;
  4641. }
  4642. }
  4643. var commonStyles = Object.assign({
  4644. position
  4645. }, adaptive && unsetSides);
  4646. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  4647. x,
  4648. y
  4649. }, getWindow(popper2)) : {
  4650. x,
  4651. y
  4652. };
  4653. x = _ref4.x;
  4654. y = _ref4.y;
  4655. if (gpuAcceleration) {
  4656. var _Object$assign;
  4657. 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));
  4658. }
  4659. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  4660. }
  4661. function computeStyles(_ref5) {
  4662. var state = _ref5.state, options = _ref5.options;
  4663. 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;
  4664. var commonStyles = {
  4665. placement: getBasePlacement$1(state.placement),
  4666. variation: getVariation(state.placement),
  4667. popper: state.elements.popper,
  4668. popperRect: state.rects.popper,
  4669. gpuAcceleration,
  4670. isFixed: state.options.strategy === "fixed"
  4671. };
  4672. if (state.modifiersData.popperOffsets != null) {
  4673. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  4674. offsets: state.modifiersData.popperOffsets,
  4675. position: state.options.strategy,
  4676. adaptive,
  4677. roundOffsets
  4678. })));
  4679. }
  4680. if (state.modifiersData.arrow != null) {
  4681. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  4682. offsets: state.modifiersData.arrow,
  4683. position: "absolute",
  4684. adaptive: false,
  4685. roundOffsets
  4686. })));
  4687. }
  4688. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  4689. "data-popper-placement": state.placement
  4690. });
  4691. }
  4692. const computeStyles$1 = {
  4693. name: "computeStyles",
  4694. enabled: true,
  4695. phase: "beforeWrite",
  4696. fn: computeStyles,
  4697. data: {}
  4698. };
  4699. var passive = {
  4700. passive: true
  4701. };
  4702. function effect(_ref) {
  4703. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  4704. 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;
  4705. var window2 = getWindow(state.elements.popper);
  4706. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  4707. if (scroll) {
  4708. scrollParents.forEach(function(scrollParent) {
  4709. scrollParent.addEventListener("scroll", instance.update, passive);
  4710. });
  4711. }
  4712. if (resize) {
  4713. window2.addEventListener("resize", instance.update, passive);
  4714. }
  4715. return function() {
  4716. if (scroll) {
  4717. scrollParents.forEach(function(scrollParent) {
  4718. scrollParent.removeEventListener("scroll", instance.update, passive);
  4719. });
  4720. }
  4721. if (resize) {
  4722. window2.removeEventListener("resize", instance.update, passive);
  4723. }
  4724. };
  4725. }
  4726. const eventListeners = {
  4727. name: "eventListeners",
  4728. enabled: true,
  4729. phase: "write",
  4730. fn: function fn() {
  4731. },
  4732. effect,
  4733. data: {}
  4734. };
  4735. var hash$1 = {
  4736. left: "right",
  4737. right: "left",
  4738. bottom: "top",
  4739. top: "bottom"
  4740. };
  4741. function getOppositePlacement(placement) {
  4742. return placement.replace(/left|right|bottom|top/g, function(matched) {
  4743. return hash$1[matched];
  4744. });
  4745. }
  4746. var hash = {
  4747. start: "end",
  4748. end: "start"
  4749. };
  4750. function getOppositeVariationPlacement(placement) {
  4751. return placement.replace(/start|end/g, function(matched) {
  4752. return hash[matched];
  4753. });
  4754. }
  4755. function getWindowScroll(node) {
  4756. var win = getWindow(node);
  4757. var scrollLeft = win.pageXOffset;
  4758. var scrollTop = win.pageYOffset;
  4759. return {
  4760. scrollLeft,
  4761. scrollTop
  4762. };
  4763. }
  4764. function getWindowScrollBarX(element) {
  4765. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  4766. }
  4767. function getViewportRect(element, strategy) {
  4768. var win = getWindow(element);
  4769. var html = getDocumentElement(element);
  4770. var visualViewport = win.visualViewport;
  4771. var width = html.clientWidth;
  4772. var height = html.clientHeight;
  4773. var x = 0;
  4774. var y = 0;
  4775. if (visualViewport) {
  4776. width = visualViewport.width;
  4777. height = visualViewport.height;
  4778. var layoutViewport = isLayoutViewport();
  4779. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  4780. x = visualViewport.offsetLeft;
  4781. y = visualViewport.offsetTop;
  4782. }
  4783. }
  4784. return {
  4785. width,
  4786. height,
  4787. x: x + getWindowScrollBarX(element),
  4788. y
  4789. };
  4790. }
  4791. function getDocumentRect(element) {
  4792. var _element$ownerDocumen;
  4793. var html = getDocumentElement(element);
  4794. var winScroll = getWindowScroll(element);
  4795. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  4796. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  4797. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  4798. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  4799. var y = -winScroll.scrollTop;
  4800. if (getComputedStyle(body || html).direction === "rtl") {
  4801. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  4802. }
  4803. return {
  4804. width,
  4805. height,
  4806. x,
  4807. y
  4808. };
  4809. }
  4810. function isScrollParent(element) {
  4811. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  4812. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  4813. }
  4814. function getScrollParent(node) {
  4815. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  4816. return node.ownerDocument.body;
  4817. }
  4818. if (isHTMLElement(node) && isScrollParent(node)) {
  4819. return node;
  4820. }
  4821. return getScrollParent(getParentNode(node));
  4822. }
  4823. function listScrollParents(element, list) {
  4824. var _element$ownerDocumen;
  4825. if (list === void 0) {
  4826. list = [];
  4827. }
  4828. var scrollParent = getScrollParent(element);
  4829. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  4830. var win = getWindow(scrollParent);
  4831. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  4832. var updatedList = list.concat(target);
  4833. return isBody ? updatedList : (
  4834. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  4835. updatedList.concat(listScrollParents(getParentNode(target)))
  4836. );
  4837. }
  4838. function rectToClientRect(rect) {
  4839. return Object.assign({}, rect, {
  4840. left: rect.x,
  4841. top: rect.y,
  4842. right: rect.x + rect.width,
  4843. bottom: rect.y + rect.height
  4844. });
  4845. }
  4846. function getInnerBoundingClientRect(element, strategy) {
  4847. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  4848. rect.top = rect.top + element.clientTop;
  4849. rect.left = rect.left + element.clientLeft;
  4850. rect.bottom = rect.top + element.clientHeight;
  4851. rect.right = rect.left + element.clientWidth;
  4852. rect.width = element.clientWidth;
  4853. rect.height = element.clientHeight;
  4854. rect.x = rect.left;
  4855. rect.y = rect.top;
  4856. return rect;
  4857. }
  4858. function getClientRectFromMixedType(element, clippingParent, strategy) {
  4859. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  4860. }
  4861. function getClippingParents(element) {
  4862. var clippingParents2 = listScrollParents(getParentNode(element));
  4863. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  4864. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  4865. if (!isElement$1(clipperElement)) {
  4866. return [];
  4867. }
  4868. return clippingParents2.filter(function(clippingParent) {
  4869. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  4870. });
  4871. }
  4872. function getClippingRect(element, boundary, rootBoundary, strategy) {
  4873. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  4874. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  4875. var firstClippingParent = clippingParents2[0];
  4876. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  4877. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  4878. accRect.top = max(rect.top, accRect.top);
  4879. accRect.right = min(rect.right, accRect.right);
  4880. accRect.bottom = min(rect.bottom, accRect.bottom);
  4881. accRect.left = max(rect.left, accRect.left);
  4882. return accRect;
  4883. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  4884. clippingRect.width = clippingRect.right - clippingRect.left;
  4885. clippingRect.height = clippingRect.bottom - clippingRect.top;
  4886. clippingRect.x = clippingRect.left;
  4887. clippingRect.y = clippingRect.top;
  4888. return clippingRect;
  4889. }
  4890. function computeOffsets(_ref) {
  4891. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  4892. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  4893. var variation = placement ? getVariation(placement) : null;
  4894. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  4895. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  4896. var offsets;
  4897. switch (basePlacement) {
  4898. case top:
  4899. offsets = {
  4900. x: commonX,
  4901. y: reference2.y - element.height
  4902. };
  4903. break;
  4904. case bottom:
  4905. offsets = {
  4906. x: commonX,
  4907. y: reference2.y + reference2.height
  4908. };
  4909. break;
  4910. case right:
  4911. offsets = {
  4912. x: reference2.x + reference2.width,
  4913. y: commonY
  4914. };
  4915. break;
  4916. case left:
  4917. offsets = {
  4918. x: reference2.x - element.width,
  4919. y: commonY
  4920. };
  4921. break;
  4922. default:
  4923. offsets = {
  4924. x: reference2.x,
  4925. y: reference2.y
  4926. };
  4927. }
  4928. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  4929. if (mainAxis != null) {
  4930. var len = mainAxis === "y" ? "height" : "width";
  4931. switch (variation) {
  4932. case start:
  4933. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  4934. break;
  4935. case end:
  4936. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  4937. break;
  4938. }
  4939. }
  4940. return offsets;
  4941. }
  4942. function detectOverflow(state, options) {
  4943. if (options === void 0) {
  4944. options = {};
  4945. }
  4946. 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;
  4947. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  4948. var altContext = elementContext === popper ? reference : popper;
  4949. var popperRect = state.rects.popper;
  4950. var element = state.elements[altBoundary ? altContext : elementContext];
  4951. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  4952. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  4953. var popperOffsets2 = computeOffsets({
  4954. reference: referenceClientRect,
  4955. element: popperRect,
  4956. strategy: "absolute",
  4957. placement
  4958. });
  4959. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  4960. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  4961. var overflowOffsets = {
  4962. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  4963. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  4964. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  4965. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  4966. };
  4967. var offsetData = state.modifiersData.offset;
  4968. if (elementContext === popper && offsetData) {
  4969. var offset2 = offsetData[placement];
  4970. Object.keys(overflowOffsets).forEach(function(key) {
  4971. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  4972. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  4973. overflowOffsets[key] += offset2[axis] * multiply;
  4974. });
  4975. }
  4976. return overflowOffsets;
  4977. }
  4978. function computeAutoPlacement(state, options) {
  4979. if (options === void 0) {
  4980. options = {};
  4981. }
  4982. 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;
  4983. var variation = getVariation(placement);
  4984. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  4985. return getVariation(placement2) === variation;
  4986. }) : basePlacements;
  4987. var allowedPlacements = placements$1.filter(function(placement2) {
  4988. return allowedAutoPlacements.indexOf(placement2) >= 0;
  4989. });
  4990. if (allowedPlacements.length === 0) {
  4991. allowedPlacements = placements$1;
  4992. }
  4993. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  4994. acc[placement2] = detectOverflow(state, {
  4995. placement: placement2,
  4996. boundary,
  4997. rootBoundary,
  4998. padding
  4999. })[getBasePlacement$1(placement2)];
  5000. return acc;
  5001. }, {});
  5002. return Object.keys(overflows).sort(function(a, b) {
  5003. return overflows[a] - overflows[b];
  5004. });
  5005. }
  5006. function getExpandedFallbackPlacements(placement) {
  5007. if (getBasePlacement$1(placement) === auto) {
  5008. return [];
  5009. }
  5010. var oppositePlacement = getOppositePlacement(placement);
  5011. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5012. }
  5013. function flip(_ref) {
  5014. var state = _ref.state, options = _ref.options, name = _ref.name;
  5015. if (state.modifiersData[name]._skip) {
  5016. return;
  5017. }
  5018. 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;
  5019. var preferredPlacement = state.options.placement;
  5020. var basePlacement = getBasePlacement$1(preferredPlacement);
  5021. var isBasePlacement = basePlacement === preferredPlacement;
  5022. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5023. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5024. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  5025. placement: placement2,
  5026. boundary,
  5027. rootBoundary,
  5028. padding,
  5029. flipVariations,
  5030. allowedAutoPlacements
  5031. }) : placement2);
  5032. }, []);
  5033. var referenceRect = state.rects.reference;
  5034. var popperRect = state.rects.popper;
  5035. var checksMap = /* @__PURE__ */ new Map();
  5036. var makeFallbackChecks = true;
  5037. var firstFittingPlacement = placements2[0];
  5038. for (var i = 0; i < placements2.length; i++) {
  5039. var placement = placements2[i];
  5040. var _basePlacement = getBasePlacement$1(placement);
  5041. var isStartVariation = getVariation(placement) === start;
  5042. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5043. var len = isVertical ? "width" : "height";
  5044. var overflow = detectOverflow(state, {
  5045. placement,
  5046. boundary,
  5047. rootBoundary,
  5048. altBoundary,
  5049. padding
  5050. });
  5051. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5052. if (referenceRect[len] > popperRect[len]) {
  5053. mainVariationSide = getOppositePlacement(mainVariationSide);
  5054. }
  5055. var altVariationSide = getOppositePlacement(mainVariationSide);
  5056. var checks = [];
  5057. if (checkMainAxis) {
  5058. checks.push(overflow[_basePlacement] <= 0);
  5059. }
  5060. if (checkAltAxis) {
  5061. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5062. }
  5063. if (checks.every(function(check) {
  5064. return check;
  5065. })) {
  5066. firstFittingPlacement = placement;
  5067. makeFallbackChecks = false;
  5068. break;
  5069. }
  5070. checksMap.set(placement, checks);
  5071. }
  5072. if (makeFallbackChecks) {
  5073. var numberOfChecks = flipVariations ? 3 : 1;
  5074. var _loop = function _loop2(_i2) {
  5075. var fittingPlacement = placements2.find(function(placement2) {
  5076. var checks2 = checksMap.get(placement2);
  5077. if (checks2) {
  5078. return checks2.slice(0, _i2).every(function(check) {
  5079. return check;
  5080. });
  5081. }
  5082. });
  5083. if (fittingPlacement) {
  5084. firstFittingPlacement = fittingPlacement;
  5085. return "break";
  5086. }
  5087. };
  5088. for (var _i = numberOfChecks; _i > 0; _i--) {
  5089. var _ret = _loop(_i);
  5090. if (_ret === "break") break;
  5091. }
  5092. }
  5093. if (state.placement !== firstFittingPlacement) {
  5094. state.modifiersData[name]._skip = true;
  5095. state.placement = firstFittingPlacement;
  5096. state.reset = true;
  5097. }
  5098. }
  5099. const flip$1 = {
  5100. name: "flip",
  5101. enabled: true,
  5102. phase: "main",
  5103. fn: flip,
  5104. requiresIfExists: ["offset"],
  5105. data: {
  5106. _skip: false
  5107. }
  5108. };
  5109. function getSideOffsets(overflow, rect, preventedOffsets) {
  5110. if (preventedOffsets === void 0) {
  5111. preventedOffsets = {
  5112. x: 0,
  5113. y: 0
  5114. };
  5115. }
  5116. return {
  5117. top: overflow.top - rect.height - preventedOffsets.y,
  5118. right: overflow.right - rect.width + preventedOffsets.x,
  5119. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5120. left: overflow.left - rect.width - preventedOffsets.x
  5121. };
  5122. }
  5123. function isAnySideFullyClipped(overflow) {
  5124. return [top, right, bottom, left].some(function(side) {
  5125. return overflow[side] >= 0;
  5126. });
  5127. }
  5128. function hide(_ref) {
  5129. var state = _ref.state, name = _ref.name;
  5130. var referenceRect = state.rects.reference;
  5131. var popperRect = state.rects.popper;
  5132. var preventedOffsets = state.modifiersData.preventOverflow;
  5133. var referenceOverflow = detectOverflow(state, {
  5134. elementContext: "reference"
  5135. });
  5136. var popperAltOverflow = detectOverflow(state, {
  5137. altBoundary: true
  5138. });
  5139. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5140. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5141. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5142. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5143. state.modifiersData[name] = {
  5144. referenceClippingOffsets,
  5145. popperEscapeOffsets,
  5146. isReferenceHidden,
  5147. hasPopperEscaped
  5148. };
  5149. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5150. "data-popper-reference-hidden": isReferenceHidden,
  5151. "data-popper-escaped": hasPopperEscaped
  5152. });
  5153. }
  5154. const hide$1 = {
  5155. name: "hide",
  5156. enabled: true,
  5157. phase: "main",
  5158. requiresIfExists: ["preventOverflow"],
  5159. fn: hide
  5160. };
  5161. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5162. var basePlacement = getBasePlacement$1(placement);
  5163. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5164. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5165. placement
  5166. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5167. skidding = skidding || 0;
  5168. distance = (distance || 0) * invertDistance;
  5169. return [left, right].indexOf(basePlacement) >= 0 ? {
  5170. x: distance,
  5171. y: skidding
  5172. } : {
  5173. x: skidding,
  5174. y: distance
  5175. };
  5176. }
  5177. function offset(_ref2) {
  5178. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5179. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5180. var data = placements.reduce(function(acc, placement) {
  5181. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5182. return acc;
  5183. }, {});
  5184. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  5185. if (state.modifiersData.popperOffsets != null) {
  5186. state.modifiersData.popperOffsets.x += x;
  5187. state.modifiersData.popperOffsets.y += y;
  5188. }
  5189. state.modifiersData[name] = data;
  5190. }
  5191. const offset$1 = {
  5192. name: "offset",
  5193. enabled: true,
  5194. phase: "main",
  5195. requires: ["popperOffsets"],
  5196. fn: offset
  5197. };
  5198. function popperOffsets(_ref) {
  5199. var state = _ref.state, name = _ref.name;
  5200. state.modifiersData[name] = computeOffsets({
  5201. reference: state.rects.reference,
  5202. element: state.rects.popper,
  5203. strategy: "absolute",
  5204. placement: state.placement
  5205. });
  5206. }
  5207. const popperOffsets$1 = {
  5208. name: "popperOffsets",
  5209. enabled: true,
  5210. phase: "read",
  5211. fn: popperOffsets,
  5212. data: {}
  5213. };
  5214. function getAltAxis(axis) {
  5215. return axis === "x" ? "y" : "x";
  5216. }
  5217. function preventOverflow(_ref) {
  5218. var state = _ref.state, options = _ref.options, name = _ref.name;
  5219. 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;
  5220. var overflow = detectOverflow(state, {
  5221. boundary,
  5222. rootBoundary,
  5223. padding,
  5224. altBoundary
  5225. });
  5226. var basePlacement = getBasePlacement$1(state.placement);
  5227. var variation = getVariation(state.placement);
  5228. var isBasePlacement = !variation;
  5229. var mainAxis = getMainAxisFromPlacement(basePlacement);
  5230. var altAxis = getAltAxis(mainAxis);
  5231. var popperOffsets2 = state.modifiersData.popperOffsets;
  5232. var referenceRect = state.rects.reference;
  5233. var popperRect = state.rects.popper;
  5234. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  5235. placement: state.placement
  5236. })) : tetherOffset;
  5237. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  5238. mainAxis: tetherOffsetValue,
  5239. altAxis: tetherOffsetValue
  5240. } : Object.assign({
  5241. mainAxis: 0,
  5242. altAxis: 0
  5243. }, tetherOffsetValue);
  5244. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  5245. var data = {
  5246. x: 0,
  5247. y: 0
  5248. };
  5249. if (!popperOffsets2) {
  5250. return;
  5251. }
  5252. if (checkMainAxis) {
  5253. var _offsetModifierState$;
  5254. var mainSide = mainAxis === "y" ? top : left;
  5255. var altSide = mainAxis === "y" ? bottom : right;
  5256. var len = mainAxis === "y" ? "height" : "width";
  5257. var offset2 = popperOffsets2[mainAxis];
  5258. var min$1 = offset2 + overflow[mainSide];
  5259. var max$1 = offset2 - overflow[altSide];
  5260. var additive = tether ? -popperRect[len] / 2 : 0;
  5261. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  5262. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  5263. var arrowElement = state.elements.arrow;
  5264. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  5265. width: 0,
  5266. height: 0
  5267. };
  5268. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  5269. var arrowPaddingMin = arrowPaddingObject[mainSide];
  5270. var arrowPaddingMax = arrowPaddingObject[altSide];
  5271. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  5272. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  5273. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  5274. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  5275. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  5276. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  5277. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  5278. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  5279. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  5280. popperOffsets2[mainAxis] = preventedOffset;
  5281. data[mainAxis] = preventedOffset - offset2;
  5282. }
  5283. if (checkAltAxis) {
  5284. var _offsetModifierState$2;
  5285. var _mainSide = mainAxis === "x" ? top : left;
  5286. var _altSide = mainAxis === "x" ? bottom : right;
  5287. var _offset = popperOffsets2[altAxis];
  5288. var _len = altAxis === "y" ? "height" : "width";
  5289. var _min = _offset + overflow[_mainSide];
  5290. var _max = _offset - overflow[_altSide];
  5291. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  5292. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  5293. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  5294. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  5295. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  5296. popperOffsets2[altAxis] = _preventedOffset;
  5297. data[altAxis] = _preventedOffset - _offset;
  5298. }
  5299. state.modifiersData[name] = data;
  5300. }
  5301. const preventOverflow$1 = {
  5302. name: "preventOverflow",
  5303. enabled: true,
  5304. phase: "main",
  5305. fn: preventOverflow,
  5306. requiresIfExists: ["offset"]
  5307. };
  5308. function getHTMLElementScroll(element) {
  5309. return {
  5310. scrollLeft: element.scrollLeft,
  5311. scrollTop: element.scrollTop
  5312. };
  5313. }
  5314. function getNodeScroll(node) {
  5315. if (node === getWindow(node) || !isHTMLElement(node)) {
  5316. return getWindowScroll(node);
  5317. } else {
  5318. return getHTMLElementScroll(node);
  5319. }
  5320. }
  5321. function isElementScaled(element) {
  5322. var rect = element.getBoundingClientRect();
  5323. var scaleX = round(rect.width) / element.offsetWidth || 1;
  5324. var scaleY = round(rect.height) / element.offsetHeight || 1;
  5325. return scaleX !== 1 || scaleY !== 1;
  5326. }
  5327. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  5328. if (isFixed === void 0) {
  5329. isFixed = false;
  5330. }
  5331. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  5332. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  5333. var documentElement = getDocumentElement(offsetParent);
  5334. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  5335. var scroll = {
  5336. scrollLeft: 0,
  5337. scrollTop: 0
  5338. };
  5339. var offsets = {
  5340. x: 0,
  5341. y: 0
  5342. };
  5343. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  5344. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  5345. isScrollParent(documentElement)) {
  5346. scroll = getNodeScroll(offsetParent);
  5347. }
  5348. if (isHTMLElement(offsetParent)) {
  5349. offsets = getBoundingClientRect(offsetParent, true);
  5350. offsets.x += offsetParent.clientLeft;
  5351. offsets.y += offsetParent.clientTop;
  5352. } else if (documentElement) {
  5353. offsets.x = getWindowScrollBarX(documentElement);
  5354. }
  5355. }
  5356. return {
  5357. x: rect.left + scroll.scrollLeft - offsets.x,
  5358. y: rect.top + scroll.scrollTop - offsets.y,
  5359. width: rect.width,
  5360. height: rect.height
  5361. };
  5362. }
  5363. function order(modifiers) {
  5364. var map = /* @__PURE__ */ new Map();
  5365. var visited = /* @__PURE__ */ new Set();
  5366. var result = [];
  5367. modifiers.forEach(function(modifier) {
  5368. map.set(modifier.name, modifier);
  5369. });
  5370. function sort(modifier) {
  5371. visited.add(modifier.name);
  5372. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  5373. requires.forEach(function(dep) {
  5374. if (!visited.has(dep)) {
  5375. var depModifier = map.get(dep);
  5376. if (depModifier) {
  5377. sort(depModifier);
  5378. }
  5379. }
  5380. });
  5381. result.push(modifier);
  5382. }
  5383. modifiers.forEach(function(modifier) {
  5384. if (!visited.has(modifier.name)) {
  5385. sort(modifier);
  5386. }
  5387. });
  5388. return result;
  5389. }
  5390. function orderModifiers(modifiers) {
  5391. var orderedModifiers = order(modifiers);
  5392. return modifierPhases.reduce(function(acc, phase) {
  5393. return acc.concat(orderedModifiers.filter(function(modifier) {
  5394. return modifier.phase === phase;
  5395. }));
  5396. }, []);
  5397. }
  5398. function debounce$1(fn2) {
  5399. var pending;
  5400. return function() {
  5401. if (!pending) {
  5402. pending = new Promise(function(resolve) {
  5403. Promise.resolve().then(function() {
  5404. pending = void 0;
  5405. resolve(fn2());
  5406. });
  5407. });
  5408. }
  5409. return pending;
  5410. };
  5411. }
  5412. function mergeByName(modifiers) {
  5413. var merged = modifiers.reduce(function(merged2, current) {
  5414. var existing = merged2[current.name];
  5415. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  5416. options: Object.assign({}, existing.options, current.options),
  5417. data: Object.assign({}, existing.data, current.data)
  5418. }) : current;
  5419. return merged2;
  5420. }, {});
  5421. return Object.keys(merged).map(function(key) {
  5422. return merged[key];
  5423. });
  5424. }
  5425. var DEFAULT_OPTIONS = {
  5426. placement: "bottom",
  5427. modifiers: [],
  5428. strategy: "absolute"
  5429. };
  5430. function areValidElements() {
  5431. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5432. args[_key] = arguments[_key];
  5433. }
  5434. return !args.some(function(element) {
  5435. return !(element && typeof element.getBoundingClientRect === "function");
  5436. });
  5437. }
  5438. function popperGenerator(generatorOptions) {
  5439. if (generatorOptions === void 0) {
  5440. generatorOptions = {};
  5441. }
  5442. 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;
  5443. return function createPopper2(reference2, popper2, options) {
  5444. if (options === void 0) {
  5445. options = defaultOptions;
  5446. }
  5447. var state = {
  5448. placement: "bottom",
  5449. orderedModifiers: [],
  5450. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  5451. modifiersData: {},
  5452. elements: {
  5453. reference: reference2,
  5454. popper: popper2
  5455. },
  5456. attributes: {},
  5457. styles: {}
  5458. };
  5459. var effectCleanupFns = [];
  5460. var isDestroyed = false;
  5461. var instance = {
  5462. state,
  5463. setOptions: function setOptions(setOptionsAction) {
  5464. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  5465. cleanupModifierEffects();
  5466. state.options = Object.assign({}, defaultOptions, state.options, options2);
  5467. state.scrollParents = {
  5468. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  5469. popper: listScrollParents(popper2)
  5470. };
  5471. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  5472. state.orderedModifiers = orderedModifiers.filter(function(m) {
  5473. return m.enabled;
  5474. });
  5475. runModifierEffects();
  5476. return instance.update();
  5477. },
  5478. // Sync update – it will always be executed, even if not necessary. This
  5479. // is useful for low frequency updates where sync behavior simplifies the
  5480. // logic.
  5481. // For high frequency updates (e.g. `resize` and `scroll` events), always
  5482. // prefer the async Popper#update method
  5483. forceUpdate: function forceUpdate() {
  5484. if (isDestroyed) {
  5485. return;
  5486. }
  5487. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  5488. if (!areValidElements(reference3, popper3)) {
  5489. return;
  5490. }
  5491. state.rects = {
  5492. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  5493. popper: getLayoutRect(popper3)
  5494. };
  5495. state.reset = false;
  5496. state.placement = state.options.placement;
  5497. state.orderedModifiers.forEach(function(modifier) {
  5498. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  5499. });
  5500. for (var index = 0; index < state.orderedModifiers.length; index++) {
  5501. if (state.reset === true) {
  5502. state.reset = false;
  5503. index = -1;
  5504. continue;
  5505. }
  5506. 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;
  5507. if (typeof fn2 === "function") {
  5508. state = fn2({
  5509. state,
  5510. options: _options,
  5511. name,
  5512. instance
  5513. }) || state;
  5514. }
  5515. }
  5516. },
  5517. // Async and optimistically optimized update – it will not be executed if
  5518. // not necessary (debounced to run at most once-per-tick)
  5519. update: debounce$1(function() {
  5520. return new Promise(function(resolve) {
  5521. instance.forceUpdate();
  5522. resolve(state);
  5523. });
  5524. }),
  5525. destroy: function destroy() {
  5526. cleanupModifierEffects();
  5527. isDestroyed = true;
  5528. }
  5529. };
  5530. if (!areValidElements(reference2, popper2)) {
  5531. return instance;
  5532. }
  5533. instance.setOptions(options).then(function(state2) {
  5534. if (!isDestroyed && options.onFirstUpdate) {
  5535. options.onFirstUpdate(state2);
  5536. }
  5537. });
  5538. function runModifierEffects() {
  5539. state.orderedModifiers.forEach(function(_ref) {
  5540. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  5541. if (typeof effect3 === "function") {
  5542. var cleanupFn = effect3({
  5543. state,
  5544. name,
  5545. instance,
  5546. options: options2
  5547. });
  5548. var noopFn = function noopFn2() {
  5549. };
  5550. effectCleanupFns.push(cleanupFn || noopFn);
  5551. }
  5552. });
  5553. }
  5554. function cleanupModifierEffects() {
  5555. effectCleanupFns.forEach(function(fn2) {
  5556. return fn2();
  5557. });
  5558. effectCleanupFns = [];
  5559. }
  5560. return instance;
  5561. };
  5562. }
  5563. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  5564. var createPopper = /* @__PURE__ */ popperGenerator({
  5565. defaultModifiers
  5566. });
  5567. var BOX_CLASS = "tippy-box";
  5568. var CONTENT_CLASS = "tippy-content";
  5569. var BACKDROP_CLASS = "tippy-backdrop";
  5570. var ARROW_CLASS = "tippy-arrow";
  5571. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  5572. var TOUCH_OPTIONS = {
  5573. passive: true,
  5574. capture: true
  5575. };
  5576. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  5577. return document.body;
  5578. };
  5579. function getValueAtIndexOrReturn(value, index, defaultValue) {
  5580. if (Array.isArray(value)) {
  5581. var v = value[index];
  5582. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  5583. }
  5584. return value;
  5585. }
  5586. function isType(value, type) {
  5587. var str = {}.toString.call(value);
  5588. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  5589. }
  5590. function invokeWithArgsOrReturn(value, args) {
  5591. return typeof value === "function" ? value.apply(void 0, args) : value;
  5592. }
  5593. function debounce(fn5, ms) {
  5594. if (ms === 0) {
  5595. return fn5;
  5596. }
  5597. var timeout;
  5598. return function(arg) {
  5599. clearTimeout(timeout);
  5600. timeout = setTimeout(function() {
  5601. fn5(arg);
  5602. }, ms);
  5603. };
  5604. }
  5605. function splitBySpaces(value) {
  5606. return value.split(/\s+/).filter(Boolean);
  5607. }
  5608. function normalizeToArray(value) {
  5609. return [].concat(value);
  5610. }
  5611. function pushIfUnique(arr, value) {
  5612. if (arr.indexOf(value) === -1) {
  5613. arr.push(value);
  5614. }
  5615. }
  5616. function unique(arr) {
  5617. return arr.filter(function(item, index) {
  5618. return arr.indexOf(item) === index;
  5619. });
  5620. }
  5621. function getBasePlacement(placement) {
  5622. return placement.split("-")[0];
  5623. }
  5624. function arrayFrom(value) {
  5625. return [].slice.call(value);
  5626. }
  5627. function removeUndefinedProps(obj) {
  5628. return Object.keys(obj).reduce(function(acc, key) {
  5629. if (obj[key] !== void 0) {
  5630. acc[key] = obj[key];
  5631. }
  5632. return acc;
  5633. }, {});
  5634. }
  5635. function div() {
  5636. return document.createElement("div");
  5637. }
  5638. function isElement(value) {
  5639. return ["Element", "Fragment"].some(function(type) {
  5640. return isType(value, type);
  5641. });
  5642. }
  5643. function isNodeList(value) {
  5644. return isType(value, "NodeList");
  5645. }
  5646. function isMouseEvent(value) {
  5647. return isType(value, "MouseEvent");
  5648. }
  5649. function isReferenceElement(value) {
  5650. return !!(value && value._tippy && value._tippy.reference === value);
  5651. }
  5652. function getArrayOfElements(value) {
  5653. if (isElement(value)) {
  5654. return [value];
  5655. }
  5656. if (isNodeList(value)) {
  5657. return arrayFrom(value);
  5658. }
  5659. if (Array.isArray(value)) {
  5660. return value;
  5661. }
  5662. return arrayFrom(document.querySelectorAll(value));
  5663. }
  5664. function setTransitionDuration(els, value) {
  5665. els.forEach(function(el) {
  5666. if (el) {
  5667. el.style.transitionDuration = value + "ms";
  5668. }
  5669. });
  5670. }
  5671. function setVisibilityState(els, state) {
  5672. els.forEach(function(el) {
  5673. if (el) {
  5674. el.setAttribute("data-state", state);
  5675. }
  5676. });
  5677. }
  5678. function getOwnerDocument(elementOrElements) {
  5679. var _element$ownerDocumen;
  5680. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  5681. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  5682. }
  5683. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  5684. var clientX = event.clientX, clientY = event.clientY;
  5685. return popperTreeData.every(function(_ref) {
  5686. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  5687. var interactiveBorder = props.interactiveBorder;
  5688. var basePlacement = getBasePlacement(popperState.placement);
  5689. var offsetData = popperState.modifiersData.offset;
  5690. if (!offsetData) {
  5691. return true;
  5692. }
  5693. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  5694. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  5695. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  5696. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  5697. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  5698. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  5699. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  5700. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  5701. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  5702. });
  5703. }
  5704. function updateTransitionEndListener(box, action, listener) {
  5705. var method = action + "EventListener";
  5706. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  5707. box[method](event, listener);
  5708. });
  5709. }
  5710. function actualContains(parent, child) {
  5711. var target = child;
  5712. while (target) {
  5713. var _target$getRootNode;
  5714. if (parent.contains(target)) {
  5715. return true;
  5716. }
  5717. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  5718. }
  5719. return false;
  5720. }
  5721. var currentInput = {
  5722. isTouch: false
  5723. };
  5724. var lastMouseMoveTime = 0;
  5725. function onDocumentTouchStart() {
  5726. if (currentInput.isTouch) {
  5727. return;
  5728. }
  5729. currentInput.isTouch = true;
  5730. if (window.performance) {
  5731. document.addEventListener("mousemove", onDocumentMouseMove);
  5732. }
  5733. }
  5734. function onDocumentMouseMove() {
  5735. var now = performance.now();
  5736. if (now - lastMouseMoveTime < 20) {
  5737. currentInput.isTouch = false;
  5738. document.removeEventListener("mousemove", onDocumentMouseMove);
  5739. }
  5740. lastMouseMoveTime = now;
  5741. }
  5742. function onWindowBlur() {
  5743. var activeElement = document.activeElement;
  5744. if (isReferenceElement(activeElement)) {
  5745. var instance = activeElement._tippy;
  5746. if (activeElement.blur && !instance.state.isVisible) {
  5747. activeElement.blur();
  5748. }
  5749. }
  5750. }
  5751. function bindGlobalEventListeners() {
  5752. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  5753. window.addEventListener("blur", onWindowBlur);
  5754. }
  5755. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  5756. var isIE11 = isBrowser ? (
  5757. // @ts-ignore
  5758. !!window.msCrypto
  5759. ) : false;
  5760. var pluginProps = {
  5761. animateFill: false,
  5762. followCursor: false,
  5763. inlinePositioning: false,
  5764. sticky: false
  5765. };
  5766. var renderProps = {
  5767. allowHTML: false,
  5768. animation: "fade",
  5769. arrow: true,
  5770. content: "",
  5771. inertia: false,
  5772. maxWidth: 350,
  5773. role: "tooltip",
  5774. theme: "",
  5775. zIndex: 9999
  5776. };
  5777. var defaultProps = Object.assign({
  5778. appendTo: TIPPY_DEFAULT_APPEND_TO,
  5779. aria: {
  5780. content: "auto",
  5781. expanded: "auto"
  5782. },
  5783. delay: 0,
  5784. duration: [300, 250],
  5785. getReferenceClientRect: null,
  5786. hideOnClick: true,
  5787. ignoreAttributes: false,
  5788. interactive: false,
  5789. interactiveBorder: 2,
  5790. interactiveDebounce: 0,
  5791. moveTransition: "",
  5792. offset: [0, 10],
  5793. onAfterUpdate: function onAfterUpdate() {
  5794. },
  5795. onBeforeUpdate: function onBeforeUpdate() {
  5796. },
  5797. onCreate: function onCreate() {
  5798. },
  5799. onDestroy: function onDestroy() {
  5800. },
  5801. onHidden: function onHidden() {
  5802. },
  5803. onHide: function onHide() {
  5804. },
  5805. onMount: function onMount() {
  5806. },
  5807. onShow: function onShow() {
  5808. },
  5809. onShown: function onShown() {
  5810. },
  5811. onTrigger: function onTrigger() {
  5812. },
  5813. onUntrigger: function onUntrigger() {
  5814. },
  5815. onClickOutside: function onClickOutside() {
  5816. },
  5817. placement: "top",
  5818. plugins: [],
  5819. popperOptions: {},
  5820. render: null,
  5821. showOnCreate: false,
  5822. touch: true,
  5823. trigger: "mouseenter focus",
  5824. triggerTarget: null
  5825. }, pluginProps, renderProps);
  5826. var defaultKeys = Object.keys(defaultProps);
  5827. var setDefaultProps = function setDefaultProps2(partialProps) {
  5828. var keys = Object.keys(partialProps);
  5829. keys.forEach(function(key) {
  5830. defaultProps[key] = partialProps[key];
  5831. });
  5832. };
  5833. function getExtendedPassedProps(passedProps) {
  5834. var plugins = passedProps.plugins || [];
  5835. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  5836. var name = plugin.name, defaultValue = plugin.defaultValue;
  5837. if (name) {
  5838. var _name;
  5839. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  5840. }
  5841. return acc;
  5842. }, {});
  5843. return Object.assign({}, passedProps, pluginProps2);
  5844. }
  5845. function getDataAttributeProps(reference2, plugins) {
  5846. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  5847. plugins
  5848. }))) : defaultKeys;
  5849. var props = propKeys.reduce(function(acc, key) {
  5850. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  5851. if (!valueAsString) {
  5852. return acc;
  5853. }
  5854. if (key === "content") {
  5855. acc[key] = valueAsString;
  5856. } else {
  5857. try {
  5858. acc[key] = JSON.parse(valueAsString);
  5859. } catch (e) {
  5860. acc[key] = valueAsString;
  5861. }
  5862. }
  5863. return acc;
  5864. }, {});
  5865. return props;
  5866. }
  5867. function evaluateProps(reference2, props) {
  5868. var out = Object.assign({}, props, {
  5869. content: invokeWithArgsOrReturn(props.content, [reference2])
  5870. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  5871. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  5872. out.aria = {
  5873. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  5874. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  5875. };
  5876. return out;
  5877. }
  5878. var innerHTML = function innerHTML2() {
  5879. return "innerHTML";
  5880. };
  5881. function dangerouslySetInnerHTML(element, html) {
  5882. element[innerHTML()] = html;
  5883. }
  5884. function createArrowElement(value) {
  5885. var arrow2 = div();
  5886. if (value === true) {
  5887. arrow2.className = ARROW_CLASS;
  5888. } else {
  5889. arrow2.className = SVG_ARROW_CLASS;
  5890. if (isElement(value)) {
  5891. arrow2.appendChild(value);
  5892. } else {
  5893. dangerouslySetInnerHTML(arrow2, value);
  5894. }
  5895. }
  5896. return arrow2;
  5897. }
  5898. function setContent(content, props) {
  5899. if (isElement(props.content)) {
  5900. dangerouslySetInnerHTML(content, "");
  5901. content.appendChild(props.content);
  5902. } else if (typeof props.content !== "function") {
  5903. if (props.allowHTML) {
  5904. dangerouslySetInnerHTML(content, props.content);
  5905. } else {
  5906. content.textContent = props.content;
  5907. }
  5908. }
  5909. }
  5910. function getChildren(popper2) {
  5911. var box = popper2.firstElementChild;
  5912. var boxChildren = arrayFrom(box.children);
  5913. return {
  5914. box,
  5915. content: boxChildren.find(function(node) {
  5916. return node.classList.contains(CONTENT_CLASS);
  5917. }),
  5918. arrow: boxChildren.find(function(node) {
  5919. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  5920. }),
  5921. backdrop: boxChildren.find(function(node) {
  5922. return node.classList.contains(BACKDROP_CLASS);
  5923. })
  5924. };
  5925. }
  5926. function render(instance) {
  5927. var popper2 = div();
  5928. var box = div();
  5929. box.className = BOX_CLASS;
  5930. box.setAttribute("data-state", "hidden");
  5931. box.setAttribute("tabindex", "-1");
  5932. var content = div();
  5933. content.className = CONTENT_CLASS;
  5934. content.setAttribute("data-state", "hidden");
  5935. setContent(content, instance.props);
  5936. popper2.appendChild(box);
  5937. box.appendChild(content);
  5938. onUpdate(instance.props, instance.props);
  5939. function onUpdate(prevProps, nextProps) {
  5940. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  5941. if (nextProps.theme) {
  5942. box2.setAttribute("data-theme", nextProps.theme);
  5943. } else {
  5944. box2.removeAttribute("data-theme");
  5945. }
  5946. if (typeof nextProps.animation === "string") {
  5947. box2.setAttribute("data-animation", nextProps.animation);
  5948. } else {
  5949. box2.removeAttribute("data-animation");
  5950. }
  5951. if (nextProps.inertia) {
  5952. box2.setAttribute("data-inertia", "");
  5953. } else {
  5954. box2.removeAttribute("data-inertia");
  5955. }
  5956. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  5957. if (nextProps.role) {
  5958. box2.setAttribute("role", nextProps.role);
  5959. } else {
  5960. box2.removeAttribute("role");
  5961. }
  5962. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  5963. setContent(content2, instance.props);
  5964. }
  5965. if (nextProps.arrow) {
  5966. if (!arrow2) {
  5967. box2.appendChild(createArrowElement(nextProps.arrow));
  5968. } else if (prevProps.arrow !== nextProps.arrow) {
  5969. box2.removeChild(arrow2);
  5970. box2.appendChild(createArrowElement(nextProps.arrow));
  5971. }
  5972. } else if (arrow2) {
  5973. box2.removeChild(arrow2);
  5974. }
  5975. }
  5976. return {
  5977. popper: popper2,
  5978. onUpdate
  5979. };
  5980. }
  5981. render.$$tippy = true;
  5982. var idCounter = 1;
  5983. var mouseMoveListeners = [];
  5984. var mountedInstances = [];
  5985. function createTippy(reference2, passedProps) {
  5986. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  5987. var showTimeout;
  5988. var hideTimeout;
  5989. var scheduleHideAnimationFrame;
  5990. var isVisibleFromClick = false;
  5991. var didHideDueToDocumentMouseDown = false;
  5992. var didTouchMove = false;
  5993. var ignoreOnFirstUpdate = false;
  5994. var lastTriggerEvent;
  5995. var currentTransitionEndListener;
  5996. var onFirstUpdate;
  5997. var listeners = [];
  5998. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  5999. var currentTarget;
  6000. var id = idCounter++;
  6001. var popperInstance = null;
  6002. var plugins = unique(props.plugins);
  6003. var state = {
  6004. // Is the instance currently enabled?
  6005. isEnabled: true,
  6006. // Is the tippy currently showing and not transitioning out?
  6007. isVisible: false,
  6008. // Has the instance been destroyed?
  6009. isDestroyed: false,
  6010. // Is the tippy currently mounted to the DOM?
  6011. isMounted: false,
  6012. // Has the tippy finished transitioning in?
  6013. isShown: false
  6014. };
  6015. var instance = {
  6016. // properties
  6017. id,
  6018. reference: reference2,
  6019. popper: div(),
  6020. popperInstance,
  6021. props,
  6022. state,
  6023. plugins,
  6024. // methods
  6025. clearDelayTimeouts,
  6026. setProps,
  6027. setContent: setContent2,
  6028. show,
  6029. hide: hide2,
  6030. hideWithInteractivity,
  6031. enable,
  6032. disable,
  6033. unmount,
  6034. destroy
  6035. };
  6036. if (!props.render) {
  6037. return instance;
  6038. }
  6039. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  6040. popper2.setAttribute("data-tippy-root", "");
  6041. popper2.id = "tippy-" + instance.id;
  6042. instance.popper = popper2;
  6043. reference2._tippy = instance;
  6044. popper2._tippy = instance;
  6045. var pluginsHooks = plugins.map(function(plugin) {
  6046. return plugin.fn(instance);
  6047. });
  6048. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  6049. addListeners();
  6050. handleAriaExpandedAttribute();
  6051. handleStyles();
  6052. invokeHook("onCreate", [instance]);
  6053. if (props.showOnCreate) {
  6054. scheduleShow();
  6055. }
  6056. popper2.addEventListener("mouseenter", function() {
  6057. if (instance.props.interactive && instance.state.isVisible) {
  6058. instance.clearDelayTimeouts();
  6059. }
  6060. });
  6061. popper2.addEventListener("mouseleave", function() {
  6062. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  6063. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  6064. }
  6065. });
  6066. return instance;
  6067. function getNormalizedTouchSettings() {
  6068. var touch = instance.props.touch;
  6069. return Array.isArray(touch) ? touch : [touch, 0];
  6070. }
  6071. function getIsCustomTouchBehavior() {
  6072. return getNormalizedTouchSettings()[0] === "hold";
  6073. }
  6074. function getIsDefaultRenderFn() {
  6075. var _instance$props$rende;
  6076. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  6077. }
  6078. function getCurrentTarget() {
  6079. return currentTarget || reference2;
  6080. }
  6081. function getDocument() {
  6082. var parent = getCurrentTarget().parentNode;
  6083. return parent ? getOwnerDocument(parent) : document;
  6084. }
  6085. function getDefaultTemplateChildren() {
  6086. return getChildren(popper2);
  6087. }
  6088. function getDelay(isShow) {
  6089. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  6090. return 0;
  6091. }
  6092. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  6093. }
  6094. function handleStyles(fromHide) {
  6095. if (fromHide === void 0) {
  6096. fromHide = false;
  6097. }
  6098. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  6099. popper2.style.zIndex = "" + instance.props.zIndex;
  6100. }
  6101. function invokeHook(hook, args, shouldInvokePropsHook) {
  6102. if (shouldInvokePropsHook === void 0) {
  6103. shouldInvokePropsHook = true;
  6104. }
  6105. pluginsHooks.forEach(function(pluginHooks) {
  6106. if (pluginHooks[hook]) {
  6107. pluginHooks[hook].apply(pluginHooks, args);
  6108. }
  6109. });
  6110. if (shouldInvokePropsHook) {
  6111. var _instance$props;
  6112. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  6113. }
  6114. }
  6115. function handleAriaContentAttribute() {
  6116. var aria = instance.props.aria;
  6117. if (!aria.content) {
  6118. return;
  6119. }
  6120. var attr = "aria-" + aria.content;
  6121. var id2 = popper2.id;
  6122. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  6123. nodes.forEach(function(node) {
  6124. var currentValue = node.getAttribute(attr);
  6125. if (instance.state.isVisible) {
  6126. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  6127. } else {
  6128. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  6129. if (nextValue) {
  6130. node.setAttribute(attr, nextValue);
  6131. } else {
  6132. node.removeAttribute(attr);
  6133. }
  6134. }
  6135. });
  6136. }
  6137. function handleAriaExpandedAttribute() {
  6138. if (hasAriaExpanded || !instance.props.aria.expanded) {
  6139. return;
  6140. }
  6141. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  6142. nodes.forEach(function(node) {
  6143. if (instance.props.interactive) {
  6144. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  6145. } else {
  6146. node.removeAttribute("aria-expanded");
  6147. }
  6148. });
  6149. }
  6150. function cleanupInteractiveMouseListeners() {
  6151. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  6152. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  6153. return listener !== debouncedOnMouseMove;
  6154. });
  6155. }
  6156. function onDocumentPress(event) {
  6157. if (currentInput.isTouch) {
  6158. if (didTouchMove || event.type === "mousedown") {
  6159. return;
  6160. }
  6161. }
  6162. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  6163. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  6164. return;
  6165. }
  6166. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  6167. return actualContains(el, actualTarget);
  6168. })) {
  6169. if (currentInput.isTouch) {
  6170. return;
  6171. }
  6172. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  6173. return;
  6174. }
  6175. } else {
  6176. invokeHook("onClickOutside", [instance, event]);
  6177. }
  6178. if (instance.props.hideOnClick === true) {
  6179. instance.clearDelayTimeouts();
  6180. instance.hide();
  6181. didHideDueToDocumentMouseDown = true;
  6182. setTimeout(function() {
  6183. didHideDueToDocumentMouseDown = false;
  6184. });
  6185. if (!instance.state.isMounted) {
  6186. removeDocumentPress();
  6187. }
  6188. }
  6189. }
  6190. function onTouchMove() {
  6191. didTouchMove = true;
  6192. }
  6193. function onTouchStart() {
  6194. didTouchMove = false;
  6195. }
  6196. function addDocumentPress() {
  6197. var doc = getDocument();
  6198. doc.addEventListener("mousedown", onDocumentPress, true);
  6199. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  6200. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  6201. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  6202. }
  6203. function removeDocumentPress() {
  6204. var doc = getDocument();
  6205. doc.removeEventListener("mousedown", onDocumentPress, true);
  6206. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  6207. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  6208. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  6209. }
  6210. function onTransitionedOut(duration, callback) {
  6211. onTransitionEnd(duration, function() {
  6212. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  6213. callback();
  6214. }
  6215. });
  6216. }
  6217. function onTransitionedIn(duration, callback) {
  6218. onTransitionEnd(duration, callback);
  6219. }
  6220. function onTransitionEnd(duration, callback) {
  6221. var box = getDefaultTemplateChildren().box;
  6222. function listener(event) {
  6223. if (event.target === box) {
  6224. updateTransitionEndListener(box, "remove", listener);
  6225. callback();
  6226. }
  6227. }
  6228. if (duration === 0) {
  6229. return callback();
  6230. }
  6231. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  6232. updateTransitionEndListener(box, "add", listener);
  6233. currentTransitionEndListener = listener;
  6234. }
  6235. function on(eventType, handler, options) {
  6236. if (options === void 0) {
  6237. options = false;
  6238. }
  6239. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  6240. nodes.forEach(function(node) {
  6241. node.addEventListener(eventType, handler, options);
  6242. listeners.push({
  6243. node,
  6244. eventType,
  6245. handler,
  6246. options
  6247. });
  6248. });
  6249. }
  6250. function addListeners() {
  6251. if (getIsCustomTouchBehavior()) {
  6252. on("touchstart", onTrigger2, {
  6253. passive: true
  6254. });
  6255. on("touchend", onMouseLeave, {
  6256. passive: true
  6257. });
  6258. }
  6259. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  6260. if (eventType === "manual") {
  6261. return;
  6262. }
  6263. on(eventType, onTrigger2);
  6264. switch (eventType) {
  6265. case "mouseenter":
  6266. on("mouseleave", onMouseLeave);
  6267. break;
  6268. case "focus":
  6269. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  6270. break;
  6271. case "focusin":
  6272. on("focusout", onBlurOrFocusOut);
  6273. break;
  6274. }
  6275. });
  6276. }
  6277. function removeListeners() {
  6278. listeners.forEach(function(_ref) {
  6279. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  6280. node.removeEventListener(eventType, handler, options);
  6281. });
  6282. listeners = [];
  6283. }
  6284. function onTrigger2(event) {
  6285. var _lastTriggerEvent;
  6286. var shouldScheduleClickHide = false;
  6287. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  6288. return;
  6289. }
  6290. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  6291. lastTriggerEvent = event;
  6292. currentTarget = event.currentTarget;
  6293. handleAriaExpandedAttribute();
  6294. if (!instance.state.isVisible && isMouseEvent(event)) {
  6295. mouseMoveListeners.forEach(function(listener) {
  6296. return listener(event);
  6297. });
  6298. }
  6299. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  6300. shouldScheduleClickHide = true;
  6301. } else {
  6302. scheduleShow(event);
  6303. }
  6304. if (event.type === "click") {
  6305. isVisibleFromClick = !shouldScheduleClickHide;
  6306. }
  6307. if (shouldScheduleClickHide && !wasFocused) {
  6308. scheduleHide(event);
  6309. }
  6310. }
  6311. function onMouseMove(event) {
  6312. var target = event.target;
  6313. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  6314. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  6315. return;
  6316. }
  6317. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  6318. var _instance$popperInsta;
  6319. var instance2 = popper22._tippy;
  6320. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  6321. if (state2) {
  6322. return {
  6323. popperRect: popper22.getBoundingClientRect(),
  6324. popperState: state2,
  6325. props
  6326. };
  6327. }
  6328. return null;
  6329. }).filter(Boolean);
  6330. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  6331. cleanupInteractiveMouseListeners();
  6332. scheduleHide(event);
  6333. }
  6334. }
  6335. function onMouseLeave(event) {
  6336. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  6337. if (shouldBail) {
  6338. return;
  6339. }
  6340. if (instance.props.interactive) {
  6341. instance.hideWithInteractivity(event);
  6342. return;
  6343. }
  6344. scheduleHide(event);
  6345. }
  6346. function onBlurOrFocusOut(event) {
  6347. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  6348. return;
  6349. }
  6350. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  6351. return;
  6352. }
  6353. scheduleHide(event);
  6354. }
  6355. function isEventListenerStopped(event) {
  6356. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  6357. }
  6358. function createPopperInstance() {
  6359. destroyPopperInstance();
  6360. 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;
  6361. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  6362. var computedReference = getReferenceClientRect ? {
  6363. getBoundingClientRect: getReferenceClientRect,
  6364. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  6365. } : reference2;
  6366. var tippyModifier = {
  6367. name: "$$tippy",
  6368. enabled: true,
  6369. phase: "beforeWrite",
  6370. requires: ["computeStyles"],
  6371. fn: function fn5(_ref2) {
  6372. var state2 = _ref2.state;
  6373. if (getIsDefaultRenderFn()) {
  6374. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  6375. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  6376. if (attr === "placement") {
  6377. box.setAttribute("data-placement", state2.placement);
  6378. } else {
  6379. if (state2.attributes.popper["data-popper-" + attr]) {
  6380. box.setAttribute("data-" + attr, "");
  6381. } else {
  6382. box.removeAttribute("data-" + attr);
  6383. }
  6384. }
  6385. });
  6386. state2.attributes.popper = {};
  6387. }
  6388. }
  6389. };
  6390. var modifiers = [{
  6391. name: "offset",
  6392. options: {
  6393. offset: offset2
  6394. }
  6395. }, {
  6396. name: "preventOverflow",
  6397. options: {
  6398. padding: {
  6399. top: 2,
  6400. bottom: 2,
  6401. left: 5,
  6402. right: 5
  6403. }
  6404. }
  6405. }, {
  6406. name: "flip",
  6407. options: {
  6408. padding: 5
  6409. }
  6410. }, {
  6411. name: "computeStyles",
  6412. options: {
  6413. adaptive: !moveTransition
  6414. }
  6415. }, tippyModifier];
  6416. if (getIsDefaultRenderFn() && arrow2) {
  6417. modifiers.push({
  6418. name: "arrow",
  6419. options: {
  6420. element: arrow2,
  6421. padding: 3
  6422. }
  6423. });
  6424. }
  6425. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  6426. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  6427. placement,
  6428. onFirstUpdate,
  6429. modifiers
  6430. }));
  6431. }
  6432. function destroyPopperInstance() {
  6433. if (instance.popperInstance) {
  6434. instance.popperInstance.destroy();
  6435. instance.popperInstance = null;
  6436. }
  6437. }
  6438. function mount() {
  6439. var appendTo = instance.props.appendTo;
  6440. var parentNode;
  6441. var node = getCurrentTarget();
  6442. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  6443. parentNode = node.parentNode;
  6444. } else {
  6445. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  6446. }
  6447. if (!parentNode.contains(popper2)) {
  6448. parentNode.appendChild(popper2);
  6449. }
  6450. instance.state.isMounted = true;
  6451. createPopperInstance();
  6452. }
  6453. function getNestedPopperTree() {
  6454. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  6455. }
  6456. function scheduleShow(event) {
  6457. instance.clearDelayTimeouts();
  6458. if (event) {
  6459. invokeHook("onTrigger", [instance, event]);
  6460. }
  6461. addDocumentPress();
  6462. var delay = getDelay(true);
  6463. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  6464. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  6465. delay = touchDelay;
  6466. }
  6467. if (delay) {
  6468. showTimeout = setTimeout(function() {
  6469. instance.show();
  6470. }, delay);
  6471. } else {
  6472. instance.show();
  6473. }
  6474. }
  6475. function scheduleHide(event) {
  6476. instance.clearDelayTimeouts();
  6477. invokeHook("onUntrigger", [instance, event]);
  6478. if (!instance.state.isVisible) {
  6479. removeDocumentPress();
  6480. return;
  6481. }
  6482. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  6483. return;
  6484. }
  6485. var delay = getDelay(false);
  6486. if (delay) {
  6487. hideTimeout = setTimeout(function() {
  6488. if (instance.state.isVisible) {
  6489. instance.hide();
  6490. }
  6491. }, delay);
  6492. } else {
  6493. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  6494. instance.hide();
  6495. });
  6496. }
  6497. }
  6498. function enable() {
  6499. instance.state.isEnabled = true;
  6500. }
  6501. function disable() {
  6502. instance.hide();
  6503. instance.state.isEnabled = false;
  6504. }
  6505. function clearDelayTimeouts() {
  6506. clearTimeout(showTimeout);
  6507. clearTimeout(hideTimeout);
  6508. cancelAnimationFrame(scheduleHideAnimationFrame);
  6509. }
  6510. function setProps(partialProps) {
  6511. if (instance.state.isDestroyed) {
  6512. return;
  6513. }
  6514. invokeHook("onBeforeUpdate", [instance, partialProps]);
  6515. removeListeners();
  6516. var prevProps = instance.props;
  6517. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  6518. ignoreAttributes: true
  6519. }));
  6520. instance.props = nextProps;
  6521. addListeners();
  6522. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  6523. cleanupInteractiveMouseListeners();
  6524. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  6525. }
  6526. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  6527. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  6528. node.removeAttribute("aria-expanded");
  6529. });
  6530. } else if (nextProps.triggerTarget) {
  6531. reference2.removeAttribute("aria-expanded");
  6532. }
  6533. handleAriaExpandedAttribute();
  6534. handleStyles();
  6535. if (onUpdate) {
  6536. onUpdate(prevProps, nextProps);
  6537. }
  6538. if (instance.popperInstance) {
  6539. createPopperInstance();
  6540. getNestedPopperTree().forEach(function(nestedPopper) {
  6541. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  6542. });
  6543. }
  6544. invokeHook("onAfterUpdate", [instance, partialProps]);
  6545. }
  6546. function setContent2(content) {
  6547. instance.setProps({
  6548. content
  6549. });
  6550. }
  6551. function show() {
  6552. var isAlreadyVisible = instance.state.isVisible;
  6553. var isDestroyed = instance.state.isDestroyed;
  6554. var isDisabled = !instance.state.isEnabled;
  6555. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  6556. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  6557. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  6558. return;
  6559. }
  6560. if (getCurrentTarget().hasAttribute("disabled")) {
  6561. return;
  6562. }
  6563. invokeHook("onShow", [instance], false);
  6564. if (instance.props.onShow(instance) === false) {
  6565. return;
  6566. }
  6567. instance.state.isVisible = true;
  6568. if (getIsDefaultRenderFn()) {
  6569. popper2.style.visibility = "visible";
  6570. }
  6571. handleStyles();
  6572. addDocumentPress();
  6573. if (!instance.state.isMounted) {
  6574. popper2.style.transition = "none";
  6575. }
  6576. if (getIsDefaultRenderFn()) {
  6577. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  6578. setTransitionDuration([box, content], 0);
  6579. }
  6580. onFirstUpdate = function onFirstUpdate2() {
  6581. var _instance$popperInsta2;
  6582. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  6583. return;
  6584. }
  6585. ignoreOnFirstUpdate = true;
  6586. void popper2.offsetHeight;
  6587. popper2.style.transition = instance.props.moveTransition;
  6588. if (getIsDefaultRenderFn() && instance.props.animation) {
  6589. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  6590. setTransitionDuration([_box, _content], duration);
  6591. setVisibilityState([_box, _content], "visible");
  6592. }
  6593. handleAriaContentAttribute();
  6594. handleAriaExpandedAttribute();
  6595. pushIfUnique(mountedInstances, instance);
  6596. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  6597. invokeHook("onMount", [instance]);
  6598. if (instance.props.animation && getIsDefaultRenderFn()) {
  6599. onTransitionedIn(duration, function() {
  6600. instance.state.isShown = true;
  6601. invokeHook("onShown", [instance]);
  6602. });
  6603. }
  6604. };
  6605. mount();
  6606. }
  6607. function hide2() {
  6608. var isAlreadyHidden = !instance.state.isVisible;
  6609. var isDestroyed = instance.state.isDestroyed;
  6610. var isDisabled = !instance.state.isEnabled;
  6611. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  6612. if (isAlreadyHidden || isDestroyed || isDisabled) {
  6613. return;
  6614. }
  6615. invokeHook("onHide", [instance], false);
  6616. if (instance.props.onHide(instance) === false) {
  6617. return;
  6618. }
  6619. instance.state.isVisible = false;
  6620. instance.state.isShown = false;
  6621. ignoreOnFirstUpdate = false;
  6622. isVisibleFromClick = false;
  6623. if (getIsDefaultRenderFn()) {
  6624. popper2.style.visibility = "hidden";
  6625. }
  6626. cleanupInteractiveMouseListeners();
  6627. removeDocumentPress();
  6628. handleStyles(true);
  6629. if (getIsDefaultRenderFn()) {
  6630. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  6631. if (instance.props.animation) {
  6632. setTransitionDuration([box, content], duration);
  6633. setVisibilityState([box, content], "hidden");
  6634. }
  6635. }
  6636. handleAriaContentAttribute();
  6637. handleAriaExpandedAttribute();
  6638. if (instance.props.animation) {
  6639. if (getIsDefaultRenderFn()) {
  6640. onTransitionedOut(duration, instance.unmount);
  6641. }
  6642. } else {
  6643. instance.unmount();
  6644. }
  6645. }
  6646. function hideWithInteractivity(event) {
  6647. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  6648. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  6649. debouncedOnMouseMove(event);
  6650. }
  6651. function unmount() {
  6652. if (instance.state.isVisible) {
  6653. instance.hide();
  6654. }
  6655. if (!instance.state.isMounted) {
  6656. return;
  6657. }
  6658. destroyPopperInstance();
  6659. getNestedPopperTree().forEach(function(nestedPopper) {
  6660. nestedPopper._tippy.unmount();
  6661. });
  6662. if (popper2.parentNode) {
  6663. popper2.parentNode.removeChild(popper2);
  6664. }
  6665. mountedInstances = mountedInstances.filter(function(i) {
  6666. return i !== instance;
  6667. });
  6668. instance.state.isMounted = false;
  6669. invokeHook("onHidden", [instance]);
  6670. }
  6671. function destroy() {
  6672. if (instance.state.isDestroyed) {
  6673. return;
  6674. }
  6675. instance.clearDelayTimeouts();
  6676. instance.unmount();
  6677. removeListeners();
  6678. delete reference2._tippy;
  6679. instance.state.isDestroyed = true;
  6680. invokeHook("onDestroy", [instance]);
  6681. }
  6682. }
  6683. function tippy(targets, optionalProps) {
  6684. if (optionalProps === void 0) {
  6685. optionalProps = {};
  6686. }
  6687. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  6688. bindGlobalEventListeners();
  6689. var passedProps = Object.assign({}, optionalProps, {
  6690. plugins
  6691. });
  6692. var elements = getArrayOfElements(targets);
  6693. var instances = elements.reduce(function(acc, reference2) {
  6694. var instance = reference2 && createTippy(reference2, passedProps);
  6695. if (instance) {
  6696. acc.push(instance);
  6697. }
  6698. return acc;
  6699. }, []);
  6700. return isElement(targets) ? instances[0] : instances;
  6701. }
  6702. tippy.defaultProps = defaultProps;
  6703. tippy.setDefaultProps = setDefaultProps;
  6704. tippy.currentInput = currentInput;
  6705. Object.assign({}, applyStyles$1, {
  6706. effect: function effect2(_ref) {
  6707. var state = _ref.state;
  6708. var initialStyles = {
  6709. popper: {
  6710. position: state.options.strategy,
  6711. left: "0",
  6712. top: "0",
  6713. margin: "0"
  6714. },
  6715. arrow: {
  6716. position: "absolute"
  6717. },
  6718. reference: {}
  6719. };
  6720. Object.assign(state.elements.popper.style, initialStyles.popper);
  6721. state.styles = initialStyles;
  6722. if (state.elements.arrow) {
  6723. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  6724. }
  6725. }
  6726. });
  6727. tippy.setDefaultProps({
  6728. render
  6729. });
  6730.  
  6731. })
  6732. };
  6733. }));
  6734.  
  6735. System.register("./index-D3l8MoSf-Dhsxm64a.js", ['jquery'], (function (exports, module) {
  6736. 'use strict';
  6737. var $;
  6738. return {
  6739. setters: [module => {
  6740. $ = module.default;
  6741. }],
  6742. execute: (function () {
  6743.  
  6744. const $body = $(document.body);
  6745. const $container = $(".tabs-container");
  6746. $body.append('<div class="scroll-top"></div>');
  6747. $container.on("scroll", function() {
  6748. const scrollTop = $(this).scrollTop();
  6749. const scrollElment = $(".scroll-top");
  6750. scrollTop > 500 ? scrollElment.fadeIn() : scrollElment.fadeOut();
  6751. });
  6752. $body.on("click", ".scroll-top", function() {
  6753. $container.animate({ scrollTop: "0" }, 1e3);
  6754. });
  6755.  
  6756. })
  6757. };
  6758. }));
  6759.  
  6760. System.import("./__entry.js", "./");