JSON Viewer

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

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

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