tastycarb / Eh dumper main

// ==UserScript==
// @name         Eh dumper main
// @namespace    http://eh-dumper.org/
// @version      0.18
// @author       ts
// @description  check if comic displayed in main page exist at server
// @license MIT
// @connect *
// @include        https://exhentai.org/*
// @include        https://e-hentai.org/*


// ==/UserScript==
(()=>{"use strict";var t={285:(t,e,n)=>{n.d(e,{Z:()=>r});var o=n(645),i=n.n(o)()((function(t){return t[1]}));i.push([t.id,"#ehd-message-content {\r\n  position: fixed;\r\n  right: 4px;\r\n  top: 4px;\r\n  color: #333;\r\n  z-index: 1000;\r\n}\r\n\r\n.ehd-message-item {\r\n  padding: 10px;\r\n  display: flex;\r\n  flex-flow: row nowrap;\r\n  justify-content: flex-start;\r\n  align-items: center;\r\n  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);\r\n  width: 260px;\r\n  border-radius: 4px;\r\n  background-color: #fafafa;\r\n  margin-bottom: 4px;\r\n}\r\n\r\n.ehd-message-item:last-child {\r\n  margin-bottom: 4px;\r\n}\r\n\r\n.ehd-message-item-icon {\r\n  width: 20px;\r\n  height: 20px;\r\n  background-size: contain;\r\n  background-repeat: no-repeat;\r\n  background-repeat: no-repeat;\r\n  margin-right: 8px;\r\n}\r\n\r\n.ehd-message-item-text {\r\n  overflow: hidden;\r\n  white-space: nowrap;\r\n  text-overflow: ellipsis;\r\n}\r\n",""]);const r=i},104:(t,e,n)=>{n.d(e,{Z:()=>r});var o=n(645),i=n.n(o)()((function(t){return t[1]}));i.push([t.id,"#nb.ehd-nb {\r\n  max-width: initial;\r\n  justify-content: center;\r\n}\r\n.g2 {\r\n  transition: padding-bottom 0.3s linear;\r\n  padding-bottom: 16px;\r\n}\r\n#taglist .state-list {\r\n  padding-top: 4px;\r\n  padding-left: 4px;\r\n}\r\n#taglist .state-list .state-item {\r\n  min-width: 1em;\r\n  height: 1em;\r\n  border: 1px solid #989898;\r\n  border-radius: 2px;\r\n  margin-right: 2px;\r\n  display: inline-block;\r\n}\r\n#taglist .state-list .state-item.full {\r\n  background-color: rgb(69, 170, 205);\r\n}\r\n.eh-dumper-btn {\r\n  text-align: center;\r\n  margin: 0;\r\n  padding: 8px 12px;\r\n  border: none;\r\n  border-radius: 4px;\r\n  background: rgb(241, 241, 241);\r\n  color: rgb(79, 83, 91);\r\n}\r\n",""]);const r=i},628:(t,e,n)=>{n.d(e,{Z:()=>r});var o=n(645),i=n.n(o)()((function(t){return t[1]}));i.push([t.id,"table.ptt td,\r\ntable.ptb td {\r\n  width: 42px;\r\n  height: 48px;\r\n}\r\n\r\n#nb {\r\n  max-width: initial;\r\n  justify-content: center;\r\n}\r\n\r\n.ehd-existed {\r\n  border: 1px solid green;\r\n}\r\n\r\n.ehd-not-existed {\r\n  border: 1px solid red;\r\n}\r\n",""]);const r=i},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=t(e);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,o){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(i[s]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);o&&i[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),e.push(l))}},e}},379:t=>{var e=[];function n(t){for(var n=-1,o=0;o<e.length;o++)if(e[o].identifier===t){n=o;break}return n}function o(t,o){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],h=o.base?l[0]+o.base:l[0],d=r[h]||0,c="".concat(h," ").concat(d);r[h]=d+1;var u=n(c),p={css:l[1],media:l[2],sourceMap:l[3]};-1!==u?(e[u].references++,e[u].updater(p)):e.push({identifier:c,updater:i(p,o),references:1}),s.push(c)}return s}function i(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n.update(t=e)}else n.remove()}}t.exports=function(t,i){var r=o(t=t||[],i=i||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=o(t,i),h=0;h<r.length;h++){var d=n(r[h]);0===e[d].references&&(e[d].updater(),e.splice(d,1))}r=l}}},569:t=>{var e={};t.exports=function(t,n){var o=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var o=n.css,i=n.media,r=n.sourceMap;i?t.setAttribute("media",i):t.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(o,t)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function n(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={id:o,exports:{}};return t[o](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{function t(t){const e=new URL(t).pathname.split("/").filter((t=>""!==t));if(e.length<3)return{pageType:"unknown"};const n=e[0],o=e[1]||"",i=e[2]||"";if("g"===n)return{pageType:"gallery",hash:`${o}_${i}`};if("s"===n){const[t,e]=i.split("-");return{pageType:"page",hash:o+"_"+t+"_"+e,pageNumber:parseInt(e||"",10)}}return{pageType:"unknown"}}var e=n(379),o=n.n(e),i=n(795),r=n.n(i),s=n(569),a=n.n(s),l=n(565),h=n.n(l),d=n(216),c=n.n(d),u=n(589),p=n.n(u),b=n(628),f={};f.styleTagTransform=p(),f.setAttributes=h(),f.insert=a().bind(null,"head"),f.domAPI=r(),f.insertStyleElement=c(),o()(b.Z,f),b.Z&&b.Z.locals&&b.Z.locals;var g=n(285),m={};m.styleTagTransform=p(),m.setAttributes=h(),m.insert=a().bind(null,"head"),m.domAPI=r(),m.insertStyleElement=c(),o()(g.Z,m),g.Z&&g.Z.locals&&g.Z.locals;let y=document.getElementById("ehd-message-content");y||(y=document.createElement("div"),y.id="ehd-message-content",document.body.appendChild(y));const x=t=>{const{type:e,message:n,duration:o=3e3}=t,i=v[e],r=document.createElement("div");r.className="ehd-message-item";const s=document.createElement("div");s.className="ehd-message-item-icon",s.style.backgroundImage=i,r.appendChild(s);const a=document.createElement("div");a.className="ehd-message-item-text",a.innerHTML=n,r.appendChild(a);const l=()=>{r.remove()};setTimeout(l,o),r.addEventListener("click",l),null==y||y.appendChild(r)},v={info:"url(\"data:image/svg+xml,%3Csvg t='1627189661210' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2915' width='20' height='20'%3E%3Cpath d='M512 64C265.6 64 64 265.6 64 512s201.6 448 448 448 448-201.6 448-448S758.4 64 512 64z m32 704h-64v-288h64v288z m-32-400c-25.6 0-48-22.4-48-48s22.4-48 48-48 48 22.4 48 48-22.4 48-48 48z' fill='%231296db' p-id='2916'%3E%3C/path%3E%3C/svg%3E\")",error:"url(\"data:image/svg+xml,%3Csvg t='1627189708309' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='3098' width='20' height='20'%3E%3Cpath d='M710.624 665.376l-45.248 45.248L512 557.248l-153.376 153.376-45.248-45.248L466.752 512l-153.376-153.376 45.248-45.248L512 466.752l153.376-153.376 45.248 45.248L557.248 512l153.376 153.376zM512 64C264.576 64 64 264.576 64 512s200.576 448 448 448 448-200.576 448-448S759.424 64 512 64z' fill='%23f7280d' p-id='3099'%3E%3C/path%3E%3C/svg%3E\")"},w=(...t)=>{console.log("[INFO]",...t),x({type:"info",message:t[0],duration:3e3})},A=(...t)=>{console.error("[ERROR]",...t),x({type:"error",message:t[0],duration:3e3})};async function C(t){try{return 200===(await fetch(t,{method:"HEAD"})).status}catch(t){return w("fetch response error",t.message,t),!1}}class E extends HTMLElement{static get observedAttributes(){return["color","size"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n        <style>\n        :host{\n            font-size:inherit;\n            display:inline-flex;\n            align-items: center;\n            justify-content:center;\n            color:var(--themeColor,#42b983);\n        }\n        .loading{\n            display: block;\n            width: 1em;\n            height: 1em;\n            margin: auto;\n            animation: rotate 1.4s linear infinite;\n        }\n        .circle {\n            stroke: currentColor;\n            animation:  progress 1.4s ease-in-out infinite;\n            stroke-dasharray: 80px, 200px;\n            stroke-dashoffset: 0px;\n            transition:.3s;\n        }\n        :host(:not(:empty)) .loading{\n            margin:.5em;\n        }\n        @keyframes rotate{\n            to{\n                transform: rotate(360deg); \n            }\n        }\n        @keyframes progress {\n            0% {\n              stroke-dasharray: 1px, 200px;\n              stroke-dashoffset: 0px; \n            }\n            50% {\n              stroke-dasharray: 100px, 200px;\n              stroke-dashoffset: -15px; \n            }\n            100% {\n              stroke-dasharray: 100px, 200px;\n              stroke-dashoffset: -125px; \n            } \n        }\n        </style>\n        <svg class="loading" id="loading" viewBox="22 22 44 44"><circle class="circle" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg>\n        <slot></slot>\n        '}get size(){return this.getAttribute("size")||""}get color(){return this.getAttribute("color")||""}set size(t){this.setAttribute("size",t)}set color(t){this.setAttribute("color",t)}connectedCallback(){this.loading=this.shadowRoot.getElementById("loading"),this.size&&(this.size=this.size),this.color&&(this.color=this.color)}attributeChangedCallback(t,e,n){"color"==t&&this.loading&&(this.loading.style.color=n),"size"==t&&this.loading&&(this.loading.style.fontSize=n+"px")}}customElements.get("xy-loading")||customElements.define("xy-loading",E);class k extends HTMLElement{static get observedAttributes(){return["name","size","color","path"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n        <style>\n        :host{\n            font-size:inherit;\n            display:inline-block;\n            transition:.3s;\n        }\n        .icon {\n            display:block;\n            width: 1em;\n            height: 1em;\n            margin: auto;\n            fill: currentColor;\n            overflow: hidden;\n            /*transition:inherit;*/\n        }\n        :host([spin]){\n            animation: rotate 1.4s linear infinite;\n        }\n        @keyframes rotate{\n            to{\n                transform: rotate(360deg); \n            }\n        }\n        </style>\n        <svg class="icon" id="icon" aria-hidden="true" viewBox="0 0 ${this.view} ${this.view}">\n            ${this.path?'<path id="path"></path>':'<use id="use"></use>'}\n        </svg>\n        `}get view(){return this.getAttribute("view")||1024}get name(){return this.getAttribute("name")}get path(){return this.getAttribute("path")||""}set name(t){this.setAttribute("name",t)}set path(t){this.setAttribute("path",t)}get size(){return this.getAttribute("size")||""}get color(){return this.getAttribute("color")||""}set size(t){this.setAttribute("size",t)}set color(t){this.setAttribute("color",t)}connectedCallback(){this.icon=this.shadowRoot.getElementById("icon"),this.use=this.icon.querySelector("use"),this.d=this.icon.querySelector("path"),this.size&&(this.size=this.size),this.color&&(this.color=this.color),this.name&&(this.name=this.name),this.path&&(this.path=this.path)}attributeChangedCallback(t,e,n){"name"==t&&this.use&&this.use.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`../iconfont/icon.svg#icon-${n}`),"path"==t&&this.d&&this.d.setAttribute("d",n),"color"==t&&this.icon&&(this.icon.style.color=n),"size"==t&&this.icon&&(this.icon.style.fontSize=n+"px")}}customElements.get("xy-icon")||customElements.define("xy-icon",k);class L extends HTMLElement{static get observedAttributes(){return["disabled","icon","loading","href","htmltype"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=`\n        <style>\n        :host{ \n            position:relative; \n            display:inline-flex; \n            padding: .25em .625em;\n            box-sizing:border-box; \n            vertical-align: middle;\n            line-height: 1.8;\n            overflow:hidden; \n            align-items:center;\n            justify-content: center;\n            border:1px solid var(--borderColor,rgba(0,0,0,.2)); \n            font-size: 14px; \n            color: var(--fontColor,#333);  \n            border-radius: var(--borderRadius,.25em); \n            transition:background .3s,box-shadow .3s,border-color .3s,color .3s;\n        }\n        :host([shape="circle"]){ \n            border-radius:50%; \n        }\n        /*\n        :host(:not([disabled]):active){\n            z-index:1;\n            transform:translateY(.1em);\n        }\n        */\n        :host([disabled]),:host([loading]){\n            pointer-events: none; \n            opacity:.6; \n        }\n        :host([block]){ \n            display:flex; \n        }\n        :host([disabled]:not([type])){ \n            background:rgba(0,0,0,.1); \n        }\n        :host([disabled]) .btn,:host([loading]) .btn{ \n            cursor: not-allowed; \n            pointer-events: all; \n        }\n        :host(:not([type="primary"]):not([type="danger"]):not([disabled]):hover),\n        :host(:not([type="primary"]):not([type="danger"]):focus-within),\n        :host([type="flat"][focus]){ \n            color:var(--themeColor,#42b983); \n            border-color: var(--themeColor,#42b983); \n        }\n        :host(:not([type="primary"]):not([type="danger"])) .btn::after{ \n            background-image: radial-gradient(circle, var(--themeColor,#42b983) 10%, transparent 10.01%); \n        }\n        :host([type="primary"]){ \n            color: #fff; \n            background:var(--themeBackground,var(--themeColor,#42b983));\n        }\n        :host([type="danger"]){ \n            color: #fff; \n            background:var(--themeBackground,var(--dangerColor,#ff7875));\n        }\n        :host([type="dashed"]){ \n            border-style:dashed \n        }\n        :host([type="flat"]),:host([type="primary"]),:host([type="danger"]){ \n            border:0;\n            padding: calc( .25em + 1px ) calc( .625em + 1px );\n        }\n        :host([type="flat"]) .btn::before{ \n            content:''; \n            position:absolute; \n            background:var(--themeColor,#42b983);\n            pointer-events:none; \n            left:0; \n            right:0; \n            top:0; \n            bottom:0; \n            opacity:0; \n            transition:.3s;\n        }\n        :host([type="flat"]:not([disabled]):hover) .btn::before{ \n            opacity:.1 \n        }\n        :host(:not([disabled]):hover){ \n            z-index:1 \n        }\n        :host([type="flat"]:focus-within) .btn:before,\n        :host([type="flat"][focus]) .btn:before{ \n            opacity:.2; \n        }\n        :host(:focus-within){ \n            /*box-shadow: 0 0 10px rgba(0,0,0,0.1);*/ \n        }\n        .btn{ \n            background:none; \n            outline:0; \n            border:0; \n            position: \n            absolute; \n            left:0; \n            top:0;\n            width:100%;\n            height:100%;\n            padding:0;\n            user-select: none;\n            cursor: unset;\n        }\n        xy-loading{ \n            margin-right: 0.35em;  \n        }\n        ::-moz-focus-inner{\n            border:0;\n        }\n        .btn::before{\n            content: "";\n            display: block;\n            position: absolute;\n            width: 100%;\n            height: 100%;\n            left:0;\n            top:0;\n            transition:.2s;\n            background:#fff;\n            opacity:0;\n        }\n        :host(:not([disabled]):active) .btn::before{ \n            opacity:.2;\n        }\n        .btn::after {\n            content: "";\n            display: block;\n            position: absolute;\n            width: 100%;\n            height: 100%;\n            left: var(--x,0); \n            top: var(--y,0);\n            pointer-events: none;\n            background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);\n            background-repeat: no-repeat;\n            background-position: 50%;\n            transform: translate(-50%,-50%) scale(10);\n            opacity: 0;\n            transition: transform .3s, opacity .8s;\n        }\n        .btn:not([disabled]):active::after {\n            transform: translate(-50%,-50%) scale(0);\n            opacity: .3;\n            transition: 0s;\n        }\n        xy-icon{\n            margin-right: 0.35em;\n            transition: none;\n        }\n        :host(:empty) xy-icon{\n            margin: auto;\n        }\n        :host(:empty){\n            padding: .65em;\n        }\n        :host([type="flat"]:empty),:host([type="primary"]:empty){ \n            padding: calc( .65em + 1px );\n        }\n        ::slotted(xy-icon){\n            transition: none;\n        }\n        :host([href]){\n            cursor:pointer;\n        }\n        </style>\n        <${this.href?"a":"button"} ${this.htmltype?'type="'+this.htmltype+'"':""} ${this.download&&this.href?'download="'+this.download+'"':""} ${this.href?'href="'+this.href+'" target="'+this.target+'" rel="'+this.rel+'"':""} class="btn" id="btn"></${this.href?"a":"button"}>${!this.loading&&this.icon&&"null"!=this.icon?'<xy-icon id="icon" name='+this.icon+"></xy-icon>":""}<slot></slot>\n        `}focus(){this.btn.focus()}get disabled(){return null!==this.getAttribute("disabled")}get toggle(){return null!==this.getAttribute("toggle")}get htmltype(){return this.getAttribute("htmltype")}get name(){return this.getAttribute("name")}get checked(){return null!==this.getAttribute("checked")}get href(){return this.getAttribute("href")}get target(){return this.getAttribute("target")||"_blank"}get rel(){return this.getAttribute("rel")}get download(){return this.getAttribute("download")}get icon(){return this.getAttribute("icon")}get loading(){return null!==this.getAttribute("loading")}set icon(t){this.setAttribute("icon",t)}set htmltype(t){this.setAttribute("htmltype",t)}set href(t){this.setAttribute("href",t)}set disabled(t){null===t||!1===t?this.removeAttribute("disabled"):this.setAttribute("disabled","")}set checked(t){null===t||!1===t?this.removeAttribute("checked"):this.setAttribute("checked","")}set loading(t){null===t||!1===t?this.removeAttribute("loading"):this.setAttribute("loading","")}connectedCallback(){this.btn=this.shadowRoot.getElementById("btn"),this.ico=this.shadowRoot.getElementById("icon"),this.load=document.createElement("xy-loading"),this.load.style.color="inherit",this.btn.addEventListener("mousedown",(function(t){if(!this.disabled){const{left:e,top:n}=this.getBoundingClientRect();this.style.setProperty("--x",t.clientX-e+"px"),this.style.setProperty("--y",t.clientY-n+"px")}})),this.addEventListener("click",(function(t){this.toggle&&(this.checked=!this.checked)})),this.btn.addEventListener("keydown",(t=>{switch(t.keyCode){case 13:t.stopPropagation()}})),this.disabled=this.disabled,this.loading=this.loading}attributeChangedCallback(t,e,n){"disabled"==t&&this.btn&&(null!==n?(this.btn.setAttribute("disabled","disabled"),this.href&&this.btn.removeAttribute("href")):(this.btn.removeAttribute("disabled"),this.href&&(this.btn.href=this.href))),"loading"==t&&this.btn&&(null!==n?(this.shadowRoot.prepend(this.load),this.btn.setAttribute("disabled","disabled")):(this.shadowRoot.removeChild(this.load),this.btn.removeAttribute("disabled"))),"icon"==t&&this.ico&&(this.ico.name=n),"href"==t&&this.btn&&(this.disabled||(this.btn.href=n)),"htmltype"==t&&this.btn&&(this.btn.type=n)}}customElements.get("xy-button")||customElements.define("xy-button",L);class S extends HTMLElement{static get observedAttributes(){return["disabled"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n        <style>\n        :host {\n            display:inline-flex;\n        }\n        ::slotted(xy-button:not(:first-of-type):not(:last-of-type)){\n            border-radius:0;\n        }\n        ::slotted(xy-button){\n            margin:0!important;\n        }\n        ::slotted(xy-button:not(:first-of-type)){\n            margin-left:-1px!important;\n        }\n        ::slotted(xy-button[type]:not([type="dashed"]):not(:first-of-type)){\n            margin-left:1px!important;\n        }\n        ::slotted(xy-button:first-of-type){\n            border-top-right-radius: 0;\n            border-bottom-right-radius: 0px;\n        }\n        ::slotted(xy-button:last-of-type){\n            border-top-left-radius: 0;\n            border-bottom-left-radius: 0;\n        }\n        </style>\n        <slot></slot>\n        '}get disabled(){return null!==this.getAttribute("disabled")}set disabled(t){null===t||!1===t?this.removeAttribute("disabled"):this.setAttribute("disabled","")}connectedCallback(){}attributeChangedCallback(t,e,n){}}customElements.get("xy-button-group")||customElements.define("xy-button-group",S);class T extends HTMLElement{static get observedAttributes(){return["color"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n        <style>\n        :host {\n            display:inline-block;\n            position: relative;\n            overflow: visible;\n        }\n        \n        :host::before,\n        :host::after {\n            content: \'\';\n            display: block;\n            position: absolute;\n            z-index: 1;\n            transform: translate(-50%, -20px);\n            opacity: 0;\n            transition:all .15s .15s,left 0s, top 0s;\n            color: var(--color,rgba(0,0,0,0.75));\n            visibility: hidden;\n            pointer-events: none;\n        }\n        :host::before {\n            content:attr(prefix) attr(tips) attr(suffix);\n            border-radius: 3px;\n            padding: 6px 10px;\n            line-height: 18px;\n            text-align: left;\n            background-color: var(--color,rgba(0,0,0,0.75));\n            color: #fff;\n            font-size: 12px;\n            font-style: normal;\n            width: max-content;\n            max-width: 200px;\n        }\n        :host::after {\n            width: 0;\n            height: 0;\n            overflow: hidden;\n            border: 6px solid transparent;\n        }\n        \n        :host([tips]:not([tips=\'\']):hover:not([show=false]))::before,\n        :host([tips]:not([tips=\'\'])[show=true])::before,\n        :host([tips]:not([tips=\'\']):focus-within:not([show=false]))::before,\n        :host([tips]:not([tips=\'\']):hover:not([show=false]))::after,\n        :host([tips]:not([tips=\'\'])[show=true])::after,\n        :host([tips]:not([tips=\'\']):focus-within:not([show=false]))::after {\n            visibility: visible;\n            opacity: 1;\n        }\n        \n        /* top & \'\' */\n        :host([dir="top"])::before,\n        :host(:not([dir]))::before,\n        :host(:not([dir]))::after,\n        :host([dir="top"])::after {\n            left: calc( var(--percent,.5) * 100% );\n            bottom: 100%;\n            transform: translate(-50%, -20px);\n        }\n        :host([dir="top"]):after,\n        :host(:not([dir])):after {\n            margin-bottom: -12px;\n            border-top-color: currentColor;\n        }\n        :host(:not([dir]):hover:not([show=false]))::before,\n        :host(:not([dir])[show=true])::before,\n        :host(:not([dir]):focus-within:not([show=false]))::before,\n        :host(:not([dir]):hover:not([show=false]))::after,\n        :host(:not([dir])[show=true])::after,\n        :host(:not([dir]):focus-within:not([show=false]))::after,\n        :host([dir="top"]:hover:not([show=false]))::before,\n        :host([dir="top"][show=true])::before,\n        :host([dir="top"]:focus-within:not([show=false]))::before,\n        :host([dir="top"]:hover:not([show=false]))::after,\n        :host([dir="top"][show=true])::after,\n        :host([dir="top"]:focus-within:not([show=false]))::after {\n            transform: translate(-50%, -10px);\n        }\n        /* right */\n        :host([dir="right"])::before,\n        :host([dir="right"])::after{\n            left: 100%;\n            top: 50%;\n            transform: translate(20px, -50%);\n        }\n        :host([dir="right"]):after {\n            margin-left: -12px;\n            border-right-color: currentColor;\n        }\n        :host([dir="right"]:hover:not([show=false]))::before,\n        :host([dir="right"][show=true])::before,\n        :host([dir="right"]:focus-within:not([show=false]))::before,\n        :host([dir="right"]:hover:not([show=false]))::after,\n        :host([dir="right"][show=true])::after,\n        :host([dir="right"]:focus-within:not([show=false]))::after {\n            transform: translate(10px, -50%);\n        }\n        \n        /* bottom */\n        :host([dir="bottom"])::before,\n        :host([dir="bottom"])::after{\n            left: calc( var(--percent,.5) * 100% );\n            top: 100%;\n            transform: translate(-50%, 20px);\n        }\n        :host([dir="bottom"])::after {\n            margin-top: -12px;\n            border-bottom-color: currentColor;\n        }\n        :host([dir="bottom"]:hover:not([show=false]))::before,\n        :host([dir="bottom"][show=true])::before,\n        :host([dir="bottom"]:focus-within:not([show=false]))::before,\n        :host([dir="bottom"]:hover:not([show=false]))::after,\n        :host([dir="bottom"][show=true])::after,\n        :host([dir="bottom"]:focus-within:not([show=false]))::after {\n            transform: translate(-50%, 10px);\n        }\n        \n        /* left */\n        :host([dir="left"])::before,\n        :host([dir="left"])::after{\n            right: 100%;\n            top: 50%;\n            transform: translate(-20px, -50%);\n        }\n        :host([dir="left"])::after{\n            margin-right: -12px;\n            border-left-color: currentColor;\n        }\n        :host([dir="left"]:hover:not([show=false]))::before,\n        :host([dir="left"][show=true])::before,\n        :host([dir="left"]:focus-within:not([show=false]))::before,\n        :host([dir="left"]:hover:not([show=false]))::after,\n        :host([dir="left"][show=true])::after,\n        :host([dir="left"]:focus-within:not([show=false]))::after {\n            transform: translate(-10px, -50%);\n        }\n\n        /* topleft */\n        :host([dir="topleft"])::before,\n        :host([dir="topleft"])::after {\n            left: 0;\n            bottom: 100%;\n            transform: translate(0, -20px);\n        }\n        :host([dir="topleft"]):after{\n            left:10px;\n            margin-bottom: -12px;\n            border-top-color: currentColor;\n        }\n        :host([dir="topleft"]:hover:not([show=false]))::before,\n        :host([dir="topleft"][show=true])::before,\n        :host([dir="topleft"]:focus-within:not([show=false]))::before,\n        :host([dir="topleft"]:hover:not([show=false]))::after,\n        :host([dir="topleft"][show=true])::after,\n        :host([dir="topleft"]:focus-within:not([show=false]))::after {\n            transform: translate(0, -10px);\n        }\n        /* topright */\n        :host([dir="topright"])::before,\n        :host([dir="topright"])::after {\n            right: 0;\n            bottom: 100%;\n            transform: translate(0, -20px);\n        }\n        :host([dir="topright"]):after{\n            right:10px;\n            margin-bottom: -12px;\n            border-top-color: currentColor;\n        }\n        :host([dir="topright"]:hover:not([show=false]))::before,\n        :host([dir="topright"][show=true])::before,\n        :host([dir="topright"]:focus-within:not([show=false]))::before,\n        :host([dir="topright"]:hover:not([show=false]))::after,\n        :host([dir="topright"][show=true])::after,\n        :host([dir="topright"]:focus-within:not([show=false]))::after {\n            transform: translate(0, -10px);\n        }\n        /* righttop */\n        :host([dir="righttop"])::before,\n        :host([dir="righttop"])::after{\n            left: 100%;\n            top: 0;\n            transform: translate(20px, 0);\n        }\n        :host([dir="righttop"]):after {\n            top: 10px;\n            margin-left: -12px;\n            border-right-color: currentColor;\n        }\n        :host([dir="righttop"]:hover:not([show=false]))::before,\n        :host([dir="righttop"][show=true])::before,\n        :host([dir="righttop"]:focus-within:not([show=false]))::before,\n        :host([dir="righttop"]:hover:not([show=false]))::after,\n        :host([dir="righttop"][show=true])::after,\n        :host([dir="righttop"]:focus-within:not([show=false]))::after {\n            transform: translate(10px, 0);\n        }\n        /* rightbottom */\n        :host([dir="rightbottom"])::before,\n        :host([dir="rightbottom"])::after{\n            left: 100%;\n            bottom: 0;\n            transform: translate(20px, 0);\n        }\n        :host([dir="rightbottom"]):after {\n            bottom: 10px;\n            margin-left: -12px;\n            border-right-color: currentColor;\n        }\n        :host([dir="rightbottom"]:hover:not([show=false]))::before,\n        :host([dir="rightbottom"][show=true])::before,\n        :host([dir="rightbottom"]:focus-within:not([show=false]))::before,\n        :host([dir="rightbottom"]:hover:not([show=false]))::after,\n        :host([dir="rightbottom"][show=true])::after,\n        :host([dir="rightbottom"]:focus-within:not([show=false]))::after {\n            transform: translate(10px, 0);\n        }\n        /* bottomleft */\n        :host([dir="bottomleft"])::before,\n        :host([dir="bottomleft"])::after{\n            left: 0;\n            top: 100%;\n            transform: translate(0, 20px);\n        }\n        :host([dir="bottomleft"])::after {\n            left: 10px;\n            margin-top: -12px;\n            border-bottom-color: currentColor;\n        }\n        :host([dir="bottomleft"]:hover:not([show=false]))::before,\n        :host([dir="bottomleft"][show=true])::before,\n        :host([dir="bottomleft"]:focus-within:not([show=false]))::before,\n        :host([dir="bottomleft"]:hover:not([show=false]))::after,\n        :host([dir="bottomleft"][show=true])::after,\n        :host([dir="bottomleft"]:focus-within:not([show=false]))::after {\n            transform: translate(0, 10px);\n        }\n        /* bottomright */\n        :host([dir="bottomright"])::before,\n        :host([dir="bottomright"])::after{\n            right: 0;\n            top: 100%;\n            transform: translate(0, 20px);\n        }\n        :host([dir="bottomright"])::after {\n            right: 10px;\n            margin-top: -12px;\n            border-bottom-color: currentColor;\n        }\n        :host([dir="bottomright"]:hover:not([show=false]))::before,\n        :host([dir="bottomright"][show=true])::before,\n        :host([dir="bottomright"]:focus-within:not([show=false]))::before,\n        :host([dir="bottomright"]:hover:not([show=false]))::after,\n        :host([dir="bottomright"][show=true])::after,\n        :host([dir="bottomright"]:focus-within:not([show=false]))::after {\n            transform: translate(0, 10px);\n        }\n        /* lefttop */\n        :host([dir="lefttop"])::before,\n        :host([dir="lefttop"])::after{\n            right: 100%;\n            top: 0;\n            transform: translate(-20px, 0);\n        }\n        :host([dir="lefttop"]):after {\n            top: 10px;\n            margin-right: -12px;\n            border-left-color: currentColor;\n        }\n        :host([dir="lefttop"]:hover:not([show=false]))::before,\n        :host([dir="lefttop"][show=true])::before,\n        :host([dir="lefttop"]:focus-within:not([show=false]))::before,\n        :host([dir="lefttop"]:hover:not([show=false]))::after,\n        :host([dir="lefttop"][show=true])::after,\n        :host([dir="lefttop"]:focus-within:not([show=false]))::after {\n            transform: translate(-10px, 0);\n        }\n        /* leftbottom */\n        :host([dir="leftbottom"])::before,\n        :host([dir="leftbottom"])::after{\n            right: 100%;\n            bottom: 0;\n            transform: translate(-20px, 0);\n        }\n        :host([dir="leftbottom"]):after {\n            bottom: 10px;\n            margin-right: -12px;\n            border-left-color: currentColor;\n        }\n        :host([dir="leftbottom"]:hover:not([show=false]))::before,\n        :host([dir="leftbottom"][show=true])::before,\n        :host([dir="leftbottom"]:focus-within:not([show=false]))::before,\n        :host([dir="leftbottom"]:hover:not([show=false]))::after,\n        :host([dir="leftbottom"][show=true])::after,\n        :host([dir="leftbottom"]:focus-within:not([show=false]))::after {\n            transform: translate(-10px, 0);\n        }\n        /* success */\n        :host([type="success"]){\n            --color:var(--successColor,#52c41a);\n        }\n        /* error */\n        :host([type="error"]){\n            --color:var(--errorColor,#f4615c);\n        }\n        /* warning */\n        :host([type="warning"]){\n            --color:var(--waringColor,#faad14);\n        }\n        slot{\n            border-radius: inherit;\n        }\n        </style>\n        <slot></slot>\n        '}get color(){return this.getAttribute("color")||""}get dir(){return this.getAttribute("dir")||"top"}get tips(){return this.getAttribute("tips")}get type(){return this.getAttribute("tips")}get suffix(){return this.getAttribute("suffix")||""}get prefix(){return this.getAttribute("prefix")||""}get show(){return null!==this.getAttribute("show")}set color(t){this.setAttribute("color",t)}set dir(t){this.setAttribute("dir",t)}set tips(t){this.setAttribute("tips",t)}set suffix(t){this.setAttribute("suffix",t)}set prefix(t){this.setAttribute("prefix",t)}set show(t){this.setAttribute("show",t)}set type(t){this.setAttribute("type",t)}connectedCallback(){if("auto"===this.dir){const{left:t,top:e,width:n,height:o}=this.getBoundingClientRect(),i=document.body.scrollWidth,r=document.body.scrollHeight,s=50;e<s&&(this.dir="bottom"),r-e-o<s&&(this.dir="top"),t<s&&(this.dir="right"),i-t-n<s&&(this.dir="left")}}attributeChangedCallback(t,e,n){"color"==t&&this.shadowRoot&&this.style.setProperty("--color",n)}}customElements.get("xy-tips")||customElements.define("xy-tips",T);class z extends HTMLElement{static get observedAttributes(){return["label","disabled","pattern","required","readonly","placeholder"]}constructor({multi:t}={}){super(),this.multi=t,this.$customValidity=null,this.attachShadow({mode:"open"}).innerHTML=`\n        <style>\n        :host{\n            box-sizing:border-box;\n            display:inline-block;\n            border:1px solid var(--borderColor,rgba(0,0,0,.2));\n            border-radius:var(--borderRadius,.25em);\n            line-height: 1.8;\n            transition:border-color .3s,box-shadow .3s;\n            padding: .25em .625em;\n            color: var(--fontColor,#333);\n            font-size: 14px;\n        }\n        :host(:focus-within){\n            /*box-shadow: 0 0 10px rgba(0,0,0,0.1);*/\n        }\n        :host([block]){\n            display:block\n        }\n        xy-tips[show=show]{\n            color:var(--errorColor,#f4615c);\n        }\n        :host([invalid]){\n            --themeColor:var(--errorColor,#f4615c);\n            border-color:var(--errorColor,#f4615c);\n        }\n        :host([invalid]) xy-icon{\n            color:var(--errorColor,#f4615c);\n        }\n        :host(:focus-within:not([disabled])),:host(:not([disabled]):hover){\n            border-color:var(--themeColor,#42b983);\n        }\n        :host([disabled]){ \n            opacity:.8;\n            cursor:not-allowed; \n        }\n        :host([disabled]) xy-tips{\n            pointer-events:none;\n            background:rgba(0,0,0,.1);\n        }\n        :host([label]) .input::placeholder{\n            color:transparent;\n        }\n        :host .input::placeholder{\n            color:#999;\n        }\n        :host(xy-textarea){\n            line-height:1.5;\n            padding-right:.25em;\n        }\n        xy-tips{  \n            display:flex;\n            width: 100%;\n            height: 100%;\n            align-items:center;\n            margin:-.25em -.625em;\n            padding:.25em .625em;\n            font-family:inherit;\n            transition:.3s background-color;\n        }\n        :host(xy-textarea) xy-tips{\n            margin-right:-.25em;\n            padding-right:.25em;\n            align-items:flex-start;\n        }\n        .input{\n            padding:0;\n            text-align: inherit;\n            color:currentColor;\n            border:0;\n            outline:0;\n            line-height: inherit;\n            font-size:inherit;\n            font-family:inherit;\n            flex:1;\n            min-width: 0;\n            -webkit-appearance: none;\n            -moz-appearance: textfield;\n            background: none;\n            overflow-x: hidden;\n            transition: color .3s;\n            animation: removeBg 0s forwards;\n        }\n        :host(xy-textarea) .input{\n            margin:0;\n        }\n        input[type="number"]::-webkit-inner-spin-button{\n            display:none;\n        }\n        ::-moz-focus-inner,::-moz-focus-outer{\n            border:0;\n            outline : 0;\n        }\n        :host([showtips]){\n            pointer-events:all;\n        }\n        .input-label{\n            pointer-events:none;\n            margin-left:-0.14em;\n            position:absolute;\n            transition: transform .3s, color .3s, background-color .3s;\n            transform-origin: left;\n            padding:0 0.14em;\n            color:#999;\n        }\n        .input:not(:placeholder-shown) ~ .input-label,\n        .input:focus ~ .input-label{\n            transform: translateY( calc( -50% - 0.43em ) ) scale(0.8);\n            background:#fff;\n        }\n        .input:-moz-ui-invalid{\n            box-shadow:none;\n        }\n        .input::-ms-reveal{\n            display:none;\n        }\n        .icon-pre{\n            display:flex;\n            margin-right:0.25em;\n            color:#999;\n        }\n        :host(xy-textarea) .icon-pre{\n            height:1.5em;\n        }\n        .btn-right{\n            width:2em;\n            height:2em;\n            margin:-.25em -.5em -.25em .25em;\n            padding:0;\n            color:#999;\n            font-size:inherit;\n        }\n        .btn-number{\n            display:flex;\n            flex-direction:column;\n            width:1.5em;\n            visibility:hidden;\n            transition:0s;\n        }\n        .btn-number xy-button{\n            display: flex;\n            color: #999;\n            border-radius:0;\n            width:100%;\n            flex:1;\n            padding:0;\n            font-size:.8em;\n            transition:.2s;\n        }\n\n        .btn-number xy-button:hover{\n            flex:1.5;\n        }\n\n        xy-button:not([disabled]):hover,xy-button:not([disabled]):focus-within{\n            color:var(--themeColor,#42b983);\n        }\n\n        :host(:focus-within:not([disabled])) .icon-pre,:host(:not([disabled]):hover) .icon-pre,:host(:not([disabled]):hover) .input-label,:host(:focus-within:not([disabled])) .input-label{\n            color:var(--themeColor,#42b983);\n        }\n\n        :host(:focus-within:not([disabled])) .btn-number,:host(:not([disabled]):hover) .btn-number{\n            visibility:visible;\n        }\n        @keyframes removeBg{\n            to{\n                background:transparent;\n            }\n        }\n        </style>\n        <xy-tips id="input-con" dir="${this.errordir}" type="error">\n            ${this.icon?'<xy-icon class="icon-pre" name='+this.icon+"></xy-icon>":""}\n            <${t?"textarea":"input"} id="input" name="${this.name}" class="input" ${"number"===this.type?'min="'+this.min+'" max="'+this.max+'" step="'+this.step+'"':""} value="${this.defaultvalue}" type="${this.typeMap(this.type)}" placeholder="${this.placeholder}" minlength="${this.minlength}" rows="${this.rows}" maxlength="${this.maxlength}">${t?"</textarea>":""}\n            <slot></slot>\n            ${this.label&&!this.icon?'<label class="input-label">'+this.label+"</label>":""}\n            ${"password"!==this.type||t?"":'<xy-button id="btn-pass" class="btn-right" icon="eye-close" type="flat" shape="circle"></xy-button>'}\n            ${"search"!==this.type||t?"":'<xy-button id="btn-search" class="btn-right" icon="search" type="flat" shape="circle"></xy-button>'}\n            ${"number"!==this.type||t?"":'<div class="btn-right btn-number"><xy-button id="btn-add" icon="up" type="flat"></xy-button><xy-button id="btn-sub" icon="down" type="flat"></xy-button></div>'}\n        </xy-tips>\n        `}checkValidity(){return!!(this.novalidate||this.disabled||this.form&&this.form.novalidate)||(this.validity?(this.inputCon.show=!1,this.invalid=!1,!0):(this.input.focus(),this.inputCon.show="show",this.invalid=!0,this.input.validity.valueMissing?this.inputCon.tips=this.input.validationMessage:this.customValidity.method(this)?this.inputCon.tips=this.errortips||this.input.validationMessage:this.inputCon.tips=this.customValidity.tips,!1))}connectedCallback(){this.form=this.closest("xy-form"),this.input=this.shadowRoot.getElementById("input"),this.inputCon=this.shadowRoot.getElementById("input-con"),this.input.addEventListener("input",(t=>{t.stopPropagation(),this.checkValidity(),this.debounce?(this.timer&&clearTimeout(this.timer),this.timer=setTimeout((()=>{this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value}})),this.list&&(this.list.filter(this.value),this.list.show=!0)}),this.debounce)):(this.dispatchEvent(new CustomEvent("input",{detail:{value:this.value}})),this.list&&(this.list.filter(this.value),this.list.show=!0))})),this.input.addEventListener("change",(()=>{this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this.input.addEventListener("focus",(t=>{if(this.checkValidity(),this.list){const{left:t,top:e,height:n,width:o}=this.getBoundingClientRect();this.list.style=`left:${t+window.scrollX}px;top:${e+n+window.scrollY}px;min-width:${o}px`,this.list.show=!0}})),this.input.addEventListener("keydown",(t=>{switch(t.key){case"ArrowUp":case"ArrowDown":this.list&&(t.preventDefault(),this.list.show=!0);break;case"Escape":case"Tab":this.list&&(this.list.show=!1);break;case"Enter":this.list?(t.preventDefault(),this.list.show=!0):this.dispatchEvent(new CustomEvent("submit",{detail:{value:this.value}}))}})),this.multi||(this.btnPass=this.shadowRoot.getElementById("btn-pass"),this.btnAdd=this.shadowRoot.getElementById("btn-add"),this.btnSub=this.shadowRoot.getElementById("btn-sub"),this.btnSearch=this.shadowRoot.getElementById("btn-search"),this.btnSearch&&this.btnSearch.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("submit",{detail:{value:this.value}}))})),this.btnPass&&this.btnPass.addEventListener("click",(()=>{this.password=!this.password,this.password?(this.input.setAttribute("type","text"),this.btnPass.icon="eye"):(this.input.setAttribute("type","password"),this.btnPass.icon="eye-close"),this.input.focus()})),this.btnAdd&&this.btnAdd.addEventListener("click",(()=>{this.input.stepUp(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this.btnSub&&this.btnSub.addEventListener("click",(()=>{this.input.stepDown(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})),this.pattern=this.pattern),document.addEventListener("mousedown",this.setlist),this.list&&(document.body.appendChild(this.list),this.list.addEventListener("submit",(t=>{this.focus(),t.target.value&&(this.value=t.target.value,this.list.show=!1)}))),this.disabled=this.disabled,this.required=this.required,this.readonly=this.readonly}setlist=t=>{this.list&&(this.contains(t.target)||this.list.contains(t.target)?this.list.show=!0:this.list.show=!1)};disconnectedCallback(){document.removeEventListener("mousedown",this.setlist)}typeMap(t){switch(t){case"password":case"number":case"email":case"tel":case"url":break;default:t="text"}return t}focus(){this.input.focus()}reset(){this.input.value=this.defaultvalue,this.inputCon.show=!1,this.invalid=!1}get customValidity(){return this.$customValidity||{method:()=>!0}}get value(){return this.input.value}get debounce(){return this.getAttribute("debounce")}get novalidate(){return null!==this.getAttribute("novalidate")}get name(){return this.getAttribute("name")||""}get invalid(){return null!==this.getAttribute("invalid")}get readonly(){return null!==this.getAttribute("readonly")}get validity(){return this.input.checkValidity()&&this.customValidity.method(this)}get errordir(){return this.getAttribute("errordir")||"top"}get defaultvalue(){return this.getAttribute("defaultvalue")||""}get rows(){return this.getAttribute("rows")||3}get icon(){return this.getAttribute("icon")}get type(){return this.getAttribute("type")}get disabled(){return null!==this.getAttribute("disabled")}get label(){return this.getAttribute("label")||""}get placeholder(){return this.getAttribute("placeholder")||this.label}get min(){return this.getAttribute("min")||0}get max(){return this.getAttribute("max")||1/0}get minlength(){return this.getAttribute("minlength")||""}get maxlength(){return this.getAttribute("maxlength")||""}get step(){return this.getAttribute("step")||1}get required(){return null!==this.getAttribute("required")}get pattern(){return this.getAttribute("pattern")}get errortips(){return this.getAttribute("errortips")}get list(){const t=this.getAttribute("list");return t?this.getRootNode().getElementById(t):null}get options(){return this.list?this.list.options:[]}set disabled(t){null===t||!1===t?this.removeAttribute("disabled"):this.setAttribute("disabled","")}set required(t){null===t||!1===t?this.removeAttribute("required"):this.setAttribute("required","")}set readonly(t){null===t||!1===t?this.removeAttribute("readonly"):this.setAttribute("readonly","")}set invalid(t){null===t||!1===t?this.removeAttribute("invalid"):this.setAttribute("invalid","")}set pattern(t){null===t||!1===t?this.removeAttribute("pattern"):this.setAttribute("pattern",t)}set label(t){this.setAttribute("label",t)}set icon(t){this.setAttribute("icon",t)}set placeholder(t){this.setAttribute("placeholder",t)}set customValidity(t){this.$customValidity=t}set novalidate(t){null===t||!1===t?this.removeAttribute("novalidate"):this.setAttribute("novalidate","")}set value(t){this.input.value=t}attributeChangedCallback(t,e,n){"disabled"==t&&this.input&&(null!==n?this.input.parentNode.setAttribute("tabindex","-1"):this.input.parentNode.removeAttribute("tabindex")),"pattern"==t&&this.input&&(null!==n?this.input.setAttribute("pattern",n):this.input.removeAttribute("pattern")),"placeholder"==t&&this.input&&(null!==n?this.input.setAttribute("placeholder",n):this.input.removeAttribute("placeholder")),"required"==t&&this.input&&(null!==n?this.input.setAttribute("required","required"):this.input.removeAttribute("required")),"readonly"==t&&this.input&&(null!==n?this.input.setAttribute("readonly","readonly"):this.input.removeAttribute("readonly"))}}customElements.get("xy-input")||customElements.define("xy-input",z),customElements.get("xy-textarea")||customElements.define("xy-textarea",class extends z{constructor(){super({multi:!0})}});class $ extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).innerHTML="\n        <style>\n        :host {\n            display:flex;\n        }\n        ::slotted(:not(:first-child):not(:last-child)){\n            border-radius:0;\n        }\n        ::slotted(*){\n            margin:0!important;\n        }\n        ::slotted(:not(:first-child)){\n            margin-left:-1px!important;\n        }\n        ::slotted(:first-child){\n            border-top-right-radius: 0;\n            border-bottom-right-radius: 0px;\n        }\n        ::slotted(:last-child){\n            border-top-left-radius: 0;\n            border-bottom-left-radius: 0;\n        }\n        </style>\n        <slot></slot>\n        "}}customElements.get("xy-input-group")||customElements.define("xy-input-group",$);class M extends HTMLElement{static get observedAttributes(){return["open","title","oktext","canceltext","loading","type"]}constructor({type:t}={}){super(),this.attachShadow({mode:"open"}).innerHTML=`\n        <style>\n        :host{\n            position:fixed;\n            display:flex;\n            left:0;\n            top:0;\n            right:0;\n            bottom:0;\n            z-index:-1;\n            background:rgba(0,0,0,.3);\n            visibility:hidden;\n            opacity:0;\n            /*backdrop-filter: blur(3px);*/\n            transition:.3s;\n        }\n        :host([open]){\n            opacity:1;\n            z-index:50;\n            visibility:visible;\n        }\n        .dialog {\n            display:flex;\n            position:relative;\n            min-width: 360px;\n            margin:auto;\n            box-shadow: 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12);\n            box-sizing: border-box;\n            max-width: calc(100vw - 20px);\n            max-height: calc(100vh - 20px);\n            border-radius: 3px;\n            background-color: #fff;\n            opacity:0;\n            transform:scale(0.5);\n            transition:.3s cubic-bezier(.645, .045, .355, 1);\n        }\n        .dialog-content{\n            box-sizing: border-box;\n            display:flex;\n            width: 100%;\n            padding:0 20px;\n            flex:1;\n            flex-direction:column;\n        }\n        :host([open]) .dialog{\n            opacity:1;\n            transform:scale(1);\n        }\n        .dialog-title {\n            line-height: 30px;\n            padding: 15px 30px 0 0;\n            font-weight: 700;\n            font-size: 14px;\n            color: #4c5161;\n            user-select: none;\n            cursor: default;\n        }\n        .dialog-body {\n            flex: 1;\n            overflow: auto;\n            min-height: 50px;\n            padding: 10px 0;\n        }\n        .dialog-footer {\n            padding: 3px 0 20px 0;\n            margin-top: -3px;\n            text-align: right;\n        }\n        .btn-close{\n            position:absolute;\n            right:10px;\n            top:10px;\n            border:0;\n        }\n        .dialog-footer xy-button {\n            margin-left:10px;\n        }\n        .dialog-type{\n            display:none;\n            margin: 15px -10px 0 20px;\n            width:30px;\n            height:30px;\n            font-size:24px;\n        }\n        .dialog-type[name]{\n            display:flex;\n        }\n        #btn-cancel{\n            visibility:hidden;\n        }\n        :host(:not([type])) .dialog-type,\n        :host([type="prompt"]) .dialog-type{\n            display:none;\n        }\n        :host([type="confirm"]) #btn-cancel,\n        :host([type="prompt"]) #btn-cancel{\n            visibility:visible;\n        }\n        xy-input{\n            width:100%;\n        }\n        :host(:not(:empty)) xy-input{\n            margin-top:10px;\n        }\n        :host(:empty) .dialog-body{\n            min-height:0;\n        }\n        </style>\n        <div class="dialog">\n            <xy-icon id="dialog-type" class="dialog-type"></xy-icon>\n            <div class="dialog-content">\n                <div class="dialog-title" id="title">${this.title}</div>\n                <xy-button class="btn-close" id="btn-close" icon="close"></xy-button>\n                <div class="dialog-body">\n                    <slot></slot>\n                    ${"prompt"===(t||this.type)?"<xy-input></xy-input>":""}\n                </div>\n                <div class="dialog-footer">\n                    <xy-button id="btn-cancel">${this.canceltext}</xy-button>\n                    <xy-button id="btn-submit" type="primary">${this.oktext}</xy-button>\n                </div>\n            </div>\n        </div>\n        `}get open(){return null!==this.getAttribute("open")}get title(){return this.getAttribute("title")||"dialog"}get type(){return this.getAttribute("type")}get oktext(){return this.getAttribute("oktext")||"ok"}get canceltext(){return this.getAttribute("canceltext")||"cancel"}get loading(){return null!==this.getAttribute("loading")}set color(t){this.setAttribute("color",t)}set title(t){this.setAttribute("title",t)}set type(t){this.setAttribute("type",t)}set oktext(t){this.setAttribute("oktext",t)}set canceltext(t){this.setAttribute("canceltext",t)}set open(t){null===t||!1===t?this.removeAttribute("open"):(this.setAttribute("open",""),this.loading&&(this.loading=!1))}set loading(t){null===t||!1===t?this.removeAttribute("loading"):this.setAttribute("loading","")}typeMap(t){let e="",n="";switch(t){case"info":e="info-circle",n="var(--infoColor,#1890ff)";break;case"success":e="check-circle",n="var(--successColor,#52c41a)";break;case"error":e="close-circle",n="var(--errorColor,#f4615c)";break;case"warning":e="warning-circle",n="var(--waringColor,#faad14)";break;case"confirm":e="question-circle",n="var(--waringColor,#faad14)"}return{name:e,color:n}}connectedCallback(){this.remove=!1,this.autoclose=!0,this.titles=this.shadowRoot.getElementById("title"),this.btnClose=this.shadowRoot.getElementById("btn-close"),this.btnCancel=this.shadowRoot.getElementById("btn-cancel"),this.btnSubmit=this.shadowRoot.getElementById("btn-submit"),this.dialogType=this.shadowRoot.getElementById("dialog-type"),this.input=this.shadowRoot.querySelector("xy-input"),this.clientWidth,this.shadowRoot.addEventListener("transitionend",(t=>{"transform"===t.propertyName&&this.open&&(this.input?this.input.focus():this.btnSubmit.focus())})),this.shadowRoot.addEventListener("transitionend",(t=>{"transform"!==t.propertyName||this.open||(this.remove&&document.body.removeChild(this),this.dispatchEvent(new CustomEvent("close")),this.btnActive&&this.btnActive.focus())})),this.addEventListener("wheel",(t=>{t.preventDefault()})),this.btnClose.addEventListener("click",(()=>{this.open=!1})),this.btnCancel.addEventListener("click",(async()=>{this.dispatchEvent(new CustomEvent("cancel")),this.open=!1})),this.btnSubmit.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("submit")),!this.loading&&this.autoclose&&(this.open=!1)}))}attributeChangedCallback(t,e,n){"open"==t&&this.shadowRoot&&null!==n&&(this.btnActive=document.activeElement),"loading"==t&&this.shadowRoot&&(this.btnSubmit.loading=null!==n),"title"==t&&this.titles&&null!==n&&(this.titles.textContent=n),"oktext"==t&&this.btnSubmit&&null!==n&&(this.btnSubmit.textContent=n),"canceltext"==t&&this.btnCancel&&null!==n&&(this.btnCancel.textContent=n),"type"==t&&this.dialogType&&null!==n&&(this.dialogType.name=this.typeMap(n).name,this.dialogType.color=this.typeMap(n).color)}}customElements.get("xy-dialog")||customElements.define("xy-dialog",M);const R="EHD_SERVER_ADDR",I=()=>window.localStorage.getItem(R)||"https://omv.local.com",q=()=>{const t=document.createElement("a");t.href="javascript:void(0)",t.className="nbw",t.innerHTML="Set Server Address",t.addEventListener("click",(t=>{t.preventDefault(),(()=>{const t=I(),e=function(){const t=new M({type:"prompt"});if(document.body.appendChild(t),t.type="prompt",t.remove=!0,t.autoclose=!1,"object"==typeof arguments[0]){const{title:e,content:n,oktext:o,canceltext:i,ok:r,cancel:s}=arguments[0];t.title=e||"Prompt",t.oktext=o||"确 定",t.canceltext=i||"取 消",t.innerHTML=n||"",t.input.onsubmit=t.onsubmit=()=>{const e=t.input.value;e?(r&&r(e),t.open=!1):(XyMessage.error("内容不能为空"),t.input.focus())},t.oncancel=s||null}else t.title="Prompt",t.oktext="确 定",t.canceltext="取 消",t.innerHTML=arguments[0]||"",t.input.onsubmit=t.onsubmit=()=>{const e=t.input.value;e?(arguments[1]&&arguments[1](e),t.open=!1):(XyMessage.error("内容不能为空"),t.input.focus())},t.oncancel=arguments[2]||null;return t.open=!0,t}({title:"请输入新的服务器地址",ok:function(t){window.localStorage.setItem(R,t)}});e.input.value=t,e.shadowRoot.querySelector(".dialog").style.textAlign="left"})()}));const e=document.createElement("div");e.appendChild(t);const n=document.querySelector("#nb");null==n||n.classList.add("ehd-nb"),null==n||n.appendChild(e)};var H=n(104),B={};function N(t,e){if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("Expected the input to be `string | string[]`");const n=Object.assign({pascalCase:!1},e);var o;return 0===(t=Array.isArray(t)?t.map((t=>t.trim())).filter((t=>t.length)).join("-"):t.trim()).length?"":1===t.length?n.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=function(t){for(var e=!1,n=!1,o=!1,i=0;i<t.length;i++){var r=t[i];e&&/[a-zA-Z]/.test(r)&&r.toUpperCase()===r?(t=t.slice(0,i)+"-"+t.slice(i),e=!1,o=n,n=!0,i++):n&&o&&/[a-zA-Z]/.test(r)&&r.toLowerCase()===r?(t=t.slice(0,i-1)+"-"+t.slice(i-1),o=n,n=!1,e=!0):(e=r.toLowerCase()===r&&r.toUpperCase()!==r,o=n,n=r.toUpperCase()===r&&r.toLowerCase()!==r)}return t}(t)),o=t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,((t,e)=>e.toUpperCase())).replace(/\d+(\w|$)/g,(t=>t.toUpperCase())),n.pascalCase?o.charAt(0).toUpperCase()+o.slice(1):o)}function P(t,e){const n=e?e.querySelector(t):document.querySelector(t);return n&&j(n)||""}function j(t){let e="";const n=t.nodeType;if(1===n||9===n||11===n){if("string"==typeof t.textContent)return t.textContent;for(let n=t.firstChild;n;n=n.nextSibling)e+=j(t)}else if(3===n||4===n)return t.nodeValue;return e}B.styleTagTransform=p(),B.setAttributes=h(),B.insert=a().bind(null,"head"),B.domAPI=r(),B.insertStyleElement=c(),o()(H.Z,B),H.Z&&H.Z.locals&&H.Z.locals;const U=(t,e)=>{var n=document.querySelector("#gd5");if(!n)return void A("未找到操作区元素");const o=Z(n);o.href=`${t}/comic/${e}`,o.target="_blank",o.innerHTML="TO EHD Viewer";const i=Z(n);i.innerHTML="Delete Gallery",i.addEventListener("click",(()=>{(async function(t){return fetch(t,{method:"DELETE"})})(t+"/api/comic/"+e).then((function(){w("删除成功")}))}))};function Z(t){var e;const n=document.createElement("p"),o=null===(e=document.querySelector("#gd5 .g2 img"))||void 0===e?void 0:e.cloneNode();n.className="g2 ehd-delete-gallery",o&&n.appendChild(o);const i=document.createElement("a");return n.appendChild(i),t.append(n),i}(()=>{if(document.getElementById("ehd-root"))return void w("script has been loaded");const e=document.createElement("div");e.id="ehd-root",document.body.appendChild(e);const n=window.location.href;if(!/^https:\/\/e[x-]hentai\.org.?/.test(n))return;const o=t(n);"gallery"===o.pageType?(w("trigger gallery render"),(async()=>{const e=window.location.href,n=t(e);if("gallery"!==n.pageType)return void A("current URL is not a gallery",e);const{hash:o}=n;q();const i=I();await async function(t,e){w("检查漫画信息...");const n=t+"/api/comic/"+e+"/info";if(await C(n))return w("漫画信息存在,检查封面..."),!0;w("漫画信息不存在,解析之...");const o=function(){const t={url:window.location.href,name:P("#gn"),nameJP:P("#gj"),type:N(P("#gdc")),uploader:P("#gdn"),rating:parseFloat(P("#rating_label").replace(/[^0-9\.]/g,"")),descriptions:[],tags:[]};return""===t.nameJP&&(t.nameJP=t.name),document.querySelectorAll("#gdd tr").forEach((e=>{const n=N(P(".gdt1",e).replace(/:$/,"")),o=P(".gdt2",e);t.descriptions.push({type:n,value:o})})),document.querySelectorAll("#taglist tr").forEach((e=>{const n=N(P(".tc",e).replace(/:$/,""));e.querySelectorAll(".gt,.gtl,.gtw").forEach((o=>{t.tags.push({type:n,lowPower:-1!==e.className.indexOf("gt"),name:j(o)||""})}))})),t}();w("解析出Info",o),w("解析完成,上传之...");try{return await async function(t,e){return fetch(t,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)}).then((t=>t.json()))}(n,o),w("上传成功,检查封面..."),!0}catch(t){return A(t),!1}}(i,o)&&await async function(t,e){const n=t+"/api/comic/"+e+"/thumbnail";if(await C(n))return w("封面已存在,获取上传状态..."),!0;w("封面不存在,上传之...");const o=document.querySelector("#gd1>div");if(!o)return A("封面图元素获取失败"),!1;const i=window.getComputedStyle(o,null),r=/url\(['"]?([^'"]+)['"]\)/.exec(i.backgroundImage);if(null==r||r.length<1||null==r[1])return A("封面 URL 获取失败",i.backgroundImage),!1;var s=r[1];try{return await async function(t,e,n,o){const i=await fetch(t),r=await i.blob(),s=new FormData;var a=/\.[^\.]+$/.exec(new URL(t).pathname);return null==a||null==a[0]||""==a[0]?(A("文件格式获取失败","pathname="+new URL(t).pathname),!1):(s.append("file",r,"thumbnail"+a[0]),fetch(e,{method:"POST",body:s}))}(s,n),w("封面已存在,获取上传状态..."),!0}catch(t){return A(t),!1}}(i,o)&&(U(i,o),async function(t,e){var n;const o=t+"/api/comic/"+e+"/page?mode=brief",i=await async function(t){return fetch(t).then((t=>t.json()))}(o);for(var r=parseInt(i.length),s=[],a=0;a<r;a+=1)s.push(`<div class="state-item">${a+1}</div>`);for(a=0;a<i.pageNumbers.length;a+=1)i.pageNumbers[a]>0&&i.pageNumbers[a]<=r&&(s[i.pageNumbers[a]-1]=`<div class="state-item full">${a+1}</div>`);const l=document.createElement("tr");l.innerHTML=`<td class="tc">pages:</td><td class="state-list">${s.join("")}</td>`,null===(n=document.querySelector("#taglist tbody"))||void 0===n||n.appendChild(l),document.querySelectorAll("#gdt .gdtm img").forEach((function(t){if(!(t instanceof HTMLImageElement))return;const e=parseInt(t.alt,10);-1!==i.pageNumbers.indexOf(e)?t.style.border="rgb(69, 170, 205) 1px solid":t.style.border="red 1px solid"})),w("获取成功")}(i,o))})()):"unknown"===o.pageType&&(w("trigger main render"),async function(){var e=I();w("en-dumper main start..."),w("set btn at nav bar"),q(),w("fetching comic status..."),document.querySelectorAll(".gl3t").forEach((n=>{var o;const i=(null===(o=n.querySelector("a"))||void 0===o?void 0:o.href)||"",r=t(i);r&&"gallery"===r.pageType?C(e+"/api/comic/"+r.hash+"/info").then((t=>{t?n.classList.add("ehd-existed"):n.classList.add("ehd-not-existed")})):A(i,"is not a gallery URL")}))}())})()})()})();