@wsxjs/wsx-press 0.0.21 → 0.0.22

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/client.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@wsxjs/wsx-core"),oe=require("./index-C1_yVVPT.cjs");require("@wsxjs/wsx-marked-components");const te=require("@wsxjs/wsx-router"),re=require("./index.cjs"),ae=require("fuse.js"),ce=".wsx-doc-page{display:flex;flex-direction:column;min-height:100%}.doc-page{flex:1;padding:var(--doc-page-padding-y, 1rem) var(--doc-page-padding-x, 2rem);max-width:1200px;margin:0 auto;width:100%}.doc-loading,.doc-empty{text-align:center;padding:3rem;color:var(--wsx-press-text-secondary, #666)}.doc-error{padding:2rem;background:var(--wsx-press-error-bg, #fee);border:1px solid var(--wsx-press-error-border, #fcc);border-radius:4px;color:var(--wsx-press-error-text, #c33)}.doc-error h2{margin-top:0;color:var(--wsx-press-error-title, #a00)}.doc-header{margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid var(--wsx-press-border, #ddd)}.doc-title{margin:0 0 .5rem;font-size:2rem;font-weight:600;color:var(--wsx-press-text-primary, #333)}.doc-description{margin:0;color:var(--wsx-press-text-secondary, #666);font-size:1.1rem}.doc-content{line-height:1.6}";var ve;let xe,we;function G(t,e,r){return(e=je(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ue(t,e,r,o,g,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,j,v,m,p){function C(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var d,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";j?(v||m?s={get:le(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||le(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var h=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(d=x(H.call(K,h,k),"class decorators","return"))&&(h=d);else{var A,F;k.static=q,k.private=j,j?a===2?A=function(l){return C(l),s.value}:(a<4&&(A=f(s,"get",C)),a!==3&&(F=f(s,"set",C))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:j?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),h=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof h=="object"&&h)(d=x(h.get,"accessor.get"))&&(s.get=d),(d=x(h.set,"accessor.set"))&&(s.set=d),(d=x(h.init,"accessor.init"))&&E.push(d);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(h,(v?"field":"method")+" decorators","return")&&(v?E.push(h):s[b]=h)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(j?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),h}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Ne(b)===i},q=new Map;function j(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],C=m[2],d=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=C+"/"+D;if(!L&&!d){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+C);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,d?"#"+C:je(C),p,n,D?R=R||[]:a=a||[],$,D,d,L,p===1,D&&d?I:u)}}return j(a),j(R),$}(t,e,g,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function je(t){var e=Me(t,"string");return typeof e=="symbol"?e:e+""}function Me(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function le(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Ne(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const J=oe.createLogger("DocPage"),Y={data:null,promise:null};async function Ce(t,e={},r=1e4){var f;const o=new AbortController,g=setTimeout(()=>o.abort(),r);let _;if(e.signal){const w=new AbortController;e.signal.aborted?w.abort():e.signal.addEventListener("abort",()=>{w.abort()}),o.signal.addEventListener("abort",()=>{w.abort()}),_=w.signal}else _=o.signal;try{const w=await fetch(t,{...e,signal:_});return clearTimeout(g),w}catch(w){if(clearTimeout(g),w instanceof Error&&w.name==="AbortError"){const x=o.signal.aborted;throw((f=e.signal)==null?void 0:f.aborted)?new Error("Request was cancelled"):x?new Error(`Request timeout after ${r}ms`):new Error("Request was aborted")}throw w}}async function He(){return Y.data?Y.data:(Y.promise||(Y.promise=(async()=>{try{const t=await Ce("/.wsx-press/docs-meta.json",{},5e3);if(!t.ok)throw new Error(`Failed to load metadata: ${t.statusText}`);const e=await t.json();return Y.data=e,Y.promise=null,e}catch(t){throw Y.promise=null,t}})()),Y.promise)}we=[y.autoRegister({tagName:"wsx-doc-page"})];exports.DocPage=void 0;class Ke extends y.LightComponent{constructor(){super({styles:ce,styleName:"wsx-doc-page"}),G(this,"_autoStyles",ce),G(this,"loadingState",void 0),G(this,"markdown",void 0),G(this,"metadata",void 0),G(this,"error",void 0),G(this,"currentLoadingPath",null),G(this,"routeChangeUnsubscribe",null),G(this,"loadingAbortController",null),G(this,"isLoading",!1),G(this,"visibilityChangeHandler",null),J.debug("DocPage initialized");const[e,r]=this.useState("loadingState","idle");Object.defineProperty(this,"loadingState",{get:e,set:r,enumerable:!0,configurable:!0});const[o,g]=this.useState("markdown","");Object.defineProperty(this,"markdown",{get:o,set:g,enumerable:!0,configurable:!0});const[_,f]=this.useState("metadata",null);Object.defineProperty(this,"metadata",{get:_,set:f,enumerable:!0,configurable:!0});const[w,x]=this.useState("error",null);Object.defineProperty(this,"error",{get:w,set:x,enumerable:!0,configurable:!0})}onConnected(){this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.cancelLoading(),this.loadDocument()}),this.visibilityChangeHandler=()=>{document.hidden?this.cancelLoading():this.loadingState==="loading"&&this.currentLoadingPath&&(J.debug("Tab became visible, reloading document"),this.loadDocument())},document.addEventListener("visibilitychange",this.visibilityChangeHandler),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.loadDocument()})})}onDisconnected(){this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null),this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null),this.cancelLoading()}cancelLoading(){this.loadingAbortController&&(this.loadingAbortController.abort(),this.loadingAbortController=null),this.isLoading=!1,this.loadingState==="loading"&&(this.loadingState="idle"),this.currentLoadingPath=null}onAttributeChanged(e,r,o){e==="params"&&this.loadDocument()}async fetchWithTimeout(e,r={},o=1e4){return Ce(e,r,o)}async loadDocument(){this.cancelLoading();try{this.loadingAbortController=new AbortController;const e=te.RouterUtils.getCurrentRoute(),r=e.params;if(!r.category||!r.page){if(J.warn("Missing route parameters:",{params:r,routeInfo:e}),Object.keys(r).length===0){J.debug("Route params not yet initialized, keeping idle state"),this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError("Missing route parameters: category and page are required","INVALID_PARAMS");return}const o=`${r.category}/${r.page}`;this.currentLoadingPath=o,this.isLoading=!0,this.loadingState="loading",this.markdown="",this.error=null,this.metadata=null;const g=await He();if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched after metadata, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}const _=g[o];if(!_){if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){this.isLoading=!1,this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError(`Document not found: ${o}`,"NOT_FOUND"),this.isLoading=!1;return}this.metadata=_;const f=`/docs/${o}.md`,w=await this.fetchWithTimeout(f,{signal:this.loadingAbortController.signal},1e4);if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched during fetch, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}if(!w.ok){w.status===404?(this.loadingState="error",this.error=new re.DocumentLoadError(`Document file not found: ${f}`,"NOT_FOUND")):(this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${w.statusText}`,"NETWORK_ERROR",{status:w.status})),this.isLoading=!1;return}const x=await w.text();if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched after fetch, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}this.markdown=x,this.loadingState="success",this.isLoading=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.connected&&this.scheduleRerender()})})}catch(e){if(this.isLoading=!1,e instanceof Error&&e.name==="AbortError"){J.debug("Document loading was cancelled"),this.currentLoadingPath&&(this.loadingState="idle",this.currentLoadingPath=null);return}if(!this.currentLoadingPath){this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${e instanceof Error?e.message:String(e)}`,"NETWORK_ERROR",e),J.error("Failed to load document (no current path):",e);return}const r=this.currentLoadingPath;if(this.currentLoadingPath!==r){this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${e instanceof Error?e.message:String(e)}`,"NETWORK_ERROR",e),J.error("Failed to load document",e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.connected&&this.scheduleRerender()})})}}render(){var e,r;return this.loadingState==="loading"?y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-loading"},"加载文档中...")):this.loadingState==="error"?y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-error"},y.jsx("h2",null,"加载失败"),y.jsx("p",null,((e=this.error)==null?void 0:e.message)||"未知错误"),((r=this.error)==null?void 0:r.code)==="NOT_FOUND"&&y.jsx("p",null,"文档不存在,请检查路径是否正确。"))):this.loadingState==="success"&&this.markdown?y.jsx("div",{class:"doc-page"},this.metadata&&y.jsx("div",{class:"doc-header"},y.jsx("h1",{class:"doc-title"},this.metadata.title),this.metadata.description&&y.jsx("p",{class:"doc-description"},this.metadata.description)),y.jsx("div",{class:"doc-content"},y.jsx("wsx-markdown",{markdown:this.markdown}))):y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-empty"},"请选择文档"))}}ve=Ke;[exports.DocPage,xe]=Ue(ve,[],we,0,void 0,y.LightComponent).c;xe();const ue=".wsx-doc-search{position:relative;width:100%;max-width:600px}.search-input-wrapper{position:relative}.search-input{width:100%;padding:.75rem 1rem;font-size:1rem;border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;outline:none;transition:border-color .2s}.search-input:focus{border-color:var(--wsx-press-primary, #007bff);box-shadow:0 0 0 3px var(--wsx-press-primary-alpha, rgba(0, 123, 255, .1))}.search-loading{position:absolute;right:1rem;top:50%;transform:translateY(-50%);color:var(--wsx-press-text-secondary, #666);font-size:.875rem}.search-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;max-height:400px;overflow-y:auto;z-index:1000}.search-result{padding:1rem;border-bottom:1px solid var(--wsx-press-border-light, #f0f0f0);cursor:pointer;transition:background-color .2s}.search-result:last-child{border-bottom:none}.search-result:hover,.search-result.selected{background-color:var(--wsx-press-hover-bg, #f5f5f5)}.result-title{font-weight:600;color:var(--wsx-press-text-primary, #333);margin-bottom:.25rem}.result-title mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.result-category{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);margin-bottom:.5rem}.result-snippet{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);line-height:1.4}.result-snippet mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.search-no-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;padding:1rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;text-align:center;color:var(--wsx-press-text-secondary, #666);z-index:1000}";var Se;let De,Ee;function Q(t,e,r){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Be(t,e,r,o,g,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,j,v,m,p){function C(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var d,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";j?(v||m?s={get:de(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||de(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var h=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(d=x(H.call(K,h,k),"class decorators","return"))&&(h=d);else{var A,F;k.static=q,k.private=j,j?a===2?A=function(l){return C(l),s.value}:(a<4&&(A=f(s,"get",C)),a!==3&&(F=f(s,"set",C))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:j?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),h=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof h=="object"&&h)(d=x(h.get,"accessor.get"))&&(s.get=d),(d=x(h.set,"accessor.set"))&&(s.set=d),(d=x(h.init,"accessor.init"))&&E.push(d);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(h,(v?"field":"method")+" decorators","return")&&(v?E.push(h):s[b]=h)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(j?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),h}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Ye(b)===i},q=new Map;function j(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],C=m[2],d=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=C+"/"+D;if(!L&&!d){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+C);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,d?"#"+C:Oe(C),p,n,D?R=R||[]:a=a||[],$,D,d,L,p===1,D&&d?I:u)}}return j(a),j(R),$}(t,e,g,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Oe(t){var e=We(t,"string");return typeof e=="symbol"?e:e+""}function We(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function de(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Ye(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const ne=oe.createLogger("DocSearch"),Z={data:null,promise:null};async function he(){return Z.data?Z.data:(Z.promise||(Z.promise=(async()=>{try{const t=await fetch("/.wsx-press/search-index.json");if(!t.ok)throw new Error(`Failed to load search index: ${t.statusText}`);const e=await t.json();return Z.data=e,Z.promise=null,e}catch(t){throw Z.promise=null,t}})()),Z.promise)}Ee=[y.autoRegister({tagName:"wsx-doc-search"})];exports.DocSearch=void 0;class Ge extends y.LightComponent{constructor(){super({styles:ue,styleName:"wsx-doc-search"}),Q(this,"_autoStyles",ue),Q(this,"query",void 0),Q(this,"results",void 0),Q(this,"isOpen",void 0),Q(this,"isLoading",void 0),Q(this,"selectedIndex",void 0),Q(this,"fuse",null),Q(this,"searchTimeout",null),Q(this,"handleInput",T=>{const N=T.target;if(this.query=N.value,this.searchTimeout!==null&&clearTimeout(this.searchTimeout),!this.query.trim()){this.results=[],this.selectedIndex=-1,this.isOpen=!1;return}this.searchTimeout=window.setTimeout(()=>{this.performSearch()},300)}),Q(this,"handleKeyDown",T=>{if(!(!this.isOpen||this.results.length===0))switch(T.key){case"ArrowDown":T.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,this.results.length-1);break;case"ArrowUp":T.preventDefault(),this.selectedIndex=Math.max(this.selectedIndex-1,-1);break;case"Enter":T.preventDefault(),this.selectedIndex>=0&&this.selectedIndex<this.results.length?this.selectResult(this.results[this.selectedIndex]):this.results.length>0&&this.selectResult(this.results[0]);break;case"Escape":T.preventDefault(),this.isOpen=!1,this.query="",this.results=[],this.selectedIndex=-1;break}}),ne.info("DocSearch initialized");const[e,r]=this.useState("query","");Object.defineProperty(this,"query",{get:e,set:r,enumerable:!0,configurable:!0});let o=this.reactive([]);Object.defineProperty(this,"results",{get:()=>o,set:T=>{o=T!==null&&typeof T<"u"&&(Array.isArray(T)||typeof T=="object")?this.reactive(T):T,this.scheduleRerender()},enumerable:!0,configurable:!0});const[g,_]=this.useState("isOpen",!1);Object.defineProperty(this,"isOpen",{get:g,set:_,enumerable:!0,configurable:!0});const[f,w]=this.useState("isLoading",!1);Object.defineProperty(this,"isLoading",{get:f,set:w,enumerable:!0,configurable:!0});const[x,U]=this.useState("selectedIndex",-1);Object.defineProperty(this,"selectedIndex",{get:x,set:U,enumerable:!0,configurable:!0})}async onConnected(){try{const e=await he();this.fuse=new ae(e.documents,e.options)}catch(e){ne.error("Failed to load search index",e)}}async performSearch(){if(!this.fuse)try{this.isLoading=!0;const r=await he();this.fuse=new ae(r.documents,r.options)}catch(r){ne.error("Failed to load search index",r),this.isLoading=!1;return}if(this.isLoading=!1,!this.query.trim()){this.results=[],this.isOpen=!1;return}const e=this.fuse.search(this.query.trim());this.results=e,this.isOpen=this.query.trim().length>0,this.selectedIndex=-1}selectResult(e){const r=new CustomEvent("doc-search-select",{detail:{route:e.item.route},bubbles:!0});this.dispatchEvent(r),this.isOpen=!1,this.query="",this.results=[],this.selectedIndex=-1}highlightTextNodes(e,r){if(!r||r.length===0)return[e];const o=[];for(const w of r)w.indices&&o.push(...w.indices);o.sort((w,x)=>w[0]-x[0]);const g=[];for(const[w,x]of o)g.length===0||g[g.length-1][1]<w?g.push([w,x+1]):g[g.length-1][1]=Math.max(g[g.length-1][1],x+1);const _=[];let f=0;for(const[w,x]of g){w>f&&_.push(e.substring(f,w));const U=document.createElement("mark");U.textContent=e.substring(w,x),_.push(U),f=x}return f<e.length&&_.push(e.substring(f)),_}render(){return y.jsx("div",{class:"doc-search"},y.jsx("div",{class:"search-input-wrapper"},y.jsx("input",{type:"text",class:"search-input",placeholder:"搜索文档...",value:this.query,onInput:this.handleInput,onKeyDown:this.handleKeyDown,onFocus:()=>{this.results.length>0&&(this.isOpen=!0)},"data-wsx-key":"DocSearch-input-text-1-1"}),this.isLoading&&y.jsx("div",{class:"search-loading"},"加载中...")),this.isOpen&&this.results.length>0&&y.jsx("div",{class:"search-results"},this.results.map((e,r)=>{var f,w;const o=r===this.selectedIndex,g=(f=e.matches)==null?void 0:f.find(x=>x.key==="title"),_=(w=e.matches)==null?void 0:w.find(x=>x.key==="content");return y.jsx("div",{key:e.item.id,class:`search-result ${o?"selected":""}`,onClick:()=>this.selectResult(e),onMouseEnter:()=>{this.selectedIndex=r}},y.jsx("div",{class:"result-title"},g?this.highlightTextNodes(e.item.title,[g]):e.item.title),y.jsx("div",{class:"result-category"},e.item.category),_&&y.jsx("div",{class:"result-snippet"},this.highlightTextNodes(e.item.content.substring(0,100),[_])))})),this.isOpen&&this.query.trim()&&this.results.length===0&&!this.isLoading&&y.jsx("div",{class:"search-no-results"},"未找到匹配的文档"))}}Se=Ge;[exports.DocSearch,De]=Be(Se,[],Ee,0,void 0,y.LightComponent).c;De();const ge="wsx-doc-layout{display:flex;flex-direction:row;width:100%;min-height:calc(100vh - var(--nav-height, 70px))}.doc-layout{display:flex;flex-direction:row;width:100%;max-width:1600px;margin:0 auto;gap:0}.doc-layout-sidebar{flex-shrink:0}.doc-layout-main{flex:1;min-width:0;padding:var(--doc-layout-main-padding-y, 1.5rem) var(--doc-layout-main-padding-x, 2rem);max-width:100%}.doc-layout-toc{flex-shrink:0}@media (max-width: 1280px){.doc-layout-toc{display:none}}@media (max-width: 1024px){.doc-layout-sidebar{display:none}.doc-layout-main{padding:var(--doc-layout-main-padding-y, 1.5rem)}}";var _e;let Ie,Le;function se(t,e,r){return(e=Te(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Je(t,e,r,o,g,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,j,v,m,p){function C(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var d,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";j?(v||m?s={get:fe(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||fe(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var h=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(d=x(H.call(K,h,k),"class decorators","return"))&&(h=d);else{var A,F;k.static=q,k.private=j,j?a===2?A=function(l){return C(l),s.value}:(a<4&&(A=f(s,"get",C)),a!==3&&(F=f(s,"set",C))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:j?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),h=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof h=="object"&&h)(d=x(h.get,"accessor.get"))&&(s.get=d),(d=x(h.set,"accessor.set"))&&(s.set=d),(d=x(h.init,"accessor.init"))&&E.push(d);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(h,(v?"field":"method")+" decorators","return")&&(v?E.push(h):s[b]=h)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(j?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),h}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Xe(b)===i},q=new Map;function j(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],C=m[2],d=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=C+"/"+D;if(!L&&!d){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+C);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,d?"#"+C:Te(C),p,n,D?R=R||[]:a=a||[],$,D,d,L,p===1,D&&d?I:u)}}return j(a),j(R),$}(t,e,g,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Te(t){var e=Qe(t,"string");return typeof e=="symbol"?e:e+""}function Qe(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function fe(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Xe(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}Le=[y.autoRegister({tagName:"wsx-doc-layout"})];exports.DocLayout=void 0;class Ze extends y.LightComponent{constructor(){super({styles:ge,styleName:"wsx-doc-layout"}),se(this,"_autoStyles",ge),se(this,"sidebarInstance",null),se(this,"docPageInstance",null),se(this,"tocInstance",null)}onConnected(){requestAnimationFrame(()=>{if(this.connected){const e=this.querySelector(".doc-layout-sidebar");e&&!this.sidebarInstance&&(this.sidebarInstance=document.createElement("wsx-doc-sidebar"),e.appendChild(this.sidebarInstance));const r=this.querySelector(".doc-layout-main");r&&!this.docPageInstance&&(this.docPageInstance=document.createElement("wsx-doc-page"),r.appendChild(this.docPageInstance));const o=this.querySelector(".doc-layout-toc");o&&!this.tocInstance&&(this.tocInstance=document.createElement("wsx-doc-toc"),o.appendChild(this.tocInstance))}})}onDisconnected(){this.sidebarInstance&&(this.sidebarInstance.remove(),this.sidebarInstance=null),this.docPageInstance&&(this.docPageInstance.remove(),this.docPageInstance=null),this.tocInstance&&(this.tocInstance.remove(),this.tocInstance=null)}render(){return y.jsx("div",{class:"doc-layout"},y.jsx("aside",{class:"doc-layout-sidebar"}),y.jsx("main",{class:"doc-layout-main"}),y.jsx("aside",{class:"doc-layout-toc"}))}}_e=Ze;[exports.DocLayout,Ie]=Je(_e,[],Le,0,void 0,y.LightComponent).c;Ie();const me="wsx-doc-sidebar{display:flex;flex-direction:column;width:280px;min-width:280px;height:100%;background:var(--wsx-press-sidebar-bg, #f9fafb);border-right:1px solid var(--wsx-press-border, #e5e7eb);overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.doc-sidebar{display:flex;flex-direction:column;width:100%;height:100%}.doc-sidebar-loading,.doc-sidebar-empty{padding:2rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280)}.doc-sidebar-nav{padding:1.5rem 0}.doc-sidebar-category{margin-bottom:2rem}.doc-sidebar-category:last-child{margin-bottom:0}.doc-sidebar-category-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);padding:.5rem 1.5rem;margin:0 0 .5rem}.doc-sidebar-list{list-style:none;margin:0;padding:0}.doc-sidebar-item{margin:0}.doc-sidebar-link{display:block;padding:.5rem 1.5rem;color:var(--wsx-press-text-primary, #111827);text-decoration:none;font-size:.875rem;line-height:1.5;transition:all .2s ease;border-left:3px solid transparent}.doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #f3f4f6);color:var(--wsx-press-text-primary, #111827)}.doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, #eff6ff);color:var(--wsx-press-sidebar-active-color, #2563eb);border-left-color:var(--wsx-press-sidebar-active-color, #2563eb);font-weight:500}@media (max-width: 1024px){wsx-doc-sidebar{width:240px;min-width:240px}}@media (max-width: 768px){wsx-doc-sidebar{display:none}}";var Re;let $e,ke;function ie(t,e,r){return(e=Ae(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ve(t,e,r,o,g,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,j,v,m,p){function C(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var d,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";j?(v||m?s={get:pe(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||pe(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var h=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(d=x(H.call(K,h,k),"class decorators","return"))&&(h=d);else{var A,F;k.static=q,k.private=j,j?a===2?A=function(l){return C(l),s.value}:(a<4&&(A=f(s,"get",C)),a!==3&&(F=f(s,"set",C))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:j?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),h=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof h=="object"&&h)(d=x(h.get,"accessor.get"))&&(s.get=d),(d=x(h.set,"accessor.set"))&&(s.set=d),(d=x(h.init,"accessor.init"))&&E.push(d);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(h,(v?"field":"method")+" decorators","return")&&(v?E.push(h):s[b]=h)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(j?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),h}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return tt(b)===i},q=new Map;function j(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],C=m[2],d=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=C+"/"+D;if(!L&&!d){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+C);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,d?"#"+C:Ae(C),p,n,D?R=R||[]:a=a||[],$,D,d,L,p===1,D&&d?I:u)}}return j(a),j(R),$}(t,e,g,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Ae(t){var e=et(t,"string");return typeof e=="symbol"?e:e+""}function et(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function pe(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function tt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const rt=oe.createLogger("DocSidebar");ke=[y.autoRegister({tagName:"wsx-doc-sidebar"})];exports.DocSidebar=void 0;class it extends y.LightComponent{constructor(){super({styles:me,styleName:"wsx-doc-sidebar"}),ie(this,"_autoStyles",me),ie(this,"metadata",void 0),ie(this,"currentRoute",void 0),ie(this,"isLoading",void 0),ie(this,"routeChangeUnsubscribe",null),ie(this,"handleDocClick",(f,w)=>{w.preventDefault(),te.RouterUtils.navigate(f)});let e=this.reactive({});Object.defineProperty(this,"metadata",{get:()=>e,set:f=>{e=f!==null&&typeof f<"u"&&(Array.isArray(f)||typeof f=="object")?this.reactive(f):f,this.scheduleRerender()},enumerable:!0,configurable:!0});const[r,o]=this.useState("currentRoute","");Object.defineProperty(this,"currentRoute",{get:r,set:o,enumerable:!0,configurable:!0});const[g,_]=this.useState("isLoading",!0);Object.defineProperty(this,"isLoading",{get:g,set:_,enumerable:!0,configurable:!0})}async onConnected(){await this.loadMetadata(),this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.updateCurrentRoute()}),this.updateCurrentRoute()}onDisconnected(){this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null)}async loadMetadata(){try{if(this.isLoading=!0,Y.data)this.metadata=Y.data;else{const e=await fetch("/.wsx-press/docs-meta.json");e.ok&&(this.metadata=await e.json())}}catch(e){rt.error("Failed to load metadata",e)}finally{this.isLoading=!1}}updateCurrentRoute(){const e=te.RouterUtils.getCurrentRoute();this.currentRoute=e.path}organizeByCategory(){const e={};return Object.values(this.metadata).forEach(o=>{const g=o.category||"other";e[g]||(e[g]=[]),e[g].push(o)}),Object.keys(e).sort().forEach(o=>{e[o].sort((g,_)=>g.title.localeCompare(_.title))}),e}isCurrentDoc(e){return this.currentRoute===e}render(){if(this.isLoading)return y.jsx("aside",{class:"doc-sidebar"},y.jsx("div",{class:"doc-sidebar-loading"},"加载中..."));const e=this.organizeByCategory(),r=Object.keys(e);return r.length===0?y.jsx("aside",{class:"doc-sidebar"},y.jsx("div",{class:"doc-sidebar-empty"},"暂无文档")):y.jsx("aside",{class:"doc-sidebar"},y.jsx("nav",{class:"doc-sidebar-nav"},r.map(o=>y.jsx("div",{key:o,class:"doc-sidebar-category"},y.jsx("h3",{class:"doc-sidebar-category-title"},o),y.jsx("ul",{class:"doc-sidebar-list"},e[o].map(g=>y.jsx("li",{key:g.route,class:"doc-sidebar-item"},y.jsx("a",{href:g.route,class:`doc-sidebar-link ${this.isCurrentDoc(g.route)?"active":""}`,onClick:_=>this.handleDocClick(g.route,_)},g.title))))))))}}Re=it;[exports.DocSidebar,$e]=Ve(Re,[],ke,0,void 0,y.LightComponent).c;$e();const be="wsx-doc-toc{display:flex;flex-direction:column;width:240px;min-width:240px;height:100%;overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.doc-toc{display:flex;flex-direction:column;width:100%;padding:1.5rem 1rem}.doc-toc-empty{padding:1rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280);font-size:.875rem}.doc-toc-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);margin:0 0 1rem;padding:0}.doc-toc-nav{width:100%}.doc-toc-list{list-style:none;margin:0;padding:0}.doc-toc-sublist{margin-top:.25rem;padding-left:1rem}.doc-toc-item{margin:0;line-height:1.6}.doc-toc-item-level-1{margin-bottom:.5rem}.doc-toc-item-level-2{margin-bottom:.375rem;font-size:.875rem}.doc-toc-item-level-3{margin-bottom:.25rem;font-size:.8125rem}.doc-toc-item-level-4,.doc-toc-item-level-5,.doc-toc-item-level-6{margin-bottom:.25rem;font-size:.75rem}.doc-toc-link{display:block;color:var(--wsx-press-text-secondary, #6b7280);text-decoration:none;transition:color .2s ease;border-left:2px solid transparent;padding:.25rem 0 .25rem .5rem;margin-left:-.5rem}.doc-toc-link:hover{color:var(--wsx-press-text-primary, #111827)}.doc-toc-link.active{color:var(--wsx-press-toc-active-color, #2563eb);border-left-color:var(--wsx-press-toc-active-color, #2563eb);font-weight:500}@media (max-width: 1280px){wsx-doc-toc{display:none}}";var Pe;let qe,ze;function ee(t,e,r){return(e=Fe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function st(t,e,r,o,g,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,j,v,m,p){function C(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var d,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";j?(v||m?s={get:ye(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||ye(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var h=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(d=x(H.call(K,h,k),"class decorators","return"))&&(h=d);else{var A,F;k.static=q,k.private=j,j?a===2?A=function(l){return C(l),s.value}:(a<4&&(A=f(s,"get",C)),a!==3&&(F=f(s,"set",C))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:j?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),h=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof h=="object"&&h)(d=x(h.get,"accessor.get"))&&(s.get=d),(d=x(h.set,"accessor.set"))&&(s.set=d),(d=x(h.init,"accessor.init"))&&E.push(d);else if(h!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(h,(v?"field":"method")+" decorators","return")&&(v?E.push(h):s[b]=h)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(j?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),h}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return nt(b)===i},q=new Map;function j(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],C=m[2],d=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=C+"/"+D;if(!L&&!d){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+C);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,d?"#"+C:Fe(C),p,n,D?R=R||[]:a=a||[],$,D,d,L,p===1,D&&d?I:u)}}return j(a),j(R),$}(t,e,g,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Fe(t){var e=ot(t,"string");return typeof e=="symbol"?e:e+""}function ot(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function ye(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function nt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const at=oe.createLogger("DocTOC"),V={data:null,promise:null};async function ct(){return V.data?V.data:(V.promise||(V.promise=(async()=>{try{const t=await fetch("/.wsx-press/docs-toc.json");if(!t.ok)throw new Error(`Failed to load TOC data: ${t.statusText}`);const e=await t.json();return V.data=e,V.promise=null,e}catch(t){throw V.promise=null,t}})()),V.promise)}ze=[y.autoRegister({tagName:"wsx-doc-toc"})];exports.DocTOC=void 0;class lt extends y.LightComponent{constructor(){super({styles:be,styleName:"wsx-doc-toc"}),ee(this,"_autoStyles",be),ee(this,"items",void 0),ee(this,"activeId",void 0),ee(this,"observer",null),ee(this,"headingElements",new Map),ee(this,"routeChangeUnsubscribe",null),ee(this,"handleTOCClick",(g,_)=>{_.preventDefault();const f=this.headingElements.get(g);f&&(f.scrollIntoView({behavior:"smooth",block:"start"}),window.history.replaceState(null,"",`#${g}`))});let e=this.reactive([]);Object.defineProperty(this,"items",{get:()=>e,set:g=>{e=g!==null&&typeof g<"u"&&(Array.isArray(g)||typeof g=="object")?this.reactive(g):g,this.scheduleRerender()},enumerable:!0,configurable:!0});const[r,o]=this.useState("activeId","");Object.defineProperty(this,"activeId",{get:r,set:o,enumerable:!0,configurable:!0})}async onConnected(){await this.loadTOC(),this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.loadTOC()})}onDisconnected(){this.observer&&(this.observer.disconnect(),this.observer=null),this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null)}async loadTOC(){try{const r=te.RouterUtils.getCurrentRoute().params;if(!r.category||!r.page){this.items=[];return}const o=`${r.category}/${r.page}`,g=await ct();this.items=g[o]||[],requestAnimationFrame(()=>{this.setupHeadingIds(),this.setupScrollObserver()})}catch(e){at.error("Failed to load TOC",e),this.items=[]}}setupHeadingIds(){const e=document.querySelector(".doc-content");if(!e)return;const r=e.querySelectorAll("h1, h2, h3, h4, h5, h6, wsx-marked-heading");this.headingElements.clear(),r.forEach(o=>{var f;const g=((f=o.textContent)==null?void 0:f.trim())||"";if(!g)return;const _=this.generateId(g);o instanceof HTMLElement&&(o.id=_,this.headingElements.set(_,o))})}generateId(e){return e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}setupScrollObserver(){"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(e=>{const r=e.filter(o=>o.isIntersecting);r.length>0&&(r.sort((o,g)=>{const _=o.boundingClientRect.top,f=g.boundingClientRect.top;return Math.abs(_)-Math.abs(f)}),this.activeId=r[0].target.id)},{rootMargin:"-100px 0px -80% 0px",threshold:0}),this.headingElements.forEach(e=>{var r;(r=this.observer)==null||r.observe(e)}))}renderTOCItem(e){const r=this.activeId===e.id,o=e.children.length>0;return y.jsx("li",{class:`doc-toc-item doc-toc-item-level-${e.level}`},y.jsx("a",{href:`#${e.id}`,class:`doc-toc-link ${r?"active":""}`,onClick:g=>this.handleTOCClick(e.id,g)},e.text),o&&y.jsx("ul",{class:"doc-toc-list doc-toc-sublist"},e.children.map(g=>this.renderTOCItem(g))))}render(){return this.items.length===0?y.jsx("aside",{class:"doc-toc"},y.jsx("div",{class:"doc-toc-empty"},"暂无目录")):y.jsx("aside",{class:"doc-toc"},y.jsx("h3",{class:"doc-toc-title"},"目录"),y.jsx("nav",{class:"doc-toc-nav"},y.jsx("ul",{class:"doc-toc-list"},this.items.map(e=>this.renderTOCItem(e)))))}}Pe=lt;[exports.DocTOC,qe]=st(Pe,[],ze,0,void 0,y.LightComponent).c;qe();
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@wsxjs/wsx-core"),oe=require("./index-C1_yVVPT.cjs");require("@wsxjs/wsx-marked-components");const te=require("@wsxjs/wsx-router"),re=require("./index.cjs"),ae=require("fuse.js"),ce=".wsx-doc-page{display:flex;flex-direction:column;min-height:100%}.doc-page{flex:1;padding:var(--doc-page-padding-y, 1rem) var(--doc-page-padding-x, 2rem);max-width:1200px;margin:0 auto;width:100%}.doc-loading,.doc-empty{text-align:center;padding:3rem;color:var(--wsx-press-text-secondary, #666)}.doc-error{padding:2rem;background:var(--wsx-press-error-bg, #fee);border:1px solid var(--wsx-press-error-border, #fcc);border-radius:4px;color:var(--wsx-press-error-text, #c33)}.doc-error h2{margin-top:0;color:var(--wsx-press-error-title, #a00)}.doc-header{margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid var(--wsx-press-border, #ddd)}.doc-title{margin:0 0 .5rem;font-size:2rem;font-weight:600;color:var(--wsx-press-text-primary, #333)}.doc-description{margin:0;color:var(--wsx-press-text-secondary, #666);font-size:1.1rem}.doc-content{line-height:1.6}";var ve;let xe,we;function G(t,e,r){return(e=Ce(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ue(t,e,r,o,d,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,C,v,m,p){function j(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";C?(v||m?s={get:le(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||le(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var g=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(h=x(H.call(K,g,k),"class decorators","return"))&&(g=h);else{var A,F;k.static=q,k.private=C,C?a===2?A=function(l){return j(l),s.value}:(a<4&&(A=f(s,"get",j)),a!==3&&(F=f(s,"set",j))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:C?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),g=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof g=="object"&&g)(h=x(g.get,"accessor.get"))&&(s.get=h),(h=x(g.set,"accessor.set"))&&(s.set=h),(h=x(g.init,"accessor.init"))&&E.push(h);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(g,(v?"field":"method")+" decorators","return")&&(v?E.push(g):s[b]=g)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(C?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),g}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Ne(b)===i},q=new Map;function C(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],j=m[2],h=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=j+"/"+D;if(!L&&!h){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+j);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,h?"#"+j:Ce(j),p,n,D?R=R||[]:a=a||[],$,D,h,L,p===1,D&&h?I:u)}}return C(a),C(R),$}(t,e,d,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Ce(t){var e=Me(t,"string");return typeof e=="symbol"?e:e+""}function Me(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function le(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Ne(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const J=oe.createLogger("DocPage"),Y={data:null,promise:null};async function je(t,e={},r=1e4){var f;const o=new AbortController,d=setTimeout(()=>o.abort(),r);let _;if(e.signal){const w=new AbortController;e.signal.aborted?w.abort():e.signal.addEventListener("abort",()=>{w.abort()}),o.signal.addEventListener("abort",()=>{w.abort()}),_=w.signal}else _=o.signal;try{const w=await fetch(t,{...e,signal:_});return clearTimeout(d),w}catch(w){if(clearTimeout(d),w instanceof Error&&w.name==="AbortError"){const x=o.signal.aborted;throw((f=e.signal)==null?void 0:f.aborted)?new Error("Request was cancelled"):x?new Error(`Request timeout after ${r}ms`):new Error("Request was aborted")}throw w}}async function He(){return Y.data?Y.data:(Y.promise||(Y.promise=(async()=>{try{const t=await je("/.wsx-press/docs-meta.json",{},5e3);if(!t.ok)throw new Error(`Failed to load metadata: ${t.statusText}`);const e=await t.json();return Y.data=e,Y.promise=null,e}catch(t){throw Y.promise=null,t}})()),Y.promise)}we=[y.autoRegister({tagName:"wsx-doc-page"})];exports.DocPage=void 0;class Ke extends y.LightComponent{constructor(){super({styles:ce,styleName:"wsx-doc-page"}),G(this,"_autoStyles",ce),G(this,"loadingState",void 0),G(this,"markdown",void 0),G(this,"metadata",void 0),G(this,"error",void 0),G(this,"currentLoadingPath",null),G(this,"routeChangeUnsubscribe",null),G(this,"loadingAbortController",null),G(this,"isLoading",!1),G(this,"visibilityChangeHandler",null),J.debug("DocPage initialized");const[e,r]=this.useState("loadingState","idle");Object.defineProperty(this,"loadingState",{get:e,set:r,enumerable:!0,configurable:!0});const[o,d]=this.useState("markdown","");Object.defineProperty(this,"markdown",{get:o,set:d,enumerable:!0,configurable:!0});const[_,f]=this.useState("metadata",null);Object.defineProperty(this,"metadata",{get:_,set:f,enumerable:!0,configurable:!0});const[w,x]=this.useState("error",null);Object.defineProperty(this,"error",{get:w,set:x,enumerable:!0,configurable:!0})}onConnected(){var e;(e=super.onConnected)==null||e.call(this),this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.cancelLoading(),this.loadDocument()}),this.visibilityChangeHandler=()=>{document.hidden?this.cancelLoading():this.loadingState==="loading"&&this.currentLoadingPath&&(J.debug("Tab became visible, reloading document"),this.loadDocument())},document.addEventListener("visibilitychange",this.visibilityChangeHandler),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.loadDocument()})})}onDisconnected(){var e;(e=super.onDisconnected)==null||e.call(this),this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null),this.visibilityChangeHandler&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null),this.cancelLoading()}cancelLoading(){this.loadingAbortController&&(this.loadingAbortController.abort(),this.loadingAbortController=null),this.isLoading=!1,this.loadingState==="loading"&&(this.loadingState="idle"),this.currentLoadingPath=null}onAttributeChanged(e,r,o){e==="params"&&this.loadDocument()}async fetchWithTimeout(e,r={},o=1e4){return je(e,r,o)}async loadDocument(){this.cancelLoading();try{this.loadingAbortController=new AbortController;const e=te.RouterUtils.getCurrentRoute(),r=e.params;if(!r.category||!r.page){if(J.warn("Missing route parameters:",{params:r,routeInfo:e}),Object.keys(r).length===0){J.debug("Route params not yet initialized, keeping idle state"),this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError("Missing route parameters: category and page are required","INVALID_PARAMS");return}const o=`${r.category}/${r.page}`;this.currentLoadingPath=o,this.isLoading=!0,this.loadingState="loading",this.markdown="",this.error=null,this.metadata=null;const d=await He();if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched after metadata, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}const _=d[o];if(!_){if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){this.isLoading=!1,this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError(`Document not found: ${o}`,"NOT_FOUND"),this.isLoading=!1;return}this.metadata=_;const f=`/docs/${o}.md`,w=await this.fetchWithTimeout(f,{signal:this.loadingAbortController.signal},1e4);if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched during fetch, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}if(!w.ok){w.status===404?(this.loadingState="error",this.error=new re.DocumentLoadError(`Document file not found: ${f}`,"NOT_FOUND")):(this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${w.statusText}`,"NETWORK_ERROR",{status:w.status})),this.isLoading=!1;return}const x=await w.text();if(this.currentLoadingPath!==o||this.loadingAbortController.signal.aborted){J.debug(`Document switched after fetch, ignoring result for ${o}`),this.isLoading=!1,this.loadingState="idle";return}this.markdown=x,this.loadingState="success",this.isLoading=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.connected&&this.scheduleRerender()})})}catch(e){if(this.isLoading=!1,e instanceof Error&&e.name==="AbortError"){J.debug("Document loading was cancelled"),this.currentLoadingPath&&(this.loadingState="idle",this.currentLoadingPath=null);return}if(!this.currentLoadingPath){this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${e instanceof Error?e.message:String(e)}`,"NETWORK_ERROR",e),J.error("Failed to load document (no current path):",e);return}const r=this.currentLoadingPath;if(this.currentLoadingPath!==r){this.loadingState="idle";return}this.loadingState="error",this.error=new re.DocumentLoadError(`Failed to load document: ${e instanceof Error?e.message:String(e)}`,"NETWORK_ERROR",e),J.error("Failed to load document",e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.connected&&this.scheduleRerender()})})}}render(){var e,r;return this.loadingState==="loading"?y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-loading"},"加载文档中...")):this.loadingState==="error"?y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-error"},y.jsx("h2",null,"加载失败"),y.jsx("p",null,((e=this.error)==null?void 0:e.message)||"未知错误"),((r=this.error)==null?void 0:r.code)==="NOT_FOUND"&&y.jsx("p",null,"文档不存在,请检查路径是否正确。"))):this.loadingState==="success"&&this.markdown?y.jsx("div",{class:"doc-page"},this.metadata&&y.jsx("div",{class:"doc-header"},y.jsx("h1",{class:"doc-title"},this.metadata.title),this.metadata.description&&y.jsx("p",{class:"doc-description"},this.metadata.description)),y.jsx("div",{class:"doc-content"},y.jsx("wsx-markdown",{markdown:this.markdown}))):y.jsx("div",{class:"doc-page"},y.jsx("div",{class:"doc-empty"},"请选择文档"))}}ve=Ke;[exports.DocPage,xe]=Ue(ve,[],we,0,void 0,y.LightComponent).c;xe();const ue=".wsx-doc-search{position:relative;width:100%;max-width:600px}.search-input-wrapper{position:relative}.search-input{width:100%;padding:.75rem 1rem;font-size:1rem;border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;outline:none;transition:border-color .2s}.search-input:focus{border-color:var(--wsx-press-primary, #007bff);box-shadow:0 0 0 3px var(--wsx-press-primary-alpha, rgba(0, 123, 255, .1))}.search-loading{position:absolute;right:1rem;top:50%;transform:translateY(-50%);color:var(--wsx-press-text-secondary, #666);font-size:.875rem}.search-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;max-height:400px;overflow-y:auto;z-index:1000}.search-result{padding:1rem;border-bottom:1px solid var(--wsx-press-border-light, #f0f0f0);cursor:pointer;transition:background-color .2s}.search-result:last-child{border-bottom:none}.search-result:hover,.search-result.selected{background-color:var(--wsx-press-hover-bg, #f5f5f5)}.result-title{font-weight:600;color:var(--wsx-press-text-primary, #333);margin-bottom:.25rem}.result-title mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.result-category{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);margin-bottom:.5rem}.result-snippet{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);line-height:1.4}.result-snippet mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.search-no-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;padding:1rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;text-align:center;color:var(--wsx-press-text-secondary, #666);z-index:1000}";var Se;let De,Ee;function Q(t,e,r){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Be(t,e,r,o,d,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,C,v,m,p){function j(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";C?(v||m?s={get:de(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||de(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var g=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(h=x(H.call(K,g,k),"class decorators","return"))&&(g=h);else{var A,F;k.static=q,k.private=C,C?a===2?A=function(l){return j(l),s.value}:(a<4&&(A=f(s,"get",j)),a!==3&&(F=f(s,"set",j))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:C?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),g=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof g=="object"&&g)(h=x(g.get,"accessor.get"))&&(s.get=h),(h=x(g.set,"accessor.set"))&&(s.set=h),(h=x(g.init,"accessor.init"))&&E.push(h);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(g,(v?"field":"method")+" decorators","return")&&(v?E.push(g):s[b]=g)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(C?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),g}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Ye(b)===i},q=new Map;function C(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],j=m[2],h=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=j+"/"+D;if(!L&&!h){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+j);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,h?"#"+j:Oe(j),p,n,D?R=R||[]:a=a||[],$,D,h,L,p===1,D&&h?I:u)}}return C(a),C(R),$}(t,e,d,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Oe(t){var e=We(t,"string");return typeof e=="symbol"?e:e+""}function We(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function de(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Ye(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const ne=oe.createLogger("DocSearch"),Z={data:null,promise:null};async function he(){return Z.data?Z.data:(Z.promise||(Z.promise=(async()=>{try{const t=await fetch("/.wsx-press/search-index.json");if(!t.ok)throw new Error(`Failed to load search index: ${t.statusText}`);const e=await t.json();return Z.data=e,Z.promise=null,e}catch(t){throw Z.promise=null,t}})()),Z.promise)}Ee=[y.autoRegister({tagName:"wsx-doc-search"})];exports.DocSearch=void 0;class Ge extends y.LightComponent{constructor(){super({styles:ue,styleName:"wsx-doc-search"}),Q(this,"_autoStyles",ue),Q(this,"query",void 0),Q(this,"results",void 0),Q(this,"isOpen",void 0),Q(this,"isLoading",void 0),Q(this,"selectedIndex",void 0),Q(this,"fuse",null),Q(this,"searchTimeout",null),Q(this,"handleInput",T=>{const N=T.target;if(this.query=N.value,this.searchTimeout!==null&&clearTimeout(this.searchTimeout),!this.query.trim()){this.results=[],this.selectedIndex=-1,this.isOpen=!1;return}this.searchTimeout=window.setTimeout(()=>{this.performSearch()},300)}),Q(this,"handleKeyDown",T=>{if(!(!this.isOpen||this.results.length===0))switch(T.key){case"ArrowDown":T.preventDefault(),this.selectedIndex=Math.min(this.selectedIndex+1,this.results.length-1);break;case"ArrowUp":T.preventDefault(),this.selectedIndex=Math.max(this.selectedIndex-1,-1);break;case"Enter":T.preventDefault(),this.selectedIndex>=0&&this.selectedIndex<this.results.length?this.selectResult(this.results[this.selectedIndex]):this.results.length>0&&this.selectResult(this.results[0]);break;case"Escape":T.preventDefault(),this.isOpen=!1,this.query="",this.results=[],this.selectedIndex=-1;break}}),ne.info("DocSearch initialized");const[e,r]=this.useState("query","");Object.defineProperty(this,"query",{get:e,set:r,enumerable:!0,configurable:!0});let o=this.reactive([]);Object.defineProperty(this,"results",{get:()=>o,set:T=>{o=T!==null&&typeof T<"u"&&(Array.isArray(T)||typeof T=="object")?this.reactive(T):T,this.scheduleRerender()},enumerable:!0,configurable:!0});const[d,_]=this.useState("isOpen",!1);Object.defineProperty(this,"isOpen",{get:d,set:_,enumerable:!0,configurable:!0});const[f,w]=this.useState("isLoading",!1);Object.defineProperty(this,"isLoading",{get:f,set:w,enumerable:!0,configurable:!0});const[x,U]=this.useState("selectedIndex",-1);Object.defineProperty(this,"selectedIndex",{get:x,set:U,enumerable:!0,configurable:!0})}async onConnected(){var e;(e=super.onConnected)==null||e.call(this);try{const r=await he();this.fuse=new ae(r.documents,r.options)}catch(r){ne.error("Failed to load search index",r)}}async performSearch(){if(!this.fuse)try{this.isLoading=!0;const r=await he();this.fuse=new ae(r.documents,r.options)}catch(r){ne.error("Failed to load search index",r),this.isLoading=!1;return}if(this.isLoading=!1,!this.query.trim()){this.results=[],this.isOpen=!1;return}const e=this.fuse.search(this.query.trim());this.results=e,this.isOpen=this.query.trim().length>0,this.selectedIndex=-1}selectResult(e){const r=new CustomEvent("doc-search-select",{detail:{route:e.item.route},bubbles:!0});this.dispatchEvent(r),this.isOpen=!1,this.query="",this.results=[],this.selectedIndex=-1}highlightTextNodes(e,r){if(!r||r.length===0)return[e];const o=[];for(const w of r)w.indices&&o.push(...w.indices);o.sort((w,x)=>w[0]-x[0]);const d=[];for(const[w,x]of o)d.length===0||d[d.length-1][1]<w?d.push([w,x+1]):d[d.length-1][1]=Math.max(d[d.length-1][1],x+1);const _=[];let f=0;for(const[w,x]of d){w>f&&_.push(e.substring(f,w));const U=document.createElement("mark");U.textContent=e.substring(w,x),_.push(U),f=x}return f<e.length&&_.push(e.substring(f)),_}render(){return y.jsx("div",{class:"doc-search"},y.jsx("div",{class:"search-input-wrapper"},y.jsx("input",{type:"text",class:"search-input",placeholder:"搜索文档...",value:this.query,onInput:this.handleInput,onKeyDown:this.handleKeyDown,onFocus:()=>{this.results.length>0&&(this.isOpen=!0)},"data-wsx-key":"DocSearch-input-text-1-1"}),this.isLoading&&y.jsx("div",{class:"search-loading"},"加载中...")),this.isOpen&&this.results.length>0&&y.jsx("div",{class:"search-results"},this.results.map((e,r)=>{var f,w;const o=r===this.selectedIndex,d=(f=e.matches)==null?void 0:f.find(x=>x.key==="title"),_=(w=e.matches)==null?void 0:w.find(x=>x.key==="content");return y.jsx("div",{key:e.item.id,class:`search-result ${o?"selected":""}`,onClick:()=>this.selectResult(e),onMouseEnter:()=>{this.selectedIndex=r}},y.jsx("div",{class:"result-title"},d?this.highlightTextNodes(e.item.title,[d]):e.item.title),y.jsx("div",{class:"result-category"},e.item.category),_&&y.jsx("div",{class:"result-snippet"},this.highlightTextNodes(e.item.content.substring(0,100),[_])))})),this.isOpen&&this.query.trim()&&this.results.length===0&&!this.isLoading&&y.jsx("div",{class:"search-no-results"},"未找到匹配的文档"))}}Se=Ge;[exports.DocSearch,De]=Be(Se,[],Ee,0,void 0,y.LightComponent).c;De();const ge="wsx-doc-layout{display:flex;flex-direction:row;width:100%;min-height:calc(100vh - var(--nav-height, 70px))}.doc-layout{display:flex;flex-direction:row;width:100%;max-width:1600px;margin:0 auto;gap:0}.doc-layout-sidebar{flex-shrink:0}.doc-layout-main{flex:1;min-width:0;padding:var(--doc-layout-main-padding-y, 1.5rem) var(--doc-layout-main-padding-x, 2rem);max-width:100%}.doc-layout-toc{flex-shrink:0}@media (max-width: 1280px){.doc-layout-toc{display:none}}@media (max-width: 1024px){.doc-layout-sidebar{display:none}.doc-layout-main{padding:var(--doc-layout-main-padding-y, 1.5rem)}}";var _e;let Ie,Le;function se(t,e,r){return(e=Te(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Je(t,e,r,o,d,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,C,v,m,p){function j(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";C?(v||m?s={get:fe(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||fe(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var g=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(h=x(H.call(K,g,k),"class decorators","return"))&&(g=h);else{var A,F;k.static=q,k.private=C,C?a===2?A=function(l){return j(l),s.value}:(a<4&&(A=f(s,"get",j)),a!==3&&(F=f(s,"set",j))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:C?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),g=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof g=="object"&&g)(h=x(g.get,"accessor.get"))&&(s.get=h),(h=x(g.set,"accessor.set"))&&(s.set=h),(h=x(g.init,"accessor.init"))&&E.push(h);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(g,(v?"field":"method")+" decorators","return")&&(v?E.push(g):s[b]=g)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(C?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),g}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return Xe(b)===i},q=new Map;function C(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],j=m[2],h=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=j+"/"+D;if(!L&&!h){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+j);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,h?"#"+j:Te(j),p,n,D?R=R||[]:a=a||[],$,D,h,L,p===1,D&&h?I:u)}}return C(a),C(R),$}(t,e,d,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Te(t){var e=Qe(t,"string");return typeof e=="symbol"?e:e+""}function Qe(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function fe(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function Xe(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}Le=[y.autoRegister({tagName:"wsx-doc-layout"})];exports.DocLayout=void 0;class Ze extends y.LightComponent{constructor(){super({styles:ge,styleName:"wsx-doc-layout"}),se(this,"_autoStyles",ge),se(this,"sidebarInstance",null),se(this,"docPageInstance",null),se(this,"tocInstance",null)}onConnected(){var e;(e=super.onConnected)==null||e.call(this),requestAnimationFrame(()=>{if(this.connected){const r=this.querySelector(".doc-layout-sidebar");r&&!this.sidebarInstance&&(this.sidebarInstance=document.createElement("wsx-doc-sidebar"),r.appendChild(this.sidebarInstance));const o=this.querySelector(".doc-layout-main");o&&!this.docPageInstance&&(this.docPageInstance=document.createElement("wsx-doc-page"),o.appendChild(this.docPageInstance));const d=this.querySelector(".doc-layout-toc");d&&!this.tocInstance&&(this.tocInstance=document.createElement("wsx-doc-toc"),d.appendChild(this.tocInstance))}})}onDisconnected(){var e;(e=super.onDisconnected)==null||e.call(this),this.sidebarInstance&&(this.sidebarInstance.remove(),this.sidebarInstance=null),this.docPageInstance&&(this.docPageInstance.remove(),this.docPageInstance=null),this.tocInstance&&(this.tocInstance.remove(),this.tocInstance=null)}render(){return y.jsx("div",{class:"doc-layout"},y.jsx("aside",{class:"doc-layout-sidebar"}),y.jsx("main",{class:"doc-layout-main"}),y.jsx("aside",{class:"doc-layout-toc"}))}}_e=Ze;[exports.DocLayout,Ie]=Je(_e,[],Le,0,void 0,y.LightComponent).c;Ie();const me="wsx-doc-sidebar{display:flex;flex-direction:column;width:280px;min-width:280px;height:100%;background:var(--wsx-press-sidebar-bg, #f9fafb);border-right:1px solid var(--wsx-press-border, #e5e7eb);overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.doc-sidebar{display:flex;flex-direction:column;width:100%;height:100%}.doc-sidebar-loading,.doc-sidebar-empty{padding:2rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280)}.doc-sidebar-nav{padding:1.5rem 0}.doc-sidebar-category{margin-bottom:2rem}.doc-sidebar-category:last-child{margin-bottom:0}.doc-sidebar-category-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);padding:.5rem 1.5rem;margin:0 0 .5rem}.doc-sidebar-list{list-style:none;margin:0;padding:0}.doc-sidebar-item{margin:0}.doc-sidebar-link{display:block;padding:.5rem 1.5rem;color:var(--wsx-press-text-primary, #111827);text-decoration:none;font-size:.875rem;line-height:1.5;transition:all .2s ease;border-left:3px solid transparent}.doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #f3f4f6);color:var(--wsx-press-text-primary, #111827)}.doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, #eff6ff);color:var(--wsx-press-sidebar-active-color, #2563eb);border-left-color:var(--wsx-press-sidebar-active-color, #2563eb);font-weight:500}@media (max-width: 1024px){wsx-doc-sidebar{width:240px;min-width:240px}}@media (max-width: 768px){wsx-doc-sidebar{display:none}}";var Re;let $e,ke;function ie(t,e,r){return(e=Ae(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ve(t,e,r,o,d,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,C,v,m,p){function j(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";C?(v||m?s={get:pe(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||pe(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var g=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(h=x(H.call(K,g,k),"class decorators","return"))&&(g=h);else{var A,F;k.static=q,k.private=C,C?a===2?A=function(l){return j(l),s.value}:(a<4&&(A=f(s,"get",j)),a!==3&&(F=f(s,"set",j))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:C?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),g=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof g=="object"&&g)(h=x(g.get,"accessor.get"))&&(s.get=h),(h=x(g.set,"accessor.set"))&&(s.set=h),(h=x(g.init,"accessor.init"))&&E.push(h);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(g,(v?"field":"method")+" decorators","return")&&(v?E.push(g):s[b]=g)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(C?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),g}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return tt(b)===i},q=new Map;function C(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],j=m[2],h=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=j+"/"+D;if(!L&&!h){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+j);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,h?"#"+j:Ae(j),p,n,D?R=R||[]:a=a||[],$,D,h,L,p===1,D&&h?I:u)}}return C(a),C(R),$}(t,e,d,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Ae(t){var e=et(t,"string");return typeof e=="symbol"?e:e+""}function et(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function pe(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function tt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const rt=oe.createLogger("DocSidebar");ke=[y.autoRegister({tagName:"wsx-doc-sidebar"})];exports.DocSidebar=void 0;class it extends y.LightComponent{constructor(){super({styles:me,styleName:"wsx-doc-sidebar"}),ie(this,"_autoStyles",me),ie(this,"metadata",void 0),ie(this,"currentRoute",void 0),ie(this,"isLoading",void 0),ie(this,"routeChangeUnsubscribe",null),ie(this,"handleDocClick",(f,w)=>{w.preventDefault(),te.RouterUtils.navigate(f)});let e=this.reactive({});Object.defineProperty(this,"metadata",{get:()=>e,set:f=>{e=f!==null&&typeof f<"u"&&(Array.isArray(f)||typeof f=="object")?this.reactive(f):f,this.scheduleRerender()},enumerable:!0,configurable:!0});const[r,o]=this.useState("currentRoute","");Object.defineProperty(this,"currentRoute",{get:r,set:o,enumerable:!0,configurable:!0});const[d,_]=this.useState("isLoading",!0);Object.defineProperty(this,"isLoading",{get:d,set:_,enumerable:!0,configurable:!0})}async onConnected(){var e;(e=super.onConnected)==null||e.call(this),await this.loadMetadata(),this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.updateCurrentRoute()}),this.updateCurrentRoute()}onDisconnected(){var e;(e=super.onDisconnected)==null||e.call(this),this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null)}async loadMetadata(){try{if(this.isLoading=!0,Y.data)this.metadata=Y.data;else{const e=await fetch("/.wsx-press/docs-meta.json");e.ok&&(this.metadata=await e.json())}}catch(e){rt.error("Failed to load metadata",e)}finally{this.isLoading=!1}}updateCurrentRoute(){const e=te.RouterUtils.getCurrentRoute();this.currentRoute=e.path}organizeByCategory(){const e={};return Object.values(this.metadata).forEach(o=>{const d=o.category||"other";e[d]||(e[d]=[]),e[d].push(o)}),Object.keys(e).sort().forEach(o=>{e[o].sort((d,_)=>d.title.localeCompare(_.title))}),e}isCurrentDoc(e){return this.currentRoute===e}render(){if(this.isLoading)return y.jsx("aside",{class:"doc-sidebar"},y.jsx("div",{class:"doc-sidebar-loading"},"加载中..."));const e=this.organizeByCategory(),r=Object.keys(e);return r.length===0?y.jsx("aside",{class:"doc-sidebar"},y.jsx("div",{class:"doc-sidebar-empty"},"暂无文档")):y.jsx("aside",{class:"doc-sidebar"},y.jsx("nav",{class:"doc-sidebar-nav"},r.map(o=>y.jsx("div",{key:o,class:"doc-sidebar-category"},y.jsx("h3",{class:"doc-sidebar-category-title"},o),y.jsx("ul",{class:"doc-sidebar-list"},e[o].map(d=>y.jsx("li",{key:d.route,class:"doc-sidebar-item"},y.jsx("a",{href:d.route,class:`doc-sidebar-link ${this.isCurrentDoc(d.route)?"active":""}`,onClick:_=>this.handleDocClick(d.route,_)},d.title))))))))}}Re=it;[exports.DocSidebar,$e]=Ve(Re,[],ke,0,void 0,y.LightComponent).c;$e();const be="wsx-doc-toc{display:flex;flex-direction:column;width:240px;min-width:240px;height:100%;overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.doc-toc{display:flex;flex-direction:column;width:100%;padding:1.5rem 1rem}.doc-toc-empty{padding:1rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280);font-size:.875rem}.doc-toc-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);margin:0 0 1rem;padding:0}.doc-toc-nav{width:100%}.doc-toc-list{list-style:none;margin:0;padding:0}.doc-toc-sublist{margin-top:.25rem;padding-left:1rem}.doc-toc-item{margin:0;line-height:1.6}.doc-toc-item-level-1{margin-bottom:.5rem}.doc-toc-item-level-2{margin-bottom:.375rem;font-size:.875rem}.doc-toc-item-level-3{margin-bottom:.25rem;font-size:.8125rem}.doc-toc-item-level-4,.doc-toc-item-level-5,.doc-toc-item-level-6{margin-bottom:.25rem;font-size:.75rem}.doc-toc-link{display:block;color:var(--wsx-press-text-secondary, #6b7280);text-decoration:none;transition:color .2s ease;border-left:2px solid transparent;padding:.25rem 0 .25rem .5rem;margin-left:-.5rem}.doc-toc-link:hover{color:var(--wsx-press-text-primary, #111827)}.doc-toc-link.active{color:var(--wsx-press-toc-active-color, #2563eb);border-left-color:var(--wsx-press-toc-active-color, #2563eb);font-weight:500}@media (max-width: 1280px){wsx-doc-toc{display:none}}";var Pe;let qe,ze;function ee(t,e,r){return(e=Fe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function st(t,e,r,o,d,_){function f(i,c,u){return function(n,a){return u&&u(n),i[c].call(n,a)}}function w(i,c){for(var u=0;u<i.length;u++)i[u].call(c);return c}function x(i,c,u,n){if(typeof i!="function"&&(n||i!==void 0))throw new TypeError(c+" must "+(u||"be")+" a function"+(n?"":" or undefined"));return i}function U(i,c,u,n,a,R,$,I,q,C,v,m,p){function j(l){if(!p(l))throw new TypeError("Attempted to access private element on non-instance")}var h,S=c[0],D=c[3],L=!I;if(!L){u||Array.isArray(S)||(S=[S]);var s={},E=[],b=a===3?"get":a===4||m?"set":"value";C?(v||m?s={get:ye(function(){return D(this)},n,"get"),set:function(l){c[4](this,l)}}:s[b]=D,v||ye(s[b],n,a===2?"":b)):v||(s=Object.getOwnPropertyDescriptor(i,n))}for(var g=i,z=S.length-1;z>=0;z-=u?2:1){var H=S[z],K=u?S[z-1]:void 0,B={},k={kind:["field","accessor","method","getter","setter","class"][a],name:n,metadata:R,addInitializer:(function(l,O){if(l.v)throw Error("attempted to call addInitializer after decoration was finished");x(O,"An initializer","be",!0),$.push(O)}).bind(null,B)};try{if(L)(h=x(H.call(K,g,k),"class decorators","return"))&&(g=h);else{var A,F;k.static=q,k.private=C,C?a===2?A=function(l){return j(l),s.value}:(a<4&&(A=f(s,"get",j)),a!==3&&(F=f(s,"set",j))):(A=function(l){return l[n]},(a<2||a===4)&&(F=function(l,O){l[n]=O}));var W=k.access={has:C?p.bind():function(l){return n in l}};if(A&&(W.get=A),F&&(W.set=F),g=H.call(K,m?{get:s.get,set:s.set}:s[b],k),m){if(typeof g=="object"&&g)(h=x(g.get,"accessor.get"))&&(s.get=h),(h=x(g.set,"accessor.set"))&&(s.set=h),(h=x(g.init,"accessor.init"))&&E.push(h);else if(g!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else x(g,(v?"field":"method")+" decorators","return")&&(v?E.push(g):s[b]=g)}}finally{B.v=!0}}return(v||m)&&I.push(function(l,O){for(var M=E.length-1;M>=0;M--)O=E[M].call(l,O);return O}),v||L||(C?m?I.push(f(s,"get"),f(s,"set")):I.push(a===2?s[b]:f.call.bind(s[b])):Object.defineProperty(i,n,s)),g}function T(i,c){return Object.defineProperty(i,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:c})}if(arguments.length>=6)var N=_[Symbol.metadata||Symbol.for("Symbol.metadata")];var P=Object.create(N??null),X=function(i,c,u,n){var a,R,$=[],I=function(b){return nt(b)===i},q=new Map;function C(b){b&&$.push(w.bind(null,b))}for(var v=0;v<c.length;v++){var m=c[v];if(Array.isArray(m)){var p=m[1],j=m[2],h=m.length>3,S=16&p,D=!!(8&p),L=(p&=7)==0,s=j+"/"+D;if(!L&&!h){var E=q.get(s);if(E===!0||E===3&&p!==4||E===4&&p!==3)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+j);q.set(s,!(p>2)||p)}U(D?i:i.prototype,m,S,h?"#"+j:Fe(j),p,n,D?R=R||[]:a=a||[],$,D,h,L,p===1,D&&h?I:u)}}return C(a),C(R),$}(t,e,d,P);return r.length||T(t,P),{e:X,get c(){var i=[];return r.length&&[T(U(t,[r],o,t.name,5,P,i),P),w.bind(null,i,t)]}}}function Fe(t){var e=ot(t,"string");return typeof e=="symbol"?e:e+""}function ot(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function ye(t,e,r){typeof e=="symbol"&&(e=(e=e.description)?"["+e+"]":"");try{Object.defineProperty(t,"name",{configurable:!0,value:r?r+" "+e:e})}catch{}return t}function nt(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(t!==null?typeof t:"null"));return t}const at=oe.createLogger("DocTOC"),V={data:null,promise:null};async function ct(){return V.data?V.data:(V.promise||(V.promise=(async()=>{try{const t=await fetch("/.wsx-press/docs-toc.json");if(!t.ok)throw new Error(`Failed to load TOC data: ${t.statusText}`);const e=await t.json();return V.data=e,V.promise=null,e}catch(t){throw V.promise=null,t}})()),V.promise)}ze=[y.autoRegister({tagName:"wsx-doc-toc"})];exports.DocTOC=void 0;class lt extends y.LightComponent{constructor(){super({styles:be,styleName:"wsx-doc-toc"}),ee(this,"_autoStyles",be),ee(this,"items",void 0),ee(this,"activeId",void 0),ee(this,"observer",null),ee(this,"headingElements",new Map),ee(this,"routeChangeUnsubscribe",null),ee(this,"handleTOCClick",(d,_)=>{_.preventDefault();const f=this.headingElements.get(d);f&&(f.scrollIntoView({behavior:"smooth",block:"start"}),window.history.replaceState(null,"",`#${d}`))});let e=this.reactive([]);Object.defineProperty(this,"items",{get:()=>e,set:d=>{e=d!==null&&typeof d<"u"&&(Array.isArray(d)||typeof d=="object")?this.reactive(d):d,this.scheduleRerender()},enumerable:!0,configurable:!0});const[r,o]=this.useState("activeId","");Object.defineProperty(this,"activeId",{get:r,set:o,enumerable:!0,configurable:!0})}async onConnected(){var e;(e=super.onConnected)==null||e.call(this),await this.loadTOC(),this.routeChangeUnsubscribe=te.RouterUtils.onRouteChange(()=>{this.loadTOC()})}onDisconnected(){var e;(e=super.onDisconnected)==null||e.call(this),this.observer&&(this.observer.disconnect(),this.observer=null),this.routeChangeUnsubscribe&&(this.routeChangeUnsubscribe(),this.routeChangeUnsubscribe=null)}async loadTOC(){try{const r=te.RouterUtils.getCurrentRoute().params;if(!r.category||!r.page){this.items=[];return}const o=`${r.category}/${r.page}`,d=await ct();this.items=d[o]||[],requestAnimationFrame(()=>{this.setupHeadingIds(),this.setupScrollObserver()})}catch(e){at.error("Failed to load TOC",e),this.items=[]}}setupHeadingIds(){const e=document.querySelector(".doc-content");if(!e)return;const r=e.querySelectorAll("h1, h2, h3, h4, h5, h6, wsx-marked-heading");this.headingElements.clear(),r.forEach(o=>{var f;const d=((f=o.textContent)==null?void 0:f.trim())||"";if(!d)return;const _=this.generateId(d);o instanceof HTMLElement&&(o.id=_,this.headingElements.set(_,o))})}generateId(e){return e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}setupScrollObserver(){"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(e=>{const r=e.filter(o=>o.isIntersecting);r.length>0&&(r.sort((o,d)=>{const _=o.boundingClientRect.top,f=d.boundingClientRect.top;return Math.abs(_)-Math.abs(f)}),this.activeId=r[0].target.id)},{rootMargin:"-100px 0px -80% 0px",threshold:0}),this.headingElements.forEach(e=>{var r;(r=this.observer)==null||r.observe(e)}))}renderTOCItem(e){const r=this.activeId===e.id,o=e.children.length>0;return y.jsx("li",{class:`doc-toc-item doc-toc-item-level-${e.level}`},y.jsx("a",{href:`#${e.id}`,class:`doc-toc-link ${r?"active":""}`,onClick:d=>this.handleTOCClick(e.id,d)},e.text),o&&y.jsx("ul",{class:"doc-toc-list doc-toc-sublist"},e.children.map(d=>this.renderTOCItem(d))))}render(){return this.items.length===0?y.jsx("aside",{class:"doc-toc"},y.jsx("div",{class:"doc-toc-empty"},"暂无目录")):y.jsx("aside",{class:"doc-toc"},y.jsx("h3",{class:"doc-toc-title"},"目录"),y.jsx("nav",{class:"doc-toc-nav"},y.jsx("ul",{class:"doc-toc-list"},this.items.map(e=>this.renderTOCItem(e)))))}}Pe=lt;[exports.DocTOC,qe]=st(Pe,[],ze,0,void 0,y.LightComponent).c;qe();
package/dist/client.js CHANGED
@@ -10,7 +10,7 @@ let Ce, Se;
10
10
  function G(t, e, r) {
11
11
  return (e = De(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
12
12
  }
13
- function Ue(t, e, r, s, f, I) {
13
+ function Ue(t, e, r, s, d, I) {
14
14
  function g(i, c, u) {
15
15
  return function(n, a) {
16
16
  return u && u(n), i[c].call(n, a);
@@ -28,7 +28,7 @@ function Ue(t, e, r, s, f, I) {
28
28
  function S(l) {
29
29
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
30
30
  }
31
- var d, D = c[0], E = c[3], j = !T;
31
+ var h, D = c[0], E = c[3], j = !T;
32
32
  if (!j) {
33
33
  u || Array.isArray(D) || (D = [D]);
34
34
  var o = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
@@ -38,13 +38,13 @@ function Ue(t, e, r, s, f, I) {
38
38
  c[4](this, l);
39
39
  } } : o[b] = E, y || de(o[b], n, a === 2 ? "" : b)) : y || (o = Object.getOwnPropertyDescriptor(i, n));
40
40
  }
41
- for (var h = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
41
+ for (var f = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
42
42
  var H = D[q], K = u ? D[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: n, metadata: L, addInitializer: (function(l, O) {
43
43
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
44
44
  v(O, "An initializer", "be", !0), k.push(O);
45
45
  }).bind(null, B) };
46
46
  try {
47
- if (j) (d = v(H.call(K, h, R), "class decorators", "return")) && (h = d);
47
+ if (j) (h = v(H.call(K, f, R), "class decorators", "return")) && (f = h);
48
48
  else {
49
49
  var A, F;
50
50
  R.static = z, R.private = C, C ? a === 2 ? A = function(l) {
@@ -57,10 +57,10 @@ function Ue(t, e, r, s, f, I) {
57
57
  var W = R.access = { has: C ? p.bind() : function(l) {
58
58
  return n in l;
59
59
  } };
60
- if (A && (W.get = A), F && (W.set = F), h = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
61
- if (typeof h == "object" && h) (d = v(h.get, "accessor.get")) && (o.get = d), (d = v(h.set, "accessor.set")) && (o.set = d), (d = v(h.init, "accessor.init")) && _.push(d);
62
- else if (h !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
63
- } else v(h, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(h) : o[b] = h);
60
+ if (A && (W.get = A), F && (W.set = F), f = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
61
+ if (typeof f == "object" && f) (h = v(f.get, "accessor.get")) && (o.get = h), (h = v(f.set, "accessor.set")) && (o.set = h), (h = v(f.init, "accessor.init")) && _.push(h);
62
+ else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
63
+ } else v(f, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(f) : o[b] = f);
64
64
  }
65
65
  } finally {
66
66
  B.v = !0;
@@ -69,7 +69,7 @@ function Ue(t, e, r, s, f, I) {
69
69
  return (y || m) && T.push(function(l, O) {
70
70
  for (var N = _.length - 1; N >= 0; N--) O = _[N].call(l, O);
71
71
  return O;
72
- }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), h;
72
+ }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), f;
73
73
  }
74
74
  function $(i, c) {
75
75
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
@@ -85,17 +85,17 @@ function Ue(t, e, r, s, f, I) {
85
85
  for (var y = 0; y < c.length; y++) {
86
86
  var m = c[y];
87
87
  if (Array.isArray(m)) {
88
- var p = m[1], S = m[2], d = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
89
- if (!j && !d) {
88
+ var p = m[1], S = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
89
+ if (!j && !h) {
90
90
  var _ = z.get(o);
91
91
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + S);
92
92
  z.set(o, !(p > 2) || p);
93
93
  }
94
- M(E ? i : i.prototype, m, D, d ? "#" + S : De(S), p, n, E ? L = L || [] : a = a || [], k, E, d, j, p === 1, E && d ? T : u);
94
+ M(E ? i : i.prototype, m, D, h ? "#" + S : De(S), p, n, E ? L = L || [] : a = a || [], k, E, h, j, p === 1, E && h ? T : u);
95
95
  }
96
96
  }
97
97
  return C(a), C(L), k;
98
- }(t, e, f, P);
98
+ }(t, e, d, P);
99
99
  return r.length || $(t, P), { e: Z, get c() {
100
100
  var i = [];
101
101
  return r.length && [$(M(t, [r], s, t.name, 5, P, i), P), x.bind(null, i, t)];
@@ -133,7 +133,7 @@ const J = ae("DocPage"), Y = {
133
133
  };
134
134
  async function Ee(t, e = {}, r = 1e4) {
135
135
  var g;
136
- const s = new AbortController(), f = setTimeout(() => s.abort(), r);
136
+ const s = new AbortController(), d = setTimeout(() => s.abort(), r);
137
137
  let I;
138
138
  if (e.signal) {
139
139
  const x = new AbortController();
@@ -149,9 +149,9 @@ async function Ee(t, e = {}, r = 1e4) {
149
149
  ...e,
150
150
  signal: I
151
151
  });
152
- return clearTimeout(f), x;
152
+ return clearTimeout(d), x;
153
153
  } catch (x) {
154
- if (clearTimeout(f), x instanceof Error && x.name === "AbortError") {
154
+ if (clearTimeout(d), x instanceof Error && x.name === "AbortError") {
155
155
  const v = s.signal.aborted;
156
156
  throw ((g = e.signal) == null ? void 0 : g.aborted) ? new Error("Request was cancelled") : v ? new Error(`Request timeout after ${r}ms`) : new Error("Request was aborted");
157
157
  }
@@ -188,10 +188,10 @@ class Ye extends X {
188
188
  enumerable: !0,
189
189
  configurable: !0
190
190
  });
191
- const [s, f] = this.useState("markdown", "");
191
+ const [s, d] = this.useState("markdown", "");
192
192
  Object.defineProperty(this, "markdown", {
193
193
  get: s,
194
- set: f,
194
+ set: d,
195
195
  enumerable: !0,
196
196
  configurable: !0
197
197
  });
@@ -211,7 +211,8 @@ class Ye extends X {
211
211
  });
212
212
  }
213
213
  onConnected() {
214
- this.routeChangeUnsubscribe = re.onRouteChange(() => {
214
+ var e;
215
+ (e = super.onConnected) == null || e.call(this), this.routeChangeUnsubscribe = re.onRouteChange(() => {
215
216
  this.cancelLoading(), this.loadDocument();
216
217
  }), this.visibilityChangeHandler = () => {
217
218
  document.hidden ? this.cancelLoading() : this.loadingState === "loading" && this.currentLoadingPath && (J.debug("Tab became visible, reloading document"), this.loadDocument());
@@ -222,7 +223,8 @@ class Ye extends X {
222
223
  });
223
224
  }
224
225
  onDisconnected() {
225
- this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null), this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null), this.cancelLoading();
226
+ var e;
227
+ (e = super.onDisconnected) == null || e.call(this), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null), this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null), this.cancelLoading();
226
228
  }
227
229
  /**
228
230
  * 取消正在进行的加载请求
@@ -260,12 +262,12 @@ class Ye extends X {
260
262
  }
261
263
  const s = `${r.category}/${r.page}`;
262
264
  this.currentLoadingPath = s, this.isLoading = !0, this.loadingState = "loading", this.markdown = "", this.error = null, this.metadata = null;
263
- const f = await Be();
265
+ const d = await Be();
264
266
  if (this.currentLoadingPath !== s || this.loadingAbortController.signal.aborted) {
265
267
  J.debug(`Document switched after metadata, ignoring result for ${s}`), this.isLoading = !1, this.loadingState = "idle";
266
268
  return;
267
269
  }
268
- const I = f[s];
270
+ const I = d[s];
269
271
  if (!I) {
270
272
  if (this.currentLoadingPath !== s || this.loadingAbortController.signal.aborted) {
271
273
  this.isLoading = !1, this.loadingState = "idle";
@@ -333,7 +335,7 @@ let Oe, Ie;
333
335
  function Q(t, e, r) {
334
336
  return (e = Te(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
335
337
  }
336
- function Ge(t, e, r, s, f, I) {
338
+ function Ge(t, e, r, s, d, I) {
337
339
  function g(i, c, u) {
338
340
  return function(n, a) {
339
341
  return u && u(n), i[c].call(n, a);
@@ -351,7 +353,7 @@ function Ge(t, e, r, s, f, I) {
351
353
  function S(l) {
352
354
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
353
355
  }
354
- var d, D = c[0], E = c[3], j = !T;
356
+ var h, D = c[0], E = c[3], j = !T;
355
357
  if (!j) {
356
358
  u || Array.isArray(D) || (D = [D]);
357
359
  var o = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
@@ -361,13 +363,13 @@ function Ge(t, e, r, s, f, I) {
361
363
  c[4](this, l);
362
364
  } } : o[b] = E, y || fe(o[b], n, a === 2 ? "" : b)) : y || (o = Object.getOwnPropertyDescriptor(i, n));
363
365
  }
364
- for (var h = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
366
+ for (var f = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
365
367
  var H = D[q], K = u ? D[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: n, metadata: L, addInitializer: (function(l, O) {
366
368
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
367
369
  v(O, "An initializer", "be", !0), k.push(O);
368
370
  }).bind(null, B) };
369
371
  try {
370
- if (j) (d = v(H.call(K, h, R), "class decorators", "return")) && (h = d);
372
+ if (j) (h = v(H.call(K, f, R), "class decorators", "return")) && (f = h);
371
373
  else {
372
374
  var A, F;
373
375
  R.static = z, R.private = C, C ? a === 2 ? A = function(l) {
@@ -380,10 +382,10 @@ function Ge(t, e, r, s, f, I) {
380
382
  var W = R.access = { has: C ? p.bind() : function(l) {
381
383
  return n in l;
382
384
  } };
383
- if (A && (W.get = A), F && (W.set = F), h = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
384
- if (typeof h == "object" && h) (d = v(h.get, "accessor.get")) && (o.get = d), (d = v(h.set, "accessor.set")) && (o.set = d), (d = v(h.init, "accessor.init")) && _.push(d);
385
- else if (h !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
386
- } else v(h, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(h) : o[b] = h);
385
+ if (A && (W.get = A), F && (W.set = F), f = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
386
+ if (typeof f == "object" && f) (h = v(f.get, "accessor.get")) && (o.get = h), (h = v(f.set, "accessor.set")) && (o.set = h), (h = v(f.init, "accessor.init")) && _.push(h);
387
+ else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
388
+ } else v(f, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(f) : o[b] = f);
387
389
  }
388
390
  } finally {
389
391
  B.v = !0;
@@ -392,7 +394,7 @@ function Ge(t, e, r, s, f, I) {
392
394
  return (y || m) && T.push(function(l, O) {
393
395
  for (var N = _.length - 1; N >= 0; N--) O = _[N].call(l, O);
394
396
  return O;
395
- }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), h;
397
+ }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), f;
396
398
  }
397
399
  function $(i, c) {
398
400
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
@@ -408,17 +410,17 @@ function Ge(t, e, r, s, f, I) {
408
410
  for (var y = 0; y < c.length; y++) {
409
411
  var m = c[y];
410
412
  if (Array.isArray(m)) {
411
- var p = m[1], S = m[2], d = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
412
- if (!j && !d) {
413
+ var p = m[1], S = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
414
+ if (!j && !h) {
413
415
  var _ = z.get(o);
414
416
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + S);
415
417
  z.set(o, !(p > 2) || p);
416
418
  }
417
- M(E ? i : i.prototype, m, D, d ? "#" + S : Te(S), p, n, E ? L = L || [] : a = a || [], k, E, d, j, p === 1, E && d ? T : u);
419
+ M(E ? i : i.prototype, m, D, h ? "#" + S : Te(S), p, n, E ? L = L || [] : a = a || [], k, E, h, j, p === 1, E && h ? T : u);
418
420
  }
419
421
  }
420
422
  return C(a), C(L), k;
421
- }(t, e, f, P);
423
+ }(t, e, d, P);
422
424
  return r.length || $(t, P), { e: Z, get c() {
423
425
  var i = [];
424
426
  return r.length && [$(M(t, [r], s, t.name, 5, P, i), P), x.bind(null, i, t)];
@@ -518,9 +520,9 @@ class Ze extends X {
518
520
  enumerable: !0,
519
521
  configurable: !0
520
522
  });
521
- const [f, I] = this.useState("isOpen", !1);
523
+ const [d, I] = this.useState("isOpen", !1);
522
524
  Object.defineProperty(this, "isOpen", {
523
- get: f,
525
+ get: d,
524
526
  set: I,
525
527
  enumerable: !0,
526
528
  configurable: !0
@@ -541,11 +543,13 @@ class Ze extends X {
541
543
  });
542
544
  }
543
545
  async onConnected() {
546
+ var e;
547
+ (e = super.onConnected) == null || e.call(this);
544
548
  try {
545
- const e = await ge();
546
- this.fuse = new le(e.documents, e.options);
547
- } catch (e) {
548
- ce.error("Failed to load search index", e);
549
+ const r = await ge();
550
+ this.fuse = new le(r.documents, r.options);
551
+ } catch (r) {
552
+ ce.error("Failed to load search index", r);
549
553
  }
550
554
  }
551
555
  /**
@@ -590,12 +594,12 @@ class Ze extends X {
590
594
  for (const x of r)
591
595
  x.indices && s.push(...x.indices);
592
596
  s.sort((x, v) => x[0] - v[0]);
593
- const f = [];
597
+ const d = [];
594
598
  for (const [x, v] of s)
595
- f.length === 0 || f[f.length - 1][1] < x ? f.push([x, v + 1]) : f[f.length - 1][1] = Math.max(f[f.length - 1][1], v + 1);
599
+ d.length === 0 || d[d.length - 1][1] < x ? d.push([x, v + 1]) : d[d.length - 1][1] = Math.max(d[d.length - 1][1], v + 1);
596
600
  const I = [];
597
601
  let g = 0;
598
- for (const [x, v] of f) {
602
+ for (const [x, v] of d) {
599
603
  x > g && I.push(e.substring(g, x));
600
604
  const M = document.createElement("mark");
601
605
  M.textContent = e.substring(x, v), I.push(M), g = v;
@@ -607,10 +611,10 @@ class Ze extends X {
607
611
  this.results.length > 0 && (this.isOpen = !0);
608
612
  }, "data-wsx-key": "DocSearch-input-text-1-1" }), this.isLoading && /* @__PURE__ */ w("div", { class: "search-loading" }, "加载中...")), this.isOpen && this.results.length > 0 && /* @__PURE__ */ w("div", { class: "search-results" }, this.results.map((e, r) => {
609
613
  var g, x;
610
- const s = r === this.selectedIndex, f = (g = e.matches) == null ? void 0 : g.find((v) => v.key === "title"), I = (x = e.matches) == null ? void 0 : x.find((v) => v.key === "content");
614
+ const s = r === this.selectedIndex, d = (g = e.matches) == null ? void 0 : g.find((v) => v.key === "title"), I = (x = e.matches) == null ? void 0 : x.find((v) => v.key === "content");
611
615
  return /* @__PURE__ */ w("div", { key: e.item.id, class: `search-result ${s ? "selected" : ""}`, onClick: () => this.selectResult(e), onMouseEnter: () => {
612
616
  this.selectedIndex = r;
613
- } }, /* @__PURE__ */ w("div", { class: "result-title" }, f ? this.highlightTextNodes(e.item.title, [f]) : e.item.title), /* @__PURE__ */ w("div", { class: "result-category" }, e.item.category), I && /* @__PURE__ */ w("div", { class: "result-snippet" }, this.highlightTextNodes(e.item.content.substring(0, 100), [I])));
617
+ } }, /* @__PURE__ */ w("div", { class: "result-title" }, d ? this.highlightTextNodes(e.item.title, [d]) : e.item.title), /* @__PURE__ */ w("div", { class: "result-category" }, e.item.category), I && /* @__PURE__ */ w("div", { class: "result-snippet" }, this.highlightTextNodes(e.item.content.substring(0, 100), [I])));
614
618
  })), this.isOpen && this.query.trim() && this.results.length === 0 && !this.isLoading && /* @__PURE__ */ w("div", { class: "search-no-results" }, "未找到匹配的文档"));
615
619
  }
616
620
  }
@@ -623,7 +627,7 @@ let $e, Le;
623
627
  function ne(t, e, r) {
624
628
  return (e = ke(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
625
629
  }
626
- function Ve(t, e, r, s, f, I) {
630
+ function Ve(t, e, r, s, d, I) {
627
631
  function g(i, c, u) {
628
632
  return function(n, a) {
629
633
  return u && u(n), i[c].call(n, a);
@@ -641,7 +645,7 @@ function Ve(t, e, r, s, f, I) {
641
645
  function S(l) {
642
646
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
643
647
  }
644
- var d, D = c[0], E = c[3], j = !T;
648
+ var h, D = c[0], E = c[3], j = !T;
645
649
  if (!j) {
646
650
  u || Array.isArray(D) || (D = [D]);
647
651
  var o = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
@@ -651,13 +655,13 @@ function Ve(t, e, r, s, f, I) {
651
655
  c[4](this, l);
652
656
  } } : o[b] = E, y || pe(o[b], n, a === 2 ? "" : b)) : y || (o = Object.getOwnPropertyDescriptor(i, n));
653
657
  }
654
- for (var h = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
658
+ for (var f = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
655
659
  var H = D[q], K = u ? D[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: n, metadata: L, addInitializer: (function(l, O) {
656
660
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
657
661
  v(O, "An initializer", "be", !0), k.push(O);
658
662
  }).bind(null, B) };
659
663
  try {
660
- if (j) (d = v(H.call(K, h, R), "class decorators", "return")) && (h = d);
664
+ if (j) (h = v(H.call(K, f, R), "class decorators", "return")) && (f = h);
661
665
  else {
662
666
  var A, F;
663
667
  R.static = z, R.private = C, C ? a === 2 ? A = function(l) {
@@ -670,10 +674,10 @@ function Ve(t, e, r, s, f, I) {
670
674
  var W = R.access = { has: C ? p.bind() : function(l) {
671
675
  return n in l;
672
676
  } };
673
- if (A && (W.get = A), F && (W.set = F), h = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
674
- if (typeof h == "object" && h) (d = v(h.get, "accessor.get")) && (o.get = d), (d = v(h.set, "accessor.set")) && (o.set = d), (d = v(h.init, "accessor.init")) && _.push(d);
675
- else if (h !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
676
- } else v(h, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(h) : o[b] = h);
677
+ if (A && (W.get = A), F && (W.set = F), f = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
678
+ if (typeof f == "object" && f) (h = v(f.get, "accessor.get")) && (o.get = h), (h = v(f.set, "accessor.set")) && (o.set = h), (h = v(f.init, "accessor.init")) && _.push(h);
679
+ else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
680
+ } else v(f, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(f) : o[b] = f);
677
681
  }
678
682
  } finally {
679
683
  B.v = !0;
@@ -682,7 +686,7 @@ function Ve(t, e, r, s, f, I) {
682
686
  return (y || m) && T.push(function(l, O) {
683
687
  for (var N = _.length - 1; N >= 0; N--) O = _[N].call(l, O);
684
688
  return O;
685
- }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), h;
689
+ }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), f;
686
690
  }
687
691
  function $(i, c) {
688
692
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
@@ -698,17 +702,17 @@ function Ve(t, e, r, s, f, I) {
698
702
  for (var y = 0; y < c.length; y++) {
699
703
  var m = c[y];
700
704
  if (Array.isArray(m)) {
701
- var p = m[1], S = m[2], d = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
702
- if (!j && !d) {
705
+ var p = m[1], S = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
706
+ if (!j && !h) {
703
707
  var _ = z.get(o);
704
708
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + S);
705
709
  z.set(o, !(p > 2) || p);
706
710
  }
707
- M(E ? i : i.prototype, m, D, d ? "#" + S : ke(S), p, n, E ? L = L || [] : a = a || [], k, E, d, j, p === 1, E && d ? T : u);
711
+ M(E ? i : i.prototype, m, D, h ? "#" + S : ke(S), p, n, E ? L = L || [] : a = a || [], k, E, h, j, p === 1, E && h ? T : u);
708
712
  }
709
713
  }
710
714
  return C(a), C(L), k;
711
- }(t, e, f, P);
715
+ }(t, e, d, P);
712
716
  return r.length || $(t, P), { e: Z, get c() {
713
717
  var i = [];
714
718
  return r.length && [$(M(t, [r], s, t.name, 5, P, i), P), x.bind(null, i, t)];
@@ -752,19 +756,21 @@ class it extends X {
752
756
  }), ne(this, "_autoStyles", me), ne(this, "sidebarInstance", null), ne(this, "docPageInstance", null), ne(this, "tocInstance", null);
753
757
  }
754
758
  onConnected() {
755
- requestAnimationFrame(() => {
759
+ var e;
760
+ (e = super.onConnected) == null || e.call(this), requestAnimationFrame(() => {
756
761
  if (this.connected) {
757
- const e = this.querySelector(".doc-layout-sidebar");
758
- e && !this.sidebarInstance && (this.sidebarInstance = document.createElement("wsx-doc-sidebar"), e.appendChild(this.sidebarInstance));
759
- const r = this.querySelector(".doc-layout-main");
760
- r && !this.docPageInstance && (this.docPageInstance = document.createElement("wsx-doc-page"), r.appendChild(this.docPageInstance));
761
- const s = this.querySelector(".doc-layout-toc");
762
- s && !this.tocInstance && (this.tocInstance = document.createElement("wsx-doc-toc"), s.appendChild(this.tocInstance));
762
+ const r = this.querySelector(".doc-layout-sidebar");
763
+ r && !this.sidebarInstance && (this.sidebarInstance = document.createElement("wsx-doc-sidebar"), r.appendChild(this.sidebarInstance));
764
+ const s = this.querySelector(".doc-layout-main");
765
+ s && !this.docPageInstance && (this.docPageInstance = document.createElement("wsx-doc-page"), s.appendChild(this.docPageInstance));
766
+ const d = this.querySelector(".doc-layout-toc");
767
+ d && !this.tocInstance && (this.tocInstance = document.createElement("wsx-doc-toc"), d.appendChild(this.tocInstance));
763
768
  }
764
769
  });
765
770
  }
766
771
  onDisconnected() {
767
- this.sidebarInstance && (this.sidebarInstance.remove(), this.sidebarInstance = null), this.docPageInstance && (this.docPageInstance.remove(), this.docPageInstance = null), this.tocInstance && (this.tocInstance.remove(), this.tocInstance = null);
772
+ var e;
773
+ (e = super.onDisconnected) == null || e.call(this), this.sidebarInstance && (this.sidebarInstance.remove(), this.sidebarInstance = null), this.docPageInstance && (this.docPageInstance.remove(), this.docPageInstance = null), this.tocInstance && (this.tocInstance.remove(), this.tocInstance = null);
768
774
  }
769
775
  render() {
770
776
  return /* @__PURE__ */ w("div", { class: "doc-layout" }, /* @__PURE__ */ w("aside", { class: "doc-layout-sidebar" }), /* @__PURE__ */ w("main", { class: "doc-layout-main" }), /* @__PURE__ */ w("aside", { class: "doc-layout-toc" }));
@@ -779,7 +785,7 @@ let Ae, Pe;
779
785
  function oe(t, e, r) {
780
786
  return (e = ze(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
781
787
  }
782
- function ot(t, e, r, s, f, I) {
788
+ function ot(t, e, r, s, d, I) {
783
789
  function g(i, c, u) {
784
790
  return function(n, a) {
785
791
  return u && u(n), i[c].call(n, a);
@@ -797,7 +803,7 @@ function ot(t, e, r, s, f, I) {
797
803
  function S(l) {
798
804
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
799
805
  }
800
- var d, D = c[0], E = c[3], j = !T;
806
+ var h, D = c[0], E = c[3], j = !T;
801
807
  if (!j) {
802
808
  u || Array.isArray(D) || (D = [D]);
803
809
  var o = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
@@ -807,13 +813,13 @@ function ot(t, e, r, s, f, I) {
807
813
  c[4](this, l);
808
814
  } } : o[b] = E, y || ye(o[b], n, a === 2 ? "" : b)) : y || (o = Object.getOwnPropertyDescriptor(i, n));
809
815
  }
810
- for (var h = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
816
+ for (var f = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
811
817
  var H = D[q], K = u ? D[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: n, metadata: L, addInitializer: (function(l, O) {
812
818
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
813
819
  v(O, "An initializer", "be", !0), k.push(O);
814
820
  }).bind(null, B) };
815
821
  try {
816
- if (j) (d = v(H.call(K, h, R), "class decorators", "return")) && (h = d);
822
+ if (j) (h = v(H.call(K, f, R), "class decorators", "return")) && (f = h);
817
823
  else {
818
824
  var A, F;
819
825
  R.static = z, R.private = C, C ? a === 2 ? A = function(l) {
@@ -826,10 +832,10 @@ function ot(t, e, r, s, f, I) {
826
832
  var W = R.access = { has: C ? p.bind() : function(l) {
827
833
  return n in l;
828
834
  } };
829
- if (A && (W.get = A), F && (W.set = F), h = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
830
- if (typeof h == "object" && h) (d = v(h.get, "accessor.get")) && (o.get = d), (d = v(h.set, "accessor.set")) && (o.set = d), (d = v(h.init, "accessor.init")) && _.push(d);
831
- else if (h !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
832
- } else v(h, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(h) : o[b] = h);
835
+ if (A && (W.get = A), F && (W.set = F), f = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
836
+ if (typeof f == "object" && f) (h = v(f.get, "accessor.get")) && (o.get = h), (h = v(f.set, "accessor.set")) && (o.set = h), (h = v(f.init, "accessor.init")) && _.push(h);
837
+ else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
838
+ } else v(f, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(f) : o[b] = f);
833
839
  }
834
840
  } finally {
835
841
  B.v = !0;
@@ -838,7 +844,7 @@ function ot(t, e, r, s, f, I) {
838
844
  return (y || m) && T.push(function(l, O) {
839
845
  for (var N = _.length - 1; N >= 0; N--) O = _[N].call(l, O);
840
846
  return O;
841
- }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), h;
847
+ }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), f;
842
848
  }
843
849
  function $(i, c) {
844
850
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
@@ -854,17 +860,17 @@ function ot(t, e, r, s, f, I) {
854
860
  for (var y = 0; y < c.length; y++) {
855
861
  var m = c[y];
856
862
  if (Array.isArray(m)) {
857
- var p = m[1], S = m[2], d = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
858
- if (!j && !d) {
863
+ var p = m[1], S = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
864
+ if (!j && !h) {
859
865
  var _ = z.get(o);
860
866
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + S);
861
867
  z.set(o, !(p > 2) || p);
862
868
  }
863
- M(E ? i : i.prototype, m, D, d ? "#" + S : ze(S), p, n, E ? L = L || [] : a = a || [], k, E, d, j, p === 1, E && d ? T : u);
869
+ M(E ? i : i.prototype, m, D, h ? "#" + S : ze(S), p, n, E ? L = L || [] : a = a || [], k, E, h, j, p === 1, E && h ? T : u);
864
870
  }
865
871
  }
866
872
  return C(a), C(L), k;
867
- }(t, e, f, P);
873
+ }(t, e, d, P);
868
874
  return r.length || $(t, P), { e: Z, get c() {
869
875
  var i = [];
870
876
  return r.length && [$(M(t, [r], s, t.name, 5, P, i), P), x.bind(null, i, t)];
@@ -925,21 +931,23 @@ class lt extends X {
925
931
  enumerable: !0,
926
932
  configurable: !0
927
933
  });
928
- const [f, I] = this.useState("isLoading", !0);
934
+ const [d, I] = this.useState("isLoading", !0);
929
935
  Object.defineProperty(this, "isLoading", {
930
- get: f,
936
+ get: d,
931
937
  set: I,
932
938
  enumerable: !0,
933
939
  configurable: !0
934
940
  });
935
941
  }
936
942
  async onConnected() {
937
- await this.loadMetadata(), this.routeChangeUnsubscribe = re.onRouteChange(() => {
943
+ var e;
944
+ (e = super.onConnected) == null || e.call(this), await this.loadMetadata(), this.routeChangeUnsubscribe = re.onRouteChange(() => {
938
945
  this.updateCurrentRoute();
939
946
  }), this.updateCurrentRoute();
940
947
  }
941
948
  onDisconnected() {
942
- this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null);
949
+ var e;
950
+ (e = super.onDisconnected) == null || e.call(this), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null);
943
951
  }
944
952
  /**
945
953
  * 加载文档元数据
@@ -971,10 +979,10 @@ class lt extends X {
971
979
  organizeByCategory() {
972
980
  const e = {};
973
981
  return Object.values(this.metadata).forEach((s) => {
974
- const f = s.category || "other";
975
- e[f] || (e[f] = []), e[f].push(s);
982
+ const d = s.category || "other";
983
+ e[d] || (e[d] = []), e[d].push(s);
976
984
  }), Object.keys(e).sort().forEach((s) => {
977
- e[s].sort((f, I) => f.title.localeCompare(I.title));
985
+ e[s].sort((d, I) => d.title.localeCompare(I.title));
978
986
  }), e;
979
987
  }
980
988
  /**
@@ -987,7 +995,7 @@ class lt extends X {
987
995
  if (this.isLoading)
988
996
  return /* @__PURE__ */ w("aside", { class: "doc-sidebar" }, /* @__PURE__ */ w("div", { class: "doc-sidebar-loading" }, "加载中..."));
989
997
  const e = this.organizeByCategory(), r = Object.keys(e);
990
- return r.length === 0 ? /* @__PURE__ */ w("aside", { class: "doc-sidebar" }, /* @__PURE__ */ w("div", { class: "doc-sidebar-empty" }, "暂无文档")) : /* @__PURE__ */ w("aside", { class: "doc-sidebar" }, /* @__PURE__ */ w("nav", { class: "doc-sidebar-nav" }, r.map((s) => /* @__PURE__ */ w("div", { key: s, class: "doc-sidebar-category" }, /* @__PURE__ */ w("h3", { class: "doc-sidebar-category-title" }, s), /* @__PURE__ */ w("ul", { class: "doc-sidebar-list" }, e[s].map((f) => /* @__PURE__ */ w("li", { key: f.route, class: "doc-sidebar-item" }, /* @__PURE__ */ w("a", { href: f.route, class: `doc-sidebar-link ${this.isCurrentDoc(f.route) ? "active" : ""}`, onClick: (I) => this.handleDocClick(f.route, I) }, f.title))))))));
998
+ return r.length === 0 ? /* @__PURE__ */ w("aside", { class: "doc-sidebar" }, /* @__PURE__ */ w("div", { class: "doc-sidebar-empty" }, "暂无文档")) : /* @__PURE__ */ w("aside", { class: "doc-sidebar" }, /* @__PURE__ */ w("nav", { class: "doc-sidebar-nav" }, r.map((s) => /* @__PURE__ */ w("div", { key: s, class: "doc-sidebar-category" }, /* @__PURE__ */ w("h3", { class: "doc-sidebar-category-title" }, s), /* @__PURE__ */ w("ul", { class: "doc-sidebar-list" }, e[s].map((d) => /* @__PURE__ */ w("li", { key: d.route, class: "doc-sidebar-item" }, /* @__PURE__ */ w("a", { href: d.route, class: `doc-sidebar-link ${this.isCurrentDoc(d.route) ? "active" : ""}`, onClick: (I) => this.handleDocClick(d.route, I) }, d.title))))))));
991
999
  }
992
1000
  }
993
1001
  Re = lt;
@@ -999,7 +1007,7 @@ let Fe, Me;
999
1007
  function te(t, e, r) {
1000
1008
  return (e = Ne(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
1001
1009
  }
1002
- function ut(t, e, r, s, f, I) {
1010
+ function ut(t, e, r, s, d, I) {
1003
1011
  function g(i, c, u) {
1004
1012
  return function(n, a) {
1005
1013
  return u && u(n), i[c].call(n, a);
@@ -1017,7 +1025,7 @@ function ut(t, e, r, s, f, I) {
1017
1025
  function S(l) {
1018
1026
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
1019
1027
  }
1020
- var d, D = c[0], E = c[3], j = !T;
1028
+ var h, D = c[0], E = c[3], j = !T;
1021
1029
  if (!j) {
1022
1030
  u || Array.isArray(D) || (D = [D]);
1023
1031
  var o = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
@@ -1027,13 +1035,13 @@ function ut(t, e, r, s, f, I) {
1027
1035
  c[4](this, l);
1028
1036
  } } : o[b] = E, y || xe(o[b], n, a === 2 ? "" : b)) : y || (o = Object.getOwnPropertyDescriptor(i, n));
1029
1037
  }
1030
- for (var h = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
1038
+ for (var f = i, q = D.length - 1; q >= 0; q -= u ? 2 : 1) {
1031
1039
  var H = D[q], K = u ? D[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: n, metadata: L, addInitializer: (function(l, O) {
1032
1040
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
1033
1041
  v(O, "An initializer", "be", !0), k.push(O);
1034
1042
  }).bind(null, B) };
1035
1043
  try {
1036
- if (j) (d = v(H.call(K, h, R), "class decorators", "return")) && (h = d);
1044
+ if (j) (h = v(H.call(K, f, R), "class decorators", "return")) && (f = h);
1037
1045
  else {
1038
1046
  var A, F;
1039
1047
  R.static = z, R.private = C, C ? a === 2 ? A = function(l) {
@@ -1046,10 +1054,10 @@ function ut(t, e, r, s, f, I) {
1046
1054
  var W = R.access = { has: C ? p.bind() : function(l) {
1047
1055
  return n in l;
1048
1056
  } };
1049
- if (A && (W.get = A), F && (W.set = F), h = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
1050
- if (typeof h == "object" && h) (d = v(h.get, "accessor.get")) && (o.get = d), (d = v(h.set, "accessor.set")) && (o.set = d), (d = v(h.init, "accessor.init")) && _.push(d);
1051
- else if (h !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1052
- } else v(h, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(h) : o[b] = h);
1057
+ if (A && (W.get = A), F && (W.set = F), f = H.call(K, m ? { get: o.get, set: o.set } : o[b], R), m) {
1058
+ if (typeof f == "object" && f) (h = v(f.get, "accessor.get")) && (o.get = h), (h = v(f.set, "accessor.set")) && (o.set = h), (h = v(f.init, "accessor.init")) && _.push(h);
1059
+ else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1060
+ } else v(f, (y ? "field" : "method") + " decorators", "return") && (y ? _.push(f) : o[b] = f);
1053
1061
  }
1054
1062
  } finally {
1055
1063
  B.v = !0;
@@ -1058,7 +1066,7 @@ function ut(t, e, r, s, f, I) {
1058
1066
  return (y || m) && T.push(function(l, O) {
1059
1067
  for (var N = _.length - 1; N >= 0; N--) O = _[N].call(l, O);
1060
1068
  return O;
1061
- }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), h;
1069
+ }), y || j || (C ? m ? T.push(g(o, "get"), g(o, "set")) : T.push(a === 2 ? o[b] : g.call.bind(o[b])) : Object.defineProperty(i, n, o)), f;
1062
1070
  }
1063
1071
  function $(i, c) {
1064
1072
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
@@ -1074,17 +1082,17 @@ function ut(t, e, r, s, f, I) {
1074
1082
  for (var y = 0; y < c.length; y++) {
1075
1083
  var m = c[y];
1076
1084
  if (Array.isArray(m)) {
1077
- var p = m[1], S = m[2], d = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
1078
- if (!j && !d) {
1085
+ var p = m[1], S = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), j = (p &= 7) == 0, o = S + "/" + E;
1086
+ if (!j && !h) {
1079
1087
  var _ = z.get(o);
1080
1088
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + S);
1081
1089
  z.set(o, !(p > 2) || p);
1082
1090
  }
1083
- M(E ? i : i.prototype, m, D, d ? "#" + S : Ne(S), p, n, E ? L = L || [] : a = a || [], k, E, d, j, p === 1, E && d ? T : u);
1091
+ M(E ? i : i.prototype, m, D, h ? "#" + S : Ne(S), p, n, E ? L = L || [] : a = a || [], k, E, h, j, p === 1, E && h ? T : u);
1084
1092
  }
1085
1093
  }
1086
1094
  return C(a), C(L), k;
1087
- }(t, e, f, P);
1095
+ }(t, e, d, P);
1088
1096
  return r.length || $(t, P), { e: Z, get c() {
1089
1097
  var i = [];
1090
1098
  return r.length && [$(M(t, [r], s, t.name, 5, P, i), P), x.bind(null, i, t)];
@@ -1142,19 +1150,19 @@ class pt extends X {
1142
1150
  super({
1143
1151
  styles: ve,
1144
1152
  styleName: "wsx-doc-toc"
1145
- }), te(this, "_autoStyles", ve), te(this, "items", void 0), te(this, "activeId", void 0), te(this, "observer", null), te(this, "headingElements", /* @__PURE__ */ new Map()), te(this, "routeChangeUnsubscribe", null), te(this, "handleTOCClick", (f, I) => {
1153
+ }), te(this, "_autoStyles", ve), te(this, "items", void 0), te(this, "activeId", void 0), te(this, "observer", null), te(this, "headingElements", /* @__PURE__ */ new Map()), te(this, "routeChangeUnsubscribe", null), te(this, "handleTOCClick", (d, I) => {
1146
1154
  I.preventDefault();
1147
- const g = this.headingElements.get(f);
1155
+ const g = this.headingElements.get(d);
1148
1156
  g && (g.scrollIntoView({
1149
1157
  behavior: "smooth",
1150
1158
  block: "start"
1151
- }), window.history.replaceState(null, "", `#${f}`));
1159
+ }), window.history.replaceState(null, "", `#${d}`));
1152
1160
  });
1153
1161
  let e = this.reactive([]);
1154
1162
  Object.defineProperty(this, "items", {
1155
1163
  get: () => e,
1156
- set: (f) => {
1157
- e = f !== null && typeof f < "u" && (Array.isArray(f) || typeof f == "object") ? this.reactive(f) : f, this.scheduleRerender();
1164
+ set: (d) => {
1165
+ e = d !== null && typeof d < "u" && (Array.isArray(d) || typeof d == "object") ? this.reactive(d) : d, this.scheduleRerender();
1158
1166
  },
1159
1167
  enumerable: !0,
1160
1168
  configurable: !0
@@ -1168,12 +1176,14 @@ class pt extends X {
1168
1176
  });
1169
1177
  }
1170
1178
  async onConnected() {
1171
- await this.loadTOC(), this.routeChangeUnsubscribe = re.onRouteChange(() => {
1179
+ var e;
1180
+ (e = super.onConnected) == null || e.call(this), await this.loadTOC(), this.routeChangeUnsubscribe = re.onRouteChange(() => {
1172
1181
  this.loadTOC();
1173
1182
  });
1174
1183
  }
1175
1184
  onDisconnected() {
1176
- this.observer && (this.observer.disconnect(), this.observer = null), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null);
1185
+ var e;
1186
+ (e = super.onDisconnected) == null || e.call(this), this.observer && (this.observer.disconnect(), this.observer = null), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null);
1177
1187
  }
1178
1188
  /**
1179
1189
  * 加载当前文档的 TOC 数据
@@ -1185,8 +1195,8 @@ class pt extends X {
1185
1195
  this.items = [];
1186
1196
  return;
1187
1197
  }
1188
- const s = `${r.category}/${r.page}`, f = await gt();
1189
- this.items = f[s] || [], requestAnimationFrame(() => {
1198
+ const s = `${r.category}/${r.page}`, d = await gt();
1199
+ this.items = d[s] || [], requestAnimationFrame(() => {
1190
1200
  this.setupHeadingIds(), this.setupScrollObserver();
1191
1201
  });
1192
1202
  } catch (e) {
@@ -1203,9 +1213,9 @@ class pt extends X {
1203
1213
  const r = e.querySelectorAll("h1, h2, h3, h4, h5, h6, wsx-marked-heading");
1204
1214
  this.headingElements.clear(), r.forEach((s) => {
1205
1215
  var g;
1206
- const f = ((g = s.textContent) == null ? void 0 : g.trim()) || "";
1207
- if (!f) return;
1208
- const I = this.generateId(f);
1216
+ const d = ((g = s.textContent) == null ? void 0 : g.trim()) || "";
1217
+ if (!d) return;
1218
+ const I = this.generateId(d);
1209
1219
  s instanceof HTMLElement && (s.id = I, this.headingElements.set(I, s));
1210
1220
  });
1211
1221
  }
@@ -1221,8 +1231,8 @@ class pt extends X {
1221
1231
  setupScrollObserver() {
1222
1232
  "IntersectionObserver" in window && (this.observer = new IntersectionObserver((e) => {
1223
1233
  const r = e.filter((s) => s.isIntersecting);
1224
- r.length > 0 && (r.sort((s, f) => {
1225
- const I = s.boundingClientRect.top, g = f.boundingClientRect.top;
1234
+ r.length > 0 && (r.sort((s, d) => {
1235
+ const I = s.boundingClientRect.top, g = d.boundingClientRect.top;
1226
1236
  return Math.abs(I) - Math.abs(g);
1227
1237
  }), this.activeId = r[0].target.id);
1228
1238
  }, {
@@ -1238,7 +1248,7 @@ class pt extends X {
1238
1248
  */
1239
1249
  renderTOCItem(e) {
1240
1250
  const r = this.activeId === e.id, s = e.children.length > 0;
1241
- return /* @__PURE__ */ w("li", { class: `doc-toc-item doc-toc-item-level-${e.level}` }, /* @__PURE__ */ w("a", { href: `#${e.id}`, class: `doc-toc-link ${r ? "active" : ""}`, onClick: (f) => this.handleTOCClick(e.id, f) }, e.text), s && /* @__PURE__ */ w("ul", { class: "doc-toc-list doc-toc-sublist" }, e.children.map((f) => this.renderTOCItem(f))));
1251
+ return /* @__PURE__ */ w("li", { class: `doc-toc-item doc-toc-item-level-${e.level}` }, /* @__PURE__ */ w("a", { href: `#${e.id}`, class: `doc-toc-link ${r ? "active" : ""}`, onClick: (d) => this.handleTOCClick(e.id, d) }, e.text), s && /* @__PURE__ */ w("ul", { class: "doc-toc-list doc-toc-sublist" }, e.children.map((d) => this.renderTOCItem(d))));
1242
1252
  }
1243
1253
  render() {
1244
1254
  return this.items.length === 0 ? /* @__PURE__ */ w("aside", { class: "doc-toc" }, /* @__PURE__ */ w("div", { class: "doc-toc-empty" }, "暂无目录")) : /* @__PURE__ */ w("aside", { class: "doc-toc" }, /* @__PURE__ */ w("h3", { class: "doc-toc-title" }, "目录"), /* @__PURE__ */ w("nav", { class: "doc-toc-nav" }, /* @__PURE__ */ w("ul", { class: "doc-toc-list" }, this.items.map((e) => this.renderTOCItem(e)))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wsxjs/wsx-press",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "A VitePress-like documentation system built with WSXJS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -28,10 +28,10 @@
28
28
  "dependencies": {
29
29
  "fuse.js": "^7.0.0",
30
30
  "marked": "^12.0.0",
31
- "@wsxjs/wsx-core": "0.0.21",
32
- "@wsxjs/wsx-marked-components": "0.0.21",
33
- "@wsxjs/wsx-router": "0.0.21",
34
- "@wsxjs/wsx-logger": "0.0.21"
31
+ "@wsxjs/wsx-core": "0.0.22",
32
+ "@wsxjs/wsx-marked-components": "0.0.22",
33
+ "@wsxjs/wsx-router": "0.0.22",
34
+ "@wsxjs/wsx-logger": "0.0.22"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/fs-extra": "^11.0.4",
@@ -48,8 +48,8 @@
48
48
  "typescript": "^5.0.0",
49
49
  "vite": "^5.4.19",
50
50
  "vitest": "^2.0.0",
51
- "@wsxjs/wsx-vite-plugin": "0.0.21",
52
- "@wsxjs/eslint-plugin-wsx": "0.0.21"
51
+ "@wsxjs/eslint-plugin-wsx": "0.0.22",
52
+ "@wsxjs/wsx-vite-plugin": "0.0.22"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "typedoc": "^0.26.0",
@@ -30,6 +30,7 @@ export default class DocLayout extends LightComponent {
30
30
  }
31
31
 
32
32
  protected onConnected() {
33
+ super.onConnected?.();
33
34
  // 在连接后创建子组件实例
34
35
  requestAnimationFrame(() => {
35
36
  if (this.connected) {
@@ -58,6 +59,7 @@ export default class DocLayout extends LightComponent {
58
59
  }
59
60
 
60
61
  protected onDisconnected() {
62
+ super.onDisconnected?.();
61
63
  // 清理所有子组件实例
62
64
  if (this.sidebarInstance) {
63
65
  this.sidebarInstance.remove();
@@ -155,6 +155,7 @@ export default class DocPage extends LightComponent {
155
155
  }
156
156
 
157
157
  protected onConnected() {
158
+ super.onConnected?.();
158
159
  // 监听路由变化(当路由参数更新时重新加载文档)
159
160
  // 注意:使用 onRouteChange 确保在路由匹配完成后再加载文档
160
161
  this.routeChangeUnsubscribe = RouterUtils.onRouteChange(() => {
@@ -189,6 +190,7 @@ export default class DocPage extends LightComponent {
189
190
  }
190
191
 
191
192
  protected onDisconnected() {
193
+ super.onDisconnected?.();
192
194
  // 清理路由变化监听器
193
195
  if (this.routeChangeUnsubscribe) {
194
196
  this.routeChangeUnsubscribe();
@@ -85,6 +85,7 @@ export default class DocSearch extends LightComponent {
85
85
  }
86
86
 
87
87
  protected async onConnected() {
88
+ super.onConnected?.();
88
89
  // 预加载搜索索引
89
90
  try {
90
91
  const index = await loadSearchIndex();
@@ -36,6 +36,7 @@ export default class DocSidebar extends LightComponent {
36
36
  }
37
37
 
38
38
  protected async onConnected() {
39
+ super.onConnected?.();
39
40
  // 加载元数据
40
41
  await this.loadMetadata();
41
42
 
@@ -49,6 +50,7 @@ export default class DocSidebar extends LightComponent {
49
50
  }
50
51
 
51
52
  protected onDisconnected() {
53
+ super.onDisconnected?.();
52
54
  if (this.routeChangeUnsubscribe) {
53
55
  this.routeChangeUnsubscribe();
54
56
  this.routeChangeUnsubscribe = null;
@@ -77,6 +77,7 @@ export default class DocTOC extends LightComponent {
77
77
  }
78
78
 
79
79
  protected async onConnected() {
80
+ super.onConnected?.();
80
81
  // 加载 TOC 数据
81
82
  await this.loadTOC();
82
83
 
@@ -87,6 +88,7 @@ export default class DocTOC extends LightComponent {
87
88
  }
88
89
 
89
90
  protected onDisconnected() {
91
+ super.onDisconnected?.();
90
92
  if (this.observer) {
91
93
  this.observer.disconnect();
92
94
  this.observer = null;