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