import{c as J,a as c,d as R,f as m,e as W}from"./8V7BUHOp.js";import{f as L,p as j,J as C,a as D,c as x,g as l,b as E,r as k,e as d,s as N,t as y}from"./CwuLZfOX.js";import{s as z}from"./CaaTB9LM.js";import{i as P}from"./ChcH33Yj.js";import{I as G,f as H,r as K,a as I,g as O,h as Q}from"./_j5m0PhM.js";import{b as U}from"./Bn6k3L-0.js";import{l as X,s as Y,p as V}from"./CNkT2fMe.js";import{a as Z,m as tt}from"./Bv7jGDQ6.js";import"./Ct62Q5nz.js";function et(o,a){const _=X(a,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.511.0 - ISC
 *
 * ISC License
 *
 * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */const u=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];G(o,Y({name:"pencil"},()=>_,{get iconNode(){return u},children:(g,v)=>{var p=J(),s=L(p);H(s,a,"default",{}),c(g,p)},$$slots:{default:!0}}))}var at=(o,a)=>d(a,o.target.value,!0),rt=(o,a)=>o.key==="Enter"&&a(),ot=m("<span> </span>"),st=m("<input/> <!>",1),nt=m("<span> </span>"),it=m('<button type="button"> <!> <!></button>'),lt=m('<div class="relative group editable-container"><!></div>');function ht(o,a){j(a,!0);let _=V(a,"topic",3,"App/Name"),u=V(a,"unit",3,""),g=V(a,"font",3,"text-2xl lg:text-xl"),v=new Z(_()),p=E(!1),s=E(""),h=E(null),w=!1;C(()=>{window.addEventListener("virtual-keypress",()=>{w=!0,setTimeout(()=>w=!1,200)})});function M(){d(p,!0),d(s,v.value,!0),setTimeout(()=>{var t;(t=l(h))==null||t.focus()},0)}function B(){var r;d(p,!1);const t=l(s).trim();t!==v.value&&(v.value=t,tt.publish(_(),t)),(r=l(h))==null||r.blur()}var $=lt(),S=x($);{var q=t=>{var r=st(),e=L(r);K(e),e.__input=[at,s],e.__keydown=[rt,B],U(e,n=>d(h,n),()=>l(h));var b=N(e,2);{var T=n=>{var i=ot(),f=x(i,!0);k(i),y(()=>z(f,u())),c(n,i)};P(b,n=>{u().length>0&&n(T)})}y(()=>{I(e,1,`input ${g()??""} font-bold tracking-tighter`),O(e,`max-width: ${l(s).length*12+50}px;`),Q(e,l(s))}),W("blur",e,()=>{w||B()}),c(t,r)},A=t=>{var r=it();r.__click=M;var e=x(r),b=N(e);{var T=i=>{var f=nt(),F=x(f,!0);k(f),y(()=>z(F,u())),c(i,f)};P(b,i=>{u().length>0&&i(T)})}var n=N(b,2);et(n,{class:"inline-block opacity-0 group-hover:opacity-100 transition-opacity",strokeWidth:"1",size:"16"}),k(r),y(()=>{I(r,1,`${g()??""} font-bold tracking-tighter cursor-pointer focus:outline-none`),z(e,`${v.value??""} `)}),c(t,r)};P(S,t=>{l(p)?t(q):t(A,!1)})}k($),c(o,$),D()}R(["input","keydown","click"]);export{et as P,ht as T};
