JSON Viewer

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

目前为 2024-11-01 提交的版本。查看 最新版本

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