/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/@violentmonkey/ui@0.7.9/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/*! @violentmonkey/ui v0.7.9 | ISC License */
!function(e,t){"use strict";var o={dark:"vmui-jkiNs1",light:"vmui-aBcXBX"},n=".vmui-jkiNs1{background:rgba(0,0,0,.8);border:1px solid #333;box-shadow:0 0 8px #333;color:#fff}.vmui-aBcXBX{background:#fff;border:1px solid #ddd;box-shadow:0 0 8px #ddd;color:#333}";function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},i.apply(this,arguments)}class s{constructor(e,t){this.onMouseDown=e=>{e.preventDefault(),e.stopPropagation();const{x:t,y:o}=this.el.getBoundingClientRect(),{clientX:n,clientY:i}=e;this.dragging={x:n-t,y:i-o},document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},this.onMouseMove=e=>{if(!this.dragging)return;const{x:t,y:o}=this.dragging,{clientX:n,clientY:i}=e,s={top:"auto",left:"auto",right:"auto",bottom:"auto"},{clientWidth:a,clientHeight:r}=document.documentElement,d=this.el.offsetWidth,l=this.el.offsetHeight,u=Math.min(a-d,Math.max(0,n-t)),c=Math.min(r-l,Math.max(0,i-o)),{origin:p}=this.options;"start"===p.x||"auto"===p.x&&u+u+d<a?s.left=`${u}px`:s.right=a-u-d+"px","start"===p.y||"auto"===p.y&&c+c+l<r?s.top=`${c}px`:s.bottom=r-c-l+"px",Object.assign(this.el.style,s)},this.onMouseUp=()=>{var e,t;this.dragging=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp),null==(e=(t=this.options).onMoved)||e.call(t)},this.el=e,this.setOptions(t)}setOptions(e){this.options=i({},s.defaultOptions,e)}enable(){this.el.addEventListener("mousedown",this.onMouseDown)}disable(){this.dragging=void 0,this.el.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp)}}function a(e=!0){const o=d("vmui-"),n=t.m(t.h(o,{id:o}));let i;e?i=n.attachShadow({mode:"open"}):(i=t.m(t.h(o,{})),n.append(i));const s=[],a=n=>{e||"function"!=typeof GM_addStyle?i.append(t.m(VM.h("style",null,n))):s.push(GM_addStyle(n.replace(/:host\b/g,`#${o} `)))};a(":host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,sans-serif;font-size:16px;line-height:1.5}");return{id:o,tag:"VM.getHostElement",shadow:e,host:n,root:i,addStyle:a,dispose:()=>{n.remove(),s.forEach((e=>e.remove()))},show(){r(this.tag,this.host)},hide(){this.host.remove()}}}function r(e,...t){document.body?document.body.append(...t):console.warn(`[${e}] document.body is not ready yet, operation skipped.`)}function d(e=""){return e+Math.random().toString(36).slice(2,8)}function l(e){return e.filter(Boolean).join(" ")}s.defaultOptions={origin:{x:"auto",y:"auto"}};var u="vmui-MNVqs0",c=".vmui-MNVqs0{left:50%;padding:8px 16px;position:fixed;top:50%;transform:translate(-50%,-50%);z-index:10000}";async function p(e){const{body:t}=e;t.style.transition="opacity .2s",t.style.opacity="0",await m(0),t.style.opacity="1",await m(200)}async function h(e){const{body:t}=e;t.style.transition="opacity .2s",t.style.opacity="0",await m(200)}async function m(e){return new Promise((t=>setTimeout(t,e)))}var f,v,y="vmui-pliUr-",g="vmui-I3r6A8",M=".vmui-pliUr-{color:#333;position:fixed;z-index:10000}.vmui-I3r6A8{display:block;padding:8px;position:relative;word-break:break-word}";const b=Object.assign("undefined"!=typeof VM&&(null==(f=VM)?void 0:f.versions)||{},{ui:"0.7.9"});if("undefined"==typeof VM||"2"!==(null==(v=VM)||null==(v=v.versions)||null==(v=v.dom)?void 0:v.split(".")[0]))throw new Error("[VM-UI] @violentmonkey/dom@2 is required\nPlease include following code in your metadata:\n\n// @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2\n// @require https://cdn.jsdelivr.net/npm/@violentmonkey/ui@0.7.9\n");e.Movable=s,e.appendToBody=r,e.classNames=l,e.getHostElement=a,e.getPanel=function(e){const r=a((e=i({shadow:!0,theme:"light"},e)).shadow),d=t.m(VM.h(r.id,{className:l([g,o[e.theme]])})),u=t.m(VM.h(r.id,{className:l([y,e.className])},d));let{style:c}=e;"function"==typeof c&&(c=c(r.id)),r.addStyle([M,n,c].filter(Boolean).join("\n")),r.root.append(u);const p=()=>{for(;d.firstChild;)d.firstChild.remove()},h=(...e)=>{d.append(...e.map(t.m).filter(Boolean))},m=(...e)=>{p(),h(...e)};let f;return e.content&&m(e.content),i({},r,{tag:"VM.getPanel",wrapper:u,body:d,clear:p,append:h,setContent:m,setMovable:(e,t)=>{f||(f=new s(u)),t&&f.setOptions(t),e?f.enable():f.disable()}})},e.getUniqueId=d,e.showToast=function(e,s){const r=a((s=i({duration:2e3,shadow:!0,theme:"light",beforeEnter:p,beforeClose:h},s)).shadow),{dispose:d,addStyle:m}=r,f=t.m(VM.h(r.id,{className:l([u,o[s.theme],s.className])},e));r.root.append(f);let{style:v}=s;"function"==typeof v&&(v=v(r.id)),m([c,n,v].filter(Boolean).join("\n"));let y=!1;const g=i({},r,{tag:"VM.showToast",body:f,close:M});return g.show(),(async()=>{await(null==s.beforeEnter?void 0:s.beforeEnter(g)),s.duration&&setTimeout(M,s.duration)})(),g;async function M(){y||(y=!0,await(null==s.beforeClose?void 0:s.beforeClose(g)),d())}},e.themeCss=n,e.themes=o,e.versions=b}(this.VM=this.VM||{},VM);
//# sourceMappingURL=/sm/2ce7673ff247c8b28d513d88be4b2f8f1179373c2eee71e46e2b79b67972233f.map