sigpro 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- function x(p,l="tags"){let a=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","truespeed"]),i=(r)=>r.replace(/"/g,"\\\""),m=(r)=>{let c=[...r.attributes].map(({name:e,value:n})=>/^on/i.test(e)?`${e}: (e) => { ${n.replace(/\s+/g," ").trim()} }`:a.has(e.toLowerCase())&&(!n||n==e)?`${e}: true`:`${e}: "${i(n)}"`);return c.length?`{ ${c.join(", ")} }`:""},s=(r,c=0)=>{let e=" ".repeat(c);if(r.nodeType==3){let n=r.textContent;return n.trim()?`${e}"${i(n)}"`:""}if(r.nodeType==1){let n=r.tagName.toLowerCase(),d=m(r),o=l==="core"?`h('${n}'`:n,t=[...r.childNodes].map((f)=>s(f,c+1)).filter(Boolean),g=!!d;if(l==="core"){if(!t.length)return g?`${e}${o}, ${d})`:`${e}${o})`;if(t.length===1&&!t[0].includes(`
2
- `))return g?`${e}${o}, ${d}, ${t[0].trim()})`:`${e}${o}, ${t[0].trim()})`;return g?`${e}${o}, ${d},
3
- ${t.join(`,
1
+ function x(p,u="tags"){let d=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","truespeed"]),l=(r)=>r.replace(/"/g,"\\\""),a=(r)=>{let g=[...r.attributes].map(({name:e,value:t})=>/^on/i.test(e)?`${e}: (e) => { ${t.replace(/\s+/g," ").trim()} }`:d.has(e.toLowerCase())&&(!t||t==e)?`${e}: true`:`${e}: "${l(t)}"`);return g.length?`{ ${g.join(", ")} }`:""},c=(r,g=0)=>{let e=" ".repeat(g);if(r.nodeType==3){let t=r.textContent;return t.trim()?`${e}"${l(t)}"`:""}if(r.nodeType==1){let t=r.tagName.toLowerCase(),n=a(r),i=u==="core"?`h('${t}'`:t,o=[...r.childNodes].map((f)=>c(f,g+1)).filter(Boolean),m=!!n;if(u==="core"){if(!o.length)return m?`${e}${i}, ${n})`:`${e}${i})`;if(o.length===1&&!o[0].includes(`
2
+ `))return m?`${e}${i}, ${n}, ${o[0].trim()})`:`${e}${i}, ${o[0].trim()})`;return m?`${e}${i}, ${n},
3
+ ${o.join(`,
4
4
  `)}
5
- ${e})`:`${e}${o},
6
- ${t.join(`,
5
+ ${e})`:`${e}${i},
6
+ ${o.join(`,
7
7
  `)}
8
- ${e})`}else{if(!t.length)return g?`${e}${o}(${d})`:`${e}${o}`;if(t.length===1&&!t[0].includes(`
9
- `))return g?`${e}${o}(${d}, ${t[0].trim()})`:`${e}${o}(${t[0].trim()})`;return g?`${e}${o}(${d},
10
- ${t.join(`,
8
+ ${e})`}else{if(!o.length)return m?`${e}${i}(${n})`:`${e}${i}`;if(o.length===1&&!o[0].includes(`
9
+ `))return m?`${e}${i}(${n}, ${o[0].trim()})`:`${e}${i}(${o[0].trim()})`;return m?`${e}${i}(${n},
10
+ ${o.join(`,
11
11
  `)}
12
- ${e})`:`${e}${o}(
13
- ${t.join(`,
12
+ ${e})`:`${e}${i}(
13
+ ${o.join(`,
14
14
  `)}
15
- ${e})`}}return""},u=[...new DOMParser().parseFromString(p,"text/html").body.childNodes].map((r)=>s(r)).filter(Boolean);return u.length==1?u[0].trim():`
16
- ${u.join(`,
15
+ ${e})`}}return""},s=[...new DOMParser().parseFromString(p,"text/html").body.childNodes].map((r)=>c(r)).filter(Boolean);return s.length==1?s[0].trim():`
16
+ ${s.join(`,
17
17
  `)}
18
- `}var h=()=>{let{signal:p}=window.SigPro,l=p(""),a=p(""),i=p("tags"),m=p(""),s=()=>{try{a(x(l(),i()))}catch(e){a("Error: "+e.message)}m(l())},u=()=>{l(""),a(""),i("tags"),m("")},r="width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical",c="padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px";return div({style:"margin:20px auto;font-family:sans-serif"},h1("HTML → SigPro"),div({style:"margin-bottom:10px"},div({style:"display:flex;gap:20px;flex-wrap:wrap;margin-top:5px"},label({style:"display:flex;align-items:center;gap:6px"},"Core",input({type:"radio",name:"mode",value:"core",checked:()=>i()==="core",onchange:(e)=>{if(e.target.checked)i("core"),s()}}),span("core — h('tag', props, ...)")),label({style:"display:flex;align-items:center;gap:6px"},"Tags",input({type:"radio",name:"mode",value:"tags",checked:()=>i()==="tags",onchange:(e)=>{if(e.target.checked)i("tags"),s()}}),span("tags — tag({ props }, ...)")))),div({style:"margin-top:15px;display:flex;gap:10px"},button({style:"padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px;background:#3b82f6;color:#fff",onclick:s},"Convert"),button({style:"padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px;background:#d1d5db",onclick:u},"Clear")),div({style:"display:grid;grid-template-columns:1fr;gap:15px;margin-top:15px;width:100%"},div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},label({style:"font-weight:bold;margin-bottom:8px"},"HTML Input"),textarea({style:"width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical",placeholder:"Paste your HTML here...",value:l,oninput:(e)=>{l(e.target.value),s()}})),div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},div({style:"display:flex;justify-content:space-between;align-items:center;margin-bottom:8px"},span({style:"font-weight:bold"},"SigPro Output"),button({style:"padding:4px 8px;background:#10b981;color:white;border:none;border-radius:4px;cursor:pointer;font-size:12px",onclick:()=>{navigator.clipboard.writeText(a()),alert("Copied!")}},"Copy")),textarea({style:"width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical;background:#f9fafb",readonly:!0,value:a,placeholder:"Converted code will appear here..."})),div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},label({style:"font-weight:bold;margin-bottom:8px"},"Live Preview"),iframe({style:"width:100%;height:200px;border:1px solid #e2e8f0;border-radius:4px;background:white;",srcdoc:()=>{return`
18
+ `}var h=()=>{let{signal:p,effect:u}=window.SigPro,d=p(""),l=p(""),a=p("tags"),c=p(""),s=()=>{try{l(x(d(),a()))}catch(t){l("Error: "+t.message)}c(d())},r=()=>{d(""),l(""),a("tags"),c("")},g="width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical",e="padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px";return div({style:"margin:20px auto;font-family:sans-serif"},h1("HTML → SigPro"),div({style:"margin-bottom:10px"},div({style:"display:flex;gap:20px;flex-wrap:wrap;margin-top:5px"},label({style:"display:flex;align-items:center;gap:6px"},"Core",input({type:"radio",name:"mode",value:"core",checked:()=>a()==="core",onchange:(t)=>{if(t.target.checked)a("core"),s()}}),span("core — h('tag', props, ...)")),label({style:"display:flex;align-items:center;gap:6px"},"Tags",input({type:"radio",name:"mode",value:"tags",checked:()=>a()==="tags",onchange:(t)=>{if(t.target.checked)a("tags"),s()}}),span("tags — tag({ props }, ...)")))),div({style:"margin-top:15px;display:flex;gap:10px"},button({style:"padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px;background:#3b82f6;color:#fff",onclick:s},"Convert"),button({style:"padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-right:8px;font-size:14px;background:#d1d5db",onclick:r},"Clear")),div({style:"display:grid;grid-template-columns:1fr;gap:15px;margin-top:15px;width:100%"},div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},label({style:"font-weight:bold;margin-bottom:8px"},"HTML Input"),textarea({style:"width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical",placeholder:"Paste your HTML here...",value:d,oninput:(t)=>{d(t.target.value),s()}})),div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},div({style:"display:flex;justify-content:space-between;align-items:center;margin-bottom:8px"},span({style:"font-weight:bold"},"SigPro Output"),button({style:"padding:4px 8px;background:#10b981;color:white;border:none;border-radius:4px;cursor:pointer;font-size:12px",onclick:()=>{navigator.clipboard.writeText(l()),alert("Copied!")}},"Copy")),textarea({style:"width:100%;height:200px;padding:10px;border:1px solid #ccc;border-radius:4px;font-family:monospace;font-size:14px;box-sizing:border-box;resize:vertical;background:#f9fafb",readonly:!0,value:l,placeholder:"Converted code will appear here..."})),div({style:"border:1px solid #ccc;border-radius:8px;padding:10px;display:flex;flex-direction:column"},label({style:"font-weight:bold;margin-bottom:8px"},"Live Preview"),iframe({style:"width:100%;height:200px;border:1px solid #e2e8f0;border-radius:4px;background:white;",ref:(t)=>u(()=>{let n=c()||"";t.srcdoc=`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
@@ -28,7 +28,7 @@ ${u.join(`,
28
28
  </style>
29
29
  </head>
30
30
  <body>
31
- ${m()||""}
31
+ ${n}
32
32
  </body>
33
33
  </html>
34
- `},sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-modals"}))))};window.html2sigpro=x;window.converter=h;
34
+ `}),sandbox:"allow-same-origin allow-scripts allow-popups allow-forms allow-modals"}))))};window.html2sigpro=x;window.converter=h;
@@ -1 +1 @@
1
- function Y({update:e,notify:t,unwatched:i}){return{link:u,unlink:f,propagate:v,checkDirty:m,shallowPropagate:g};function u(l,n,s){let p=n.depsTail;if(p!==void 0&&p.dep===l)return;let o=p!==void 0?p.nextDep:n.deps;if(o!==void 0&&o.dep===l){o.version=s,n.depsTail=o;return}let d=l.subsTail;if(d!==void 0&&d.version===s&&d.sub===n)return;let b=n.depsTail=l.subsTail={version:s,dep:l,sub:n,prevDep:p,nextDep:o,prevSub:d,nextSub:void 0};if(o!==void 0)o.prevDep=b;if(p!==void 0)p.nextDep=b;else n.deps=b;if(d!==void 0)d.nextSub=b;else l.subs=b}function f(l,n=l.sub){let{dep:s,prevDep:p,nextDep:o,nextSub:d,prevSub:b}=l;if(o!==void 0)o.prevDep=p;else n.depsTail=p;if(p!==void 0)p.nextDep=o;else n.deps=o;if(d!==void 0)d.prevSub=b;else s.subsTail=b;if(b!==void 0)b.nextSub=d;else if((s.subs=d)===void 0)i(s);return o}function v(l,n){let s=l.nextSub,p;e:do{let o=l.sub,d=o.flags;if(!(d&60)){if(o.flags=d|32,n)o.flags|=8}else if(!(d&12))d=0;else if(!(d&4))o.flags=d&-9|32;else if(!(d&48)&&c(l,o))o.flags=d|8|32,d&=1;else d=0;if(d&2)t(o);if(d&1){let b=o.subs;if(b!==void 0){let T=(l=b).nextSub;if(T!==void 0)p={value:s,prev:p},s=T;continue}}if((l=s)!==void 0){s=l.nextSub;continue}while(p!==void 0)if(l=p.value,p=p.prev,l!==void 0){s=l.nextSub;continue e}break}while(!0)}function m(l,n){let s,p=0,o=!1;e:do{let d=l.dep,b=d.flags;if(n.flags&16)o=!0;else if((b&17)===17){let T=d.subs;if(e(d)){if(T.nextSub!==void 0)g(T);o=!0}}else if((b&33)===33){s={value:l,prev:s},l=d.deps,n=d,++p;continue}if(!o){let T=l.nextDep;if(T!==void 0){l=T;continue}}while(p--){if(l=s.value,s=s.prev,o){let h=n.subs;if(e(n)){if(h.nextSub!==void 0)g(h);n=l.sub;continue}o=!1}else n.flags&=-33;n=l.sub;let T=l.nextDep;if(T!==void 0){l=T;continue e}}return o&&!!n.flags}while(!0)}function g(l){do{let n=l.sub,s=n.flags;if((s&48)===32){if(n.flags=s|16,(s&6)===2)t(n)}}while((l=l.nextSub)!==void 0)}function c(l,n){let s=n.depsTail;while(s!==void 0){if(s===l)return!0;s=s.prevDep}return!1}}var q=0,N=0,Z=0,L=0,C=0,w,S=[],{link:z,unlink:O,propagate:ee,checkDirty:te,shallowPropagate:ie}=Y({update(e){if("getter"in e)return le(e);if("currentValue"in e)return $(e);return e.flags=1,!0},notify(e){let t=C,i=t;do if(S[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);C=t;while(i<--t){let u=S[i];S[i++]=S[t],S[t]=u}},unwatched(e){if("getter"in e){if(e.depsTail!==void 0)e.flags=17,J(e)}else if("currentValue"in e);else if("fn"in e)G.call(e);else R.call(e)}});function k(e){return re.bind({currentValue:e,pendingValue:e,subs:void 0,subsTail:void 0,flags:1})}function A(e){let t={fn:e,cleanup:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:6},i=w;if(w=t,i!==void 0)z(t,i,0),i.flags|=64;try{++N;let u=t.fn();t.cleanup=typeof u==="function"?u:void 0}finally{--N,w=i,t.flags&=-5}return G.bind(t)}function F(e){let t={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:1},i=w;if(w=t,i!==void 0)z(t,i,0),i.flags|=64;try{e()}finally{w=i}return R.bind(t)}function le(e){if(e.flags&64){let i=e.depsTail;while(i!==void 0){let{prevDep:u,dep:f}=i;if(!("getter"in f)&&!("currentValue"in f))O(i,e);i=u}}e.depsTail=void 0,e.flags=5;let t=w;w=e;try{++q;let i=e.value;return!Object.is(i,e.value=e.getter(i))}finally{w=t,e.flags&=-5,K(e)}}function $(e){return e.flags=1,!Object.is(e.currentValue,e.currentValue=e.pendingValue)}function ne(e){let t=e.flags;if(t&16||t&32&&te(e.deps,e)){if(t&64){let u=e.depsTail;while(u!==void 0){let{prevDep:f,dep:v}=u;if(!("getter"in v)&&!("currentValue"in v))O(u,e);u=f}}if(e.cleanup){if(I(e),!e.flags)return}e.depsTail=void 0,e.flags=6;let i=w;w=e;try{++q,++N;let u=e.fn();e.cleanup=typeof u==="function"?u:void 0}finally{--N,w=i,e.flags&=-5,K(e)}}else if(e.deps!==void 0)e.flags=2|t&64}function oe(){try{while(L<C){let e=S[L];S[L++]=void 0,ne(e)}}finally{while(L<C){let e=S[L];S[L++]=void 0,e.flags|=10}if(L=0,C=0,S.length>64)S.length=64}}function re(...e){if(e.length){if(!Object.is(this.pendingValue,this.pendingValue=e[0])){this.flags=17;let t=this.subs;if(t!==void 0){if(ee(t,!!N),!Z)oe()}}}else{if(this.flags&16){if($(this)){let i=this.subs;if(i!==void 0)ie(i)}}let t=w;if(t!==void 0)z(this,t,q);return this.currentValue}}function I(e){let t=e.cleanup;e.cleanup=void 0;let i=w;w=void 0;try{t()}finally{w=i}}function G(){if(R.call(this),this.cleanup)I(this)}function R(){this.flags=0,J(this);let e=this.subs;if(e!==void 0)O(e)}function J(e){let t=e.depsTail;while(t!==void 0){let i=t.prevDep;O(t,e),t=i}}function K(e){let t=e.depsTail,i=t!==void 0?t.nextDep:e.deps;while(i!==void 0)i=O(i,e)}var D=typeof document<"u"?document:null,se="http://www.w3.org/2000/svg",ae=new Set("svg path circle rect line polyline polygon g defs text textPath tspan use symbol image marker ellipse foreignObject clipPath mask linearGradient radialGradient pattern filter stop animate animateMotion animateTransform view desc metadata title switch feGaussianBlur feOffset feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feImage feMerge feMergeNode feMorphology fePointLight feSpecularLighting feSpotLight feTile feTurbulence".split(" "));function M(e,t,i,u){if(t==="class"||t==="className"){if(u)if(i==null||i===!1)e.removeAttribute("class");else e.setAttribute("class",i===!0?"":i);else e.className=i??"";return}if(i==null||i===!1){if(t==="style")e._lastStyle=void 0;e.removeAttribute(t);return}if(t==="style"){let f=e._lastStyle;if(typeof i==="string"){if(f!==void 0)e.removeAttribute("style"),e._lastStyle=void 0;e.setAttribute("style",i);return}if(typeof i==="object"){if(f===void 0&&e.hasAttribute("style"))e.removeAttribute("style");if(f){for(let v in f)if(!(v in i))e.style.removeProperty(v)}for(let v in i){let m=i[v];if(m==null||m===!1)e.style.removeProperty(v);else e.style.setProperty(v,String(m))}e._lastStyle=i;return}}if(u){e.setAttribute(t,i===!0?"":i);return}if(t in e&&typeof e[t]!=="function")e[t]=i;else e.setAttribute(t,i===!0?"":i)}function fe(e){let t=[e];while(t.length){let i=t.pop();if(i._stopScope)i._stopScope(),i._stopScope=null;if(i._cln){for(let f of i._cln)f();i._cln=null}let u=i.childNodes;for(let f=0,v=u.length;f<v;f++)t.push(u[f])}}function P(e,t={},...i){if(typeof e==="function"){let g,c=F(()=>{g=e(t,i)}),l=(n)=>{if(n instanceof Node)n._stopScope=c;else if(Array.isArray(n))n.forEach(l)};return l(g),g}if(t instanceof Node||Array.isArray(t)||t!==null&&typeof t!=="object"||t===void 0)i=[t,...i],t={};let u=ae.has(e),f=u?D.createElementNS(se,e):D.createElement(e),v,m=!1;for(let g of Object.keys(t||{})){let c=t[g];if(g==="ref"){if(typeof c==="function")c(f);else if(c!=null&&typeof c==="object")c.current=f;continue}if(e==="select"&&g==="value"){v=c;continue}if(g==="html"){if(m=!0,typeof c==="function"){let l;A(()=>{let n=c()??"";if(n!==l)f.innerHTML=n,l=n})}else f.innerHTML=c??"";continue}if(g.startsWith("on")&&typeof c==="function"){let l=g.slice(2).toLowerCase();f.addEventListener(l,c),(f._cln||(f._cln=[])).push(()=>f.removeEventListener(l,c))}else if(typeof c==="function")A(()=>M(f,g,c(),u));else M(f,g,c,u)}if(!m){let g=(c)=>{if(Array.isArray(c)){for(let l of c)g(l);return}if(c==null||c===!1||c===!0)return;if(typeof c==="function"){let l=D.createComment("");f.appendChild(l),A(()=>{let n=c(),s=Array.isArray(n)?n:[n],p=[];for(let o of s){if(o==null||o===!1||o===!0)continue;p.push(o instanceof Node?o:D.createTextNode(String(o)))}for(let o of p)f.insertBefore(o,l);return()=>{for(let o of p)fe(o),o.remove()}});return}f.appendChild(c instanceof Node?c:D.createTextNode(String(c)))};g(i)}if(v!==void 0)if(typeof v==="function")A(()=>M(f,"value",v(),u));else M(f,"value",v,u);return f}var ue="a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup table tbody td template textarea tfoot th thead time tr u ul video",Q=(e=typeof window<"u"?window:null)=>{if(!e)return;for(let t of ue.split(" "))e[t]=(i,...u)=>P(t,i,...u)},H=k(typeof window<"u"?window.location.hash.slice(1)||"/":"/"),de=k({});if(typeof window<"u")window.addEventListener("hashchange",()=>{H(window.location.hash.slice(1)||"/")});var W=new Map,V=k(0);if(typeof window<"u")window.__sigpro_hmr_page__=(e,t)=>{W.set(e,t),V(V()+1)};var U=(e)=>()=>{let t=P("div",{class:"router-hook"}),i,u,f,v=A(()=>{V();let m=H(),g=m.split("/").filter(Boolean),c=e.find((s)=>{let p=s.path.split("/").filter(Boolean);return p.length===g.length&&p.every((o,d)=>o[0]===":"||o===g[d])})||e.find((s)=>s.path==="*");if(!c){if(i)i(),i=void 0;t.replaceChildren(),u=f=void 0;return}let l={};c.path.split("/").filter(Boolean).forEach((s,p)=>{if(s[0]===":")l[s.slice(1)]=g[p]});let n=W.get(c.path)??c.component;if(m===u&&n===f)return;if(u=m,f=n,i)i();de(l),i=F(()=>{let s=typeof n==="function"?P(n,l):n,p=s==null?[]:Array.isArray(s)?s:[s];t.replaceChildren(...p)})});return t._stopScope=()=>{if(i)i();v()},t};U.to=(e)=>{if(typeof window<"u")window.location.hash=e.replace(/^#?\/?/,"#/")};U.back=()=>{if(typeof window<"u")window.history.back()};U.path=()=>H();var ce=k("en");Q();var X=(e)=>typeof e==="function",ve=(e)=>{let{value:t,class:i}=e,u=k(0),f=k(""),v=k(0),m=k(0),g=k(0),c=()=>window.getSelection().rangeCount?window.getSelection().getRangeAt(0):0,l,n,s="\uD83D\uDE00 \uD83D\uDE0A \uD83D\uDE09 \uD83E\uDDD0 \uD83D\uDE2E \uD83E\uDD14 \uD83D\uDE05 \uD83D\uDE02 \uD83D\uDE0D \uD83D\uDE18 \uD83E\uDD70 \uD83D\uDC4D \uD83D\uDC4E \uD83D\uDC4C \uD83E\uDD1D \uD83E\uDD1E \uD83D\uDC4B \uD83D\uDC4F \uD83D\uDE4C \uD83D\uDE4F \uD83D\uDCAA ☝️ \uD83D\uDC47 \uD83D\uDC48 \uD83D\uDC49 \uD83D\uDD95 ✅ ⚠️ \uD83D\uDE80 \uD83D\uDCE2 ✉️ ❤️".split(" "),p=()=>{m(m()+1),l&&v(l.innerText.length)},o=()=>{if(l){let r=l.innerHTML;X(t)?t(r):e.onchange?.(r),p()}},d=(r,x=null)=>{if(l?.focus(),n){let y=window.getSelection();y.removeAllRanges(),y.addRange(n)}document.execCommand(r,0,x),n=0,o()},b=(r,x=null)=>{if(m(),!l||u())return 0;try{if(r=="formatBlock"){let y=window.getSelection().getRangeAt(0).commonAncestorContainer;while(y&&y!==l){if(y.tagName===x)return 1;y=y.parentNode}return 0}return document.queryCommandState(r)}catch(y){return 0}},T=(r)=>{if(r){let x=new FileReader;x.onload=(y)=>{let j=r.type.startsWith("image/"),E=y.target.result;d("insertHTML",j?div({style:"display:inline-block;resize:both;overflow:hidden;vertical-align:bottom;width:200px;border:1px dashed #ccc;padding:2px;cursor:pointer",class:"resizable-img-container"},[img({src:E,style:"width:100%;height:100%;object-fit:contain;pointer-events:none"})]):a({href:E,download:r.name,contenteditable:"false",style:"display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border:1px solid #ccc;border-radius:4px;background:#f9f9f9;text-decoration:none;color:#333;font-size:12px;margin:2px;cursor:pointer"},[span({class:"icon-[lucide--paperclip] w-3 h-3"}),r.name]))},x.readAsDataURL(r)}},h=(r,x,y)=>button({type:"button",class:()=>`btn btn-ghost btn-xs ${b(x,y)?"btn-active bg-primary/20":""}`,onclick:()=>typeof x=="function"?x():d(x,y)},[span({class:`icon-[lucide--${r}]`})]);return div({class:`border border-base-300 rounded-box bg-base-100 overflow-hidden flex flex-col ${i||""}`},[div({class:"flex flex-wrap items-center gap-1 p-2 border-b border-base-300 bg-base-200 sticky top-0 z-20"},[div({class:"flex flex-wrap gap-1 flex-1"},[h("bold","bold"),h("italic","italic"),h("underline","underline"),input({type:"color",class:"w-5 h-5 p-0 bg-transparent cursor-pointer",oninput:(r)=>d("foreColor",r.target.value)}),span({class:"w-px h-5 bg-base-300 mx-1"}),h("align-left","justifyLeft"),h("align-center","justifyCenter"),h("align-right","justifyRight"),span({class:"w-px h-5 bg-base-300 mx-1"}),h("list","insertUnorderedList"),h("list-ordered","insertOrderedList"),h("indent-decrease","outdent"),h("indent-increase","indent"),h("quote",()=>d("formatBlock",b("formatBlock","BLOCKQUOTE")?"P":"BLOCKQUOTE"),"BLOCKQUOTE"),span({class:"w-px h-5 bg-base-300 mx-1"}),h("link",()=>{let r=prompt("URL:");r&&d("createLink",r)}),h("paperclip",()=>{let r=document.createElement("input");r.type="file",r.onchange=(x)=>T(x.target.files[0]),r.click()}),div({class:"relative"},[h("smile",()=>{n=c(),g(!g())}),div({class:"absolute top-full left-0 mt-1 p-2 bg-base-100 border shadow-xl rounded-box w-52 z-50 flex flex-wrap gap-1",style:()=>g()?"":"display:none"},s.map((r)=>span({class:"cursor-pointer p-1 text-lg",onclick:()=>{d("insertText",r),g(0)}},r)))]),h("undo-2","undo"),h("redo-2","redo")]),h("code-2",()=>{if(!u())f(l?.innerHTML||"");else if(l)l.innerHTML=f(),o();u(!u())})]),div({class:"relative flex-1 flex flex-col",onclick:()=>g(0)},[div({ref:(r)=>{if(r&&!l)l=r,r.innerHTML=(X(t)?t():t)||"",document.execCommand("defaultParagraphSeparator",0,"br"),r.onclick=(x)=>{let y=x.target.closest(".resizable-img-container");if(y){let j=y.querySelector("img");j&&((E)=>{let _=document.createElement("div");_.style="position:fixed;top:0;left:0;width:100%;height:100%;background:#000e;z-index:9999;display:flex;align-items:center;justify-content:center;cursor:zoom-out",_.onclick=()=>_.remove();let B=document.createElement("img");B.src=E,B.style="max-width:95%;max-height:95%",_.appendChild(B),document.body.appendChild(_)})(j.src)}}},style:()=>`min-height:22rem;${u()?"display:none":""}`,class:"p-4 outline-none text-base-content leading-relaxed [&>div]:m-0 [&>p]:m-0 [&>div]:min-h-[1em] [&_.resizable-img-container]:hover:border-primary [&_blockquote]:border-l-4 [&_blockquote]:border-base-300 [&_blockquote]:pl-4 [&_blockquote]:italic [&_ul]:list-disc [&_ul]:pl-8 [&_ol]:list-decimal [&_ol]:pl-8",contenteditable:"true",oninput:o,onkeydown:(r)=>r.key==="Tab"&&(r.preventDefault(),d("indent")),onkeyup:()=>{p(),n=c()},onmouseup:o,onpaste:(r)=>{r.preventDefault(),d("insertText",r.clipboardData.getData("text/plain"))},ondrop:(r)=>{r.preventDefault(),T(r.dataTransfer.files[0])},ondragover:(r)=>r.preventDefault()}),textarea({class:"w-full flex-1 min-h-[22rem] p-4 font-mono text-sm bg-base-200 border-0",style:()=>u()?"":"display:none",value:f,oninput:(r)=>{if(f(r.target.value),l)l.innerHTML=r.target.value;e.onchange?.(r.target.value)}})]),div({class:"px-3 py-1 border-t text-[10px] text-right opacity-60"},[span(()=>v())])])};export{ve as Editor};
1
+ function Y({update:e,notify:t,unwatched:i}){return{link:d,unlink:f,propagate:v,checkDirty:g,shallowPropagate:s};function d(l,o,u){let p=o.depsTail;if(p!==void 0&&p.dep===l)return;let n=p!==void 0?p.nextDep:o.deps;if(n!==void 0&&n.dep===l){n.version=u,o.depsTail=n;return}let c=l.subsTail;if(c!==void 0&&c.version===u&&c.sub===o)return;let y=o.depsTail=l.subsTail={version:u,dep:l,sub:o,prevDep:p,nextDep:n,prevSub:c,nextSub:void 0};if(n!==void 0)n.prevDep=y;if(p!==void 0)p.nextDep=y;else o.deps=y;if(c!==void 0)c.nextSub=y;else l.subs=y}function f(l,o=l.sub){let{dep:u,prevDep:p,nextDep:n,nextSub:c,prevSub:y}=l;if(n!==void 0)n.prevDep=p;else o.depsTail=p;if(p!==void 0)p.nextDep=n;else o.deps=n;if(c!==void 0)c.prevSub=y;else u.subsTail=y;if(y!==void 0)y.nextSub=c;else if((u.subs=c)===void 0)i(u);return n}function v(l,o){let u=l.nextSub,p;e:do{let n=l.sub,c=n.flags;if(!(c&60)){if(n.flags=c|32,o)n.flags|=8}else if(!(c&12))c=0;else if(!(c&4))n.flags=c&-9|32;else if(!(c&48)&&h(l,n))n.flags=c|8|32,c&=1;else c=0;if(c&2)t(n);if(c&1){let y=n.subs;if(y!==void 0){let T=(l=y).nextSub;if(T!==void 0)p={value:u,prev:p},u=T;continue}}if((l=u)!==void 0){u=l.nextSub;continue}while(p!==void 0)if(l=p.value,p=p.prev,l!==void 0){u=l.nextSub;continue e}break}while(!0)}function g(l,o){let u,p=0,n=!1;e:do{let c=l.dep,y=c.flags;if(o.flags&16)n=!0;else if((y&17)===17){let T=c.subs;if(e(c)){if(T.nextSub!==void 0)s(T);n=!0}}else if((y&33)===33){u={value:l,prev:u},l=c.deps,o=c,++p;continue}if(!n){let T=l.nextDep;if(T!==void 0){l=T;continue}}while(p--){if(l=u.value,u=u.prev,n){let b=o.subs;if(e(o)){if(b.nextSub!==void 0)s(b);o=l.sub;continue}n=!1}else o.flags&=-33;o=l.sub;let T=l.nextDep;if(T!==void 0){l=T;continue e}}return n&&!!o.flags}while(!0)}function s(l){do{let o=l.sub,u=o.flags;if((u&48)===32){if(o.flags=u|16,(u&6)===2)t(o)}}while((l=l.nextSub)!==void 0)}function h(l,o){let u=o.depsTail;while(u!==void 0){if(u===l)return!0;u=u.prevDep}return!1}}var R=0,A=0,Z=0,C=0,D=0,w,S=[],{link:q,unlink:N,propagate:ee,checkDirty:te,shallowPropagate:ie}=Y({update(e){if("getter"in e)return le(e);if("currentValue"in e)return $(e);return e.flags=1,!0},notify(e){let t=D,i=t;do if(S[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);D=t;while(i<--t){let d=S[i];S[i++]=S[t],S[t]=d}},unwatched(e){if("getter"in e){if(e.depsTail!==void 0)e.flags=17,W(e)}else if("currentValue"in e);else if("fn"in e)G.call(e);else U.call(e)}});function k(e){return re.bind({currentValue:e,pendingValue:e,subs:void 0,subsTail:void 0,flags:1})}function B(e){let t={fn:e,cleanup:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:6},i=w;if(w=t,i!==void 0)q(t,i,0),i.flags|=64;try{++A;let d=t.fn();t.cleanup=typeof d==="function"?d:void 0}finally{--A,w=i,t.flags&=-5}return G.bind(t)}function H(e){let t={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:1},i=w;if(w=t,i!==void 0)q(t,i,0),i.flags|=64;try{e()}finally{w=i}return U.bind(t)}function le(e){if(e.flags&64){let i=e.depsTail;while(i!==void 0){let{prevDep:d,dep:f}=i;if(!("getter"in f)&&!("currentValue"in f))N(i,e);i=d}}e.depsTail=void 0,e.flags=5;let t=w;w=e;try{++R;let i=e.value;return!Object.is(i,e.value=e.getter(i))}finally{w=t,e.flags&=-5,J(e)}}function $(e){return e.flags=1,!Object.is(e.currentValue,e.currentValue=e.pendingValue)}function ne(e){let t=e.flags;if(t&16||t&32&&te(e.deps,e)){if(t&64){let d=e.depsTail;while(d!==void 0){let{prevDep:f,dep:v}=d;if(!("getter"in v)&&!("currentValue"in v))N(d,e);d=f}}if(e.cleanup){if(I(e),!e.flags)return}e.depsTail=void 0,e.flags=6;let i=w;w=e;try{++R,++A;let d=e.fn();e.cleanup=typeof d==="function"?d:void 0}finally{--A,w=i,e.flags&=-5,J(e)}}else if(e.deps!==void 0)e.flags=2|t&64}function oe(){try{while(C<D){let e=S[C];S[C++]=void 0,ne(e)}}finally{while(C<D){let e=S[C];S[C++]=void 0,e.flags|=10}if(C=0,D=0,S.length>64)S.length=64}}function re(...e){if(e.length){if(!Object.is(this.pendingValue,this.pendingValue=e[0])){this.flags=17;let t=this.subs;if(t!==void 0){if(ee(t,!!A),!Z)oe()}}}else{if(this.flags&16){if($(this)){let i=this.subs;if(i!==void 0)ie(i)}}let t=w;if(t!==void 0)q(this,t,R);return this.currentValue}}function I(e){let t=e.cleanup;e.cleanup=void 0;let i=w;w=void 0;try{t()}finally{w=i}}function G(){if(U.call(this),this.cleanup)I(this)}function U(){this.flags=0,W(this);let e=this.subs;if(e!==void 0)N(e)}function W(e){let t=e.depsTail;while(t!==void 0){let i=t.prevDep;N(t,e),t=i}}function J(e){let t=e.depsTail,i=t!==void 0?t.nextDep:e.deps;while(i!==void 0)i=N(i,e)}var _=typeof document<"u"?document:null,se="http://www.w3.org/2000/svg",ae=new Set("svg path circle rect line polyline polygon g defs text textPath tspan use symbol image marker ellipse foreignObject clipPath mask linearGradient radialGradient pattern filter stop animate animateMotion animateTransform view desc metadata title switch feGaussianBlur feOffset feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feImage feMerge feMergeNode feMorphology fePointLight feSpecularLighting feSpotLight feTile feTurbulence".split(" ")),fe=new Set(["allowFullscreen","async","autofocus","autoplay","checked","controls","defer","disabled","formNoValidate","hidden","inert","loop","multiple","muted","noValidate","open","playsInline","readOnly","required","reversed","selected"]);function E(e,t,i,d){let f=t.toLowerCase();if(f==="innerhtml"||f==="outerhtml"||f==="srcdoc")return;if(f.startsWith("on")&&i!=null&&i!==!1)return;if(/^(href|src|action|formaction|poster|data|xlink:href)$/i.test(t)&&i!=null&&i!==!1){if(typeof i!=="string")return;try{let v=new URL(i,"https://placeholder.invalid/").protocol,g=v==="data:"&&f==="src"&&/^(img|source|video|audio|track|input)$/i.test(e.tagName)&&/^data:image\/(png|jpe?g|gif|webp|avif|bmp);/i.test(i.trim());if(!/^(https?|mailto|tel|blob):$/.test(v)&&!g)return}catch{return}}if(t==="class"||t==="className"){if(d)if(i==null||i===!1)e.removeAttribute("class");else e.setAttribute("class",i===!0?"":i);else e.className=i??"";return}if(fe.has(t)&&!d&&t in e){let v=i!=null&&i!==!1;if(e[t]=v,v)e.setAttribute(t,"");else e.removeAttribute(t);return}if(i==null||i===!1){if(t==="style")e._lastStyle=void 0;e.removeAttribute(t);return}if(t==="style"){let v=e._lastStyle;if(typeof i==="string"){if(v!==void 0)e.removeAttribute("style"),e._lastStyle=void 0;e.setAttribute("style",i);return}if(typeof i==="object"){if(v){for(let g in v)if(!(g in i))if(g.startsWith("--"))e.style.removeProperty(g);else e.style[g]=""}for(let g in i){let s=i[g];if(g.startsWith("--"))if(s==null||s===!1)e.style.removeProperty(g);else e.style.setProperty(g,String(s));else e.style[g]=s==null||s===!1?"":String(s)}e._lastStyle=i;return}}if(d){e.setAttribute(t,i===!0?"":i);return}if(t in e&&typeof e[t]!=="function")e[t]=i;else e.setAttribute(t,i===!0?"":i)}function ue(e){let t=[e];while(t.length){let i=t.pop();if(i._stopScope)i._stopScope(),i._stopScope=null;if(i._cln){for(let f of i._cln)f();i._cln=null}let d=i.childNodes;for(let f=0,v=d.length;f<v;f++)t.push(d[f])}}function M(e,t={},...i){if(typeof e==="function"){let s,h=H(()=>{s=e(t,i)}),l=(o)=>{if(o instanceof Node)o._stopScope=h;else if(Array.isArray(o))o.forEach(l)};return l(s),s}if(t instanceof Node||Array.isArray(t)||t!==null&&typeof t!=="object")i=[t,...i],t={};let d=ae.has(e),f=d?_.createElementNS(se,e):_.createElement(e),v;for(let s of Object.keys(t||{})){let h=t[s];if(s==="ref"){if(typeof h==="function")h(f);else if(h!=null&&typeof h==="object")h.current=f;continue}if(e==="select"&&s==="value"){v=h;continue}if(s.startsWith("on")&&typeof h==="function"){let l=s.slice(2).toLowerCase();f.addEventListener(l,h),(f._cln||(f._cln=[])).push(()=>f.removeEventListener(l,h))}else if(typeof h==="function")B(()=>E(f,s,h(),d));else E(f,s,h,d)}let g=(s)=>{if(Array.isArray(s)){for(let h of s)g(h);return}if(s==null||s===!1||s===!0)return;if(typeof s==="function"){let h=_.createComment("");f.appendChild(h);let l=B(()=>{let o=s(),u=Array.isArray(o)?o:[o],p=[];for(let n of u){if(n==null||n===!1||n===!0)continue;p.push(n instanceof Node?n:_.createTextNode(String(n)))}for(let n of p)f.insertBefore(n,h);return()=>{for(let n of p)ue(n),n.remove()}});(f._cln||(f._cln=[])).push(l);return}f.appendChild(s instanceof Node?s:_.createTextNode(String(s)))};if(g(i),v!==void 0)if(typeof v==="function")B(()=>E(f,"value",v(),d));else E(f,"value",v,d);return f}var de="a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup table tbody td template textarea tfoot th thead time tr u ul video",K=(e=typeof window<"u"?window:null)=>{if(!e)return;for(let t of de.split(" "))e[t]=(i,...d)=>M(t,i,...d)},z=k(typeof window<"u"?window.location.hash.slice(1)||"/":"/"),ce=k({});if(typeof window<"u")window.addEventListener("hashchange",()=>{z(window.location.hash.slice(1)||"/")});var Q=new Map,V=k(0);if(typeof window<"u")window.__sigpro_hmr_page__=(e,t)=>{Q.set(e,t),V(V()+1)};var F=(e)=>()=>{e=[...e].sort((g,s)=>(g.path==="*")-(s.path==="*")||g.path.split("/").filter((h)=>h[0]===":").length-s.path.split("/").filter((h)=>h[0]===":").length);let t=M("div",{class:"router-hook"}),i,d,f,v=B(()=>{V();let g=z(),s=g.split(/[?#]/)[0].split("/").filter(Boolean),h=e.find((u)=>{let p=u.path.split("/").filter(Boolean);return p.length===s.length&&p.every((n,c)=>n[0]===":"||n===s[c])})||e.find((u)=>u.path==="*");if(!h){if(i)i(),i=void 0;t.replaceChildren(),d=f=void 0;return}let l={};h.path.split("/").filter(Boolean).forEach((u,p)=>{if(u[0]===":")l[u.slice(1)]=s[p]});let o=Q.get(h.path)??h.component;if(g===d&&o===f)return;if(d=g,f=o,i)i();ce(l),i=H(()=>{let u=typeof o==="function"?M(o,l):o,p=u==null?[]:Array.isArray(u)?u:[u];t.replaceChildren(...p)})});return t._stopScope=()=>{if(i)i();v()},t};F.to=(e)=>{if(typeof window<"u")window.location.hash=e.replace(/^#?\/?/,"#/")};F.back=()=>{if(typeof window<"u")window.history.back()};F.path=()=>z();var pe=k("en");K();var X=(e)=>typeof e==="function",ve=(e)=>{let{value:t,class:i}=e,d=k(0),f=k(""),v=k(0),g=k(0),s=k(0),h=()=>window.getSelection().rangeCount?window.getSelection().getRangeAt(0):0,l,o,u="\uD83D\uDE00 \uD83D\uDE0A \uD83D\uDE09 \uD83E\uDDD0 \uD83D\uDE2E \uD83E\uDD14 \uD83D\uDE05 \uD83D\uDE02 \uD83D\uDE0D \uD83D\uDE18 \uD83E\uDD70 \uD83D\uDC4D \uD83D\uDC4E \uD83D\uDC4C \uD83E\uDD1D \uD83E\uDD1E \uD83D\uDC4B \uD83D\uDC4F \uD83D\uDE4C \uD83D\uDE4F \uD83D\uDCAA ☝️ \uD83D\uDC47 \uD83D\uDC48 \uD83D\uDC49 \uD83D\uDD95 ✅ ⚠️ \uD83D\uDE80 \uD83D\uDCE2 ✉️ ❤️".split(" "),p=()=>{g(g()+1),l&&v(l.innerText.length)},n=()=>{if(l){let r=l.innerHTML;X(t)?t(r):e.onchange?.(r),p()}},c=(r,x=null)=>{if(l?.focus(),o){let m=window.getSelection();m.removeAllRanges(),m.addRange(o)}document.execCommand(r,0,x),o=0,n()},y=(r,x=null)=>{if(g(),!l||d())return 0;try{if(r=="formatBlock"){let m=window.getSelection().getRangeAt(0).commonAncestorContainer;while(m&&m!==l){if(m.tagName===x)return 1;m=m.parentNode}return 0}return document.queryCommandState(r)}catch(m){return 0}},T=(r)=>{if(r){let x=new FileReader;x.onload=(m)=>{let O=r.type.startsWith("image/"),j=m.target.result;c("insertHTML",O?div({style:"display:inline-block;resize:both;overflow:hidden;vertical-align:bottom;width:200px;border:1px dashed #ccc;padding:2px;cursor:pointer",class:"resizable-img-container"},[img({src:j,style:"width:100%;height:100%;object-fit:contain;pointer-events:none"})]):a({href:j,download:r.name,contenteditable:"false",style:"display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border:1px solid #ccc;border-radius:4px;background:#f9f9f9;text-decoration:none;color:#333;font-size:12px;margin:2px;cursor:pointer"},[span({class:"icon-[lucide--paperclip] w-3 h-3"}),r.name]))},x.readAsDataURL(r)}},b=(r,x,m)=>button({type:"button",class:()=>`btn btn-ghost btn-xs ${y(x,m)?"btn-active bg-primary/20":""}`,onclick:()=>typeof x=="function"?x():c(x,m)},[span({class:`icon-[lucide--${r}]`})]);return div({class:`border border-base-300 rounded-box bg-base-100 overflow-hidden flex flex-col ${i||""}`},[div({class:"flex flex-wrap items-center gap-1 p-2 border-b border-base-300 bg-base-200 sticky top-0 z-20"},[div({class:"flex flex-wrap gap-1 flex-1"},[b("bold","bold"),b("italic","italic"),b("underline","underline"),input({type:"color",class:"w-5 h-5 p-0 bg-transparent cursor-pointer",oninput:(r)=>c("foreColor",r.target.value)}),span({class:"w-px h-5 bg-base-300 mx-1"}),b("align-left","justifyLeft"),b("align-center","justifyCenter"),b("align-right","justifyRight"),span({class:"w-px h-5 bg-base-300 mx-1"}),b("list","insertUnorderedList"),b("list-ordered","insertOrderedList"),b("indent-decrease","outdent"),b("indent-increase","indent"),b("quote",()=>c("formatBlock",y("formatBlock","BLOCKQUOTE")?"P":"BLOCKQUOTE"),"BLOCKQUOTE"),span({class:"w-px h-5 bg-base-300 mx-1"}),b("link",()=>{let r=prompt("URL:");r&&c("createLink",r)}),b("paperclip",()=>{let r=document.createElement("input");r.type="file",r.onchange=(x)=>T(x.target.files[0]),r.click()}),div({class:"relative"},[b("smile",()=>{o=h(),s(!s())}),div({class:"absolute top-full left-0 mt-1 p-2 bg-base-100 border shadow-xl rounded-box w-52 z-50 flex flex-wrap gap-1",style:()=>s()?"":"display:none"},u.map((r)=>span({class:"cursor-pointer p-1 text-lg",onclick:()=>{c("insertText",r),s(0)}},r)))]),b("undo-2","undo"),b("redo-2","redo")]),b("code-2",()=>{if(!d())f(l?.innerHTML||"");else if(l)l.innerHTML=f(),n();d(!d())})]),div({class:"relative flex-1 flex flex-col",onclick:()=>s(0)},[div({ref:(r)=>{if(r&&!l)l=r,r.innerHTML=(X(t)?t():t)||"",document.execCommand("defaultParagraphSeparator",0,"br"),r.onclick=(x)=>{let m=x.target.closest(".resizable-img-container");if(m){let O=m.querySelector("img");O&&((j)=>{let L=document.createElement("div");L.style="position:fixed;top:0;left:0;width:100%;height:100%;background:#000e;z-index:9999;display:flex;align-items:center;justify-content:center;cursor:zoom-out",L.onclick=()=>L.remove();let P=document.createElement("img");P.src=j,P.style="max-width:95%;max-height:95%",L.appendChild(P),document.body.appendChild(L)})(O.src)}}},style:()=>`min-height:22rem;${d()?"display:none":""}`,class:"p-4 outline-none text-base-content leading-relaxed [&>div]:m-0 [&>p]:m-0 [&>div]:min-h-[1em] [&_.resizable-img-container]:hover:border-primary [&_blockquote]:border-l-4 [&_blockquote]:border-base-300 [&_blockquote]:pl-4 [&_blockquote]:italic [&_ul]:list-disc [&_ul]:pl-8 [&_ol]:list-decimal [&_ol]:pl-8",contenteditable:"true",oninput:n,onkeydown:(r)=>r.key==="Tab"&&(r.preventDefault(),c("indent")),onkeyup:()=>{p(),o=h()},onmouseup:n,onpaste:(r)=>{r.preventDefault(),c("insertText",r.clipboardData.getData("text/plain"))},ondrop:(r)=>{r.preventDefault(),T(r.dataTransfer.files[0])},ondragover:(r)=>r.preventDefault()}),textarea({class:"w-full flex-1 min-h-[22rem] p-4 font-mono text-sm bg-base-200 border-0",style:()=>d()?"":"display:none",value:f,oninput:(r)=>{if(f(r.target.value),l)l.innerHTML=r.target.value;e.onchange?.(r.target.value)}})]),div({class:"px-3 py-1 border-t text-[10px] text-right opacity-60"},[span(()=>v())])])};export{ve as Editor};