JSON Viewer

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

目前為 2024-10-17 提交的版本,檢視 最新版本

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

QingJ © 2025

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