JSON Viewer

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

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

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