JSON Viewer

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

目前為 2024-10-20 提交的版本,檢視 最新版本

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