pulse-ui-client 0.1.29 → 0.1.30
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/dist/channel.d.ts +1 -1
- package/dist/client.d.ts +6 -21
- package/dist/helpers.d.ts +1 -1
- package/dist/index.bun.js +3 -3
- package/dist/index.d.ts +12 -16
- package/dist/index.development.js +2138 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +15 -17
- package/dist/index.node.js +3 -3
- package/dist/messages.d.ts +1 -1
- package/dist/pulse.d.ts +5 -5
- package/dist/renderer.d.ts +8 -20
- package/dist/transport.d.ts +1 -1
- package/package.json +45 -45
- package/dist/channel.test.d.ts +0 -1
- package/dist/renderer.test.d.ts +0 -1
- package/dist/serialize/clean.test.d.ts +0 -1
- package/dist/serialize/serializer.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{useEffect as d,useState as QW,useMemo as qW,createContext as BW,useContext as KW}from"react";import LW,{cloneElement as _,createElement as r,isValidElement as MW,lazy as yW,Suspense as bW}from"react";var GW="$$fragment",UW="$$";function VW(W){return typeof W==="object"&&W!==null}function DW(W){return typeof W==="object"&&W!==null&&W.tag.startsWith("$$")&&W.tag!=="$$fragment"}import{jsx as s,Fragment as TW}from"react/jsx-runtime";class h{client;path;components;cssModules;callbacks;callbackCache;renderPropKeys;cssProps;callbackList;constructor(W,Z,$,Q,q=[],J=[],D=[]){this.client=W;this.path=Z;this.components=$;this.cssModules=Q;this.callbacks=new Set(q),this.callbackCache=new Map,this.renderPropKeys=new Set(J),this.cssProps=new Set(D),this.callbackList=[...this.callbacks].sort()}hasCallbackPath(W){return this.callbacks.has(W)}hasRenderPropPath(W){return this.renderPropKeys.has(W)}hasAnyCallbackUnder(W){if(W==="")return this.callbackList.length>0;let Z=kW(this.callbackList,W);return Z<this.callbackList.length&&this.callbackList[Z].startsWith(W)}setCallbacks(W){this.callbacks=new Set(W);for(let Z of Array.from(this.callbackCache.keys()))if(!this.callbacks.has(Z))this.callbackCache.delete(Z);this.callbackList=[...this.callbacks].sort()}setRenderProps(W){this.renderPropKeys=new Set(W)}setCssRefs(W){this.cssProps=new Set(W)}applyCallbackDelta(W){if(W.remove)for(let Z of W.remove)this.callbacks.delete(Z),this.callbackCache.delete(Z);if(W.add)for(let Z of W.add)this.callbacks.add(Z);this.callbackList=[...this.callbacks].sort()}applyRenderPropsDelta(W){if(W.remove)for(let Z of W.remove)this.renderPropKeys.delete(Z);if(W.add)for(let Z of W.add)this.renderPropKeys.add(Z)}applyCssRefsDelta(W){if(W.remove)for(let Z of W.remove)this.cssProps.delete(Z);if(W.add)for(let Z of W.add)this.cssProps.add(Z)}getCallback(W,Z){let $=this.propPath(W,Z),Q=this.callbackCache.get($);if(!Q)Q=(...q)=>this.client.invokeCallback(this.path,$,q),this.callbackCache.set($,Q);return Q}renderNode(W,Z=""){if(W==null||typeof W==="boolean"||typeof W==="number"||typeof W==="string")return W;if(VW(W)){let{tag:$,props:Q={},children:q=[]}=W,J={};for(let[F,G]of Object.entries(Q))J[F]=this.transformValue(Z,F,G);if(W.key)J.key=W.key;let D=[];for(let F=0;F<q.length;F+=1){let G=q[F],U=Z?`${Z}.${F}`:String(F);D.push(this.renderNode(G,U))}if(DW(W)){let F=W.tag.slice(UW.length),G=this.components[F];if(!G)throw Error(`Could not find component ${F}. This is a Pulse internal error.`);return r(G,J,...D)}return r($===GW?LW.Fragment:$,J,...D)}return null}propPath(W,Z){return W?`${W}.${Z}`:Z}transformValue(W,Z,$){let Q=this.propPath(W,Z);if(this.callbacks.has(Q))return this.getCallback(W,Z);if(this.renderPropKeys.has(Q))return this.renderNode($,Q);if(this.cssProps.has(Q))return this.resolveCssToken($);return $}resolveCssToken(W){let Z=W.indexOf(":");if(Z===-1)return W;let $=W.slice(0,Z),Q=W.slice(Z+1);if(!$||!Q)return W;let q=this.cssModules[$];if(!q)throw Error(`Received CSS reference for unknown module '${$}'`);let J=q[Q];if(typeof J!=="string")throw Error(`Received CSS reference for missing class '${Q}' in module '${$}'`);return J}}function v(W){let Z=W.props?.children;if(Z==null)return[];return Array.isArray(Z)?Z.slice():[Z]}function t(W,Z,$){let Q=W;for(let q of Z){if(q.type==="update_callbacks"){$.applyCallbackDelta(q.data);continue}if(q.type==="update_css_refs"){$.applyCssRefsDelta(q.data);continue}if(q.type==="update_render_props"){$.applyRenderPropsDelta(q.data);continue}let J=q.path.split(".").filter((F)=>F.length>0),D=(F,G,U)=>{if(G<J.length){l(F,J,G);let O=F,N=J[G],V=+N,X=U?`${U}.${N}`:N;if(!Number.isNaN(V)){let f=v(O),A=f[V];return f[V]=D(A,G+1,X),_(O,void 0,...f)}else{let f=O.props??{},A=f[N],C={...f,[N]:D(A,G+1,X)};return _(O,C)}}switch(q.type){case"replace":return $.renderNode(q.data,q.path);case"update_props":{l(F,J,G);let O=F,V={...O.props??{}},X=q.data;if(X.remove&&X.remove.length>0){for(let A of X.remove)if(A in V)delete V[A]}if(X.set)for(let[A,C]of Object.entries(X.set))V[A]=$.transformValue(U,A,C);if((X.remove?.length??0)>0)return V.key=O.key,V.ref=O.ref,r(O.type,V,...v(O));else return _(O,V)}case"reconciliation":{l(F,J,G);let O=F,N=v(O),V=[],[X,f]=q.new,[A,C]=q.reuse,R=-1,K=-1,M=-1,y=-1;if(X.length>0)R=X[0],M=0;if(A.length>0)K=A[0],y=0;for(let H=0;H<q.N;++H)if(H===R){let o=f[M],T=U?`${U}.${H}`:String(H);V.push($.renderNode(o,T)),R=M<X.length-1?X[++M]:-1}else if(H===K){let o=C[y],T=N[o],zW=U?`${U}.${H}`:String(H);if($.hasAnyCallbackUnder(zW))T=a(T,zW,$);V.push(T),K=y<A.length-1?A[++y]:-1}else V.push(N[H]);return _(O,null,...V)}default:throw Error(`[Pulse renderer] Unknown update type: ${q.type}`)}};Q=D(Q,0,"")}return Q}function SW(W,Z){let $=yW(W);return({children:Q,...q})=>{return s(bW,{fallback:Z??s(TW,{}),children:s($,{...q,children:Q})})}}function l(W,Z,$){return!0}function a(W,Z,$){if(!MW(W))return W;let Q=W,q=Q.props??{},J={...q};for(let F of Object.keys(q)){let G=Z?`${Z}.${F}`:F;if($.hasCallbackPath(G))J[F]=$.getCallback(Z,F);if($.hasRenderPropPath(G)&&$.hasAnyCallbackUnder(G))J[F]=a(q[F],G,$)}let D=v(Q).map((F,G)=>{let U=Z?`${Z}.${G}`:String(G);if($.hasAnyCallbackUnder(U))return a(F,U,$);else return F});return _(Q,J,...D)}function kW(W,Z){let $=0,Q=W.length;while($<Q){let q=$+Q>>>1;if(W[q]<Z)$=q+1;else Q=q}return $}function Y(){function W(Z,$){return(Q)=>{let q={};for(let J of Z)q[J]=Q[J];if($)for(let J in $){let D=$[J];q[J]=D(Q)}return q}}return W}var _W=(W)=>W.tagName.toLowerCase(),gW=["id","className","tagName","localName","clientHeight","clientLeft","clientTop","clientWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth","slot"],xW=["autofocus","tabIndex","nonce"],mW=["accessKey","accessKeyLabel","autocapitalize","dir","draggable","hidden","inert","lang","offsetHeight","offsetLeft","offsetTop","offsetWidth","popover","spellcheck","title","translate","writingSuggestions","contentEditable","enterKeyHint","isContentEditable","inputMode"],vW=Y()(gW,{tagName:_W}),hW=Y()(xW),pW=Y()(mW);function w(W){return{...vW(W),...hW(W),...pW(W)}}function z(W,Z){let $=Y()(W,Z);return(Q)=>({...w(Q),...$(Q)})}var EW=["hash","host","hostname","href","origin","password","pathname","port","protocol","search","target","download","rel","hreflang","type","username","ping","referrerPolicy","text"],uW=z(EW),iW=["alt","coords","download","hash","host","hostname","href","origin","password","pathname","port","protocol","rel","search","shape","target","username","ping","referrerPolicy"],cW=z(iW),dW=["autoplay","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","loop","muted","networkState","paused","playbackRate","preload","readyState","seeking","src","volume","preservesPitch"],CW=z(dW),nW=(W)=>CW(W),oW=["disabled","name","type","value","formAction","formEnctype","formMethod","formNoValidate","formTarget","popoverTargetAction"],lW=z(oW),sW=["value"],rW=z(sW),aW=["height","src","type","width","align","name"],tW=z(aW),eW=["disabled","name","type","validationMessage","willValidate"],W1=z(eW),Z1=["acceptCharset","action","autocomplete","encoding","enctype","length","method","name","noValidate","target","rel"],$1=z(Z1),Q1=["allow","allowFullscreen","height","name","referrerPolicy","src","srcdoc","width","align","frameBorder","longDesc","marginHeight","marginWidth","scrolling","sandbox"],q1=z(Q1),F1=["alt","crossOrigin","decoding","height","isMap","loading","naturalHeight","naturalWidth","referrerPolicy","sizes","src","srcset","useMap","width","align","border","complete","hspace","longDesc","lowsrc","name","vspace","x","y","fetchPriority"],J1=z(F1),X1=["accept","alt","autocomplete","checked","defaultChecked","defaultValue","dirName","disabled","height","indeterminate","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","selectionDirection","selectionEnd","selectionStart","size","src","step","type","value","valueAsNumber","width","align","capture","formAction","formEnctype","formMethod","formNoValidate","formTarget","useMap","validationMessage","willValidate","popoverTargetAction"],z1=z(X1),G1=["htmlFor"],U1=z(G1),V1=["value","type"],D1=z(V1),A1=["as","crossOrigin","disabled","fetchPriority","href","hreflang","imageSizes","imageSrcset","integrity","media","referrerPolicy","rel","type","charset","rev","target","sizes"],O1=z(A1),f1=["name"],N1=z(f1),C1=["high","low","max","min","optimum","value"],R1=z(C1),P1=["cite","dateTime"],AW=z(P1),j1=["reversed","start","type","compact"],B1=z(j1),K1=["data","height","name","type","useMap","width","validationMessage","willValidate","align","archive","border","code","codeBase","codeType","declare","hspace","standby","vspace"],I1=z(K1),H1=["disabled","label"],Y1=z(H1),w1=["defaultSelected","disabled","index","label","selected","text","value"],L1=z(w1),M1=["defaultValue","name","type","value","htmlFor","validationMessage","willValidate"],y1=z(M1),b1=["max","position","value"],S1=z(b1),k1=["cite"],OW=z(k1),T1=(W)=>w(W),_1=["async","crossOrigin","defer","fetchPriority","integrity","noModule","referrerPolicy","src","text","type","charset"],g1=Y()(_1,{event:(W)=>W.event,htmlFor:(W)=>W.htmlFor}),x1=(W)=>({...w(W),...g1(W)}),m1=["autocomplete","disabled","length","multiple","name","required","selectedIndex","size","type","value","validationMessage","willValidate"],v1=z(m1),h1=["name"],p1=z(h1),E1=["height","media","sizes","src","srcset","type","width"],u1=z(E1),i1=["align"],c1=z(i1),d1=["abbr","cellIndex","colSpan","headers","rowSpan","scope","align","axis","bgColor","ch","chOff","height","noWrap","vAlign","width"],fW=z(d1),n1=["span","align","ch","chOff","vAlign","width"],NW=z(n1),o1=["align","bgColor","border","cellPadding","cellSpacing","frame","rules","summary","width"],l1=z(o1),s1=["rowIndex","sectionRowIndex","align","bgColor","ch","chOff","vAlign"],r1=z(s1),a1=["align","ch","chOff","vAlign"],e=z(a1),t1=(W)=>w(W),e1=["autocomplete","cols","defaultValue","dirName","disabled","maxLength","minLength","name","placeholder","readOnly","required","rows","selectionDirection","selectionEnd","selectionStart","value","wrap","textLength","validationMessage","willValidate"],WZ=z(e1),ZZ=["dateTime"],$Z=z(ZZ),QZ=["default","kind","label","readyState","src","srclang"],qZ=z(QZ),FZ=["height","poster","videoHeight","videoWidth","width","playsInline"],JZ=Y()(FZ),XZ=(W)=>({...CW(W),...JZ(W)}),zZ=["clear"],GZ=z(zZ),UZ=["href","target"],VZ=z(UZ),DZ=["aLink","background","bgColor","link","text","vLink"],AZ=z(DZ),OZ=["compact"],fZ=z(OZ),NZ=["open"],CZ=z(NZ),RZ=["open","returnValue"],PZ=z(RZ),jZ=["align"],BZ=z(jZ),KZ=(W)=>w(W),IZ=["align"],b=z(IZ),HZ=["align","color","noShade","size","width"],YZ=z(HZ),wZ=["version"],LZ=z(wZ),MZ=(W)=>w(W),yZ=["content","httpEquiv","name","scheme"],bZ=z(yZ),SZ=["align"],kZ=z(SZ),TZ=(W)=>w(W),_Z=["width"],gZ=z(_Z),xZ=(W)=>w(W),mZ=["media","type","disabled"],vZ=z(mZ),hZ=["text"],pZ=z(hZ),EZ=["compact","type"],uZ=z(EZ),iZ={A:uW,AREA:cW,AUDIO:nW,BASE:VZ,BLOCKQUOTE:OW,Q:OW,BODY:AZ,BR:GZ,BUTTON:lW,CANVAS:w,CAPTION:c1,CITE:T1,COL:NW,COLGROUP:NW,DATA:rW,DETAILS:CZ,DIALOG:PZ,DIV:BZ,DL:fZ,EMBED:tW,FIELDSET:W1,FORM:$1,H1:b,H2:b,H3:b,H4:b,H5:b,H6:b,HEAD:KZ,HR:YZ,HTML:LZ,IFRAME:q1,IMG:J1,INPUT:z1,LABEL:U1,LI:D1,LINK:O1,MAP:N1,MENU:MZ,META:bZ,METER:R1,INS:AW,DEL:AW,OBJECT:I1,OL:B1,OPTGROUP:Y1,OPTION:L1,OUTPUT:y1,P:kZ,PICTURE:TZ,PRE:gZ,PROGRESS:S1,SCRIPT:x1,SELECT:v1,SLOT:p1,SOURCE:u1,SPAN:xZ,STYLE:vZ,TABLE:l1,TBODY:e,THEAD:e,TFOOT:e,TD:fW,TH:fW,TEMPLATE:t1,TEXTAREA:WZ,TIME:$Z,TITLE:pZ,TR:r1,TRACK:qZ,UL:uZ,VIDEO:XZ};function p(W){let Z=W.tagName.toUpperCase(),$=iZ[Z];if($)return $(W);throw Error(`Unexpected HTML element tag: ${W.tagName} (update .web/custom/serialize.ts)`)}var cZ=(W)=>p(W.target),g=(W)=>W.relatedTarget?p(W.relatedTarget):null;function P(W,Z){return Y()(W,{target:cZ,...Z||{}})}var I=["target","bubbles","cancelable","defaultPrevented","eventPhase","isTrusted","timeStamp","type"],E=[...I,"detail"],u=[...E,"altKey","button","buttons","clientX","clientY","ctrlKey","metaKey","movementX","movementY","pageX","pageY","screenX","screenY","shiftKey"],dZ=[...u,"pointerId","pressure","tangentialPressure","tiltX","tiltY","twist","width","height","pointerType","isPrimary"],nZ=P(I),oZ=P(E),lZ=P(u,{relatedTarget:g}),sZ=P(I,{clipboardData:(W)=>RW(W.clipboardData)}),rZ=P([...I,"data"]),aZ=P(u,{relatedTarget:g,dataTransfer:(W)=>RW(W.dataTransfer)}),tZ=P(dZ,{relatedTarget:g}),eZ=P(I,{relatedTarget:g}),W0=P(I),Z0=P(I),$0=P(I),Q0=P([...E,"altKey","ctrlKey","code","key","locale","location","metaKey","repeat","shiftKey"]),q0=P([...E,"altKey","ctrlKey","metaKey","shiftKey","changedTouches","targetTouches","touches"],{changedTouches:(W)=>WW(W.changedTouches),targetTouches:(W)=>WW(W.targetTouches),touches:(W)=>WW(W.touches)}),F0=P([...u,"deltaMode","deltaX","deltaY","deltaZ"],{relatedTarget:g}),J0=P([...I,"animationName","elapsedTime","pseudoElement"]),X0=P([...I,"oldState","newState"]),z0=P([...I,"elapsedTime","propertyName","pseudoElement"]);function WW(W){return Array.from(W).map((Z)=>({target:p(Z.target),identifier:Z.identifier,screenX:Z.screenX,screenY:Z.screenY,clientX:Z.clientX,clientY:Z.clientY,pageX:Z.pageX,pageY:Z.pageY}))}function RW(W){if(!W)return null;let Z=[];if(W.items)for(let $=0;$<W.items.length;$++){let Q=W.items[$];Z.push({kind:Q.kind,type:Q.type})}return{drop_effect:W.dropEffect,effect_allowed:W.effectAllowed,items:Z,types:Array.from(W.types||[])}}var j={};function B(W,Z,$){for(let Q of Z)W[Q]=$}B(j,["pointerdown","pointermove","pointerup","pointercancel","gotpointercapture","lostpointercapture","pointerenter","pointerleave","pointerover","pointerout"],tZ);B(j,["click","contextmenu","dblclick","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup"],lZ);B(j,["drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop"],aZ);B(j,["keydown","keypress","keyup"],Q0);B(j,["focus","blur"],eZ);B(j,["change","input"],$0);B(j,["invalid"],Z0);B(j,["reset","submit"],W0);B(j,["copy","cut","paste"],sZ);B(j,["compositionend","compositionstart","compositionupdate"],rZ);B(j,["touchcancel","touchend","touchmove","touchstart"],q0);B(j,["scroll"],oZ);B(j,["wheel"],F0);B(j,["animationstart","animationend","animationiteration"],J0);B(j,["transitionend"],z0);B(j,["toggle"],X0);function ZW(W){if(W&&typeof W==="object"&&"nativeEvent"in W&&typeof W.isDefaultPrevented==="function"){let Z=W;if(typeof Z.type!=="string")return W;let $=j[Z.type.toLowerCase()];if($)return $(Z);return nZ(Z)}return W}function x(W){let Z=new Map,$=[],Q=[],q=[],J=[],D=0;function F(U){if(U==null||typeof U==="number"||typeof U==="string"||typeof U==="boolean")return U;let O=D++,N=Z.get(U);if(N!==void 0)return $.push(O),N;if(Z.set(U,O),U instanceof Date)return Q.push(O),U.getTime();if(Array.isArray(U)){let V=U.length,X=Array(V);for(let f=0;f<V;f++)X[f]=F(U[f]);return X}if(U instanceof Map){J.push(O);let V={};for(let[X,f]of U.entries())V[String(X)]=F(f);return V}if(U instanceof Set){q.push(O);let V=U.size,X=Array(V),f=0;for(let A of U)X[f]=F(A),f+=1;return X}if(typeof U==="object"){let V={},X=Object.keys(U);for(let f=0;f<X.length;f++){let A=X[f];V[A]=F(U[A])}return V}throw Error(`Unsupported value in serialization: ${U}`)}let G=F(W);return[[$,Q,q,J],G]}function $W(W,Z){let[[$,Q,q,J],D]=W,F=new Set($),G=new Set(Q),U=new Set(q),O=new Set(J),N=[];function V(X){let f=N.length;if(F.has(f))return N.push(null),N[X];if(G.has(f)){let A=new Date(X);return N.push(A),A}if(X==null||typeof X==="number"||typeof X==="string"||typeof X==="boolean"){if(Z?.coerceNullsToUndefined)return X??void 0;return X}if(Array.isArray(X)){if(U.has(f)){let R=new Set;N.push(R);for(let K=0;K<X.length;K++)R.add(V(X[K]));return R}let A=X.length,C=Array(A);N.push(C);for(let R=0;R<A;R++)C[R]=V(X[R]);return C}if(typeof X==="object"){if(O.has(f)){let R=new Map;N.push(R);let K=Object.keys(X);for(let M=0;M<K.length;M++){let y=K[M];R.set(y,V(X[y]))}return R}let A={};N.push(A);let C=Object.keys(X);for(let R=0;R<C.length;R++){let K=C[R];A[K]=V(X[K])}return A}throw Error(`Unsupported value in deserialization: ${X}`)}return V(D)}import{io as A0}from"socket.io-client";class L extends Error{constructor(W){super(W);this.name="PulseChannelResetError"}}function G0(){if(typeof crypto<"u"&&typeof crypto.randomUUID==="function")return crypto.randomUUID().replace(/-/g,"");return Math.random().toString(16).slice(2)+Math.random().toString(16).slice(2)}function U0(W){if(W instanceof Error)return W.message;if(typeof W==="string")return W;try{return JSON.stringify(W)}catch{return String(W)}}function V0(W){return typeof W.responseTo==="string"}function D0(W){return typeof W.event==="string"}class PW{client;id;handlers=new Map;pending=new Map;backlog=[];closed=!1;constructor(W,Z){this.client=W;this.id=Z}emit(W,Z){this.ensureOpen(),this.client.sendChannelMessage({type:"channel_message",channel:this.id,event:W,payload:Z})}async request(W,Z){this.ensureOpen();let $=G0();return new Promise((Q,q)=>{this.pending.set($,{resolve:Q,reject:q}),this.client.sendChannelMessage({type:"channel_message",channel:this.id,event:W,payload:Z,requestId:$}).catch((J)=>{this.pending.delete($),q(J)})})}on(W,Z){this.ensureOpen();let $=this.handlers.get(W);if(!$)$=new Set,this.handlers.set(W,$);return $.add(Z),this.flushBacklog(W),()=>{let Q=this.handlers.get(W);if(!Q)return;if(Q.delete(Z),Q.size===0)this.handlers.delete(W)}}handleServerMessage(W){if(V0(W))return this.resolvePending(W),this.closed;if(this.closed)return!0;if(!D0(W))return this.closed;if(W.event==="__close__")return this.close(new L("Channel closed by server")),!0;if(W.requestId)this.dispatchRequest(W);else this.dispatchEvent(W);return this.closed}handleDisconnect(W){this.close(W)}dispose(W){this.close(W)}ensureOpen(){if(this.closed)throw new L("Channel is closed")}flushBacklog(W){if(this.backlog.length===0)return;let Z=[];for(let $ of this.backlog)if($.event===W)this.dispatchEvent($);else Z.push($);this.backlog=Z}dispatchEvent(W){let Z=this.handlers.get(W.event);if(!Z||Z.size===0){this.backlog.push(W);return}for(let $ of Z)try{let Q=$(W.payload);if(Q&&typeof Q.then==="function")Q.catch((q)=>{console.error("Pulse channel handler error",q)})}catch(Q){console.error("Pulse channel handler error",Q)}}async dispatchRequest(W){let Z=this.handlers.get(W.event),$,Q;if(Z&&Z.size>0)for(let q of Z)try{let J=q(W.payload);if($=await Promise.resolve(J),$!==void 0)break}catch(J){Q=J;break}if(Q){await this.client.sendChannelMessage({type:"channel_message",channel:this.id,event:void 0,responseTo:W.requestId,error:U0(Q)});return}await this.client.sendChannelMessage({type:"channel_message",channel:this.id,event:void 0,responseTo:W.requestId,payload:$})}resolvePending(W){let Z=W.responseTo?this.pending.get(W.responseTo):void 0;if(!Z)return;if(this.pending.delete(W.responseTo),W.error!==void 0&&W.error!==null)Z.reject(new L(String(W.error)));else Z.resolve(W.payload)}close(W){if(this.closed)return;this.closed=!0;for(let Z of this.pending.values())Z.reject(W);this.pending.clear(),this.handlers.clear(),this.backlog=[]}}function jW(W,Z){return new PW(W,Z)}class i{url;renderId;frameworkNavigate;activeViews;socket=null;messageQueue;connectionListeners=new Set;serverErrors=new Map;serverErrorListeners=new Set;channels=new Map;constructor(W,Z,$){this.url=W;this.renderId=Z;this.frameworkNavigate=$;this.socket=null,this.activeViews=new Map,this.messageQueue=[]}isConnected(){return this.socket?.connected??!1}async connect(){if(this.socket)return;return new Promise((W,Z)=>{let $=A0(this.url,{transports:["websocket","webtransport"],auth:{renderId:this.renderId}});this.socket=$,$.on("connect",()=>{console.log("[SocketIOTransport] Connected:",this.socket?.id);for(let[Q,q]of this.activeViews)$.emit("message",x({type:"mount",path:Q,routeInfo:q.routeInfo}));for(let Q of this.messageQueue){if(Q.type==="mount"&&this.activeViews.has(Q.path))continue;if(Q.type==="navigate")continue;$.emit("message",x(Q))}this.messageQueue=[],this.notifyConnectionListeners(!0),W()}),$.on("connect_error",(Q)=>{console.error("[SocketIOTransport] Connection failed:",Q),this.notifyConnectionListeners(!1),Z(Q)}),$.on("disconnect",()=>{console.log("[SocketIOTransport] Disconnected"),this.handleTransportDisconnect(),this.notifyConnectionListeners(!1)}),$.on("message",(Q)=>this.handleServerMessage($W(Q,{coerceNullsToUndefined:!0})))})}onConnectionChange(W){return this.connectionListeners.add(W),W(this.isConnected()),()=>{this.connectionListeners.delete(W)}}notifyConnectionListeners(W){for(let Z of this.connectionListeners)Z(W)}onServerError(W){this.serverErrorListeners.add(W);for(let[Z,$]of this.serverErrors)W(Z,$);return()=>{this.serverErrorListeners.delete(W)}}notifyServerError(W,Z){for(let $ of this.serverErrorListeners)$(W,Z)}async sendMessage(W){if(this.isConnected())this.socket.emit("message",x(W));else this.messageQueue.push(W)}async sendChannelMessage(W){await this.sendMessage(W)}mountView(W,Z){if(this.activeViews.has(W))throw Error(`Path ${W} is already mounted`);this.activeViews.set(W,Z),this.sendMessage({type:"mount",path:W,routeInfo:Z.routeInfo})}async navigate(W,Z){await this.sendMessage({type:"navigate",path:W,routeInfo:Z})}unmount(W){this.sendMessage({type:"unmount",path:W}),this.activeViews.delete(W)}disconnect(){this.socket?.disconnect(),this.socket=null,this.messageQueue=[],this.connectionListeners.clear(),this.activeViews.clear(),this.serverErrors.clear(),this.serverErrorListeners.clear();for(let{bridge:W}of this.channels.values())W.dispose(new L("Client disconnected"));this.channels.clear()}handleServerMessage(W){switch(W.type){case"vdom_init":{let Z=this.activeViews.get(W.path);if(!Z)return;if(Z)Z.onInit(W.vdom,W.callbacks,W.render_props,W.css_refs);if(this.serverErrors.has(W.path))this.serverErrors.delete(W.path),this.notifyServerError(W.path,null);break}case"vdom_update":{let Z=this.activeViews.get(W.path);if(!Z)return;if(Z.onUpdate(W.ops),this.serverErrors.has(W.path))this.serverErrors.delete(W.path),this.notifyServerError(W.path,null);break}case"server_error":{if(!this.activeViews.has(W.path))return;this.serverErrors.set(W.path,W.error),this.notifyServerError(W.path,W.error);break}case"api_call":{this.performApiCall(W);break}case"navigate_to":{let Z=!!W.replace,$=W.path||"";if($.startsWith("//"))$=`${window.location.protocol}${$}`;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test($))if($.startsWith("http://")||$.startsWith("https://"))try{let q=new URL($);if(q.origin===window.location.origin){let J=`${q.pathname}${q.search}${q.hash}`;this.frameworkNavigate(J,{replace:Z})}else if(Z)window.location.replace($);else window.location.assign($)}catch{if(Z)window.location.replace($);else window.location.assign($)}else if(Z)window.location.replace($);else window.location.assign($);else this.frameworkNavigate($,{replace:Z});break}case"channel_message":{this.routeChannelMessage(W);break}default:console.error("Unexpected message:",W)}}async performApiCall(W){try{let Z=await fetch(W.url,{method:W.method||"GET",headers:{...W.headers||{},...W.body!=null&&!("content-type"in(W.headers||{}))?{"content-type":"application/json"}:{}},body:W.body!=null?typeof W.body==="string"?W.body:JSON.stringify(W.body):void 0,credentials:W.credentials||"include"}),$={};Z.headers.forEach((D,F)=>$[F]=D);let Q=null;if((Z.headers.get("content-type")||"").includes("application/json"))Q=await Z.json().catch(()=>null);else Q=await Z.text().catch(()=>null);let J={type:"api_result",id:W.id,ok:Z.ok,status:Z.status,headers:$,body:Q};await this.sendMessage(J)}catch(Z){let $={type:"api_result",id:W.id,ok:!1,status:0,headers:{},body:{error:String(Z)}};await this.sendMessage($)}}async invokeCallback(W,Z,$){await this.sendMessage({type:"callback",path:W,callback:Z,args:$.map(ZW)})}acquireChannel(W){let Z=this.ensureChannelEntry(W);return Z.refCount+=1,Z.bridge}releaseChannel(W){let Z=this.channels.get(W);if(!Z)return;if(Z.refCount=Math.max(0,Z.refCount-1),Z.refCount===0)Z.bridge.dispose(new L("Channel released")),this.channels.delete(W)}ensureChannelEntry(W){let Z=this.channels.get(W);if(!Z)Z={bridge:jW(this,W),refCount:0},this.channels.set(W,Z);return Z}routeChannelMessage(W){let Z=this.ensureChannelEntry(W.channel);if(Z.bridge.handleServerMessage(W)&&Z.refCount===0)this.channels.delete(W.channel)}handleTransportDisconnect(){for(let W of this.channels.values())W.bridge.handleDisconnect(new L("Connection lost"))}}import{useLocation as O0,useParams as f0,useNavigate as N0}from"react-router";import{jsx as S,jsxs as c}from"react/jsx-runtime";var IW=BW(null),HW=BW(null),n=()=>{let W=KW(IW);if(!W)throw Error("usePulseClient must be used within a PulseProvider");return W},C0=(W)=>{let Z=KW(HW);if(!Z)throw Error("usePulsePrerender must be used within a PulseProvider");let $=Z.views[W];if(!$)throw Error(`No prerender found for '${W}'`);return $},FW=typeof window<"u";function R0({children:W,config:Z,prerender:$}){let[Q,q]=QW(!0),J=N0(),{renderId:D}=$,F=qW(()=>new i(Z.serverAddress,D,J),[Z.serverAddress,J,D]);return d(()=>F.onConnectionChange(q),[F]),d(()=>{if(FW)return F.connect(),()=>F.disconnect()},[F]),S(IW.Provider,{value:F,children:c(HW.Provider,{value:$,children:[!Q&&S("div",{style:{position:"fixed",bottom:"20px",right:"20px",backgroundColor:"red",color:"white",padding:"10px",borderRadius:"5px",zIndex:1000},children:"Failed to connect to the server."}),W]})})}function P0({externalComponents:W,path:Z,cssModules:$}){let Q=n(),q=C0(Z),J=q.vdom,D=qW(()=>new h(Q,Z,W,$,q.callbacks,q.render_props,q.css_refs),[Q,Z,W,$,q]),[F,G]=QW(()=>D.renderNode(J)),[U,O]=QW(null),N=O0(),V=f0(),X=qW(()=>{let{"*":f="",...A}=V,C=new URLSearchParams(N.search);return{hash:N.hash,pathname:N.pathname,query:N.search,queryParams:Object.fromEntries(C.entries()),pathParams:A,catchall:f.length>0?f.split("/"):[]}},[N.hash,N.pathname,N.search,JSON.stringify(V)]);if(d(()=>{if(FW){Q.mountView(Z,{routeInfo:X,onInit:(A,C,R,K)=>{D.setCallbacks(C),D.setRenderProps(R),D.setCssRefs(K),G(D.renderNode(A))},onUpdate:(A)=>{G((C)=>C==null?C:t(C,A,D))}});let f=Q.onServerError((A,C)=>{if(A===Z)O(C)});return()=>{f(),Q.unmount(Z)}}},[Q]),d(()=>{if(FW)Q.navigate(Z,X)},[Q,Z,X]),U)return S(j0,{error:U});return F}function j0({error:W}){return c("div",{style:{padding:16,border:"1px solid #e00",background:"#fff5f5",color:"#900",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',whiteSpace:"pre-wrap"},children:[c("div",{style:{fontWeight:700,marginBottom:8},children:["Server Error during ",W.phase]}),W.message&&S("div",{children:W.message}),W.stack&&c("details",{open:!0,style:{marginTop:8},children:[S("summary",{children:"Stack trace"}),S("pre",{style:{margin:0},children:W.stack})]})]})}import{useEffect as B0,useMemo as K0}from"react";function I0(W){let Z=n(),$=K0(()=>{if(!W)throw Error("usePulseChannel requires a non-empty channelId");return Z.acquireChannel(W)},[Z,W]);return B0(()=>{return()=>{Z.releaseChannel(W)}},[Z,W]),$}import{forwardRef as H0,useCallback as Y0}from"react";import{jsx as L0}from"react/jsx-runtime";var w0=H0(function({onSubmit:Z,action:$,...Q},q){return L0("form",{...Q,action:$,ref:q,onSubmit:Y0((J)=>YW({event:J,action:$,onSubmit:Z}),[$,Z])})});async function YW({event:W,action:Z,onSubmit:$,formData:Q,force:q}){if($?.(W),!q&&W.defaultPrevented)return;let J=W.currentTarget;W.preventDefault();let D=W.nativeEvent;if(!Q)Q=new FormData(J,D.submitter);let F=new URL(Z,window.location.href);try{await fetch(F,{method:"POST",credentials:"include",body:Q})}catch(G){throw G}}import{io as M0}from"socket.io-client";class wW{url;socket=null;listener=null;messageQueue=[];connectionListeners=new Set;constructor(W){this.url=W}connect(W){return this.listener=W,new Promise((Z,$)=>{this.socket=M0(this.url,{transports:["websocket"]}),this.socket.on("connect",()=>{console.log("[SocketIOTransport] Connected:",this.socket?.id);for(let Q of this.messageQueue)this.socket?.emit("message",Q);this.messageQueue=[],this.notifyConnectionListeners(!0),Z()}),this.socket.on("connect_error",(Q)=>{console.error("[SocketIOTransport] Connection failed:",Q),this.notifyConnectionListeners(!1),$(Q)}),this.socket.on("disconnect",()=>{console.log("[SocketIOTransport] Disconnected"),this.notifyConnectionListeners(!1)}),this.socket.on("message",(Q)=>{this.listener?.(Q)})})}disconnect(){this.socket?.disconnect(),this.socket=null,this.listener=null,this.messageQueue=[],this.connectionListeners.clear()}async sendMessage(W){if(this.isConnected())this.socket.emit("message",W);else this.messageQueue.push(W)}isConnected(){return this.socket?.connected||!1}onConnectionChange(W){return this.connectionListeners.add(W),W(this.isConnected()),()=>{this.connectionListeners.delete(W)}}notifyConnectionListeners(W){for(let Z of this.connectionListeners)Z(W)}}function y0({params:W,request:Z}){let{"*":$="",...Q}=W,q=new URL(Z.url);return{hash:q.hash,pathname:q.pathname,query:q.search,queryParams:Object.fromEntries(q.searchParams.entries()),pathParams:Q,catchall:$.length>1?$.split("/"):[]}}function b0(W){if(W===null||typeof W!=="object")return!1;let Z=Object.getPrototypeOf(W);return Z===Object.prototype||Z===null}function JW(W){return typeof W==="function"||typeof W==="symbol"||typeof W>"u"}async function S0(W){let Z=await W.arrayBuffer();return Array.from(new Uint8Array(Z))}async function k0(W){return await m(W,{seen:new WeakMap,nextId:1})}function T0(W,Z){if(W.seen.get(Z)!==void 0)return null;let Q=W.nextId++;return W.seen.set(Z,Q),Q}async function m(W,Z){if(W===null||typeof W!=="object")return W;if(W instanceof Date)return{__t:"datetime",timestamp:W.getTime()};if(W instanceof FormData){let F=T0(Z,W);if(F===null)return{__t:"ref",id:Z.seen.get(W)};let G={};for(let[O,N]of W.entries()){let V=await m(N,Z);if(V===void 0)continue;if(Object.prototype.hasOwnProperty.call(G,O)){let X=G[O];if(Array.isArray(X))X.push(V);else G[O]=[X,V]}else G[O]=V}return{__t:"formdata",fields:G,__id:F}}if(W instanceof File){let F=W,G=await S0(W);return{__t:"file",name:F.name,type:F.type,size:F.size,lastModified:F.lastModified,content:G}}let $=W,Q=Z.seen.get($);if(Q!==void 0)return{__t:"ref",id:Q};let q=Z.nextId++;if(Z.seen.set($,q),Array.isArray(W)){let G=(await Promise.all(W.map((O)=>m(O,Z)))).filter((O)=>O!==void 0);return{__t:"array",__id:q,items:G}}let J={};if(b0(W))for(let F of Object.keys(W)){let G=W[F];if(JW(G))continue;let U=await m(G,Z);if(U!==void 0)J[F]=U}else for(let F in W){let G=W[F];if(JW(G))continue;let U=await m(G,Z);if(U!==void 0)J[F]=U}return{__t:"object",__id:q,props:J}}function _0(W){return k(W)}function k(W){if(W===null||typeof W!=="object")return W;let Z=W,$=Z.__t;if($==="datetime"){let q=Z.timestamp;return new Date(q)}if($==="file"){let q=Z.content;if(Array.isArray(q))return{...Z,content:new Uint8Array(q)};return Z}if($==="formdata"){let q=Z.fields,J={};for(let D of Object.keys(q)){let F=q[D];if(Array.isArray(F))J[D]=F.map((G)=>k(G));else J[D]=k(F)}return{__t:"formdata",fields:J}}if($==="array")return Z.items.map((J)=>k(J));if($==="object"){let q=Z.props,J={};for(let D of Object.keys(q))J[D]=k(q[D]);return J}if($==="ref")return Z;let Q={};for(let q of Object.keys(Z))Q[q]=k(Z[q]);return Q}function g0(W){return XW(W,new WeakSet)}function XW(W,Z){if(W===null||typeof W!=="object")return W;if(Z.has(W))return;if(Z.add(W),Array.isArray(W))return W.map((Q)=>XW(Q,Z)).filter((Q)=>Q!==void 0);let $={};for(let Q in W){let q=W[Q];if(JW(q))continue;let J=XW(q,Z);if(J!==void 0)$[Q]=J}return $}export{n as usePulseClient,I0 as usePulseChannel,YW as submitForm,x as serialize,y0 as extractServerRouteInfo,ZW as extractEvent,k0 as encodeForWire,$W as deserialize,_0 as decodeFromWire,g0 as cleanForSerialization,t as applyReactTreeUpdates,h as VDOMRenderer,wW as SocketIOTransport,SW as RenderLazy,P0 as PulseView,i as PulseSocketIOClient,R0 as PulseProvider,w0 as PulseForm,L as PulseChannelResetError};
|
|
1
|
+
class b extends Error{constructor(W){super(W);this.name="PulseChannelResetError"}}function N1(){if(typeof crypto<"u"&&typeof crypto.randomUUID==="function")return crypto.randomUUID().replace(/-/g,"");return Math.random().toString(16).slice(2)+Math.random().toString(16).slice(2)}function f1(W){if(W instanceof Error)return W.message;if(typeof W==="string")return W;try{return JSON.stringify(W)}catch{return String(W)}}function B1(W){return typeof W.responseTo==="string"}function C1(W){return typeof W.event==="string"}class t{client;id;handlers=new Map;pending=new Map;backlog=[];closed=!1;constructor(W,Z){this.client=W;this.id=Z}emit(W,Z){this.ensureOpen(),this.client.sendMessage({type:"channel_message",channel:this.id,event:W,payload:Z})}request(W,Z){this.ensureOpen();let $=N1();return new Promise((J,q)=>{this.pending.set($,{resolve:J,reject:q}),this.client.sendMessage({type:"channel_message",channel:this.id,event:W,payload:Z,requestId:$})})}on(W,Z){this.ensureOpen();let $=this.handlers.get(W);if(!$)$=new Set,this.handlers.set(W,$);return $.add(Z),this.flushBacklog(W),()=>{let J=this.handlers.get(W);if(!J)return;if(J.delete(Z),J.size===0)this.handlers.delete(W)}}handleServerMessage(W){if(B1(W))return this.resolvePending(W),this.closed;if(this.closed)return!0;if(!C1(W))return this.closed;if(W.event==="__close__")return this.close(new b("Channel closed by server")),!0;if(W.requestId)this.dispatchRequest(W);else this.dispatchEvent(W);return this.closed}handleDisconnect(W){this.close(W)}dispose(W){this.close(W)}ensureOpen(){if(this.closed)throw new b("Channel is closed")}flushBacklog(W){if(this.backlog.length===0)return;let Z=[];for(let $ of this.backlog)if($.event===W)this.dispatchEvent($);else Z.push($);this.backlog=Z}dispatchEvent(W){let Z=this.handlers.get(W.event);if(!Z||Z.size===0){this.backlog.push(W);return}for(let $ of Z)try{let J=$(W.payload);if(J&&typeof J.then==="function")J.catch((q)=>{console.error("Pulse channel handler error",q)})}catch(J){console.error("Pulse channel handler error",J)}}async dispatchRequest(W){let Z=this.handlers.get(W.event),$,J;if(Z&&Z.size>0)for(let q of Z)try{let G=q(W.payload);if($=await Promise.resolve(G),$!==void 0)break}catch(G){J=G;break}if(J){this.client.sendMessage({type:"channel_message",channel:this.id,event:void 0,responseTo:W.requestId,error:f1(J)});return}this.client.sendMessage({type:"channel_message",channel:this.id,event:void 0,responseTo:W.requestId,payload:$})}resolvePending(W){let Z=W.responseTo?this.pending.get(W.responseTo):void 0;if(!Z)return;if(this.pending.delete(W.responseTo),W.error!==void 0&&W.error!==null)Z.reject(new b(String(W.error)));else Z.resolve(W.payload)}close(W){if(this.closed)return;this.closed=!0;for(let Z of this.pending.values())Z.reject(W);this.pending.clear(),this.handlers.clear(),this.backlog=[]}}function e(W,Z){return new t(W,Z)}import{forwardRef as K1,useCallback as H1}from"react";import{jsx as P1}from"react/jsx-runtime";var I1=K1(function({onSubmit:Z,action:$,...J},q){return P1("form",{...J,action:$,ref:q,onSubmit:H1((G)=>W1({event:G,action:$,onSubmit:Z}),[$,Z])})});async function W1({event:W,action:Z,onSubmit:$,formData:J,force:q}){if($?.(W),!q&&W.defaultPrevented)return;let G=W.currentTarget;W.preventDefault();let U=W.nativeEvent;if(!J)J=new FormData(G,U.submitter);let F=new URL(Z,window.location.href);try{await fetch(F,{method:"POST",credentials:"include",body:J})}catch(O){throw O}}function b1({params:W,request:Z}){let{"*":$="",...J}=W,q=new URL(Z.url);return{hash:q.hash,pathname:q.pathname,query:q.search,queryParams:Object.fromEntries(q.searchParams.entries()),pathParams:J,catchall:$.length>1?$.split("/"):[]}}import{createContext as j1,useContext as A1,useEffect as m,useMemo as o,useState as s}from"react";import{useLocation as Q0,useNavigate as G0,useParams as z0}from"react-router";import{io as Z0}from"socket.io-client";function Y(){function W(Z,$){return(J)=>{let q={};for(let G of Z)q[G]=J[G];if($)for(let G in $){let U=$[G];q[G]=U(J)}return q}}return W}var Y1=(W)=>W.tagName.toLowerCase(),y1=["id","className","tagName","localName","clientHeight","clientLeft","clientTop","clientWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth","slot"],w1=["autofocus","tabIndex","nonce"],L1=["accessKey","accessKeyLabel","autocapitalize","dir","draggable","hidden","inert","lang","offsetHeight","offsetLeft","offsetTop","offsetWidth","popover","spellcheck","title","translate","writingSuggestions","contentEditable","enterKeyHint","isContentEditable","inputMode"],M1=Y()(y1,{tagName:Y1}),S1=Y()(w1),k1=Y()(L1);function y(W){return{...M1(W),...S1(W),...k1(W)}}function X(W,Z){let $=Y()(W,Z);return(J)=>({...y(J),...$(J)})}var _1=["hash","host","hostname","href","origin","password","pathname","port","protocol","search","target","download","rel","hreflang","type","username","ping","referrerPolicy","text"],T1=X(_1),g1=["alt","coords","download","hash","host","hostname","href","origin","password","pathname","port","protocol","rel","search","shape","target","username","ping","referrerPolicy"],v1=X(g1),x1=["autoplay","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","loop","muted","networkState","paused","playbackRate","preload","readyState","seeking","src","volume","preservesPitch"],X1=X(x1),u1=(W)=>X1(W),m1=["disabled","name","type","value","formAction","formEnctype","formMethod","formNoValidate","formTarget","popoverTargetAction"],h1=X(m1),E1=["value"],p1=X(E1),d1=["height","src","type","width","align","name"],i1=X(d1),c1=["disabled","name","type","validationMessage","willValidate"],n1=X(c1),l1=["acceptCharset","action","autocomplete","encoding","enctype","length","method","name","noValidate","target","rel"],o1=X(l1),s1=["allow","allowFullscreen","height","name","referrerPolicy","src","srcdoc","width","align","frameBorder","longDesc","marginHeight","marginWidth","scrolling","sandbox"],r1=X(s1),a1=["alt","crossOrigin","decoding","height","isMap","loading","naturalHeight","naturalWidth","referrerPolicy","sizes","src","srcset","useMap","width","align","border","complete","hspace","longDesc","lowsrc","name","vspace","x","y","fetchPriority"],t1=X(a1),e1=["accept","alt","autocomplete","checked","defaultChecked","defaultValue","dirName","disabled","height","indeterminate","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","selectionDirection","selectionEnd","selectionStart","size","src","step","type","value","valueAsNumber","width","align","capture","formAction","formEnctype","formMethod","formNoValidate","formTarget","useMap","validationMessage","willValidate","popoverTargetAction"],WW=X(e1),ZW=["htmlFor"],$W=X(ZW),JW=["value","type"],qW=X(JW),XW=["as","crossOrigin","disabled","fetchPriority","href","hreflang","imageSizes","imageSrcset","integrity","media","referrerPolicy","rel","type","charset","rev","target","sizes"],FW=X(XW),QW=["name"],GW=X(QW),zW=["high","low","max","min","optimum","value"],UW=X(zW),DW=["cite","dateTime"],Z1=X(DW),VW=["reversed","start","type","compact"],jW=X(VW),AW=["data","height","name","type","useMap","width","validationMessage","willValidate","align","archive","border","code","codeBase","codeType","declare","hspace","standby","vspace"],OW=X(AW),RW=["disabled","label"],NW=X(RW),fW=["defaultSelected","disabled","index","label","selected","text","value"],BW=X(fW),CW=["defaultValue","name","type","value","htmlFor","validationMessage","willValidate"],KW=X(CW),HW=["max","position","value"],IW=X(HW),PW=["cite"],$1=X(PW),bW=(W)=>y(W),YW=["async","crossOrigin","defer","fetchPriority","integrity","noModule","referrerPolicy","src","text","type","charset"],yW=Y()(YW,{event:(W)=>W.event,htmlFor:(W)=>W.htmlFor}),wW=(W)=>({...y(W),...yW(W)}),LW=["autocomplete","disabled","length","multiple","name","required","selectedIndex","size","type","value","validationMessage","willValidate"],MW=X(LW),SW=["name"],kW=X(SW),_W=["height","media","sizes","src","srcset","type","width"],TW=X(_W),gW=["align"],vW=X(gW),xW=["abbr","cellIndex","colSpan","headers","rowSpan","scope","align","axis","bgColor","ch","chOff","height","noWrap","vAlign","width"],J1=X(xW),uW=["span","align","ch","chOff","vAlign","width"],q1=X(uW),mW=["align","bgColor","border","cellPadding","cellSpacing","frame","rules","summary","width"],hW=X(mW),EW=["rowIndex","sectionRowIndex","align","bgColor","ch","chOff","vAlign"],pW=X(EW),dW=["align","ch","chOff","vAlign"],p=X(dW),iW=(W)=>y(W),cW=["autocomplete","cols","defaultValue","dirName","disabled","maxLength","minLength","name","placeholder","readOnly","required","rows","selectionDirection","selectionEnd","selectionStart","value","wrap","textLength","validationMessage","willValidate"],nW=X(cW),lW=["dateTime"],oW=X(lW),sW=["default","kind","label","readyState","src","srclang"],rW=X(sW),aW=["height","poster","videoHeight","videoWidth","width","playsInline"],tW=Y()(aW),eW=(W)=>({...X1(W),...tW(W)}),WZ=["clear"],ZZ=X(WZ),$Z=["href","target"],JZ=X($Z),qZ=["aLink","background","bgColor","link","text","vLink"],XZ=X(qZ),FZ=["compact"],QZ=X(FZ),GZ=["open"],zZ=X(GZ),UZ=["open","returnValue"],DZ=X(UZ),VZ=["align"],jZ=X(VZ),AZ=(W)=>y(W),OZ=["align"],L=X(OZ),RZ=["align","color","noShade","size","width"],NZ=X(RZ),fZ=["version"],BZ=X(fZ),CZ=(W)=>y(W),KZ=["content","httpEquiv","name","scheme"],HZ=X(KZ),IZ=["align"],PZ=X(IZ),bZ=(W)=>y(W),YZ=["width"],yZ=X(YZ),wZ=(W)=>y(W),LZ=["media","type","disabled"],MZ=X(LZ),SZ=["text"],kZ=X(SZ),_Z=["compact","type"],TZ=X(_Z),gZ={A:T1,AREA:v1,AUDIO:u1,BASE:JZ,BLOCKQUOTE:$1,Q:$1,BODY:XZ,BR:ZZ,BUTTON:h1,CANVAS:y,CAPTION:vW,CITE:bW,COL:q1,COLGROUP:q1,DATA:p1,DETAILS:zZ,DIALOG:DZ,DIV:jZ,DL:QZ,EMBED:i1,FIELDSET:n1,FORM:o1,H1:L,H2:L,H3:L,H4:L,H5:L,H6:L,HEAD:AZ,HR:NZ,HTML:BZ,IFRAME:r1,IMG:t1,INPUT:WW,LABEL:$W,LI:qW,LINK:FW,MAP:GW,MENU:CZ,META:HZ,METER:UW,INS:Z1,DEL:Z1,OBJECT:OW,OL:jW,OPTGROUP:NW,OPTION:BW,OUTPUT:KW,P:PZ,PICTURE:bZ,PRE:yZ,PROGRESS:IW,SCRIPT:wW,SELECT:MW,SLOT:kW,SOURCE:TW,SPAN:wZ,STYLE:MZ,TABLE:hW,TBODY:p,THEAD:p,TFOOT:p,TD:J1,TH:J1,TEMPLATE:iW,TEXTAREA:nW,TIME:oW,TITLE:kZ,TR:pW,TRACK:rW,UL:TZ,VIDEO:eW};function g(W){let Z=W.tagName.toUpperCase(),$=gZ[Z];if($)return $(W);throw Error(`Unexpected HTML element tag: ${W.tagName} (update .web/custom/serialize.ts)`)}var vZ=(W)=>g(W.target),k=(W)=>W.relatedTarget?g(W.relatedTarget):null;function B(W,Z){return Y()(W,{target:vZ,...Z||{}})}var P=["target","bubbles","cancelable","defaultPrevented","eventPhase","isTrusted","timeStamp","type"],v=[...P,"detail"],x=[...v,"altKey","button","buttons","clientX","clientY","ctrlKey","metaKey","movementX","movementY","pageX","pageY","screenX","screenY","shiftKey"],xZ=[...x,"pointerId","pressure","tangentialPressure","tiltX","tiltY","twist","width","height","pointerType","isPrimary"],uZ=B(P),mZ=B(v),hZ=B(x,{relatedTarget:k}),EZ=B(P,{clipboardData:(W)=>F1(W.clipboardData)}),pZ=B([...P,"data"]),dZ=B(x,{relatedTarget:k,dataTransfer:(W)=>F1(W.dataTransfer)}),iZ=B(xZ,{relatedTarget:k}),cZ=B(P,{relatedTarget:k}),nZ=B(P),lZ=B(P),oZ=B(P),sZ=B([...v,"altKey","ctrlKey","code","key","locale","location","metaKey","repeat","shiftKey"]),rZ=B([...v,"altKey","ctrlKey","metaKey","shiftKey","changedTouches","targetTouches","touches"],{changedTouches:(W)=>d(W.changedTouches),targetTouches:(W)=>d(W.targetTouches),touches:(W)=>d(W.touches)}),aZ=B([...x,"deltaMode","deltaX","deltaY","deltaZ"],{relatedTarget:k}),tZ=B([...P,"animationName","elapsedTime","pseudoElement"]),eZ=B([...P,"oldState","newState"]),W0=B([...P,"elapsedTime","propertyName","pseudoElement"]);function d(W){return Array.from(W).map((Z)=>({target:g(Z.target),identifier:Z.identifier,screenX:Z.screenX,screenY:Z.screenY,clientX:Z.clientX,clientY:Z.clientY,pageX:Z.pageX,pageY:Z.pageY}))}function F1(W){if(!W)return null;let Z=[];if(W.items)for(let $=0;$<W.items.length;$++){let J=W.items[$];Z.push({kind:J.kind,type:J.type})}return{drop_effect:W.dropEffect,effect_allowed:W.effectAllowed,items:Z,types:Array.from(W.types||[])}}var C={};function H(W,Z,$){for(let J of Z)W[J]=$}H(C,["pointerdown","pointermove","pointerup","pointercancel","gotpointercapture","lostpointercapture","pointerenter","pointerleave","pointerover","pointerout"],iZ);H(C,["click","contextmenu","dblclick","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup"],hZ);H(C,["drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop"],dZ);H(C,["keydown","keypress","keyup"],sZ);H(C,["focus","blur"],cZ);H(C,["change","input"],oZ);H(C,["invalid"],lZ);H(C,["reset","submit"],nZ);H(C,["copy","cut","paste"],EZ);H(C,["compositionend","compositionstart","compositionupdate"],pZ);H(C,["touchcancel","touchend","touchmove","touchstart"],rZ);H(C,["scroll"],mZ);H(C,["wheel"],aZ);H(C,["animationstart","animationend","animationiteration"],tZ);H(C,["transitionend"],W0);H(C,["toggle"],eZ);function Q1(W){if(W&&typeof W==="object"&&"nativeEvent"in W&&typeof W.isDefaultPrevented==="function"){let Z=W;if(typeof Z.type!=="string")return W;let $=C[Z.type.toLowerCase()];if($)return $(Z);return uZ(Z)}return W}function _(W){let Z=new Map,$=[],J=[],q=[],G=[],U=0;function F(z){if(z==null||typeof z==="number"||typeof z==="string"||typeof z==="boolean")return z;let f=U++,V=Z.get(z);if(V!==void 0)return $.push(f),V;if(Z.set(z,f),z instanceof Date)return J.push(f),z.getTime();if(Array.isArray(z)){let j=z.length,Q=Array(j);for(let D=0;D<j;D++)Q[D]=F(z[D]);return Q}if(z instanceof Map){G.push(f);let j={};for(let[Q,D]of z.entries())j[String(Q)]=F(D);return j}if(z instanceof Set){q.push(f);let j=z.size,Q=Array(j),D=0;for(let A of z)Q[D]=F(A),D+=1;return Q}if(typeof z==="object"){let j={},Q=Object.keys(z);for(let D=0;D<Q.length;D++){let A=Q[D];j[A]=F(z[A])}return j}throw Error(`Unsupported value in serialization: ${z}`)}let O=F(W);return[[$,J,q,G],O]}function i(W,Z){let[[$,J,q,G],U]=W,F=new Set($),O=new Set(J),z=new Set(q),f=new Set(G),V=[];function j(Q){let D=V.length;if(F.has(D))return V.push(null),V[Q];if(O.has(D)){let A=new Date(Q);return V.push(A),A}if(Q==null||typeof Q==="number"||typeof Q==="string"||typeof Q==="boolean"){if(Z?.coerceNullsToUndefined)return Q??void 0;return Q}if(Array.isArray(Q)){if(z.has(D)){let R=new Set;V.push(R);for(let K=0;K<Q.length;K++)R.add(j(Q[K]));return R}let A=Q.length,N=Array(A);V.push(N);for(let R=0;R<A;R++)N[R]=j(Q[R]);return N}if(typeof Q==="object"){if(f.has(D)){let R=new Map;V.push(R);let K=Object.keys(Q);for(let w=0;w<K.length;w++){let I=K[w];R.set(I,j(Q[I]))}return R}let A={};V.push(A);let N=Object.keys(Q);for(let R=0;R<N.length;R++){let K=N[R];A[K]=j(Q[K])}return A}throw Error(`Unsupported value in deserialization: ${Q}`)}return j(U)}class c{#W;#Z=null;#J;#X=new Set;#$=new Map;#F=new Set;#q=new Map;#U;#D;#Q;constructor(W,Z,$){this.#U=W,this.#D=Z,this.#Q=$,this.#Z=null,this.#W=new Map,this.#J=[]}isConnected(){return this.#Z?.connected??!1}async connect(){if(this.#Z)return;return new Promise((W,Z)=>{let $=Z0(this.#U,{transports:["websocket","webtransport"],auth:{renderId:this.#D}});this.#Z=$,$.on("connect",()=>{console.log("[SocketIOTransport] Connected:",this.#Z?.id);for(let[J,q]of this.#W)$.emit("message",_({type:"mount",path:J,routeInfo:q.routeInfo}));for(let J of this.#J){if(J.type==="mount"&&this.#W.has(J.path))continue;if(J.type==="navigate")continue;$.emit("message",_(J))}this.#J=[],this.notifyConnectionListeners(!0),W()}),$.on("connect_error",(J)=>{console.error("[SocketIOTransport] Connection failed:",J),this.notifyConnectionListeners(!1),Z(J)}),$.on("disconnect",()=>{console.log("[SocketIOTransport] Disconnected"),this.#A(),this.notifyConnectionListeners(!1)}),$.on("message",(J)=>this.#j(i(J,{coerceNullsToUndefined:!0})))})}onConnectionChange(W){return this.#X.add(W),W(this.isConnected()),()=>{this.#X.delete(W)}}notifyConnectionListeners(W){for(let Z of this.#X)Z(W)}onServerError(W){this.#F.add(W);for(let[Z,$]of this.#$)W(Z,$);return()=>{this.#F.delete(W)}}notifyServerError(W,Z){for(let $ of this.#F)$(W,Z)}sendMessage(W){if(this.isConnected())this.#Z.emit("message",_(W));else this.#J.push(W)}mountView(W,Z){if(this.#W.has(W))throw Error(`Path ${W} is already mounted`);this.#W.set(W,Z),this.sendMessage({type:"mount",path:W,routeInfo:Z.routeInfo})}async navigate(W,Z){await this.sendMessage({type:"navigate",path:W,routeInfo:Z})}unmount(W){this.sendMessage({type:"unmount",path:W}),this.#W.delete(W)}disconnect(){this.#Z?.disconnect(),this.#Z=null,this.#J=[],this.#X.clear(),this.#W.clear(),this.#$.clear(),this.#F.clear();for(let{bridge:W}of this.#q.values())W.dispose(new b("Client disconnected"));this.#q.clear()}#j(W){switch(W.type){case"vdom_init":{let Z=this.#W.get(W.path);if(!Z)return;if(Z)Z.onInit(W.vdom,W.callbacks,W.render_props,W.css_refs);if(this.#$.has(W.path))this.#$.delete(W.path),this.notifyServerError(W.path,null);break}case"vdom_update":{let Z=this.#W.get(W.path);if(!Z)return;if(Z.onUpdate(W.ops),this.#$.has(W.path))this.#$.delete(W.path),this.notifyServerError(W.path,null);break}case"server_error":{if(!this.#W.has(W.path))return;this.#$.set(W.path,W.error),this.notifyServerError(W.path,W.error);break}case"api_call":{this.#G(W);break}case"navigate_to":{let Z=!!W.replace,$=W.path||"";if($.startsWith("//"))$=`${window.location.protocol}${$}`;if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test($))if($.startsWith("http://")||$.startsWith("https://"))try{let q=new URL($);if(q.origin===window.location.origin){let G=`${q.pathname}${q.search}${q.hash}`;this.#Q(G,{replace:Z})}else if(Z)window.location.replace($);else window.location.assign($)}catch{if(Z)window.location.replace($);else window.location.assign($)}else if(Z)window.location.replace($);else window.location.assign($);else this.#Q($,{replace:Z});break}case"channel_message":{this.#V(W);break}default:console.error("Unexpected message:",W)}}async#G(W){try{let Z=await fetch(W.url,{method:W.method||"GET",headers:{...W.headers||{},...W.body!=null&&!("content-type"in(W.headers||{}))?{"content-type":"application/json"}:{}},body:W.body!=null?typeof W.body==="string"?W.body:JSON.stringify(W.body):void 0,credentials:W.credentials||"include"}),$={};Z.headers.forEach((U,F)=>{$[F]=U});let J=null;if((Z.headers.get("content-type")||"").includes("application/json"))J=await Z.json().catch(()=>null);else J=await Z.text().catch(()=>null);let G={type:"api_result",id:W.id,ok:Z.ok,status:Z.status,headers:$,body:J};this.sendMessage(G)}catch(Z){let $={type:"api_result",id:W.id,ok:!1,status:0,headers:{},body:{error:String(Z)}};this.sendMessage($)}}invokeCallback(W,Z,$){this.sendMessage({type:"callback",path:W,callback:Z,args:$.map(Q1)})}acquireChannel(W){let Z=this.#z(W);return Z.refCount+=1,Z.bridge}releaseChannel(W){let Z=this.#q.get(W);if(!Z)return;if(Z.refCount=Math.max(0,Z.refCount-1),Z.refCount===0)Z.bridge.dispose(new b("Channel released")),this.#q.delete(W)}#z(W){let Z=this.#q.get(W);if(!Z)Z={bridge:e(this,W),refCount:0},this.#q.set(W,Z);return Z}#V(W){let Z=this.#z(W.channel);if(Z.bridge.handleServerMessage(W)&&Z.refCount===0)this.#q.delete(W.channel)}#A(){for(let W of this.#q.values())W.bridge.handleDisconnect(new b("Connection lost"))}}import{cloneElement as T,createElement as n,Fragment as $0,isValidElement as J0,lazy as q0,Suspense as X0}from"react";var G1="$$fragment",z1="$$";function U1(W){return typeof W==="object"&&W!==null}function D1(W){return typeof W==="object"&&W!==null&&W.tag.startsWith("$$")&&W.tag!=="$$fragment"}import{jsx as V1}from"react/jsx-runtime";class l{#W;#Z;#J;#X;#$;#F;#q;#U;#D;constructor(W,Z,$,J,q=[],G=[],U=[]){this.#F=W,this.#q=Z,this.#U=$,this.#D=J,this.#W=new Set(q),this.#Z=new Map,this.#J=new Set(G),this.#X=new Set(U),this.#$=[...this.#W].sort()}hasCallbackPath(W){return this.#W.has(W)}hasRenderPropPath(W){return this.#J.has(W)}hasAnyCallbackUnder(W){if(W==="")return this.#$.length>0;let Z=this.#A(this.#$,W);return Z<this.#$.length&&this.#$[Z].startsWith(W)}applyCallbackDelta(W){if(W.remove)for(let Z of W.remove)this.#W.delete(Z),this.#Z.delete(Z);if(W.add)for(let Z of W.add)this.#W.add(Z);this.#$=[...this.#W].sort()}applyRenderPropsDelta(W){if(W.remove)for(let Z of W.remove)this.#J.delete(Z);if(W.add)for(let Z of W.add)this.#J.add(Z)}applyCssRefsDelta(W){if(W.remove)for(let Z of W.remove)this.#X.delete(Z);if(W.add)for(let Z of W.add)this.#X.add(Z)}getCallback(W,Z){let $=this.#Q(W,Z),J=this.#Z.get($);if(!J)J=(...q)=>this.#F.invokeCallback(this.#q,$,q),this.#Z.set($,J);return J}renderNode(W,Z=""){if(W==null||typeof W==="boolean"||typeof W==="number"||typeof W==="string")return W;if(U1(W)){let{tag:$,props:J={},children:q=[]}=W,G={};for(let[F,O]of Object.entries(J))G[F]=this.transformValue(Z,F,O);if(W.key)G.key=W.key;let U=[];for(let F=0;F<q.length;F+=1){let O=q[F],z=Z?`${Z}.${F}`:String(F);U.push(this.renderNode(O,z))}if(D1(W)){let F=W.tag.slice(z1.length),O=this.#U[F];if(!O)throw Error(`Could not find component ${F}. This is a Pulse internal error.`);return n(O,G,...U)}return n($===G1?$0:$,G,...U)}return null}#Q(W,Z){return W?`${W}.${Z}`:Z}transformValue(W,Z,$){let J=this.#Q(W,Z);if(this.#W.has(J))return this.getCallback(W,Z);if(this.#J.has(J))return this.renderNode($,J);if(this.#X.has(J))return this.#j($);return $}#j(W){let Z=W.indexOf(":");if(Z===-1)return W;let $=W.slice(0,Z),J=W.slice(Z+1);if(!$||!J)return W;let q=this.#D[$];if(!q)throw Error(`Received CSS reference for unknown module '${$}'`);let G=q[J];if(typeof G!=="string")throw Error(`Received CSS reference for missing class '${J}' in module '${$}'`);return G}init(W,Z,$,J){this.#W=new Set(Z);for(let q of Array.from(this.#Z.keys()))if(!this.#W.has(q))this.#Z.delete(q);return this.#$=[...this.#W].sort(),this.#J=new Set($),this.#X=new Set(J),this.renderNode(W)}#G(W){let Z=W.props?.children;if(Z==null)return[];return Array.isArray(Z)?Z.slice():[Z]}applyUpdates(W,Z){let $=W;for(let J of Z){if(J.type==="update_callbacks"){this.applyCallbackDelta(J.data);continue}if(J.type==="update_css_refs"){this.applyCssRefsDelta(J.data);continue}if(J.type==="update_render_props"){this.applyRenderPropsDelta(J.data);continue}let q=J.path.split(".").filter((U)=>U.length>0),G=(U,F,O)=>{if(F<q.length){this.#z(U,q,F);let z=U,f=q[F],V=+f,j=O?`${O}.${f}`:f;if(!Number.isNaN(V)){let Q=this.#G(z),D=Q[V];return Q[V]=G(D,F+1,j),T(z,void 0,...Q)}else{let Q=z.props??{},D=Q[f],A={...Q,[f]:G(D,F+1,j)};return T(z,A)}}switch(J.type){case"replace":return this.renderNode(J.data,J.path);case"update_props":{this.#z(U,q,F);let z=U,V={...z.props??{}},j=J.data;if(j.remove&&j.remove.length>0){for(let D of j.remove)if(D in V)delete V[D]}if(j.set)for(let[D,A]of Object.entries(j.set))V[D]=this.transformValue(O,D,A);if((j.remove?.length??0)>0)return V.key=z.key,V.ref=z.ref,n(z.type,V,...this.#G(z));else return T(z,V)}case"reconciliation":{this.#z(U,q,F);let z=U,f=this.#G(z),V=[],[j,Q]=J.new,[D,A]=J.reuse,N=-1,R=-1,K=-1,w=-1;if(j.length>0)N=j[0],K=0;if(D.length>0)R=D[0],w=0;for(let I=0;I<J.N;++I)if(I===N){let E=Q[K],S=O?`${O}.${I}`:String(I);V.push(this.renderNode(E,S)),N=K<j.length-1?j[++K]:-1}else if(I===R){let E=A[w],S=f[E],a=O?`${O}.${I}`:String(I);if(this.hasAnyCallbackUnder(a))S=this.#V(S,a);V.push(S),R=w<D.length-1?D[++w]:-1}else V.push(f[I]);return T(z,null,...V)}default:throw Error(`[Pulse renderer] Unknown update type: ${J?.type}`)}};$=G($,0,"")}return $}#z(W,Z,$){return!0}#V(W,Z){if(!J0(W))return W;let $=W,J=$.props??{},q={...J};for(let U of Object.keys(J)){let F=Z?`${Z}.${U}`:U;if(this.hasCallbackPath(F))q[U]=this.getCallback(Z,U);if(this.hasRenderPropPath(F)&&this.hasAnyCallbackUnder(F))q[U]=this.#V(J[U],F)}let G=this.#G($).map((U,F)=>{let O=Z?`${Z}.${F}`:String(F);if(this.hasAnyCallbackUnder(O))return this.#V(U,O);else return U});return T($,q,...G)}#A(W,Z){let $=0,J=W.length;while($<J){let q=$+J>>>1;if(W[q]<Z)$=q+1;else J=q}return $}}function F0(W,Z){let $=q0(W);return({children:J,...q})=>{return V1(X0,{fallback:Z,children:V1($,{...q,children:J})})}}import{jsx as M,jsxs as u}from"react/jsx-runtime";var O1=j1(null),R1=j1(null),h=()=>{let W=A1(O1);if(!W)throw Error("usePulseClient must be used within a PulseProvider");return W},U0=(W)=>{let Z=A1(R1);if(!Z)throw Error("usePulsePrerender must be used within a PulseProvider");let $=Z.views[W];if(!$)throw Error(`No prerender found for '${W}'`);return $},r=typeof window<"u";function D0({children:W,config:Z,prerender:$}){let[J,q]=s(!0),G=G0(),{renderId:U}=$,F=o(()=>new c(Z.serverAddress,U,G),[Z.serverAddress,G,U]);return m(()=>F.onConnectionChange(q),[F]),m(()=>{if(r)return F.connect(),()=>F.disconnect()},[F]),M(O1.Provider,{value:F,children:u(R1.Provider,{value:$,children:[!J&&M("div",{style:{position:"fixed",bottom:"20px",right:"20px",backgroundColor:"red",color:"white",padding:"10px",borderRadius:"5px",zIndex:1000},children:"Failed to connect to the server."}),W]})})}function V0({externalComponents:W,path:Z,cssModules:$}){let J=h(),q=U0(Z),G=q.vdom,U=o(()=>new l(J,Z,W,$,q.callbacks,q.render_props,q.css_refs),[J,Z,W,$,q]),[F,O]=s(()=>U.init(G,q.callbacks,q.render_props,q.css_refs)),[z,f]=s(null),V=Q0(),j=z0(),Q=o(()=>{let{"*":D="",...A}=j,N=new URLSearchParams(V.search);return{hash:V.hash,pathname:V.pathname,query:V.search,queryParams:Object.fromEntries(N.entries()),pathParams:A,catchall:D.length>0?D.split("/"):[]}},[V.hash,V.pathname,V.search,JSON.stringify(j)]);if(m(()=>{if(r){J.mountView(Z,{routeInfo:Q,onInit:(A,N,R,K)=>{O(U.init(A,N,R,K))},onUpdate:(A)=>{O((N)=>N==null?N:U.applyUpdates(N,A))}});let D=J.onServerError((A,N)=>{if(A===Z)f(N)});return()=>{D(),J.unmount(Z)}}},[J,U,Z,Q]),m(()=>{if(r)J.navigate(Z,Q)},[J,Z,Q]),z)return M(j0,{error:z});return F}function j0({error:W}){return u("div",{style:{padding:16,border:"1px solid #e00",background:"#fff5f5",color:"#900",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',whiteSpace:"pre-wrap"},children:[u("div",{style:{fontWeight:700,marginBottom:8},children:["Server Error during ",W.phase]}),W.message&&M("div",{children:W.message}),W.stack&&u("details",{open:!0,style:{marginTop:8},children:[M("summary",{children:"Stack trace"}),M("pre",{style:{margin:0},children:W.stack})]})]})}import{useEffect as A0,useMemo as O0}from"react";function R0(W){let Z=h(),$=O0(()=>{if(!W)throw Error("usePulseChannel requires a non-empty channelId");return Z.acquireChannel(W)},[Z,W]);return A0(()=>{return()=>{Z.releaseChannel(W)}},[Z,W]),$}export{h as usePulseClient,R0 as usePulseChannel,W1 as submitForm,_ as serialize,b1 as extractServerRouteInfo,i as deserialize,F0 as RenderLazy,V0 as PulseView,D0 as PulseProvider,I1 as PulseForm,b as PulseChannelResetError};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=7B651FB8E7CF7FED64756E2164756E21
|