"use strict";var visualEditOverlay=(()=>{var V=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var Oe=(e,t)=>{for(var o in t)V(e,o,{get:t[o],enumerable:!0})},we=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of De(t))!_e.call(e,a)&&a!==o&&V(e,a,{get:()=>t[a],enumerable:!(n=Le(t,a))||n.enumerable});return e};var Pe=e=>we(V({},"__esModule",{value:!0}),e);var ze={};Oe(ze,{CONFIG:()=>L,activateDebugMode:()=>G,badgeManager:()=>b,blockInteractiveEvent:()=>ie,deactivateDebugMode:()=>U,handleBadgeReposition:()=>_,init:()=>re,setInteractionMode:()=>j,state:()=>r});var h={MODE_ACTIVATED:"DEBUG_MODE_ACTIVATED",MODE_DEACTIVATED:"DEBUG_MODE_DEACTIVATED",ELEMENT_SELECTED:"ELEMENT_SELECTED",ELEMENT_DESELECTED:"ELEMENT_DESELECTED",CHANGES_ERROR:"CHANGES_ERROR",INTERACTION_MODE_CHANGED:"INTERACTION_MODE_CHANGED",INLINE_EDIT_START:"INLINE_EDIT_START",INLINE_EDIT_CHANGE:"INLINE_EDIT_CHANGE",INLINE_EDIT_END:"INLINE_EDIT_END",INLINE_EDIT_ERROR:"INLINE_EDIT_ERROR"},C={ACTIVATE:"ACTIVATE",DEACTIVATE:"DEACTIVATE",CLEAR_SELECTION:"CLEAR_SELECTION",APPLY_CHANGES:"APPLY_CHANGES",SET_INTERACTION_MODE:"SET_INTERACTION_MODE",ENABLE_INLINE_EDIT:"ENABLE_INLINE_EDIT",DISABLE_INLINE_EDIT:"DISABLE_INLINE_EDIT",FOCUS_ELEMENT:"FOCUS_ELEMENT",SET_ANNOTATION_MARKERS:"SET_ANNOTATION_MARKERS"},O={SITE_DEBUG:"SITE_DEBUG",DEBUG_COMMAND:"DEBUG_COMMAND"};var w=class{constructor(){this.GAP=8,this.VIEWPORT_PADDING=8,this.removalTimeouts=new Map}createBadge(t,o="hover"){let n=document.createElement("div");return n.className=`debug-badge ${o}`,n.textContent=t,n.style.opacity="0",n.setAttribute("role","tooltip"),n.setAttribute("aria-live","polite"),n.id=`debug-badge-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,document.body.appendChild(n),n}calculatePosition(t,o){let n=t.getBoundingClientRect();if(n.top===0&&n.left===0&&n.bottom===0&&n.right===0){let s=t.parentElement;for(;s;){let E=s.getBoundingClientRect();if(E.top!==0||E.left!==0||E.bottom!==0||E.right!==0){n=E;break}s=s.parentElement}}let a=o.getBoundingClientRect(),l=[{side:"top",calc:()=>({top:n.top-a.height-this.GAP,left:n.left-4.5}),fits:s=>s.top>=this.VIEWPORT_PADDING},{side:"bottom",calc:()=>({top:n.bottom+this.GAP,left:n.left-4.5}),fits:s=>s.top+a.height<=window.innerHeight-this.VIEWPORT_PADDING},{side:"left",calc:()=>({top:n.top,left:n.left-a.width-this.GAP}),fits:s=>s.left>=this.VIEWPORT_PADDING},{side:"right",calc:()=>({top:n.top,left:n.right+this.GAP}),fits:s=>s.left+a.width<=window.innerWidth-this.VIEWPORT_PADDING}];for(let s of l){let E=s.calc();if((s.side==="top"||s.side==="bottom")&&(E.left+a.width>window.innerWidth-this.VIEWPORT_PADDING&&(E.left=window.innerWidth-a.width-this.VIEWPORT_PADDING),E.left<this.VIEWPORT_PADDING&&(E.left=this.VIEWPORT_PADDING)),(s.side==="left"||s.side==="right")&&(E.top+a.height>window.innerHeight-this.VIEWPORT_PADDING&&(E.top=window.innerHeight-a.height-this.VIEWPORT_PADDING),E.top<this.VIEWPORT_PADDING&&(E.top=this.VIEWPORT_PADDING)),s.fits(E))return{...E,side:s.side}}let p=l[0].calc();return{top:Math.max(this.VIEWPORT_PADDING,Math.min(p.top,window.innerHeight-a.height-this.VIEWPORT_PADDING)),left:Math.max(this.VIEWPORT_PADDING,Math.min(p.left,window.innerWidth-a.width-this.VIEWPORT_PADDING)),side:"constrained"}}positionBadge(t,o,n=!0){let a=this.calculatePosition(t,o);o.style.top=`${a.top}px`,o.style.left=`${a.left}px`,o.dataset.side=a.side,n&&requestAnimationFrame(()=>{o.style.opacity="1"})}showHoverBadge(t,o,n=!1){let a=n?"dynamic":"hover",l=this.createBadge(o,a);return this.positionBadge(t,l),l}showSelectedBadge(t,o,n=!1){let a=n?"selected-dynamic":"selected",l=this.createBadge(o,a);return this.positionBadge(t,l),l}removeBadge(t){if(t&&(this.removalTimeouts.has(t)&&(clearTimeout(this.removalTimeouts.get(t)),this.removalTimeouts.delete(t)),t.parentElement)){t.style.opacity="0";let o=setTimeout(()=>{t.parentElement&&t.parentElement.removeChild(t),this.removalTimeouts.delete(t)},150);this.removalTimeouts.set(t,o)}}cleanup(){this.removalTimeouts.forEach(t=>clearTimeout(t)),this.removalTimeouts.clear(),document.querySelectorAll(".debug-badge").forEach(t=>{t.parentElement&&t.parentElement.removeChild(t)})}updateBadgePosition(t,o){o&&t&&this.positionBadge(t,o,!1)}};function se(e){if(document.getElementById("visual-edit-overlay-styles"))return;let t=document.createElement("style");t.id="visual-edit-overlay-styles",t.textContent=`
    /* Hover state - dotted lines (editable elements) */
    [data-debug-hover]:not([data-debug-selected]):not([data-debug-dynamic]) {
        outline: 2px dotted #5288CC !important;
        outline-offset: 2px !important;
    }

    /* Hover state for dynamic elements (not editable) - orange/warning color */
    [data-debug-hover][data-debug-dynamic]:not([data-debug-selected]) {
        outline: 2px dotted #FF8C42 !important;
        outline-offset: 2px !important;
    }

    /* Expression span hover \u2014 override display:contents so outline is visible */
    [data-debug-hover][data-ve-dynamic] {
        display: inline !important;
        outline: 2px dotted #5288CC !important;
        outline-offset: 1px !important;
    }

    /* Expression span selected \u2014 override display:contents so outline is visible */
    [data-debug-selected][data-ve-dynamic] {
        display: inline !important;
        outline: 1.5px solid #2764EB !important;
        outline-offset: 1px !important;
    }

    /* Selected state - solid lines */
    [data-debug-selected]:not([data-debug-dynamic]) {
        outline: 1.5px solid #2764EB !important;
        outline-offset: 3px !important;
        box-shadow: 0 0 0 1px rgba(39, 100, 235, 0.3), inset 0 0 0 999px rgba(39, 100, 235, 0.05) !important;
    }

    /* Selected state for dynamic elements - orange solid */
    [data-debug-selected][data-debug-dynamic] {
        outline: 1.5px solid #FF8C42 !important;
        outline-offset: 3px !important;
        box-shadow: 0 0 0 1px rgba(255, 140, 66, 0.3), inset 0 0 0 999px rgba(255, 140, 66, 0.05) !important;
    }

    /* Badge element styles (created dynamically in JS) */
    .debug-badge {
        position: fixed;
        z-index: ${e};
        pointer-events: none;
        padding: 4px 6px 4px 22px;
        border-radius: 6px;
        font-size: 11px;
        font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        font-weight: bold;
        white-space: nowrap;
        background-repeat: no-repeat;
        background-position: 4px center;
        background-size: 14px 14px;
        transition: top 0.15s ease-out, left 0.15s ease-out, opacity 0.15s ease-out;
    }

    /* Numbered annotation pins (created dynamically in JS, driven by the parent's annotation list).
       Comment-bubble glyph from Figma: #0B7CFF fill, white rim, white number, layered drop shadow. */
    .ve-annotation-marker {
        position: absolute;
        z-index: ${e};
        width: 28px;
        height: 28px;
        /* Anchor on the recorded click point (the circle center sits at the box center; the tail is
           a nub below it). drop-shadow follows the bubble + tail outline. */
        transform: translate(-50%, -50%);
        /* Clickable: a click opens that change's edit popup. */
        pointer-events: auto;
        cursor: pointer;
        user-select: none;
        transition: transform 0.1s ease-out;
        filter:
            drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.23))
            drop-shadow(0 5px 2.5px rgba(0, 0, 0, 0.2))
            drop-shadow(0 10px 3px rgba(0, 0, 0, 0.12));
    }

    .ve-annotation-marker:hover {
        transform: translate(-50%, -50%) scale(1.12);
    }

    .ve-annotation-marker__bubble {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
    }

    .ve-annotation-marker__label {
        position: absolute;
        /* Centered on the circle (= the box center; the tail sits below). */
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: rgba(255, 255, 255, 0.95);
        font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        font-size: 13px;
        font-weight: 700;
        line-height: 1;
        font-feature-settings: "cv05" 1, "cv10" 1, "cv11" 1;
    }

    /* Badge variants */
    .debug-badge.hover {
        background-color: #DBEAFE;
        border: 1px solid #B5CBF6;
        color: #1E4ED8;
        background-image: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.93934 1.06066L7 0L8.06066 1.06066L12.9393 5.93934L14 7L12.9393 8.06066L8.06066 12.9393L7 14L5.93934 12.9393L1.06066 8.06066L0 7L1.06066 5.93934L5.93934 1.06066ZM2.12132 7L7 11.8787L11.8787 7L7 2.12132L2.12132 7Z" fill="%231E4ED8"/></svg>');
    }

    .debug-badge.dynamic {
        background-color: #FFF5E6;
        border: 1px solid #FFCC99;
        color: #CC5500;
        background-image: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 0L8.5 5.5L14 7L8.5 8.5L7 14L5.5 8.5L0 7L5.5 5.5L7 0Z" fill="%23CC5500"/></svg>');
    }

    .debug-badge.selected {
        background-color: #1E4ED8;
        border: 1px solid #1E4ED8;
        color: white;
        background-image: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.93934 1.06066L7 0L8.06066 1.06066L12.9393 5.93934L14 7L12.9393 8.06066L8.06066 12.9393L7 14L5.93934 12.9393L1.06066 8.06066L0 7L1.06066 5.93934L5.93934 1.06066ZM2.12132 7L7 11.8787L11.8787 7L7 2.12132L2.12132 7Z" fill="white"/></svg>');
    }

    .debug-badge.selected-dynamic {
        background-color: #FF8C42;
        border: 1px solid #FF8C42;
        color: white;
        background-image: url('data:image/svg+xml;utf8,<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 0L8.5 5.5L14 7L8.5 8.5L7 14L5.5 8.5L0 7L5.5 5.5L7 0Z" fill="white"/></svg>');
    }

    /* Ensure debug badges are always visible */
    .debug-badge {
        pointer-events: none !important;
        display: block !important;
    }
  `,document.head.appendChild(t)}var i={FILE_NAME:"x-file-name",LINE_NUMBER:"x-line-number",COLUMN:"x-column",COMPONENT:"x-component",ID:"x-id",DYNAMIC:"x-dynamic",EXCLUDED:"x-excluded",SOURCE_TYPE:"x-source-type",SOURCE_VAR:"x-source-var",SOURCE_FILE:"x-source-file",SOURCE_FILE_ABS:"x-source-file-abs",SOURCE_LINE:"x-source-line",SOURCE_PATH:"x-source-path",SOURCE_EDITABLE:"x-source-editable",ARRAY_VAR:"x-array-var",ARRAY_FILE:"x-array-file",ARRAY_LINE:"x-array-line",ARRAY_ITEM_PARAM:"x-array-item-param",ARRAY_INLINE:"x-array-inline",VE_DYNAMIC:"data-ve-dynamic"},Be=[i.FILE_NAME,i.LINE_NUMBER,i.COMPONENT];var y={STATIC_LOCAL:"static-local",STATIC_IMPORTED:"static-imported",PROP:"prop",STATE:"state",COMPUTED:"computed",TEMPLATE:"template",EXTERNAL:"external",UNKNOWN:"unknown"},le=new Set([y.STATIC_LOCAL,y.STATIC_IMPORTED]),P=new Set([y.PROP,y.STATE,y.COMPUTED,y.EXTERNAL]);function $(e,t){return P.has(e)?!1:le.has(e)?t==="true":!1}var x={TEXT_CONTENT:"textContent",VARIABLE_EDIT:"variableEdit",READONLY:"readonly",SHARED_SOURCE:"sharedSource",CLASS_NAME:"className",CONTENT:"content"};var W={[i.VE_DYNAMIC]:"true",[i.EXCLUDED]:"true"},X="display:contents";var S="ve-annotation-marker",q="data-ve-marker-id",v=new Map,K=new Map,de=e=>e<0?0:e>1?1:e;function ue(e){return document.querySelector(`[${i.ID}="${CSS.escape(e)}"]`)}function ce(e,t,o){let n=e.getAttribute(i.ID);if(!n)return;let a=e.getBoundingClientRect();a.width<=0||a.height<=0||K.set(n,{fx:de((t-a.left)/a.width),fy:de((o-a.top)/a.height)})}function Ee(e,t,o){let n=t.getBoundingClientRect(),a=K.get(o),l=a?n.left+a.fx*n.width:n.left,p=a?n.top+a.fy*n.height:n.top;e.style.left=`${l+window.scrollX}px`,e.style.top=`${p+window.scrollY}px`}var He='<svg class="ve-annotation-marker__bubble" viewBox="-1 -1 28 28" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M13 26C20.18 26 26 20.18 26 13C26 5.82 20.18 0 13 0C5.82001 0 1.38889e-05 5.82 1.38889e-05 13C-0.00459839 16.1508 1.13968 19.1952 3.21851 21.563L1.00001 26H13Z" fill="#0B7CFF" stroke="#ffffff" stroke-width="1.5" stroke-linejoin="round" /></svg>';function ke(e,t){let o=e.querySelector(`.${S}__label`);o&&(o.textContent=t)}function Ge(e,t){let o=document.createElement("div");o.className=S,o.setAttribute(q,t),o.innerHTML=He;let n=document.createElement("span");return n.className=`${S}__label`,n.textContent=e,o.appendChild(n),document.body.appendChild(o),o}function me(e){let t=Array.isArray(e)?e:[],o=new Set;for(let{elementId:n,label:a}of t){if(!n)continue;let l=ue(n);if(!l)continue;o.add(n);let p=v.get(n);p?ke(p,a):(p=Ge(a,n),v.set(n,p)),Ee(p,l,n)}for(let[n,a]of v)o.has(n)||(a.remove(),v.delete(n))}function pe(){for(let[e,t]of v){let o=ue(e);o&&Ee(t,o,e)}}function fe(){for(let e of v.values())e.remove();v.clear(),K.clear()}function B(e){let t="";for(let o of e.childNodes)o.nodeType===Node.TEXT_NODE&&(t+=o.textContent);return t.trim()}function Z(e){let t=[];return!e||!e.childNodes||e.childNodes.forEach(o=>{if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"";n.trim()&&t.push({type:"text",text:n})}else if(o.nodeType===Node.ELEMENT_NODE){let n=o,a=n.tagName?n.tagName.toLowerCase():"";a==="br"?t.push({type:"dynamic",text:`
`}):n.hasAttribute&&n.hasAttribute("data-ve-dynamic")?t.push({type:"dynamic",text:n.textContent||""}):t.push({type:"element",text:n.textContent||"",tagName:a})}}),t}function ge(e,t){if(t.trim()===t){let o=e.match(/^(\s*)/)[1],n=e.match(/(\s*)$/)[1];return o+t+n}return t}function Te(e){let t=[],o=[];if(e.elementId)try{if(e.isMultiElement){let n=document.querySelectorAll(`[${i.ID}="${CSS.escape(e.elementId)}"]`),a=Array.from(n).filter(Boolean);if(o=a,e.arrayIndex!==void 0&&e.arrayIndex!==null){let l=a[e.arrayIndex];if(l)t=[l];else{A({action:h.CHANGES_ERROR,error:`Element at arrayIndex ${e.arrayIndex} not found`,elementId:e.elementId,arrayIndex:e.arrayIndex});return}}else t=a}else{let n=document.querySelector(`[${i.ID}="${CSS.escape(e.elementId)}"]`);if(!n){A({action:h.CHANGES_ERROR,error:`Element not found: ${i.ID}="${e.elementId}"`,elementId:e.elementId});return}t=[n],o=[n]}}catch(n){A({action:h.CHANGES_ERROR,error:`Invalid element selector: ${n.message}`,elementId:e.elementId});return}else{if(!r.selectedElement){A({action:h.CHANGES_ERROR,error:"No element selected and no elementId provided"});return}t=[r.selectedElement],o=[r.selectedElement]}if(t.length===0){A({action:h.CHANGES_ERROR,error:"No elements found",elementId:e.elementId});return}o.length>0&&o[0].hasAttribute(i.VE_DYNAMIC)&&o[0].getAttribute(i.SOURCE_EDITABLE)==="true"&&(o=o.map(n=>n.parentElement).filter(Boolean));try{t.forEach(n=>{let a=!e.isMultiElement||e.arrayIndex!==void 0&&e.arrayIndex!==null,l=Array.isArray(e.textParts);if((l||e.textContent!==void 0)&&a){let p=n.children&&n.children.length>0;if(l){let s=e.textParts,E=[];for(let d of n.childNodes)d.nodeType===Node.TEXT_NODE&&d.textContent&&d.textContent.trim()&&E.push(d.textContent);if(E.length===s.length){let d=!0;for(let c=0;c<s.length;c++)if(E[c].trim()!==(s[c]||"").trim()){d=!1;break}if(d)return}if(n.querySelector("[data-ve-dynamic]")!==null){let d=Z(n),c=[];for(let u of n.childNodes)u.nodeType===Node.ELEMENT_NODE&&u.hasAttribute&&!u.hasAttribute("data-ve-dynamic")&&c.push(u.cloneNode(!0));for(;n.firstChild;)n.removeChild(n.firstChild);let g=0,N=0;for(let u of d)if(u.type==="text"){let T=s[g]??"";if(g++,T.trim()){let f=document.createTextNode(T);n.appendChild(f)}}else if(u.type==="dynamic"){let T=document.createElement("span");Object.entries(W).forEach(([f,I])=>{T.setAttribute(f,I)}),T.style.cssText=X,T.textContent=u.text,n.appendChild(T)}else u.type==="element"&&N<c.length&&(n.appendChild(c[N]),N++);if(g<s.length)for(let u=g;u<s.length;u++){let T=s[u]??"";if(T.trim()){let f=document.createTextNode(T);n.appendChild(f)}}}else{let d=[];for(let c of n.childNodes)c.nodeType===Node.TEXT_NODE&&c.textContent&&c.textContent.trim()&&d.push(c);for(let c=0;c<Math.min(d.length,s.length);c++)d[c].textContent=ge(d[c].textContent,s[c]??"");if(s.length>d.length)for(let c=d.length;c<s.length;c++){let g=s[c]??"";g.trim()&&n.appendChild(document.createTextNode(g))}if(s.length<d.length)for(let c=s.length;c<d.length;c++)d[c].textContent=""}}else if(!p)n.textContent=e.textContent;else{let s=Array.from(n.childNodes).filter(m=>m.nodeType===Node.TEXT_NODE),E=s.find(m=>m.textContent&&m.textContent.trim().length>0)||s[0];if(E)E.textContent=ge(E.textContent,e.textContent);else{let m=document.createTextNode(e.textContent);n.insertBefore(m,n.firstChild||null)}}}e.id!==void 0&&!e.isMultiElement&&(e.id?n.id=e.id:n.removeAttribute("id"))}),o.forEach(n=>{e.className!==void 0&&(n.className=e.className),e.attributes&&typeof e.attributes=="object"&&Object.entries(e.attributes).forEach(([a,l])=>{a.startsWith("x-")||(l?n.setAttribute(a,l):n.removeAttribute(a))})})}catch(n){A({action:h.CHANGES_ERROR,error:n.message,elementId:e.elementId})}}function H(e){if(e.getAttribute(i.DYNAMIC)==="true")return!0;let t=e.getAttribute(i.ID);return!!(t&&document.querySelectorAll(`[${i.ID}="${CSS.escape(t)}"]`).length>1)}function R(e){let t={isDynamic:!1,isEditable:!0,editType:x.TEXT_CONTENT,sourceInfo:null},o=e.getAttribute(i.DYNAMIC),n=e.getAttribute(i.ID),a=1;if(n&&(a=document.querySelectorAll(`[${i.ID}="${CSS.escape(n)}"]`).length),t.isDynamic=o==="true"||a>1,!t.isDynamic&&e.getAttribute(i.SOURCE_EDITABLE)!=="true")return t;let l=e.getAttribute(i.SOURCE_TYPE),p=e.getAttribute(i.SOURCE_EDITABLE);t.sourceInfo={type:l||null,varName:e.getAttribute(i.SOURCE_VAR)||null,file:e.getAttribute(i.SOURCE_FILE)||null,fileAbs:e.getAttribute(i.SOURCE_FILE_ABS)||null,line:e.getAttribute(i.SOURCE_LINE)||null,path:e.getAttribute(i.SOURCE_PATH)||null,editable:p==="true",arrayVar:e.getAttribute(i.ARRAY_VAR)||null,arrayFile:e.getAttribute(i.ARRAY_FILE)||null,arrayLine:e.getAttribute(i.ARRAY_LINE)||null,itemParam:e.getAttribute(i.ARRAY_ITEM_PARAM)||null,arrayInline:e.getAttribute(i.ARRAY_INLINE)||null};let s=Array.from(e.children||[]).some(d=>d.hasAttribute&&d.hasAttribute(i.VE_DYNAMIC)),E=Array.from(e.childNodes||[]).some(d=>d.nodeType===Node.TEXT_NODE&&d.textContent.trim());if(s&&E)return t.sourceInfo?.arrayVar?(t.isEditable=!1,t.editType=x.READONLY,t):(t.isEditable=!0,t.editType=x.TEXT_CONTENT,t);if(p==="true"?(t.isEditable=!0,t.editType=x.VARIABLE_EDIT):l&&$(l,p??void 0)?(t.isEditable=!0,t.editType=x.VARIABLE_EDIT):l&&P.has(l)?(t.isEditable=!1,t.editType=x.READONLY):l===y.STATIC_LOCAL||l===y.STATIC_IMPORTED?(t.isEditable=!1,t.editType=x.READONLY):(t.isEditable=!1,t.editType=x.READONLY),t.isEditable&&t.sourceInfo){let d=Ue(e);d.isShared&&(t.isEditable=!1,t.editType=x.SHARED_SOURCE,t.sourceInfo.isSharedSource=!0,t.sourceInfo.sharedCount=d.sharedCount)}return t}function Ue(e){let t=e.getAttribute(i.SOURCE_VAR),o=e.getAttribute(i.SOURCE_FILE_ABS),n=e.getAttribute(i.SOURCE_PATH),a=e.getAttribute(i.ARRAY_VAR),l=e.getAttribute(i.ARRAY_FILE),p=e.getAttribute(i.ID);if(!t)return{isShared:!1,sharedCount:0};let s=0,E=new Set,m=e.parentElement;for(;m;){let u=m.getAttribute(i.ID);u&&E.add(u),m=m.parentElement}let d=null,c=null,g=e.parentElement;for(;g;){let u=g.getAttribute(i.ID);if(u)if(document.querySelectorAll(`[${i.ID}="${CSS.escape(u)}"]`).length>1)d=g,c=u;else break;g=g.parentElement}function N(u,T){if(u===e||p&&T===p||e.contains(u)||u.contains(e)||T&&E.has(T)||d&&d.contains(u))return!0;if(c){let f=u.parentElement;for(;f;){if(f.getAttribute(i.ID)===c)return!0;f=f.parentElement}}return!1}if(o){let u=`[${i.SOURCE_VAR}="${t}"][${i.SOURCE_FILE_ABS}="${CSS.escape(o)}"]`;n&&(u+=`[${i.SOURCE_PATH}="${n}"]`),document.querySelectorAll(u).forEach(f=>{let I=f.getAttribute(i.ID);N(f,I)||s++})}if(a&&l&&n){let u=`[${i.ARRAY_VAR}="${a}"][${i.ARRAY_FILE}="${CSS.escape(l)}"][${i.SOURCE_PATH}="${n}"]`;document.querySelectorAll(u).forEach(f=>{let I=f.getAttribute(i.ID);N(f,I)||s++})}return{isShared:s>0,sharedCount:s}}function k(e){let t=e.getAttribute(i.ID);if(!t)return null;let o=document.querySelectorAll(`[${i.ID}="${CSS.escape(t)}"]`);if(o.length<=1)return null;let n=Array.from(o).indexOf(e);return n>=0?n:null}function he(e){let t=e.target;A({action:h.INLINE_EDIT_CHANGE,elementId:t.getAttribute(i.ID),textContent:t.textContent})}function Ae(e){e.key==="Enter"&&!e.shiftKey?(e.preventDefault(),M(!0)):e.key==="Escape"&&(e.preventDefault(),M(!1))}function be(e){setTimeout(()=>{r.inlineEditElement&&document.activeElement!==r.inlineEditElement&&M(!0)},100)}function Ie(e){r.inlineEditElement&&M(!1);let t=e?.elementId,o=e?.arrayIndex,n=null;if(t){let m=document.querySelectorAll(`[${i.ID}="${CSS.escape(t)}"]`);m.length>1&&o!==void 0&&o!==null?n=m[o]:n=m[0]||null}else r.selectedElement&&(n=r.selectedElement);if(!n){A({action:h.INLINE_EDIT_ERROR,error:"No element found for inline editing",elementId:t});return}let a=R(n),l=B(n).length>0,p=Array.from(n.children||[]).some(m=>m.hasAttribute&&m.hasAttribute(i.VE_DYNAMIC));if(!l||a.isDynamic&&!a.isEditable||p){A({action:h.INLINE_EDIT_ERROR,error:p?"Mixed content (text + expressions) cannot be inline edited. Edit the source data instead.":a.isDynamic?"Dynamic element is not editable (source cannot be traced)":"Element has no direct text content",elementId:t,isDynamic:a.isDynamic,isEditable:a.isEditable});return}r.inlineEditMetadata={editType:a.editType,sourceInfo:a.sourceInfo,arrayIndex:e?.arrayIndex??k(n)},r.inlineEditOriginalText=n.textContent||"",r.inlineEditElement=n,n.contentEditable="true",n.style.outline="none",n.style.cursor="text",n.focus();let s=document.createRange();s.selectNodeContents(n),s.collapse(!1);let E=window.getSelection();E.removeAllRanges(),E.addRange(s),n.addEventListener("input",he),n.addEventListener("keydown",Ae),n.addEventListener("blur",be),A({action:h.INLINE_EDIT_START,elementId:n.getAttribute(i.ID),textContent:n.textContent})}function M(e=!0){let t=r.inlineEditElement;if(!t)return;t.removeEventListener("input",he),t.removeEventListener("keydown",Ae),t.removeEventListener("blur",be),t.contentEditable="false",t.style.cursor="";let o=t.textContent,n=t.getAttribute(i.ID);e||(t.textContent=r.inlineEditOriginalText),r.inlineEditElement=null;let a=r.inlineEditOriginalText;r.inlineEditOriginalText="",A({action:h.INLINE_EDIT_END,elementId:n,textContent:e?o:a,originalText:a,saved:e,editType:r.inlineEditMetadata?.editType,sourceInfo:r.inlineEditMetadata?.sourceInfo,arrayIndex:r.inlineEditMetadata?.arrayIndex}),r.inlineEditMetadata=null}function A(e){if(window.parent&&window.parent!==window)try{window.parent.postMessage({type:O.SITE_DEBUG,source:window.location.href,timestamp:Date.now(),...e},L.PARENT_ORIGIN)}catch{}}function Ce(e){if(e.origin!==L.PARENT_ORIGIN&&L.PARENT_ORIGIN!=="*"||!e.data||typeof e.data!="object")return;let{type:t,action:o,data:n}=e.data;if(t===O.DEBUG_COMMAND)switch(o){case C.ACTIVATE:G();break;case C.DEACTIVATE:U();break;case C.CLEAR_SELECTION:D();break;case C.APPLY_CHANGES:Te(n);break;case C.SET_INTERACTION_MODE:j(n.mode);break;case C.ENABLE_INLINE_EDIT:Ie(n);break;case C.DISABLE_INLINE_EDIT:M(n?.save!==!1);break;case C.FOCUS_ELEMENT:z(n?.elementId);break;case C.SET_ANNOTATION_MARKERS:me(n?.markers??[]);break}}function Fe(e){let t=e.match(/rgba?\(([^)]+)\)/);if(!t)return null;let o=t[1].split(",").map(p=>parseFloat(p.trim()));if(o.length<3)return null;let n=Math.round(o[0]),a=Math.round(o[1]),l=Math.round(o[2]);return"#"+[n,a,l].map(p=>{let s=p.toString(16);return s.length===1?"0"+s:s}).join("").toUpperCase()}function Ye(e){let t=e.match(/rgba?\(([^)]+)\)/);if(!t)return 1;let o=t[1].split(",").map(n=>parseFloat(n.trim()));return o.length===4?o[3]:1}function F(e){if(!e||e==="transparent"||e==="rgba(0, 0, 0, 0)")return{hex:null,opacity:0,hasColor:!1};let t=Fe(e),o=Ye(e);return{hex:t,opacity:Math.round(o*100),hasColor:!!t}}function xe(e){let t=e.getBoundingClientRect(),o=window.getComputedStyle(e),n=F(o.color),a=F(o.backgroundColor),l=F(o.borderColor),p=B(e),s=p.length>0,E=Z(e),m=E.filter(c=>c.type==="text").length,d=e.children?e.children.length:0;return{tagName:e.tagName.toLowerCase(),id:e.id||null,className:e.className||null,textContent:p||null,hasDirectTextContent:s,hasChildElements:d>0,childElementCount:d,textNodeCount:m,contentParts:E,attributes:Array.from(e.attributes).reduce((c,g)=>(c[g.name]=g.value,c),{}),rect:{x:t.x,y:t.y,width:t.width,height:t.height},computedStyles:{color:n,backgroundColor:a,borderColor:l,fontSize:o.fontSize,fontWeight:o.fontWeight,fontFamily:o.fontFamily,textAlign:o.textAlign,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,textDecoration:o.textDecoration,fontStyle:o.fontStyle,display:o.display,position:o.position,marginTop:o.marginTop,marginRight:o.marginRight,marginBottom:o.marginBottom,marginLeft:o.marginLeft,paddingTop:o.paddingTop,paddingRight:o.paddingRight,paddingBottom:o.paddingBottom,paddingLeft:o.paddingLeft}}}var Ve=["Toast"],$e=new Set(["Toaster","Sonner"]);function ee(e){return e?$e.has(e)?!0:Ve.some(t=>e.startsWith(t)):!1}function J(e){let t=e.getAttribute("data-ve-original-id");t&&(e.setAttribute(i.ID,t),e.removeAttribute("data-ve-original-id"))}function Q(){r.selectedGroup.forEach(e=>{e.removeAttribute("data-debug-selected"),e.removeAttribute("data-debug-dynamic")}),r.selectedBadges.forEach(e=>{b.removeBadge(e)}),r.selectedGroup=[],r.selectedBadges=[],r.selectedExprParents.forEach(e=>e.removeAttribute("data-debug-selected")),r.selectedExprParents=[]}function We(e){let t=e.getBoundingClientRect();if(t.top===0&&t.left===0&&t.bottom===0&&t.right===0){let o=e.parentElement;for(;o;){let n=o.getBoundingClientRect();if(n.top!==0||n.left!==0||n.bottom!==0||n.right!==0){t=n;break}o=o.parentElement}}return t}function Xe(e,t){let o=e.parentElement;if(!o)return;let n=o.getAttribute(i.FILE_NAME),a=o.getAttribute(i.LINE_NUMBER),l=o.getAttribute(i.COLUMN),p=o.getAttribute(i.COMPONENT);n&&(t.attributes[i.FILE_NAME]=n),a&&(t.attributes[i.LINE_NUMBER]=a),l?t.attributes[i.COLUMN]=l:delete t.attributes[i.COLUMN],p&&(t.attributes[i.COMPONENT]=p),t.className=o.className||null}function te(e){if(!r.isActive||r.interactionMode==="preview")return;let t=e.target?.closest?.(`.${S}`);if(t){e.preventDefault(),e.stopPropagation(),z(t.getAttribute(q));return}let o=e.target;o&&o.hasAttribute&&o.hasAttribute(i.VE_DYNAMIC)&&(o.hasAttribute(i.SOURCE_EDITABLE)||(o=o.parentElement)),!(r.inlineEditElement&&(o===r.inlineEditElement||r.inlineEditElement.contains(o)))&&(r.inlineEditElement&&M(!0),e.preventDefault(),e.stopPropagation(),ye(o,{toggle:!0,clickPoint:{x:e.clientX,y:e.clientY}}))}function ye(e,{toggle:t=!0,clickPoint:o}={}){if(e.tagName&&e.tagName.toLowerCase()==="svg"||e.id==="emergent-badge")return;let n=e.getAttribute(i.COMPONENT);if(ee(n)||e.closest(`[${i.COMPONENT}^="Toast"], [${i.COMPONENT}="Toaster"], [${i.COMPONENT}="Sonner"]`)||!e.hasAttribute(i.FILE_NAME)||!e.hasAttribute(i.LINE_NUMBER)||!e.hasAttribute(i.COMPONENT))return;let l=new Set(["strong","em","span","code","a","b","i","u","s","mark","small","sub","sup","abbr","cite","q","time","kbd","samp","var","del","ins","label"]),p=e.tagName?e.tagName.toLowerCase():"";if(l.has(p)&&e.hasAttribute(i.VE_DYNAMIC)&&e.getAttribute(i.SOURCE_EDITABLE)!=="true"){let u=e.parentElement;u&&u.hasAttribute(i.FILE_NAME)&&u.hasAttribute(i.LINE_NUMBER)&&u.hasAttribute(i.COMPONENT)&&(e=u)}let s=xe(e);if(!s.attributes[i.ID]){let u=`temp-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;e.setAttribute(i.ID,u),s.attributes[i.ID]=u}let E=e.hasAttribute(i.VE_DYNAMIC)&&e.getAttribute(i.SOURCE_EDITABLE)==="true",m=null;if(E){Xe(e,s);let u=s.attributes[i.ID];if(u){let T=document.querySelectorAll(`[${i.ID}="${CSS.escape(u)}"]`);if(T.length>1){m=Array.from(T).indexOf(e),m<0&&(m=null);let f=`expr-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;e.setAttribute("data-ve-original-id",u),e.setAttribute(i.ID,f),s.attributes[i.ID]=f}}}let d=R(e),c=H(e),g=k(e);g===null&&m!==null&&(g=m);let N=r.selectedElement===e;if(r.selectedElement&&(!N||!t)&&(J(r.selectedElement),r.selectedElement.removeAttribute("data-debug-selected"),Q()),t&&N)J(e),r.selectedElement=null,e.removeAttribute("data-debug-selected"),Q(),A({action:h.ELEMENT_DESELECTED});else{r.selectedElement=e,o&&ce(e,o.x,o.y);let u=s.hasChildElements&&(s.textNodeCount||0)>0,T=c&&!d.isEditable&&!u;if(E){e.setAttribute("data-debug-selected","true");let I=!d.isEditable;r.selectedBadges=[b.showSelectedBadge(e,"expr",I)],r.selectedExprParents=[]}else if(c&&s.attributes[i.ID]){let I=s.attributes[i.ID],ve=document.querySelectorAll(`[${i.ID}="${CSS.escape(I)}"]`);r.selectedGroup=Array.from(ve).filter(Boolean),r.selectedGroup.forEach(ae=>{ae.setAttribute("data-debug-selected","true"),T&&ae.setAttribute("data-debug-dynamic","true")});let Se=T?`${e.tagName.toLowerCase()} (Dynamic)`:e.tagName.toLowerCase(),Re=b.showSelectedBadge(e,Se,T);r.selectedBadges=[Re],r.selectedExprParents=[]}else{e.setAttribute("data-debug-selected","true");let I=E?"expr":e.tagName.toLowerCase();r.selectedBadges=[b.showSelectedBadge(e,I,!1)],r.selectedExprParents=[]}let f=We(e);A({action:h.ELEMENT_SELECTED,element:s,isDynamic:c,isEditable:d.isEditable,editType:d.editType,sourceInfo:d.sourceInfo,arrayIndex:g,elementCount:c?r.selectedGroup.length:1,isMultiElement:c&&r.selectedGroup.length>1,isExprSpan:E,position:{x:f.left,y:f.bottom,width:f.width,height:f.height,elementRect:{top:f.top,left:f.left,bottom:f.bottom,right:f.right}}})}}function z(e){if(!e)return;let t=document.querySelector(`[${i.ID}="${CSS.escape(e)}"]`);t&&(D(),qe(t),Ze(t))}function qe(e){let t=e.getBoundingClientRect(),o=Ke(e);if(o){let n=o.getBoundingClientRect(),a=o.scrollTop+(t.top-n.top)-(o.clientHeight-t.height)/2;o.scrollTo({top:Math.max(0,a),behavior:"smooth"})}else{let n=t.top+window.scrollY-(window.innerHeight-t.height)/2;window.scrollTo({top:Math.max(0,n),behavior:"smooth"})}}function Ke(e){let t=e.parentElement;for(;t&&t!==document.body&&t!==document.documentElement;){let o=getComputedStyle(t).overflowY;if((o==="auto"||o==="scroll")&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function Ze(e){let t=null,o=0,n=Date.now(),a=()=>{let l=e.getBoundingClientRect().top;if(o=t!==null&&Math.abs(l-t)<.5?o+1:0,t=l,o>=3||Date.now()-n>1e3){ye(e,{toggle:!1});return}requestAnimationFrame(a)};requestAnimationFrame(a)}function D(){if(r.inlineEditElement&&M(!0),r.selectedElement&&(J(r.selectedElement),r.selectedElement.removeAttribute("data-debug-selected"),r.selectedElement=null),Q(),r.hoverBadge&&(b.removeBadge(r.hoverBadge),r.hoverBadge=null),r.hoverTarget=null,r.hoverGroup=[],document.querySelectorAll("[data-debug-hover]").forEach(t=>{t.removeAttribute("data-debug-hover"),t.removeAttribute("data-debug-dynamic")}),A({action:h.ELEMENT_DESELECTED}),r.lastMouseX||r.lastMouseY){let t=document.elementFromPoint(r.lastMouseX,r.lastMouseY);t&&t.dispatchEvent(new MouseEvent("mouseover",{clientX:r.lastMouseX,clientY:r.lastMouseY,bubbles:!0}))}}function ne(e){if(!r.isActive||r.interactionMode==="preview")return;let t=e.target,o=!!(t&&t.hasAttribute&&t.hasAttribute(i.VE_DYNAMIC)&&t.getAttribute(i.SOURCE_EDITABLE)==="true");if(t&&t.hasAttribute&&t.hasAttribute(i.VE_DYNAMIC)&&!o&&(t=t.parentElement),!t||t.nodeType!==Node.ELEMENT_NODE||t.hasAttribute("data-debug-selected")||o&&t.parentElement?.hasAttribute("data-debug-selected")||t.tagName&&t.tagName.toLowerCase()==="svg"||t.id==="emergent-badge")return;if(!o){let m=t.getAttribute(i.COMPONENT);if(ee(m)||!(t.hasAttribute(i.FILE_NAME)&&t.hasAttribute(i.LINE_NUMBER)&&t.hasAttribute(i.COMPONENT)))return}if(t===r.hoverTarget){o!==r.hoverIsExprSpan&&r.hoverBadge&&(r.hoverBadge.textContent=o?"expr":r.hoverNonExprLabel??"",r.hoverIsExprSpan=o);return}if(r.hoverGroup.length>0?(r.hoverGroup.forEach(m=>{m.removeAttribute("data-debug-hover"),m.hasAttribute("data-debug-selected")||m.removeAttribute("data-debug-dynamic")}),r.hoverGroup=[]):r.hoverTarget&&(r.hoverTarget.removeAttribute("data-debug-hover"),r.hoverTarget.hasAttribute("data-debug-selected")||r.hoverTarget.removeAttribute("data-debug-dynamic")),o){let d=!R(t).isEditable;t.setAttribute("data-debug-hover","true"),d&&t.setAttribute("data-debug-dynamic","true"),r.hoverBadge&&b.removeBadge(r.hoverBadge),r.hoverTarget=t,r.hoverIsExprSpan=!0,r.hoverNonExprLabel=null,r.hoverBadge=b.showHoverBadge(t,"expr",d);return}let n=H(t),a=R(t),l=t.children&&t.children.length>0&&Array.from(t.childNodes).some(m=>m.nodeType===Node.TEXT_NODE&&m.textContent&&m.textContent.trim()),p=n&&!a.isEditable&&!l;if(n){let m=t.getAttribute(i.ID)||t.closest(`[${i.ID}]`)?.getAttribute(i.ID);if(m){let d=document.querySelectorAll(`[${i.ID}="${CSS.escape(m)}"]`);if(r.hoverGroup=Array.from(d).filter(Boolean),r.hoverGroup.some(g=>g.hasAttribute("data-debug-selected"))){r.hoverGroup=[];return}r.hoverGroup.forEach(g=>{g.setAttribute("data-debug-hover","true"),p&&g.setAttribute("data-debug-dynamic","true")})}else t.setAttribute("data-debug-hover","true"),p&&t.setAttribute("data-debug-dynamic","true")}else t.setAttribute("data-debug-hover","true");let s=p?`${t.tagName.toLowerCase()} (Dynamic)`:t.tagName.toLowerCase(),E=o?"expr":s;r.hoverBadge&&b.removeBadge(r.hoverBadge),r.hoverTarget=t,r.hoverIsExprSpan=o??!1,r.hoverNonExprLabel=s,r.hoverBadge=b.showHoverBadge(t,E,p)}function oe(e){if(!r.isActive||r.interactionMode==="preview")return;let t=e.relatedTarget;t&&r.hoverTarget&&(r.hoverTarget===t||t.hasAttribute&&t.hasAttribute(i.VE_DYNAMIC)&&t.parentElement===r.hoverTarget&&t.getAttribute(i.SOURCE_EDITABLE)!=="true")||(r.hoverGroup.length>0?(r.hoverGroup.forEach(o=>{o.removeAttribute("data-debug-hover"),o.hasAttribute("data-debug-selected")||o.removeAttribute("data-debug-dynamic")}),r.hoverGroup=[]):r.hoverTarget&&(r.hoverTarget.removeAttribute("data-debug-hover"),r.hoverTarget.hasAttribute("data-debug-selected")||r.hoverTarget.removeAttribute("data-debug-dynamic")),r.hoverBadge&&(b.removeBadge(r.hoverBadge),r.hoverBadge=null,r.hoverTarget=null))}var L={VERSION:"0.1.9.1",PARENT_ORIGIN:"*",Z_INDEX:1e4},r={isActive:!1,interactionMode:"select",selectedElement:null,selectedGroup:[],selectedExprParents:[],hoverGroup:[],hoverBadge:null,selectedBadges:[],hoverTarget:null,hoverIsExprSpan:!1,hoverNonExprLabel:null,repositionRAF:null,inlineEditElement:null,inlineEditOriginalText:"",inlineEditMetadata:null,lastMouseX:0,lastMouseY:0},b=new w,Ne=["pointerdown","pointerup","touchstart","touchend","mousedown","mouseup","contextmenu"];function ie(e){if(r.isActive&&r.interactionMode==="select"&&!e.target?.closest?.(`.${S}`)&&!((e instanceof MouseEvent||e instanceof PointerEvent)&&(e.metaKey||e.ctrlKey||e.altKey))){if(r.inlineEditElement){let t=e.target;if(t===r.inlineEditElement||r.inlineEditElement.contains(t))return}e.preventDefault(),e.stopPropagation()}}function Me(e){r.lastMouseX=e.clientX,r.lastMouseY=e.clientY}var Y;function _(){r.hoverBadge&&(r.hoverBadge.style.opacity="0",r.hoverBadge.style.transition="none"),r.selectedBadges.forEach(e=>{e.style.opacity="0",e.style.transition="none"}),clearTimeout(Y),Y=setTimeout(()=>{r.repositionRAF&&cancelAnimationFrame(r.repositionRAF),r.repositionRAF=requestAnimationFrame(()=>{if(r.hoverBadge&&r.hoverTarget&&(b.updateBadgePosition(r.hoverTarget,r.hoverBadge),r.hoverBadge.offsetHeight,r.hoverBadge.style.transition="",r.hoverBadge.style.opacity="1"),r.selectedBadges.length>0){let e=r.selectedGroup.length>0?r.selectedGroup[0]:r.selectedElement;e&&(b.updateBadgePosition(e,r.selectedBadges[0]),r.selectedBadges[0].offsetHeight,r.selectedBadges[0].style.transition="",r.selectedBadges[0].style.opacity="1")}pe(),r.repositionRAF=null})},50)}function G(){r.isActive=!0,document.body.style.cursor=r.interactionMode==="select"?"crosshair":"default",r.interactionMode==="select"&&document.body.classList.add("debug-select-mode"),document.addEventListener("click",te,!0),document.addEventListener("mouseover",ne,!0),document.addEventListener("mouseout",oe,!0),document.addEventListener("mousemove",Me,!0),Ne.forEach(e=>{document.addEventListener(e,ie,!0)}),window.addEventListener("scroll",_,{passive:!0}),window.addEventListener("resize",_,{passive:!0}),A({action:h.MODE_ACTIVATED,url:window.location.href})}function U(){r.isActive=!1,document.body.style.cursor="",document.body.classList.remove("debug-select-mode"),document.removeEventListener("click",te,!0),document.removeEventListener("mouseover",ne,!0),document.removeEventListener("mouseout",oe,!0),document.removeEventListener("mousemove",Me,!0),Ne.forEach(e=>{document.removeEventListener(e,ie,!0)}),window.removeEventListener("scroll",_),window.removeEventListener("resize",_),clearTimeout(Y),Y=void 0,r.repositionRAF&&(cancelAnimationFrame(r.repositionRAF),r.repositionRAF=null),D(),b.cleanup(),fe(),A({action:h.MODE_DEACTIVATED})}function j(e){r.interactionMode=e,r.isActive&&(document.body.style.cursor=e==="select"?"crosshair":"default",e==="select"?document.body.classList.add("debug-select-mode"):document.body.classList.remove("debug-select-mode")),A({action:h.INTERACTION_MODE_CHANGED,mode:e})}function re(){window.parent!==window&&(se(L.Z_INDEX),window.addEventListener("message",Ce))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",re):re();window.visualEditOverlay={activate:G,deactivate:U,clearSelection:D,getState:()=>({...r})};return Pe(ze);})();
