/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/control-panel@1.3.4/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var EventEmitter=require("events").EventEmitter,inherits=require("inherits"),fs=require("fs"),css=require("dom-css"),insertcss=require("insert-css"),path=require("path"),isstring=require("is-string"),themes=require("./themes"),uuid=require("node-uuid");function Plate(e,t){if(!(this instanceof Plate))return new Plate(e,t);var n=this;(t=t||{}).width=t.width||300,t.theme=t.theme||"dark",t.theme=isstring(t.theme)?themes[t.theme]:t.theme,t.root=t.root||document.body,t.position=t.position;var r=document.createElement("div"),s=uuid.v4();r.className="control-panel",r.id="control-panel-"+s;var o=fs.readFileSync(path.join(__dirname,"components","styles","base.css")),i=fs.readFileSync(path.join(__dirname,"components","styles","color.css")),c=fs.readFileSync(path.join(__dirname,"components","styles","range.css")),p=fs.readFileSync(path.join(__dirname,"components","styles","checkbox.css")),a=fs.readFileSync(path.join(__dirname,"components","styles","multibox.css")),l=fs.readFileSync(path.join(__dirname,"components","styles","button.css")),g=fs.readFileSync(path.join(__dirname,"components","styles","interval.css")),m=fs.readFileSync(path.join(__dirname,"components","styles","select.css"));c=String(c).replace(new RegExp("{{ THUMB_COLOR }}","g"),t.theme.foreground1).replace(new RegExp("{{ TRACK_COLOR }}","g"),t.theme.background2).replace(new RegExp("{{ UUID }}","g"),s),p=String(p).replace(new RegExp("{{ BOX_COLOR }}","g"),t.theme.background2).replace(new RegExp("{{ ICON_COLOR }}","g"),t.theme.foreground1).replace(new RegExp("{{ UUID }}","g"),s),a=String(a).replace(new RegExp("{{ BOX_COLOR }}","g"),t.theme.background2).replace(new RegExp("{{ ICON_COLOR }}","g"),t.theme.foreground1).replace(new RegExp("{{ UUID }}","g"),s),l=String(l).replace(new RegExp("{{ BUTTON_COLOR }}","g"),t.theme.text2).replace(new RegExp("{{ BUTTON_BG }}","g"),t.theme.background2).replace(new RegExp("{{ BUTTON_COLOR_HOVER }}","g"),t.theme.text2).replace(new RegExp("{{ BUTTON_BG_HOVER }}","g"),t.theme.background2hover).replace(new RegExp("{{ BUTTON_COLOR_ACTIVE }}","g"),t.theme.background2).replace(new RegExp("{{ BUTTON_BG_ACTIVE }}","g"),t.theme.text2).replace(new RegExp("{{ UUID }}","g"),s),g=String(g).replace(new RegExp("{{ INTERVAL_COLOR }}","g"),t.theme.foreground1).replace(new RegExp("{{ TRACK_COLOR }}","g"),t.theme.background2).replace(new RegExp("{{ UUID }}","g"),s),m=String(m).replace(new RegExp("{{ TEXT_COLOR }}","g"),t.theme.text2).replace(new RegExp("{{ BG_COLOR }}","g"),t.theme.background2).replace(new RegExp("{{ BG_COLOR_HOVER }}","g"),t.theme.background2hover).replace(new RegExp("{{ UUID }}","g"),s),insertcss(o),insertcss(c),insertcss(i),insertcss(p),insertcss(a),insertcss(l),insertcss(g),insertcss(m);var h=document.createElement("style");h.setAttribute("type","text/css"),h.setAttribute("rel","stylesheet"),h.setAttribute("href","//cdn.jsdelivr.net/font-hack/2.019/css/hack.min.css"),document.getElementsByTagName("head")[0].appendChild(h),css(r,{background:t.theme.background1,width:t.width,padding:"14px",paddingBottom:"8px",opacity:.95}),"top-right"!==t.position&&"top-left"!==t.position&&"bottom-right"!==t.position&&"bottom-left"!==t.position||css(r,{position:"absolute"}),"top-right"===t.position||"bottom-right"===t.position?css(r,{right:8}):css(r,{left:8}),"top-right"===t.position||"top-left"===t.position?css(r,{top:8}):css(r,{bottom:8}),t.title&&require("./components/title")(r,t.title,t.theme);var u,d={button:require("./components/button"),text:require("./components/text"),range:require("./components/range"),checkbox:require("./components/checkbox"),multibox:require("./components/multibox"),color:require("./components/color"),interval:require("./components/interval"),select:require("./components/select")},R={};e.forEach((function(e){"button"!==e.type&&(R[e.label]=e.initial)})),e.forEach((function(e){(u=d[e.type](r,e,t.theme,s)).on("initialized",(function(t){R[e.label]=t})),u.on("input",(function(t){R[e.label]=t,n.emit("input",R)}))})),n.state=R,t.root.appendChild(r)}module.exports=Plate,inherits(Plate,EventEmitter);
//# sourceMappingURL=/sm/e475c69f690aaa2eadb73700dc4fd59723b99d2ca7c314fe02b0aa2ba38f82ef.map