defaultkavy
988a9be4c2
add: Timestamp element add: Float property fix: word-wrap: break-word on message and author-name element update: hide paid message on export css
63 lines
98 KiB
JavaScript
63 lines
98 KiB
JavaScript
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function t(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=t(o);fetch(o.href,i)}})();class nt{parent;__hidden=!1;domEvents={};on(t,r,o){this.domEvents[t]||(this.domEvents[t]=new Map);const i=s=>r(s,this);return this.domEvents[t].set(r,i),this.dom.addEventListener(t,i,o),this}off(t,r,o){const i=this.domEvents[t]?.get(r);return i&&this.dom.removeEventListener(t,i,o),this}once(t,r,o){const i=s=>{this.dom.removeEventListener(t,i,o),r(s,this)};return this.dom.addEventListener(t,i,o),this}hide(t){return $.fluent(this,arguments,()=>this.__hidden,()=>{if(t!==void 0)return t instanceof ut?(this.__hidden=t.value,t.use(this,"hide")):this.__hidden=t,this.parent?.children.render(),this})}remove(){return this.parent?.children.remove(this).render(),this}replace(t){return this.parent?.children.replace(this,t).render(),this}contains(t){return t?t instanceof nt?this.dom.contains(t.dom):t instanceof EventTarget?this.dom.contains($(t).dom):this.dom.contains(t):!1}self(t){return t(this),this}inDOM(){return document.contains(this.dom)}isElement(){if(this instanceof ot)return this}static from(t){if(t.$)return t.$;if(t instanceof HTMLElement){const r=$(t.tagName);return r.dom=t,t.parentElement&&(r.parent=$(t.parentElement)),r}else if(t instanceof Text){const r=new vt(t.textContent??"");return r.dom=t,t.parentElement&&(r.parent=$(t.parentElement)),r}throw"$NODE.FROM: NOT SUPPORT TARGET ELEMENT TYPE"}}class ot extends nt{dom;static_classes=new Set;constructor(t,r){super(),this.dom=document.createElement(t),this.dom.$=this,this.setOptions(r)}setOptions(t){return this.id(t?.id),t&&t.class&&this.class(...t.class),this}id(t){return $.fluent(this,arguments,()=>this.dom.id,()=>$.set(this.dom,"id",t))}class(...t){return $.fluent(this,arguments,()=>this.dom.classList,()=>{this.dom.classList.forEach(r=>this.static_classes.has(r)??this.dom.classList.remove(r)),this.dom.classList.add(...t.detype())})}addClass(...t){return $.fluent(this,arguments,()=>this,()=>{this.dom.classList.add(...t.detype())})}removeClass(...t){return $.fluent(this,arguments,()=>this,()=>{this.dom.classList.remove(...t.detype())})}staticClass(...t){return $.fluent(this,arguments,()=>this.static_classes,()=>{this.removeClass(...this.static_classes),this.static_classes.clear(),this.addStaticClass(...t)})}addStaticClass(...t){return $.fluent(this,arguments,()=>this,()=>{t.detype().forEach(r=>this.static_classes.add(r)),this.addClass(...t)})}removeStaticClass(...t){return $.fluent(this,arguments,()=>this,()=>{t.detype().forEach(r=>this.static_classes.delete(r)),this.removeClass(...t)})}css(t){return $.fluent(this,arguments,()=>this.dom.style,()=>{Object.assign(this.dom.style,t)})}attribute(t,r){return arguments.length?arguments.length===1?t===void 0?null:this.dom.getAttribute(t):arguments.length===2?(t&&r&&this.dom.setAttribute(t,`${r}`),this):this:null}autocapitalize(t){return $.fluent(this,arguments,()=>this.dom.autocapitalize,()=>$.set(this.dom,"autocapitalize",t))}dir(t){return $.fluent(this,arguments,()=>this.dom.dir,()=>$.set(this.dom,"dir",t))}innerText(t){return $.fluent(this,arguments,()=>this.dom.innerText,()=>$.set(this.dom,"innerText",t))}title(t){return $.fluent(this,arguments,()=>this.dom.title,()=>$.set(this.dom,"title",t))}translate(t){return $.fluent(this,arguments,()=>this.dom.translate,()=>$.set(this.dom,"translate",t))}popover(t){return $.fluent(this,arguments,()=>this.dom.popover,()=>$.set(this.dom,"popover",t))}spellcheck(t){return $.fluent(this,arguments,()=>this.dom.spellcheck,()=>$.set(this.dom,"spellcheck",t))}inert(t){return $.fluent(this,arguments,()=>this.dom.inert,()=>$.set(this.dom,"inert",t))}lang(t){return $.fluent(this,arguments,()=>this.dom.lang,()=>$.set(this.dom,"lang",t))}draggable(t){return $.fluent(this,arguments,()=>this.dom.draggable,()=>$.set(this.dom,"draggable",t))}hidden(t){return $.fluent(this,arguments,()=>this.dom.hidden,()=>$.set(this.dom,"hidden",t))}tabIndex(t){return $.fluent(this,arguments,()=>this.dom.tabIndex,()=>$.set(this.dom,"tabIndex",t))}click(){return this.dom.click(),this}attachInternals(){return this.dom.attachInternals()}hidePopover(){return this.dom.hidePopover(),this}showPopover(){return this.dom.showPopover(),this}togglePopover(){return this.dom.togglePopover(),this}focus(){return this.dom.focus(),this}blur(){return this.dom.blur(),this}animate(t,r,o){const i=this.dom.animate(t,r);return o&&o(i),this}getAnimations(t){return this.dom.getAnimations(t)}get accessKeyLabel(){return this.dom.accessKeyLabel}get offsetHeight(){return this.dom.offsetHeight}get offsetLeft(){return this.dom.offsetLeft}get offsetParent(){return $(this.dom.offsetParent)}get offsetTop(){return this.dom.offsetTop}get offsetWidth(){return this.dom.offsetWidth}get dataset(){return this.dom.dataset}}class vt extends nt{dom;constructor(t){super(),this.dom=new Text(t),this.dom.$=this}content(t){return $.fluent(this,arguments,()=>this.dom.textContent,()=>$.set(this.dom,"textContent",t))}}class $e{#t;elementList=new Set;constructor(t){this.#t=t}add(t){if(typeof t=="string"){const r=new vt(t);r.parent=this.#t,this.elementList.add(r)}else t.parent=this.#t,this.elementList.add(t)}remove(t){return this.elementList.has(t)?(this.elementList.delete(t),t.parent=void 0,this):this}removeAll(t=!0){this.elementList.forEach(r=>this.remove(r)),t&&this.render()}replace(t,r){const o=this.array.map(i=>i===t?r:i);return this.elementList.clear(),o.forEach(i=>this.elementList.add(i)),t.parent=void 0,r.parent=this.#t,this}render(){const[t,r]=[this.array.map(i=>i.dom),Array.from(this.dom.childNodes)],o=[];for(;r.length||t.length;){const[i,s]=[r.at(0),t.at(0)];s?i?s!==i?(s.$.__hidden||(this.dom.insertBefore(s,i),o.push(s)),t.shift()):(s.$.__hidden&&this.dom.removeChild(s),t.shift(),r.shift()):(s.$.__hidden||this.dom.append(s),t.shift()):(i&&!o.includes(i)&&i.remove(),r.shift())}}get array(){return[...this.elementList.values()]}get dom(){return this.#t.dom}}class ut{value;attributes=new Map;constructor(t){this.value=t}set(t){this.value=t;for(const[r,o]of this.attributes.entries())for(const i of o)r[i]instanceof Function&&r[i](t)}toString(){return`${this.value}`}use(t,r){const o=this.attributes.get(t);o?o.add(r):this.attributes.set(t,new Set().add(r))}}class R extends ot{children=new $e(this);constructor(t,r){super(t,r)}content(t){return $.fluent(this,arguments,()=>this,()=>{this.children.removeAll(!1),this.insert(t)})}insert(t){return $.fluent(this,arguments,()=>this,()=>{t instanceof Function&&(t=t(this)),t=$.multableResolve(t);for(const r of t)if(r!==void 0)if(r instanceof Array)this.insert(r);else if(r instanceof ut){const o=new vt(r.toString());r.use(o,"content"),this.children.add(o)}else this.children.add(r);this.children.render()})}clear(){return this.children.removeAll(),this}$(t){return $(this.dom.querySelector(t))}$all(t){return Array.from(this.dom.querySelectorAll(t)).map(r=>$(r))}}class Ht extends R{constructor(t){super("a",t),this.dom.addEventListener("click",r=>{$.anchorPreventDefault&&r.preventDefault(),$.anchorHandler&&this.href()&&$.anchorHandler(this.href(),r)})}href(t){return $.fluent(this,arguments,()=>this.dom.href,()=>{t&&(this.dom.href=t)})}target(t){return $.fluent(this,arguments,()=>this.dom.target,()=>{t&&(this.dom.target=t)})}}var Dt;(e=>{function t(n,a,l,d){return a.length?(d(),n):l()}e.fluent=t;function r(n){return n instanceof Array?n:[n]}e.multableResolve=r;function o(n,a){return r(a).forEach(l=>{Object.getOwnPropertyNames(l.prototype).forEach(d=>{d!=="constructor"&&Object.defineProperty(n.prototype,d,Object.getOwnPropertyDescriptor(l.prototype,d)||Object.create(null))})}),n}e.mixin=o;function i(n,a,l){l!==void 0&&(n[a]=l)}e.set=i;function s(n){return new ut(n)}e.state=s})(Dt||(Dt={}));class It extends R{constructor(t){super("form",t)}autocomplete(t){return $.fluent(this,arguments,()=>this.dom.autocomplete,()=>$.set(this.dom,"autocomplete",t))}action(t){return $.fluent(this,arguments,()=>this.dom.formAction,()=>$.set(this.dom,"formAction",t))}enctype(t){return $.fluent(this,arguments,()=>this.dom.formEnctype,()=>$.set(this.dom,"formEnctype",t))}method(t){return $.fluent(this,arguments,()=>this.dom.formMethod,()=>$.set(this.dom,"formMethod",t))}noValidate(t){return $.fluent(this,arguments,()=>this.dom.formNoValidate,()=>$.set(this.dom,"formNoValidate",t))}acceptCharset(t){return $.fluent(this,arguments,()=>this.dom.acceptCharset,()=>$.set(this.dom,"acceptCharset",t))}target(t){return $.fluent(this,arguments,()=>this.dom.formTarget,()=>$.set(this.dom,"formTarget",t))}requestSubmit(){return this.dom.requestSubmit(),this}reset(){return this.dom.reset(),this}submit(){return this.dom.submit(),this}checkValidity(){return this.dom.checkValidity()}reportValidity(){return this.dom.reportValidity()}get length(){return this.dom.length}get elements(){return Array.from(this.dom.elements).map(t=>$(t))}}function Jt(e){return Dt.mixin(e,ye)}class ye{formAction(t){return $.fluent(this,arguments,()=>this.dom.formAction,()=>$.set(this.dom,"formAction",t))}formEnctype(t){return $.fluent(this,arguments,()=>this.dom.formEnctype,()=>$.set(this.dom,"formEnctype",t))}formMethod(t){return $.fluent(this,arguments,()=>this.dom.formMethod,()=>$.set(this.dom,"formMethod",t))}formNoValidate(t){return $.fluent(this,arguments,()=>this.dom.formNoValidate,()=>$.set(this.dom,"formNoValidate",t))}formTarget(t){return $.fluent(this,arguments,()=>this.dom.formTarget,()=>$.set(this.dom,"formTarget",t))}name(t){return $.fluent(this,arguments,()=>this.dom.name,()=>$.set(this.dom,"name",t))}value(t){return $.fluent(this,arguments,()=>this.dom.value,()=>$.set(this.dom,"value",t))}get form(){return this.dom.form?$(this.dom.form):null}get labels(){return Array.from(this.dom.labels??[]).map(t=>$(t))}get validationMessage(){return this.dom.validationMessage}get validity(){return this.dom.validity}get willValidate(){return this.dom.willValidate}}var Le=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Ce=(e,t,r,o)=>{for(var i=o>1?void 0:o?Re(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Le(t,r,i),i};let ct=class extends R{constructor(e){super("button",e)}disabled(e){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",e))}type(e){return $.fluent(this,arguments,()=>this.dom.type,()=>$.set(this.dom,"type",e))}checkValidity(){return this.dom.checkValidity()}reportValidity(){return this.dom.reportValidity()}};ct=Ce([Jt],ct);var Ae=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,Ee=(e,t,r,o)=>{for(var i=o>1?void 0:o?Be(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Ae(t,r,i),i};let pt=class extends ot{constructor(e){super("input",e)}accept(...e){return $.fluent(this,arguments,()=>this.dom.accept.split(","),()=>this.dom.accept=e.toString())}capture(e){return $.fluent(this,arguments,()=>this.dom.capture,()=>$.set(this.dom,"capture",e))}alt(e){return $.fluent(this,arguments,()=>this.dom.alt,()=>$.set(this.dom,"alt",e))}height(e){return $.fluent(this,arguments,()=>this.dom.height,()=>$.set(this.dom,"height",e))}width(e){return $.fluent(this,arguments,()=>this.dom.width,()=>$.set(this.dom,"width",e))}checked(e){return $.fluent(this,arguments,()=>this.dom.checked,()=>$.set(this.dom,"checked",e))}max(e){return $.fluent(this,arguments,()=>this.dom.max===""?null:parseInt(this.dom.min),()=>$.set(this.dom,"max",e?.toString()))}min(e){return $.fluent(this,arguments,()=>this.dom.min===""?null:parseInt(this.dom.min),()=>$.set(this.dom,"min",e?.toString()))}maxLength(e){return $.fluent(this,arguments,()=>this.dom.maxLength,()=>$.set(this.dom,"maxLength",e))}minLength(e){return $.fluent(this,arguments,()=>this.dom.minLength,()=>$.set(this.dom,"minLength",e))}autocomplete(e){return $.fluent(this,arguments,()=>this.dom.autocomplete,()=>$.set(this.dom,"autocomplete",e))}defaultValue(e){return $.fluent(this,arguments,()=>this.dom.defaultValue,()=>$.set(this.dom,"defaultValue",e))}defaultChecked(e){return $.fluent(this,arguments,()=>this.dom.defaultChecked,()=>$.set(this.dom,"defaultChecked",e))}dirName(e){return $.fluent(this,arguments,()=>this.dom.dirName,()=>$.set(this.dom,"dirName",e))}disabled(e){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",e))}multiple(e){return $.fluent(this,arguments,()=>this.dom.multiple,()=>$.set(this.dom,"multiple",e))}pattern(e){return $.fluent(this,arguments,()=>this.dom.pattern,()=>$.set(this.dom,"pattern",e))}placeholder(e){return $.fluent(this,arguments,()=>this.dom.placeholder,()=>$.set(this.dom,"placeholder",e))}readOnly(e){return $.fluent(this,arguments,()=>this.dom.readOnly,()=>$.set(this.dom,"readOnly",e))}required(e){return $.fluent(this,arguments,()=>this.dom.required,()=>$.set(this.dom,"required",e))}selectionDirection(e){return $.fluent(this,arguments,()=>this.dom.selectionDirection,()=>$.set(this.dom,"selectionDirection",e))}selectionEnd(e){return $.fluent(this,arguments,()=>this.dom.selectionEnd,()=>$.set(this.dom,"selectionEnd",e))}selectionStart(e){return $.fluent(this,arguments,()=>this.dom.selectionStart,()=>$.set(this.dom,"selectionStart",e))}size(e){return $.fluent(this,arguments,()=>this.dom.size,()=>$.set(this.dom,"size",e))}src(e){return $.fluent(this,arguments,()=>this.dom.src,()=>$.set(this.dom,"src",e))}step(e){return $.fluent(this,arguments,()=>Number(this.dom.step),()=>$.set(this.dom,"step",e?.toString()))}type(e){return $.fluent(this,arguments,()=>this.dom.type,()=>$.set(this.dom,"type",e))}inputMode(e){return $.fluent(this,arguments,()=>this.dom.inputMode,()=>$.set(this.dom,"inputMode",e))}valueAsDate(e){return $.fluent(this,arguments,()=>this.dom.valueAsDate,()=>$.set(this.dom,"valueAsDate",e))}valueAsNumber(e){return $.fluent(this,arguments,()=>this.dom.valueAsNumber,()=>$.set(this.dom,"valueAsNumber",e))}webkitdirectory(e){return $.fluent(this,arguments,()=>this.dom.webkitdirectory,()=>$.set(this.dom,"webkitdirectory",e))}select(){return this.dom.select(),this}setCustomValidity(e){return this.dom.setCustomValidity(e),this}setRangeText(e,t,r,o){return typeof t=="number"&&typeof r=="number"&&this.dom.setRangeText(e,t,r,o),this.dom.setRangeText(e),this}setSelectionRange(e,t,r){return this.dom.setSelectionRange(e,t,r),this}showPicker(){return this.dom.showPicker(),this}stepDown(){return this.dom.stepDown(),this}stepUp(){return this.dom.stepUp(),this}checkValidity(){return this.dom.checkValidity()}reportValidity(){return this.dom.reportValidity()}get files(){return this.dom.files}get webkitEntries(){return this.dom.webkitEntries}};pt=Ee([Jt],pt);class Ot extends R{constructor(t){super("label",t)}for(t){return $.fluent(this,arguments,()=>this.dom.htmlFor,()=>{$.set(this.dom,"htmlFor",t,"for")})}get form(){return this.dom.form}get control(){return this.dom.control}}class Gt extends ot{constructor(t){super("img",t)}alt(t){return $.fluent(this,arguments,()=>this.dom.alt,()=>$.set(this.dom,"alt",t))}crossOrigin(t){return $.fluent(this,arguments,()=>this.dom.crossOrigin,()=>$.set(this.dom,"crossOrigin",t))}decoding(t){return $.fluent(this,arguments,()=>this.dom.decoding,()=>$.set(this.dom,"decoding",t))}height(t){return $.fluent(this,arguments,()=>this.dom.height,()=>$.set(this.dom,"height",t))}isMap(t){return $.fluent(this,arguments,()=>this.dom.isMap,()=>$.set(this.dom,"isMap",t))}loading(t){return $.fluent(this,arguments,()=>this.dom.loading,()=>$.set(this.dom,"loading",t))}referrerPolicy(t){return $.fluent(this,arguments,()=>this.dom.referrerPolicy,()=>$.set(this.dom,"referrerPolicy",t))}sizes(t){return $.fluent(this,arguments,()=>this.dom.sizes,()=>$.set(this.dom,"sizes",t))}src(t){return $.fluent(this,arguments,()=>this.dom.src,()=>$.set(this.dom,"src",t))}srcset(t){return $.fluent(this,arguments,()=>this.dom.srcset,()=>$.set(this.dom,"srcset",t))}useMap(t){return $.fluent(this,arguments,()=>this.dom.useMap,()=>$.set(this.dom,"useMap",t))}width(t){return $.fluent(this,arguments,()=>this.dom.width,()=>$.set(this.dom,"width",t))}decode(){return this.dom.decode()}get complete(){return this.dom.complete}get currentSrc(){return this.dom.currentSrc}get naturalHeight(){return this.dom.naturalHeight}get naturalWidth(){return this.dom.naturalWidth}get x(){return this.dom.x}get y(){return this.dom.y}}class Wt extends R{constructor(t){super("canvas",t)}height(t){return $.fluent(this,arguments,()=>this.dom.height,()=>{$.set(this.dom,"height",t)})}width(t){return $.fluent(this,arguments,()=>this.dom.width,()=>{$.set(this.dom,"width",t)})}captureStream(t){return this.dom.captureStream(t)}getContext(t,r){return this.dom.getContext(t)}toBlob(t,r,o){return this.dom.toBlob(t,r,o),this}toDataURL(t,r){return this.dom.toDataURL(t,r)}transferControlToOffscreen(){return this.dom.transferControlToOffscreen()}}class _t extends R{constructor(t){super("dialog",t)}open(t){return $.fluent(this,arguments,()=>this.dom.open,()=>$.set(this.dom,"open",t))}returnValue(t){return $.fluent(this,arguments,()=>this.dom.returnValue,()=>$.set(this.dom,"returnValue",t))}close(){return this.dom.close(),this}show(){return this.dom.show(),this}showModal(){return this.dom.showModal(),this}}function le(e){return $.mixin(e,ve)}class ve{on(t,r){return this.events.on(t,r),this}off(t,r){return this.events.off(t,r),this}once(t,r){return this.events.once(t,r),this}}class Zt{eventMap=new Map;register(...t){return t.forEach(r=>{const o=new oe(r);this.eventMap.set(o.name,o)}),this}delete(t){return this.eventMap.delete(t),this}fire(t,...r){const o=this.get(t);return o instanceof oe&&o.fire(...r),this}on(t,r){return this.get(t).add(r),this}off(t,r){return this.get(t).delete(r),this}once(t,r){const o=(...i)=>{this.get(t).delete(o),r(...i)};return this.get(t).add(o),this}get(t){const r=this.eventMap.get(t);if(!r)throw new Error("EVENT NOT EXIST");return r}}class oe{name;callbackList=new Set;constructor(t){this.name=t}fire(...t){this.callbackList.forEach(r=>r(...t))}add(t){this.callbackList.add(t)}delete(t){this.callbackList.delete(t)}}class At extends R{view_cache=new Map;event=new Zt().register("switch");content_id=null;constructor(t){super("view",t)}setView(t,r){return this.view_cache.set(t,r),this}deleteView(t){return this.view_cache.delete(t),this}deleteAllView(){return this.view_cache.clear(),this}switchView(t){const r=this.view_cache.get(t);if(r===void 0)throw"$View.switch(): target content is undefined";return this.content(r),this.content_id=t,this.event.fire("switch",t),this}}var Se=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,Fe=(e,t,r,o)=>{for(var i=o>1?void 0:o?Te(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&Se(t,r,i),i};let mt=class extends R{constructor(){super("select")}add(e){return this.insert(e),this}item(e){return $(this.dom.item(e))}namedItem(e){return $(this.dom.namedItem(e))}disabled(e){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",e))}multiple(e){return $.fluent(this,arguments,()=>this.dom.multiple,()=>$.set(this.dom,"multiple",e))}required(e){return $.fluent(this,arguments,()=>this.dom.required,()=>$.set(this.dom,"required",e))}autocomplete(e){return $.fluent(this,arguments,()=>this.dom.autocomplete,()=>$.set(this.dom,"autocomplete",e))}get length(){return this.dom.length}get size(){return this.dom.size}get options(){return Array.from(this.dom.options).map(e=>$(e))}get selectedIndex(){return this.dom.selectedIndex}get selectedOptions(){return Array.from(this.dom.selectedOptions).map(e=>$(e))}};mt=Fe([Jt],mt);class Nt extends R{constructor(t){super("option",t)}defaultSelected(t){return $.fluent(this,arguments,()=>this.dom.defaultSelected,()=>$.set(this.dom,"defaultSelected",t))}disabled(t){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",t))}label(t){return $.fluent(this,arguments,()=>this.dom.label,()=>$.set(this.dom,"label",t))}selected(t){return $.fluent(this,arguments,()=>this.dom.selected,()=>$.set(this.dom,"selected",t))}text(t){return $.fluent(this,arguments,()=>this.dom.text,()=>$.set(this.dom,"text",t))}value(t){return $.fluent(this,arguments,()=>this.dom.value,()=>$.set(this.dom,"value",t))}get form(){return this.dom.form?$(this.dom.form):null}get index(){return this.dom.index}}class Pt extends R{constructor(t){super("optgroup",t)}disabled(t){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",t))}label(t){return $.fluent(this,arguments,()=>this.dom.label,()=>$.set(this.dom,"label",t))}}class jt extends R{constructor(t){super("textarea",t)}cols(t){return $.fluent(this,arguments,()=>this.dom.cols,()=>$.set(this.dom,"cols",t))}name(t){return $.fluent(this,arguments,()=>this.dom.name,()=>$.set(this.dom,"name",t))}wrap(t){return $.fluent(this,arguments,()=>this.dom.wrap,()=>$.set(this.dom,"wrap",t))}value(t){return $.fluent(this,arguments,()=>this.dom.value,()=>$.set(this.dom,"value",t))}maxLength(t){return $.fluent(this,arguments,()=>this.dom.maxLength,()=>$.set(this.dom,"maxLength",t))}minLength(t){return $.fluent(this,arguments,()=>this.dom.minLength,()=>$.set(this.dom,"minLength",t))}autocomplete(t){return $.fluent(this,arguments,()=>this.dom.autocomplete,()=>$.set(this.dom,"autocomplete",t))}defaultValue(t){return $.fluent(this,arguments,()=>this.dom.defaultValue,()=>$.set(this.dom,"defaultValue",t))}dirName(t){return $.fluent(this,arguments,()=>this.dom.dirName,()=>$.set(this.dom,"dirName",t))}disabled(t){return $.fluent(this,arguments,()=>this.dom.disabled,()=>$.set(this.dom,"disabled",t))}placeholder(t){return $.fluent(this,arguments,()=>this.dom.placeholder,()=>$.set(this.dom,"placeholder",t))}readOnly(t){return $.fluent(this,arguments,()=>this.dom.readOnly,()=>$.set(this.dom,"readOnly",t))}required(t){return $.fluent(this,arguments,()=>this.dom.required,()=>$.set(this.dom,"required",t))}selectionDirection(t){return $.fluent(this,arguments,()=>this.dom.selectionDirection,()=>$.set(this.dom,"selectionDirection",t))}selectionEnd(t){return $.fluent(this,arguments,()=>this.dom.selectionEnd,()=>$.set(this.dom,"selectionEnd",t))}selectionStart(t){return $.fluent(this,arguments,()=>this.dom.selectionStart,()=>$.set(this.dom,"selectionStart",t))}type(t){return $.fluent(this,arguments,()=>this.dom.type,()=>$.set(this.dom,"type",t))}inputMode(t){return $.fluent(this,arguments,()=>this.dom.inputMode,()=>$.set(this.dom,"inputMode",t))}select(){return this.dom.select(),this}setCustomValidity(t){return this.dom.setCustomValidity(t),this}setRangeText(t,r,o,i){return typeof r=="number"&&typeof o=="number"&&this.dom.setRangeText(t,r,o,i),this.dom.setRangeText(t),this}setSelectionRange(t,r,o){return this.dom.setSelectionRange(t,r,o),this}checkValidity(){return this.dom.checkValidity()}reportValidity(){return this.dom.reportValidity()}get validationMessage(){return this.dom.validationMessage}get validity(){return this.dom.validity}get form(){return this.dom.form?$(this.dom.form):null}get labels(){return Array.from(this.dom.labels??[]).map(t=>$(t))}}function f(e){if(typeof e>"u"||e===null)return e;if(typeof e=="string"){if(e.startsWith("::"))return Array.from(document.querySelectorAll(e.replace(/^::/,""))).map(t=>f(t));if(e.startsWith(":"))return f(document.querySelector(e.replace(/^:/,"")));if(e in f.TagNameElementMap)switch(f.TagNameElementMap[e]){case ot:return new ot(e);case Ht:return new Ht;case R:return new R(e);case pt:return new pt;case Ot:return new Ot;case It:return new It;case ct:return new ct;case Gt:return new Gt;case Wt:return new Wt;case _t:return new _t;case At:return new At;case mt:return new mt;case Nt:return new Nt;case Pt:return new Pt;case jt:return new jt}else return new R(e)}if(e instanceof HTMLElement||e instanceof Text)return e.$?e.$:nt.from(e);throw"$: NOT SUPPORT TARGET ELEMENT TYPE"}(e=>{e.anchorHandler=null,e.anchorPreventDefault=!1,e.body=document.body,e.routers=new Set,e.TagNameElementMap={a:Ht,p:R,pre:R,code:R,blockquote:R,strong:R,h1:R,h2:R,h3:R,h4:R,h5:R,h6:R,div:R,ol:R,ul:R,dl:R,li:R,input:pt,label:Ot,button:ct,form:It,img:Gt,dialog:_t,canvas:Wt,view:At,select:mt,option:Nt,optgroup:Pt,textarea:jt};function t(d,m,h,c){return m.length?(c(),d):h()}e.fluent=t;function r(d){return d instanceof Array?d:[d]}e.multableResolve=r;function o(d,m){return r(m).forEach(h=>{Object.getOwnPropertyNames(h.prototype).forEach(c=>{c!=="constructor"&&Object.defineProperty(d.prototype,c,Object.getOwnPropertyDescriptor(h.prototype,c)||Object.create(null))})}),d}e.mixin=o;function i(d,m,h,c){if(h!==void 0){if(h instanceof ut&&d instanceof Node){h.use(d.$,c??m),d[m]=h.value;return}d[m]=h}}e.set=i;function s(d){return new ut(d)}e.state=s;async function n(d,m){return new Promise(h=>{const c=new FileReader;c.onload=g=>{const L=e("img");if(L.once("load",T=>{const A=e("canvas"),W=A.getContext("2d"),N=L.height()/L.width(),[V,j]=[N>1?m/N:m,N>1?m:m*N];A.height(j).width(V),W?.drawImage(L.dom,0,0,V,j),h(A.toDataURL(d.type))}),!g.target)throw"$.resize(): e.target is null";L.src(g.target.result)},c.readAsDataURL(d)})}e.resize=n;function a(d=1){return parseInt(getComputedStyle(document.documentElement).fontSize)*d}e.rem=a;function l(d,m,h){if(typeof m=="number")return Array(m).fill("").map(g=>{const L=c(d)?d[0](...d.slice(1)):e(d);return h&&h(L),L});{const g=[];for(const L of m){const T=d instanceof Function?d(...L):c(d)?d[0](...d.slice(1)):e(d);L instanceof Function?L(T):(L instanceof nt||typeof L=="string")&&T.content(L),g.push(T)}return g}function c(g){return g instanceof Array&&g[0]instanceof Function}}e.builder=l})(f||(f={}));globalThis.$=f;var we=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,Me=(e,t,r,o)=>{for(var i=o>1?void 0:o?ke(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&we(t,r,i),i};let Yt=class{id;content;events=new Zt().register("open","load");constructor(e){this.id=e}};Yt=Me([le],Yt);var He=Object.defineProperty,De=Object.getOwnPropertyDescriptor,Ie=(e,t,r,o)=>{for(var i=o>1?void 0:o?De(t,r):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(i=(o?n(t,r,i):n(i))||i);return o&&i&&He(t,r,i),i};let ie=class{routeMap=new Map;recordMap=new Map;$view;index=0;events=new Zt().register("pathchange","notfound","load");basePath;constructor(e,t){this.basePath=e,this.$view=t??new At}addRoute(e){e=$.multableResolve(e);for(const t of e)this.routeMap.set(t.path,t);return this}listen(){if(!history.state||!("index"in history.state)){const e={index:this.index,data:{}};history.replaceState(e,"")}else this.index=history.state.index;return addEventListener("popstate",this.popstate),$.routers.add(this),this.resolvePath(),this.events.fire("pathchange",{path:location.href,navigation:"Forward"}),this}open(e){if(e===void 0)return;if(e===location.href)return this;this.index+=1;const t={index:this.index,data:{}};return history.pushState(t,"",e),$.routers.forEach(r=>r.resolvePath()),this.events.fire("pathchange",{path:e,navigation:"Forward"}),this}back(){return history.back(),this}replace(e){return history.replaceState({index:this.index},"",e),$.routers.forEach(t=>t.resolvePath(e)),this.events.fire("pathchange",{path:e,navigation:"Forward"}),this}setStateData(e,t){return history.state.data===void 0&&(history.state.data={}),history.state.data[e]=t,this}popstate=(()=>{history.state.index>this.index||history.state.index<this.index,this.index=history.state.index,this.resolvePath(),this.events.fire("pathchange",{path:location.pathname,navigation:"Forward"})}).bind(this);resolvePath(e=location.pathname){if(!e.startsWith(this.basePath))return;e=e.replace(this.basePath,"/").replace("//","/");let t=!1;const r=i=>{const s=this.recordMap.get(i);return s?(t=!0,s.content&&!this.$view.contains(s.content)&&this.$view.switchView(i),s.events.fire("open",{path:e,record:s}),!0):!1},o=(i,s,n)=>{const a=new Yt(i);let l=s.builder({params:n,record:a,loaded:()=>{a.events.fire("load",{path:i,record:a}),this.events.fire("load",{path:i})}});typeof l=="string"&&(l=new vt(l)),a.content=l,this.recordMap.set(i,a),this.$view.setView(i,l).switchView(i),a.events.fire("open",{path:e,record:a}),t=!0};for(const[i,s]of this.routeMap.entries()){if(i instanceof Function){const m=i(e);m&&(r(m)||o(m,s,void 0));continue}const[n,a]=[i.split("/").map(m=>`/${m}`),e.split("/").map(m=>`/${m}`)];n.shift(),a.shift();const l={};let d="";for(let m=0;m<a.length;m++){const[h,c]=[n.at(m),a.at(m)];if(!(!h||!c)){if(h===c){if(d+=c,h===n.at(-1)){r(d)||o(d,s,l);return}}else if(h.includes(":")){const[g,L]=h.split(":");if(!c.startsWith(g))continue;if(Object.assign(l,{[L]:c.replace(g,"")}),d+=c,h===n.at(-1)){r(d)||o(d,s,l);return}}}}}if(!t){let i=!1;const s=()=>i=!0;this.events.fire("notfound",{path:e,preventDefault:s}),i||this.$view.clear()}}};ie=Ie([le],ie);Array.prototype.detype=function(...e){return this.filter(t=>{if(e.length)for(const r of e)return typeof t==typeof r;else return t!==void 0})};class Qt extends R{$value=$("input").class("value");$unit=$("span").staticClass("unit");$label=$("label").hide(!0);constructor(t){super("div"),this.staticClass("input-component",t),this.$value.id(t),this.$label.for(t)}unit(t){return this.$unit.content(t),this}value(t){return t===void 0?this:(this.$value.value(t.toString()),this)}label(t){return t&&this.$label.hide(!1),this.$label.content(t),this}min(t){return this.$value.min(t),this}max(t){return this.$value.max(t),this}}class Ct extends Qt{$color=$("input").type("color").class("color");constructor(t){super(t),this.addStaticClass("color"),this.$color.id(t),this.layout()}layout(){this.content([this.$label,$("div").content([this.$value,this.$color])]),this.$value.on("input",t=>this.$color.value(this.$value.value())),this.$color.on("input",t=>this.$value.value(this.$color.value()))}value(t){return super.value(t),this.$color.value(t),this}}class P extends Qt{$range=$("input").type("range").class("range");constructor(t){super(t),this.addStaticClass("range"),this.$range.id(t),this.$value,this.layout()}layout(){this.content([this.$label,$("div").content([this.$value,this.$range,this.$unit])]),this.$range.on("input",t=>{this.$value.value(`${this.$range.value()}`)}),this.$value.on("input",t=>{this.$range.value(this.$value.value())})}value(t){return arguments.length?t===void 0?this:(t.match(/[a-zA-Z]/)&&(t=t.replaceAll(/[a-zA-Z]/g,"")),super.value(t),this.$range.value(t),this):this.$value.value()}min(t){return super.min(t),this.$range.min(t),this}max(t){return super.max(t),this.$range.max(t),this}}class Q extends Qt{$select=$("select");constructor(t){super(t),this.addStaticClass("select"),this.$select.id(t),this.layout()}layout(){this.content([this.$label,this.$select])}add(t){return this.$select.add(t),this}value(t){return super.value(t),this.$select.value(t),this}}var x,Y,B,Bt;(function(e){e.HEX="HEX",e.RGB="RGB",e.HSL="HSL",e.CIELab="CIELab",e.CMYK="CMYK"})(x||(x={})),function(e){e.ANALOGOUS="ANALOGOUS",e.COMPLEMENTARY="COMPLEMENTARY",e.SPLIT_COMPLEMENTARY="SPLIT_COMPLEMENTARY",e.TRIADIC="TRIADIC",e.TETRADIC="TETRADIC",e.SQUARE="SQUARE"}(Y||(Y={})),function(e){e.ADDITIVE="ADDITIVE",e.SUBTRACTIVE="SUBTRACTIVE"}(B||(B={})),function(e){e.black="#000000",e.silver="#C0C0C0",e.gray="#808080",e.white="#FFFFFF",e.maroon="#800000",e.red="#FF0000",e.purple="#800080",e.fuchsia="#FF00FF",e.green="#008000",e.lime="#00FF00",e.olive="#808000",e.yellow="#FFFF00",e.navy="#000080",e.blue="#0000FF",e.teal="#008080",e.aqua="#00FFFF",e.orange="#FFA500",e.aliceblue="#F0F8FF",e.antiquewhite="#FAEBD7",e.aquamarine="#7FFFD4",e.azure="#F0FFFF",e.beige="#F5F5DC",e.bisque="#FFE4C4",e.blanchedalmond="#FFEBCD",e.blueviolet="#8A2BE2",e.brown="#A52A2A",e.burlywood="#DEB887",e.cadetblue="#5F9EA0",e.chartreuse="#7FFF00",e.chocolate="#D2691E",e.coral="#FF7F50",e.cornflowerblue="#6495ED",e.cornsilk="#FFF8DC",e.crimson="#DC143C",e.cyan="#00FFFF",e.darkblue="#00008B",e.darkcyan="#008B8B",e.darkgoldenrod="#B8860B",e.darkgray="#A9A9A9",e.darkgreen="#006400",e.darkgrey="#A9A9A9",e.darkkhaki="#BDB76B",e.darkmagenta="#8B008B",e.darkolivegreen="#556B2F",e.darkorange="#FF8C00",e.darkorchid="#9932CC",e.darkred="#8B0000",e.darksalmon="#E9967A",e.darkseagreen="#8FBC8F",e.darkslateblue="#483D8B",e.darkslategray="#2F4F4F",e.darkslategrey="#2F4F4F",e.darkturquoise="#00CED1",e.darkviolet="#9400D3",e.deeppink="#FF1493",e.deepskyblue="#00BFFF",e.dimgray="#696969",e.dimgrey="#696969",e.dodgerblue="#1E90FF",e.firebrick="#B22222",e.floralwhite="#FFFAF0",e.forestgreen="#228B22",e.gainsboro="#DCDCDC",e.ghostwhite="#F8F8FF",e.gold="#FFD700",e.goldenrod="#DAA520",e.greenyellow="#ADFF2F",e.grey="#808080",e.honeydew="#F0FFF0",e.hotpink="#FF69B4",e.indianred="#CD5C5C",e.indigo="#4B0082",e.ivory="#FFFFF0",e.khaki="#F0E68C",e.lavender="#E6E6FA",e.lavenderblush="#FFF0F5",e.lawngreen="#7CFC00",e.lemonchiffon="#FFFACD",e.lightblue="#ADD8E6",e.lightcoral="#F08080",e.lightcyan="#E0FFFF",e.lightgoldenrodyellow="#FAFAD2",e.lightgray="#D3D3D3",e.lightgreen="#90EE90",e.lightgrey="#D3D3D3",e.lightpink="#FFB6C1",e.lightsalmon="#FFA07A",e.lightseagreen="#20B2AA",e.lightskyblue="#87CEFA",e.lightslategray="#778899",e.lightslategrey="#778899",e.lightsteelblue="#B0C4DE",e.lightyellow="#FFFFE0",e.limegreen="#32CD32",e.linen="#FAF0E6",e.magenta="#FF00FF",e.mediumaquamarine="#66CDAA",e.mediumblue="#0000CD",e.mediumorchid="#BA55D3",e.mediumpurple="#9370DB",e.mediumseagreen="#3CB371",e.mediumslateblue="#7B68EE",e.mediumspringgreen="#00FA9A",e.mediumturquoise="#48D1CC",e.mediumvioletred="#C71585",e.midnightblue="#191970",e.mintcream="#F5FFFA",e.mistyrose="#FFE4E1",e.moccasin="#FFE4B5",e.navajowhite="#FFDEAD",e.oldlace="#FDF5E6",e.olivedrab="#6B8E23",e.orangered="#FF4500",e.orchid="#DA70D6",e.palegoldenrod="#EEE8AA",e.palegreen="#98FB98",e.paleturquoise="#AFEEEE",e.palevioletred="#DB7093",e.papayawhip="#FFEFD5",e.peachpuff="#FFDAB9",e.peru="#CD853F",e.pink="#FFC0CB",e.plum="#DDA0DD",e.powderblue="#B0E0E6",e.rosybrown="#BC8F8F",e.royalblue="#4169E1",e.saddlebrown="#8B4513",e.salmon="#FA8072",e.sandybrown="#F4A460",e.seagreen="#2E8B57",e.seashell="#FFF5EE",e.sienna="#A0522D",e.skyblue="#87CEEB",e.slateblue="#6A5ACD",e.slategray="#708090",e.slategrey="#708090",e.snow="#FFFAFA",e.springgreen="#00FF7F",e.steelblue="#4682B4",e.tan="#D2B48C",e.thistle="#D8BFD8",e.tomato="#FF6347",e.turquoise="#40E0D0",e.violet="#EE82EE",e.wheat="#F5DEB3",e.whitesmoke="#F5F5F5",e.yellowgreen="#9ACD32",e.rebeccapurple="#663399"}(Bt||(Bt={}));const he=Object.keys(Bt),Oe={HEX:["R","G","B","A"],RGB:["R","G","B","A"],HSL:["H","S","L","A"],CIELab:["L","a","b","A"],CMYK:["C","M","Y","K","A"]},Vt={BGR:x.RGB,ABGR:x.RGB,HLS:x.HSL,AHLS:x.HSL,LAB:x.CIELab,ALAB:x.CIELab,CKMY:x.CMYK,ACKMY:x.CMYK};var ht;(function(e){e.NUMBER="number",e.BOOLEAN="boolean"})(ht||(ht={}));const O={[x.HEX]:/^#(?:([a-f\d])([a-f\d])([a-f\d])([a-f\d])?|([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?)$/i,[x.RGB]:/^rgba?\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[x.HSL]:/^hsla?\s*\(\s*(?:(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*,\s*((?:\d*\.)?\d+)%\s*,\s*((?:\d*\.)?\d+)%(?:\s*,\s*((?:\d*\.)?\d+))?|(-?(?:\d*\.)?\d+(?:deg|grad|rad|turn)?)\s*((?:\d*\.)?\d+)%\s*((?:\d*\.)?\d+)%(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[x.CIELab]:/^lab\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)\s*(-?(?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/,[x.CMYK]:/^(?:device-cmyk|cmyk)\s*\(\s*(?:((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)\s*,\s*((?:\d*\.)?\d+%?)(?:\s*,\s*((?:\d*\.)?\d+))?|((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)\s*((?:\d*\.)?\d+%?)(?:\s*\/\s*((?:\d*\.)?\d+%?))?)\s*\)$/},ue=/^(-?(?:\d*\.)?\d+)((?:deg|grad|rad|turn)?)$/,S=/^(-?\d+(?:\.\d+)?|-?\.\d+)%$/,Xt=/^0x([a-f\d]{1,2})$/i,Ge=/\{(\d+)\}/g,We=/,( +|\d+)/g,_e=/ +/,Ne="The provided string color doesn't have a correct format",Pe="The provided color object doesn't have the proper keys or format";var I,D,gt;(function(e){e.NONE="none",e.DEGREES="deg",e.GRADIANS="grad",e.RADIANS="rad",e.TURNS="turn"})(I||(I={})),function(e){e.NONE="none",e.PERCENT="percent"}(D||(D={})),function(e){e.DEVICE_CMYK="device-cmyk",e.CMYK="cmyk"}(gt||(gt={}));const X={decimals:6,legacyCSS:!1,spacesAfterCommas:!1,anglesUnit:I.NONE,rgbUnit:D.NONE,labUnit:D.NONE,cmykUnit:D.PERCENT,alphaUnit:D.NONE,cmykFunction:gt.DEVICE_CMYK},M=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),bt=e=>+`${e}`.replace(S,"$1"),q=e=>S.test(`${e}`)?bt(e):Math.min(+e,100),xt=e=>(e.length===1&&(e+=e),parseInt(e,16)),$t=e=>{const t=p(e,0).toString(16).toUpperCase();return t.length===1?`0x0${t}`:`0x${t}`},z=(e,t=!1)=>!t&&S.test(e)?Math.min(255*bt(e)/100,255):Xt.test(e)?(e.length===3&&(e+=e.slice(-1)),t?p(e)/255:p(e)):Math.min(+e,t?1:255),Et=e=>S.test(e)?w(125*bt(e)/100,-125,125):w(+e,-125,125),U=e=>Math.min(S.test(e)?bt(e)/100:+e,1),ce=e=>[...e].sort().join("").toUpperCase(),p=(e,t=6)=>{const r=Math.pow(10,t);return Math.round(+e*r)/r},w=(e,t,r)=>Math.max(t,Math.min(e,r)),ft=e=>{if(typeof e=="string"){const t=e.match(ue),r=+t[1];switch(t[2]){case I.RADIANS:e=p(180*r/Math.PI);break;case I.TURNS:e=p(360*r);break;case I.GRADIANS:e=p(.9*r);break;case I.DEGREES:default:e=r}}return(e>360||e<0)&&(e-=360*Math.floor(e/360)),e},je=(e,t)=>{let r;switch(t){case I.RADIANS:r=p((o=>o*Math.PI/180)(e));break;case I.TURNS:r=p(e/360);break;case I.GRADIANS:r=p(10/9*e);break;case I.DEGREES:case I.NONE:default:r=e}return r},y=(e,...t)=>{const r=[],o=[],i=[],s=[],n=[],a=[],l=Object.values(I),d=Object.values(D),m=Object.values(gt),h={legacyCSS:0,spacesAfterCommas:0,cmykFunction:0};for(const c of t)if(typeof c=="string"){if(r.push(c),c.includes(",")){h.legacyCSS++;const g=c.match(We);new Set(g).size===1&&_e.test(g[0].slice(1))&&h.spacesAfterCommas++}if(c.match(O.HSL)){const g=c.match(O.HSL),L=g[1]||g[5],T=g[8],A=L.match(ue)[2];o.push(A===""?I.NONE:A),a.push(S.test(T));continue}if(O.RGB.test(c)){const g=c.match(O.RGB),L=g[1]||g[5],T=g[2]||g[6],A=g[3]||g[7],W=g[8];i.push(S.test(L)&&S.test(T)&&S.test(A)),a.push(S.test(W));continue}if(O.CIELab.test(c)){const g=c.match(O.CIELab),L=g[1],T=g[2],A=g[3],W=g[4];s.push(S.test(L)&&S.test(T)&&S.test(A)),a.push(S.test(W));continue}if(c.match(O.CMYK)){const g=c.match(O.CMYK),L=g[1]||g[6],T=g[2]||g[7],A=g[3]||g[8],W=g[4]||g[9],N=g[10];n.push(S.test(L)&&S.test(T)&&S.test(A)&&S.test(W)),c.startsWith("cmyk")&&h.cmykFunction++,a.push(S.test(N))}}return{decimals:typeof e.decimals===ht.NUMBER?e.decimals:X.decimals,legacyCSS:typeof e.legacyCSS===ht.BOOLEAN?e.legacyCSS:!!(r.length&&h.legacyCSS===r.length)||X.legacyCSS,spacesAfterCommas:typeof e.spacesAfterCommas===ht.BOOLEAN?e.spacesAfterCommas:!!(r.length&&h.spacesAfterCommas===r.length)||X.spacesAfterCommas,anglesUnit:e.anglesUnit&&l.includes(e.anglesUnit)?e.anglesUnit:new Set(o).size===1?o[0]:X.anglesUnit,rgbUnit:e.rgbUnit&&d.includes(e.rgbUnit)?e.rgbUnit:new Set(i).size===1&&i[0]?D.PERCENT:X.rgbUnit,labUnit:e.labUnit&&d.includes(e.labUnit)?e.labUnit:new Set(s).size===1&&s[0]?D.PERCENT:X.labUnit,cmykUnit:e.cmykUnit&&d.includes(e.cmykUnit)?e.cmykUnit:new Set(n).size!==1||n[0]?X.cmykUnit:D.NONE,alphaUnit:e.alphaUnit&&d.includes(e.alphaUnit)?e.alphaUnit:new Set(a).size===1&&a[0]?D.PERCENT:X.alphaUnit,cmykFunction:e.cmykFunction&&m.includes(e.cmykFunction)?e.cmykFunction:n.length&&n.length===h.cmykFunction?gt.CMYK:X.cmykFunction}},Tt=e=>`${e}`in B,pe=[[.4360747,.3850649,.1430804],[.2225045,.7168786,.0606169],[.0139322,.0971045,.7141733]],Ye=[[3.1338561,-1.6168667,-.4906146],[-.9787684,1.9161415,.033454],[.0719453,-.2289914,1.4052427]],et=pe.map(e=>e.reduce((t,r)=>t+r,0)),Ft=(e,t,r)=>(r<0&&(r+=6),r>=6&&(r-=6),p(r<1?255*((t-e)*r+e):r<3?255*t:r<4?255*((t-e)*(4-r)+e):255*e)),Ve=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Xe=e=>e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,me=(e,t,r,o)=>{const i=[0,0,0],s=[e,t,r];return o.forEach((n,a)=>{n.forEach((l,d)=>{i[a]+=l*s[d]})}),i},F=(e,t,r)=>{t/=100;const o=(r/=100)<=.5?r*(t+1):r+t-r*t,i=2*r-o;return{R:Ft(i,o,(e/=60)+2),G:Ft(i,o,e),B:Ft(i,o,e-2)}},it=(e,t,r,o=1)=>{e/=255,t/=255,r/=255,o=Math.min(o,1);const i=Math.max(e,t,r),s=Math.min(e,t,r),n=i-s;let a=0,l=0;const d=(i+s)/2;if(n!==0){switch(i){case e:a=(t-r)/n%6;break;case t:a=(r-e)/n+2;break;case r:a=(e-t)/n+4}a=p(60*a),a<0&&(a+=360),l=n/(1-Math.abs(2*d-1))}return{H:a,S:p(100*l),L:p(100*d),A:o}},st=(e,t,r)=>{const o=[e/255,t/255,r/255].map(Ve),i=me(o[0],o[1],o[2],pe),s=((n,a,l)=>{const d=c=>c>.008856451679035631?Math.cbrt(c):c/.12841854934601665+.13793103448275862,m=d(n/et[0]),h=d(a/et[1]);return[116*h-16,500*(m-h),200*(h-d(l/et[2]))]})(i[0],i[1],i[2]);return{L:s[0],a:s[1],b:s[2]}},te=(e,t,r)=>{const o=((s,n,a)=>{const l=c=>c>.20689655172413793?c**3:.12841854934601665*(c-.13793103448275862),d=(s+16)/116,m=n/500,h=a/200;return[et[0]*l(d+m),et[1]*l(d),et[2]*l(d-h)]})(e,t,r),i=me(o[0],o[1],o[2],Ye).map(Xe);return{R:w(255*i[0],0,255),G:w(255*i[1],0,255),B:w(255*i[2],0,255)}},ee=(e,t,r,o)=>({R:p(255*(1-e)*(o=1-o)),G:p(255*(1-t)*o),B:p(255*(1-r)*o)}),ge=(e,t,r)=>{e/=255,t/=255,r/=255;const o=1-Math.max(e,t,r),i=1-o,s=i&&(i-t)/i,n=i&&(i-r)/i;return{C:p(100*(i&&(i-e)/i)),M:p(100*s),Y:p(100*n),K:p(100*o)}},se=(e,t)=>{if(e<0&&(e+=360),e>360&&(e-=360),e===360||e===0)return e;const r=[[0,120],[120,180],[180,240],[240,360]],o=[[0,60],[60,120],[120,240],[240,360]],i=t?o:r;let s=0,n=0,a=0,l=0;return(t?r:o).find((d,m)=>e>=d[0]&&e<d[1]&&(s=d[0],n=d[1],a=i[m][0],l=i[m][1],!0)),a+(l-a)/(n-s)*(e-s)},wt=e=>e?", ":",",dt=(e,t)=>{const r=ce(Object.keys(e));return Oe[Vt[r]].reduce((o,i,s)=>{const n=e[i];return n!==void 0&&o.push(t(n,s)),o},[])},lt=(e,t)=>e.replace(Ge,(r,o)=>`${t[+o-1]}`),yt=(e,t,r=!1)=>{const{alphaUnit:o,legacyCSS:i,decimals:s}=t;return o!==D.PERCENT||i&&!r?p(e,s):`${p(100*e,s)}%`},b={[x.HEX]:e=>{const t=dt(e,o=>(i=>{let s=p(i,0).toString(16).toUpperCase();return s.length===1&&(s=`0${s}`),s})(p(o))),r=t.length===4?"#{1}{2}{3}{4}":"#{1}{2}{3}";return lt(r,t)},[x.RGB]:(e,t)=>{const{decimals:r,legacyCSS:o,spacesAfterCommas:i,rgbUnit:s}=t,n=wt(i),a=dt(e,(d,m)=>s===D.PERCENT&&m<3?`${((h,c)=>p(h/255*100,c))(d,r)}%`:m===3?yt(d,t):p(d,r)),l=o?a.length===4?`rgba({1}${n}{2}${n}{3}${n}{4})`:`rgb({1}${n}{2}${n}{3})`:a.length===4?"rgb({1} {2} {3} / {4})":"rgb({1} {2} {3})";return lt(l,a)},[x.HSL]:(e,t)=>{const{decimals:r,legacyCSS:o,spacesAfterCommas:i,anglesUnit:s}=t,n=wt(i),a=dt(e,(d,m)=>m===0&&s!==I.NONE?`${p(je(d,s),r)}${s}`:m===3?yt(d,t):p(d,r)),l=o?a.length===4?`hsla({1}${n}{2}%${n}{3}%${n}{4})`:`hsl({1}${n}{2}%${n}{3}%)`:a.length===4?"hsl({1} {2}% {3}% / {4})":"hsl({1} {2}% {3}%)";return lt(l,a)},[x.CIELab]:(e,t)=>{const{decimals:r,labUnit:o}=t,i=dt(e,(n,a)=>{if(a===0){const l=p(q(n),r);return o===D.PERCENT?`${l}%`:`${l}`}return a<3?o===D.PERCENT?`${((l,d)=>p(l/125*100,d))(n,r)}%`:p(n,r):yt(n,t,!0)}),s=i.length===4?"lab({1} {2} {3} / {4})":"lab({1} {2} {3})";return lt(s,i)},[x.CMYK]:(e,t)=>{const{decimals:r,legacyCSS:o,spacesAfterCommas:i,cmykUnit:s,cmykFunction:n}=t,a=wt(i),l=dt(e,(m,h)=>s===D.PERCENT&&h<4?`${p(m,r)}%`:h===4?yt(m,t):p(m/100,r)),d=o?l.length===5?`${n}({1}${a}{2}${a}{3}${a}{4}${a}{5})`:`${n}({1}${a}{2}${a}{3}${a}{4})`:l.length===5?`${n}({1} {2} {3} {4} / {5})`:`${n}({1} {2} {3} {4})`;return lt(d,l)}},k=e=>(typeof e=="string"&&(e=S.test(e)?bt(e)/100:+e),isNaN(+e)||e>1?1:p(e)),at=(e,t,r)=>t.reduce((o,i)=>[...o,{...e,H:r===B.ADDITIVE?ft(e.H+i):ft(se(se(e.H,!1)+i,!0))}],[{...e}]),Ke=(e,t)=>at(e,[30,-30],t),Ue=(e,t)=>at(e,[180],t),ze=(e,t)=>at(e,[150,-150],t),qe=(e,t)=>at(e,[120,-120],t),Je=(e,t)=>at(e,[60,-120,180],t),Ze=(e,t)=>at(e,[90,-90,180],t),v=e=>typeof e=="string"?(t=>{let r;if(Object.keys(x).some(o=>{if(O[o].test(t))return r=o,!0}),!r&&~he.indexOf(t)&&(r=x.HEX),!r)throw new Error(Ne);return r})(e):(t=>{let r,o=!1;const i=ce(Object.keys(t));if(Vt[i]&&(r=Vt[i]),r&&r===x.RGB){const s=Object.entries(t).some(a=>!Xt.test(`${a[1]}`)),n=Object.entries(t).some(a=>!(S.test(`${a[1]}`)||!Xt.test(`${a[1]}`)&&!isNaN(+a[1])&&+a[1]<=255));s&&n&&(o=!0),s||(r=x.HEX)}if(!r||o)throw new Error(Pe);return r})(e),Qe={[x.HEX](e){const t=(~he.indexOf(e)?Bt[e]:e).match(O.HEX),r={R:xt(t[1]||t[5]),G:xt(t[2]||t[6]),B:xt(t[3]||t[7])},o=t[4]||t[8];return o!==void 0&&(r.A=xt(o)/255),r},[x.RGB](e){const t=e.match(O.RGB),r=z(t[1]||t[5]),o=z(t[2]||t[6]),i=z(t[3]||t[7]),s=t[4]||t[8],n={R:Math.min(r,255),G:Math.min(o,255),B:Math.min(i,255)};return s!==void 0&&(n.A=k(s)),n},[x.HSL](e){const t=e.match(O.HSL),r=ft(t[1]||t[5]),o=q(t[2]||t[6]),i=q(t[3]||t[7]),s=t[4]||t[8],n=F(r,o,i);return s!==void 0&&(n.A=k(s)),n},[x.CIELab](e){const t=e.match(O.CIELab),r=q(t[1]),o=Et(t[2]),i=Et(t[3]),s=t[4],n=te(r,o,i);return s!==void 0&&(n.A=k(s)),n},[x.CMYK](e){const t=e.match(O.CMYK),r=U(t[1]||t[6]),o=U(t[2]||t[7]),i=U(t[3]||t[8]),s=U(t[4]||t[9]),n=t[5]||t[10],a=ee(r,o,i,s);return n!==void 0&&(a.A=k(n)),a}},tr={[x.HEX](e){const t={R:z(`${e.R}`),G:z(`${e.G}`),B:z(`${e.B}`)};return M(e,"A")&&(t.A=Math.min(z(`${e.A}`,!0),1)),t},[x.RGB](e){return this.HEX(e)},[x.HSL](e){const t=q(`${e.S}`),r=q(`${e.L}`),o=F(ft(e.H),t,r);return M(e,"A")&&(o.A=k(e.A)),o},[x.CIELab](e){const t=q(`${e.L}`),r=Et(`${e.a}`),o=Et(`${e.b}`),i=te(t,r,o);return M(e,"A")&&(i.A=k(e.A)),i},[x.CMYK](e){const t=U(`${e.C}`),r=U(`${e.M}`),o=U(`${e.Y}`),i=U(`${e.K}`),s=ee(t,r,o,i);return M(e,"A")&&(s.A=k(e.A)),s}},J=(e,t=v(e))=>typeof e=="string"?Qe[t](e):tr[t](e),u={[x.HEX]:e=>({R:$t(e.R),G:$t(e.G),B:$t(e.B)}),HEXA(e){const t=u.HEX(e);return t.A=M(e,"A")?$t(255*e.A):"0xFF",t},[x.RGB](e,t){const r=er(e,t);return M(r,"A")&&delete r.A,r},RGBA(e,t){const r=u.RGB(e,t);return r.A=M(e,"A")?p(e.A):1,r},[x.HSL](e,t){const r=it(e.R,e.G,e.B);return delete r.A,Kt(r,t)},HSLA(e,t){const r=u.HSL(e,t);return r.A=M(e,"A")?p(e.A,t):1,r},[x.CIELab](e,t){const r=st(e.R,e.G,e.B);return rr(r,t)},CIELabA(e,t){const r=u.CIELab(e,t);return r.A=M(e,"A")?p(e.A,t):1,r},[x.CMYK]:(e,t)=>or(ge(e.R,e.G,e.B),t),CMYKA(e,t){const r=u.CMYK(e,t);return r.A=M(e,"A")?p(e.A,t):1,r}},Lt=(e,t,r,o)=>{const i=v(e),s=typeof e=="string",n=J(e,i),a=typeof e=="string"&&M(n,"A")||typeof e!="string"&&M(e,"A"),l=it(n.R,n.G,n.B,n.A);a||delete l.A;const d=r?l.L/(t+1):(100-l.L)/(t+1),m=Array(t).fill(null).map((h,c)=>({...l,L:l.L+d*(c+1)*(1-2*+r)}));switch(i){case x.HEX:default:return m.map(h=>{const c=F(h.H,h.S,h.L);return a&&(c.A=h.A),s?a?b.HEX({...c,A:p(255*c.A)}):b.HEX(c):a?u.HEXA(c):u.HEX(c)});case x.RGB:return m.map(h=>{const c=F(h.H,h.S,h.L);return a&&(c.A=h.A),s?b.RGB(c,o):a?u.RGBA(c,o.decimals):u.RGB(c,o.decimals)});case x.HSL:return m.map(h=>s?b.HSL(h,o):a?u.HSLA({...F(h.H,h.S,h.L),A:h.A},o.decimals):u.HSL(F(h.H,h.S,h.L),o.decimals));case x.CIELab:return m.map(h=>{const c=F(h.H,h.S,h.L);return s?b.CIELab(a?u.CIELabA(c,o.decimals):u.CIELab(c,o.decimals),o):a?u.CIELabA({...c,A:h.A},o.decimals):u.CIELab(c,o.decimals)})}},tt={buildHarmony(e,t,r,o){const i=v(e),s=J(e,i),n=it(s.R,s.G,s.B,s.A),a=typeof e=="string"&&M(s,"A")||typeof e!="string"&&M(e,"A"),l=typeof e=="string";switch(i){case x.HEX:default:return a?this.HEXA(Kt(n,0),t,r,l):this.HEX(Kt(n,0),t,r,l);case x.HSL:return a?this.HSLA(n,t,r,l,o):this.HSL(n,t,r,l,o);case x.RGB:return a?this.RGBA(n,t,r,l,o):this.RGB(n,t,r,l,o);case x.CIELab:return a?this.CIELabA(n,t,r,l,o):this.CIELab(n,t,r,l,o)}},[x.HEX]:(e,t,r,o)=>t(e,r).map(i=>o?b.HEX(F(i.H,i.S,i.L)):u.HEX(F(i.H,i.S,i.L))),HEXA:(e,t,r,o)=>t(e,r).map(i=>o?b.HEX({...F(i.H,i.S,i.L),A:255*k(i.A)}):u.HEXA({...F(i.H,i.S,i.L),A:k(i.A)})),[x.RGB]:(e,t,r,o,i)=>t(e,r).map(s=>o?b.RGB(F(s.H,s.S,s.L),i):u.RGB(F(s.H,s.S,s.L),i.decimals)),RGBA:(e,t,r,o,i)=>t(e,r).map(s=>o?b.RGB({...F(s.H,s.S,s.L),A:k(s.A)},i):u.RGBA({...F(s.H,s.S,s.L),A:k(s.A)},i.decimals)),[x.HSL]:(e,t,r,o,i)=>t(e,r).map(s=>o?b.HSL({H:s.H,S:s.S,L:s.L},i):u.HSL(F(s.H,s.S,s.L),i.decimals)),HSLA:(e,t,r,o,i)=>t(e,r).map(s=>o?b.HSL({...s,A:k(s.A)},i):u.HSLA({...F(s.H,s.S,s.L),A:k(s.A)},i.decimals)),[x.CIELab]:(e,t,r,o,i)=>t(e,r).map(s=>{const n=F(s.H,s.S,s.L);return o?b.CIELab(st(n.R,n.G,n.B),i):u.CIELab(n,i.decimals)}),CIELabA:(e,t,r,o,i)=>t(e,r).map(s=>{const n=F(s.H,s.S,s.L);return o?b.CIELab({...st(n.R,n.G,n.B),A:k(s.A)},i):u.CIELabA({...n,A:k(s.A)},i.decimals)})},C={mix(e,t){const r=e.map(n=>{const a=v(n);return J(n,a)}),o=t===B.SUBTRACTIVE?r.map(n=>{const a=((l,d,m)=>{const h=Math.min(l,d,m),c=Math.min(255-l,255-d,255-m),g=l-h,L=d-h,T=m-h,A=Math.min(g,L),W=g-A,N=(L+A)/2,V=(T+L-A)/2,j=Math.max(W,N,V)/Math.max(g,L,T),St=isNaN(j)||j===1/0||j<=0?1:j;return{R:W/St+c,Y:N/St+c,B:V/St+c}})(n.R,n.G,n.B);return M(n,"A")&&(a.A=n.A),a}):null;function i(n){const a=t===B.ADDITIVE?{R:0,G:0,B:0,A:0}:{R:0,Y:0,B:0,A:0};return n.reduce((l,d)=>{const m=M(d,"A")?d.A:1,h={R:Math.min(l.R+d.R*m,255),B:Math.min(l.B+d.B*m,255),A:1-(1-m)*(1-l.A)},c="G"in l?l.G:l.Y,g="G"in d?d.G:d.Y;return{...h,...t===B.ADDITIVE?{G:Math.min(c+g*m,255)}:{Y:Math.min(c+g*m,255)}}},a)}let s;if(t===B.ADDITIVE)s=i(r);else{const n=i(o);s=((a,l,d)=>{const m=Math.min(a,l,d),h=Math.min(255-a,255-l,255-d),c=a-m,g=l-m,L=d-m,T=Math.min(g,L),A=c+g-T,W=g+T,N=2*(L-T),V=Math.max(A,W,N)/Math.max(c,g,L),j=isNaN(V)||V===1/0||V<=0?1:V;return{R:A/j+h,G:W/j+h,B:N/j+h}})(n.R,n.Y,n.B),s.A=n.A}return{R:p(s.R),G:p(s.G),B:p(s.B),A:w(s.A,0,1)}},[x.HEX](e,t,r){const o=this.mix(e,t);return delete o.A,r?b.HEX(o):u.HEX(o)},HEXA(e,t,r){const o=this.mix(e,t);return o.A=r?255*k(o.A):k(o.A),r?b.HEX(o):u.HEXA(o)},[x.RGB](e,t,r,o){const i=this.mix(e,t);return delete i.A,r?b.RGB(i,o):u.RGB(i,o.decimals)},RGBA(e,t,r,o){const i=this.mix(e,t);return r?b.RGB(i,o):u.RGBA(i,o.decimals)},[x.HSL](e,t,r,o){const i=this.mix(e,t),s=it(i.R,i.G,i.B);return delete i.A,delete s.A,r?b.HSL(s,o):u.HSL(i,o.decimals)},HSLA(e,t,r,o){const i=this.mix(e,t),s=it(i.R,i.G,i.B,i.A);return r?b.HSL(s,o):u.HSLA(i,o.decimals)},[x.CIELab](e,t,r,o){const i=this.mix(e,t),s=st(i.R,i.G,i.B);return delete i.A,r?b.CIELab(s,o):u.CIELabA(i,o.decimals)},CIELabA(e,t,r,o){const i=this.mix(e,t),s=st(i.R,i.G,i.B);return M(i,"A")&&(s.A=i.A),r?b.CIELab(s,o):u.CIELabA(i,o.decimals)}},er=(e,t)=>({R:p(e.R,t),G:p(e.G,t),B:p(e.B,t),...M(e,"A")?{A:p(e.A,t)}:{}}),Kt=(e,t)=>({H:p(e.H,t),S:p(e.S,t),L:p(e.L,t),...M(e,"A")?{A:p(e.A,t)}:{}}),rr=(e,t)=>({L:p(e.L,t),a:p(e.a,t),b:p(e.b,t)}),or=(e,t)=>({C:p(e.C,t),M:p(e.M,t),Y:p(e.Y,t),K:p(e.K,t)}),H=(e,t,r,o)=>o(J(e,t),r),E=(e,t,r,o,i)=>(r<1&&(r=5),((n,a,l)=>{const d=l-1,m=(a.R-n.R)/d,h=(a.G-n.G)/d,c=(a.B-n.B)/d,g=k(n.A),L=(k(a.A)-g)/d;return Array(l).fill(null).map((T,A)=>A===0?n:A===d?a:{R:p(n.R+m*A),G:p(n.G+h*A),B:p(n.B+c*A),A:p(g+L*A)})})(J(e),J(t),r).map(n=>i(n,o))),kt=(e,t,r,o)=>({[Y.ANALOGOUS]:tt.buildHarmony(t,Ke,r,o),[Y.COMPLEMENTARY]:tt.buildHarmony(t,Ue,r,o),[Y.SPLIT_COMPLEMENTARY]:tt.buildHarmony(t,ze,r,o),[Y.TRIADIC]:tt.buildHarmony(t,qe,r,o),[Y.TETRADIC]:tt.buildHarmony(t,Je,r,o),[Y.SQUARE]:tt.buildHarmony(t,Ze,r,o)})[e];class _{constructor(t,r={}){this._options=y(r,t),this.rgb=J(t),this.updateHSL(),this.updateLab(),this.updateCMYK()}updateRGB(){this.rgb={...F(this.hsl.H,this.hsl.S,this.hsl.L),A:this.hsl.A}}updateRGBFromCMYK(){this.rgb={...ee(this.cmyk.C,this.cmyk.M,this.cmyk.Y,this.cmyk.K),A:this.rgb.A}}updateRGBFromLab(){this.rgb={...te(this.lab.L,this.lab.a,this.lab.b),A:this.rgb.A}}updateHSL(){this.hsl=it(this.rgb.R,this.rgb.G,this.rgb.B,this.rgb.A)}updateLab(){this.lab={...st(this.rgb.R,this.rgb.G,this.rgb.B),A:this.rgb.A}}updateCMYK(){this.cmyk=ge(this.rgb.R,this.rgb.G,this.rgb.B)}setOptions(t={}){return this._options={...this._options,...t},this}setH(t){return this.hsl.H=ft(t),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setS(t){return this.hsl.S=w(t,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setL(t){return this.hsl.L=w(t,0,100),this.updateRGB(),this.updateLab(),this.updateCMYK(),this}setR(t){this.rgb.R=w(t,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK()}setG(t){return this.rgb.G=w(t,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setB(t){return this.rgb.B=w(t,0,255),this.updateHSL(),this.updateLab(),this.updateCMYK(),this}setCIEL(t){return this.lab.L=w(t,0,100),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEa(t){return this.lab.a=w(t,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setCIEb(t){return this.lab.b=w(t,-125,125),this.updateRGBFromLab(),this.updateHSL(),this.updateCMYK(),this}setA(t){return this.hsl.A=this.rgb.A=w(t,0,1),this}setC(t){return this.cmyk.C=w(t,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setM(t){return this.cmyk.M=w(t,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setY(t){return this.cmyk.Y=w(t,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}setK(t){return this.cmyk.K=w(t,0,100),this.updateRGBFromCMYK(),this.updateHSL(),this.updateLab(),this}get options(){return this._options}get H(){return p(this.hsl.H,this.options.decimals)}get S(){return p(this.hsl.S,this.options.decimals)}get L(){return p(this.hsl.L,this.options.decimals)}get CIEL(){return p(this.lab.L,this.options.decimals)}get CIEa(){return p(this.lab.a,this.options.decimals)}get CIEb(){return p(this.lab.b,this.options.decimals)}get R(){return p(this.rgb.R,this.options.decimals)}get G(){return p(this.rgb.G,this.options.decimals)}get B(){return p(this.rgb.B,this.options.decimals)}get A(){return p(this.hsl.A,this.options.decimals)}get C(){return p(this.cmyk.C,this.options.decimals)}get M(){return p(this.cmyk.M,this.options.decimals)}get Y(){return p(this.cmyk.Y,this.options.decimals)}get K(){return p(this.cmyk.K,this.options.decimals)}get HEXObject(){return u.HEX(this.rgb)}get HEXAObject(){return u.HEXA(this.rgb)}get RGBObject(){return{R:this.R,G:this.G,B:this.B}}get RGBAObject(){return{...this.RGBObject,A:this.A}}get HSLObject(){return{H:this.H,S:this.S,L:this.L}}get HSLAObject(){return{...this.HSLObject,A:this.A}}get CIELabObject(){return{L:this.CIEL,a:this.CIEa,b:this.CIEb}}get CIELabAObject(){return{...this.CIELabObject,A:this.A}}get CMYKObject(){return{C:this.C,M:this.M,Y:this.Y,K:this.K}}get CMYKAObject(){return{...this.CMYKObject,A:this.A}}get HEX(){return b.HEX({R:this.R,G:this.G,B:this.B})}get HEXA(){return b.HEX({R:this.R,G:this.G,B:this.B,A:255*this.A})}get RGB(){return b.RGB({R:this.R,G:this.G,B:this.B},this.options)}get RGBA(){return b.RGB({R:this.R,G:this.G,B:this.B,A:this.A},this.options)}get HSL(){return b.HSL({H:this.H,S:this.S,L:this.L},this.options)}get HSLA(){return b.HSL({H:this.H,S:this.S,L:this.L,A:this.A},this.options)}get CIELab(){return b.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb},this.options)}get CIELabA(){return b.CIELab({L:this.CIEL,a:this.CIEa,b:this.CIEb,A:this.A},this.options)}get CMYK(){return b.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K},this.options)}get CMYKA(){return b.CMYK({C:this.C,M:this.M,Y:this.Y,K:this.K,A:this.A},this.options)}static toHEXObject(t){const r=v(t);return H(t,r,0,u.HEX)}static toHEX(t){return b.HEX(_.toHEXObject(t))}static toHEXAObject(t){const r=v(t);return H(t,r,0,u.HEXA)}static toHEXA(t){return b.HEX(_.toHEXAObject(t))}static toRGBObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.RGB)}static toRGB(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.RGB);return b.RGB(s,i)}static toRGBAObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.RGBA)}static toRGBA(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.RGBA);return b.RGB(s,i)}static toHSLObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.HSL)}static toHSL(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.HSL);return b.HSL(s,i)}static toHSLAObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.HSLA)}static toHSLA(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.HSLA);return b.HSL(s,i)}static toCIELabObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.CIELab)}static toCIELab(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.CIELab);return b.CIELab(s,i)}static toCIELabAObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.CIELabA)}static toCIELabA(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.CIELabA);return b.CIELab(s,i)}static toCMYKObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.CMYK)}static toCMYK(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.CMYK);return b.CMYK(s,i)}static toCMYKAObject(t,r={}){const o=v(t);return H(t,o,r.decimals,u.CMYKA)}static toCMYKA(t,r={}){const o=v(t),i=y(r,t),s=H(t,o,r.decimals,u.CMYKA);return b.CMYK(s,i)}static getBlendHEXObject(t,r,o=5){return E(t,r,o,0,u.HEX)}static getBlendHEX(t,r,o=5){return _.getBlendHEXObject(t,r,o).map(i=>b.HEX(i))}static getBlendHEXAObject(t,r,o=5){return E(t,r,o,0,u.HEXA)}static getBlendHEXA(t,r,o=5){return _.getBlendHEXAObject(t,r,o).map(i=>b.HEX(i))}static getBlendRGBObject(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.RGB):E(t,r,5,o?.decimals,u.RGB)}static getBlendRGB(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.RGB).map(s=>b.RGB(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.RGB).map(s=>b.RGB(s,y(o||{},t,r)))}static getBlendRGBAObject(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.RGBA):E(t,r,5,o?.decimals,u.RGBA)}static getBlendRGBA(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.RGBA).map(s=>b.RGB(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.RGBA).map(s=>b.RGB(s,y(o||{},t,r)))}static getBlendHSLObject(t,r,o,i){return E(t,r,typeof o=="number"?o:5,i?.decimals,u.HSL)}static getBlendHSL(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.HSL).map(s=>b.HSL(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.HSL).map(s=>b.HSL(s,y(o||{},t,r)))}static getBlendHSLAObject(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.HSLA):E(t,r,5,o?.decimals,u.HSLA)}static getBlendHSLA(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.HSLA).map(s=>b.HSL(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.HSLA).map(s=>b.HSL(s,y(o||{},t,r)))}static getBlendCIELabObject(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.CIELab):E(t,r,5,o?.decimals,u.CIELab)}static getBlendCIELab(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.CIELab).map(s=>b.CIELab(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.CIELab).map(s=>b.CIELab(s,y(o||{},t,r)))}static getBlendCIELabAObject(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.CIELabA):E(t,r,5,o?.decimals,u.CIELabA)}static getBlendCIELabA(t,r,o,i){return typeof o=="number"?E(t,r,o,i?.decimals,u.CIELabA).map(s=>b.CIELab(s,y(i||{},t,r))):E(t,r,5,o?.decimals,u.CIELabA).map(s=>b.CIELab(s,y(o||{},t,r)))}static getMixHEXObject(t,r=B.ADDITIVE){return C.HEX(t,r,!1)}static getMixHEX(t,r=B.ADDITIVE){return C.HEX(t,r,!0)}static getMixHEXAObject(t,r=B.ADDITIVE){return C.HEXA(t,r,!1)}static getMixHEXA(t,r=B.ADDITIVE){return C.HEXA(t,r,!0)}static getMixRGBObject(t,r,o){return typeof r=="string"?C.RGB(t,r,!1,y(o||{},...t)):C.RGB(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixRGB(t,r,o){return typeof r=="string"?C.RGB(t,r,!0,y(o||{},...t)):C.RGB(t,B.ADDITIVE,!0,y(r||{},...t))}static getMixRGBAObject(t,r,o){return typeof r=="string"?C.RGBA(t,r,!1,y(o||{},...t)):C.RGBA(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixRGBA(t,r,o){return typeof r=="string"?C.RGBA(t,r,!0,y(o||{},...t)):C.RGBA(t,B.ADDITIVE,!0,y(r||{},...t))}static getMixHSLObject(t,r,o){return typeof r=="string"?C.HSL(t,r,!1,y(o||{},...t)):C.HSL(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixHSL(t,r,o){return typeof r=="string"?C.HSL(t,r,!0,y(o||{},...t)):C.HSL(t,B.ADDITIVE,!0,y(r||{},...t))}static getMixHSLAObject(t,r,o){return typeof r=="string"?C.HSLA(t,r,!1,y(o||{},...t)):C.HSLA(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixHSLA(t,r,o){return typeof r=="string"?C.HSLA(t,r,!0,y(o||{},...t)):C.HSLA(t,B.ADDITIVE,!0,y(r||{},...t))}static getMixCIELabObject(t,r,o){return typeof r=="string"?C.CIELab(t,r,!1,y(o||{},...t)):C.CIELab(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixCIELab(t,r,o){return typeof r=="string"?C.CIELab(t,r,!0,y(o||{},...t)):C.CIELab(t,B.ADDITIVE,!0,y(r||{},...t))}static getMixCIELabAObject(t,r,o){return typeof r=="string"?C.CIELabA(t,r,!1,y(o||{},...t)):C.CIELabA(t,B.ADDITIVE,!1,y(r||{},...t))}static getMixCIELabA(t,r,o){return typeof r=="string"?C.CIELabA(t,r,!0,y(o||{},...t)):C.CIELabA(t,B.ADDITIVE,!0,y(r||{},...t))}static getShades(t,r,o){return typeof r=="number"?Lt(t,r,!0,y(o||{},t)):Lt(t,5,!0,y(r||{},t))}static getTints(t,r,o){return typeof r=="number"?Lt(t,r,!1,y(o||{},t)):Lt(t,5,!1,y(r||{},t))}static getHarmony(t,r,o,i){return`${r}`in Y?kt(r,t,Tt(o)?o:B.ADDITIVE,y(Tt(o)?i||{}:o||{},t)):Tt(r)?kt(Y.COMPLEMENTARY,t,r,y(o||{},t)):kt(Y.COMPLEMENTARY,t,B.ADDITIVE,y(r||{},t))}}function G(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ir(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).toString().replaceAll(",","")}class sr extends R{type;name;flex_hidden$=$.state(!1);constructor(t,r){super("div"),this.staticClass("style-panel"),this.type=r,this.name=t,this.layout(),this.on("input",o=>{this.update()})}update(){return this.role_model_list.forEach(([t,r])=>{r.update(this),K.updateStyle(this.name,r,[t])}),this.flex_hidden$.set(this.data?.display!=="flex"),this}layout(){if(!this.roles.length)return this.clear();const t=this.data.backgroundColor==="??"?{HEX:"??",A:"??"}:new _(this.data.backgroundColor),r=this.data.color==="??"?{HEX:"??",A:"??"}:new _(this.data.color);this.content([$("section").content([$("h3").content("Properties"),$("div").content([new Q("display").label("Display").add([["block","inline","flex","inline-flex","none"].map(o=>$("option").content(o).value(o))]).value(this.data.display),new P("opacity").value(this.data.opacity).unit("px").min(0).max(1).label("Opacity").self(o=>{o.$range.step(.01),o.$value.step(.1)}),new Q("float").label("Float").add([["left","right","none"].map(o=>$("option").content(o).value(o))]).value(this.data.float)])]),$("section").content([$("h3").content("Flex"),$("div").content([new Q("flex-direction").label("Direction").add([["row","column","row-reverse","column-reverse"].map(o=>$("option").content(o).value(o))]).value(this.data.flexDirection),new P("gap").value(this.data.gap).unit("px").min(0).max(100).label("Gap"),new Q("justify-content").label("Justify Content").add([["start","center","end","stretch","space-around","space-evenly","space-between"].map(o=>$("option").content(o).value(o))]).value(this.data.justifyContent),new Q("align-items").label("Align Items").add([["start","center","end","stretch","space-around","space-evenly","space-between"].map(o=>$("option").content(o).value(o))]).value(this.data.alignItems)])]).hide(this.flex_hidden$),this.type==="text"?$("section").content([$("h3").content("Font"),$("div").content([new P("font-size").value(this.data.fontSize).unit("px").min(1).label("Size"),new P("font-weight").min(100).max(900).label("Weight").value(this.data.fontWeight).self(o=>o.$range.step(100)),new Ct("font-color").value(this.data.color).label("Color"),new P("font-color-transparent").value(r.A.toString()).unit("px").min(0).max(1).label("Transparent").self(o=>{o.$range.step(.01),o.$value.step(.1)})])]):void 0,this.type==="image"?$("section").content([$("h3").content("Dimension"),$("div").content([new P("height").value(this.data.height).unit("px").min(1).label("Height"),new P("width").value(this.data.width).unit("px").min(1).label("Width")])]):void 0,$("section").content([$("h3").content("Background"),$("div").content([new Ct("background-color").value(t.HEX).label("Color"),new P("background-color-transparent").value(t.A.toString()).unit("px").min(0).max(1).label("Transparent").self(o=>{o.$range.step(.01),o.$value.step(.1)})])]),$("section").content([$("h3").content("Padding"),$("div").content([["left","top","right","bottom"].map(o=>new P(`padding-${o}`).value(this.data[`padding${G(o)}`]).unit("px").label(G(o)))])]),$("section").content([$("h3").content("Margin"),$("div").content([["left","top","right","bottom"].map(o=>new P(`margin-${o}`).value(this.data[`margin${G(o)}`]).unit("px").label(G(o)))])]),$("section").content([$("header").content([$("h3").content("Border"),$("div").content([$("label").content("Link").for("border-link"),$("input").id("border-link").type("checkbox").checked(!0)])]),$("div").content([["left","top","right","bottom"].map(o=>$("section").content([$("h4").content(G(o)),$("div").content([new P(`border-${o}-width`).value(this.data[`border${G(o)}Width`]).unit("px").label("Width"),new Q(`border-${o}-style`).label("Style").add([["solid","dashed","doubled","dotted","groove","outset","inset","ridge","hidden"].map(i=>$("option").value(i).content(i).id(i))]).value(this.data[`border${G(o)}Style`]),new Ct(`border-${o}-color`).value(this.data[`border${G(o)}Color`]).label("Color")]).on("input",(i,s)=>{$(":#border-link")?.checked()&&["left","top","right","bottom"].forEach(n=>{if(n===o)return;const a=$(i.target)?.id();a?.includes("width")&&$(`:div.border-${n}-width`)?.value(s.$(`#border-${o}-width`)?.value()),a?.includes("style")&&$(`:div.border-${n}-style`)?.value(s.$(`#border-${o}-style`)?.value()),a?.includes("color")&&$(`:div.border-${n}-color`)?.value(s.$(`#border-${o}-color`)?.value())})})]))])]),$("section").content([$("header").content([$("h3").content("Border Radius"),$("div").content([$("label").content("Link").for("border-radius-link"),$("input").id("border-radius-link").type("checkbox").checked(!0)])]),$("div").content([["top-left","top-right","bottom-left","bottom-right"].map(o=>new P(`border-${o}-radius`).value(this.data[`border${ir(o)}Radius`]).unit("px").label(`${o.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).toString().replace(","," ")}`).on("input",(i,s)=>{$(":#border-radius-link")?.checked()&&["top-left","top-right","bottom-left","bottom-right"].forEach(n=>{n!==o&&$(`:div.border-${n}-radius`)?.value(s.value())})}))])])])}get models(){return this.roles.map(t=>Z.get(t).get(this.name))}get role_model_list(){return this.roles.map(t=>[t,Z.get(t).get(this.name)])}get data(){return this.roles.length>1?function(r,o){let i={};for(const[s,n]of Object.entries(r)){i[s]=n;for(const a of o)if(a[s]!==n){i[s]="??";break}}return i}(this.models[0].data,this.models.map(r=>r.data)):this.models[0].data}get roles(){return $("::.role-checkbox").map(t=>{if(t.checked())return t.value()}).detype()}}class nr{data;constructor(t){this.data=t}update(t){const r=(n,a,l=!1)=>n==="??"||n===void 0?a:l?n+"px":n,o=n=>({[`border${G(n)}Style`]:r(t.$(`#border-${n}-style`)?.value(),this.data[`border${G(n)}Style`]),[`border${G(n)}Color`]:r(t.$(`#border-${n}-color`)?.value(),this.data[`border${G(n)}Color`]),[`border${G(n)}Width`]:r(t.$(`#border-${n}-width`)?.value(),this.data[`border${G(n)}Width`],!0)}),i=n=>({[`${n}Top`]:r(t.$(`#${n}-top`)?.value(),this.data[`${n}Top`],!0),[`${n}Bottom`]:r(t.$(`#${n}-bottom`)?.value(),this.data[`${n}Bottom`],!0),[`${n}Left`]:r(t.$(`#${n}-left`)?.value(),this.data[`${n}Left`],!0),[`${n}Right`]:r(t.$(`#${n}-right`)?.value(),this.data[`${n}Right`],!0)}),s={fontSize:r(t.$("#font-size")?.value(),this.data.fontSize,!0),fontWeight:r(t.$("#font-weight")?.value(),this.data.fontWeight),color:new _({...new _(r(t.$("#font-color")?.value(),this.data.color)).RGBObject,A:r(t.$("#font-color-transparent")?.value(),new _(this.data.color).A)}).HEXA,backgroundColor:new _({...new _(r(t.$("#background-color")?.value(),this.data.backgroundColor)).RGBObject,A:r(t.$("#background-color-transparent")?.value(),new _(this.data.backgroundColor).A)}).HEXA,...o("top"),...o("bottom"),...o("left"),...o("right"),borderTopLeftRadius:r(t.$("#border-top-left-radius")?.value(),this.data.borderTopLeftRadius,!0),borderTopRightRadius:r(t.$("#border-top-right-radius")?.value(),this.data.borderTopRightRadius,!0),borderBottomLeftRadius:r(t.$("#border-bottom-left-radius")?.value(),this.data.borderBottomLeftRadius,!0),borderBottomRightRadius:r(t.$("#border-bottom-right-radius")?.value(),this.data.borderBottomRightRadius,!0),...i("margin"),...i("padding"),opacity:r(t.$("#opacity")?.value(),this.data.opacity),display:r(t.$("#display")?.value(),this.data.display),height:r(t.$("#height")?.value(),this.data.height,!0),width:r(t.$("#width")?.value(),this.data.width,!0),flexDirection:r(t.$("#flex-direction")?.value(),this.data.flexDirection),justifyContent:r(t.$("#justify-content")?.value(),this.data.justifyContent),alignItems:r(t.$("#align-items")?.value(),this.data.alignItems),gap:r(t.$("#gap")?.value(),this.data.gap,!0),float:r(t.$("#float")?.value(),this.data.float)};return this.data=s,this}}const fe={fontSize:"16px",color:"#000000",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block","flex-direction":"row","justify-content":"start","align-items":"start",gap:"0px",float:"none"};({...fe});const ne={Normal:{Message:{fontSize:"16px",fontWeight:"400",color:"#F0F0F0FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"4px",marginBottom:"0px",marginLeft:"2px",marginRight:"2px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",flexDirection:"row",gap:"0px",float:"none"},Name:{fontSize:"16px",fontWeight:"400",color:"#FFFFFFFF",backgroundColor:"#FF427B99",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"block",flexDirection:"row",gap:"0px",float:"none"},Avatar:{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",height:"60px",width:"60px",flexDirection:"row",gap:"0px",float:"none"},Time:{fontSize:"16px",fontWeight:"100",color:"#FFFFFFD1",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"5px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"right"},"Author Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"flex",flexDirection:"row",gap:"0px",float:"none"},"Content Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",flexDirection:"row",gap:"0px",float:"none"},"Outer Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#3D3D3D80",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"10px",marginLeft:"0px",marginRight:"0px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"start",gap:"10px",float:"none"}},Member:{Message:{fontSize:"16px",fontWeight:"400",color:"#F0F0F0FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"4px",marginBottom:"0px",marginLeft:"2px",marginRight:"2px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},Name:{fontSize:"16px",fontWeight:"400",color:"#FFFFFFFF",backgroundColor:"#FF424299",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"block",gap:"0px",float:"none"},Avatar:{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",height:"60px",width:"60px",gap:"0px",float:"none"},Time:{fontSize:"16px",fontWeight:"100",color:"#FFFFFFD1",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"5px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"right"},"Author Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"flex",flexDirection:"row",gap:"0px",float:"none"},"Content Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},"Outer Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#3D3D3D80",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"10px",marginLeft:"0px",marginRight:"0px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"start",gap:"10px",float:"none"}},Moderator:{Message:{fontSize:"16px",fontWeight:"400",color:"#F0F0F0FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"4px",marginBottom:"0px",marginLeft:"2px",marginRight:"2px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},Name:{fontSize:"16px",fontWeight:"400",color:"#FFFFFFFF",backgroundColor:"#656EEC99",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"block",gap:"0px",float:"none"},Avatar:{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",height:"60px",width:"60px",gap:"0px",float:"none"},Time:{fontSize:"16px",fontWeight:"100",color:"#FFFFFFD1",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"5px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"right"},"Author Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"flex",flexDirection:"row",gap:"0px",float:"none"},"Content Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},"Outer Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#3D3D3D80",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"10px",marginLeft:"0px",marginRight:"0px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"start",gap:"10px",float:"none"}},Owner:{Message:{fontSize:"16px",fontWeight:"400",color:"#F0F0F0FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"4px",marginBottom:"0px",marginLeft:"2px",marginRight:"2px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},Name:{fontSize:"16px",fontWeight:"400",color:"#FCFF52FF",backgroundColor:"#00000099",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"block",gap:"0px",float:"none"},Avatar:{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",height:"60px",width:"60px",gap:"0px",float:"none"},Time:{fontSize:"16px",fontWeight:"100",color:"#FFFFFFD1",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"5px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"right"},"Author Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"flex",flexDirection:"row",gap:"0px",float:"none"},"Content Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#00000000",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",marginTop:"0px",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",paddingTop:"0px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",opacity:"1",display:"block",gap:"0px",float:"none"},"Outer Area":{fontSize:"16px",color:"#000000FF",backgroundColor:"#3D3D3D80",borderTopStyle:"solid",borderTopColor:"#000000",borderTopWidth:"0px",borderBottomStyle:"solid",borderBottomColor:"#000000",borderBottomWidth:"0px",borderLeftStyle:"solid",borderLeftColor:"#000000",borderLeftWidth:"0px",borderRightStyle:"solid",borderRightColor:"#000000",borderRightWidth:"0px",borderTopLeftRadius:"10px",borderTopRightRadius:"10px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",marginTop:"0px",marginBottom:"10px",marginLeft:"0px",marginRight:"0px",paddingTop:"8px",paddingBottom:"8px",paddingLeft:"8px",paddingRight:"8px",opacity:"1",display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"start",gap:"10px",float:"none"}}},Rt={bocchi:["bocchi_1.png","bocchi_2.png"],kita:["kita_1.png","kita_2.png"],nijika:["nijika_1.png","nijika_2.png"],ryo:["ryo_1.png","ryo_2.png"]};class ar extends R{data;$content=$("div").id("content");$message=$("span").id("message");$name=$("span").id("author-name");$author_area=$("yt-live-chat-author-chip");$timestamp=$("span").id("timestamp");$avatar=$("yt-img-shadow").id("author-photo");$overlay=$("div").class("overlay");$hint=$("div").class("hint").css({display:"none"});constructor(t){super("yt-live-chat-text-message-renderer"),this.data=t,this.build(),this.init()}init(){Z.get(this.data.role)?.forEach((t,r)=>this.updateStyle(r,t))}build(){this.content([this.$overlay.content([`Role: ${this.data.role}`]),this.$hint,this.$avatar.content([$("img").src(`/${this.avatar_url}`)]),this.$content.content([this.$timestamp.content(new Intl.DateTimeFormat("en",{timeStyle:"short"}).format(new Date)),this.$author_area.content([this.$name.content(this.data.name),$("span").id("chat-badges").content([$("yt-live-chat-author-badge-renderer").content([$("div").id("image").content([$("img")])]),this.data.role==="Moderator"?$("yt-live-chat-author-badge-renderer").attribute("type","moderator").content([$("div").id("image").self(t=>{t.dom.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" focusable="false" style="pointer-events: none; display: inherit; width: 100%; height: 100%;"><path d="M9.64589146,7.05569719 C9.83346524,6.562372 9.93617022,6.02722257 9.93617022,5.46808511 C9.93617022,3.00042984 7.93574038,1 5.46808511,1 C4.90894765,1 4.37379823,1.10270499 3.88047304,1.29027875 L6.95744681,4.36725249 L4.36725255,6.95744681 L1.29027875,3.88047305 C1.10270498,4.37379824 1,4.90894766 1,5.46808511 C1,7.93574038 3.00042984,9.93617022 5.46808511,9.93617022 C6.02722256,9.93617022 6.56237198,9.83346524 7.05569716,9.64589147 L12.4098057,15 L15,12.4098057 L9.64589146,7.05569719 Z"></path></svg>'})]):void 0])]),this.$message.content(this.data.message),$("span").id("deleted-state")])])}updateStyle(t,r){switch(t){case"Message":this.$message.css(r.data);break;case"Name":this.$name.css(r.data);break;case"Avatar":this.$avatar.css(r.data);break;case"Content Area":this.$content.css(r.data);break;case"Author Area":this.$author_area.css(r.data);break;case"Outer Area":this.css(r.data);break;case"Time":this.$timestamp.css(r.data);break}}hint(t){switch(t){case"Message":this.hintPosition(this.$message);break;case"Name":this.hintPosition(this.$name);break;case"Avatar":this.hintPosition(this.$avatar);break;case"Time":this.hintPosition(this.$timestamp);break;case"Content Area":this.hintPosition(this.$content);break;case"Author Area":this.hintPosition(this.$author_area);break;case"Outer Area":this.hintPosition(this);break}}hintPosition(t){const r=t.dom.getBoundingClientRect(),o=this.dom.getBoundingClientRect();this.$hint.css({position:"absolute",top:`${r.top-o.top}px`,left:`${r.left-o.left}px`,height:`${r.height}px`,width:`${r.width}px`,backgroundColor:"#ff000030",display:"block"})}get avatar_url(){const t=this.data.role==="Normal"?Rt.bocchi:this.data.role==="Member"?Rt.kita:this.data.role==="Moderator"?Rt.ryo:Rt.nijika;return t[Math.floor(Math.random()*t.length)]}}class dr extends R{messageList=new Set;constructor(){super("ytchat")}send(t){const r=new ar(t);return this.messageList.add(r),this.insert(r),this}updateStyle(t,r,o){this.messageList.forEach(i=>{o.includes(i.data.role)&&i.updateStyle(t,r)})}showHint(t){this.messageList.forEach(r=>{this.roles.includes(r.data.role)&&r.hint(t)})}hideHint(){this.messageList.forEach(t=>{t.$hint.css({display:"none"})})}get roles(){return $("::.role-checkbox").map(t=>{if(t.checked())return t.value()}).detype()}}const lr=`yt-live-chat-renderer yt-live-chat-header-renderer,
|
|
yt-live-chat-renderer yt-live-chat-ticker-renderer,
|
|
yt-live-chat-renderer yt-live-chat-message-input-renderer,
|
|
yt-live-chat-renderer #reaction-control-panel-overlay,
|
|
yt-live-chat-renderer #action-panel,
|
|
yt-live-chat-renderer #inline-toast-container,
|
|
yt-live-chat-renderer #panel-pages,
|
|
yt-live-chat-renderer #promo,
|
|
yt-live-chat-viewer-engagement-message-renderer,
|
|
yt-live-chat-banner-manager,
|
|
yt-live-chat-docked-message,
|
|
yt-live-chat-paid-message-renderer {
|
|
display: none !important;
|
|
}
|
|
#item-scroller {
|
|
overflow: hidden !important;
|
|
}
|
|
html, body, yt-live-chat-app, yt-live-chat-renderer {
|
|
background: #00000000 !important;
|
|
}
|
|
yt-live-chat-text-message-renderer #message, yt-live-chat-text-message-renderer #author-name {
|
|
word-wrap: break-word;
|
|
}
|
|
yt-live-chat-text-message-renderer {
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
yt-live-chat-text-message-renderer #author-photo {
|
|
overflow: hidden;
|
|
flex-shrink: 0;
|
|
}
|
|
yt-live-chat-text-message-renderer #author-photo img {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
yt-live-chat-text-message-renderer #content {
|
|
width: 100%;
|
|
}
|
|
yt-live-chat-text-message-renderer #menu {
|
|
display: none;
|
|
}
|
|
yt-live-chat-text-message-renderer #chat-badges {
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
gap: 0.2rem !important;
|
|
}
|
|
yt-live-chat-text-message-renderer yt-live-chat-author-chip {
|
|
align-items: unset !important;
|
|
}
|
|
yt-live-chat-text-message-renderer yt-live-chat-author-badge-renderer[type="moderator"] {
|
|
display: block;
|
|
height: 16px;
|
|
width: 16px;
|
|
fill: #5e84f1;
|
|
}
|
|
|
|
`,Mt={version:"v1.0.7",github_homepage:"https://github.com/defaultkavy/youtube-chat-designer",author_link:"https://x.com/defaultkavy"},Z=new Map,Ut=["Normal","Member","Moderator","Owner"],zt=["Message","Name","Avatar","Time","Author Area","Content Area","Outer Area"],hr=["Message","Name","Time"],ur=["Badge","Avatar"],re=new Map,rt=f("view"),K=new dr().css({backgroundColor:"#131313"}).send({name:"ひとり",message:"Hover mouse on the message will show the author role info.",role:"Normal"}).send({name:"郁代",message:"Shift + Left Click on Role list to select multiple role, edit selected role settings in once.",role:"Member"}).send({name:"リョウ",message:"If you want to save your settings, using Copy JSON and save it, you can paste the JSON to recovery your settings.",role:"Moderator"}).send({name:"虹夏",message:"Try to send message for test your design.",role:"Owner"});be();const qt=f("app").content([f("h1").content(["YouTube Chat Designer",f("span").content(Mt.version),f("a").content("GitHub").href(Mt.github_homepage).target("_blank"),f("a").content("@defaultkavy").href(Mt.author_link).target("_blank")]),f("div").class("content").content([f("div").class("console").content([f("div").class("menu").content([f("div").class("action-row").content([f("div").class("role-list").content([f("button").content("ROLE").on("click",()=>{const e=f("::.role-checkbox"),t=!e.find(r=>r.checked()===!1);e.slice(t?1:0).forEach(r=>r.checked(!t)),ae()}),f("div").content([Ut.map(e=>[f("div").class("role").content(t=>[f("input").class("role-checkbox").type("checkbox").value(e).id(e.toLowerCase()).on("input",ae),f("label").content(e).for(e.toLowerCase()).on("click",r=>{const o=f("::.role-checkbox"),i=t.$(`input#${e.toLowerCase()}`),s=o.filter(n=>n.checked()).length>1;if(r.shiftKey)return s?void 0:i.checked()?r.preventDefault():void 0;if(i.checked()&&!s)return r.preventDefault();i.checked()&&s&&r.preventDefault(),o.forEach(n=>{n.id()!==e.toLowerCase()&&n.checked(!1)})})])])])]),f("div").class("button-list").content([f("div").class("button-group").content([f("span").content("JSON"),f("button").content("Paste").self(e=>{let t;e.on("click",async r=>{const o=await navigator.clipboard.readText();try{const i=JSON.parse(o);be(i)}catch{e.content("Error!").class("error").removeClass("done"),t&&clearTimeout(t),t=setTimeout(()=>{e.removeClass("error").content("Paste"),t=void 0},3e3);return}xe(),e.content("Pasted!").class("done").removeClass("error"),t&&clearTimeout(t),t=setTimeout(()=>{e.removeClass("done").content("Paste"),t=void 0},3e3)})}),f("button").content("Copy").self(e=>{let t;e.on("click",r=>{navigator.clipboard.writeText(JSON.stringify(pr())),e.content("Copied!").class("done"),t&&clearTimeout(t),t=setTimeout(()=>{e.removeClass("done").content("Copy"),t=void 0},3e3)})})]),f("div").class("button-group").content([f("span").content("CSS"),f("button").content("Copy").self(e=>{let t;e.on("click",r=>{navigator.clipboard.writeText(cr()),e.content("Copied!").class("done"),t&&clearTimeout(t),t=setTimeout(()=>{e.removeClass("done").content("Copy"),t=void 0},3e3)})})])])]),f("div").class("element-list").content(e=>[zt.map(t=>f("button").staticClass("element-button").content(t).on("click",(r,o)=>rt.switchView(t)).self(r=>{rt.event.on("switch",o=>{o!==t?r.removeClass("active"):r.addClass("active")})}).on("mouseenter",r=>{K.showHint(t)}))]).on("mouseleave",e=>{K.hideHint()})]),rt]),f("div").class("preview").content([f("header").content([f("h2").content("YouTube Chat Preview"),new Ct("ytchat-background-color").label("Background Color").value("#131313").on("input",(e,t)=>{K.css({backgroundColor:t.$color.value()})})]),K,f("div").class("input-panel").content([f("div").content([f("select").id("role-select").add([Ut.map(e=>f("option").content(e).value(e))]),f("input").id("username").placeholder("User Name")]),f("div").content([f("textarea").id("message-input").attribute("placeholder","Type here...").on("keydown",e=>{e.key==="Enter"&&(e.preventDefault(),de())}),f("button").content("Send").on("click",e=>{de()})])])])])]);f(document.body).content(qt);xe();window.addEventListener("resize",()=>mr());function be(e=ne){Z.clear();for(const t of Ut){const r=new Map;Z.set(t,r);for(const o of zt){const i=gr(e[t][o]??ne[t][o]??fe),s=new nr(i);r.set(o,s),K.updateStyle(o,s,[t])}}rt.deleteAllView().clear();for(const t of zt){const r=new sr(t,hr.includes(t)?"text":ur.includes(t)?"image":"element");re.set(t,r),rt.setView(t,r)}}function xe(){rt.switchView("Message"),f("::.role-checkbox")?.forEach(e=>e.checked(!1)),f(":#normal")?.checked(!0),re.forEach(e=>e.update().layout())}function ae(){re.forEach(e=>e.layout())}function de(){const e=f(":#message-input").value().trim();e!==""&&(K.send({name:f(":#username").value(),message:e,role:f(":#role-select").value()}),K.dom.scrollTop=K.dom.scrollHeight)}function cr(){let e=lr;for(const[r,o]of Z)for(const[i,s]of o){let n=r==="Normal"?"yt-live-chat-text-message-renderer":`yt-live-chat-text-message-renderer[author-type="${r.toLowerCase()}"]`;switch(i){case"Message":n+=" #message";break;case"Name":n+=" #author-name ";break;case"Badge":n+=" #chat-bagdes";break;case"Avatar":n+=" #author-photo";break;case"Author Area":n+=" yt-live-chat-author-clip";break;case"Content Area":n+=" #content";break;case"Time":n+=" #timestamp";break}let a="";for(const[l,d]of Object.entries(s.data))a+=` ${t(l)}: ${d} !important;
|
|
`;e+=`${n} {
|
|
${a}
|
|
}
|
|
|
|
`}return e;function t(r){return r.replaceAll(/[A-Z]/g,o=>`-${o.toLowerCase()}`)}}function pr(){const e={};for(const[t,r]of Z.entries()){const o={};for(const[i,s]of r.entries())o[i]=s.data;e[t]=o}return e}function mr(){innerWidth<700?f(document.body).content(f("div").content([`Please use a screen with a width greeter than 700px. Current width: ${innerWidth}px`])):qt.inDOM()||f(document.body).content(qt)}function gr(e){switch(void 0){case e.gap:e.gap="0px";case e.float:e.float="none"}return e}
|