@ecopages/radiant 0.3.0-alpha.5 → 0.3.0-alpha.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.
- package/README.md +5 -3
- package/dist/context/context-consumer-bootstrap.js +2 -2
- package/dist/context/context-consumer-bootstrap.js.map +5 -5
- package/dist/context/context-consumer-runtime.js +2 -2
- package/dist/context/context-consumer-runtime.js.map +4 -4
- package/dist/context/context-provider.js +2 -2
- package/dist/context/context-provider.js.map +5 -5
- package/dist/context/decorators/consume-context.js +2 -2
- package/dist/context/decorators/consume-context.js.map +6 -6
- package/dist/context/decorators/context-selection-delivery.js +2 -2
- package/dist/context/decorators/context-selection-delivery.js.map +3 -3
- package/dist/context/decorators/context-selector.js +2 -2
- package/dist/context/decorators/context-selector.js.map +5 -5
- package/dist/context/decorators/legacy/consume-context.js +2 -2
- package/dist/context/decorators/legacy/consume-context.js.map +5 -5
- package/dist/context/decorators/legacy/context-selector-field.js +2 -2
- package/dist/context/decorators/legacy/context-selector-field.js.map +5 -5
- package/dist/context/decorators/legacy/context-selector.js +2 -2
- package/dist/context/decorators/legacy/context-selector.js.map +5 -5
- package/dist/context/decorators/legacy/provide-context.js +2 -2
- package/dist/context/decorators/legacy/provide-context.js.map +5 -5
- package/dist/context/decorators/on-context-update.js +2 -2
- package/dist/context/decorators/on-context-update.js.map +6 -6
- package/dist/context/decorators/provide-context.js +2 -2
- package/dist/context/decorators/provide-context.js.map +6 -6
- package/dist/context/decorators/standard/consume-context.js +2 -2
- package/dist/context/decorators/standard/consume-context.js.map +5 -5
- package/dist/context/decorators/standard/context-selector-field.js +2 -2
- package/dist/context/decorators/standard/context-selector-field.js.map +5 -5
- package/dist/context/decorators/standard/context-selector.js +2 -2
- package/dist/context/decorators/standard/context-selector.js.map +5 -5
- package/dist/context/decorators/standard/provide-context.js +2 -2
- package/dist/context/decorators/standard/provide-context.js.map +5 -5
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.js +3 -0
- package/dist/context/index.js.map +35 -0
- package/dist/core/radiant-component-ssr.js +2 -2
- package/dist/core/radiant-component-ssr.js.map +4 -4
- package/dist/core/radiant-element.js +2 -2
- package/dist/core/radiant-element.js.map +3 -3
- package/dist/core/ssr-preparation.js +2 -2
- package/dist/core/ssr-preparation.js.map +3 -3
- package/dist/decorators/legacy/query-slot.js +2 -2
- package/dist/decorators/legacy/query-slot.js.map +3 -3
- package/dist/decorators/query-slot.js +2 -2
- package/dist/decorators/query-slot.js.map +3 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -26
- package/dist/server/radiant-component-ssr-runtime.js +2 -2
- package/dist/server/radiant-component-ssr-runtime.js.map +4 -4
- package/dist/server/render-component.js +2 -2
- package/dist/server/render-component.js.map +4 -4
- package/dist/server/render-controller.js +2 -2
- package/dist/server/render-controller.js.map +4 -4
- package/package.json +6 -3
- package/size-budget.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var m2=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,$)=>(typeof require<"u"?require:M)[$]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});var QF=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function B(F,M){let H=F[QF];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,QF,{value:[M],configurable:!0})}function x(F){let M=[],$=Object.getPrototypeOf(F);while($&&$!==Object.prototype)M.push($),$=Object.getPrototypeOf($);for(let H=M.length-1;H>=0;H-=1){let W=M[H][QF];if(!Array.isArray(W))continue;for(let j of W)j(F)}}import{createSubscribableJsxValue as l0}from"@ecopages/jsx";import{trackDependency as OF}from"@ecopages/signals";class CF{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return OF(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch($){M=$}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch($){F.push($)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function n0(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class w{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,$){this.host=F;this.access=M;this.shouldAutoBind=$;let H=this.createReactiveBindingNamespace();this.bindings=H,this.$=H}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,$){if(M===$)return;this.reactiveDependencies.get(F)?.notify($);let H=this.updateCallbacks.get(F);if(H)for(let W of H)W()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerHydrationBinding(F,M){}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let $=this.updateCallbacks.get(F);return $.add(M),()=>{if($.delete(M),$.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let $=l0({getValue:()=>this.readReactiveBindingValue(F),subscribe:(H)=>this.registerUpdateCallback(F,()=>{H(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,$),$}bind(F){return this.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){let $=typeof M==="string"?M:M?`$${F}`:void 0,H=this.access.getBindingTarget?.(this.host)??this.host;if(!$||this.access.hasProperty(this.host,$))return;this.access.defineProperty(H,$,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){OF(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let $=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,$),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:(H)=>{let W=M.getValue();if(W===H)return;M.setValue(H),this.notifyUpdate(F,W,H)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,$={}){let H={name:F,value:M,initialValue:M};this.reactiveFields.set(F,H),this.defineReactiveAccessor(F,{bind:$.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(W)=>{this.reactiveFields.set(F,{...H,value:W})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let $=new CF(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,$),$}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(n0(M))return M.get();return M}}var BF=Symbol(),N=Symbol();function v(F,M){let H=F[BF];if(Array.isArray(H)){H.push(M);return}Object.defineProperty(F,BF,{value:[M],configurable:!0})}function fF(F){let M=F,$=M[BF];if(!Array.isArray($))return;M[N]=!0;try{for(let H of $)H()}finally{delete M[N]}}function SF(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var _="data-hydration",xF="data-hydration-type",LF="data-hydration-key";function b(F){let M=F.hydrationKey?` ${LF}="${a0(F.hydrationKey)}"`:"";return`<script type="application/json" ${_} ${xF}="${F.type}"${M}>${F.serializedValue}</script>`}function h(F){return SF(F)}function g(F,M){let $=F.textContent;if(!$)return M;try{return JSON.parse($)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${_}>:`,$.slice(0,120));return M}}function y(F,M,$){let H=F.children;if(!H||H.length===0){let W=F.childNodes;if(!W||W.length===0)return null;for(let j=0;j<W.length;j+=1){let P=W[j];if(P.nodeType!==1)continue;let Z=P;if(VF(Z,M,$))return Z}return null}for(let W=0;W<H.length;W+=1)if(VF(H[W],M,$))return H[W];return null}function VF(F,M,$){if(F.tagName!=="SCRIPT"||!F.hasAttribute(_)||F.getAttribute(xF)!==M)return!1;if($!==void 0)return F.getAttribute(LF)===$;return!F.hasAttribute(LF)}function a0(F){return F.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as r0,isKeyedJsxValue as NF,isSlotJsxValue as o0}from"@ecopages/jsx";var K="",u="data-radiant-slot-projection";function vF(F){let M=new Map;for(let $ of Array.from(F.childNodes)){if(M2($))continue;t0(M,F2($),$)}return M}function bF(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let $=new Map;for(let[H,W]of Object.entries(M)){if(!Array.isArray(W)||W.length===0)continue;$.set(AF(H),W.map((j)=>r0(j)))}return $}function hF(F){let M=Array.from(F.childNodes).filter(($)=>cF($)).map(($)=>m($)??"").filter(($)=>$!=="");return M.length>0?M.join(""):void 0}function gF(F){let M={};for(let[$,H]of F.entries()){let W=H.map((j)=>m(j)).filter((j)=>j!==void 0&&j!=="");if(W.length>0)M[$]=W}return Object.keys(M).length>0?JSON.stringify(M):void 0}function yF(F,M){let $=!1,H=(j)=>{if(o0(j))return $=!0,H2(j,M,H);if(NF(j))return e0(j,H(j.value));if($2(j))return{_$rType$:1,rootLocalName:j.rootLocalName,strings:j.strings,values:j.values.map((P)=>H(P))};if(uF(j))return Array.from(j,(P)=>H(P));return j},W=H(F);return{containsSlots:$,value:W}}function mF(F){for(let M of Array.from(F.childNodes)){if(!dF(M))continue;let $=M.textContent??void 0;return M.parentNode?.removeChild(M),$}return}function t0(F,M,$){let H=F.get(M);if(H){H.push($);return}F.set(M,[$])}function e0(F,M){return{...F,value:M}}function F2(F){if(F instanceof Element)return AF(F.getAttribute("slot"));return K}function uF(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function dF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(u)}function cF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(_)}function M2(F){return dF(F)||cF(F)}function $2(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function AF(F){return F??K}function m(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(NF(F))return m(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(uF(F))return Array.from(F,(M)=>m(M)??"").join("");return}function H2(F,M,$){let H=M.get(AF(F.name));if(H&&H.length>0)return H.length===1?H[0]:H;if(F.fallback===void 0)return"";return $(F.fallback)}var UF=Symbol.for("@ecopages/radiant.hydrator-installed");function e2(){globalThis[UF]=!0}function FM(){delete globalThis[UF]}function pF(){return globalThis[UF]===!0}var sF=Symbol.for("@ecopages/radiant.component-ssr-runtime");function iF(){return globalThis[sF]}function $M(F){globalThis[sF]=F}function aF(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function W2(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function O(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function j2(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var P2={array(F){let M=j2(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${W2(M)}"`);return M},string(F){return F}},lF={default:rF,array:nF,object:nF};function nF(F){return JSON.stringify(F)}function rF(F){return`${F}`}function I(F,M){let $=aF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return P2[$](F)}function d(F,M){let $=aF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(lF[$]??lF.default??rF)(F)}function Z2(F){return typeof F==="boolean"}function G2(F){return typeof F==="number"}function X2(F){return typeof F==="string"}function Q2(F){return Array.isArray(F)}function B2(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function U(F,M){switch(F){case Boolean:return Z2(M);case Number:return G2(M);case String:return X2(M);case Array:return Q2(M);case Object:return B2(M);default:return!1}}var oF=(F,M,$,H)=>{if(M===Boolean){let j=F.getAttribute($);if(j===null)return H;return j===""?!0:I(j,M)}let W=F.getAttribute($);return W!==null?I(W,M):H??O(M)};import{hasHydrationMarkers as L2,hydrate as A2,jsx as U2,render as Y2}from"@ecopages/jsx";import{Computed as D2,subtle as J2}from"@ecopages/signals";var R2=q2();function q2(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class p extends R2{bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;projectedSlotContent=new Map;renderSignal;renderWatcher=new J2.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();this.reactiveHost=new w(this,{defineProperty:(F,M,$)=>Object.defineProperty(F,M,$),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,x(this)}connectedCallback(){let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),tF(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}transformAttributeValue(F,M){return F!==null?M?.converter.fromAttribute(F):F}attributeChangedCallback(F,M,$){if(M===$||!this.elementReady)return;if(this.reactiveProperties.has(F)){let H=this.reactiveProperties.get(F),W=this.transformAttributeValue($,H),j=this.transformAttributeValue(M,H),P=H?H.attribute:F;this[P]=W,this.notifyUpdate(F,j,W)}}renderTemplate({target:F=this,template:M,insert:$="replace",sanitize:H}){let W=H?H(M):M;switch($){case"replace":F.innerHTML=W;break;case"beforeend":F.insertAdjacentHTML("beforeend",W);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",W);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",W);break;case"afterend":F.insertAdjacentHTML("afterend",W);break}}render(){return U2("slot",{})}renderToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),c().renderView(this,F)}renderHost(){return c().renderHost(this)}renderHostToString(F={}){return c().renderHostToString(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;this.isRendering=!0,this.disconnectSlotProjectionObserver();try{A2(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&tF(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{Y2(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(F){this.reactiveProperties.set(F.name,F)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.contextProviders.set(F,M),this.registerHydrationBinding(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){fF(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==p.prototype.render}getHostSsrAttributes(){return c().getHostAttributes(this)}resolveSsrRenderBridge(){let F={};if(this.renderHostToString===p.prototype.renderHostToString)F.renderHostToString=(M)=>this.renderHostToString(M);if(this.renderHost===p.prototype.renderHost)F.renderHost=()=>this.renderHost();return F}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.bind(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let $ of F)M.push(this.subscribeEvent($));return M}subscribeEvent(F){let M=(H)=>{if(H.target&&H.target.matches(F.selector))F.listener.call(this,H)},$=`${F.type}:${F.selector}`;return this.addEventListener(F.type,M,F.options),this.eventSubscriptions.set($,{...F,listener:M}),this.unsubscribeEvent.bind(this,$)}unsubscribeEvent(F){let M=this.eventSubscriptions.get(F);if(M)this.removeEventListener(M.type,M.listener,M.options),this.eventSubscriptions.delete(F)}removeAllSubscribedEvents(){for(let F of this.eventSubscriptions.values())this.removeEventListener(F.type,F.listener,F.options);this.eventSubscriptions.clear()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.querySelectorAll($));return this.querySelector($)??null}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(F??K)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,attribute:H,reflect:W,defaultValue:j}=M,P=H??F;if(j!==void 0&&!U($,j))throw Error(`defaultValue does not match the expected type for ${$.name}`);let Z=oF(this,$,P,j);if(this.hasAttribute(P)&&(!W||Z==null||Z===""))this.removeAttribute(P);let G={type:$,name:F,value:Z,initialValue:Z,attribute:P,converter:{fromAttribute:(Q)=>I(Q,$),toAttribute:(Q)=>d(Q,$)}};this.registerReactiveProperty(G);let X=(Q)=>{if(W)if(Q==null||Q===""||Q===!1)this.removeAttribute(P);else{let L=G.converter.toAttribute(Q);this.setAttribute(P,L)}};if(this.reactiveHost.defineReactiveAccessor(F,{bind:M.bind,getValue:()=>this.reactiveProperties.get(F)?.value,setValue:(Q)=>{this.reactiveProperties.set(F,{...G,value:Q}),X(Q)}}),Z!==void 0)queueMicrotask(()=>{let Q=this.reactiveProperties.get(F)?.value;if(Q===void 0)return;X(Q),this.notifyUpdate(F,void 0,Q)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let F=this.isConnected?mF(this):void 0;if(typeof F==="string"&&F!==""){this.projectedSlotContent=bF(F),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=vF(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=gF(this.projectedSlotContent);if(!F)return;return`<script type="application/json" ${u}>${_2(F)}</script>`}getAuthoredHydrationScriptMarkup(){let F=hF(this);if(F)return F;return}handleSlotProjectionMutations(F){let M=!1;for(let $ of F){for(let H of Array.from($.removedNodes))if(this.removeProjectedSlotNode(H))M=!0;for(let H of Array.from($.addedNodes)){if(H.parentNode!==this)continue;if(this.addProjectedSlotNode(H))M=!0}}if(M)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(u)||F.hasAttribute(_)))return!1;let M=F instanceof Element?F.getAttribute("slot")??K:K,$=this.projectedSlotContent.get(M);if($){if($.includes(F))return!1;return $.push(F),!0}return this.projectedSlotContent.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,$]of this.projectedSlotContent.entries()){let H=$.indexOf(F);if(H===-1)continue;if($.splice(H,1),$.length===0)this.projectedSlotContent.delete(M);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new D2(()=>this.resolveRenderOutput()),M=F.get();if(!this.isConnected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}resolveRenderOutput(){return this.ensureSlotProjectionState(),yF(this.render(),this.projectedSlotContent)}}function c(){let F=iF();if(!F)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return F}function tF(F){return pF()&&L2(F)}function _2(F){return F.replace(/</g,"\\u003c")}import{render as z2}from"@ecopages/jsx";import{Computed as k2,subtle as K2}from"@ecopages/signals";class eF{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;needsRender=!1;renderSignal;renderWatcher=new K2.Watcher(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new w(this,{defineProperty:(M,$,H)=>Object.defineProperty(M,$,H),hasProperty:(M,$)=>($ in M),readProperty:(M,$)=>M[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,x(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.connected=!0,this.reactiveHost.connectHost()}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost(),this.connected=!1}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(!F)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{z2(this.resolveTrackedRenderOutput(),F)}finally{this.isRendering=!1}}}bind(F){return this.reactiveHost.bind(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,defaultValue:H,bind:W}=M;if(H!==void 0&&!U($,H))throw Error(`defaultValue does not match the expected type for ${$.name}`);let j=Object.getOwnPropertyDescriptor(this.host,F),P=this.host,G=P[F]??H??O($);this.reactiveHost.defineReactiveAccessor(F,{bind:W,getValue:()=>G,setValue:(X)=>{G=X},notifyInitialValue:G}),Object.defineProperty(this.host,F,{get:()=>this[F],set:(X)=>{this[F]=X},enumerable:j?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let X=this[F];if(j){if(Object.defineProperty(this.host,F,j),"value"in j&&j.writable)P[F]=X;return}delete P[F];try{P[F]=X}catch{Object.defineProperty(this.host,F,{value:X,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){}registerHydrationBinding(F,M){}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,$){this.host.addEventListener(F,M,$)}removeEventListener(F,M,$){this.host.removeEventListener(F,M,$)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll($));return this.host.querySelector($)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==eF.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new k2(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}function kM(F,M){return F.bind(M)}var F0=Symbol.for("@ecopages/radiant.controllerIdentifier");function YF(F,M){F[F0]=M}function IM(F){return F[F0]}var i="data-controller",M0=Symbol.for("@ecopages/radiant.controller-registry-state");function I2(){let F=globalThis,M=F[M0];if(M)return M;let $={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[M0]=$,$}var l=I2(),T=l.controllerRegistry,E=l.activeRuntimes;function $0(F){let M=F.getAttribute(i);if(!M)return[];return M.split(/\s+/).map(($)=>$.trim()).filter(($)=>$.length>0)}function s(F,M){if(F instanceof Element&&F.hasAttribute(i))M(F);for(let $ of Array.from(F.querySelectorAll(`[${i}]`)))M($)}class H0{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[$]of M)this.disconnectController(F,$);E.delete(this)}reconcileRegisteredController(F){s(this.root,(M)=>{if(!$0(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,$]of Array.from(this.controllersByElement.entries())){if(!$.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(s(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){E.add(this);return}this.observer=new MutationObserver((M)=>{for(let $ of M){if($.type==="attributes"&&$.target instanceof Element){this.reconcileElement($.target);continue}for(let H of Array.from($.removedNodes)){if(!(H instanceof Element))continue;s(H,(W)=>{this.disconnectElementControllers(W)})}for(let H of Array.from($.addedNodes)){if(!(H instanceof Element))continue;s(H,(W)=>{this.reconcileElement(W)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[i],attributes:!0,childList:!0,subtree:!0}),E.add(this)}reconcileElement(F){let M=new Set($0(F)),$=this.controllersByElement.get(F);if($){for(let H of $.keys())if(!M.has(H))this.disconnectController(F,H)}for(let H of M)this.connectController(F,H)}connectController(F,M){let $=T.get(M);if(!$)return;let H=this.controllersByElement.get(F);if(!H)H=new Map,this.controllersByElement.set(F,H);if(H.has(M))return;let W=new $(F);H.set(M,W),W.connect()}disconnectController(F,M){let $=this.controllersByElement.get(F);if(!$)return;let H=$.get(M);if(!H)return;if(H.disconnect(),$.delete(M),$.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let $ of Array.from(M.keys()))this.disconnectController(F,$)}}function E2(F,M){let $=T.get(F);if($)return $;YF(M,F),T.set(F,M);for(let H of Array.from(E))H.reconcileRegisteredController(F);return M}function wM(F){return T.has(F)}function T2(F,M){if(T.get(F)===M)return M;YF(M,F),T.set(F,M);for(let H of Array.from(E))H.replaceRegisteredController(F);return M}function W0(F){l.controllerRegistrationStrategy=F}function OM(){W0("replace")}function CM(){W0("keep-current")}function j0(F,M){if(l.controllerRegistrationStrategy==="replace")return T2(F,M);return E2(F,M)}function fM(F=document){return new H0(F)}function SM(){for(let F of Array.from(E))F.stop()}var DF;((W)=>{W.SUBSCRIPTION_REQUEST="context-subscription-request";W.CONTEXT_REQUEST="context-request";W.ON_MOUNT="context-on-mount";W.MOUNTED="context-mounted"})(DF||={});class JF extends Event{context;callback;subscribe;handled=!1;constructor(F,M,$){super("context-request",{bubbles:!0,composed:!0});this.context=F;this.callback=M;this.subscribe=$}markHandled(){this.handled=!0}}class n extends CustomEvent{constructor(F){super("context-on-mount",{detail:{context:F},bubbles:!0,composed:!0})}}class RF extends Event{context;callback;select;subscribe;onSubscribe;handled=!1;constructor(F,M,$,H,W){super("context-subscription-request",{bubbles:!0,composed:!0});this.context=F;this.callback=M;this.select=$;this.subscribe=H;this.onSubscribe=W}markHandled(){this.handled=!0}}function P0(F){return b({type:"context",...F})}function Z0(F){return h(F)}function bM(F){if(F instanceof Element)return F;if("host"in F)return F.host;if("element"in F)return F.element;return null}function G0(F){if(F instanceof Element)return F;if("host"in F)return F.host;if("element"in F)return F.element;return F}import{createMarkupNodeLike as w2}from"@ecopages/jsx";class C{host;context;hydrationKey;hydrate;serialize;pendingHostHydration;value;subscriptions=[];constructor(F,M){this.host=F,this.context=M.context,this.hydrationKey=M.hydrationKey,this.hydrate=M.hydrate,this.serialize=M.serialize,this.pendingHostHydration=Boolean(M.hydrate),this.value=M.initialValue,this.tryHydrateFromHost(),this.registerEvents(),this.host.dispatchEvent(new n(this.context))}setContext=(F,M)=>{if(this.tryHydrateFromHost(),this.pendingHostHydration=!1,typeof this.value>"u"&&this.isObject(F)){let $=this.value;if(this.value={...F},M)M(this.value);this.notifySubscribers(this.value,$);return}if(this.isObject(this.value)&&this.isObject(F)){let $={...this.value};if(this.value={...this.value,...F},M)M(this.value);this.notifySubscribers(this.value,$)}};getContext=()=>{return this.tryHydrateFromHost(),this.value};getContextKey=()=>{return this.context};serializeHydrationValue=()=>{if(this.tryHydrateFromHost(),!this.hydrate||typeof this.value>"u")return;let F=this.serialize?this.serialize(this.value):this.value;if(typeof F>"u")return;let M=JSON.stringify(F);if(typeof M!=="string")return;return Z0(M)};renderHydrationScriptTag=()=>{let F=this.serializeHydrationValue();if(!F)return;return P0({hydrationKey:this.hydrationKey,serializedValue:F})};renderHydrationScript=()=>{let F=this.renderHydrationScriptTag();if(!F)return;return w2(F)};subscribe=(F)=>{let M={hasChanged:($,H)=>{if(typeof H>"u"||!F.select)return!0;return F.select($)!==F.select(H)},notify:($)=>{if(F.select){F.callback(F.select($),M.unsubscribe);return}F.callback($,M.unsubscribe)},unsubscribe:()=>{let $=this.subscriptions.indexOf(M);if($!==-1)this.subscriptions.splice($,1)}};return this.subscriptions.push(M),M.unsubscribe};tryHydrateFromHost(){if(!this.pendingHostHydration)return;let F=this.findHydrationScriptElement();if(!F)return;this.value=this.mergeHydrationValue(g(F,this.value)),this.pendingHostHydration=!1}mergeHydrationValue(F){if(this.hydrate===Object&&this.isObject(F)&&(this.isObject(this.value)||typeof this.value>"u"))return{...this.value??{},...F};return F}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}findHydrationScriptElement(){return y(G0(this.host),"context",this.hydrationKey)}notifySubscribers=(F,M)=>{for(let $ of this.subscriptions)if($.hasChanged(F,M))$.notify(F)};handleSubscriptionRequest=(F,{subscribe:M,onSubscribe:$})=>{this.tryHydrateFromHost();let H=M?this.subscribe(F):void 0;if(H)$?.(H);if(typeof this.value>"u")return;if(F.select)F.callback(F.select(this.value),H);else F.callback(this.value,H)};onSubscriptionRequest=(F)=>{let{context:M,callback:$,subscribe:H,select:W,target:j,onSubscribe:P}=F;if(M!==this.context)return;if(F.markHandled(),F.stopPropagation(),j instanceof EventTarget)j.dispatchEvent(new n(this.context));if(W){this.handleSubscriptionRequest({select:W,callback:$},{subscribe:H,onSubscribe:P});return}this.handleSubscriptionRequest({callback:$},{subscribe:H,onSubscribe:P})};onContextRequest=(F)=>{let{context:M,callback:$}=F;if(M!==this.context)return;F.markHandled(),F.stopPropagation(),$(this)};registerEvents=()=>{this.host.addEventListener("context-subscription-request",this.onSubscriptionRequest),this.host.addEventListener("context-request",this.onContextRequest)}}var pM=(F)=>F;var X0=Symbol.for("@ecopages/radiant.ssr-context-provider-resolver");function Q0(){return globalThis}function iM(F){Q0()[X0]=F}function qF(F){return Q0()[X0]?.(F)}function _F(F,M,$,H={}){let W=qF(M);if(!W)return!1;if($(W),F.connectedContextCallback(M),H.emitMounted)F.dispatchEvent(new CustomEvent("context-mounted",{detail:W}));return!0}function B0(F,M,$,H={}){let W=new JF(M,(j)=>{if($(j),F.connectedContextCallback(M),H.emitMounted)F.dispatchEvent(new CustomEvent("context-mounted",{detail:j}))});return F.dispatchEvent(W),W.handled}function f(F,M){let $=qF(F);if(!$)return!1;let H=$.getContext();if(M.select)return M.callback(M.select(H)),!0;return M.callback(H),!0}function zF(F,M,$,H){let W=new RF(M,$.callback,$.select,H.subscribe,H.onSubscribe);return F.dispatchEvent(W),W.handled}function a(F,M,$,H={}){return L0(F,()=>_F(F,M,$,H))}function J(F,M,$,H){return L0(F,()=>{if(H)return f(M,{callback:$,select:H});return f(M,{callback:$})})}function r(F,M,$,H={}){if(_F(F,M,$,H))return!0;return B0(F,M,$,H)}function Y(F,M,$,H={}){if(H.select){let j={callback:$,select:H.select};if(f(M,j))return!0;return zF(F,M,j,{subscribe:H.subscribe,onSubscribe:H.onSubscribe})}let W={callback:$};if(f(M,W))return!0;return zF(F,M,W,{subscribe:H.subscribe,onSubscribe:H.onSubscribe})}function L0(F,M){return v(F,M),M()}function A0(F){return(M,$)=>{let H=(j,P)=>{j[$]=P},W=(j,P={})=>{if(j[$])return!0;return r(j,F,(Z)=>{H(j,Z)},P)};B(M,(j)=>{a(j,F,(P)=>{H(j,P)}),j.registerConnectedCallback(()=>{if(W(j,{emitMounted:!0}))return;queueMicrotask(()=>{W(j,{emitMounted:!0})})})})}}function U0(F){return(M,$)=>{let H=String($.name),W=(P,Z)=>{let G=P;G[H]=Z},j=(P,Z={})=>{if(P[H])return!0;return r(P,F,(X)=>{W(P,X)},Z)};$.addInitializer(function(){if(a(this,F,(P)=>{W(this,P)},{emitMounted:!0}))return;this.registerConnectedCallback(()=>{if(j(this,{emitMounted:!0}))return;queueMicrotask(()=>{j(this,{emitMounted:!0})})})})}}function O2(F){return typeof F==="function"}function A(F,M,$,H){if(typeof H==="object")return F(void 0,H);return M($,H)}function D(F,M,$,H,W){if(typeof H==="object"){if(!O2($))throw TypeError("Standard method decorators require a method target");return F($,H)}if(!W)throw TypeError("Legacy method decorators require a property descriptor");return M($,H,W)}function X$(F){function M($,H){return A(U0(F),A0(F),$,H)}return M}function R(F,M,$){let H=!1,W,j=F;return(P)=>{if(j[N]!==!0&&H&&Object.is(W,P))return;if(H=!0,W=P,M(P),$&&typeof j.requestUpdate==="function")j.requestUpdate()}}function o({context:F,select:M,subscribe:$=!0,requestUpdate:H=!0}){return(W,j,P)=>{let Z=P.value;return B(W,(G)=>{let X,Q=R(G,(L)=>{Z.call(G,L)},H);J(G,F,Q,M),G.registerConnectedCallback(()=>{if(Y(G,F,Q,{onSubscribe:(L)=>{X=L},select:M,subscribe:$}))return;queueMicrotask(()=>{Y(G,F,Q,{onSubscribe:(L)=>{X=L},select:M,subscribe:$})})}),G.registerCleanupCallback(()=>{X?.(),X=void 0})}),P}}function t({context:F,select:M,subscribe:$=!0,requestUpdate:H=!0}){return function(W,j){j.addInitializer(function(){let P,Z=R(this,(X)=>{W.call(this,X)},H);if(J(this,F,Z,M))return;let G=()=>{return Y(this,F,Z,{onSubscribe:(X)=>{P=X},select:M,subscribe:$})};this.registerCleanupCallback(()=>{P?.(),P=void 0}),this.registerConnectedCallback(()=>{if(G())return;queueMicrotask(()=>{G()})})})}}function Y0(F){let{context:M,select:$,subscribe:H=!0}=F;return(W,j)=>{B(W,(P)=>{let Z,G=R(P,(X)=>{P[j]=X},!0);J(P,M,G,$),P.registerConnectedCallback(()=>{if(Y(P,M,G,{onSubscribe:(X)=>{Z=X},select:$,subscribe:H}))return;queueMicrotask(()=>{Y(P,M,G,{onSubscribe:(X)=>{Z=X},select:$,subscribe:H})})}),P.registerCleanupCallback(()=>{Z?.(),Z=void 0})})}}function D0(F){let{context:M,select:$,subscribe:H=!0}=F;return function(W,j){let P=String(j.name);return j.addInitializer(function(){let Z,G=R(this,(Q)=>{let L=this;L[P]=Q},!0);if(J(this,M,G,$))return;let X=()=>{return Y(this,M,G,{onSubscribe:(Q)=>{Z=Q},select:$,subscribe:H})};this.registerCleanupCallback(()=>{Z?.(),Z=void 0}),this.registerConnectedCallback(()=>{if(X())return;queueMicrotask(()=>{X()})})}),function(Z){return Z}}}function S$(F){function M($,H,W){if(typeof H==="object"){if(H.kind==="field"){if($!==void 0)throw TypeError("@contextSelector field decorators require an undefined target");return D0(F)(void 0,H)}if(typeof $!=="function")throw TypeError("@contextSelector standard method decorators require a method target");return t(F)($,H)}if(W){if(typeof $==="function"||$===void 0)throw TypeError("@contextSelector legacy method decorators require a host target");return o(F)($,H,W)}if(typeof $==="function"||$===void 0)throw TypeError("@contextSelector legacy field decorators require a host target");return Y0(F)($,H)}return M}function b$(F){function M($,H,W){return D(t(F),o(F),$,H,W)}return M}function J0({context:F,initialValue:M,hydrate:$,serialize:H}){return(W,j)=>{let P=(Z)=>{if(Z[j])return;let G=new C(Z,{context:F,hydrationKey:j,initialValue:M,hydrate:$,serialize:H});Z[j]=G,Z.registerContextProvider(j,G),Z.connectedContextCallback(F)};B(W,(Z)=>{P(Z),Z.registerConnectedCallback(()=>{P(Z)})})}}function R0({context:F,initialValue:M,hydrate:$,serialize:H}){return(W,j)=>{let P=String(j.name);j.addInitializer(function(){let Z=this,G=new C(this,{context:F,hydrationKey:P,initialValue:M,hydrate:$,serialize:H});Z[P]=G,this.registerContextProvider(P,G),this.connectedContextCallback(F)})}}function i$(F){function M($,H){return A(R0(F),J0(F),$,H)}return M}function kF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function C2(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function f2(F,M){if(M.converter?.fromAttribute){let $=M.converter.fromAttribute(F);if(F===null&&$===void 0&&"defaultValue"in M)return M.defaultValue;return $}if(M.type){if(F===null)return M.defaultValue??O(M.type);if(M.type===Boolean&&F==="")return!0;return I(F,M.type)}if(F===null)return M.defaultValue;return F}function z(F,M,$){return f2(kF(F).getAttribute(M),$)}function S2(F,M,$,H){let W=H.converter?.toAttribute?H.converter.toAttribute($):H.type?d($,H.type):$==null?null:String($);if(W===null){F.removeAttribute(M);return}F.setAttribute(M,W)}function e(F,M,$={}){if($.type&&$.defaultValue!==void 0&&!U($.type,$.defaultValue))throw Error(`defaultValue does not match the expected type for ${$.type.name}`);let H=F,W=$.source??C2(M),j=Symbol(`@ecopages/radiant/attr:${M}:observer`),P=Symbol(`@ecopages/radiant/attr:${M}:last-value`),Z=$.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,Z),F.registerReactiveDependencyReader(M,()=>z(F,W,$)),H[P]=z(F,W,$),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),z(this,W,$)},set(Q){let L=kF(this),q=z(this,W,$);S2(L,W,Q,$);let k=z(this,W,$);if(Object.is(q,k))return;this[P]=k,F.notifyUpdate(M,q,k)},enumerable:!0,configurable:!0});let G=()=>{H[j]?.disconnect()},X=()=>{let Q=z(F,W,$),L=H[P];if(!Object.is(L,Q))H[P]=Q,F.notifyUpdate(M,L,Q);if(typeof MutationObserver>"u")return;let q=kF(F);G();let k=new MutationObserver(()=>{let XF=z(F,W,$),wF=H[P];if(Object.is(wF,XF))return;H[P]=XF,F.notifyUpdate(M,wF,XF)});k.observe(q,{attributeFilter:[W],attributes:!0}),H[j]=k};X(),F.registerConnectedCallback(X),F.registerCleanupCallback(G)}function q0(F={}){return(M,$)=>{let H=Symbol(`@ecopages/radiant/attr:${$}:installed`);B(M,(W)=>{W.registerConnectedCallback(()=>{if(W[H])return;let j=W[$],P=F.defaultValue===void 0?j:F.defaultValue;e(W,$,{...F,defaultValue:P}),W[H]=!0})})}}function _0(F={}){return function(M,$){let H=String($.name),W=Symbol(`@ecopages/radiant/attr:${H}:initializer`);return $.addInitializer(function(){let j=this[W],P=F.defaultValue===void 0?j:F.defaultValue;e(this,H,{...F,defaultValue:P})}),function(j){return this[W]=j,j}}}function WH(F={}){function M($,H){return A(_0(F),q0(F),$,H)}return M}function z0(F,M,$){let H=$.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return H;let W=H.bind(this);return Object.defineProperty(this,M,{value:W,configurable:!0,writable:!0}),W}}}function k0(F,M){let $=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${$}.`);M.addInitializer(function(){this[$]=this[$].bind(this)})}function BH(F,M,$){return D(k0,z0,F,M,$)}function UH(F){return function(M){return j0(F,M)}}var K0=Symbol.for("@ecopages/radiant.customElementTagName");function FF(F,M){F[K0]=M}function DH(F){return F[K0]}function I0(F,M){return($)=>{if(FF($,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,$,M)}}function E0(F,M){return function($,H){H.addInitializer(function(){if(FF(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function IH(F,M){function $(H,W){if(typeof W<"u")return E0(F,M)(H,W);return I0(F,M)(H)}return $}function MF(F,M){let $=null,H=null,W,j=()=>{if($!==null)clearTimeout($),$=null},P=()=>{if(H===null)return W;let G=H;return H=null,j(),W=G(),W},Z=function(...G){H=()=>F.apply(this,G),j(),$=setTimeout(()=>{P()},M)};return Z.cancel=()=>{j(),H=null},Z.flush=()=>{if(H===null)return W;return P()},Z.pending=()=>H!==null,Z}function T0(F){return(M,$,H)=>{let W=H.value,j=new WeakMap;return H.value=function(...Z){let G=j.get(this);if(!G)G=MF((...X)=>{return W.apply(this,X)},F),j.set(this,G);G(...Z)},H}}function w0(F){return(M)=>{let $=new WeakMap;return function(...H){let W=$.get(this);if(!W)W=MF((...j)=>{return M.apply(this,j)},F),$.set(this,W);W(...H)}}}function NH(F){function M($,H,W){return D(w0(F),T0(F),$,H,W)}return M}class KF{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function $F(F,M){let $=new KF(F,M);return F.registerEventEmitter(M.name,$),$}function O0(F){return(M,$)=>{B(M,(H)=>{let W=$F(H,F);H.registerConnectedCallback(()=>{Object.defineProperty(H,$,{get(){return W},enumerable:!0,configurable:!0})})})}}function C0(F){return function(M,$){$.addInitializer(function(){let H=$F(this,F);Object.defineProperty(this,$.name,{get(){return H},enumerable:!0,configurable:!0})})}}function lH(F){function M($,H){return A(C0(F),O0(F),$,H)}return M}var HF=Symbol("radiant.shadowRootListenerHooks"),f0=Symbol("radiant.patchedAttachShadow");function V0(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function V2(F){return!(F instanceof Element)}function S0(F,M,$,H){let W=(j)=>{if(j.target instanceof Element&&j.target.matches($))H(j)};return F.addEventListener(M.type,W,M.options),()=>{F.removeEventListener(M.type,W,M.options)}}function x2(F,M){let $=V0(F);if(!$[HF])$[HF]=new Set;if($[HF].add(M),$[f0])return;let H=$.attachShadow;$.attachShadow=function(j){let P=H.call(this,j);for(let Z of $[HF]??[])Z();return P},$[f0]=!0}function WF(F,M,$){if(V2(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let H=V0(F),W=$.bind(F),j=null,P=null,Z=null,G=null,X=!1,Q=()=>{j?.(),P?.(),Z?.(),G?.(),j=null,P=null,Z=null,G=null},L=()=>{if(X)return;if("window"in M&&!j)window.addEventListener(M.type,W,M.options),j=()=>{window.removeEventListener(M.type,W,M.options)};if("document"in M&&!P)document.addEventListener(M.type,W,M.options),P=()=>{document.removeEventListener(M.type,W,M.options)};if("selector"in M||"ref"in M){let q="selector"in M?M.selector:`[data-ref='${CSS.escape(M.ref)}']`;if(M.scope!=="shadow"&&!Z)Z=S0(H,M,q,W);if(M.scope!=="light"&&H.shadowRoot&&!G)G=S0(H.shadowRoot,M,q,W)}};if("selector"in M||"ref"in M){if(M.scope!=="light")x2(F,()=>{if(F.isConnected)L()})}if(F.registerConnectedCallback(L),F.registerCleanupCallback(Q),F.isConnected)L();return()=>{X=!0,Q()}}function x0(F){return(M,$,H)=>{let W=H.value;return B(M,(j)=>{WF(j,F,W.bind(j))}),H}}function N0(F){return function(M,$){$.addInitializer(function(){WF(this,F,M.bind(this))})}}function W9(F){function M($,H,W){return D(N0(F),x0(F),$,H,W)}return M}function v0(F){return(M,$)=>{let H=Symbol(`@ecopages/radiant/on-updated:${$}:cleanup`);B(M,(W)=>{W.registerConnectedCallback(()=>{let j=W[$].bind(W),P=[];if(Array.isArray(F))for(let Z of F)P.push(W.registerUpdateCallback(Z,j));else if(typeof F==="string")P.push(W.registerUpdateCallback(F,j));W[H]=()=>{for(let Z of P)Z()}}),W.registerCleanupCallback(()=>{let j=W[H];if(typeof j==="function")j(),delete W[H]})})}}function b0(F){return function(M,$){$.addInitializer(function(){let H=M.bind(this);if(Object.defineProperty(this,$.name,{value:H,configurable:!0,writable:!0}),Array.isArray(F))for(let W of F)this.registerUpdateCallback(W,H);else if(typeof F==="string")this.registerUpdateCallback(F,H)})}}function L9(F){function M($,H,W){return D(b0(F),v0(F),$,H,W)}return M}var IF=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function jF(F,M,$){let H=F.constructor,W=H[IF]??[];if(W.some((j)=>j.name===M))return;W.push({name:M,options:$}),H[IF]=W}function U9(F){return(F.constructor[IF]??[]).slice()}function h0({type:F,attribute:M,reflect:$,defaultValue:H,bind:W}){if(H!==void 0&&!U(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return(j,P)=>{let Z=M??P;jF(j,P,{type:F,reflect:$,attribute:Z,defaultValue:H,bind:W});let G=Symbol.for(`@ecopages/radiant.ssr-prop:${P}`);Object.defineProperty(j,P,{get(){return this[G]??H},set(X){this[G]=X},configurable:!0,enumerable:!0}),B(j,(X)=>{X.registerConnectedCallback(()=>{let Q=X[P],L=H===void 0?Q:H;X.createReactiveProp(P,{type:F,reflect:$,attribute:Z,defaultValue:L,bind:W})})})}}function g0({type:F,attribute:M,reflect:$,defaultValue:H,bind:W}){if(H!==void 0&&!U(F,H))throw Error(`defaultValue does not match the expected type for ${F.name}`);return function(j,P){let Z=String(P.name),G=M??Z,X=Symbol(`@ecopages/radiant/reactive-prop:${Z}:initializer`);return P.addInitializer(function(){let Q=this[X],L=H===void 0?Q:H;jF(this,Z,{type:F,reflect:$,attribute:G,defaultValue:H,bind:W}),this.createReactiveProp(Z,{type:F,reflect:$,attribute:G,defaultValue:L,bind:W})}),function(Q){return this[X]=Q,Q}}}function T9(F){function M($,H){return A(g0(F),h0(F),$,H)}return M}function N2(F){return!(F instanceof Element)}function v2(F){return"shadowRoot"in F?F.shadowRoot??null:null}function b2(F){return F instanceof Element?F:F.host}function h2(F,M="light"){let $=v2(F);if(M==="shadow")return $?[$]:[];if(M==="both")return $?[F,$]:[F];return[F]}function PF(F,M){if(N2(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let $=b2(F),H="selector"in M?M.selector:`[data-ref="${M.ref}"]`,W=null,j=()=>{let P=h2($,M.scope);if(M.all)return P.flatMap((Z)=>Array.from(Z.querySelectorAll(H)));for(let Z of P){let G=Z.querySelector(H);if(G)return G}return null};return{get value(){if(M.cache){if(W===null||M.all&&Array.isArray(W)&&!W.length)W=j();return W}return j()}}}function y0({cache:F=!0,...M}){return($,H)=>{B($,(W)=>{W.registerConnectedCallback(()=>{let j=PF(W,{cache:F,...M});Object.defineProperty(W,H,{get(){return j.value},enumerable:!0,configurable:!0})})})}}function m0(F){return function(M,$){let H=String($.name);$.addInitializer(function(){let W=PF(this,F);Object.defineProperty(this,H,{get(){return W.value},enumerable:!0,configurable:!0})})}}function h9(F){function M($,H){return A(m0(F),y0(F),$,H)}return M}function S(F,M={}){let $=null,H,W=()=>{if(M.all)return typeof F.getSlotElements==="function"?F.getSlotElements(M.name):[];return typeof F.getSlotElement==="function"?F.getSlotElement(M.name):null};return{get value(){if(M.cache===!1)return W();let j=F.slotProjectionVersion??0;if(H!==j)$=W(),H=j;return $}}}function u0(F={}){return(M,$)=>{let H=(P)=>{return typeof Object.getOwnPropertyDescriptor(P,$)?.get==="function"},W=(P)=>{if(H(P))return;let Z=S(P,F);Object.defineProperty(P,$,{get(){return Z.value},enumerable:!0,configurable:!0})},j=new WeakMap;Object.defineProperty(M,$,{get(){let P=j.get(this);if(!P)P=S(this,F),j.set(this,P);return P.value},enumerable:!0,configurable:!0}),B(M,(P)=>{v(P,()=>{W(P)}),P.registerConnectedCallback(()=>{W(P)})})}}function d0(F={}){return function(M,$){let H=String($.name);$.addInitializer(function(){let W=S(this,F);Object.defineProperty(this,H,{get(){return W.value},enumerable:!0,configurable:!0})})}}function a9(F={}){function M($,H){return A(d0(F),u0(F),$,H)}return M}function c0(F){return b({type:"signal",...F})}function p0(F){return h(F)}import{createMarkupNodeLike as g2}from"@ecopages/jsx";import{state as y2}from"@ecopages/signals";function ZF(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class V{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??y2(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return g2(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return c0({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return y(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let $=g(M,F);if(this.hydrate===Object&&this.isObject($)&&this.isObject(F))return{...F,...$};return $}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return p0(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function GF(F){return new V(F)}function EF(F={}){return(M,$)=>{let H=(W)=>{let j=W[$];if(j instanceof V)return j;let P=typeof F.source==="function"?F.source(W):F.source??(ZF(j)?j:void 0),Z=F.bind??W.shouldAutoBindReactiveMembers?.()??!1,G=P!==void 0?F.initial:j===void 0?F.initial:j;W.defineReactiveBinding($,Z);let X=GF({host:W,hydrate:F.hydrate,hydrationKey:$,initialValue:G,property:$,source:P});if(W.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),W.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate)W.registerHydrationBinding($,X);return W[$]=X,X};B(M,(W)=>{let j=H(W);W.registerConnectedCallback(()=>{if(!(W[$]instanceof V))W[$]=j})})}}function TF(F={}){return function(M,$){let H=String($.name);return function(W){let j=typeof F.source==="function"?F.source(this):F.source??(ZF(W)?W:void 0),P=j!==void 0?F.initial:W===void 0?F.initial:W,Z=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding(H,Z);let G=GF({host:this,hydrate:F.hydrate,hydrationKey:H,initialValue:P,property:H,source:j});if(this.registerConnectedCallback(()=>{G.hydrateFromHost(),G.connectToSource()}),this.registerCleanupCallback(()=>{G.disconnectFromSource()}),F.hydrate)this.registerHydrationBinding(H,G);return G}}}function B3(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return TF()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return EF()(F,M)}let $=F??{};function H(W,j){if(typeof j==="object"){if(W!==void 0)throw TypeError("@signal standard decorators require an undefined target");return TF($)(void 0,j)}if(W===void 0)throw TypeError("@signal legacy decorators require a host target");return EF($)(W,j)}return H}function s0(F,M){B(F,($)=>{$.registerConnectedCallback(()=>{$.createReactiveField(M,$[M],{bind:$.shouldAutoBindReactiveMembers?.()??!1})})})}function i0(F,M){let $=Symbol(`__${String(M.name)}__value`),H=String(M.name);return M.addInitializer(function(){this.defineReactiveBinding(H,this.shouldAutoBindReactiveMembers?.()??!1),this.registerReactiveDependencyReader(H,()=>this[$]),Object.defineProperty(this,M.name,{get(){return this.trackReactiveRead(H),this[$]},set(W){let j=this[$];if(j!==W)this[$]=W,this.notifyUpdate(H,j,W)},enumerable:!0,configurable:!0})}),function(W){return this[$]=W,W}}function q3(F,M){return A(i0,s0,F,M)}export{SM as stopControllers,q3 as state,fM as startControllers,B3 as signal,W0 as setControllerRegistrationStrategy,T2 as replaceController,j0 as registerControllerWithConfiguredStrategy,E2 as registerController,a9 as querySlot,h9 as query,i$ as provideContext,T9 as prop,L9 as onUpdated,W9 as onEvent,b$ as onContextUpdate,wM as hasRegisteredController,lH as event,OM as enableControllerReplacementForHmr,CM as disableControllerReplacementForHmr,NH as debounce,IH as customElement,pM as createContext,UH as controller,S$ as contextSelector,X$ as consumeContext,BH as bound,kM as bindReactiveValue,WH as attr,p as RadiantElement,eF as RadiantController,H0 as ControllerRegistryRuntime,RF as ContextSubscriptionRequestEvent,JF as ContextRequestEvent,C as ContextProvider,n as ContextOnMountEvent,DF as ContextEventsTypes,i as CONTROLLER_ATTRIBUTE};
|
|
1
|
+
var B0=((F)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(F,{get:(M,$)=>(typeof require<"u"?require:M)[$]}):F)(function(F){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+F+'" is not supported')});var n=Symbol.for("@ecopages/radiant.legacy-instance-initializers");function Q(F,M){let P=F[n];if(Array.isArray(P)){P.push(M);return}Object.defineProperty(F,n,{value:[M],configurable:!0})}function w(F){let M=[],$=Object.getPrototypeOf(F);while($&&$!==Object.prototype)M.push($),$=Object.getPrototypeOf($);for(let P=M.length-1;P>=0;P-=1){let H=M[P][n];if(!Array.isArray(H))continue;for(let W of H)W(F)}}import{createSubscribableJsxValue as xM}from"@ecopages/jsx";import{trackDependency as jF}from"@ecopages/signals";class ZF{read;subscribers=new Set;watcherListeners=new Set;version=0;constructor(F){this.read=F}get(){return jF(this),this.read()}subscribe(F){return this.subscribers.add(F),()=>{this.subscribers.delete(F)}}addWatcher(F){return this.watcherListeners.add(F),()=>{this.watcherListeners.delete(F)}}getVersion(){return this.version}notify(F){this.version+=1;let M;try{this.notifyWatchers()}catch($){M=$}if(this.publish(F),M)throw M}publish(F){for(let M of this.subscribers)M(F)}notifyWatchers(){let F=[];for(let M of this.watcherListeners)try{M()}catch($){F.push($)}if(F.length===1)throw F[0];if(F.length>1)throw AggregateError(F,"Multiple reactive dependency notifications failed.")}}function AM(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"}class k{host;access;shouldAutoBind;bindings;$;reactiveFields=new Map;reactiveDependencies=new Map;reactiveDependencyReaders=new Map;reactiveBindings=new Map;updateCallbacks=new Map;onConnectedCallbacks=[];onDisconnectedCallback=[];constructor(F,M,$){this.host=F;this.access=M;this.shouldAutoBind=$;let P=this.createReactiveBindingNamespace();this.bindings=P,this.$=P}connectHost(){for(let F of this.onConnectedCallbacks)F()}disconnectHost(){for(let F of this.onDisconnectedCallback)F()}notifyUpdate(F,M,$){if(M===$)return;this.reactiveDependencies.get(F)?.notify($);let P=this.updateCallbacks.get(F);if(P)for(let H of P)H()}registerCleanupCallback(F){this.onDisconnectedCallback.push(F)}registerConnectedCallback(F){this.onConnectedCallbacks.push(F)}registerHydrationBinding(F,M){}registerReactiveDependencyReader(F,M){this.reactiveDependencyReaders.set(F,M)}registerUpdateCallback(F,M){if(!this.updateCallbacks.has(F))this.updateCallbacks.set(F,new Set);let $=this.updateCallbacks.get(F);return $.add(M),()=>{if($.delete(M),$.size===0)this.updateCallbacks.delete(F)}}getReactiveBinding(F){let M=this.reactiveBindings.get(F);if(M)return M;let $=xM({getValue:()=>this.readReactiveBindingValue(F),subscribe:(P)=>this.registerUpdateCallback(F,()=>{P(this.readReactiveBindingValue(F))})});return this.reactiveBindings.set(F,$),$}bind(F){return this.getReactiveBinding(F)}defineReactiveBinding(F,M=!0){let $=typeof M==="string"?M:M?`$${F}`:void 0,P=this.access.getBindingTarget?.(this.host)??this.host;if(!$||this.access.hasProperty(this.host,$))return;this.access.defineProperty(P,$,{get:()=>this.getReactiveBinding(F),enumerable:!1,configurable:!0})}trackReactiveRead(F){jF(this.getReactiveDependency(F))}defineReactiveAccessor(F,M){let $=M.bind??this.shouldAutoBind();if(this.defineReactiveBinding(F,$),this.registerReactiveDependencyReader(F,M.getValue),this.access.defineProperty(this.host,F,{get:()=>{return this.trackReactiveRead(F),M.getValue()},set:(P)=>{let H=M.getValue();if(H===P)return;M.setValue(P),this.notifyUpdate(F,H,P)},enumerable:!0,configurable:!0}),M.notifyInitialValue!==void 0)this.notifyUpdate(F,void 0,M.notifyInitialValue)}createReactiveField(F,M,$={}){let P={name:F,value:M,initialValue:M};this.reactiveFields.set(F,P),this.defineReactiveAccessor(F,{bind:$.bind,getValue:()=>this.reactiveFields.get(F)?.value,setValue:(H)=>{this.reactiveFields.set(F,{...P,value:H})},notifyInitialValue:M})}createReactiveBindingNamespace(){return new Proxy(Object.create(null),{get:(F,M)=>{if(typeof M!=="string")return;return this.getReactiveBinding(M)}})}getReactiveDependency(F){let M=this.reactiveDependencies.get(F);if(M)return M;let $=new ZF(()=>this.readReactiveDependencyValue(F));return this.reactiveDependencies.set(F,$),$}readReactiveDependencyValue(F){let M=this.reactiveDependencyReaders.get(F);if(M)return M();return this.readReactiveBindingValue(F)}readReactiveBindingValue(F){let M=this.access.readProperty(this.host,F);if(AM(M))return M.get();return M}}var r=Symbol.for("@ecopages/radiant.ssr-preparation-callbacks"),XF=Symbol.for("@ecopages/radiant.ssr-preparation-running");function GF(F,M){let P=F[r];if(Array.isArray(P)){P.push(M);return}Object.defineProperty(F,r,{value:[M],configurable:!0})}function BF(F){let M=F,$=M[r];if(!Array.isArray($))return;M[XF]=!0;try{for(let P of $)P()}finally{delete M[XF]}}function QF(F){return F.replace(/&/g,"\\u0026").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}var J="data-hydration",qF="data-hydration-type",o="data-hydration-key";function RF(F){let M=F.hydrationKey?` ${o}="${YM(F.hydrationKey)}"`:"";return`<script type="application/json" ${J} ${qF}="${F.type}"${M}>${F.serializedValue}</script>`}function DF(F){return QF(F)}function LF(F,M){let $=F.textContent;if(!$)return M;try{return JSON.parse($)}catch{if(typeof console<"u")console.warn(`[@ecopages/radiant] Failed to parse hydration payload from <script ${J}>:`,$.slice(0,120));return M}}function JF(F,M,$){let P=F.children;if(!P||P.length===0){let H=F.childNodes;if(!H||H.length===0)return null;for(let W=0;W<H.length;W+=1){let j=H[W];if(j.nodeType!==1)continue;let Z=j;if(UF(Z,M,$))return Z}return null}for(let H=0;H<P.length;H+=1)if(UF(P[H],M,$))return P[H];return null}function UF(F,M,$){if(F.tagName!=="SCRIPT"||!F.hasAttribute(J)||F.getAttribute(qF)!==M)return!1;if($!==void 0)return F.getAttribute(o)===$;return!F.hasAttribute(o)}function YM(F){return F.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}import{createMarkupNodeLike as zM,isKeyedJsxValue as xF,isSlotJsxValue as _M}from"@ecopages/jsx";var Y="",O="data-radiant-slot-projection";function AF(F){let M=new Map;for(let $ of Array.from(F.childNodes)){if(IM($))continue;TM(M,KM($),$)}return M}function YF(F){let M;try{M=JSON.parse(F)}catch{if(typeof console<"u")console.warn("[@ecopages/radiant] Failed to parse slot projection payload:",F.slice(0,120));return new Map}let $=new Map;for(let[P,H]of Object.entries(M)){if(!Array.isArray(H)||H.length===0)continue;$.set(a(P),H.map((W)=>zM(W)))}return $}function zF(F){let M=Array.from(F.childNodes).filter(($)=>EF($)).map(($)=>C($)??"").filter(($)=>$!=="");return M.length>0?M.join(""):void 0}function _F(F){let M={};for(let[$,P]of F.entries()){let H=P.map((W)=>C(W)).filter((W)=>W!==void 0&&W!=="");if(H.length>0)M[$]=H}return Object.keys(M).length>0?JSON.stringify(M):void 0}function TF(F,M){let $=!1,P=(W)=>{if(_M(W))return $=!0,wM(W,M,P);if(xF(W))return kM(W,P(W.value));if(EM(W))return{_$rType$:1,rootLocalName:W.rootLocalName,strings:W.strings,values:W.values.map((j)=>P(j))};if(KF(W))return Array.from(W,(j)=>P(j));return W},H=P(F);return{containsSlots:$,value:H}}function kF(F){for(let M of Array.from(F.childNodes)){if(!IF(M))continue;let $=M.textContent??void 0;return M.parentNode?.removeChild(M),$}return}function TM(F,M,$){let P=F.get(M);if(P){P.push($);return}F.set(M,[$])}function kM(F,M){return{...F,value:M}}function KM(F){if(F instanceof Element)return a(F.getAttribute("slot"));return Y}function KF(F){return typeof F!=="string"&&typeof F==="object"&&F!==null&&Symbol.iterator in F}function IF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(O)}function EF(F){return F instanceof HTMLScriptElement&&F.hasAttribute(J)}function IM(F){return IF(F)||EF(F)}function EM(F){return typeof F==="object"&&F!==null&&F._$rType$===1&&Array.isArray(F.strings)&&Array.isArray(F.values)}function a(F){return F??Y}function C(F){if(F===void 0||F===null||F===!1||F===!0)return;if(typeof Node<"u"&&F instanceof Node){if(F.nodeType===Node.TEXT_NODE)return F.textContent??"";return F.outerHTML??F.textContent??void 0}if(xF(F))return C(F.value);if(typeof F==="string"||typeof F==="number"||typeof F==="bigint")return String(F);if(typeof F==="object"&&F!==null&&"outerHTML"in F)return typeof F.outerHTML==="string"?F.outerHTML:F.textContent??void 0;if(KF(F))return Array.from(F,(M)=>C(M)??"").join("");return}function wM(F,M,$){let P=M.get(a(F.name));if(P&&P.length>0)return P.length===1?P[0]:P;if(F.fallback===void 0)return"";return $(F.fallback)}var t=Symbol.for("@ecopages/radiant.hydrator-installed");function T0(){globalThis[t]=!0}function k0(){delete globalThis[t]}function wF(){return globalThis[t]===!0}var CF=Symbol.for("@ecopages/radiant.component-ssr-runtime");function OF(){return globalThis[CF]}function I0(F){globalThis[CF]=F}function VF(F){switch(F){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function CM(F){switch(typeof F){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(F))return"array";if(Object.prototype.toString.call(F)==="[object Object]")return"object"}function K(F){switch(F){case Number:return 0;case String:return"";case Boolean:return!1;default:return null}}function OM(F){try{return JSON.parse(F)}catch{throw TypeError("Invalid JSON string")}}var SM={array(F){let M=OM(F);if(!Array.isArray(M))throw TypeError(`Expected an array but got a value of type "${typeof M}"`);return M},boolean(F){return!(F==="0"||String(F).toLowerCase()==="false")},number(F){return Number(F.replace(/_/g,""))},object(F){let M=JSON.parse(F);if(M===null||typeof M!=="object"||Array.isArray(M))throw TypeError(`expected value of type "object" but instead got value "${F}" of type "${CM(M)}"`);return M},string(F){return F}},SF={default:bF,array:fF,object:fF};function fF(F){return JSON.stringify(F)}function bF(F){return`${F}`}function z(F,M){let $=VF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return SM[$](F)}function S(F,M){let $=VF(M);if(!$)throw TypeError(`[radiant-element] Unknown type "${M}"`);return(SF[$]??SF.default??bF)(F)}function fM(F){return typeof F==="boolean"}function VM(F){return typeof F==="number"}function bM(F){return typeof F==="string"}function NM(F){return Array.isArray(F)}function vM(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}function R(F,M){switch(F){case Boolean:return fM(M);case Number:return VM(M);case String:return bM(M);case Array:return NM(M);case Object:return vM(M);default:return!1}}var NF=(F,M,$,P)=>{if(M===Boolean){let W=F.getAttribute($);if(W===null)return P;return W===""?!0:z(W,M)}let H=F.getAttribute($);return H!==null?z(H,M):P??K(M)};import{hasHydrationMarkers as hM,hydrate as gM,jsx as yM,render as uM}from"@ecopages/jsx";import{Computed as mM,subtle as cM}from"@ecopages/signals";var dM=sM();function sM(){if(typeof HTMLElement<"u")return HTMLElement;throw Error("RadiantElement requires HTMLElement. Install '@ecopages/radiant/server/light-dom-shim' before importing Radiant components in SSR.")}class V extends dM{bindings;$;reactiveHost;reactiveProperties=new Map;contextProviders=new Map;hydrationBindings=new Map;eventSubscriptions=new Map;eventEmitters=new Map;elementReady=!1;isRendering=!1;isFirstConnectPending=!1;isRenderScheduled=!1;needsRender=!1;projectedSlotContent=new Map;renderSignal;renderWatcher=new cM.Watcher(()=>{this.requestUpdate()});slotProjectionObserver;slotProjectionVersion=0;constructor(){super();this.reactiveHost=new k(this,{defineProperty:(F,M,$)=>Object.defineProperty(F,M,$),getBindingTarget:(F)=>Object.getPrototypeOf(F)??F,hasProperty:(F,M)=>(M in F),readProperty:(F,M)=>F[M]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,w(this)}connectedCallback(){let F=this.isFirstConnectPending;if(this.elementReady=!0,this.reactiveHost.connectHost(),F)return;this.isFirstConnectPending=!0,queueMicrotask(()=>{if(this.isFirstConnectPending=!1,!this.isConnected)return;if(!this.shouldRunRenderLifecycle())return;if(this.ensureSlotProjectionState(),this.observeSlotProjection(),vF(this)){if(this.needsRender=!1,this.hydrate(),this.needsRender)this.update();return}this.update()})}connectedContextCallback(F){}disconnectedCallback(){this.disconnectSlotProjectionObserver(),this.disconnectRenderWatcher(),this.removeAllSubscribedEvents(),this.reactiveHost.disconnectHost()}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}transformAttributeValue(F,M){return F!==null?M?.converter.fromAttribute(F):F}attributeChangedCallback(F,M,$){if(M===$||!this.elementReady)return;if(this.reactiveProperties.has(F)){let P=this.reactiveProperties.get(F),H=this.transformAttributeValue($,P),W=this.transformAttributeValue(M,P),j=P?P.attribute:F;this[j]=H,this.notifyUpdate(F,W,H)}}renderTemplate({target:F=this,template:M,insert:$="replace",sanitize:P}){let H=P?P(M):M;switch($){case"replace":F.innerHTML=H;break;case"beforeend":F.insertAdjacentHTML("beforeend",H);break;case"afterbegin":F.insertAdjacentHTML("afterbegin",H);break;case"beforebegin":F.insertAdjacentHTML("beforebegin",H);break;case"afterend":F.insertAdjacentHTML("afterend",H);break}}render(){return yM("slot",{})}renderToString(F={}){if(!this.shouldRunRenderLifecycle())return this.innerHTML;return this.prepareForSsr(),f().renderView(this,F)}renderHost(){return f().renderHost(this)}renderHostToString(F={}){return f().renderHostToString(this,F)}hydrate(){if(!this.shouldRunRenderLifecycle()||!this.isConnected||this.isRendering)return;this.isRendering=!0,this.disconnectSlotProjectionObserver();try{gM(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,!this.isConnected||this.isRendering)return;if(this.isFirstConnectPending&&vF(this))return;while(this.needsRender&&this.isConnected){this.needsRender=!1,this.isRendering=!0,this.disconnectSlotProjectionObserver();try{uM(this.resolveTrackedRenderOutput().value,this)}finally{this.isRendering=!1,this.observeSlotProjection()}}}registerReactiveProperty(F){this.reactiveProperties.set(F.name,F)}getReactiveProperties(){return Array.from(this.reactiveProperties.values())}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}registerContextProvider(F,M){this.contextProviders.set(F,M),this.registerHydrationBinding(F,M)}registerHydrationBinding(F,M){this.hydrationBindings.set(F,M)}getContextProviders(){return Array.from(this.contextProviders.values())}getHydrationBindings(){return Array.from(this.hydrationBindings.values())}prepareForSsr(){BF(this)}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==V.prototype.render}getHostSsrAttributes(){return f().getHostAttributes(this)}resolveSsrRenderBridge(){let F={};if(this.renderHostToString===V.prototype.renderHostToString)F.renderHostToString=(M)=>this.renderHostToString(M);if(this.renderHost===V.prototype.renderHost)F.renderHost=()=>this.renderHost();return F}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}bind(F){return this.reactiveHost.bind(F)}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}subscribeEvents(F){let M=[];for(let $ of F)M.push(this.subscribeEvent($));return M}subscribeEvent(F){let M=(P)=>{if(P.target&&P.target.matches(F.selector))F.listener.call(this,P)},$=`${F.type}:${F.selector}`;return this.addEventListener(F.type,M,F.options),this.eventSubscriptions.set($,{...F,listener:M}),this.unsubscribeEvent.bind(this,$)}unsubscribeEvent(F){let M=this.eventSubscriptions.get(F);if(M)this.removeEventListener(M.type,M.listener,M.options),this.eventSubscriptions.delete(F)}removeAllSubscribedEvents(){for(let F of this.eventSubscriptions.values())this.removeEventListener(F.type,F.listener,F.options);this.eventSubscriptions.clear()}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerEventEmitter(F,M){this.eventEmitters.set(F,M)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.querySelectorAll($));return this.querySelector($)??null}getSlotElement(F){return this.getSlotElements(F)[0]??null}getSlotElements(F){return this.ensureSlotProjectionState(),(this.projectedSlotContent.get(F??Y)??[]).filter((M)=>typeof Node<"u"&&M instanceof Element)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,attribute:P,reflect:H,defaultValue:W}=M,j=P??F;if(W!==void 0&&!R($,W))throw Error(`defaultValue does not match the expected type for ${$.name}`);let Z=NF(this,$,j,W);if(this.hasAttribute(j)&&(!H||Z==null||Z===""))this.removeAttribute(j);let X={type:$,name:F,value:Z,initialValue:Z,attribute:j,converter:{fromAttribute:(B)=>z(B,$),toAttribute:(B)=>S(B,$)}};this.registerReactiveProperty(X);let G=(B)=>{if(H)if(B==null||B===""||B===!1)this.removeAttribute(j);else{let U=X.converter.toAttribute(B);this.setAttribute(j,U)}};if(this.reactiveHost.defineReactiveAccessor(F,{bind:M.bind,getValue:()=>this.reactiveProperties.get(F)?.value,setValue:(B)=>{this.reactiveProperties.set(F,{...X,value:B}),G(B)}}),Z!==void 0)queueMicrotask(()=>{let B=this.reactiveProperties.get(F)?.value;if(B===void 0)return;G(B),this.notifyUpdate(F,void 0,B)})}ensureSlotProjectionState(){if(this.projectedSlotContent.size>0)return;let F=this.isConnected?kF(this):void 0;if(typeof F==="string"&&F!==""){this.projectedSlotContent=YF(F),this.slotProjectionVersion+=1;return}if(this.getHostChildNodeCount()>0)this.projectedSlotContent=AF(this),this.slotProjectionVersion+=1}getHostChildNodeCount(){return"childNodes"in this&&this.childNodes?this.childNodes.length:0}getSlotProjectionScriptTag(){this.ensureSlotProjectionState();let F=_F(this.projectedSlotContent);if(!F)return;return`<script type="application/json" ${O}>${pM(F)}</script>`}getAuthoredHydrationScriptMarkup(){let F=zF(this);if(F)return F;return}handleSlotProjectionMutations(F){let M=!1;for(let $ of F){for(let P of Array.from($.removedNodes))if(this.removeProjectedSlotNode(P))M=!0;for(let P of Array.from($.addedNodes)){if(P.parentNode!==this)continue;if(this.addProjectedSlotNode(P))M=!0}}if(M)this.slotProjectionVersion+=1,this.update()}addProjectedSlotNode(F){if(F instanceof HTMLScriptElement&&(F.hasAttribute(O)||F.hasAttribute(J)))return!1;let M=F instanceof Element?F.getAttribute("slot")??Y:Y,$=this.projectedSlotContent.get(M);if($){if($.includes(F))return!1;return $.push(F),!0}return this.projectedSlotContent.set(M,[F]),!0}removeProjectedSlotNode(F){for(let[M,$]of this.projectedSlotContent.entries()){let P=$.indexOf(F);if(P===-1)continue;if($.splice(P,1),$.length===0)this.projectedSlotContent.delete(M);return!0}return!1}observeSlotProjection(){if(typeof MutationObserver>"u"||this.slotProjectionObserver||!this.isConnected)return;this.slotProjectionObserver=new MutationObserver((F)=>this.handleSlotProjectionMutations(F)),this.slotProjectionObserver.observe(this,{childList:!0})}disconnectSlotProjectionObserver(){this.slotProjectionObserver?.disconnect(),this.slotProjectionObserver=void 0}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new mM(()=>this.resolveRenderOutput()),M=F.get();if(!this.isConnected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}resolveRenderOutput(){return this.ensureSlotProjectionState(),TF(this.render(),this.projectedSlotContent)}}function f(){let F=OF();if(!F)throw Error("Radiant SSR runtime is unavailable. Import `@ecopages/radiant/server/render-component` before using instance SSR methods.");return F}function vF(F){return wF()&&hM(F)}function pM(F){return F.replace(/</g,"\\u003c")}import{render as iM}from"@ecopages/jsx";import{Computed as lM,subtle as nM}from"@ecopages/signals";class hF{host;element;bindings;$;reactiveHost;connected=!1;isRendering=!1;isRenderScheduled=!1;needsRender=!1;renderSignal;renderWatcher=new nM.Watcher(()=>{this.requestUpdate()});constructor(F){this.host=F,this.element=F,this.reactiveHost=new k(this,{defineProperty:(M,$,P)=>Object.defineProperty(M,$,P),hasProperty:(M,$)=>($ in M),readProperty:(M,$)=>M[$]},()=>this.shouldAutoBindReactiveMembers()),this.bindings=this.reactiveHost.bindings,this.$=this.reactiveHost.$,w(this)}connect(){if(this.connected=!0,this.reactiveHost.connectHost(),this.shouldRunRenderLifecycle())this.update()}connectForSsrRender(){this.connected=!0,this.reactiveHost.connectHost()}disconnect(){this.connected=!1,this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost()}disconnectForSsrRender(){this.disconnectRenderWatcher(),this.reactiveHost.disconnectHost(),this.connected=!1}get isConnected(){return this.connected}render(){return null}requestUpdate(){if(!this.shouldRunRenderLifecycle())return;if(this.needsRender=!0,this.isRenderScheduled)return;this.isRenderScheduled=!0,queueMicrotask(()=>{if(this.isRenderScheduled=!1,!this.needsRender)return;this.update()})}update(){if(!this.shouldRunRenderLifecycle())return;let F=this.getRenderTarget();if(!F)return;if(this.needsRender=!0,!this.connected||this.isRendering)return;while(this.needsRender){this.needsRender=!1,this.isRendering=!0;try{iM(this.resolveTrackedRenderOutput(),F)}finally{this.isRendering=!1}}}bind(F){return this.reactiveHost.bind(F)}getReactiveBinding(F){return this.reactiveHost.getReactiveBinding(F)}createReactiveField(F,M,$={}){this.reactiveHost.createReactiveField(F,M,$)}createReactiveProp(F,M){let{type:$,defaultValue:P,bind:H}=M;if(P!==void 0&&!R($,P))throw Error(`defaultValue does not match the expected type for ${$.name}`);let W=Object.getOwnPropertyDescriptor(this.host,F),j=this.host,X=j[F]??P??K($);this.reactiveHost.defineReactiveAccessor(F,{bind:H,getValue:()=>X,setValue:(G)=>{X=G},notifyInitialValue:X}),Object.defineProperty(this.host,F,{get:()=>this[F],set:(G)=>{this[F]=G},enumerable:W?.enumerable??!0,configurable:!0}),this.registerCleanupCallback(()=>{let G=this[F];if(W){if(Object.defineProperty(this.host,F,W),"value"in W&&W.writable)j[F]=G;return}delete j[F];try{j[F]=G}catch{Object.defineProperty(this.host,F,{value:G,writable:!0,enumerable:!0,configurable:!0})}})}defineReactiveBinding(F,M=!0){this.reactiveHost.defineReactiveBinding(F,M)}notifyUpdate(F,M,$){this.reactiveHost.notifyUpdate(F,M,$)}registerUpdateCallback(F,M){return this.reactiveHost.registerUpdateCallback(F,M)}connectedContextCallback(F){}registerContextProvider(F,M){}registerHydrationBinding(F,M){}registerCleanupCallback(F){this.reactiveHost.registerCleanupCallback(F)}registerConnectedCallback(F){this.reactiveHost.registerConnectedCallback(F)}registerReactiveDependencyReader(F,M){this.reactiveHost.registerReactiveDependencyReader(F,M)}trackReactiveRead(F){this.reactiveHost.trackReactiveRead(F)}addEventListener(F,M,$){this.host.addEventListener(F,M,$)}removeEventListener(F,M,$){this.host.removeEventListener(F,M,$)}dispatchEvent(F){return this.host.dispatchEvent(F)}getRef(F,M=!1){let $=`[data-ref="${F}"]`;if(M)return Array.from(this.host.querySelectorAll($));return this.host.querySelector($)??null}shouldAutoBindReactiveMembers(){return!0}shouldRunRenderLifecycle(){return this.render!==hF.prototype.render}getRenderTarget(){return this.host instanceof HTMLElement?this.host:null}disconnectRenderWatcher(){if(!this.renderSignal)return;this.renderWatcher.unwatch(this.renderSignal),this.renderSignal=void 0}resolveTrackedRenderOutput(){let F=new lM(()=>this.render()),M=F.get();if(!this.connected)return M;if(this.renderSignal)this.renderWatcher.unwatch(this.renderSignal);return this.renderSignal=F,this.renderWatcher.watch(F),M}}var gF=Symbol.for("@ecopages/radiant.controllerIdentifier");function e(F,M){F[gF]=M}function i0(F){return F[gF]}var N="data-controller",yF=Symbol.for("@ecopages/radiant.controller-registry-state");function rM(){let F=globalThis,M=F[yF];if(M)return M;let $={activeRuntimes:new Set,controllerRegistrationStrategy:"keep-current",controllerRegistry:new Map};return F[yF]=$,$}var v=rM(),T=v.controllerRegistry,_=v.activeRuntimes;function uF(F){let M=F.getAttribute(N);if(!M)return[];return M.split(/\s+/).map(($)=>$.trim()).filter(($)=>$.length>0)}function b(F,M){if(F instanceof Element&&F.hasAttribute(N))M(F);for(let $ of Array.from(F.querySelectorAll(`[${N}]`)))M($)}class mF{root;controllersByElement=new Map;observer;stopped=!1;constructor(F=document){this.root=F;this.start()}stop(){if(this.stopped)return;this.stopped=!0,this.observer?.disconnect(),this.observer=void 0;for(let[F,M]of this.controllersByElement)for(let[$]of M)this.disconnectController(F,$);_.delete(this)}reconcileRegisteredController(F){b(this.root,(M)=>{if(!uF(M).includes(F))return;this.connectController(M,F)})}replaceRegisteredController(F){for(let[M,$]of Array.from(this.controllersByElement.entries())){if(!$.has(F))continue;this.disconnectController(M,F)}this.reconcileRegisteredController(F)}start(){if(b(this.root,(M)=>{this.reconcileElement(M)}),typeof MutationObserver>"u"){_.add(this);return}this.observer=new MutationObserver((M)=>{for(let $ of M){if($.type==="attributes"&&$.target instanceof Element){this.reconcileElement($.target);continue}for(let P of Array.from($.removedNodes)){if(!(P instanceof Element))continue;b(P,(H)=>{this.disconnectElementControllers(H)})}for(let P of Array.from($.addedNodes)){if(!(P instanceof Element))continue;b(P,(H)=>{this.reconcileElement(H)})}}});let F=this.root instanceof Document?this.root.documentElement:this.root;this.observer.observe(F,{attributeFilter:[N],attributes:!0,childList:!0,subtree:!0}),_.add(this)}reconcileElement(F){let M=new Set(uF(F)),$=this.controllersByElement.get(F);if($){for(let P of $.keys())if(!M.has(P))this.disconnectController(F,P)}for(let P of M)this.connectController(F,P)}connectController(F,M){let $=T.get(M);if(!$)return;let P=this.controllersByElement.get(F);if(!P)P=new Map,this.controllersByElement.set(F,P);if(P.has(M))return;let H=new $(F);P.set(M,H),H.connect()}disconnectController(F,M){let $=this.controllersByElement.get(F);if(!$)return;let P=$.get(M);if(!P)return;if(P.disconnect(),$.delete(M),$.size===0)this.controllersByElement.delete(F)}disconnectElementControllers(F){let M=this.controllersByElement.get(F);if(!M)return;for(let $ of Array.from(M.keys()))this.disconnectController(F,$)}}function oM(F,M){let $=T.get(F);if($)return $;e(M,F),T.set(F,M);for(let P of Array.from(_))P.reconcileRegisteredController(F);return M}function r0(F){return T.has(F)}function aM(F,M){if(T.get(F)===M)return M;e(M,F),T.set(F,M);for(let P of Array.from(_))P.replaceRegisteredController(F);return M}function cF(F){v.controllerRegistrationStrategy=F}function o0(){cF("replace")}function a0(){cF("keep-current")}function dF(F,M){if(v.controllerRegistrationStrategy==="replace")return aM(F,M);return oM(F,M)}function t0(F=document){return new mF(F)}function e0(){for(let F of Array.from(_))F.stop()}function tM(F){return typeof F==="function"}function q(F,M,$,P){if(typeof P==="object")return F(void 0,P);return M($,P)}function D(F,M,$,P,H){if(typeof P==="object"){if(!tM($))throw TypeError("Standard method decorators require a method target");return F($,P)}if(!H)throw TypeError("Legacy method decorators require a property descriptor");return M($,P,H)}function FF(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function eM(F){return F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}function F0(F,M){if(M.converter?.fromAttribute){let $=M.converter.fromAttribute(F);if(F===null&&$===void 0&&"defaultValue"in M)return M.defaultValue;return $}if(M.type){if(F===null)return M.defaultValue??K(M.type);if(M.type===Boolean&&F==="")return!0;return z(F,M.type)}if(F===null)return M.defaultValue;return F}function x(F,M,$){return F0(FF(F).getAttribute(M),$)}function M0(F,M,$,P){let H=P.converter?.toAttribute?P.converter.toAttribute($):P.type?S($,P.type):$==null?null:String($);if(H===null){F.removeAttribute(M);return}F.setAttribute(M,H)}function h(F,M,$={}){if($.type&&$.defaultValue!==void 0&&!R($.type,$.defaultValue))throw Error(`defaultValue does not match the expected type for ${$.type.name}`);let P=F,H=$.source??eM(M),W=Symbol(`@ecopages/radiant/attr:${M}:observer`),j=Symbol(`@ecopages/radiant/attr:${M}:last-value`),Z=$.bind??F.shouldAutoBindReactiveMembers?.()??!1;F.defineReactiveBinding(M,Z),F.registerReactiveDependencyReader(M,()=>x(F,H,$)),P[j]=x(F,H,$),Object.defineProperty(F,M,{get(){return F.trackReactiveRead(M),x(this,H,$)},set(B){let U=FF(this),L=x(this,H,$);M0(U,H,B,$);let A=x(this,H,$);if(Object.is(L,A))return;this[j]=A,F.notifyUpdate(M,L,A)},enumerable:!0,configurable:!0});let X=()=>{P[W]?.disconnect()},G=()=>{let B=x(F,H,$),U=P[j];if(!Object.is(U,B))P[j]=B,F.notifyUpdate(M,U,B);if(typeof MutationObserver>"u")return;let L=FF(F);X();let A=new MutationObserver(()=>{let l=x(F,H,$),WF=P[j];if(Object.is(WF,l))return;P[j]=l,F.notifyUpdate(M,WF,l)});A.observe(L,{attributeFilter:[H],attributes:!0}),P[W]=A};G(),F.registerConnectedCallback(G),F.registerCleanupCallback(X)}function sF(F={}){return(M,$)=>{let P=Symbol(`@ecopages/radiant/attr:${$}:installed`);Q(M,(H)=>{H.registerConnectedCallback(()=>{if(H[P])return;let W=H[$],j=F.defaultValue===void 0?W:F.defaultValue;h(H,$,{...F,defaultValue:j}),H[P]=!0})})}}function pF(F={}){return function(M,$){let P=String($.name),H=Symbol(`@ecopages/radiant/attr:${P}:initializer`);return $.addInitializer(function(){let W=this[H],j=F.defaultValue===void 0?W:F.defaultValue;h(this,P,{...F,defaultValue:j})}),function(W){return this[H]=W,W}}}function U2(F={}){function M($,P){return q(pF(F),sF(F),$,P)}return M}function iF(F,M,$){let P=$.value;return{configurable:!0,get(){if(this===F.prototype||Object.prototype.hasOwnProperty.call(this,M))return P;let H=P.bind(this);return Object.defineProperty(this,M,{value:H,configurable:!0,writable:!0}),H}}}function lF(F,M){let $=String(M.name);if(M.private)throw Error(`'bound' cannot decorate private properties like ${$}.`);M.addInitializer(function(){this[$]=this[$].bind(this)})}function A2(F,M,$){return D(lF,iF,F,M,$)}function _2(F){return function(M){return dF(F,M)}}var nF=Symbol.for("@ecopages/radiant.customElementTagName");function g(F,M){F[nF]=M}function k2(F){return F[nF]}function rF(F,M){return($)=>{if(g($,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,$,M)}}function oF(F,M){return function($,P){P.addInitializer(function(){if(g(this,F),typeof customElements<"u"&&!customElements.get(F))customElements.define(F,this,M)})}}function f2(F,M){function $(P,H){if(typeof H<"u")return oF(F,M)(P,H);return rF(F,M)(P)}return $}function y(F,M){let $=null,P=null,H,W=()=>{if($!==null)clearTimeout($),$=null},j=()=>{if(P===null)return H;let X=P;return P=null,W(),H=X(),H},Z=function(...X){P=()=>F.apply(this,X),W(),$=setTimeout(()=>{j()},M)};return Z.cancel=()=>{W(),P=null},Z.flush=()=>{if(P===null)return H;return j()},Z.pending=()=>P!==null,Z}function aF(F){return(M,$,P)=>{let H=P.value,W=new WeakMap;return P.value=function(...Z){let X=W.get(this);if(!X)X=y((...G)=>{return H.apply(this,G)},F),W.set(this,X);X(...Z)},P}}function tF(F){return(M)=>{let $=new WeakMap;return function(...P){let H=$.get(this);if(!H)H=y((...W)=>{return M.apply(this,W)},F),$.set(this,H);H(...P)}}}function c2(F){function M($,P,H){return D(tF(F),aF(F),$,P,H)}return M}class MF{host;eventConfig;constructor(F,M){this.host=F,this.eventConfig=M}emit(F){let M=new CustomEvent(this.eventConfig.name,{detail:F,bubbles:this.eventConfig.bubbles,cancelable:this.eventConfig.cancelable,composed:this.eventConfig.composed});this.host.dispatchEvent(M)}}function u(F,M){let $=new MF(F,M);return F.registerEventEmitter(M.name,$),$}function eF(F){return(M,$)=>{Q(M,(P)=>{let H=u(P,F);P.registerConnectedCallback(()=>{Object.defineProperty(P,$,{get(){return H},enumerable:!0,configurable:!0})})})}}function FM(F){return function(M,$){$.addInitializer(function(){let P=u(this,F);Object.defineProperty(this,$.name,{get(){return P},enumerable:!0,configurable:!0})})}}function M$(F){function M($,P){return q(FM(F),eF(F),$,P)}return M}var m=Symbol("radiant.shadowRootListenerHooks"),MM=Symbol("radiant.patchedAttachShadow");function PM(F){if(F instanceof Element)return F;if("host"in F)return F.host;return F.element}function $0(F){return!(F instanceof Element)}function $M(F,M,$,P){let H=(W)=>{if(W.target instanceof Element&&W.target.matches($))P(W)};return F.addEventListener(M.type,H,M.options),()=>{F.removeEventListener(M.type,H,M.options)}}function P0(F,M){let $=PM(F);if(!$[m])$[m]=new Set;if($[m].add(M),$[MM])return;let P=$.attachShadow;$.attachShadow=function(W){let j=P.call(this,W);for(let Z of $[m]??[])Z();return j},$[MM]=!0}function c(F,M,$){if($0(F)&&"scope"in M&&M.scope&&M.scope!=="light")throw Error("RadiantController event listeners only support light DOM scope.");let P=PM(F),H=$.bind(F),W=null,j=null,Z=null,X=null,G=!1,B=()=>{W?.(),j?.(),Z?.(),X?.(),W=null,j=null,Z=null,X=null},U=()=>{if(G)return;if("window"in M&&!W)window.addEventListener(M.type,H,M.options),W=()=>{window.removeEventListener(M.type,H,M.options)};if("document"in M&&!j)document.addEventListener(M.type,H,M.options),j=()=>{document.removeEventListener(M.type,H,M.options)};if("selector"in M||"ref"in M){let L="selector"in M?M.selector:`[data-ref='${CSS.escape(M.ref)}']`;if(M.scope!=="shadow"&&!Z)Z=$M(P,M,L,H);if(M.scope!=="light"&&P.shadowRoot&&!X)X=$M(P.shadowRoot,M,L,H)}};if("selector"in M||"ref"in M){if(M.scope!=="light")P0(F,()=>{if(F.isConnected)U()})}if(F.registerConnectedCallback(U),F.registerCleanupCallback(B),F.isConnected)U();return()=>{G=!0,B()}}function HM(F){return(M,$,P)=>{let H=P.value;return Q(M,(W)=>{c(W,F,H.bind(W))}),P}}function WM(F){return function(M,$){$.addInitializer(function(){c(this,F,M.bind(this))})}}function U$(F){function M($,P,H){return D(WM(F),HM(F),$,P,H)}return M}function jM(F){return(M,$)=>{let P=Symbol(`@ecopages/radiant/on-updated:${$}:cleanup`);Q(M,(H)=>{H.registerConnectedCallback(()=>{let W=H[$].bind(H),j=[];if(Array.isArray(F))for(let Z of F)j.push(H.registerUpdateCallback(Z,W));else if(typeof F==="string")j.push(H.registerUpdateCallback(F,W));H[P]=()=>{for(let Z of j)Z()}}),H.registerCleanupCallback(()=>{let W=H[P];if(typeof W==="function")W(),delete H[P]})})}}function ZM(F){return function(M,$){$.addInitializer(function(){let P=M.bind(this);if(Object.defineProperty(this,$.name,{value:P,configurable:!0,writable:!0}),Array.isArray(F))for(let H of F)this.registerUpdateCallback(H,P);else if(typeof F==="string")this.registerUpdateCallback(F,P)})}}function Y$(F){function M($,P,H){return D(ZM(F),jM(F),$,P,H)}return M}var $F=Symbol.for("@ecopages/radiant.reactivePropDefinitions");function d(F,M,$){let P=F.constructor,H=P[$F]??[];if(H.some((W)=>W.name===M))return;H.push({name:M,options:$}),P[$F]=H}function _$(F){return(F.constructor[$F]??[]).slice()}function XM({type:F,attribute:M,reflect:$,defaultValue:P,bind:H}){if(P!==void 0&&!R(F,P))throw Error(`defaultValue does not match the expected type for ${F.name}`);return(W,j)=>{let Z=M??j;d(W,j,{type:F,reflect:$,attribute:Z,defaultValue:P,bind:H});let X=Symbol.for(`@ecopages/radiant.ssr-prop:${j}`);Object.defineProperty(W,j,{get(){return this[X]??P},set(G){this[X]=G},configurable:!0,enumerable:!0}),Q(W,(G)=>{G.registerConnectedCallback(()=>{let B=G[j],U=P===void 0?B:P;G.createReactiveProp(j,{type:F,reflect:$,attribute:Z,defaultValue:U,bind:H})})})}}function GM({type:F,attribute:M,reflect:$,defaultValue:P,bind:H}){if(P!==void 0&&!R(F,P))throw Error(`defaultValue does not match the expected type for ${F.name}`);return function(W,j){let Z=String(j.name),X=M??Z,G=Symbol(`@ecopages/radiant/reactive-prop:${Z}:initializer`);return j.addInitializer(function(){let B=this[G],U=P===void 0?B:P;d(this,Z,{type:F,reflect:$,attribute:X,defaultValue:P,bind:H}),this.createReactiveProp(Z,{type:F,reflect:$,attribute:X,defaultValue:U,bind:H})}),function(B){return this[G]=B,B}}}function b$(F){function M($,P){return q(GM(F),XM(F),$,P)}return M}function H0(F){return!(F instanceof Element)}function W0(F){return"shadowRoot"in F?F.shadowRoot??null:null}function j0(F){return F instanceof Element?F:F.host}function Z0(F,M="light"){let $=W0(F);if(M==="shadow")return $?[$]:[];if(M==="both")return $?[F,$]:[F];return[F]}function s(F,M){if(H0(F)&&M.scope&&M.scope!=="light")throw Error("RadiantController queries only support light DOM scope.");let $=j0(F),P="selector"in M?M.selector:`[data-ref="${M.ref}"]`,H=null,W=()=>{let j=Z0($,M.scope);if(M.all)return j.flatMap((Z)=>Array.from(Z.querySelectorAll(P)));for(let Z of j){let X=Z.querySelector(P);if(X)return X}return null};return{get value(){if(M.cache){if(H===null||M.all&&Array.isArray(H)&&!H.length)H=W();return H}return W()}}}function BM({cache:F=!0,...M}){return($,P)=>{Q($,(H)=>{H.registerConnectedCallback(()=>{let W=s(H,{cache:F,...M});Object.defineProperty(H,P,{get(){return W.value},enumerable:!0,configurable:!0})})})}}function QM(F){return function(M,$){let P=String($.name);$.addInitializer(function(){let H=s(this,F);Object.defineProperty(this,P,{get(){return H.value},enumerable:!0,configurable:!0})})}}function p$(F){function M($,P){return q(QM(F),BM(F),$,P)}return M}function I(F,M={}){let $=null,P,H=()=>{if(M.all)return typeof F.getSlotElements==="function"?F.getSlotElements(M.name):[];return typeof F.getSlotElement==="function"?F.getSlotElement(M.name):null};return{get value(){if(M.cache===!1)return H();let W=F.slotProjectionVersion??0;if(P!==W)$=H(),P=W;return $}}}function UM(F={}){return(M,$)=>{let P=(j)=>{return typeof Object.getOwnPropertyDescriptor(j,$)?.get==="function"},H=(j)=>{if(P(j))return;let Z=I(j,F);Object.defineProperty(j,$,{get(){return Z.value},enumerable:!0,configurable:!0})},W=new WeakMap;Object.defineProperty(M,$,{get(){let j=W.get(this);if(!j)j=I(this,F),W.set(this,j);return j.value},enumerable:!0,configurable:!0}),Q(M,(j)=>{GF(j,()=>{H(j)}),j.registerConnectedCallback(()=>{H(j)})})}}function qM(F={}){return function(M,$){let P=String($.name);$.addInitializer(function(){let H=I(this,F);Object.defineProperty(this,P,{get(){return H.value},enumerable:!0,configurable:!0})})}}function PP(F={}){function M($,P){return q(qM(F),UM(F),$,P)}return M}function RM(F){return RF({type:"signal",...F})}function DM(F){return DF(F)}import{createMarkupNodeLike as X0}from"@ecopages/jsx";import{state as G0}from"@ecopages/signals";function p(F){return typeof F==="object"&&F!==null&&typeof F.get==="function"&&typeof F.set==="function"&&typeof F.subscribe==="function"&&typeof F.update==="function"}class E{host;hydrate;hydrationKey;property;source;currentValue;hasAppliedHostHydration=!1;sourceUnsubscribe;constructor(F){this.host=F.host,this.hydrate=F.hydrate,this.hydrationKey=F.hydrationKey,this.property=F.property,this.source=F.source??G0(this.resolveInitialValue(F.initialValue)),this.currentValue=this.source.get()}get(){return this.source.get()}set(F){this.source.set(F)}subscribe(F){return this.source.subscribe(F)}update(F){this.set(F(this.get()))}connectToSource(){if(this.sourceUnsubscribe)return;let F=this.source.get();if(!Object.is(this.currentValue,F)){let M=this.currentValue;this.currentValue=F,this.host.notifyUpdate(this.property,M,F)}this.sourceUnsubscribe=this.source.subscribe((M)=>{this.handleSourceChange(M)})}disconnectFromSource(){this.sourceUnsubscribe?.(),this.sourceUnsubscribe=void 0}hydrateFromHost(){if(!this.hydrate||this.hasAppliedHostHydration)return;this.hasAppliedHostHydration=!0;let F=this.source.get(),M=this.resolveInitialValue(F);if(!Object.is(F,M))this.source.set(M),this.currentValue=this.source.get(),this.host.notifyUpdate(this.property,F,this.currentValue)}renderHydrationScript(){let F=this.renderHydrationScriptTag();if(!F)return;return X0(F)}renderHydrationScriptTag(){let F=this.serializeHydrationValue();if(!F)return;return RM({hydrationKey:this.hydrationKey,serializedValue:F})}findHydrationScriptElement(){if(!(this.host instanceof Element))return null;return JF(this.host,"signal",this.hydrationKey)}isObject(F){return typeof F==="object"&&!Array.isArray(F)&&F!==null}resolveInitialValue(F){if(!this.hydrate)return F;let M=this.findHydrationScriptElement();if(!M)return F;let $=LF(M,F);if(this.hydrate===Object&&this.isObject($)&&this.isObject(F))return{...F,...$};return $}serializeHydrationValue(){if(!this.hydrate)return;let F=JSON.stringify(this.get());if(typeof F!=="string")return;return DM(F)}handleSourceChange(F){let M=this.currentValue;if(this.currentValue=F,!Object.is(M,F))this.host.notifyUpdate(this.property,M,F)}}function i(F){return new E(F)}function PF(F={}){return(M,$)=>{let P=(H)=>{let W=H[$];if(W instanceof E)return W;let j=typeof F.source==="function"?F.source(H):F.source??(p(W)?W:void 0),Z=F.bind??H.shouldAutoBindReactiveMembers?.()??!1,X=j!==void 0?F.initial:W===void 0?F.initial:W;H.defineReactiveBinding($,Z);let G=i({host:H,hydrate:F.hydrate,hydrationKey:$,initialValue:X,property:$,source:j});if(H.registerConnectedCallback(()=>{G.hydrateFromHost(),G.connectToSource()}),H.registerCleanupCallback(()=>{G.disconnectFromSource()}),F.hydrate)H.registerHydrationBinding($,G);return H[$]=G,G};Q(M,(H)=>{let W=P(H);H.registerConnectedCallback(()=>{if(!(H[$]instanceof E))H[$]=W})})}}function HF(F={}){return function(M,$){let P=String($.name);return function(H){let W=typeof F.source==="function"?F.source(this):F.source??(p(H)?H:void 0),j=W!==void 0?F.initial:H===void 0?F.initial:H,Z=F.bind??this.shouldAutoBindReactiveMembers?.()??!1;this.defineReactiveBinding(P,Z);let X=i({host:this,hydrate:F.hydrate,hydrationKey:P,initialValue:j,property:P,source:W});if(this.registerConnectedCallback(()=>{X.hydrateFromHost(),X.connectToSource()}),this.registerCleanupCallback(()=>{X.disconnectFromSource()}),F.hydrate)this.registerHydrationBinding(P,X);return X}}}function AP(F,M){if(typeof M<"u"){if(typeof M==="object"){if(F!==void 0)throw TypeError("@signal standard decorators require an undefined target");return HF()(void 0,M)}if(F===void 0)throw TypeError("@signal legacy decorators require a host target");return PF()(F,M)}let $=F??{};function P(H,W){if(typeof W==="object"){if(H!==void 0)throw TypeError("@signal standard decorators require an undefined target");return HF($)(void 0,W)}if(H===void 0)throw TypeError("@signal legacy decorators require a host target");return PF($)(H,W)}return P}function LM(F,M){Q(F,($)=>{$.registerConnectedCallback(()=>{$.createReactiveField(M,$[M],{bind:$.shouldAutoBindReactiveMembers?.()??!1})})})}function JM(F,M){let $=Symbol(`__${String(M.name)}__value`),P=String(M.name);return M.addInitializer(function(){this.defineReactiveBinding(P,this.shouldAutoBindReactiveMembers?.()??!1),this.registerReactiveDependencyReader(P,()=>this[$]),Object.defineProperty(this,M.name,{get(){return this.trackReactiveRead(P),this[$]},set(H){let W=this[$];if(W!==H)this[$]=H,this.notifyUpdate(P,W,H)},enumerable:!0,configurable:!0})}),function(H){return this[$]=H,H}}function EP(F,M){return q(JM,LM,F,M)}export{e0 as stopControllers,EP as state,t0 as startControllers,AP as signal,cF as setControllerRegistrationStrategy,aM as replaceController,dF as registerControllerWithConfiguredStrategy,oM as registerController,PP as querySlot,p$ as query,b$ as prop,Y$ as onUpdated,U$ as onEvent,r0 as hasRegisteredController,M$ as event,o0 as enableControllerReplacementForHmr,a0 as disableControllerReplacementForHmr,c2 as debounce,f2 as customElement,_2 as controller,A2 as bound,U2 as attr,V as RadiantElement,hF as RadiantController,mF as ControllerRegistryRuntime,N as CONTROLLER_ATTRIBUTE};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=F9A587638766618964756E2164756E21
|