var L={isObservable(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function H(t,e=!0){return e?Object.assign(L,t):(Object.setPrototypeOf(t,L),t)}function M(t){return L.isPrototypeOf(t)&&t!==L?t:L}function w(t){return typeof t>"u"}function K(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function W(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}function q(t,e){let{observedAttributes:n=[]}=t.constructor;return n.reduce(function(r,o){return Reflect.set(r,dt(o),e(t,o)),r},{})}function dt(t){return t.replace(/-./g,e=>e[1].toUpperCase())}var d={setDeleteAttr:pt,ssr:"",D:globalThis.document,F:globalThis.DocumentFragment,H:globalThis.HTMLElement,S:globalThis.SVGElement,M:globalThis.MutationObserver};function pt(t,e,n){if(Reflect.set(t,e,n),!!w(n)){if(Reflect.deleteProperty(t,e),t instanceof d.H&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var A="__dde_lifecycleToEvents",y="dde:connected",_="dde:disconnected",N="dde:attributeChanged";var O=[{get scope(){return d.D.body},host:t=>t?t(d.D.body):d.D.body,prevent:!0}],E={get current(){return O[O.length-1]},get host(){return this.current.host},preventDefault(){let{current:t}=this;return t.prevent=!0,t},get state(){return[...O]},push(t={}){return O.push(Object.assign({},this.current,{prevent:!1},t))},pushRoot(){return O.push(O[0])},pop(){if(O.length!==1)return O.pop()}};function Q(...t){return this.appendOriginal(...t),this}function lt(t){return t.append===Q||(t.appendOriginal=t.append,t.append=Q),t}var F;function T(t,e,...n){let r=M(this),o=0,c,s;switch((Object(e)!==e||r.isObservable(e))&&(e={textContent:e}),!0){case typeof t=="function":{o=1,E.push({scope:t,host:(...b)=>b.length?(o===1?n.unshift(...b):b.forEach(g=>g(s)),void 0):s}),c=t(e||void 0);let f=c instanceof d.F;if(c.nodeName==="#comment")break;let p=T.mark({type:"component",name:t.name,host:f?"this":"parentElement"});c.prepend(p),f&&(s=p);break}case t==="#text":c=P.call(this,d.D.createTextNode(""),e);break;case(t==="<>"||!t):c=P.call(this,d.D.createDocumentFragment(),e);break;case!!F:c=P.call(this,d.D.createElementNS(F,t),e);break;case!c:c=P.call(this,d.D.createElement(t),e)}return lt(c),s||(s=c),n.forEach(f=>f(s)),o&&E.pop(),o=2,c}function jt(t,e=t,n=void 0){let r=Symbol.for("default"),o=Array.from(e.querySelectorAll("slot")).reduce((s,f)=>Reflect.set(s,f.name||r,f)&&s,{}),c=Reflect.has(o,r);if(t.append=new Proxy(t.append,{apply(s,f,p){if(!p.length)return t;let b=d.D.createDocumentFragment();for(let g of p){if(!g||!g.slot){c&&b.appendChild(g);continue}let D=g.slot,j=o[D];vt(g,"remove","slot"),j&&(ht(j,g,n),Reflect.deleteProperty(o,D))}return c&&(o[r].replaceWith(b),Reflect.deleteProperty(o,r)),t.append=s,t}}),t!==e){let s=Array.from(t.childNodes);s.forEach(f=>f.remove()),t.append(...s)}return e}function ht(t,e,n){n&&n(t,e);try{t.replaceWith(P(e,{className:[e.className,t.className],dataset:{...t.dataset}}))}catch{t.replaceWith(e)}}T.mark=function(t,e=!1){t=Object.entries(t).map(([o,c])=>o+`="${c}"`).join(" ");let n=e?"":"/",r=d.D.createComment(``);return e&&(r.end=d.D.createComment("")),r};function Mt(t){let e=this;return function(...r){F=t;let o=T.call(e,...r);return F=void 0,o}}var $=new WeakMap,{setDeleteAttr:X}=d;function P(t,...e){if(!e.length)return t;$.set(t,et(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))tt.call(this,t,n,r);return $.delete(t),t}function tt(t,e,n){let{setRemoveAttr:r,s:o}=et(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(f,p)=>tt.call(c,t,f,p));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return Y(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return X(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return B(o,n,Y.bind(null,t[e]));case"ariaset":return B(o,n,(f,p)=>r("aria-"+f,p));case"classList":return bt.call(c,t,n)}return gt(t,e)?X(t,e,n):r(e,n)}function et(t,e){if($.has(t))return $.get(t);let r=(t instanceof d.S?xt:Et).bind(null,t,"Attribute"),o=M(e);return{setRemoveAttr:r,s:o}}function bt(t,e){let n=M(this);return B(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function Wt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function vt(t,e,n,r){return t instanceof d.H?t[e+"Attribute"](n,r):t[e+"AttributeNS"](null,n,r)}function gt(t,e){if(!Reflect.has(t,e))return!1;let n=nt(t,e);return!w(n.set)}function nt(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||nt(t,e)}function B(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function rt(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Et(t,e,n,r){return t[(w(r)?"remove":"set")+e](n,rt(r))}function xt(t,e,n,r,o=null){return t[(w(r)?"remove":"set")+e+"NS"](o,n,rt(r))}function Y(t,e,n){if(Reflect.set(t,e,n),!!w(n))return Reflect.deleteProperty(t,e)}var C=d.M?mt():new Proxy({},{get(){return()=>{}}});function mt(){let t=new Map,e=!1,n=i=>function(a){for(let u of a)if(u.type==="childList"){if(g(u.addedNodes,!0)){i();continue}D(u.removedNodes,!0)&&i()}},r=new d.M(n(f));return{observe(i){let a=new d.M(n(()=>{}));return a.observe(i,{childList:!0,subtree:!0}),()=>a.disconnect()},onConnected(i,a){s();let u=c(i);u.connected.has(a)||(u.connected.add(a),u.length_c+=1)},offConnected(i,a){if(!t.has(i))return;let u=t.get(i);u.connected.has(a)&&(u.connected.delete(a),u.length_c-=1,o(i,u))},onDisconnected(i,a){s();let u=c(i);u.disconnected.has(a)||(u.disconnected.add(a),u.length_d+=1)},offDisconnected(i,a){if(!t.has(i))return;let u=t.get(i);u.disconnected.has(a)&&(u.disconnected.delete(a),u.length_d-=1,o(i,u))}};function o(i,a){a.length_c||a.length_d||(t.delete(i),f())}function c(i){if(t.has(i))return t.get(i);let a={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,a),a}function s(){e||(e=!0,r.observe(d.D.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,r.disconnect())}function p(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function b(i){t.size>30&&await p();let a=[];if(!(i instanceof Node))return a;for(let u of t.keys())u===i||!(u instanceof Node)||i.contains(u)&&a.push(u);return a}function g(i,a){let u=!1;for(let x of i){if(a&&b(x).then(g),!t.has(x))continue;let k=t.get(x);k.length_c&&(x.dispatchEvent(new Event(y)),k.connected=new WeakSet,k.length_c=0,k.length_d||t.delete(x),u=!0)}return u}function D(i,a){let u=!1;for(let x of i)a&&b(x).then(D),!(!t.has(x)||!t.get(x).length_d)&&((globalThis.queueMicrotask||setTimeout)(j(x)),u=!0);return u}function j(i){return()=>{i.isConnected||(i.dispatchEvent(new Event(_)),t.delete(i))}}}function It(t,e,n,r=Ot){E.push({scope:t,host:(...s)=>s.length?s.forEach(f=>f(t)):t}),typeof r=="function"&&(r=r.call(t,t));let o=t[A];o||yt(t);let c=n.call(t,r);return o||t.dispatchEvent(new Event(y)),e.nodeType===11&&typeof e.mode=="string"&&t.addEventListener(_,C.observe(e),{once:!0}),E.pop(),e.append(c)}function yt(t){return I(t.prototype,"connectedCallback",function(e,n,r){e.apply(n,r),n.dispatchEvent(new Event(y))}),I(t.prototype,"disconnectedCallback",function(e,n,r){e.apply(n,r),(globalThis.queueMicrotask||setTimeout)(()=>!n.isConnected&&n.dispatchEvent(new Event(_)))}),I(t.prototype,"attributeChangedCallback",function(e,n,r){let[o,,c]=r;n.dispatchEvent(new CustomEvent(N,{detail:[o,c]})),e.apply(n,r)}),t.prototype[A]=!0,t}function I(t,e,n){t[e]=new Proxy(t[e]||(()=>{}),{apply:n})}function Ot(t){return q(t,(e,n)=>e.getAttribute(n))}function Vt(t,e,n){return e||(e={}),function(o,...c){n&&(c.unshift(o),o=typeof n=="function"?n():n);let s=c.length?new CustomEvent(t,Object.assign({detail:c[0]},e)):new Event(t,e);return o.dispatchEvent(s)}}function m(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var ot=t=>Object.assign({},typeof t=="object"?t:null,{once:!0});m.connected=function(t,e){return e=ot(e),function(r){return r.addEventListener(y,t,e),r[A]?r:r.isConnected?(r.dispatchEvent(new Event(y)),r):(W(e.signal,()=>C.offConnected(r,t))&&C.onConnected(r,t),r)}};m.disconnected=function(t,e){return e=ot(e),function(r){return r.addEventListener(_,t,e),r[A]||W(e.signal,()=>C.offDisconnected(r,t))&&C.onDisconnected(r,t),r}};var J=new WeakMap;m.disconnectedAsAbort=function(t){if(J.has(t))return J.get(t);let e=new AbortController;return J.set(t,e),t(m.disconnected(()=>e.abort())),e};var wt=new WeakSet;m.attributeChanged=function(t,e){return typeof e!="object"&&(e={}),function(r){if(r.addEventListener(N,t,e),r[A]||wt.has(r)||!d.M)return r;let o=new d.M(function(s){for(let{attributeName:f,target:p}of s)p.dispatchEvent(new CustomEvent(N,{detail:[f,p.getAttribute(f)]}))});return W(e.signal,()=>o.disconnect())&&o.observe(r,{attributes:!0}),r}};var l="__dde_observable";function U(t){try{return Reflect.has(t,l)}catch{return!1}}var z=[],h=new WeakMap;function v(t,e){if(typeof t!="function")return ct(!1,t,e);if(U(t))return t;let n=ct(!0),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),z.push(r),at(n,t()),z.pop(),!c.length)return;let s=h.get(r);for(let f of c)s.has(f)||S(f,r)};return h.set(n[l],r),h.set(r,new Set([n])),r(),n}v.action=function(t,e,...n){let r=t[l],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};v.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));V(e,n),o&&o.addEventListener("abort",()=>S(e,n))}};v.symbols={onclear:Symbol.for("Observable.onclear")};v.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[l];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,l)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(n.clear(...c),h.delete(o))})}};var R="__dde_reactive";v.el=function(t,e){let n=T.mark({type:"reactive"},!0),r=n.end,o=d.D.createDocumentFragment();o.append(n,r);let{current:c}=E,s=f=>{if(!n.parentNode||!r.parentNode)return S(t,s);E.push(c);let p=e(f);E.pop(),Array.isArray(p)||(p=[p]);let b=n;for(;(b=n.nextSibling)!==r;)b.remove();n.after(...p),n.isConnected&&At(c.host())};return V(t,s),ut(t,s,n,e),s(t()),o};function At(t){!t||!t[R]||(requestIdleCallback||setTimeout)(function(){t[R]=t[R].filter(([e,n])=>n.isConnected?!0:(S(...e),!1))})}var _t={_set(t){this.value=t}};function Ct(t){return function(e,n){let r=(...c)=>c.length?e.setAttribute(n,...c):e.getAttribute(n),o=ft(r,r(),_t);return t[n]=o,o}}var Z="__dde_attributes";v.observedAttributes=function(t){let e=t[Z]={},n=q(t,Ct(e));return m.attributeChanged(function({detail:o}){/*! This maps attributes to observables (`O.observedAttributes`). * Investigate `__dde_attributes` key of the element.*/let[c,s]=o,f=this[Z][c];if(f)return v.action(f,"_set",s)})(t),m.disconnected(function(){/*! This removes all observables mapped to attributes (`O.observedAttributes`). * Investigate `__dde_attributes` key of the element.*/v.clear(...Object.values(this[Z]))})(t),n};var it={isObservable:U,processReactiveAttribute(t,e,n,r){if(!U(n))return n;let o=c=>{if(!t.isConnected)return S(n,o);r(e,c)};return V(n,o),ut(n,o,t,e),n()}};function ut(t,e,...n){let{current:r}=E;r.prevent||r.host(function(o){o[R]||(o[R]=[],m.disconnected(()=>o[R].forEach(([[c,s]])=>S(c,s,c[l]?.host()===o)))(o)),o[R].push([[t,e],...n])})}function ct(t,e,n){let r=t?()=>st(r):(...o)=>o.length?at(r,...o):st(r);return ft(r,e,n,t)}var Rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),G=class extends Error{constructor(){super();let[e,...n]=this.stack.split(` `),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ft(t,e,n,r=!1){let o=[];K(n)!=="[object Object]"&&(n={});let{onclear:c}=v.symbols;n[c]&&(o.push(n[c]),Reflect.deleteProperty(n,c));let{host:s}=E;return Reflect.defineProperty(t,l,{value:{value:e,actions:n,onclear:o,host:s,listeners:new Set,defined:new G().stack,readonly:r},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[l],Rt),t}function St(){return z[z.length-1]}function st(t){if(!t[l])return;let{value:e,listeners:n}=t[l],r=St();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function at(t,e,n){if(!t[l])return;let r=t[l];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function V(t,e){if(t[l])return t[l].listeners.add(e)}function S(t,e,n){let r=t[l];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(v.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>S(s,c,!0))}return o}H(it);export{v as O,P as assign,tt as assignAttribute,lt as chainableAppend,bt as classListDeclarative,T as createElement,Mt as createElementNS,It as customElementRender,yt as customElementWithDDE,Vt as dispatchEvent,T as el,Mt as elNS,vt as elementAttribute,Wt as empty,U as isObservable,yt as lifecycleToEvents,v as observable,Ot as observedAttributes,m as on,H as registerReactivity,E as scope,jt as simulateSlots};