JSON Viewer

格式化显示JSON使数据看起来更加漂亮,支持折叠/展开格式化后的数据,支持JSON脑图让调用层级看着更清晰,支持复制JSON脑图节点路径

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

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version v0.7.7
  5. // @author Feny
  6. // @description 格式化显示JSON使数据看起来更加漂亮,支持折叠/展开格式化后的数据,支持JSON脑图让调用层级看着更清晰,支持复制JSON脑图节点路径
  7. // @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==
  8. // @homepage https://github.com/xFeny/monkey-jsonviewer
  9. // @match *://*/*
  10. // @require https://unpkg.com/dom-to-image@2
  11. // @require https://unpkg.com/jquery@3.7.1/dist/jquery.min.js
  12. // @require data:application/javascript,%3Bwindow.jquery%3DjQuery%3B
  13. // @require https://unpkg.com/jsmind@0.8.5/es6/jsmind.js
  14. // @require data:application/javascript,%3Bwindow.jsmind%3DjsMind%3B
  15. // @require https://unpkg.com/beautifier@0.1.7
  16. // @require data:application/javascript,%3Bwindow.beautifier%3Djs_beautify%3Bwindow.js_beautify%3Djs_beautify%3Bwindow.css_beautify%3Dcss_beautify%3B
  17. // @require https://unpkg.com/@highlightjs/cdn-assets@11.10.0/highlight.min.js
  18. // @require data:application/javascript,%3Bwindow.hljs%3Dhljs%3B
  19. // @require https://unpkg.com/systemjs@6.15.1/dist/system.min.js
  20. // @require https://unpkg.com/systemjs@6.15.1/dist/extras/named-register.min.js
  21. // @require data:application/javascript,%3B(typeof%20System!%3D'undefined')%26%26(System%3Dnew%20System.constructor())%3B
  22. // @grant GM_addStyle
  23. // @grant GM_getValue
  24. // @grant GM_openInTab
  25. // @grant GM_registerMenuCommand
  26. // @grant GM_setClipboard
  27. // @grant GM_setValue
  28. // @grant unsafeWindow
  29. // @note v0.7.6 操作栏右侧布局修改
  30. // @note v0.7.4 增加对JS、CSS美化输出 v0.7.4 增加对JS、CSS美化输出
  31. // @note v0.6.9 切换为暗黑主题,tab栏和JSONCrak的也跟着改变
  32. // @note v0.6.6 增加多一种暗黑主题,默认主题色修改
  33. // @note v0.6.3 修复暗黑主题,tab颜色问题
  34. // @note v0.6.2 脑图增加JSON Crack
  35. // @note v0.6.1 增加多一种浅色主题
  36. // @note v0.6.0 增加简单HTTP 请求功能,可请求GET/POST/PUT/DELETE的API接口,而不单单只能GET请求使用
  37. // @note v0.5.9 jsonp格式小优化
  38. // @note v0.5.8 增加JSON手动输入
  39. // @note v0.5.7 一些小细节优化
  40. // @note v0.5.6 修复BUG
  41. // @note v0.5.5 解决@require jquery-simple-tree-table.min.js依赖加载失败问题
  42. // @note v0.5.4 单击复制修改为CTRL+单击复制JSONPath功能,JSON格式化风格增加table格式
  43. // @note v0.5.3 增加暗黑主题色
  44. // @note v0.5.2 单击JSON格式化的key可复制JSONPath
  45. // @note v0.5.1 修复JSONPath提示有误
  46. // @note v0.5.0 解决chrome 120+以上内核JSON格式化不执行和引入layer报错问题
  47. // @note v0.4.9 布局修改,增加保存JSON/脑图为文件,增加JSON过滤,鼠标移入key提示JSONPath
  48. // @note v0.4.8 代码优化
  49. // @note v0.4.7 增加对JSONP的判断,代码优化
  50. // @note v0.4.6 增加复制按钮,JSON脑图CSS样式细节优化,JSON脑图增加收起/展开子节点按钮
  51. // @note v0.4.5 在json-viewer-updated原基础上进行了一些修改,主要有CSS样式修改,新增折叠/展开全部功能,新增JSON脑图功能,脑图节点点击显示调用路径
  52. // ==/UserScript==
  53.  
  54. (o=>{window.addEventListener("message",t=>{const{data:e}=t;if(e&&e.isJSON){if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const r=document.createElement("style");r.textContent=o,document.head.append(r)}})})(` @charset "UTF-8";body{padding-top:20px;padding-left:5px}body .beautify_checkbox{top:0;left:0;z-index:999;width:100vw;padding:5px 10px;position:fixed;display:flex;align-items:center;background-color:#f3f3f3;border-bottom:1px solid #ccc}body .beautify_checkbox label{font-size:13px}body .beautify_checkbox input[type=checkbox]{width:14px;height:14px;position:relative;top:1.5px;margin-right:5px}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}body li::marker,html li::marker{content:""}body input:focus,body select:focus,body textarea:focus,html input:focus,html select:focus,html textarea:focus{outline:0}.hidden{display:none!important}.layui-layer-tips{width:auto!important}.format-container{top:0;left:0;z-index:10;position:fixed;width:100vw;height:100vh;display:flex;flex-direction:column}.format-container .tabs,.format-container .toolbar{display:flex;line-height:28px;background-color:#ececec;border-bottom:1px solid #ccc}.format-container .toolbar{line-height:23px}.format-container .toolbar .searchbox{display:flex;flex-grow:1}.format-container .toolbar .searchbox input{flex-grow:1;border:none;outline:none;font-size:12px;padding-left:23px;background-size:12px;background-repeat:no-repeat;background-position:7px center;background-image:url(data:image/svg+xml;base64,PCEtLSBUaGlzIFNvdXJjZSBDb2RlIEZvcm0gaXMgc3ViamVjdCB0byB0aGUgdGVybXMgb2YgdGhlIE1vemlsbGEgUHVibGljCiAgIC0gTGljZW5zZSwgdi4gMi4wLiBJZiBhIGNvcHkgb2YgdGhlIE1QTCB3YXMgbm90IGRpc3RyaWJ1dGVkIHdpdGggdGhpcwogICAtIGZpbGUsIFlvdSBjYW4gb2J0YWluIG9uZSBhdCBodHRwOi8vbW96aWxsYS5vcmcvTVBMLzIuMC8uIC0tPgo8c3ZnIGZpbGw9InJnYmEoMTM1LCAxMzUsIDEzNywgMC45KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTIgMTIiPgogIDxwYXRoIGZpbGw9ImNvbnRleHQtZmlsbCIgb3BhY2l0eT0iLjQiIGQ9Ik01IDkuMmwyIDEuNlY2LjFMOC41NSA0aC01LjFMNSA2LjF2My4xeiIvPgogIDxwYXRoIGZpbGw9ImNvbnRleHQtZmlsbCIgZD0iTTEuMTggMi42QTEgMSAwIDAgMSAyIDFIMTBhMSAxIDAgMCAxIC44IDEuNkw4IDYuNHY0LjgyYzAgLjYzLS43Mi45OC0xLjIyLjZsLTIuNS0xLjk5QS43NS43NSAwIDAgMSA0IDkuMjVWNi40MUwxLjE4IDIuNnpNMiAyTDUgNi4wOXYzLjA0bDIgMS41OVY2LjA5TDEwLjAxIDJIMnoiLz4KPC9zdmc+Cg==)}.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==)}.format-container .tabs-item{border-width:3px;border-top:3px solid #ececec}.format-container .tabs-item.active{color:#0060df;border-top-color:#0060df;background-color:#e9e9e9}.format-container .tabs-item:hover{border-top-color:#c3c3c6}.format-container .tabs-item,.format-container .toolbar-item{cursor:pointer;padding:0 10px;font-size:12px}.format-container .tabs-item:hover,.format-container .toolbar-item:hover{background-color:#d4d4d4}.format-container .rightbox{position:absolute;right:200px;display:flex;font-size:13px}.format-container .rightbox>div{padding:0 5px;margin-top:2px}.format-container .rightbox>div span{cursor:pointer;display:inline;padding:5px 10px;border-radius:3px}.format-container .rightbox>div span:hover{background-color:#ccc}.format-container .rightbox>div span:after{content:"";right:-5px;top:40%;position:relative;border-top:5px solid #999;border-left:5px solid transparent;border-right:5px solid transparent;z-index:999}.format-container .rightbox>div .ulbox{display:none}.format-container .rightbox>div ul{color:#333;cursor:pointer;text-align:center;border-radius:3px}.format-container .rightbox>div ul li{font-size:13px;padding:5px 20px;background-color:#dfdfdf}.format-container .rightbox>div ul li.active:before{left:15px;content:"\u221A";display:inline;position:absolute}.format-container .rightbox>div ul li:hover{border-radius:3px;background-color:#ccc}.format-container .rightbox>div .tippy-box{background-color:#dfdfdf!important}.format-container .rightbox>div .tippy-box .tippy-arrow{color:#dfdfdf!important}.format-container .tabs-container{flex-grow:1;overflow:auto;line-height:1.4;font-size:13.5px;font-family:monospace}.format-container .tabs-container>div{display:none}.format-container .tabs-container>div.active{display:block}.format-container .tabs-container #formatContainer{padding:10px}.format-container .tabs-container #rawTextContainer{padding:0 10px}.format-container .tabs-container #rawTextContainer pre{display:block!important;overflow-wrap:break-word;white-space:pre-wrap}.format-container .jsonp{color:#93983a}.format-container ul.json-object,.format-container ul.json-array{margin:0 0 0 2px;list-style-type:none;border-left:1px dotted #5d6d7e;padding-left:24px}.format-container .json-brackets{font-weight:700}.format-container .json-key{color:#910f93;cursor:pointer}.format-container .json-string,.format-container .json-string a{color:#2e7c16}.format-container .json-number{color:#164ff1}.format-container .json-boolean{color:#905}.format-container .json-null{color:#228fec}.format-container a.json-toggle{position:rElative;color:inherit;opacity:.2;text-decoration:none}.format-container a.json-toggle:hover{opacity:.35}.format-container a.json-toggle:active{opacity:.5}.format-container a.json-toggle:focus{outline:none}.format-container a.json-toggle:before{top:2.5px;left:-15px;position:absolute;content:"";display:block;width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor;transform:rotate(90deg)}.format-container a.json-toggle.collapsed:before{transform:rotate(0)}.format-container a.json-placeholder{color:#ccc;font-size:12px;padding:0 1em;text-decoration:none}.format-container a.json-placeholder:hover{text-decoration:underline}.format-container .json-curly-brackets{color:#6d9331}.format-container .json-square-brackets{color:#8e9331}.format-container #jmContainer{width:100vw;height:calc(100vh - 57px)}.format-container #jmContainer jmnode{display:flex;align-items:center;padding-left:22px;color:#475872!important;box-shadow:none!important;background-color:transparent!important}.format-container #jmContainer jmnode.root{padding:0;color:transparent!important}.format-container #jmContainer jmnode:before{content:"";top:50%!important;margin-top:1.5px;position:absolute;border-radius:50%;transform:translateY(-50%)}.format-container #jmContainer jmnode.root:before{left:50%;width:18px;height:18px;transform:translate(-18px,-50%)}.format-container #jmContainer jmnode:hover{text-shadow:0px 0px 1px currentColor}.format-container #jmContainer jmnode:not(.root):before{left:0;width:15px;height:15px}.format-container #jmContainer jmexpander{margin-top:1px;line-height:9px}.format-container #jmContainer .datatype{opacity:.6;font-size:12px;margin-top:2px;padding-left:5px}.format-container table{width:-webkit-fill-available;margin-left:20px;border-collapse:collapse}.format-container table tr:hover{background-color:#f0f9fe}.format-container table tr.selected td,.format-container table tr.selected td a{color:#fff!important;background-color:#3875d7}.format-container table tr td:first-child{width:120px}.format-container table .tree-len{color:#ccc;font-size:13px}.format-container table .simple-tree-table-icon{color:#000;opacity:.2;width:0!important;margin:0!important;line-height:0!important}.format-container table .simple-tree-table-icon:before{top:.5px;left:-15px;position:relative;content:"";width:0;height:0;display:none;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor;transform:rotate(90deg)}.format-container table .simple-tree-table-icon::hover{opacity:.35}.format-container table .simple-tree-table-icon:after{content:""!important}.format-container table .simple-tree-table-icon::active{opacity:.5}.format-container table .simple-tree-table-opened .simple-tree-table-icon:before{display:block}.format-container table .simple-tree-table-closed .simple-tree-table-icon:before{display:block;transform:rotate(0)}.httpRequest{padding:20px}.httpRequest input,.httpRequest select{border-radius:0;padding-left:10px;border:1px solid #ccc}.requestbox,.textarea{width:700px;display:flex}.requestbox{height:35px;margin-bottom:15px}.requestbox input{flex-grow:1}.requestbox button{cursor:pointer;padding:0 15px;border:1px solid #ccc}.requestbox button:active{background-color:#cfcfcf}.textarea input{flex-grow:1;height:30px}.light .json-key{color:#0040cf}.light .json-string,.light .json-string a{color:#a31515}.light .json-number{color:#0b7500}.light .json-boolean{color:#00f}.light .json-null{color:#05f}body.dark .format-container li,body.dark .format-container pre,body.dark_plus .format-container li,body.dark_plus .format-container pre{color:#ccc}body.dark .format-container .tabs,body.dark .format-container .toolbar,body.dark_plus .format-container .tabs,body.dark_plus .format-container .toolbar{color:#c4c4c4;border-bottom-color:#464646;background-color:#333}body.dark .format-container .tabs .tabs-item,body.dark .format-container .toolbar .tabs-item,body.dark_plus .format-container .tabs .tabs-item,body.dark_plus .format-container .toolbar .tabs-item{border-top-color:#333}body.dark .format-container .tabs .tabs-item.active,body.dark .format-container .toolbar .tabs-item.active,body.dark_plus .format-container .tabs .tabs-item.active,body.dark_plus .format-container .toolbar .tabs-item.active{color:#c4c4c4;border-top-color:#64b7ff;background-color:#464646}body.dark .format-container .tabs .tabs-item:hover,body.dark .format-container .tabs .toolbar-item:hover,body.dark .format-container .toolbar .tabs-item:hover,body.dark .format-container .toolbar .toolbar-item:hover,body.dark_plus .format-container .tabs .tabs-item:hover,body.dark_plus .format-container .tabs .toolbar-item:hover,body.dark_plus .format-container .toolbar .tabs-item:hover,body.dark_plus .format-container .toolbar .toolbar-item:hover{border-top-color:#64b7ff;background-color:#464646}body.dark .format-container .searchbox input,body.dark_plus .format-container .searchbox input{color:#ccc;background-color:#464646;border-left:1.5px solid #333333}body.dark .format-container .searchbox .clear,body.dark_plus .format-container .searchbox .clear{filter:invert(.8)}body.dark .format-container .rightbox>div span:hover,body.dark_plus .format-container .rightbox>div span:hover{background-color:#464646}body.dark .format-container .rightbox .tippy-box,body.dark_plus .format-container .rightbox .tippy-box{background-color:#4e4e4e!important}body.dark .format-container .rightbox .tippy-box .tippy-arrow,body.dark_plus .format-container .rightbox .tippy-box .tippy-arrow{color:#4e4e4e!important}body.dark .format-container .rightbox .tippy-box li,body.dark_plus .format-container .rightbox .tippy-box li{background-color:#4e4e4e!important}body.dark .format-container .rightbox .tippy-box li:hover,body.dark_plus .format-container .rightbox .tippy-box li:hover{background-color:#464646!important}body.dark .format-container .jsonp,body.dark_plus .format-container .jsonp{color:#f1d700}body.dark .format-container .json-toggle,body.dark_plus .format-container .json-toggle{opacity:.35}body.dark .format-container .json-toggle:hover,body.dark_plus .format-container .json-toggle:hover{opacity:.5}body.dark .format-container jmnode,body.dark_plus .format-container jmnode{filter:brightness(2)}body.dark .format-container jmexpander,body.dark_plus .format-container jmexpander{background-color:#dfdfdf}body.dark .format-container table tr:hover,body.dark_plus .format-container table tr:hover{background-color:#353b48}body.dark .format-container .simple-tree-table-icon,body.dark_plus .format-container .simple-tree-table-icon{color:#fff;opacity:.5}body.dark .format-container .tabs-container{background-color:#252526}body.dark .format-container .json-curly-brackets{color:#ce70d6}body.dark .format-container .json-square-brackets{color:#f1d700}body.dark .format-container .json-key{color:#9cdcfe}body.dark .format-container .json-string,body.dark .format-container .json-string a{color:#ce9178}body.dark .format-container .json-number{color:#b5cea8}body.dark .format-container .json-boolean{color:#358cd6}body.dark .format-container .json-null{color:#569cd6}body.dark_plus .format-container .tabs-container{background-color:#1e1f22}body.dark_plus .format-container .json-curly-brackets{color:#bb9667}body.dark_plus .format-container .json-square-brackets{color:#bbbda3}body.dark_plus .format-container .json-key{color:#c77dbb}body.dark_plus .format-container .json-string,body.dark_plus .format-container .json-string a{color:#499472}body.dark_plus .format-container .json-number{color:#27abb7}body.dark_plus .format-container .json-boolean{color:#ce8d66}body.dark_plus .format-container .json-null{color:#c06235}/**
  55. * @license BSD
  56. * @copyright 2014-2023 hizzgdev@163.com
  57. *
  58. * Project Home:
  59. * https://github.com/hizzgdev/jsmind/
  60. */.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}.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}.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=)} `);
  61.  
  62. System.addImportMap({ imports: {"jquery":"user:jquery","highlight.js":"user:highlight.js","beautifier":"user:beautifier","jsmind":"user:jsmind"} });
  63. System.set("user:jquery", (()=>{const _=jquery;('default' in _)||(_.default=_);return _})());
  64. System.set("user:highlight.js", (()=>{const _=hljs;('default' in _)||(_.default=_);return _})());
  65. System.set("user:beautifier", (()=>{const _=beautifier;('default' in _)||(_.default=_);return _})());
  66. System.set("user:jsmind", (()=>{const _=jsmind;('default' in _)||(_.default=_);return _})());
  67.  
  68. System.register("./__entry.js", ['./__monkey.entry-C9amzrwp.js'], (function (exports, module) {
  69. 'use strict';
  70. return {
  71. setters: [null],
  72. execute: (function () {
  73.  
  74.  
  75.  
  76. })
  77. };
  78. }));
  79.  
  80. System.register("./__monkey.entry-C9amzrwp.js", ['jquery'], (function (exports, module) {
  81. 'use strict';
  82. var $;
  83. return {
  84. setters: [module => {
  85. $ = module.default;
  86. }],
  87. execute: (function () {
  88.  
  89. const scriptRel = function detectScriptRel() {
  90. const relList = typeof document !== "undefined" && document.createElement("link").relList;
  91. return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
  92. }();
  93. const assetsURL = function(dep) {
  94. return "/" + dep;
  95. };
  96. const seen = {};
  97. const __vitePreload = function preload(baseModule, deps, importerUrl) {
  98. let promise = Promise.resolve();
  99. if (deps && deps.length > 0) {
  100. document.getElementsByTagName("link");
  101. const cspNonceMeta = document.querySelector(
  102. "meta[property=csp-nonce]"
  103. );
  104. const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
  105. promise = Promise.allSettled(
  106. deps.map((dep) => {
  107. dep = assetsURL(dep);
  108. if (dep in seen) return;
  109. seen[dep] = true;
  110. const isCss = dep.endsWith(".css");
  111. const cssSelector = isCss ? '[rel="stylesheet"]' : "";
  112. if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
  113. return;
  114. }
  115. const link = document.createElement("link");
  116. link.rel = isCss ? "stylesheet" : scriptRel;
  117. if (!isCss) {
  118. link.as = "script";
  119. }
  120. link.crossOrigin = "";
  121. link.href = dep;
  122. if (cspNonce) {
  123. link.setAttribute("nonce", cspNonce);
  124. }
  125. document.head.appendChild(link);
  126. if (isCss) {
  127. return new Promise((res, rej) => {
  128. link.addEventListener("load", res);
  129. link.addEventListener(
  130. "error",
  131. () => rej(new Error(`Unable to preload CSS for ${dep}`))
  132. );
  133. });
  134. }
  135. })
  136. );
  137. }
  138. function handlePreloadError(err) {
  139. const e = new Event("vite:preloadError", {
  140. cancelable: true
  141. });
  142. e.payload = err;
  143. window.dispatchEvent(e);
  144. if (!e.defaultPrevented) {
  145. throw err;
  146. }
  147. }
  148. return promise.then((res) => {
  149. for (const item of res || []) {
  150. if (item.status !== "rejected") continue;
  151. handlePreloadError(item.reason);
  152. }
  153. return baseModule().catch(handlePreloadError);
  154. });
  155. };
  156. const Utils = exports("U", {
  157. // 检查字符串是否为URL
  158. isUrl: function(string) {
  159. const regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  160. return regexp.test(string);
  161. },
  162. // 检查是否是图片链接
  163. isImg: function(pathImg) {
  164. const regexp = /\.(ico|bmp|gif|jpg|jpeg|png|svg|webp|GIF|JPG|PNG|WEBP|SVG)([\w#!:.?+=&%@!\-\/])?/i;
  165. return regexp.test(pathImg);
  166. },
  167. // 检验内容是否是json格式的内容
  168. isJSON: function(str) {
  169. try {
  170. JSON.parse(str);
  171. return true;
  172. } catch (e) {
  173. console.log("is not json");
  174. return false;
  175. }
  176. },
  177. // 获取数据类型
  178. getType: function(value) {
  179. return Object.prototype.toString.call(value).match(/\s(.+)]/)[1].toLowerCase();
  180. },
  181. // 获取数组中对象key最多的对象
  182. findMaxKeysObject: function(arr) {
  183. let maxKeysCount = 0, maxKeysObject;
  184. for (const obj of arr) {
  185. const keysCount = Object.keys(obj).length;
  186. if (keysCount > maxKeysCount) {
  187. maxKeysCount = keysCount;
  188. maxKeysObject = obj;
  189. }
  190. }
  191. return maxKeysObject;
  192. },
  193. // 随机rgb颜色
  194. randomColor: (opacity) => {
  195. const red = Math.floor(Math.random() * 256);
  196. const green = Math.floor(Math.random() * 256);
  197. const blue = Math.floor(Math.random() * 256);
  198. return `rgba(${red}, ${green}, ${blue}, ${opacity})`;
  199. },
  200. /**
  201. * 是否满足JSON
  202. * @returns
  203. */
  204. isJSONDocument: function(contentType) {
  205. const docType = [
  206. "application/vnd.api+json",
  207. "application/x-javascript",
  208. "application/javascript",
  209. "application/json",
  210. "text/javascript",
  211. "text/plain",
  212. "text/json",
  213. "text/css"
  214. ];
  215. if (!docType.includes(contentType)) {
  216. return false;
  217. }
  218. return true;
  219. }
  220. });
  221. const URL = exports("d", {
  222. JSON_CRACK_WIDGET: "https://jsoncrack.feny.ink/widget",
  223. EXAMPLE_JSON: "https://fetch-api.feny.ink/example.json",
  224. LAYUI_JS: "https://unpkg.com/layui@2.7.6/dist/layui.js",
  225. LAYUI_CSS: "https://unpkg.com/layui@2.7.6/dist/css/layui.css",
  226. ONLINE_HTTP_REQUEST: "https://fetch-api.feny.ink/httpRequest"
  227. });
  228. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  229. var _GM_getValue = exports("a", /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)());
  230. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  231. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  232. var _GM_setClipboard = exports("c", /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)());
  233. var _GM_setValue = exports("_", /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)());
  234. var _unsafeWindow = exports("b", /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)());
  235. (function() {
  236. if (!Utils.isJSONDocument(document.contentType)) {
  237. return;
  238. }
  239. _unsafeWindow.GLOBAL_SOURCE_ELEMENT = $("pre").first();
  240. if (_unsafeWindow.GLOBAL_SOURCE_ELEMENT.length === 0) {
  241. const text = document.body.innerText;
  242. if (!Utils.isJSON(text)) {
  243. return;
  244. }
  245. const pre = document.createElement("pre");
  246. pre.innerText = text;
  247. document.body.insertAdjacentHTML("afterbegin", pre);
  248. _unsafeWindow.GLOBAL_SOURCE_ELEMENT = $(pre);
  249. }
  250. let rawText = _unsafeWindow.GLOBAL_SOURCE_ELEMENT.text();
  251. if (!rawText) {
  252. return;
  253. }
  254. let tokens = rawText.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  255. if (tokens && tokens[1] && tokens[2]) {
  256. _unsafeWindow.GLOBAL_JSONP_FUN = tokens[1];
  257. rawText = tokens[2];
  258. }
  259. if (!Utils.isJSON(rawText)) {
  260. __vitePreload(() => module.import('./index-K1cLASEb-EuUtQHGj.js'), void 0 );
  261. return;
  262. }
  263. window.postMessage({ isJSON: true });
  264. setTimeout(() => {
  265. _unsafeWindow.GLOBAL_SOURCE_ELEMENT.hide();
  266. try {
  267. _unsafeWindow.GLOBAL_JSON = eval(`(${rawText})`);
  268. } catch (e) {
  269. _unsafeWindow.GLOBAL_JSON = JSON.parse(rawText);
  270. }
  271. $(document.head).append(`<link href="${URL.LAYUI_CSS}" rel="stylesheet">`).append(`<script src="${URL.LAYUI_JS}">`);
  272. _GM_addStyle(
  273. `jmnode.root::before{background-color: ${Utils.randomColor(0.5)}}
  274. jmnode:not(.root)::before{background-color: ${Utils.randomColor(0.5)}}
  275. `
  276. );
  277. __vitePreload(() => module.import('./index-Br6_RM-l-DMETjyL_.js'), void 0 );
  278. __vitePreload(() => module.import('./index-Bh1L0bkF-Cksj6_mf.js'), void 0 ).then((format) => format.default.init()).then(() => __vitePreload(() => module.import('./index-DLIQUm1z-DMvlwzrK.js'), void 0 )).then(() => __vitePreload(() => module.import('./index-Cgl7hcfy-DaTAQqy4.js'), void 0 ));
  279. });
  280. const openInTab = () => _GM_openInTab(URL.EXAMPLE_JSON);
  281. _GM_registerMenuCommand("测试JSON( Alt + j )", openInTab);
  282. document.addEventListener("keydown", function(event) {
  283. if (event.altKey && event.key === "j") {
  284. openInTab();
  285. }
  286. });
  287. })();
  288.  
  289. })
  290. };
  291. }));
  292.  
  293. System.register("./index-K1cLASEb-EuUtQHGj.js", ['jquery', 'highlight.js', 'beautifier'], (function (exports, module) {
  294. 'use strict';
  295. var $, hljs, js_beautify, css_beautify;
  296. return {
  297. setters: [module => {
  298. $ = module.default;
  299. }, module => {
  300. hljs = module.default;
  301. }, module => {
  302. js_beautify = module.js_beautify;
  303. css_beautify = module.css_beautify;
  304. }],
  305. execute: (function () {
  306.  
  307. const docType = [
  308. "application/x-javascript",
  309. "application/javascript",
  310. "text/javascript",
  311. "text/css"
  312. ];
  313. const contentType = document.contentType;
  314. if (docType.includes(document.contentType)) {
  315. window.postMessage({ isJSON: true });
  316. setTimeout(() => {
  317. const preElement = $("pre").first();
  318. if (preElement.length == 0) {
  319. return;
  320. }
  321. const rawText = preElement.text();
  322. const layout = '<div class="beautify_checkbox"><input type="checkbox" id="beautify"/><label for="beautify">美化输出</label></div>';
  323. document.body.insertAdjacentHTML("afterbegin", layout);
  324. const checkbox = document.querySelector(".beautify_checkbox input");
  325. checkbox.addEventListener("click", function() {
  326. if (this.checked) {
  327. beautifyCode(contentType, preElement, rawText);
  328. } else {
  329. preElement.html(rawText);
  330. }
  331. });
  332. });
  333. }
  334. function beautifyCode(contentType2, element, rawText) {
  335. const language = contentType2.substring(contentType2.indexOf("/") + 1);
  336. if (!["css", "javascript", "x-javascript"].includes(language)) {
  337. return;
  338. }
  339. let beautifyCode2;
  340. switch (language) {
  341. case "css":
  342. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  343. beautifyCode2 = cssBeautify(rawText);
  344. beautifyCode2 = hljs.highlight(beautifyCode2, {
  345. language
  346. }).value;
  347. break;
  348. case "javascript":
  349. case "x-javascript":
  350. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  351. beautifyCode2 = jsBeautify(rawText);
  352. beautifyCode2 = hljs.highlight(beautifyCode2, {
  353. language: "javascript"
  354. }).value;
  355. break;
  356. }
  357. element.html(`<code>${beautifyCode2}</code>`);
  358. }
  359.  
  360. })
  361. };
  362. }));
  363.  
  364. System.register("./index-Br6_RM-l-DMETjyL_.js", [], (function (exports, module) {
  365. 'use strict';
  366. return {
  367. execute: (function () {
  368.  
  369. const layout = `
  370. <div class="format-container">
  371. <div class="panel">
  372. <div class="tabs">
  373. <div class="tabs-item btn active" id="format">JSON格式化</div>
  374. <div class="tabs-item btn" id="viewJsonMind">JSON脑图</div>
  375. <div class="tabs-item btn" id="viewRawText">原始数据</div>
  376. <div class="rightbox">
  377. </div>
  378. <div class="rightbox">
  379. <div class="style">
  380. <span>风格</span>
  381. <span class="ulbox" data-type="style">
  382. <ul>
  383. <li data-type="style" data-value="default">默认</li>
  384. <li data-type="style" data-value="table">表格</li>
  385. </ul>
  386. </span>
  387. </div>
  388. <div class="theme">
  389. <span>主题</span>
  390. <span class="ulbox" data-type="theme">
  391. <ul>
  392. <li data-type="theme" data-value="default">默认</li>
  393. <li data-type="theme" data-value="light">浅色</li>
  394. <li data-type="theme" data-value="dark">暗黑</li>
  395. <li data-type="theme" data-value="dark_plus">暗黑+</li>
  396. </ul>
  397. </span>
  398. </div>
  399. <div class="tools">
  400. <span>工具</span>
  401. <span class="ulbox" data-type="tools">
  402. <ul>
  403. <li data-type="tools" data-value="inputJson">JSON 输入</li>
  404. <li data-type="tools" data-value="fetchApi">HTTP 请求</li>
  405. </ul>
  406. </span>
  407. </div>
  408. </div>
  409. </div>
  410. <div class="toolbar">
  411. <div class="toolbar-item btn" id="saveJson">保存</div>
  412. <div class="toolbar-item btn" id="copyJson">复制</div>
  413. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  414. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  415. <div class="toolbar-item btn" id="jsoncrack" style="display: none;">JSON Crack</div>
  416. <div class="toolbar-item btn" id="beautify" style="display: none;">美化输出</div>
  417. <div class="searchbox">
  418. <input type="text" placeholder="过滤 JSON "/>
  419. <button class="clear" hidden></button>
  420. </div>
  421. </div>
  422. </div>
  423. <div class="tabs-container">
  424. <div class="active" id="formatContainer"></div>
  425. <div id="jmContainer"></div>
  426. <div id="rawTextContainer"><pre></pre></div>
  427. </div>
  428. </div>`;
  429. document.body.insertAdjacentHTML("afterbegin", layout);
  430.  
  431. })
  432. };
  433. }));
  434.  
  435. System.register("./index-Bh1L0bkF-Cksj6_mf.js", ['jquery', './__monkey.entry-C9amzrwp.js'], (function (exports, module) {
  436. 'use strict';
  437. var $, _GM_setValue, _GM_getValue, _unsafeWindow, Utils, _GM_setClipboard;
  438. return {
  439. setters: [module => {
  440. $ = module.default;
  441. }, module => {
  442. _GM_setValue = module._;
  443. _GM_getValue = module.a;
  444. _unsafeWindow = module.b;
  445. Utils = module.U;
  446. _GM_setClipboard = module.c;
  447. }],
  448. execute: (function () {
  449.  
  450. (function($2) {
  451. function isCollapsable(arg) {
  452. return arg instanceof Object && Object.keys(arg).length > 0;
  453. }
  454. function json2html(json, parentPath = "") {
  455. let html = "", type = Utils.getType(json);
  456. switch (type) {
  457. case "array":
  458. case "object":
  459. let len = json.length || Object.keys(json).length;
  460. if (len > 0) {
  461. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  462. html += type === "array" ? '[</span><ol class="json-array">' : '{</span><ul class="json-object">';
  463. for (var key in json) {
  464. if (json.hasOwnProperty(key)) {
  465. let comma = --len > 0 ? "," : "", jsonPath = parentPath + "." + key, collapse = isCollapsable(json[key]) ? '<a href class="json-toggle"></a>' : "", res = json2html(json[key], jsonPath);
  466. let toHtml = type === "array" ? res : `<span class="json-key">"${key}"</span>: ${res}`;
  467. html += [
  468. `<li json-path="${jsonPath}">`,
  469. collapse,
  470. toHtml,
  471. comma,
  472. "</li>"
  473. ].join("");
  474. }
  475. }
  476. if (type === "array") {
  477. html += `</ol><span class="json-brackets json-square-brackets">]</span>`;
  478. } else {
  479. html += `</ul><span class="json-brackets json-curly-brackets">}</span>`;
  480. }
  481. } else {
  482. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  483. html += type === "array" ? "[]" : "{}";
  484. html += "</span>";
  485. }
  486. break;
  487. default:
  488. json = type === "string" ? json.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : json;
  489. if (Utils.isUrl(json)) {
  490. html += `<a target="_blank" href="${json}" class="json-string">"${json}"</a>`;
  491. } else {
  492. json = type === "string" ? `"${json}"` : json;
  493. html += `<span class="json-${type}">${json}</span>`;
  494. }
  495. break;
  496. }
  497. return html;
  498. }
  499. $2.fn.jsonViewer = function(json, jsonpFn) {
  500. return this.each(function() {
  501. var html = json2html(json);
  502. if (jsonpFn !== void 0 && jsonpFn !== null) {
  503. html = `<div class="jsonp">${jsonpFn}(</div>${html}<div class="jsonp">)</div>`;
  504. }
  505. $2(this).html(html);
  506. $2(this).off("click");
  507. $2(this).on("click", "a.json-toggle", function() {
  508. var target = $2(this).toggleClass("collapsed").siblings("ul.json-object, ol.json-array");
  509. target.toggle();
  510. if (target.is(":visible")) {
  511. target.siblings(".json-placeholder").remove();
  512. } else {
  513. var count = target.children('li:not([class*="hidden"])').length;
  514. var placeholder = count + (count > 1 ? " items" : " item");
  515. target.after(
  516. '<a href class="json-placeholder">' + placeholder + "</a>"
  517. );
  518. }
  519. return false;
  520. });
  521. $2(this).on("click", "a.json-placeholder", function() {
  522. $2(this).siblings("a.json-toggle").click();
  523. $2(this).siblings("a.json-placeholder").remove();
  524. return false;
  525. });
  526. });
  527. };
  528. })($);
  529. !function(e) {
  530. var t = {};
  531. function n(o) {
  532. if (t[o]) return t[o].exports;
  533. var i = t[o] = { i: o, l: false, exports: {} };
  534. return e[o].call(i.exports, i, i.exports, n), i.l = true, i.exports;
  535. }
  536. n.m = e, n.c = t, n.d = function(e2, t2, o) {
  537. n.o(e2, t2) || Object.defineProperty(e2, t2, { enumerable: true, get: o });
  538. }, n.r = function(e2) {
  539. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
  540. }, n.t = function(e2, t2) {
  541. if (1 & t2 && (e2 = n(e2)), 8 & t2) return e2;
  542. if (4 & t2 && "object" == typeof e2 && e2 && e2.__esModule) return e2;
  543. var o = /* @__PURE__ */ Object.create(null);
  544. 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) {
  545. return e2[t3];
  546. }).bind(null, i));
  547. return o;
  548. }, n.n = function(e2) {
  549. var t2 = e2 && e2.__esModule ? function() {
  550. return e2.default;
  551. } : function() {
  552. return e2;
  553. };
  554. return n.d(t2, "a", t2), t2;
  555. }, n.o = function(e2, t2) {
  556. return Object.prototype.hasOwnProperty.call(e2, t2);
  557. }, n.p = "/dist", n(n.s = 5);
  558. }([function(e, t) {
  559. e.exports = $;
  560. }, function(e, t, n) {
  561. var o = n(2), i = n(3);
  562. "string" == typeof (i = i.__esModule ? i.default : i) && (i = [[e.i, i, ""]]);
  563. var a = { insert: "head", singleton: false };
  564. o(i, a);
  565. e.exports = i.locals || {};
  566. }, function(e, t, n) {
  567. var o, i = function() {
  568. return void 0 === o && (o = Boolean(window && document && document.all && !window.atob)), o;
  569. }, a = /* @__PURE__ */ function() {
  570. var e2 = {};
  571. return function(t2) {
  572. if (void 0 === e2[t2]) {
  573. var n2 = document.querySelector(t2);
  574. if (window.HTMLIFrameElement && n2 instanceof window.HTMLIFrameElement) try {
  575. n2 = n2.contentDocument.head;
  576. } catch (e3) {
  577. n2 = null;
  578. }
  579. e2[t2] = n2;
  580. }
  581. return e2[t2];
  582. };
  583. }(), r = [];
  584. function s(e2) {
  585. for (var t2 = -1, n2 = 0; n2 < r.length; n2++) if (r[n2].identifier === e2) {
  586. t2 = n2;
  587. break;
  588. }
  589. return t2;
  590. }
  591. function c(e2, t2) {
  592. for (var n2 = {}, o2 = [], i2 = 0; i2 < e2.length; i2++) {
  593. var a2 = e2[i2], c2 = t2.base ? a2[0] + t2.base : a2[0], l2 = n2[c2] || 0, u2 = "".concat(c2, " ").concat(l2);
  594. n2[c2] = l2 + 1;
  595. var d2 = s(u2), f2 = { css: a2[1], media: a2[2], sourceMap: a2[3] };
  596. -1 !== d2 ? (r[d2].references++, r[d2].updater(f2)) : r.push({ identifier: u2, updater: y(f2, t2), references: 1 }), o2.push(u2);
  597. }
  598. return o2;
  599. }
  600. function l(e2) {
  601. var t2 = document.createElement("style"), o2 = e2.attributes || {};
  602. if (void 0 === o2.nonce) {
  603. var i2 = n.nc;
  604. i2 && (o2.nonce = i2);
  605. }
  606. if (Object.keys(o2).forEach(function(e3) {
  607. t2.setAttribute(e3, o2[e3]);
  608. }), "function" == typeof e2.insert) e2.insert(t2);
  609. else {
  610. var r2 = a(e2.insert || "head");
  611. if (!r2) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  612. r2.appendChild(t2);
  613. }
  614. return t2;
  615. }
  616. var u, d = (u = [], function(e2, t2) {
  617. return u[e2] = t2, u.filter(Boolean).join("\n");
  618. });
  619. function f(e2, t2, n2, o2) {
  620. var i2 = n2 ? "" : o2.media ? "@media ".concat(o2.media, " {").concat(o2.css, "}") : o2.css;
  621. if (e2.styleSheet) e2.styleSheet.cssText = d(t2, i2);
  622. else {
  623. var a2 = document.createTextNode(i2), r2 = e2.childNodes;
  624. r2[t2] && e2.removeChild(r2[t2]), r2.length ? e2.insertBefore(a2, r2[t2]) : e2.appendChild(a2);
  625. }
  626. }
  627. function h(e2, t2, n2) {
  628. var o2 = n2.css, i2 = n2.media, a2 = n2.sourceMap;
  629. 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;
  630. else {
  631. for (; e2.firstChild; ) e2.removeChild(e2.firstChild);
  632. e2.appendChild(document.createTextNode(o2));
  633. }
  634. }
  635. var p = null, v = 0;
  636. function y(e2, t2) {
  637. var n2, o2, i2;
  638. if (t2.singleton) {
  639. var a2 = v++;
  640. n2 = p || (p = l(t2)), o2 = f.bind(null, n2, a2, false), i2 = f.bind(null, n2, a2, true);
  641. } else n2 = l(t2), o2 = h.bind(null, n2, t2), i2 = function() {
  642. !function(e3) {
  643. if (null === e3.parentNode) return false;
  644. e3.parentNode.removeChild(e3);
  645. }(n2);
  646. };
  647. return o2(e2), function(t3) {
  648. if (t3) {
  649. if (t3.css === e2.css && t3.media === e2.media && t3.sourceMap === e2.sourceMap) return;
  650. o2(e2 = t3);
  651. } else i2();
  652. };
  653. }
  654. e.exports = function(e2, t2) {
  655. (t2 = t2 || {}).singleton || "boolean" == typeof t2.singleton || (t2.singleton = i());
  656. var n2 = c(e2 = e2 || [], t2);
  657. return function(e3) {
  658. if (e3 = e3 || [], "[object Array]" === Object.prototype.toString.call(e3)) {
  659. for (var o2 = 0; o2 < n2.length; o2++) {
  660. var i2 = s(n2[o2]);
  661. r[i2].references--;
  662. }
  663. for (var a2 = c(e3, t2), l2 = 0; l2 < n2.length; l2++) {
  664. var u2 = s(n2[l2]);
  665. 0 === r[u2].references && (r[u2].updater(), r.splice(u2, 1));
  666. }
  667. n2 = a2;
  668. }
  669. };
  670. };
  671. }, function(e, t, n) {
  672. (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;
  673. }, function(e, t, n) {
  674. e.exports = function(e2) {
  675. var t2 = [];
  676. return t2.toString = function() {
  677. return this.map(function(t3) {
  678. var n2 = function(e3, t4) {
  679. var n3 = e3[1] || "", o = e3[3];
  680. if (!o) return n3;
  681. if (t4 && "function" == typeof btoa) {
  682. 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) {
  683. return "/*# sourceURL=".concat(o.sourceRoot || "").concat(e4, " */");
  684. });
  685. return [n3].concat(a).concat([i]).join("\n");
  686. }
  687. var r, s, c;
  688. return [n3].join("\n");
  689. }(t3, e2);
  690. return t3[2] ? "@media ".concat(t3[2], " {").concat(n2, "}") : n2;
  691. }).join("");
  692. }, t2.i = function(e3, n2, o) {
  693. "string" == typeof e3 && (e3 = [[null, e3, ""]]);
  694. var i = {};
  695. if (o) for (var a = 0; a < this.length; a++) {
  696. var r = this[a][0];
  697. null != r && (i[r] = true);
  698. }
  699. for (var s = 0; s < e3.length; s++) {
  700. var c = [].concat(e3[s]);
  701. o && i[c[0]] || (n2 && (c[2] ? c[2] = "".concat(n2, " and ").concat(c[2]) : c[2] = n2), t2.push(c));
  702. }
  703. }, t2;
  704. };
  705. }, function(e, t, n) {
  706. n.r(t);
  707. var o = n(0), i = n.n(o);
  708. function a(e2, t2) {
  709. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  710. }
  711. function r(e2, t2) {
  712. for (var n2 = 0; n2 < t2.length; n2++) {
  713. var o2 = t2[n2];
  714. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  715. }
  716. }
  717. function s(e2, t2, n2) {
  718. return t2 && r(e2.prototype, t2), e2;
  719. }
  720. var c = function() {
  721. function e2() {
  722. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  723. a(this, e2), this.opts = { type: t2.type || "session", key: t2.key }, this.inst = new l(this.opts);
  724. }
  725. return s(e2, [{ key: "get", value: function() {
  726. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
  727. return this.inst.get(this.opts.key) || e3;
  728. } }, { key: "set", value: function(e3) {
  729. this.inst.set(this.opts.key, e3);
  730. } }, { key: "remove", value: function() {
  731. this.inst.remove(this.opts.key);
  732. } }]), e2;
  733. }(), l = function() {
  734. function e2() {
  735. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  736. a(this, e2), this.storage = { local: window.localStorage, session: window.sessionStorage }[t2.type];
  737. }
  738. return s(e2, [{ key: "get", value: function(e3) {
  739. try {
  740. var t2 = this.storage.getItem(e3);
  741. return t2 ? JSON.parse(t2) : null;
  742. } catch (e4) {
  743. return console.log(e4), null;
  744. }
  745. } }, { key: "set", value: function(e3, t2) {
  746. try {
  747. this.storage.setItem(e3, JSON.stringify(t2));
  748. } catch (e4) {
  749. console.log(e4);
  750. }
  751. } }, { key: "remove", value: function(e3) {
  752. this.storage.removeItem(e3);
  753. } }]), e2;
  754. }(), u = (n(1), "simple-tree-table");
  755. function d(e2, t2) {
  756. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  757. }
  758. function f(e2, t2) {
  759. for (var n2 = 0; n2 < t2.length; n2++) {
  760. var o2 = t2[n2];
  761. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  762. }
  763. }
  764. var h = { expander: null, collapser: null, opened: "all", margin: 20, iconPosition: "> :first-child", iconTemplate: "<span />", store: null, storeKey: null }, p = function() {
  765. function e2(t3) {
  766. var n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  767. 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();
  768. }
  769. var t2, n2, o2;
  770. return t2 = e2, o2 = [{ key: "getDefaults", value: function() {
  771. return h;
  772. } }, { key: "setDefaults", value: function(e3) {
  773. return i.a.extend(h, e3);
  774. } }], (n2 = [{ key: "init", value: function() {
  775. this.$table.addClass(u), this.build(), this.unbind(), this.bind();
  776. } }, { key: "destroy", value: function() {
  777. var e3 = function(e4, t3) {
  778. var n3 = new RegExp("".concat(u, "(-\\S+)?"), "g");
  779. return (t3.match(n3) || []).join(" ");
  780. };
  781. this.$table.removeClass(e3), this.nodes().removeClass(e3), this.$table.find(".".concat(u, "-icon")).remove(), this.unbind();
  782. } }, { key: "build", value: function() {
  783. var e3 = this;
  784. this.nodes().not("[data-node-depth]").each(function(t3, n3) {
  785. var o3 = i()(n3), a2 = e3.depth(o3);
  786. o3.data("node-depth", a2), 1 == a2 && o3.addClass("".concat(u, "-root"));
  787. }), this.nodes().filter(function(t3, n3) {
  788. return 0 == i()(n3).find(e3.options.iconPosition).find(".".concat(u, "-handler")).length;
  789. }).each(function(t3, n3) {
  790. 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"));
  791. o3.find(e3.options.iconPosition).prepend(s2);
  792. }), this.nodes().not(".".concat(u, "-empty, .").concat(u, "-opened, .").concat(u, "-closed")).each(function(t3, n3) {
  793. var o3 = i()(n3);
  794. e3.hasChildren(o3) ? e3.opensDefault(o3) ? o3.addClass("".concat(u, "-opened")) : o3.addClass("".concat(u, "-closed")) : o3.addClass("".concat(u, "-empty"));
  795. }), this.nodes().filter(".".concat(u, "-opened")).each(function(t3, n3) {
  796. e3.show(i()(n3));
  797. }), this.nodes().filter(".".concat(u, "-closed")).each(function(t3, n3) {
  798. e3.hide(i()(n3));
  799. });
  800. } }, { key: "opensDefault", value: function(e3) {
  801. var t3 = this.options.opened;
  802. return t3 && ("all" == t3 || -1 != t3.indexOf(e3.data("node-id")));
  803. } }, { key: "bind", value: function() {
  804. var e3 = this;
  805. this.$expander.on("click.".concat(u), function(t3) {
  806. e3.expand();
  807. }), this.$collapser.on("click.".concat(u), function(t3) {
  808. e3.collapse();
  809. }), this.$table.on("click.".concat(u), "tr .".concat(u, "-handler"), function(t3) {
  810. var n3 = i()(t3.currentTarget).closest("tr");
  811. n3.hasClass("".concat(u, "-opened")) ? e3.close(n3) : e3.open(n3);
  812. });
  813. } }, { key: "unbind", value: function() {
  814. this.$expander.off(".".concat(u)), this.$collapser.off(".".concat(u)), this.$table.off(".".concat(u, " node:open node:close"));
  815. } }, { key: "expand", value: function() {
  816. var e3 = this;
  817. this.nodes().each(function(t3, n3) {
  818. e3.show(i()(n3));
  819. }), this.save();
  820. } }, { key: "collapse", value: function() {
  821. var e3 = this;
  822. this.nodes().each(function(t3, n3) {
  823. e3.hide(i()(n3));
  824. }), this.save();
  825. } }, { key: "nodes", value: function() {
  826. return this.$table.find("tr[data-node-id]");
  827. } }, { key: "depth", value: function(e3) {
  828. var t3 = e3.data("node-depth");
  829. if (t3) return t3;
  830. var n3 = this.findByID(e3.data("node-pid"));
  831. return 0 != n3.length ? this.depth(n3) + 1 : 1;
  832. } }, { key: "open", value: function(e3) {
  833. this.show(e3), this.save(), e3.trigger("node:open", [e3]);
  834. } }, { key: "show", value: function(e3) {
  835. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-closed")).addClass("".concat(u, "-opened")), this.showDescs(e3));
  836. } }, { key: "showDescs", value: function(e3) {
  837. var t3 = this;
  838. this.findChildren(e3).each(function(e4, n3) {
  839. var o3 = i()(n3);
  840. o3.show(), o3.hasClass("".concat(u, "-opened")) && t3.showDescs(o3);
  841. });
  842. } }, { key: "close", value: function(e3) {
  843. this.hide(e3), this.save(), e3.trigger("node:close", [e3]);
  844. } }, { key: "hide", value: function(e3) {
  845. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-opened")).addClass("".concat(u, "-closed")), this.hideDescs(e3));
  846. } }, { key: "hideDescs", value: function(e3) {
  847. var t3 = this;
  848. this.findChildren(e3).each(function(e4, n3) {
  849. var o3 = i()(n3);
  850. o3.hide(), t3.hideDescs(o3);
  851. });
  852. } }, { key: "hasChildren", value: function(e3) {
  853. return 0 != this.findChildren(e3).length;
  854. } }, { key: "findChildren", value: function(e3) {
  855. var t3 = e3.data("node-id");
  856. return this.$table.find('tr[data-node-pid="'.concat(t3, '"]'));
  857. } }, { key: "findDescendants", value: function(e3) {
  858. var t3 = this, n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], o3 = this.findChildren(e3);
  859. return n3.push(o3), o3.each(function(e4, o4) {
  860. t3.findDescendants(i()(o4), n3);
  861. }), n3;
  862. } }, { key: "findByID", value: function(e3) {
  863. return this.$table.find('tr[data-node-id="'.concat(e3, '"]'));
  864. } }, { key: "openByID", value: function(e3) {
  865. this.open(this.findByID(e3));
  866. } }, { key: "closeByID", value: function(e3) {
  867. this.close(this.findByID(e3));
  868. } }, { key: "load", value: function() {
  869. var e3 = this;
  870. if (this.store) {
  871. var t3 = this.store.get();
  872. t3 && (this.nodes().each(function(t4, n3) {
  873. e3.show(i()(n3));
  874. }), this.nodes().filter(function(e4, n3) {
  875. return -1 != t3.indexOf(i()(n3).data("node-id"));
  876. }).each(function(t4, n3) {
  877. e3.hide(i()(n3));
  878. }));
  879. }
  880. } }, { key: "save", value: function() {
  881. if (this.store) {
  882. var e3 = this.nodes().filter(".".concat(u, "-closed")).map(function(e4, t3) {
  883. return i()(t3).data("node-id");
  884. }).get();
  885. this.store.set(e3);
  886. }
  887. } }]) && f(t2.prototype, n2), o2 && f(t2, o2), e2;
  888. }();
  889. i.a.fn.simpleTreeTable = function(e2) {
  890. return this.each(function(t2, n2) {
  891. var o2 = i()(n2);
  892. o2.data(u) && o2.data(u).destroy(), o2.data(u, new p(o2, e2));
  893. });
  894. }, i.a.SimpleTreeTable = p;
  895. }]);
  896. function treeTableTrHTML(json, level = 0, pId = "", pChain = "") {
  897. let tr = "";
  898. for (const key in json) {
  899. let val = json[key], type = Utils.getType(val), tId = key + "_" + Math.random(), chain = pChain + "." + key;
  900. if (["array", "object"].includes(type)) {
  901. let brackets = "", len = Object.keys(val).length, res = treeTableTrHTML(val, level + 1, tId, chain);
  902. if (!res) {
  903. if (type === "array") {
  904. brackets = `<span class="json-brackets json-square-brackets">[]</span>`;
  905. } else {
  906. brackets = `<span class="json-brackets json-curly-brackets">{}</span>`;
  907. }
  908. }
  909. tr += `
  910. <tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  911. <td class="json-key" json-path="${chain}" style="padding-left: ${level * 19}px">${key}:
  912. <span class="tree-len">${len > 0 ? type === "array" ? "[" + len + "]" : "{" + len + "}" : ""}</span>
  913. </td>
  914. <td>${brackets}</td>
  915. </tr>`;
  916. tr += res;
  917. } else {
  918. val = type === "string" ? val.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : val;
  919. tr += `<tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  920. <td class="json-key" json-path="${chain}" style="padding-left: ${level * 19}px">${key}:</td>`;
  921. if (Utils.isUrl(val)) {
  922. tr += `<td class="json-${type}"><a target="_blank" href="${val}">"${val}"</a></td>`;
  923. } else {
  924. val = type === "string" ? `"${val}"` : val;
  925. tr += `<td class="json-${type}">${val}</td>`;
  926. }
  927. tr += "</tr>";
  928. }
  929. }
  930. return tr;
  931. }
  932. const evnet = {
  933. /**
  934. * a标签鼠标移入,看是否是图片,是图片生成预览图
  935. * @returns this
  936. */
  937. urlHover: function() {
  938. $("#formatContainer").on(
  939. {
  940. mouseenter: function() {
  941. const that = $(this), href = that.attr("href");
  942. if (Utils.isImg(href)) {
  943. layer.tips(`<img src="${href}" />`, that, {
  944. time: 0,
  945. anim: 5,
  946. maxWidth: 500,
  947. tips: [3, "#d9d9d9"]
  948. });
  949. }
  950. },
  951. mouseleave: () => layer.closeAll()
  952. },
  953. "a[href]"
  954. );
  955. return this;
  956. },
  957. /**
  958. * 鼠标移入key提示JSONPath
  959. * @returns this
  960. */
  961. tipsJsonPath: function() {
  962. const that = this;
  963. $("#formatContainer").on(
  964. {
  965. mouseenter: function() {
  966. const jsonPath = that.getJsonPath(this);
  967. const tips = `<b>ctrl + 点击复制</b><br/>${jsonPath}`;
  968. layer.tips(tips, this, {
  969. time: 0,
  970. anim: 5,
  971. maxWidth: 500,
  972. tips: [1, "#2e59a7"]
  973. });
  974. },
  975. mouseleave: () => layer.closeAll()
  976. },
  977. ".json-key"
  978. );
  979. return this;
  980. },
  981. /**
  982. * 复制key的JSONPath
  983. * @returns
  984. */
  985. copyJsonPath: function() {
  986. const that = this;
  987. $("#formatContainer").on("click", ".json-key", function(event) {
  988. if (event.ctrlKey) {
  989. const jsonPath = that.getJsonPath(this);
  990. _GM_setClipboard(jsonPath);
  991. layer.msg("复制成功", { time: 1500 });
  992. }
  993. });
  994. return this;
  995. },
  996. /**
  997. * 给定htmlElement获取JSONPath
  998. * @param {*} element
  999. * @returns
  1000. */
  1001. getJsonPath: function(element) {
  1002. const style = _GM_getValue("style") || "default";
  1003. const jsonPath = style == "default" ? $(element).parent().attr("json-path") : $(element).attr("json-path");
  1004. return jsonPath.split(".").reduce(
  1005. (prev, next) => /^\d+$/.test(next) ? prev + `[${next}]` : prev + "." + next
  1006. );
  1007. },
  1008. init: function() {
  1009. this.urlHover().tipsJsonPath().copyJsonPath();
  1010. }
  1011. };
  1012. const formatStyle = exports("default", {
  1013. // 切换风格
  1014. changeStyle: function(val) {
  1015. layer.load(0, { shade: false });
  1016. _GM_setValue("style", val);
  1017. this.setStyle();
  1018. return this;
  1019. },
  1020. // 设置风格
  1021. setStyle: function() {
  1022. const style = _GM_getValue("style") || "default";
  1023. $("input").val("");
  1024. $("#formatContainer").html("");
  1025. if (style === "default") {
  1026. $("#formatContainer").jsonViewer(
  1027. _unsafeWindow.GLOBAL_JSON,
  1028. _unsafeWindow.GLOBAL_JSONP_FUN
  1029. );
  1030. try {
  1031. layer.closeAll();
  1032. } catch (error) {
  1033. }
  1034. } else {
  1035. const trHTML = treeTableTrHTML(_unsafeWindow.GLOBAL_JSON);
  1036. let appendHtml = `<table id="treeTable">${trHTML}</table>`;
  1037. if (_unsafeWindow.GLOBAL_JSONP_FUN !== void 0 && _unsafeWindow.GLOBAL_JSONP_FUN !== null) {
  1038. appendHtml = `<div class="jsonp">${_unsafeWindow.GLOBAL_JSONP_FUN}(</div>${appendHtml}<div class="jsonp">)</div>`;
  1039. }
  1040. $("#formatContainer").append(appendHtml);
  1041. setTimeout(() => {
  1042. $("#treeTable").simpleTreeTable({
  1043. expander: "#expandAll",
  1044. collapser: "#collapseAll"
  1045. });
  1046. try {
  1047. layer.closeAll();
  1048. } catch (error) {
  1049. }
  1050. });
  1051. $("#treeTable").on("mousedown", "tr", function() {
  1052. $(".selected").not(this).removeClass("selected");
  1053. $(this).toggleClass("selected");
  1054. });
  1055. }
  1056. return this;
  1057. },
  1058. init: function() {
  1059. const that = this;
  1060. that.setStyle();
  1061. evnet.init();
  1062. window.addEventListener("message", function(event) {
  1063. const { data } = event;
  1064. if (!data) {
  1065. return;
  1066. }
  1067. if (data.reload) {
  1068. that.setStyle();
  1069. return;
  1070. }
  1071. const { type, value } = data;
  1072. if (type === "style") {
  1073. that.changeStyle(value);
  1074. return;
  1075. }
  1076. });
  1077. }
  1078. });
  1079.  
  1080. })
  1081. };
  1082. }));
  1083.  
  1084. System.register("./index-DLIQUm1z-DMvlwzrK.js", ['jquery', './__monkey.entry-C9amzrwp.js', 'jsmind'], (function (exports, module) {
  1085. 'use strict';
  1086. var $, _unsafeWindow, _GM_setClipboard, _GM_getValue, URL$1, Utils, _GM_setValue, require$$0;
  1087. return {
  1088. setters: [module => {
  1089. $ = module.default;
  1090. }, module => {
  1091. _unsafeWindow = module.b;
  1092. _GM_setClipboard = module.c;
  1093. _GM_getValue = module.a;
  1094. URL$1 = module.d;
  1095. Utils = module.U;
  1096. _GM_setValue = module._;
  1097. }, module => {
  1098. require$$0 = module.default;
  1099. }],
  1100. execute: (function () {
  1101.  
  1102. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  1103. var domToImage = { exports: {} };
  1104. var hasRequiredDomToImage;
  1105. function requireDomToImage() {
  1106. if (hasRequiredDomToImage) return domToImage.exports;
  1107. hasRequiredDomToImage = 1;
  1108. (function(module) {
  1109. (function(global2) {
  1110. var util = newUtil();
  1111. var inliner = newInliner();
  1112. var fontFaces = newFontFaces();
  1113. var images = newImages();
  1114. var defaultOptions = {
  1115. // Default is to fail on error, no placeholder
  1116. imagePlaceholder: void 0,
  1117. // Default cache bust is false, it will use the cache
  1118. cacheBust: false
  1119. };
  1120. var domtoimage = {
  1121. toSvg,
  1122. toPng,
  1123. toJpeg,
  1124. toBlob,
  1125. toPixelData,
  1126. impl: {
  1127. fontFaces,
  1128. images,
  1129. util,
  1130. inliner,
  1131. options: {}
  1132. }
  1133. };
  1134. module.exports = domtoimage;
  1135. function toSvg(node, options) {
  1136. options = options || {};
  1137. copyOptions(options);
  1138. return Promise.resolve(node).then(function(node2) {
  1139. return cloneNode(node2, options.filter, true);
  1140. }).then(embedFonts).then(inlineImages).then(applyOptions).then(function(clone) {
  1141. return makeSvgDataUri(
  1142. clone,
  1143. options.width || util.width(node),
  1144. options.height || util.height(node)
  1145. );
  1146. });
  1147. function applyOptions(clone) {
  1148. if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
  1149. if (options.width) clone.style.width = options.width + "px";
  1150. if (options.height) clone.style.height = options.height + "px";
  1151. if (options.style)
  1152. Object.keys(options.style).forEach(function(property) {
  1153. clone.style[property] = options.style[property];
  1154. });
  1155. return clone;
  1156. }
  1157. }
  1158. function toPixelData(node, options) {
  1159. return draw(node, options || {}).then(function(canvas) {
  1160. return canvas.getContext("2d").getImageData(
  1161. 0,
  1162. 0,
  1163. util.width(node),
  1164. util.height(node)
  1165. ).data;
  1166. });
  1167. }
  1168. function toPng(node, options) {
  1169. return draw(node, options || {}).then(function(canvas) {
  1170. return canvas.toDataURL();
  1171. });
  1172. }
  1173. function toJpeg(node, options) {
  1174. options = options || {};
  1175. return draw(node, options).then(function(canvas) {
  1176. return canvas.toDataURL("image/jpeg", options.quality || 1);
  1177. });
  1178. }
  1179. function toBlob(node, options) {
  1180. return draw(node, options || {}).then(util.canvasToBlob);
  1181. }
  1182. function copyOptions(options) {
  1183. if (typeof options.imagePlaceholder === "undefined") {
  1184. domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
  1185. } else {
  1186. domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
  1187. }
  1188. if (typeof options.cacheBust === "undefined") {
  1189. domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
  1190. } else {
  1191. domtoimage.impl.options.cacheBust = options.cacheBust;
  1192. }
  1193. }
  1194. function draw(domNode, options) {
  1195. return toSvg(domNode, options).then(util.makeImage).then(util.delay(100)).then(function(image) {
  1196. var canvas = newCanvas(domNode);
  1197. canvas.getContext("2d").drawImage(image, 0, 0);
  1198. return canvas;
  1199. });
  1200. function newCanvas(domNode2) {
  1201. var canvas = document.createElement("canvas");
  1202. canvas.width = options.width || util.width(domNode2);
  1203. canvas.height = options.height || util.height(domNode2);
  1204. if (options.bgcolor) {
  1205. var ctx = canvas.getContext("2d");
  1206. ctx.fillStyle = options.bgcolor;
  1207. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1208. }
  1209. return canvas;
  1210. }
  1211. }
  1212. function cloneNode(node, filter, root) {
  1213. if (!root && filter && !filter(node)) return Promise.resolve();
  1214. return Promise.resolve(node).then(makeNodeCopy).then(function(clone) {
  1215. return cloneChildren(node, clone, filter);
  1216. }).then(function(clone) {
  1217. return processClone(node, clone);
  1218. });
  1219. function makeNodeCopy(node2) {
  1220. if (node2 instanceof HTMLCanvasElement) return util.makeImage(node2.toDataURL());
  1221. return node2.cloneNode(false);
  1222. }
  1223. function cloneChildren(original, clone, filter2) {
  1224. var children = original.childNodes;
  1225. if (children.length === 0) return Promise.resolve(clone);
  1226. return cloneChildrenInOrder(clone, util.asArray(children), filter2).then(function() {
  1227. return clone;
  1228. });
  1229. function cloneChildrenInOrder(parent, children2, filter3) {
  1230. var done = Promise.resolve();
  1231. children2.forEach(function(child) {
  1232. done = done.then(function() {
  1233. return cloneNode(child, filter3);
  1234. }).then(function(childClone) {
  1235. if (childClone) parent.appendChild(childClone);
  1236. });
  1237. });
  1238. return done;
  1239. }
  1240. }
  1241. function processClone(original, clone) {
  1242. if (!(clone instanceof Element)) return clone;
  1243. return Promise.resolve().then(cloneStyle).then(clonePseudoElements).then(copyUserInput).then(fixSvg).then(function() {
  1244. return clone;
  1245. });
  1246. function cloneStyle() {
  1247. copyStyle(window.getComputedStyle(original), clone.style);
  1248. function copyStyle(source, target) {
  1249. if (source.cssText) target.cssText = source.cssText;
  1250. else copyProperties(source, target);
  1251. function copyProperties(source2, target2) {
  1252. util.asArray(source2).forEach(function(name) {
  1253. target2.setProperty(
  1254. name,
  1255. source2.getPropertyValue(name),
  1256. source2.getPropertyPriority(name)
  1257. );
  1258. });
  1259. }
  1260. }
  1261. }
  1262. function clonePseudoElements() {
  1263. [":before", ":after"].forEach(function(element) {
  1264. clonePseudoElement(element);
  1265. });
  1266. function clonePseudoElement(element) {
  1267. var style = window.getComputedStyle(original, element);
  1268. var content = style.getPropertyValue("content");
  1269. if (content === "" || content === "none") return;
  1270. var className = util.uid();
  1271. clone.className = clone.className + " " + className;
  1272. var styleElement = document.createElement("style");
  1273. styleElement.appendChild(formatPseudoElementStyle(className, element, style));
  1274. clone.appendChild(styleElement);
  1275. function formatPseudoElementStyle(className2, element2, style2) {
  1276. var selector = "." + className2 + ":" + element2;
  1277. var cssText = style2.cssText ? formatCssText(style2) : formatCssProperties(style2);
  1278. return document.createTextNode(selector + "{" + cssText + "}");
  1279. function formatCssText(style3) {
  1280. var content2 = style3.getPropertyValue("content");
  1281. return style3.cssText + " content: " + content2 + ";";
  1282. }
  1283. function formatCssProperties(style3) {
  1284. return util.asArray(style3).map(formatProperty).join("; ") + ";";
  1285. function formatProperty(name) {
  1286. return name + ": " + style3.getPropertyValue(name) + (style3.getPropertyPriority(name) ? " !important" : "");
  1287. }
  1288. }
  1289. }
  1290. }
  1291. }
  1292. function copyUserInput() {
  1293. if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
  1294. if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
  1295. }
  1296. function fixSvg() {
  1297. if (!(clone instanceof SVGElement)) return;
  1298. clone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
  1299. if (!(clone instanceof SVGRectElement)) return;
  1300. ["width", "height"].forEach(function(attribute) {
  1301. var value = clone.getAttribute(attribute);
  1302. if (!value) return;
  1303. clone.style.setProperty(attribute, value);
  1304. });
  1305. }
  1306. }
  1307. }
  1308. function embedFonts(node) {
  1309. return fontFaces.resolveAll().then(function(cssText) {
  1310. var styleNode = document.createElement("style");
  1311. node.appendChild(styleNode);
  1312. styleNode.appendChild(document.createTextNode(cssText));
  1313. return node;
  1314. });
  1315. }
  1316. function inlineImages(node) {
  1317. return images.inlineAll(node).then(function() {
  1318. return node;
  1319. });
  1320. }
  1321. function makeSvgDataUri(node, width, height) {
  1322. return Promise.resolve(node).then(function(node2) {
  1323. node2.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  1324. return new XMLSerializer().serializeToString(node2);
  1325. }).then(util.escapeXhtml).then(function(xhtml) {
  1326. return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + "</foreignObject>";
  1327. }).then(function(foreignObject) {
  1328. return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' + foreignObject + "</svg>";
  1329. }).then(function(svg) {
  1330. return "data:image/svg+xml;charset=utf-8," + svg;
  1331. });
  1332. }
  1333. function newUtil() {
  1334. return {
  1335. escape,
  1336. parseExtension,
  1337. mimeType,
  1338. dataAsUrl,
  1339. isDataUrl,
  1340. canvasToBlob,
  1341. resolveUrl,
  1342. getAndEncode,
  1343. uid: uid(),
  1344. delay,
  1345. asArray,
  1346. escapeXhtml,
  1347. makeImage,
  1348. width,
  1349. height
  1350. };
  1351. function mimes() {
  1352. var WOFF = "application/font-woff";
  1353. var JPEG = "image/jpeg";
  1354. return {
  1355. "woff": WOFF,
  1356. "woff2": WOFF,
  1357. "ttf": "application/font-truetype",
  1358. "eot": "application/vnd.ms-fontobject",
  1359. "png": "image/png",
  1360. "jpg": JPEG,
  1361. "jpeg": JPEG,
  1362. "gif": "image/gif",
  1363. "tiff": "image/tiff",
  1364. "svg": "image/svg+xml"
  1365. };
  1366. }
  1367. function parseExtension(url) {
  1368. var match2 = /\.([^\.\/]*?)$/g.exec(url);
  1369. if (match2) return match2[1];
  1370. else return "";
  1371. }
  1372. function mimeType(url) {
  1373. var extension = parseExtension(url).toLowerCase();
  1374. return mimes()[extension] || "";
  1375. }
  1376. function isDataUrl(url) {
  1377. return url.search(/^(data:)/) !== -1;
  1378. }
  1379. function toBlob2(canvas) {
  1380. return new Promise(function(resolve) {
  1381. var binaryString = window.atob(canvas.toDataURL().split(",")[1]);
  1382. var length = binaryString.length;
  1383. var binaryArray = new Uint8Array(length);
  1384. for (var i = 0; i < length; i++)
  1385. binaryArray[i] = binaryString.charCodeAt(i);
  1386. resolve(new Blob([binaryArray], {
  1387. type: "image/png"
  1388. }));
  1389. });
  1390. }
  1391. function canvasToBlob(canvas) {
  1392. if (canvas.toBlob)
  1393. return new Promise(function(resolve) {
  1394. canvas.toBlob(resolve);
  1395. });
  1396. return toBlob2(canvas);
  1397. }
  1398. function resolveUrl(url, baseUrl) {
  1399. var doc = document.implementation.createHTMLDocument();
  1400. var base = doc.createElement("base");
  1401. doc.head.appendChild(base);
  1402. var a = doc.createElement("a");
  1403. doc.body.appendChild(a);
  1404. base.href = baseUrl;
  1405. a.href = url;
  1406. return a.href;
  1407. }
  1408. function uid() {
  1409. var index = 0;
  1410. return function() {
  1411. return "u" + fourRandomChars() + index++;
  1412. function fourRandomChars() {
  1413. return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
  1414. }
  1415. };
  1416. }
  1417. function makeImage(uri) {
  1418. return new Promise(function(resolve, reject) {
  1419. var image = new Image();
  1420. image.onload = function() {
  1421. resolve(image);
  1422. };
  1423. image.onerror = reject;
  1424. image.src = uri;
  1425. });
  1426. }
  1427. function getAndEncode(url) {
  1428. var TIMEOUT = 3e4;
  1429. if (domtoimage.impl.options.cacheBust) {
  1430. url += (/\?/.test(url) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
  1431. }
  1432. return new Promise(function(resolve) {
  1433. var request = new XMLHttpRequest();
  1434. request.onreadystatechange = done;
  1435. request.ontimeout = timeout;
  1436. request.responseType = "blob";
  1437. request.timeout = TIMEOUT;
  1438. request.open("GET", url, true);
  1439. request.send();
  1440. var placeholder;
  1441. if (domtoimage.impl.options.imagePlaceholder) {
  1442. var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
  1443. if (split && split[1]) {
  1444. placeholder = split[1];
  1445. }
  1446. }
  1447. function done() {
  1448. if (request.readyState !== 4) return;
  1449. if (request.status !== 200) {
  1450. if (placeholder) {
  1451. resolve(placeholder);
  1452. } else {
  1453. fail("cannot fetch resource: " + url + ", status: " + request.status);
  1454. }
  1455. return;
  1456. }
  1457. var encoder = new FileReader();
  1458. encoder.onloadend = function() {
  1459. var content = encoder.result.split(/,/)[1];
  1460. resolve(content);
  1461. };
  1462. encoder.readAsDataURL(request.response);
  1463. }
  1464. function timeout() {
  1465. if (placeholder) {
  1466. resolve(placeholder);
  1467. } else {
  1468. fail("timeout of " + TIMEOUT + "ms occured while fetching resource: " + url);
  1469. }
  1470. }
  1471. function fail(message) {
  1472. console.error(message);
  1473. resolve("");
  1474. }
  1475. });
  1476. }
  1477. function dataAsUrl(content, type) {
  1478. return "data:" + type + ";base64," + content;
  1479. }
  1480. function escape(string) {
  1481. return string.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
  1482. }
  1483. function delay(ms) {
  1484. return function(arg) {
  1485. return new Promise(function(resolve) {
  1486. setTimeout(function() {
  1487. resolve(arg);
  1488. }, ms);
  1489. });
  1490. };
  1491. }
  1492. function asArray(arrayLike) {
  1493. var array = [];
  1494. var length = arrayLike.length;
  1495. for (var i = 0; i < length; i++) array.push(arrayLike[i]);
  1496. return array;
  1497. }
  1498. function escapeXhtml(string) {
  1499. return string.replace(/#/g, "%23").replace(/\n/g, "%0A");
  1500. }
  1501. function width(node) {
  1502. var leftBorder = px(node, "border-left-width");
  1503. var rightBorder = px(node, "border-right-width");
  1504. return node.scrollWidth + leftBorder + rightBorder;
  1505. }
  1506. function height(node) {
  1507. var topBorder = px(node, "border-top-width");
  1508. var bottomBorder = px(node, "border-bottom-width");
  1509. return node.scrollHeight + topBorder + bottomBorder;
  1510. }
  1511. function px(node, styleProperty) {
  1512. var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
  1513. return parseFloat(value.replace("px", ""));
  1514. }
  1515. }
  1516. function newInliner() {
  1517. var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
  1518. return {
  1519. inlineAll,
  1520. shouldProcess,
  1521. impl: {
  1522. readUrls,
  1523. inline
  1524. }
  1525. };
  1526. function shouldProcess(string) {
  1527. return string.search(URL_REGEX) !== -1;
  1528. }
  1529. function readUrls(string) {
  1530. var result = [];
  1531. var match2;
  1532. while ((match2 = URL_REGEX.exec(string)) !== null) {
  1533. result.push(match2[1]);
  1534. }
  1535. return result.filter(function(url) {
  1536. return !util.isDataUrl(url);
  1537. });
  1538. }
  1539. function inline(string, url, baseUrl, get) {
  1540. return Promise.resolve(url).then(function(url2) {
  1541. return baseUrl ? util.resolveUrl(url2, baseUrl) : url2;
  1542. }).then(get || util.getAndEncode).then(function(data) {
  1543. return util.dataAsUrl(data, util.mimeType(url));
  1544. }).then(function(dataUrl) {
  1545. return string.replace(urlAsRegex(url), "$1" + dataUrl + "$3");
  1546. });
  1547. function urlAsRegex(url2) {
  1548. return new RegExp(`(url\\(['"]?)(` + util.escape(url2) + `)(['"]?\\))`, "g");
  1549. }
  1550. }
  1551. function inlineAll(string, baseUrl, get) {
  1552. if (nothingToInline()) return Promise.resolve(string);
  1553. return Promise.resolve(string).then(readUrls).then(function(urls) {
  1554. var done = Promise.resolve(string);
  1555. urls.forEach(function(url) {
  1556. done = done.then(function(string2) {
  1557. return inline(string2, url, baseUrl, get);
  1558. });
  1559. });
  1560. return done;
  1561. });
  1562. function nothingToInline() {
  1563. return !shouldProcess(string);
  1564. }
  1565. }
  1566. }
  1567. function newFontFaces() {
  1568. return {
  1569. resolveAll,
  1570. impl: {
  1571. readAll
  1572. }
  1573. };
  1574. function resolveAll() {
  1575. return readAll().then(function(webFonts) {
  1576. return Promise.all(
  1577. webFonts.map(function(webFont) {
  1578. return webFont.resolve();
  1579. })
  1580. );
  1581. }).then(function(cssStrings) {
  1582. return cssStrings.join("\n");
  1583. });
  1584. }
  1585. function readAll() {
  1586. return Promise.resolve(util.asArray(document.styleSheets)).then(getCssRules).then(selectWebFontRules).then(function(rules) {
  1587. return rules.map(newWebFont);
  1588. });
  1589. function selectWebFontRules(cssRules) {
  1590. return cssRules.filter(function(rule) {
  1591. return rule.type === CSSRule.FONT_FACE_RULE;
  1592. }).filter(function(rule) {
  1593. return inliner.shouldProcess(rule.style.getPropertyValue("src"));
  1594. });
  1595. }
  1596. function getCssRules(styleSheets) {
  1597. var cssRules = [];
  1598. styleSheets.forEach(function(sheet) {
  1599. try {
  1600. util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
  1601. } catch (e) {
  1602. console.log("Error while reading CSS rules from " + sheet.href, e.toString());
  1603. }
  1604. });
  1605. return cssRules;
  1606. }
  1607. function newWebFont(webFontRule) {
  1608. return {
  1609. resolve: function resolve() {
  1610. var baseUrl = (webFontRule.parentStyleSheet || {}).href;
  1611. return inliner.inlineAll(webFontRule.cssText, baseUrl);
  1612. },
  1613. src: function() {
  1614. return webFontRule.style.getPropertyValue("src");
  1615. }
  1616. };
  1617. }
  1618. }
  1619. }
  1620. function newImages() {
  1621. return {
  1622. inlineAll,
  1623. impl: {
  1624. newImage
  1625. }
  1626. };
  1627. function newImage(element) {
  1628. return {
  1629. inline
  1630. };
  1631. function inline(get) {
  1632. if (util.isDataUrl(element.src)) return Promise.resolve();
  1633. return Promise.resolve(element.src).then(get || util.getAndEncode).then(function(data) {
  1634. return util.dataAsUrl(data, util.mimeType(element.src));
  1635. }).then(function(dataUrl) {
  1636. return new Promise(function(resolve, reject) {
  1637. element.onload = resolve;
  1638. element.onerror = reject;
  1639. element.src = dataUrl;
  1640. });
  1641. });
  1642. }
  1643. }
  1644. function inlineAll(node) {
  1645. if (!(node instanceof Element)) return Promise.resolve(node);
  1646. return inlineBackground(node).then(function() {
  1647. if (node instanceof HTMLImageElement)
  1648. return newImage(node).inline();
  1649. else
  1650. return Promise.all(
  1651. util.asArray(node.childNodes).map(function(child) {
  1652. return inlineAll(child);
  1653. })
  1654. );
  1655. });
  1656. function inlineBackground(node2) {
  1657. var background = node2.style.getPropertyValue("background");
  1658. if (!background) return Promise.resolve(node2);
  1659. return inliner.inlineAll(background).then(function(inlined) {
  1660. node2.style.setProperty(
  1661. "background",
  1662. inlined,
  1663. node2.style.getPropertyPriority("background")
  1664. );
  1665. }).then(function() {
  1666. return node2;
  1667. });
  1668. }
  1669. }
  1670. }
  1671. })();
  1672. })(domToImage);
  1673. return domToImage.exports;
  1674. }
  1675. /**
  1676. * @license BSD-3-Clause
  1677. * @copyright 2014-2023 hizzgdev@163.com
  1678. *
  1679. * Project Home:
  1680. * https://github.com/hizzgdev/jsmind/
  1681. */
  1682. (function(module, exports) {
  1683. !function(e, t) {
  1684. t(require$$0, requireDomToImage());
  1685. }(commonjsGlobal, function(e, t) {
  1686. function i(e2) {
  1687. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  1688. }
  1689. var n = i(e), o = i(t);
  1690. if (!n.default) throw new Error("jsMind is not defined");
  1691. if (!o.default) throw new Error("dom-to-image is required");
  1692. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  1693. class a {
  1694. constructor(e2, t2) {
  1695. var i2 = {};
  1696. 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;
  1697. }
  1698. shoot() {
  1699. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  1700. 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));
  1701. }
  1702. create_canvas() {
  1703. let e2 = r.c("canvas");
  1704. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  1705. 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;
  1706. }
  1707. clear(e2) {
  1708. e2.parentNode.removeChild(e2);
  1709. }
  1710. draw_background(e2) {
  1711. return new Promise((function(t2, i2) {
  1712. const n2 = this.options.background;
  1713. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  1714. }).bind(this));
  1715. }
  1716. draw_lines(e2) {
  1717. return new Promise((function(t2, i2) {
  1718. this.jm.view.graph.copy_to(e2, function() {
  1719. t2(e2);
  1720. });
  1721. }).bind(this));
  1722. }
  1723. draw_nodes(e2) {
  1724. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  1725. return e2.drawImage(t2, 0, 0), e2;
  1726. });
  1727. }
  1728. draw_watermark(e2, t2) {
  1729. 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;
  1730. }
  1731. load_image(e2) {
  1732. return new Promise(function(t2, i2) {
  1733. let n2 = new Image();
  1734. n2.onload = function() {
  1735. t2(n2);
  1736. }, n2.onerror = i2, n2.src = e2;
  1737. });
  1738. }
  1739. download(e2) {
  1740. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  1741. if (navigator.msSaveBlob && e2.msToBlob) {
  1742. var i2 = e2.msToBlob();
  1743. navigator.msSaveBlob(i2, t2);
  1744. } else {
  1745. var n2 = e2.toDataURL(), o2 = r.c("a");
  1746. if ("download" in o2) {
  1747. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  1748. var s2 = r.d.createEvent("MouseEvents");
  1749. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  1750. } else location.href = n2;
  1751. }
  1752. }
  1753. }
  1754. let d = new n.default.plugin("screenshot", function(e2, t2) {
  1755. var i2 = new a(e2, t2);
  1756. e2.screenshot = i2, e2.shoot = function() {
  1757. i2.shoot();
  1758. };
  1759. });
  1760. n.default.register_plugin(d);
  1761. });
  1762. })();
  1763. const jsonMind = {
  1764. isFirst: true,
  1765. // JSON数据转换为jsMind所需要的数据结构
  1766. convert: function(json2) {
  1767. const children = [];
  1768. if (typeof json2 === "object") {
  1769. for (const key in json2) {
  1770. let val = json2[key], isArray = Array.isArray(val);
  1771. if (isArray && val.length > 0) {
  1772. val = Utils.findMaxKeysObject(val);
  1773. }
  1774. const type = Object.prototype.toString.call(val).match(/\s(.+)]/)[1];
  1775. children.push({
  1776. isArray,
  1777. chain: key,
  1778. id: key + "_" + Math.random(),
  1779. topic: `${key}<span class="datatype">${type}</span>`,
  1780. children: this.convert(val)
  1781. });
  1782. }
  1783. }
  1784. return children;
  1785. },
  1786. // 脑图节点调用链
  1787. mindChain: function(node) {
  1788. let chain = node.data.chain;
  1789. if (!node.parent) {
  1790. return chain;
  1791. }
  1792. const parent = node.parent, parentChain = this.mindChain(parent);
  1793. chain = parent.data.isArray ? `${parentChain}[0].${chain}` : `${parentChain}.${chain}`;
  1794. return chain;
  1795. },
  1796. // 显示脑图
  1797. show: function(json2) {
  1798. let isArr = Array.isArray(json2);
  1799. if (isArr) {
  1800. if (typeof json2[0] !== "object") {
  1801. layer.msg("数据结构无法生成脑图", { time: 1e3 });
  1802. return this;
  1803. }
  1804. json2 = Utils.findMaxKeysObject(json2);
  1805. }
  1806. if (!this.isFirst) {
  1807. return this;
  1808. }
  1809. _unsafeWindow.GLOBAL_JSMIND.show({
  1810. meta: {
  1811. name: "JSON脑图",
  1812. author: "1220301855@qq.com",
  1813. version: "1.0"
  1814. },
  1815. format: "node_tree",
  1816. /* 数据内容 */
  1817. data: {
  1818. id: "root",
  1819. topic: "Response",
  1820. direction: "left",
  1821. children: this.convert(json2),
  1822. chain: isArr ? "Response[0]" : "Response"
  1823. }
  1824. });
  1825. this.isFirst = false;
  1826. return this;
  1827. },
  1828. // 脑图节点事件
  1829. event: function() {
  1830. const jsonMind2 = this;
  1831. $("jmnode").on("dblclick mouseover mouseout", function(event) {
  1832. const that2 = $(this), node = _unsafeWindow.GLOBAL_JSMIND.get_node(that2.attr("nodeid"));
  1833. if (!node.parent) {
  1834. return;
  1835. }
  1836. switch (event.type) {
  1837. case "dblclick":
  1838. _GM_setClipboard(jsonMind2.mindChain(node));
  1839. layer.msg("节点路径复制成功", { time: 1500 });
  1840. break;
  1841. case "mouseover":
  1842. const s = `<b>节点路径(双击复制)</b><br/>${jsonMind2.mindChain(node)}`;
  1843. layer.tips(s, that2, {
  1844. time: 0,
  1845. tips: [2, "#2e59a7"]
  1846. });
  1847. break;
  1848. default:
  1849. layer.closeAll();
  1850. break;
  1851. }
  1852. });
  1853. return this;
  1854. },
  1855. init: function(json2) {
  1856. if (!_unsafeWindow.GLOBAL_JSMIND) {
  1857. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  1858. mode: "side",
  1859. editable: false,
  1860. container: "jmContainer",
  1861. view: {
  1862. hmargin: 50,
  1863. // 思维导图距容器外框的最小水平距离
  1864. vmargin: 50,
  1865. // 思维导图距容器外框的最小垂直距离
  1866. engine: "svg",
  1867. // 思维导图各节点之间线条的绘制引擎
  1868. draggable: true,
  1869. // 当容器不能完全容纳思维导图时,是否允许拖动画布代替鼠标滚动
  1870. support_html: false,
  1871. line_color: "#C4C9D0"
  1872. },
  1873. zoom: {
  1874. // 配置缩放
  1875. min: 0.1,
  1876. // 最小的缩放比例
  1877. max: 2.1,
  1878. // 最大的缩放比例
  1879. step: 0.1
  1880. // 缩放比例间隔
  1881. },
  1882. layout: {
  1883. vspace: 7,
  1884. // 节点之间的垂直间距
  1885. hspace: 150
  1886. // 节点之间的水平空间
  1887. }
  1888. });
  1889. }
  1890. this.show(json2).event();
  1891. }
  1892. };
  1893. const tabsEvent = {
  1894. firstFormat: true,
  1895. isBeautify: false,
  1896. $rawText: $("#rawTextContainer"),
  1897. /**
  1898. * 保存为文件
  1899. */
  1900. download: {
  1901. download: function(content, filename) {
  1902. const link = document.createElement("a");
  1903. link.href = content;
  1904. link.download = filename;
  1905. link.click();
  1906. },
  1907. saveJSON: function(text2) {
  1908. const blob = new Blob([text2], { type: "text/plain;charset=utf-8" });
  1909. const url = URL.createObjectURL(blob);
  1910. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  1911. this.download(url, filename);
  1912. URL.revokeObjectURL(url);
  1913. },
  1914. savePNG: () => _unsafeWindow.GLOBAL_JSMIND.shoot()
  1915. },
  1916. saveJson: function() {
  1917. if ($("#jmContainer").is(":visible")) {
  1918. this.download.savePNG();
  1919. } else {
  1920. this.download.saveJSON(this.$rawText.text());
  1921. }
  1922. },
  1923. // 复制JSON文本内容
  1924. copyJson: function() {
  1925. _GM_setClipboard(this.$rawText.text());
  1926. layer.msg("复制成功", { time: 1500 });
  1927. },
  1928. // 全部折叠
  1929. collapseAll: function() {
  1930. if ($("#formatContainer").is(":visible")) {
  1931. try {
  1932. $("a.json-toggle").not(".collapsed").click();
  1933. } catch (e) {
  1934. }
  1935. } else {
  1936. _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  1937. }
  1938. },
  1939. // 全部展开
  1940. expandAll: function() {
  1941. if ($("#formatContainer").is(":visible")) {
  1942. try {
  1943. $("a.json-placeholder").click().remove();
  1944. } catch (e) {
  1945. }
  1946. } else {
  1947. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  1948. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  1949. _unsafeWindow.GLOBAL_JSMIND.get_root()
  1950. );
  1951. }
  1952. },
  1953. format: function() {
  1954. },
  1955. // 显示JSON脑图
  1956. viewJsonMind: function() {
  1957. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  1958. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  1959. _unsafeWindow.GLOBAL_JSMIND.get_root()
  1960. );
  1961. },
  1962. // 查看原始JSON内容
  1963. viewRawText: function() {
  1964. if (this.firstFormat) {
  1965. this.$rawText.html(_unsafeWindow.GLOBAL_SOURCE_ELEMENT.clone());
  1966. this.firstFormat = false;
  1967. }
  1968. },
  1969. // 美化
  1970. beautify: function() {
  1971. this.isBeautify = !this.isBeautify;
  1972. if (this.isBeautify) {
  1973. let str = JSON.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  1974. if (_unsafeWindow.GLOBAL_JSONP_FUN !== void 0 && _unsafeWindow.GLOBAL_JSONP_FUN !== null) {
  1975. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  1976. }
  1977. this.$rawText.find("pre").text(str);
  1978. } else {
  1979. this.$rawText.html(_unsafeWindow.GLOBAL_SOURCE_ELEMENT.clone());
  1980. }
  1981. },
  1982. jsoncrack: function() {
  1983. let theme2 = _GM_getValue("theme") || "light";
  1984. theme2 = theme2.replace(/_.*/, "");
  1985. layer.closeAll();
  1986. const index = layer.open({
  1987. type: 1,
  1988. title: false,
  1989. maxmin: true,
  1990. shadeClose: true,
  1991. area: ["900px", "600px"],
  1992. content: `<iframe style="width: 100%;height: 100%;border: 0;" id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  1993. success: function(layero) {
  1994. const jsonCrackEmbed = layero.find("#jsoncrackEmbed")[0];
  1995. window == null ? void 0 : window.addEventListener("message", () => {
  1996. jsonCrackEmbed.contentWindow.postMessage(
  1997. {
  1998. options: { theme: theme2 },
  1999. json: JSON.stringify(_unsafeWindow.GLOBAL_JSON)
  2000. },
  2001. "*"
  2002. );
  2003. });
  2004. }
  2005. });
  2006. layer.full(index);
  2007. },
  2008. init: function() {
  2009. this.viewRawText();
  2010. $(".btn").on("click", (e) => {
  2011. const target = e.target, id = target.id;
  2012. if (target.classList.contains("tabs-item")) {
  2013. const index = $(target).index();
  2014. $(target).addClass("active").siblings().removeClass("active");
  2015. $(".tabs-container > div").removeClass("active").eq(index).addClass("active");
  2016. const beautifyEl = $("#beautify"), searchEl = $(".searchbox"), copyJsonEl = $("#copyJson"), jsoncrackEl = $("#jsoncrack"), aEl = $("#collapseAll, #expandAll");
  2017. id === "format" ? searchEl.show() : searchEl.hide();
  2018. id === "viewJsonMind" ? copyJsonEl.hide() && jsoncrackEl.show() : copyJsonEl.show() && jsoncrackEl.hide();
  2019. id === "viewRawText" ? beautifyEl.show() && aEl.hide() : beautifyEl.hide() && aEl.show();
  2020. }
  2021. this[id](target);
  2022. });
  2023. return this;
  2024. }
  2025. };
  2026. window.addEventListener("message", function(event) {
  2027. const { data } = event;
  2028. if (data && data.reload) {
  2029. jsonMind.isFirst = true;
  2030. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  2031. tabsEvent.isBeautify = false;
  2032. tabsEvent.$rawText.html(_unsafeWindow.GLOBAL_SOURCE_ELEMENT.clone());
  2033. }
  2034. });
  2035. const jsonFilter = {
  2036. // 过滤 JSON
  2037. filterJSON: function(filter) {
  2038. const style = _GM_getValue("style") || "default";
  2039. if (!filter) {
  2040. style == "default" ? $("#formatContainer li").removeClass("hidden") : $(".json-key").parent().removeClass("hidden");
  2041. return;
  2042. }
  2043. const chainSet = /* @__PURE__ */ new Set();
  2044. document.querySelectorAll("#formatContainer *[json-path]").forEach((el) => {
  2045. let chain = $(el).attr("json-path");
  2046. if (!chain) {
  2047. return;
  2048. }
  2049. const newChain = chain.substr(chain.lastIndexOf("."));
  2050. if (!newChain.toLowerCase().includes(filter.toLowerCase())) {
  2051. return;
  2052. }
  2053. chainSet.add(chain);
  2054. while (chain = chain.substr(0, chain.lastIndexOf("."))) {
  2055. chainSet.add(chain);
  2056. }
  2057. });
  2058. document.querySelectorAll(
  2059. "#formatContainer *[class*='json-']:not([class*='json-key']):not([class*='json-brackets'])"
  2060. ).forEach((el) => {
  2061. const target = $(el);
  2062. let chain = style == "default" ? target.parent().attr("json-path") : target.siblings(".json-key").attr("json-path");
  2063. if (!chain) {
  2064. return;
  2065. }
  2066. const text2 = target.text();
  2067. if (!text2.toLowerCase().includes(filter.toLowerCase())) {
  2068. return;
  2069. }
  2070. chainSet.add(chain);
  2071. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  2072. chainSet.add(chain);
  2073. }
  2074. });
  2075. style == "default" ? $("#formatContainer li").addClass("hidden") : $(".json-key").parent().addClass("hidden");
  2076. chainSet.forEach((chain) => {
  2077. style == "default" ? $(`#formatContainer *[json-path="${chain}"]`).removeClass("hidden") : $(`#formatContainer *[json-path="${chain}"]`).parent().removeClass("hidden");
  2078. });
  2079. },
  2080. // JSON 过滤
  2081. input: function() {
  2082. const that2 = this;
  2083. $("input").on("input", function() {
  2084. const val = $(this).val();
  2085. val === "" ? $(".clear").attr("hidden", true) : $(".clear").attr("hidden", false);
  2086. that2.filterJSON(val);
  2087. });
  2088. return that2;
  2089. },
  2090. // 清空输入框内容
  2091. clear: function() {
  2092. const that2 = this;
  2093. $(".clear").click(function() {
  2094. that2.filterJSON();
  2095. $("input").val("");
  2096. $(this).attr("hidden", true);
  2097. });
  2098. return this;
  2099. },
  2100. init: function() {
  2101. this.input().clear();
  2102. }
  2103. };
  2104. const theme = {
  2105. // 切换主题
  2106. changeTheme: function(value) {
  2107. _GM_setValue("theme", value);
  2108. this.setTheme();
  2109. return this;
  2110. },
  2111. // 设置主题
  2112. setTheme: function() {
  2113. const theme2 = _GM_getValue("theme") || "default";
  2114. $("body").removeClass().addClass(theme2);
  2115. return this;
  2116. },
  2117. init: function() {
  2118. const that2 = this;
  2119. that2.setTheme();
  2120. window.addEventListener("message", function(event) {
  2121. const { data } = event;
  2122. if (!data) {
  2123. return;
  2124. }
  2125. const { type, value } = data;
  2126. if (type === "theme") {
  2127. that2.changeTheme(value);
  2128. }
  2129. });
  2130. }
  2131. };
  2132. const tools = {
  2133. inputJson: function() {
  2134. const that = this;
  2135. layer.prompt(
  2136. {
  2137. title: "JSON 输入",
  2138. formType: 2,
  2139. shadeClose: true,
  2140. maxlength: 1e6
  2141. },
  2142. function(text) {
  2143. if (!text) {
  2144. layer.msg("内容不能为空", { time: 1500 });
  2145. return;
  2146. }
  2147. const rawText = text, oldJSONPFun = _unsafeWindow.GLOBAL_JSONP_FUN;
  2148. const match = text.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  2149. if (match && match[1] && match[2]) {
  2150. _unsafeWindow.GLOBAL_JSONP_FUN = match[1];
  2151. text = match[2];
  2152. }
  2153. try {
  2154. const json = JSON.parse(JSON.stringify(eval(`(${text})`)));
  2155. that.reload(json, rawText);
  2156. } catch (e) {
  2157. console.log(e);
  2158. _unsafeWindow.GLOBAL_JSONP_FUN = oldJSONPFun;
  2159. layer.msg("JSON不合法", { time: 1500 });
  2160. }
  2161. }
  2162. );
  2163. return this;
  2164. },
  2165. fetchApi: function() {
  2166. const that2 = this;
  2167. layer.open({
  2168. type: 1,
  2169. closeBtn: 0,
  2170. //不显示关闭按钮
  2171. shadeClose: true,
  2172. //开启遮罩关闭
  2173. title: "HTTP 请求",
  2174. content: `<form class="httpRequest">
  2175. <div class="requestbox">
  2176. <select name="method">
  2177. <option value="POST">POST</option>
  2178. <option value="GET">GET</option>
  2179. <option value="PUT">PUT</option>
  2180. <option value="DELETE">DELETE</option>
  2181. </select>
  2182. <input name="url" placeholder="请求地址" />
  2183. <select name="contentType">
  2184. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  2185. <option value="application/json;charset=UTF-8">application/json</option>
  2186. </select>
  2187. <button type="submit">发送</button>
  2188. </div>
  2189. <div class="textarea">
  2190. <input name="headers" placeholder='请求头 {"token": "test"}' />
  2191. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  2192. </div>
  2193. </form>`
  2194. });
  2195. $("form").on("submit", function(event) {
  2196. event.preventDefault();
  2197. const serialize = $(this).serializeArray();
  2198. const form = {};
  2199. for (const key in serialize) {
  2200. const it = serialize[key];
  2201. form[it.name] = it.value;
  2202. }
  2203. if (form.url === "") {
  2204. layer.msg("请求URL不能为空");
  2205. return;
  2206. }
  2207. let headers = form.headers;
  2208. let params = form.params;
  2209. try {
  2210. if (headers) {
  2211. headers = JSON.parse(headers);
  2212. }
  2213. } catch (e) {
  2214. layer.msg("请求头格式不合法");
  2215. return;
  2216. }
  2217. try {
  2218. if (params) {
  2219. params = JSON.parse(params);
  2220. }
  2221. } catch (e) {
  2222. layer.msg("请求参数格式不合法");
  2223. return;
  2224. }
  2225. layer.load(0, { shade: false });
  2226. $.ajax({
  2227. url: URL$1.ONLINE_HTTP_REQUEST,
  2228. type: "POST",
  2229. data: JSON.stringify(form),
  2230. contentType: "application/json"
  2231. }).then(
  2232. (response) => {
  2233. _unsafeWindow.GLOBAL_JSONP_FUN = null;
  2234. that2.reload(response, JSON.stringify(response));
  2235. },
  2236. (error) => {
  2237. layer.closeAll();
  2238. console.log(error);
  2239. }
  2240. );
  2241. });
  2242. return this;
  2243. },
  2244. reload: function(json2, rawText2) {
  2245. _unsafeWindow.GLOBAL_JSON = json2;
  2246. _unsafeWindow.GLOBAL_SOURCE_ELEMENT.text(rawText2);
  2247. window.postMessage({ reload: true });
  2248. layer.closeAll();
  2249. },
  2250. init: function() {
  2251. const that2 = this;
  2252. window.addEventListener("message", function(event) {
  2253. const { data } = event;
  2254. if (!data) {
  2255. return;
  2256. }
  2257. const { type, value } = data;
  2258. if (type === "tools") {
  2259. that2[value]();
  2260. }
  2261. });
  2262. }
  2263. };
  2264. var top = "top";
  2265. var bottom = "bottom";
  2266. var right = "right";
  2267. var left = "left";
  2268. var auto = "auto";
  2269. var basePlacements = [top, bottom, right, left];
  2270. var start = "start";
  2271. var end = "end";
  2272. var clippingParents = "clippingParents";
  2273. var viewport = "viewport";
  2274. var popper = "popper";
  2275. var reference = "reference";
  2276. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  2277. return acc.concat([placement + "-" + start, placement + "-" + end]);
  2278. }, []);
  2279. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  2280. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  2281. }, []);
  2282. var beforeRead = "beforeRead";
  2283. var read = "read";
  2284. var afterRead = "afterRead";
  2285. var beforeMain = "beforeMain";
  2286. var main = "main";
  2287. var afterMain = "afterMain";
  2288. var beforeWrite = "beforeWrite";
  2289. var write = "write";
  2290. var afterWrite = "afterWrite";
  2291. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  2292. function getNodeName(element) {
  2293. return element ? (element.nodeName || "").toLowerCase() : null;
  2294. }
  2295. function getWindow(node) {
  2296. if (node == null) {
  2297. return window;
  2298. }
  2299. if (node.toString() !== "[object Window]") {
  2300. var ownerDocument = node.ownerDocument;
  2301. return ownerDocument ? ownerDocument.defaultView || window : window;
  2302. }
  2303. return node;
  2304. }
  2305. function isElement$1(node) {
  2306. var OwnElement = getWindow(node).Element;
  2307. return node instanceof OwnElement || node instanceof Element;
  2308. }
  2309. function isHTMLElement(node) {
  2310. var OwnElement = getWindow(node).HTMLElement;
  2311. return node instanceof OwnElement || node instanceof HTMLElement;
  2312. }
  2313. function isShadowRoot(node) {
  2314. if (typeof ShadowRoot === "undefined") {
  2315. return false;
  2316. }
  2317. var OwnElement = getWindow(node).ShadowRoot;
  2318. return node instanceof OwnElement || node instanceof ShadowRoot;
  2319. }
  2320. function applyStyles(_ref) {
  2321. var state = _ref.state;
  2322. Object.keys(state.elements).forEach(function(name) {
  2323. var style = state.styles[name] || {};
  2324. var attributes = state.attributes[name] || {};
  2325. var element = state.elements[name];
  2326. if (!isHTMLElement(element) || !getNodeName(element)) {
  2327. return;
  2328. }
  2329. Object.assign(element.style, style);
  2330. Object.keys(attributes).forEach(function(name2) {
  2331. var value = attributes[name2];
  2332. if (value === false) {
  2333. element.removeAttribute(name2);
  2334. } else {
  2335. element.setAttribute(name2, value === true ? "" : value);
  2336. }
  2337. });
  2338. });
  2339. }
  2340. function effect$2(_ref2) {
  2341. var state = _ref2.state;
  2342. var initialStyles = {
  2343. popper: {
  2344. position: state.options.strategy,
  2345. left: "0",
  2346. top: "0",
  2347. margin: "0"
  2348. },
  2349. arrow: {
  2350. position: "absolute"
  2351. },
  2352. reference: {}
  2353. };
  2354. Object.assign(state.elements.popper.style, initialStyles.popper);
  2355. state.styles = initialStyles;
  2356. if (state.elements.arrow) {
  2357. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  2358. }
  2359. return function() {
  2360. Object.keys(state.elements).forEach(function(name) {
  2361. var element = state.elements[name];
  2362. var attributes = state.attributes[name] || {};
  2363. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  2364. var style = styleProperties.reduce(function(style2, property) {
  2365. style2[property] = "";
  2366. return style2;
  2367. }, {});
  2368. if (!isHTMLElement(element) || !getNodeName(element)) {
  2369. return;
  2370. }
  2371. Object.assign(element.style, style);
  2372. Object.keys(attributes).forEach(function(attribute) {
  2373. element.removeAttribute(attribute);
  2374. });
  2375. });
  2376. };
  2377. }
  2378. const applyStyles$1 = {
  2379. name: "applyStyles",
  2380. enabled: true,
  2381. phase: "write",
  2382. fn: applyStyles,
  2383. effect: effect$2,
  2384. requires: ["computeStyles"]
  2385. };
  2386. function getBasePlacement$1(placement) {
  2387. return placement.split("-")[0];
  2388. }
  2389. var max = Math.max;
  2390. var min = Math.min;
  2391. var round = Math.round;
  2392. function getUAString() {
  2393. var uaData = navigator.userAgentData;
  2394. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  2395. return uaData.brands.map(function(item) {
  2396. return item.brand + "/" + item.version;
  2397. }).join(" ");
  2398. }
  2399. return navigator.userAgent;
  2400. }
  2401. function isLayoutViewport() {
  2402. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  2403. }
  2404. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  2405. if (includeScale === void 0) {
  2406. includeScale = false;
  2407. }
  2408. if (isFixedStrategy === void 0) {
  2409. isFixedStrategy = false;
  2410. }
  2411. var clientRect = element.getBoundingClientRect();
  2412. var scaleX = 1;
  2413. var scaleY = 1;
  2414. if (includeScale && isHTMLElement(element)) {
  2415. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  2416. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  2417. }
  2418. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  2419. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  2420. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  2421. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  2422. var width = clientRect.width / scaleX;
  2423. var height = clientRect.height / scaleY;
  2424. return {
  2425. width,
  2426. height,
  2427. top: y,
  2428. right: x + width,
  2429. bottom: y + height,
  2430. left: x,
  2431. x,
  2432. y
  2433. };
  2434. }
  2435. function getLayoutRect(element) {
  2436. var clientRect = getBoundingClientRect(element);
  2437. var width = element.offsetWidth;
  2438. var height = element.offsetHeight;
  2439. if (Math.abs(clientRect.width - width) <= 1) {
  2440. width = clientRect.width;
  2441. }
  2442. if (Math.abs(clientRect.height - height) <= 1) {
  2443. height = clientRect.height;
  2444. }
  2445. return {
  2446. x: element.offsetLeft,
  2447. y: element.offsetTop,
  2448. width,
  2449. height
  2450. };
  2451. }
  2452. function contains(parent, child) {
  2453. var rootNode = child.getRootNode && child.getRootNode();
  2454. if (parent.contains(child)) {
  2455. return true;
  2456. } else if (rootNode && isShadowRoot(rootNode)) {
  2457. var next = child;
  2458. do {
  2459. if (next && parent.isSameNode(next)) {
  2460. return true;
  2461. }
  2462. next = next.parentNode || next.host;
  2463. } while (next);
  2464. }
  2465. return false;
  2466. }
  2467. function getComputedStyle(element) {
  2468. return getWindow(element).getComputedStyle(element);
  2469. }
  2470. function isTableElement(element) {
  2471. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  2472. }
  2473. function getDocumentElement(element) {
  2474. return ((isElement$1(element) ? element.ownerDocument : (
  2475. // $FlowFixMe[prop-missing]
  2476. element.document
  2477. )) || window.document).documentElement;
  2478. }
  2479. function getParentNode(element) {
  2480. if (getNodeName(element) === "html") {
  2481. return element;
  2482. }
  2483. return (
  2484. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  2485. // $FlowFixMe[incompatible-return]
  2486. // $FlowFixMe[prop-missing]
  2487. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  2488. element.parentNode || // DOM Element detected
  2489. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  2490. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  2491. getDocumentElement(element)
  2492. );
  2493. }
  2494. function getTrueOffsetParent(element) {
  2495. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  2496. getComputedStyle(element).position === "fixed") {
  2497. return null;
  2498. }
  2499. return element.offsetParent;
  2500. }
  2501. function getContainingBlock(element) {
  2502. var isFirefox = /firefox/i.test(getUAString());
  2503. var isIE = /Trident/i.test(getUAString());
  2504. if (isIE && isHTMLElement(element)) {
  2505. var elementCss = getComputedStyle(element);
  2506. if (elementCss.position === "fixed") {
  2507. return null;
  2508. }
  2509. }
  2510. var currentNode = getParentNode(element);
  2511. if (isShadowRoot(currentNode)) {
  2512. currentNode = currentNode.host;
  2513. }
  2514. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  2515. var css = getComputedStyle(currentNode);
  2516. 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") {
  2517. return currentNode;
  2518. } else {
  2519. currentNode = currentNode.parentNode;
  2520. }
  2521. }
  2522. return null;
  2523. }
  2524. function getOffsetParent(element) {
  2525. var window2 = getWindow(element);
  2526. var offsetParent = getTrueOffsetParent(element);
  2527. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  2528. offsetParent = getTrueOffsetParent(offsetParent);
  2529. }
  2530. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  2531. return window2;
  2532. }
  2533. return offsetParent || getContainingBlock(element) || window2;
  2534. }
  2535. function getMainAxisFromPlacement(placement) {
  2536. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  2537. }
  2538. function within(min$1, value, max$1) {
  2539. return max(min$1, min(value, max$1));
  2540. }
  2541. function withinMaxClamp(min2, value, max2) {
  2542. var v = within(min2, value, max2);
  2543. return v > max2 ? max2 : v;
  2544. }
  2545. function getFreshSideObject() {
  2546. return {
  2547. top: 0,
  2548. right: 0,
  2549. bottom: 0,
  2550. left: 0
  2551. };
  2552. }
  2553. function mergePaddingObject(paddingObject) {
  2554. return Object.assign({}, getFreshSideObject(), paddingObject);
  2555. }
  2556. function expandToHashMap(value, keys) {
  2557. return keys.reduce(function(hashMap, key) {
  2558. hashMap[key] = value;
  2559. return hashMap;
  2560. }, {});
  2561. }
  2562. var toPaddingObject = function toPaddingObject2(padding, state) {
  2563. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  2564. placement: state.placement
  2565. })) : padding;
  2566. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  2567. };
  2568. function arrow(_ref) {
  2569. var _state$modifiersData$;
  2570. var state = _ref.state, name = _ref.name, options = _ref.options;
  2571. var arrowElement = state.elements.arrow;
  2572. var popperOffsets2 = state.modifiersData.popperOffsets;
  2573. var basePlacement = getBasePlacement$1(state.placement);
  2574. var axis = getMainAxisFromPlacement(basePlacement);
  2575. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  2576. var len = isVertical ? "height" : "width";
  2577. if (!arrowElement || !popperOffsets2) {
  2578. return;
  2579. }
  2580. var paddingObject = toPaddingObject(options.padding, state);
  2581. var arrowRect = getLayoutRect(arrowElement);
  2582. var minProp = axis === "y" ? top : left;
  2583. var maxProp = axis === "y" ? bottom : right;
  2584. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  2585. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  2586. var arrowOffsetParent = getOffsetParent(arrowElement);
  2587. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  2588. var centerToReference = endDiff / 2 - startDiff / 2;
  2589. var min2 = paddingObject[minProp];
  2590. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  2591. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  2592. var offset2 = within(min2, center, max2);
  2593. var axisProp = axis;
  2594. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  2595. }
  2596. function effect$1(_ref2) {
  2597. var state = _ref2.state, options = _ref2.options;
  2598. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  2599. if (arrowElement == null) {
  2600. return;
  2601. }
  2602. if (typeof arrowElement === "string") {
  2603. arrowElement = state.elements.popper.querySelector(arrowElement);
  2604. if (!arrowElement) {
  2605. return;
  2606. }
  2607. }
  2608. if (!contains(state.elements.popper, arrowElement)) {
  2609. return;
  2610. }
  2611. state.elements.arrow = arrowElement;
  2612. }
  2613. const arrow$1 = {
  2614. name: "arrow",
  2615. enabled: true,
  2616. phase: "main",
  2617. fn: arrow,
  2618. effect: effect$1,
  2619. requires: ["popperOffsets"],
  2620. requiresIfExists: ["preventOverflow"]
  2621. };
  2622. function getVariation(placement) {
  2623. return placement.split("-")[1];
  2624. }
  2625. var unsetSides = {
  2626. top: "auto",
  2627. right: "auto",
  2628. bottom: "auto",
  2629. left: "auto"
  2630. };
  2631. function roundOffsetsByDPR(_ref, win) {
  2632. var x = _ref.x, y = _ref.y;
  2633. var dpr = win.devicePixelRatio || 1;
  2634. return {
  2635. x: round(x * dpr) / dpr || 0,
  2636. y: round(y * dpr) / dpr || 0
  2637. };
  2638. }
  2639. function mapToStyles(_ref2) {
  2640. var _Object$assign2;
  2641. 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;
  2642. 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;
  2643. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  2644. x,
  2645. y
  2646. }) : {
  2647. x,
  2648. y
  2649. };
  2650. x = _ref3.x;
  2651. y = _ref3.y;
  2652. var hasX = offsets.hasOwnProperty("x");
  2653. var hasY = offsets.hasOwnProperty("y");
  2654. var sideX = left;
  2655. var sideY = top;
  2656. var win = window;
  2657. if (adaptive) {
  2658. var offsetParent = getOffsetParent(popper2);
  2659. var heightProp = "clientHeight";
  2660. var widthProp = "clientWidth";
  2661. if (offsetParent === getWindow(popper2)) {
  2662. offsetParent = getDocumentElement(popper2);
  2663. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  2664. heightProp = "scrollHeight";
  2665. widthProp = "scrollWidth";
  2666. }
  2667. }
  2668. offsetParent = offsetParent;
  2669. if (placement === top || (placement === left || placement === right) && variation === end) {
  2670. sideY = bottom;
  2671. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  2672. // $FlowFixMe[prop-missing]
  2673. offsetParent[heightProp]
  2674. );
  2675. y -= offsetY - popperRect.height;
  2676. y *= gpuAcceleration ? 1 : -1;
  2677. }
  2678. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  2679. sideX = right;
  2680. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  2681. // $FlowFixMe[prop-missing]
  2682. offsetParent[widthProp]
  2683. );
  2684. x -= offsetX - popperRect.width;
  2685. x *= gpuAcceleration ? 1 : -1;
  2686. }
  2687. }
  2688. var commonStyles = Object.assign({
  2689. position
  2690. }, adaptive && unsetSides);
  2691. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  2692. x,
  2693. y
  2694. }, getWindow(popper2)) : {
  2695. x,
  2696. y
  2697. };
  2698. x = _ref4.x;
  2699. y = _ref4.y;
  2700. if (gpuAcceleration) {
  2701. var _Object$assign;
  2702. 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));
  2703. }
  2704. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  2705. }
  2706. function computeStyles(_ref5) {
  2707. var state = _ref5.state, options = _ref5.options;
  2708. 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;
  2709. var commonStyles = {
  2710. placement: getBasePlacement$1(state.placement),
  2711. variation: getVariation(state.placement),
  2712. popper: state.elements.popper,
  2713. popperRect: state.rects.popper,
  2714. gpuAcceleration,
  2715. isFixed: state.options.strategy === "fixed"
  2716. };
  2717. if (state.modifiersData.popperOffsets != null) {
  2718. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  2719. offsets: state.modifiersData.popperOffsets,
  2720. position: state.options.strategy,
  2721. adaptive,
  2722. roundOffsets
  2723. })));
  2724. }
  2725. if (state.modifiersData.arrow != null) {
  2726. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  2727. offsets: state.modifiersData.arrow,
  2728. position: "absolute",
  2729. adaptive: false,
  2730. roundOffsets
  2731. })));
  2732. }
  2733. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2734. "data-popper-placement": state.placement
  2735. });
  2736. }
  2737. const computeStyles$1 = {
  2738. name: "computeStyles",
  2739. enabled: true,
  2740. phase: "beforeWrite",
  2741. fn: computeStyles,
  2742. data: {}
  2743. };
  2744. var passive = {
  2745. passive: true
  2746. };
  2747. function effect(_ref) {
  2748. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  2749. 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;
  2750. var window2 = getWindow(state.elements.popper);
  2751. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  2752. if (scroll) {
  2753. scrollParents.forEach(function(scrollParent) {
  2754. scrollParent.addEventListener("scroll", instance.update, passive);
  2755. });
  2756. }
  2757. if (resize) {
  2758. window2.addEventListener("resize", instance.update, passive);
  2759. }
  2760. return function() {
  2761. if (scroll) {
  2762. scrollParents.forEach(function(scrollParent) {
  2763. scrollParent.removeEventListener("scroll", instance.update, passive);
  2764. });
  2765. }
  2766. if (resize) {
  2767. window2.removeEventListener("resize", instance.update, passive);
  2768. }
  2769. };
  2770. }
  2771. const eventListeners = {
  2772. name: "eventListeners",
  2773. enabled: true,
  2774. phase: "write",
  2775. fn: function fn() {
  2776. },
  2777. effect,
  2778. data: {}
  2779. };
  2780. var hash$1 = {
  2781. left: "right",
  2782. right: "left",
  2783. bottom: "top",
  2784. top: "bottom"
  2785. };
  2786. function getOppositePlacement(placement) {
  2787. return placement.replace(/left|right|bottom|top/g, function(matched) {
  2788. return hash$1[matched];
  2789. });
  2790. }
  2791. var hash = {
  2792. start: "end",
  2793. end: "start"
  2794. };
  2795. function getOppositeVariationPlacement(placement) {
  2796. return placement.replace(/start|end/g, function(matched) {
  2797. return hash[matched];
  2798. });
  2799. }
  2800. function getWindowScroll(node) {
  2801. var win = getWindow(node);
  2802. var scrollLeft = win.pageXOffset;
  2803. var scrollTop = win.pageYOffset;
  2804. return {
  2805. scrollLeft,
  2806. scrollTop
  2807. };
  2808. }
  2809. function getWindowScrollBarX(element) {
  2810. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  2811. }
  2812. function getViewportRect(element, strategy) {
  2813. var win = getWindow(element);
  2814. var html = getDocumentElement(element);
  2815. var visualViewport = win.visualViewport;
  2816. var width = html.clientWidth;
  2817. var height = html.clientHeight;
  2818. var x = 0;
  2819. var y = 0;
  2820. if (visualViewport) {
  2821. width = visualViewport.width;
  2822. height = visualViewport.height;
  2823. var layoutViewport = isLayoutViewport();
  2824. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  2825. x = visualViewport.offsetLeft;
  2826. y = visualViewport.offsetTop;
  2827. }
  2828. }
  2829. return {
  2830. width,
  2831. height,
  2832. x: x + getWindowScrollBarX(element),
  2833. y
  2834. };
  2835. }
  2836. function getDocumentRect(element) {
  2837. var _element$ownerDocumen;
  2838. var html = getDocumentElement(element);
  2839. var winScroll = getWindowScroll(element);
  2840. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  2841. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  2842. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  2843. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  2844. var y = -winScroll.scrollTop;
  2845. if (getComputedStyle(body || html).direction === "rtl") {
  2846. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  2847. }
  2848. return {
  2849. width,
  2850. height,
  2851. x,
  2852. y
  2853. };
  2854. }
  2855. function isScrollParent(element) {
  2856. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  2857. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  2858. }
  2859. function getScrollParent(node) {
  2860. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  2861. return node.ownerDocument.body;
  2862. }
  2863. if (isHTMLElement(node) && isScrollParent(node)) {
  2864. return node;
  2865. }
  2866. return getScrollParent(getParentNode(node));
  2867. }
  2868. function listScrollParents(element, list) {
  2869. var _element$ownerDocumen;
  2870. if (list === void 0) {
  2871. list = [];
  2872. }
  2873. var scrollParent = getScrollParent(element);
  2874. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  2875. var win = getWindow(scrollParent);
  2876. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  2877. var updatedList = list.concat(target);
  2878. return isBody ? updatedList : (
  2879. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  2880. updatedList.concat(listScrollParents(getParentNode(target)))
  2881. );
  2882. }
  2883. function rectToClientRect(rect) {
  2884. return Object.assign({}, rect, {
  2885. left: rect.x,
  2886. top: rect.y,
  2887. right: rect.x + rect.width,
  2888. bottom: rect.y + rect.height
  2889. });
  2890. }
  2891. function getInnerBoundingClientRect(element, strategy) {
  2892. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  2893. rect.top = rect.top + element.clientTop;
  2894. rect.left = rect.left + element.clientLeft;
  2895. rect.bottom = rect.top + element.clientHeight;
  2896. rect.right = rect.left + element.clientWidth;
  2897. rect.width = element.clientWidth;
  2898. rect.height = element.clientHeight;
  2899. rect.x = rect.left;
  2900. rect.y = rect.top;
  2901. return rect;
  2902. }
  2903. function getClientRectFromMixedType(element, clippingParent, strategy) {
  2904. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  2905. }
  2906. function getClippingParents(element) {
  2907. var clippingParents2 = listScrollParents(getParentNode(element));
  2908. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  2909. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  2910. if (!isElement$1(clipperElement)) {
  2911. return [];
  2912. }
  2913. return clippingParents2.filter(function(clippingParent) {
  2914. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  2915. });
  2916. }
  2917. function getClippingRect(element, boundary, rootBoundary, strategy) {
  2918. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  2919. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  2920. var firstClippingParent = clippingParents2[0];
  2921. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  2922. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  2923. accRect.top = max(rect.top, accRect.top);
  2924. accRect.right = min(rect.right, accRect.right);
  2925. accRect.bottom = min(rect.bottom, accRect.bottom);
  2926. accRect.left = max(rect.left, accRect.left);
  2927. return accRect;
  2928. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  2929. clippingRect.width = clippingRect.right - clippingRect.left;
  2930. clippingRect.height = clippingRect.bottom - clippingRect.top;
  2931. clippingRect.x = clippingRect.left;
  2932. clippingRect.y = clippingRect.top;
  2933. return clippingRect;
  2934. }
  2935. function computeOffsets(_ref) {
  2936. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  2937. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  2938. var variation = placement ? getVariation(placement) : null;
  2939. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  2940. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  2941. var offsets;
  2942. switch (basePlacement) {
  2943. case top:
  2944. offsets = {
  2945. x: commonX,
  2946. y: reference2.y - element.height
  2947. };
  2948. break;
  2949. case bottom:
  2950. offsets = {
  2951. x: commonX,
  2952. y: reference2.y + reference2.height
  2953. };
  2954. break;
  2955. case right:
  2956. offsets = {
  2957. x: reference2.x + reference2.width,
  2958. y: commonY
  2959. };
  2960. break;
  2961. case left:
  2962. offsets = {
  2963. x: reference2.x - element.width,
  2964. y: commonY
  2965. };
  2966. break;
  2967. default:
  2968. offsets = {
  2969. x: reference2.x,
  2970. y: reference2.y
  2971. };
  2972. }
  2973. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  2974. if (mainAxis != null) {
  2975. var len = mainAxis === "y" ? "height" : "width";
  2976. switch (variation) {
  2977. case start:
  2978. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  2979. break;
  2980. case end:
  2981. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  2982. break;
  2983. }
  2984. }
  2985. return offsets;
  2986. }
  2987. function detectOverflow(state, options) {
  2988. if (options === void 0) {
  2989. options = {};
  2990. }
  2991. 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;
  2992. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  2993. var altContext = elementContext === popper ? reference : popper;
  2994. var popperRect = state.rects.popper;
  2995. var element = state.elements[altBoundary ? altContext : elementContext];
  2996. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  2997. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  2998. var popperOffsets2 = computeOffsets({
  2999. reference: referenceClientRect,
  3000. element: popperRect,
  3001. strategy: "absolute",
  3002. placement
  3003. });
  3004. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  3005. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  3006. var overflowOffsets = {
  3007. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  3008. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  3009. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  3010. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  3011. };
  3012. var offsetData = state.modifiersData.offset;
  3013. if (elementContext === popper && offsetData) {
  3014. var offset2 = offsetData[placement];
  3015. Object.keys(overflowOffsets).forEach(function(key) {
  3016. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  3017. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  3018. overflowOffsets[key] += offset2[axis] * multiply;
  3019. });
  3020. }
  3021. return overflowOffsets;
  3022. }
  3023. function computeAutoPlacement(state, options) {
  3024. if (options === void 0) {
  3025. options = {};
  3026. }
  3027. 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;
  3028. var variation = getVariation(placement);
  3029. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  3030. return getVariation(placement2) === variation;
  3031. }) : basePlacements;
  3032. var allowedPlacements = placements$1.filter(function(placement2) {
  3033. return allowedAutoPlacements.indexOf(placement2) >= 0;
  3034. });
  3035. if (allowedPlacements.length === 0) {
  3036. allowedPlacements = placements$1;
  3037. }
  3038. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  3039. acc[placement2] = detectOverflow(state, {
  3040. placement: placement2,
  3041. boundary,
  3042. rootBoundary,
  3043. padding
  3044. })[getBasePlacement$1(placement2)];
  3045. return acc;
  3046. }, {});
  3047. return Object.keys(overflows).sort(function(a, b) {
  3048. return overflows[a] - overflows[b];
  3049. });
  3050. }
  3051. function getExpandedFallbackPlacements(placement) {
  3052. if (getBasePlacement$1(placement) === auto) {
  3053. return [];
  3054. }
  3055. var oppositePlacement = getOppositePlacement(placement);
  3056. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  3057. }
  3058. function flip(_ref) {
  3059. var state = _ref.state, options = _ref.options, name = _ref.name;
  3060. if (state.modifiersData[name]._skip) {
  3061. return;
  3062. }
  3063. 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;
  3064. var preferredPlacement = state.options.placement;
  3065. var basePlacement = getBasePlacement$1(preferredPlacement);
  3066. var isBasePlacement = basePlacement === preferredPlacement;
  3067. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  3068. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  3069. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  3070. placement: placement2,
  3071. boundary,
  3072. rootBoundary,
  3073. padding,
  3074. flipVariations,
  3075. allowedAutoPlacements
  3076. }) : placement2);
  3077. }, []);
  3078. var referenceRect = state.rects.reference;
  3079. var popperRect = state.rects.popper;
  3080. var checksMap = /* @__PURE__ */ new Map();
  3081. var makeFallbackChecks = true;
  3082. var firstFittingPlacement = placements2[0];
  3083. for (var i = 0; i < placements2.length; i++) {
  3084. var placement = placements2[i];
  3085. var _basePlacement = getBasePlacement$1(placement);
  3086. var isStartVariation = getVariation(placement) === start;
  3087. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  3088. var len = isVertical ? "width" : "height";
  3089. var overflow = detectOverflow(state, {
  3090. placement,
  3091. boundary,
  3092. rootBoundary,
  3093. altBoundary,
  3094. padding
  3095. });
  3096. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  3097. if (referenceRect[len] > popperRect[len]) {
  3098. mainVariationSide = getOppositePlacement(mainVariationSide);
  3099. }
  3100. var altVariationSide = getOppositePlacement(mainVariationSide);
  3101. var checks = [];
  3102. if (checkMainAxis) {
  3103. checks.push(overflow[_basePlacement] <= 0);
  3104. }
  3105. if (checkAltAxis) {
  3106. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  3107. }
  3108. if (checks.every(function(check) {
  3109. return check;
  3110. })) {
  3111. firstFittingPlacement = placement;
  3112. makeFallbackChecks = false;
  3113. break;
  3114. }
  3115. checksMap.set(placement, checks);
  3116. }
  3117. if (makeFallbackChecks) {
  3118. var numberOfChecks = flipVariations ? 3 : 1;
  3119. var _loop = function _loop2(_i2) {
  3120. var fittingPlacement = placements2.find(function(placement2) {
  3121. var checks2 = checksMap.get(placement2);
  3122. if (checks2) {
  3123. return checks2.slice(0, _i2).every(function(check) {
  3124. return check;
  3125. });
  3126. }
  3127. });
  3128. if (fittingPlacement) {
  3129. firstFittingPlacement = fittingPlacement;
  3130. return "break";
  3131. }
  3132. };
  3133. for (var _i = numberOfChecks; _i > 0; _i--) {
  3134. var _ret = _loop(_i);
  3135. if (_ret === "break") break;
  3136. }
  3137. }
  3138. if (state.placement !== firstFittingPlacement) {
  3139. state.modifiersData[name]._skip = true;
  3140. state.placement = firstFittingPlacement;
  3141. state.reset = true;
  3142. }
  3143. }
  3144. const flip$1 = {
  3145. name: "flip",
  3146. enabled: true,
  3147. phase: "main",
  3148. fn: flip,
  3149. requiresIfExists: ["offset"],
  3150. data: {
  3151. _skip: false
  3152. }
  3153. };
  3154. function getSideOffsets(overflow, rect, preventedOffsets) {
  3155. if (preventedOffsets === void 0) {
  3156. preventedOffsets = {
  3157. x: 0,
  3158. y: 0
  3159. };
  3160. }
  3161. return {
  3162. top: overflow.top - rect.height - preventedOffsets.y,
  3163. right: overflow.right - rect.width + preventedOffsets.x,
  3164. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  3165. left: overflow.left - rect.width - preventedOffsets.x
  3166. };
  3167. }
  3168. function isAnySideFullyClipped(overflow) {
  3169. return [top, right, bottom, left].some(function(side) {
  3170. return overflow[side] >= 0;
  3171. });
  3172. }
  3173. function hide(_ref) {
  3174. var state = _ref.state, name = _ref.name;
  3175. var referenceRect = state.rects.reference;
  3176. var popperRect = state.rects.popper;
  3177. var preventedOffsets = state.modifiersData.preventOverflow;
  3178. var referenceOverflow = detectOverflow(state, {
  3179. elementContext: "reference"
  3180. });
  3181. var popperAltOverflow = detectOverflow(state, {
  3182. altBoundary: true
  3183. });
  3184. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  3185. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  3186. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  3187. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  3188. state.modifiersData[name] = {
  3189. referenceClippingOffsets,
  3190. popperEscapeOffsets,
  3191. isReferenceHidden,
  3192. hasPopperEscaped
  3193. };
  3194. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  3195. "data-popper-reference-hidden": isReferenceHidden,
  3196. "data-popper-escaped": hasPopperEscaped
  3197. });
  3198. }
  3199. const hide$1 = {
  3200. name: "hide",
  3201. enabled: true,
  3202. phase: "main",
  3203. requiresIfExists: ["preventOverflow"],
  3204. fn: hide
  3205. };
  3206. function distanceAndSkiddingToXY(placement, rects, offset2) {
  3207. var basePlacement = getBasePlacement$1(placement);
  3208. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  3209. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  3210. placement
  3211. })) : offset2, skidding = _ref[0], distance = _ref[1];
  3212. skidding = skidding || 0;
  3213. distance = (distance || 0) * invertDistance;
  3214. return [left, right].indexOf(basePlacement) >= 0 ? {
  3215. x: distance,
  3216. y: skidding
  3217. } : {
  3218. x: skidding,
  3219. y: distance
  3220. };
  3221. }
  3222. function offset(_ref2) {
  3223. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  3224. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  3225. var data = placements.reduce(function(acc, placement) {
  3226. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  3227. return acc;
  3228. }, {});
  3229. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  3230. if (state.modifiersData.popperOffsets != null) {
  3231. state.modifiersData.popperOffsets.x += x;
  3232. state.modifiersData.popperOffsets.y += y;
  3233. }
  3234. state.modifiersData[name] = data;
  3235. }
  3236. const offset$1 = {
  3237. name: "offset",
  3238. enabled: true,
  3239. phase: "main",
  3240. requires: ["popperOffsets"],
  3241. fn: offset
  3242. };
  3243. function popperOffsets(_ref) {
  3244. var state = _ref.state, name = _ref.name;
  3245. state.modifiersData[name] = computeOffsets({
  3246. reference: state.rects.reference,
  3247. element: state.rects.popper,
  3248. strategy: "absolute",
  3249. placement: state.placement
  3250. });
  3251. }
  3252. const popperOffsets$1 = {
  3253. name: "popperOffsets",
  3254. enabled: true,
  3255. phase: "read",
  3256. fn: popperOffsets,
  3257. data: {}
  3258. };
  3259. function getAltAxis(axis) {
  3260. return axis === "x" ? "y" : "x";
  3261. }
  3262. function preventOverflow(_ref) {
  3263. var state = _ref.state, options = _ref.options, name = _ref.name;
  3264. 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;
  3265. var overflow = detectOverflow(state, {
  3266. boundary,
  3267. rootBoundary,
  3268. padding,
  3269. altBoundary
  3270. });
  3271. var basePlacement = getBasePlacement$1(state.placement);
  3272. var variation = getVariation(state.placement);
  3273. var isBasePlacement = !variation;
  3274. var mainAxis = getMainAxisFromPlacement(basePlacement);
  3275. var altAxis = getAltAxis(mainAxis);
  3276. var popperOffsets2 = state.modifiersData.popperOffsets;
  3277. var referenceRect = state.rects.reference;
  3278. var popperRect = state.rects.popper;
  3279. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  3280. placement: state.placement
  3281. })) : tetherOffset;
  3282. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  3283. mainAxis: tetherOffsetValue,
  3284. altAxis: tetherOffsetValue
  3285. } : Object.assign({
  3286. mainAxis: 0,
  3287. altAxis: 0
  3288. }, tetherOffsetValue);
  3289. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  3290. var data = {
  3291. x: 0,
  3292. y: 0
  3293. };
  3294. if (!popperOffsets2) {
  3295. return;
  3296. }
  3297. if (checkMainAxis) {
  3298. var _offsetModifierState$;
  3299. var mainSide = mainAxis === "y" ? top : left;
  3300. var altSide = mainAxis === "y" ? bottom : right;
  3301. var len = mainAxis === "y" ? "height" : "width";
  3302. var offset2 = popperOffsets2[mainAxis];
  3303. var min$1 = offset2 + overflow[mainSide];
  3304. var max$1 = offset2 - overflow[altSide];
  3305. var additive = tether ? -popperRect[len] / 2 : 0;
  3306. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  3307. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  3308. var arrowElement = state.elements.arrow;
  3309. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  3310. width: 0,
  3311. height: 0
  3312. };
  3313. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  3314. var arrowPaddingMin = arrowPaddingObject[mainSide];
  3315. var arrowPaddingMax = arrowPaddingObject[altSide];
  3316. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  3317. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  3318. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  3319. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  3320. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  3321. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  3322. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  3323. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  3324. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  3325. popperOffsets2[mainAxis] = preventedOffset;
  3326. data[mainAxis] = preventedOffset - offset2;
  3327. }
  3328. if (checkAltAxis) {
  3329. var _offsetModifierState$2;
  3330. var _mainSide = mainAxis === "x" ? top : left;
  3331. var _altSide = mainAxis === "x" ? bottom : right;
  3332. var _offset = popperOffsets2[altAxis];
  3333. var _len = altAxis === "y" ? "height" : "width";
  3334. var _min = _offset + overflow[_mainSide];
  3335. var _max = _offset - overflow[_altSide];
  3336. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  3337. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  3338. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  3339. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  3340. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  3341. popperOffsets2[altAxis] = _preventedOffset;
  3342. data[altAxis] = _preventedOffset - _offset;
  3343. }
  3344. state.modifiersData[name] = data;
  3345. }
  3346. const preventOverflow$1 = {
  3347. name: "preventOverflow",
  3348. enabled: true,
  3349. phase: "main",
  3350. fn: preventOverflow,
  3351. requiresIfExists: ["offset"]
  3352. };
  3353. function getHTMLElementScroll(element) {
  3354. return {
  3355. scrollLeft: element.scrollLeft,
  3356. scrollTop: element.scrollTop
  3357. };
  3358. }
  3359. function getNodeScroll(node) {
  3360. if (node === getWindow(node) || !isHTMLElement(node)) {
  3361. return getWindowScroll(node);
  3362. } else {
  3363. return getHTMLElementScroll(node);
  3364. }
  3365. }
  3366. function isElementScaled(element) {
  3367. var rect = element.getBoundingClientRect();
  3368. var scaleX = round(rect.width) / element.offsetWidth || 1;
  3369. var scaleY = round(rect.height) / element.offsetHeight || 1;
  3370. return scaleX !== 1 || scaleY !== 1;
  3371. }
  3372. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  3373. if (isFixed === void 0) {
  3374. isFixed = false;
  3375. }
  3376. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  3377. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  3378. var documentElement = getDocumentElement(offsetParent);
  3379. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  3380. var scroll = {
  3381. scrollLeft: 0,
  3382. scrollTop: 0
  3383. };
  3384. var offsets = {
  3385. x: 0,
  3386. y: 0
  3387. };
  3388. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  3389. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  3390. isScrollParent(documentElement)) {
  3391. scroll = getNodeScroll(offsetParent);
  3392. }
  3393. if (isHTMLElement(offsetParent)) {
  3394. offsets = getBoundingClientRect(offsetParent, true);
  3395. offsets.x += offsetParent.clientLeft;
  3396. offsets.y += offsetParent.clientTop;
  3397. } else if (documentElement) {
  3398. offsets.x = getWindowScrollBarX(documentElement);
  3399. }
  3400. }
  3401. return {
  3402. x: rect.left + scroll.scrollLeft - offsets.x,
  3403. y: rect.top + scroll.scrollTop - offsets.y,
  3404. width: rect.width,
  3405. height: rect.height
  3406. };
  3407. }
  3408. function order(modifiers) {
  3409. var map = /* @__PURE__ */ new Map();
  3410. var visited = /* @__PURE__ */ new Set();
  3411. var result = [];
  3412. modifiers.forEach(function(modifier) {
  3413. map.set(modifier.name, modifier);
  3414. });
  3415. function sort(modifier) {
  3416. visited.add(modifier.name);
  3417. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  3418. requires.forEach(function(dep) {
  3419. if (!visited.has(dep)) {
  3420. var depModifier = map.get(dep);
  3421. if (depModifier) {
  3422. sort(depModifier);
  3423. }
  3424. }
  3425. });
  3426. result.push(modifier);
  3427. }
  3428. modifiers.forEach(function(modifier) {
  3429. if (!visited.has(modifier.name)) {
  3430. sort(modifier);
  3431. }
  3432. });
  3433. return result;
  3434. }
  3435. function orderModifiers(modifiers) {
  3436. var orderedModifiers = order(modifiers);
  3437. return modifierPhases.reduce(function(acc, phase) {
  3438. return acc.concat(orderedModifiers.filter(function(modifier) {
  3439. return modifier.phase === phase;
  3440. }));
  3441. }, []);
  3442. }
  3443. function debounce$1(fn2) {
  3444. var pending;
  3445. return function() {
  3446. if (!pending) {
  3447. pending = new Promise(function(resolve) {
  3448. Promise.resolve().then(function() {
  3449. pending = void 0;
  3450. resolve(fn2());
  3451. });
  3452. });
  3453. }
  3454. return pending;
  3455. };
  3456. }
  3457. function mergeByName(modifiers) {
  3458. var merged = modifiers.reduce(function(merged2, current) {
  3459. var existing = merged2[current.name];
  3460. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  3461. options: Object.assign({}, existing.options, current.options),
  3462. data: Object.assign({}, existing.data, current.data)
  3463. }) : current;
  3464. return merged2;
  3465. }, {});
  3466. return Object.keys(merged).map(function(key) {
  3467. return merged[key];
  3468. });
  3469. }
  3470. var DEFAULT_OPTIONS = {
  3471. placement: "bottom",
  3472. modifiers: [],
  3473. strategy: "absolute"
  3474. };
  3475. function areValidElements() {
  3476. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3477. args[_key] = arguments[_key];
  3478. }
  3479. return !args.some(function(element) {
  3480. return !(element && typeof element.getBoundingClientRect === "function");
  3481. });
  3482. }
  3483. function popperGenerator(generatorOptions) {
  3484. if (generatorOptions === void 0) {
  3485. generatorOptions = {};
  3486. }
  3487. 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;
  3488. return function createPopper2(reference2, popper2, options) {
  3489. if (options === void 0) {
  3490. options = defaultOptions;
  3491. }
  3492. var state = {
  3493. placement: "bottom",
  3494. orderedModifiers: [],
  3495. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  3496. modifiersData: {},
  3497. elements: {
  3498. reference: reference2,
  3499. popper: popper2
  3500. },
  3501. attributes: {},
  3502. styles: {}
  3503. };
  3504. var effectCleanupFns = [];
  3505. var isDestroyed = false;
  3506. var instance = {
  3507. state,
  3508. setOptions: function setOptions(setOptionsAction) {
  3509. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  3510. cleanupModifierEffects();
  3511. state.options = Object.assign({}, defaultOptions, state.options, options2);
  3512. state.scrollParents = {
  3513. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  3514. popper: listScrollParents(popper2)
  3515. };
  3516. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  3517. state.orderedModifiers = orderedModifiers.filter(function(m) {
  3518. return m.enabled;
  3519. });
  3520. runModifierEffects();
  3521. return instance.update();
  3522. },
  3523. // Sync update – it will always be executed, even if not necessary. This
  3524. // is useful for low frequency updates where sync behavior simplifies the
  3525. // logic.
  3526. // For high frequency updates (e.g. `resize` and `scroll` events), always
  3527. // prefer the async Popper#update method
  3528. forceUpdate: function forceUpdate() {
  3529. if (isDestroyed) {
  3530. return;
  3531. }
  3532. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  3533. if (!areValidElements(reference3, popper3)) {
  3534. return;
  3535. }
  3536. state.rects = {
  3537. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  3538. popper: getLayoutRect(popper3)
  3539. };
  3540. state.reset = false;
  3541. state.placement = state.options.placement;
  3542. state.orderedModifiers.forEach(function(modifier) {
  3543. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  3544. });
  3545. for (var index = 0; index < state.orderedModifiers.length; index++) {
  3546. if (state.reset === true) {
  3547. state.reset = false;
  3548. index = -1;
  3549. continue;
  3550. }
  3551. 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;
  3552. if (typeof fn2 === "function") {
  3553. state = fn2({
  3554. state,
  3555. options: _options,
  3556. name,
  3557. instance
  3558. }) || state;
  3559. }
  3560. }
  3561. },
  3562. // Async and optimistically optimized update – it will not be executed if
  3563. // not necessary (debounced to run at most once-per-tick)
  3564. update: debounce$1(function() {
  3565. return new Promise(function(resolve) {
  3566. instance.forceUpdate();
  3567. resolve(state);
  3568. });
  3569. }),
  3570. destroy: function destroy() {
  3571. cleanupModifierEffects();
  3572. isDestroyed = true;
  3573. }
  3574. };
  3575. if (!areValidElements(reference2, popper2)) {
  3576. return instance;
  3577. }
  3578. instance.setOptions(options).then(function(state2) {
  3579. if (!isDestroyed && options.onFirstUpdate) {
  3580. options.onFirstUpdate(state2);
  3581. }
  3582. });
  3583. function runModifierEffects() {
  3584. state.orderedModifiers.forEach(function(_ref) {
  3585. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  3586. if (typeof effect3 === "function") {
  3587. var cleanupFn = effect3({
  3588. state,
  3589. name,
  3590. instance,
  3591. options: options2
  3592. });
  3593. var noopFn = function noopFn2() {
  3594. };
  3595. effectCleanupFns.push(cleanupFn || noopFn);
  3596. }
  3597. });
  3598. }
  3599. function cleanupModifierEffects() {
  3600. effectCleanupFns.forEach(function(fn2) {
  3601. return fn2();
  3602. });
  3603. effectCleanupFns = [];
  3604. }
  3605. return instance;
  3606. };
  3607. }
  3608. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  3609. var createPopper = /* @__PURE__ */ popperGenerator({
  3610. defaultModifiers
  3611. });
  3612. var BOX_CLASS = "tippy-box";
  3613. var CONTENT_CLASS = "tippy-content";
  3614. var BACKDROP_CLASS = "tippy-backdrop";
  3615. var ARROW_CLASS = "tippy-arrow";
  3616. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  3617. var TOUCH_OPTIONS = {
  3618. passive: true,
  3619. capture: true
  3620. };
  3621. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  3622. return document.body;
  3623. };
  3624. function getValueAtIndexOrReturn(value, index, defaultValue) {
  3625. if (Array.isArray(value)) {
  3626. var v = value[index];
  3627. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  3628. }
  3629. return value;
  3630. }
  3631. function isType(value, type) {
  3632. var str = {}.toString.call(value);
  3633. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  3634. }
  3635. function invokeWithArgsOrReturn(value, args) {
  3636. return typeof value === "function" ? value.apply(void 0, args) : value;
  3637. }
  3638. function debounce(fn5, ms) {
  3639. if (ms === 0) {
  3640. return fn5;
  3641. }
  3642. var timeout;
  3643. return function(arg) {
  3644. clearTimeout(timeout);
  3645. timeout = setTimeout(function() {
  3646. fn5(arg);
  3647. }, ms);
  3648. };
  3649. }
  3650. function splitBySpaces(value) {
  3651. return value.split(/\s+/).filter(Boolean);
  3652. }
  3653. function normalizeToArray(value) {
  3654. return [].concat(value);
  3655. }
  3656. function pushIfUnique(arr, value) {
  3657. if (arr.indexOf(value) === -1) {
  3658. arr.push(value);
  3659. }
  3660. }
  3661. function unique(arr) {
  3662. return arr.filter(function(item, index) {
  3663. return arr.indexOf(item) === index;
  3664. });
  3665. }
  3666. function getBasePlacement(placement) {
  3667. return placement.split("-")[0];
  3668. }
  3669. function arrayFrom(value) {
  3670. return [].slice.call(value);
  3671. }
  3672. function removeUndefinedProps(obj) {
  3673. return Object.keys(obj).reduce(function(acc, key) {
  3674. if (obj[key] !== void 0) {
  3675. acc[key] = obj[key];
  3676. }
  3677. return acc;
  3678. }, {});
  3679. }
  3680. function div() {
  3681. return document.createElement("div");
  3682. }
  3683. function isElement(value) {
  3684. return ["Element", "Fragment"].some(function(type) {
  3685. return isType(value, type);
  3686. });
  3687. }
  3688. function isNodeList(value) {
  3689. return isType(value, "NodeList");
  3690. }
  3691. function isMouseEvent(value) {
  3692. return isType(value, "MouseEvent");
  3693. }
  3694. function isReferenceElement(value) {
  3695. return !!(value && value._tippy && value._tippy.reference === value);
  3696. }
  3697. function getArrayOfElements(value) {
  3698. if (isElement(value)) {
  3699. return [value];
  3700. }
  3701. if (isNodeList(value)) {
  3702. return arrayFrom(value);
  3703. }
  3704. if (Array.isArray(value)) {
  3705. return value;
  3706. }
  3707. return arrayFrom(document.querySelectorAll(value));
  3708. }
  3709. function setTransitionDuration(els, value) {
  3710. els.forEach(function(el) {
  3711. if (el) {
  3712. el.style.transitionDuration = value + "ms";
  3713. }
  3714. });
  3715. }
  3716. function setVisibilityState(els, state) {
  3717. els.forEach(function(el) {
  3718. if (el) {
  3719. el.setAttribute("data-state", state);
  3720. }
  3721. });
  3722. }
  3723. function getOwnerDocument(elementOrElements) {
  3724. var _element$ownerDocumen;
  3725. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  3726. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  3727. }
  3728. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  3729. var clientX = event.clientX, clientY = event.clientY;
  3730. return popperTreeData.every(function(_ref) {
  3731. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  3732. var interactiveBorder = props.interactiveBorder;
  3733. var basePlacement = getBasePlacement(popperState.placement);
  3734. var offsetData = popperState.modifiersData.offset;
  3735. if (!offsetData) {
  3736. return true;
  3737. }
  3738. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  3739. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  3740. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  3741. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  3742. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  3743. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  3744. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  3745. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  3746. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  3747. });
  3748. }
  3749. function updateTransitionEndListener(box, action, listener) {
  3750. var method = action + "EventListener";
  3751. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  3752. box[method](event, listener);
  3753. });
  3754. }
  3755. function actualContains(parent, child) {
  3756. var target = child;
  3757. while (target) {
  3758. var _target$getRootNode;
  3759. if (parent.contains(target)) {
  3760. return true;
  3761. }
  3762. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  3763. }
  3764. return false;
  3765. }
  3766. var currentInput = {
  3767. isTouch: false
  3768. };
  3769. var lastMouseMoveTime = 0;
  3770. function onDocumentTouchStart() {
  3771. if (currentInput.isTouch) {
  3772. return;
  3773. }
  3774. currentInput.isTouch = true;
  3775. if (window.performance) {
  3776. document.addEventListener("mousemove", onDocumentMouseMove);
  3777. }
  3778. }
  3779. function onDocumentMouseMove() {
  3780. var now = performance.now();
  3781. if (now - lastMouseMoveTime < 20) {
  3782. currentInput.isTouch = false;
  3783. document.removeEventListener("mousemove", onDocumentMouseMove);
  3784. }
  3785. lastMouseMoveTime = now;
  3786. }
  3787. function onWindowBlur() {
  3788. var activeElement = document.activeElement;
  3789. if (isReferenceElement(activeElement)) {
  3790. var instance = activeElement._tippy;
  3791. if (activeElement.blur && !instance.state.isVisible) {
  3792. activeElement.blur();
  3793. }
  3794. }
  3795. }
  3796. function bindGlobalEventListeners() {
  3797. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  3798. window.addEventListener("blur", onWindowBlur);
  3799. }
  3800. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  3801. var isIE11 = isBrowser ? (
  3802. // @ts-ignore
  3803. !!window.msCrypto
  3804. ) : false;
  3805. var pluginProps = {
  3806. animateFill: false,
  3807. followCursor: false,
  3808. inlinePositioning: false,
  3809. sticky: false
  3810. };
  3811. var renderProps = {
  3812. allowHTML: false,
  3813. animation: "fade",
  3814. arrow: true,
  3815. content: "",
  3816. inertia: false,
  3817. maxWidth: 350,
  3818. role: "tooltip",
  3819. theme: "",
  3820. zIndex: 9999
  3821. };
  3822. var defaultProps = Object.assign({
  3823. appendTo: TIPPY_DEFAULT_APPEND_TO,
  3824. aria: {
  3825. content: "auto",
  3826. expanded: "auto"
  3827. },
  3828. delay: 0,
  3829. duration: [300, 250],
  3830. getReferenceClientRect: null,
  3831. hideOnClick: true,
  3832. ignoreAttributes: false,
  3833. interactive: false,
  3834. interactiveBorder: 2,
  3835. interactiveDebounce: 0,
  3836. moveTransition: "",
  3837. offset: [0, 10],
  3838. onAfterUpdate: function onAfterUpdate() {
  3839. },
  3840. onBeforeUpdate: function onBeforeUpdate() {
  3841. },
  3842. onCreate: function onCreate() {
  3843. },
  3844. onDestroy: function onDestroy() {
  3845. },
  3846. onHidden: function onHidden() {
  3847. },
  3848. onHide: function onHide() {
  3849. },
  3850. onMount: function onMount() {
  3851. },
  3852. onShow: function onShow() {
  3853. },
  3854. onShown: function onShown() {
  3855. },
  3856. onTrigger: function onTrigger() {
  3857. },
  3858. onUntrigger: function onUntrigger() {
  3859. },
  3860. onClickOutside: function onClickOutside() {
  3861. },
  3862. placement: "top",
  3863. plugins: [],
  3864. popperOptions: {},
  3865. render: null,
  3866. showOnCreate: false,
  3867. touch: true,
  3868. trigger: "mouseenter focus",
  3869. triggerTarget: null
  3870. }, pluginProps, renderProps);
  3871. var defaultKeys = Object.keys(defaultProps);
  3872. var setDefaultProps = function setDefaultProps2(partialProps) {
  3873. var keys = Object.keys(partialProps);
  3874. keys.forEach(function(key) {
  3875. defaultProps[key] = partialProps[key];
  3876. });
  3877. };
  3878. function getExtendedPassedProps(passedProps) {
  3879. var plugins = passedProps.plugins || [];
  3880. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  3881. var name = plugin.name, defaultValue = plugin.defaultValue;
  3882. if (name) {
  3883. var _name;
  3884. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  3885. }
  3886. return acc;
  3887. }, {});
  3888. return Object.assign({}, passedProps, pluginProps2);
  3889. }
  3890. function getDataAttributeProps(reference2, plugins) {
  3891. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  3892. plugins
  3893. }))) : defaultKeys;
  3894. var props = propKeys.reduce(function(acc, key) {
  3895. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  3896. if (!valueAsString) {
  3897. return acc;
  3898. }
  3899. if (key === "content") {
  3900. acc[key] = valueAsString;
  3901. } else {
  3902. try {
  3903. acc[key] = JSON.parse(valueAsString);
  3904. } catch (e) {
  3905. acc[key] = valueAsString;
  3906. }
  3907. }
  3908. return acc;
  3909. }, {});
  3910. return props;
  3911. }
  3912. function evaluateProps(reference2, props) {
  3913. var out = Object.assign({}, props, {
  3914. content: invokeWithArgsOrReturn(props.content, [reference2])
  3915. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  3916. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  3917. out.aria = {
  3918. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  3919. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  3920. };
  3921. return out;
  3922. }
  3923. var innerHTML = function innerHTML2() {
  3924. return "innerHTML";
  3925. };
  3926. function dangerouslySetInnerHTML(element, html) {
  3927. element[innerHTML()] = html;
  3928. }
  3929. function createArrowElement(value) {
  3930. var arrow2 = div();
  3931. if (value === true) {
  3932. arrow2.className = ARROW_CLASS;
  3933. } else {
  3934. arrow2.className = SVG_ARROW_CLASS;
  3935. if (isElement(value)) {
  3936. arrow2.appendChild(value);
  3937. } else {
  3938. dangerouslySetInnerHTML(arrow2, value);
  3939. }
  3940. }
  3941. return arrow2;
  3942. }
  3943. function setContent(content, props) {
  3944. if (isElement(props.content)) {
  3945. dangerouslySetInnerHTML(content, "");
  3946. content.appendChild(props.content);
  3947. } else if (typeof props.content !== "function") {
  3948. if (props.allowHTML) {
  3949. dangerouslySetInnerHTML(content, props.content);
  3950. } else {
  3951. content.textContent = props.content;
  3952. }
  3953. }
  3954. }
  3955. function getChildren(popper2) {
  3956. var box = popper2.firstElementChild;
  3957. var boxChildren = arrayFrom(box.children);
  3958. return {
  3959. box,
  3960. content: boxChildren.find(function(node) {
  3961. return node.classList.contains(CONTENT_CLASS);
  3962. }),
  3963. arrow: boxChildren.find(function(node) {
  3964. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  3965. }),
  3966. backdrop: boxChildren.find(function(node) {
  3967. return node.classList.contains(BACKDROP_CLASS);
  3968. })
  3969. };
  3970. }
  3971. function render(instance) {
  3972. var popper2 = div();
  3973. var box = div();
  3974. box.className = BOX_CLASS;
  3975. box.setAttribute("data-state", "hidden");
  3976. box.setAttribute("tabindex", "-1");
  3977. var content = div();
  3978. content.className = CONTENT_CLASS;
  3979. content.setAttribute("data-state", "hidden");
  3980. setContent(content, instance.props);
  3981. popper2.appendChild(box);
  3982. box.appendChild(content);
  3983. onUpdate(instance.props, instance.props);
  3984. function onUpdate(prevProps, nextProps) {
  3985. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  3986. if (nextProps.theme) {
  3987. box2.setAttribute("data-theme", nextProps.theme);
  3988. } else {
  3989. box2.removeAttribute("data-theme");
  3990. }
  3991. if (typeof nextProps.animation === "string") {
  3992. box2.setAttribute("data-animation", nextProps.animation);
  3993. } else {
  3994. box2.removeAttribute("data-animation");
  3995. }
  3996. if (nextProps.inertia) {
  3997. box2.setAttribute("data-inertia", "");
  3998. } else {
  3999. box2.removeAttribute("data-inertia");
  4000. }
  4001. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  4002. if (nextProps.role) {
  4003. box2.setAttribute("role", nextProps.role);
  4004. } else {
  4005. box2.removeAttribute("role");
  4006. }
  4007. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  4008. setContent(content2, instance.props);
  4009. }
  4010. if (nextProps.arrow) {
  4011. if (!arrow2) {
  4012. box2.appendChild(createArrowElement(nextProps.arrow));
  4013. } else if (prevProps.arrow !== nextProps.arrow) {
  4014. box2.removeChild(arrow2);
  4015. box2.appendChild(createArrowElement(nextProps.arrow));
  4016. }
  4017. } else if (arrow2) {
  4018. box2.removeChild(arrow2);
  4019. }
  4020. }
  4021. return {
  4022. popper: popper2,
  4023. onUpdate
  4024. };
  4025. }
  4026. render.$$tippy = true;
  4027. var idCounter = 1;
  4028. var mouseMoveListeners = [];
  4029. var mountedInstances = [];
  4030. function createTippy(reference2, passedProps) {
  4031. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  4032. var showTimeout;
  4033. var hideTimeout;
  4034. var scheduleHideAnimationFrame;
  4035. var isVisibleFromClick = false;
  4036. var didHideDueToDocumentMouseDown = false;
  4037. var didTouchMove = false;
  4038. var ignoreOnFirstUpdate = false;
  4039. var lastTriggerEvent;
  4040. var currentTransitionEndListener;
  4041. var onFirstUpdate;
  4042. var listeners = [];
  4043. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  4044. var currentTarget;
  4045. var id = idCounter++;
  4046. var popperInstance = null;
  4047. var plugins = unique(props.plugins);
  4048. var state = {
  4049. // Is the instance currently enabled?
  4050. isEnabled: true,
  4051. // Is the tippy currently showing and not transitioning out?
  4052. isVisible: false,
  4053. // Has the instance been destroyed?
  4054. isDestroyed: false,
  4055. // Is the tippy currently mounted to the DOM?
  4056. isMounted: false,
  4057. // Has the tippy finished transitioning in?
  4058. isShown: false
  4059. };
  4060. var instance = {
  4061. // properties
  4062. id,
  4063. reference: reference2,
  4064. popper: div(),
  4065. popperInstance,
  4066. props,
  4067. state,
  4068. plugins,
  4069. // methods
  4070. clearDelayTimeouts,
  4071. setProps,
  4072. setContent: setContent2,
  4073. show,
  4074. hide: hide2,
  4075. hideWithInteractivity,
  4076. enable,
  4077. disable,
  4078. unmount,
  4079. destroy
  4080. };
  4081. if (!props.render) {
  4082. return instance;
  4083. }
  4084. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  4085. popper2.setAttribute("data-tippy-root", "");
  4086. popper2.id = "tippy-" + instance.id;
  4087. instance.popper = popper2;
  4088. reference2._tippy = instance;
  4089. popper2._tippy = instance;
  4090. var pluginsHooks = plugins.map(function(plugin) {
  4091. return plugin.fn(instance);
  4092. });
  4093. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  4094. addListeners();
  4095. handleAriaExpandedAttribute();
  4096. handleStyles();
  4097. invokeHook("onCreate", [instance]);
  4098. if (props.showOnCreate) {
  4099. scheduleShow();
  4100. }
  4101. popper2.addEventListener("mouseenter", function() {
  4102. if (instance.props.interactive && instance.state.isVisible) {
  4103. instance.clearDelayTimeouts();
  4104. }
  4105. });
  4106. popper2.addEventListener("mouseleave", function() {
  4107. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  4108. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4109. }
  4110. });
  4111. return instance;
  4112. function getNormalizedTouchSettings() {
  4113. var touch = instance.props.touch;
  4114. return Array.isArray(touch) ? touch : [touch, 0];
  4115. }
  4116. function getIsCustomTouchBehavior() {
  4117. return getNormalizedTouchSettings()[0] === "hold";
  4118. }
  4119. function getIsDefaultRenderFn() {
  4120. var _instance$props$rende;
  4121. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  4122. }
  4123. function getCurrentTarget() {
  4124. return currentTarget || reference2;
  4125. }
  4126. function getDocument() {
  4127. var parent = getCurrentTarget().parentNode;
  4128. return parent ? getOwnerDocument(parent) : document;
  4129. }
  4130. function getDefaultTemplateChildren() {
  4131. return getChildren(popper2);
  4132. }
  4133. function getDelay(isShow) {
  4134. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  4135. return 0;
  4136. }
  4137. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  4138. }
  4139. function handleStyles(fromHide) {
  4140. if (fromHide === void 0) {
  4141. fromHide = false;
  4142. }
  4143. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  4144. popper2.style.zIndex = "" + instance.props.zIndex;
  4145. }
  4146. function invokeHook(hook, args, shouldInvokePropsHook) {
  4147. if (shouldInvokePropsHook === void 0) {
  4148. shouldInvokePropsHook = true;
  4149. }
  4150. pluginsHooks.forEach(function(pluginHooks) {
  4151. if (pluginHooks[hook]) {
  4152. pluginHooks[hook].apply(pluginHooks, args);
  4153. }
  4154. });
  4155. if (shouldInvokePropsHook) {
  4156. var _instance$props;
  4157. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  4158. }
  4159. }
  4160. function handleAriaContentAttribute() {
  4161. var aria = instance.props.aria;
  4162. if (!aria.content) {
  4163. return;
  4164. }
  4165. var attr = "aria-" + aria.content;
  4166. var id2 = popper2.id;
  4167. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4168. nodes.forEach(function(node) {
  4169. var currentValue = node.getAttribute(attr);
  4170. if (instance.state.isVisible) {
  4171. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  4172. } else {
  4173. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  4174. if (nextValue) {
  4175. node.setAttribute(attr, nextValue);
  4176. } else {
  4177. node.removeAttribute(attr);
  4178. }
  4179. }
  4180. });
  4181. }
  4182. function handleAriaExpandedAttribute() {
  4183. if (hasAriaExpanded || !instance.props.aria.expanded) {
  4184. return;
  4185. }
  4186. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4187. nodes.forEach(function(node) {
  4188. if (instance.props.interactive) {
  4189. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  4190. } else {
  4191. node.removeAttribute("aria-expanded");
  4192. }
  4193. });
  4194. }
  4195. function cleanupInteractiveMouseListeners() {
  4196. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  4197. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  4198. return listener !== debouncedOnMouseMove;
  4199. });
  4200. }
  4201. function onDocumentPress(event) {
  4202. if (currentInput.isTouch) {
  4203. if (didTouchMove || event.type === "mousedown") {
  4204. return;
  4205. }
  4206. }
  4207. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  4208. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  4209. return;
  4210. }
  4211. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  4212. return actualContains(el, actualTarget);
  4213. })) {
  4214. if (currentInput.isTouch) {
  4215. return;
  4216. }
  4217. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  4218. return;
  4219. }
  4220. } else {
  4221. invokeHook("onClickOutside", [instance, event]);
  4222. }
  4223. if (instance.props.hideOnClick === true) {
  4224. instance.clearDelayTimeouts();
  4225. instance.hide();
  4226. didHideDueToDocumentMouseDown = true;
  4227. setTimeout(function() {
  4228. didHideDueToDocumentMouseDown = false;
  4229. });
  4230. if (!instance.state.isMounted) {
  4231. removeDocumentPress();
  4232. }
  4233. }
  4234. }
  4235. function onTouchMove() {
  4236. didTouchMove = true;
  4237. }
  4238. function onTouchStart() {
  4239. didTouchMove = false;
  4240. }
  4241. function addDocumentPress() {
  4242. var doc = getDocument();
  4243. doc.addEventListener("mousedown", onDocumentPress, true);
  4244. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4245. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4246. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4247. }
  4248. function removeDocumentPress() {
  4249. var doc = getDocument();
  4250. doc.removeEventListener("mousedown", onDocumentPress, true);
  4251. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4252. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4253. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4254. }
  4255. function onTransitionedOut(duration, callback) {
  4256. onTransitionEnd(duration, function() {
  4257. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  4258. callback();
  4259. }
  4260. });
  4261. }
  4262. function onTransitionedIn(duration, callback) {
  4263. onTransitionEnd(duration, callback);
  4264. }
  4265. function onTransitionEnd(duration, callback) {
  4266. var box = getDefaultTemplateChildren().box;
  4267. function listener(event) {
  4268. if (event.target === box) {
  4269. updateTransitionEndListener(box, "remove", listener);
  4270. callback();
  4271. }
  4272. }
  4273. if (duration === 0) {
  4274. return callback();
  4275. }
  4276. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  4277. updateTransitionEndListener(box, "add", listener);
  4278. currentTransitionEndListener = listener;
  4279. }
  4280. function on(eventType, handler, options) {
  4281. if (options === void 0) {
  4282. options = false;
  4283. }
  4284. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4285. nodes.forEach(function(node) {
  4286. node.addEventListener(eventType, handler, options);
  4287. listeners.push({
  4288. node,
  4289. eventType,
  4290. handler,
  4291. options
  4292. });
  4293. });
  4294. }
  4295. function addListeners() {
  4296. if (getIsCustomTouchBehavior()) {
  4297. on("touchstart", onTrigger2, {
  4298. passive: true
  4299. });
  4300. on("touchend", onMouseLeave, {
  4301. passive: true
  4302. });
  4303. }
  4304. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  4305. if (eventType === "manual") {
  4306. return;
  4307. }
  4308. on(eventType, onTrigger2);
  4309. switch (eventType) {
  4310. case "mouseenter":
  4311. on("mouseleave", onMouseLeave);
  4312. break;
  4313. case "focus":
  4314. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  4315. break;
  4316. case "focusin":
  4317. on("focusout", onBlurOrFocusOut);
  4318. break;
  4319. }
  4320. });
  4321. }
  4322. function removeListeners() {
  4323. listeners.forEach(function(_ref) {
  4324. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  4325. node.removeEventListener(eventType, handler, options);
  4326. });
  4327. listeners = [];
  4328. }
  4329. function onTrigger2(event) {
  4330. var _lastTriggerEvent;
  4331. var shouldScheduleClickHide = false;
  4332. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  4333. return;
  4334. }
  4335. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  4336. lastTriggerEvent = event;
  4337. currentTarget = event.currentTarget;
  4338. handleAriaExpandedAttribute();
  4339. if (!instance.state.isVisible && isMouseEvent(event)) {
  4340. mouseMoveListeners.forEach(function(listener) {
  4341. return listener(event);
  4342. });
  4343. }
  4344. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  4345. shouldScheduleClickHide = true;
  4346. } else {
  4347. scheduleShow(event);
  4348. }
  4349. if (event.type === "click") {
  4350. isVisibleFromClick = !shouldScheduleClickHide;
  4351. }
  4352. if (shouldScheduleClickHide && !wasFocused) {
  4353. scheduleHide(event);
  4354. }
  4355. }
  4356. function onMouseMove(event) {
  4357. var target = event.target;
  4358. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  4359. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  4360. return;
  4361. }
  4362. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  4363. var _instance$popperInsta;
  4364. var instance2 = popper22._tippy;
  4365. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  4366. if (state2) {
  4367. return {
  4368. popperRect: popper22.getBoundingClientRect(),
  4369. popperState: state2,
  4370. props
  4371. };
  4372. }
  4373. return null;
  4374. }).filter(Boolean);
  4375. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  4376. cleanupInteractiveMouseListeners();
  4377. scheduleHide(event);
  4378. }
  4379. }
  4380. function onMouseLeave(event) {
  4381. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  4382. if (shouldBail) {
  4383. return;
  4384. }
  4385. if (instance.props.interactive) {
  4386. instance.hideWithInteractivity(event);
  4387. return;
  4388. }
  4389. scheduleHide(event);
  4390. }
  4391. function onBlurOrFocusOut(event) {
  4392. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  4393. return;
  4394. }
  4395. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  4396. return;
  4397. }
  4398. scheduleHide(event);
  4399. }
  4400. function isEventListenerStopped(event) {
  4401. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  4402. }
  4403. function createPopperInstance() {
  4404. destroyPopperInstance();
  4405. 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;
  4406. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  4407. var computedReference = getReferenceClientRect ? {
  4408. getBoundingClientRect: getReferenceClientRect,
  4409. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  4410. } : reference2;
  4411. var tippyModifier = {
  4412. name: "$$tippy",
  4413. enabled: true,
  4414. phase: "beforeWrite",
  4415. requires: ["computeStyles"],
  4416. fn: function fn5(_ref2) {
  4417. var state2 = _ref2.state;
  4418. if (getIsDefaultRenderFn()) {
  4419. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  4420. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  4421. if (attr === "placement") {
  4422. box.setAttribute("data-placement", state2.placement);
  4423. } else {
  4424. if (state2.attributes.popper["data-popper-" + attr]) {
  4425. box.setAttribute("data-" + attr, "");
  4426. } else {
  4427. box.removeAttribute("data-" + attr);
  4428. }
  4429. }
  4430. });
  4431. state2.attributes.popper = {};
  4432. }
  4433. }
  4434. };
  4435. var modifiers = [{
  4436. name: "offset",
  4437. options: {
  4438. offset: offset2
  4439. }
  4440. }, {
  4441. name: "preventOverflow",
  4442. options: {
  4443. padding: {
  4444. top: 2,
  4445. bottom: 2,
  4446. left: 5,
  4447. right: 5
  4448. }
  4449. }
  4450. }, {
  4451. name: "flip",
  4452. options: {
  4453. padding: 5
  4454. }
  4455. }, {
  4456. name: "computeStyles",
  4457. options: {
  4458. adaptive: !moveTransition
  4459. }
  4460. }, tippyModifier];
  4461. if (getIsDefaultRenderFn() && arrow2) {
  4462. modifiers.push({
  4463. name: "arrow",
  4464. options: {
  4465. element: arrow2,
  4466. padding: 3
  4467. }
  4468. });
  4469. }
  4470. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  4471. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  4472. placement,
  4473. onFirstUpdate,
  4474. modifiers
  4475. }));
  4476. }
  4477. function destroyPopperInstance() {
  4478. if (instance.popperInstance) {
  4479. instance.popperInstance.destroy();
  4480. instance.popperInstance = null;
  4481. }
  4482. }
  4483. function mount() {
  4484. var appendTo = instance.props.appendTo;
  4485. var parentNode;
  4486. var node = getCurrentTarget();
  4487. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  4488. parentNode = node.parentNode;
  4489. } else {
  4490. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  4491. }
  4492. if (!parentNode.contains(popper2)) {
  4493. parentNode.appendChild(popper2);
  4494. }
  4495. instance.state.isMounted = true;
  4496. createPopperInstance();
  4497. }
  4498. function getNestedPopperTree() {
  4499. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  4500. }
  4501. function scheduleShow(event) {
  4502. instance.clearDelayTimeouts();
  4503. if (event) {
  4504. invokeHook("onTrigger", [instance, event]);
  4505. }
  4506. addDocumentPress();
  4507. var delay = getDelay(true);
  4508. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  4509. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  4510. delay = touchDelay;
  4511. }
  4512. if (delay) {
  4513. showTimeout = setTimeout(function() {
  4514. instance.show();
  4515. }, delay);
  4516. } else {
  4517. instance.show();
  4518. }
  4519. }
  4520. function scheduleHide(event) {
  4521. instance.clearDelayTimeouts();
  4522. invokeHook("onUntrigger", [instance, event]);
  4523. if (!instance.state.isVisible) {
  4524. removeDocumentPress();
  4525. return;
  4526. }
  4527. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  4528. return;
  4529. }
  4530. var delay = getDelay(false);
  4531. if (delay) {
  4532. hideTimeout = setTimeout(function() {
  4533. if (instance.state.isVisible) {
  4534. instance.hide();
  4535. }
  4536. }, delay);
  4537. } else {
  4538. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  4539. instance.hide();
  4540. });
  4541. }
  4542. }
  4543. function enable() {
  4544. instance.state.isEnabled = true;
  4545. }
  4546. function disable() {
  4547. instance.hide();
  4548. instance.state.isEnabled = false;
  4549. }
  4550. function clearDelayTimeouts() {
  4551. clearTimeout(showTimeout);
  4552. clearTimeout(hideTimeout);
  4553. cancelAnimationFrame(scheduleHideAnimationFrame);
  4554. }
  4555. function setProps(partialProps) {
  4556. if (instance.state.isDestroyed) {
  4557. return;
  4558. }
  4559. invokeHook("onBeforeUpdate", [instance, partialProps]);
  4560. removeListeners();
  4561. var prevProps = instance.props;
  4562. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  4563. ignoreAttributes: true
  4564. }));
  4565. instance.props = nextProps;
  4566. addListeners();
  4567. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  4568. cleanupInteractiveMouseListeners();
  4569. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  4570. }
  4571. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  4572. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  4573. node.removeAttribute("aria-expanded");
  4574. });
  4575. } else if (nextProps.triggerTarget) {
  4576. reference2.removeAttribute("aria-expanded");
  4577. }
  4578. handleAriaExpandedAttribute();
  4579. handleStyles();
  4580. if (onUpdate) {
  4581. onUpdate(prevProps, nextProps);
  4582. }
  4583. if (instance.popperInstance) {
  4584. createPopperInstance();
  4585. getNestedPopperTree().forEach(function(nestedPopper) {
  4586. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  4587. });
  4588. }
  4589. invokeHook("onAfterUpdate", [instance, partialProps]);
  4590. }
  4591. function setContent2(content) {
  4592. instance.setProps({
  4593. content
  4594. });
  4595. }
  4596. function show() {
  4597. var isAlreadyVisible = instance.state.isVisible;
  4598. var isDestroyed = instance.state.isDestroyed;
  4599. var isDisabled = !instance.state.isEnabled;
  4600. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  4601. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  4602. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  4603. return;
  4604. }
  4605. if (getCurrentTarget().hasAttribute("disabled")) {
  4606. return;
  4607. }
  4608. invokeHook("onShow", [instance], false);
  4609. if (instance.props.onShow(instance) === false) {
  4610. return;
  4611. }
  4612. instance.state.isVisible = true;
  4613. if (getIsDefaultRenderFn()) {
  4614. popper2.style.visibility = "visible";
  4615. }
  4616. handleStyles();
  4617. addDocumentPress();
  4618. if (!instance.state.isMounted) {
  4619. popper2.style.transition = "none";
  4620. }
  4621. if (getIsDefaultRenderFn()) {
  4622. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  4623. setTransitionDuration([box, content], 0);
  4624. }
  4625. onFirstUpdate = function onFirstUpdate2() {
  4626. var _instance$popperInsta2;
  4627. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  4628. return;
  4629. }
  4630. ignoreOnFirstUpdate = true;
  4631. void popper2.offsetHeight;
  4632. popper2.style.transition = instance.props.moveTransition;
  4633. if (getIsDefaultRenderFn() && instance.props.animation) {
  4634. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  4635. setTransitionDuration([_box, _content], duration);
  4636. setVisibilityState([_box, _content], "visible");
  4637. }
  4638. handleAriaContentAttribute();
  4639. handleAriaExpandedAttribute();
  4640. pushIfUnique(mountedInstances, instance);
  4641. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  4642. invokeHook("onMount", [instance]);
  4643. if (instance.props.animation && getIsDefaultRenderFn()) {
  4644. onTransitionedIn(duration, function() {
  4645. instance.state.isShown = true;
  4646. invokeHook("onShown", [instance]);
  4647. });
  4648. }
  4649. };
  4650. mount();
  4651. }
  4652. function hide2() {
  4653. var isAlreadyHidden = !instance.state.isVisible;
  4654. var isDestroyed = instance.state.isDestroyed;
  4655. var isDisabled = !instance.state.isEnabled;
  4656. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  4657. if (isAlreadyHidden || isDestroyed || isDisabled) {
  4658. return;
  4659. }
  4660. invokeHook("onHide", [instance], false);
  4661. if (instance.props.onHide(instance) === false) {
  4662. return;
  4663. }
  4664. instance.state.isVisible = false;
  4665. instance.state.isShown = false;
  4666. ignoreOnFirstUpdate = false;
  4667. isVisibleFromClick = false;
  4668. if (getIsDefaultRenderFn()) {
  4669. popper2.style.visibility = "hidden";
  4670. }
  4671. cleanupInteractiveMouseListeners();
  4672. removeDocumentPress();
  4673. handleStyles(true);
  4674. if (getIsDefaultRenderFn()) {
  4675. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  4676. if (instance.props.animation) {
  4677. setTransitionDuration([box, content], duration);
  4678. setVisibilityState([box, content], "hidden");
  4679. }
  4680. }
  4681. handleAriaContentAttribute();
  4682. handleAriaExpandedAttribute();
  4683. if (instance.props.animation) {
  4684. if (getIsDefaultRenderFn()) {
  4685. onTransitionedOut(duration, instance.unmount);
  4686. }
  4687. } else {
  4688. instance.unmount();
  4689. }
  4690. }
  4691. function hideWithInteractivity(event) {
  4692. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4693. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  4694. debouncedOnMouseMove(event);
  4695. }
  4696. function unmount() {
  4697. if (instance.state.isVisible) {
  4698. instance.hide();
  4699. }
  4700. if (!instance.state.isMounted) {
  4701. return;
  4702. }
  4703. destroyPopperInstance();
  4704. getNestedPopperTree().forEach(function(nestedPopper) {
  4705. nestedPopper._tippy.unmount();
  4706. });
  4707. if (popper2.parentNode) {
  4708. popper2.parentNode.removeChild(popper2);
  4709. }
  4710. mountedInstances = mountedInstances.filter(function(i) {
  4711. return i !== instance;
  4712. });
  4713. instance.state.isMounted = false;
  4714. invokeHook("onHidden", [instance]);
  4715. }
  4716. function destroy() {
  4717. if (instance.state.isDestroyed) {
  4718. return;
  4719. }
  4720. instance.clearDelayTimeouts();
  4721. instance.unmount();
  4722. removeListeners();
  4723. delete reference2._tippy;
  4724. instance.state.isDestroyed = true;
  4725. invokeHook("onDestroy", [instance]);
  4726. }
  4727. }
  4728. function tippy(targets, optionalProps) {
  4729. if (optionalProps === void 0) {
  4730. optionalProps = {};
  4731. }
  4732. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  4733. bindGlobalEventListeners();
  4734. var passedProps = Object.assign({}, optionalProps, {
  4735. plugins
  4736. });
  4737. var elements = getArrayOfElements(targets);
  4738. var instances = elements.reduce(function(acc, reference2) {
  4739. var instance = reference2 && createTippy(reference2, passedProps);
  4740. if (instance) {
  4741. acc.push(instance);
  4742. }
  4743. return acc;
  4744. }, []);
  4745. return isElement(targets) ? instances[0] : instances;
  4746. }
  4747. tippy.defaultProps = defaultProps;
  4748. tippy.setDefaultProps = setDefaultProps;
  4749. tippy.currentInput = currentInput;
  4750. Object.assign({}, applyStyles$1, {
  4751. effect: function effect2(_ref) {
  4752. var state = _ref.state;
  4753. var initialStyles = {
  4754. popper: {
  4755. position: state.options.strategy,
  4756. left: "0",
  4757. top: "0",
  4758. margin: "0"
  4759. },
  4760. arrow: {
  4761. position: "absolute"
  4762. },
  4763. reference: {}
  4764. };
  4765. Object.assign(state.elements.popper.style, initialStyles.popper);
  4766. state.styles = initialStyles;
  4767. if (state.elements.arrow) {
  4768. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  4769. }
  4770. }
  4771. });
  4772. tippy.setDefaultProps({
  4773. render
  4774. });
  4775. const tippyEvent = {
  4776. instance: null,
  4777. tippy: function() {
  4778. const that2 = this;
  4779. [".style", ".theme", ".tools"].forEach((selector) => {
  4780. tippy(selector, {
  4781. duration: 100,
  4782. allowHTML: true,
  4783. interactive: true,
  4784. trigger: "click",
  4785. onTrigger: function(instance) {
  4786. const ulbox = $(instance.reference).find(".ulbox");
  4787. const type = ulbox.data("type");
  4788. const dataValue = _GM_getValue(type) || "default";
  4789. ulbox.find("li").removeClass();
  4790. ulbox.find(`li[data-value=${dataValue}]`).addClass("active");
  4791. instance.setContent(ulbox.html());
  4792. that2.instance = instance;
  4793. }
  4794. });
  4795. });
  4796. return this;
  4797. },
  4798. checked: function() {
  4799. const that2 = this;
  4800. $(document.body).on("click", ".rightbox li", function() {
  4801. const el = $(this);
  4802. const hasClass = el.hasClass("active");
  4803. if (hasClass) {
  4804. return;
  4805. }
  4806. const type = el.data("type");
  4807. const value = el.data("value");
  4808. if (type !== "tools") {
  4809. el.addClass("active").siblings().removeClass();
  4810. } else {
  4811. that2.instance.hide();
  4812. }
  4813. window.postMessage({ type, value });
  4814. });
  4815. return this;
  4816. },
  4817. init: function() {
  4818. this.tippy().checked();
  4819. }
  4820. };
  4821. theme.init();
  4822. tools.init();
  4823. tabsEvent.init();
  4824. tippyEvent.init();
  4825. jsonFilter.init();
  4826.  
  4827. })
  4828. };
  4829. }));
  4830.  
  4831. System.register("./index-Cgl7hcfy-DaTAQqy4.js", ['jquery'], (function (exports, module) {
  4832. 'use strict';
  4833. var $;
  4834. return {
  4835. setters: [module => {
  4836. $ = module.default;
  4837. }],
  4838. execute: (function () {
  4839.  
  4840. $(document.body).append('<div class="scroll-top"></div>').find(".tabs-container").on("scroll", function(e) {
  4841. const scrollTop = $(this).scrollTop();
  4842. scrollTop > 500 ? $(".scroll-top").fadeIn() : $(".scroll-top").fadeOut();
  4843. }).parents().find(".scroll-top").on("click", function() {
  4844. $(".tabs-container").animate(
  4845. {
  4846. scrollTop: "0"
  4847. },
  4848. 1e3
  4849. );
  4850. });
  4851.  
  4852. })
  4853. };
  4854. }));
  4855.  
  4856. System.import("./__entry.js", "./");