JSON Viewer

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

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

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

QingJ © 2025

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