JSON Viewer

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

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

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