weifuwu 0.81.3 → 0.81.4

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.
@@ -11,6 +11,8 @@ export interface CardProps {
11
11
  active?: boolean;
12
12
  onClick?: () => void;
13
13
  className?: string;
14
+ /** id 属性(锚点定位——AgentDetail Tab 导航用) */
15
+ id?: string;
14
16
  style?: Record<string, string>;
15
17
  children?: any;
16
18
  }
@@ -1,4 +1,4 @@
1
- import{h as so}from"weifuwu/ui-dom";var Cr={"chevron-down":["M6 9l6 6 6-6"],"chevron-up":["M6 15l6-6 6 6"],"chevron-left":["M15 18l-6-6 6-6"],"chevron-right":["M9 18l6-6-6-6"],"arrow-left":["M19 12H5","M12 19l-7-7 7-7"],"arrow-up":["M12 19V5","M5 12l7-7 7 7"],"arrow-down":["M12 5v14","M19 12l-7 7-7-7"],"arrow-right":["M5 12h14","M12 5l7 7-7 7"],sort:["M7 15l5 5 5-5","M7 9l5-5 5 5"],"sort-asc":["M12 19V5","M5 12l7-7 7 7"],"sort-desc":["M12 5v14","M19 12l-7 7-7-7"],check:["M20 6L9 17l-5-5"],close:["M18 6L6 18","M6 6l12 12"],alert:["M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","M12 9v4","M12 17h.01"],info:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 16v-4","M12 8h.01"],warning:["M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","M12 9v4","M12 17h.01"],pause:["M6 4h4v16H6z","M14 4h4v16h-4z"],settings:["M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],search:["M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z","M21 21l-4.35-4.35"],send:["M22 2L11 13","M22 2l-7 20-4-9-9-4 20-7z"],stop:["M6 6h12v12H6z"],retry:["M1 4v6h6","M23 20v-6h-6","M20.49 9A9 9 0 0 0 5.64 5.64L1 10","M3.51 15a9 9 0 0 0 14.85 3.36L23 14"],upload:["M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4","M17 8l-5-5-5 5","M12 3v12"],trash:["M3 6h18","M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2","M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14","M10 11v6","M14 11v6"],edit:["M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7","M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"],plus:["M12 5v14","M5 12h14"],copy:["M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2z","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"],eye:["M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],"eye-off":["M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94","M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19","M14.12 14.12a3 3 0 1 1-4.24-4.24","M1 1l22 22"],star:["M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"],dashboard:["M3 13h8V3H3z","M21 13h-8V9h8z","M21 21h-8v-8h8z","M3 21h8v-8H3z"],grid:["M3 3h7v7H3z","M14 3h7v7h-7z","M14 14h7v7h-7z","M3 14h7v7H3z"],box:["M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z","M3.27 6.96L12 12.01l8.73-5.05","M12 22.08V12"],users:["M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2","M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z","M23 21v-2a4 4 0 0 0-3-3.87","M16 3.13a4 4 0 0 1 0 7.75"],user:["M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2","M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"],home:["M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M9 22V12h6v10"],folder:["M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"],file:["M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z","M13 2v7h7"],"file-text":["M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z","M13 2v7h7","M9 13h6","M9 17h6"],calendar:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M16 3v4","M8 3v4","M3 11h18"],clock:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 6v6l4 2"],bell:["M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9","M13.73 21a2 2 0 0 1-3.46 0"],menu:["M3 12h18","M3 6h18","M3 18h18"],activity:["M22 12h-4l-3 9L9 3l-3 9H2"],"trending-up":["M23 6l-9.5 9.5-5-5L1 18","M17 6h6v6"],"trending-down":["M23 18l-9.5-9.5-5 5L1 6","M17 18h6v-6"],database:["M12 8c4.97 0 9-1.34 9-3s-4.03-3-9-3-9 1.34-9 3 4.03 3 9 3z","M21 12c0 1.66-4.03 3-9 3s-9-1.34-9-3","M3 5v14c0 1.66 4.03 3 9 3s9-1.34 9-3V5"],server:["M20 4H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z","M4 14h16","M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2","M7 18h.01","M12 18h.01"],heart:["M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"],refresh:["M23 4v6h-6","M1 20v-6h6","M3.51 9a9 9 0 0 1 14.85-3.36L23 10","M20.49 15a9 9 0 0 1-14.85 3.36L1 14"],message:["M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"],inbox:["M22 12h-6l-2 3h-4l-2-3H2","M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"],shield:["M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"],zap:["M13 2L3 14h9l-1 8 10-12h-9l1-8z"],target:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12z","M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"],mail:["M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z","M22 6l-10 7L2 6"],"external-link":["M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6","M15 3h6v6","M10 14L21 3"],"log-out":["M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4","M16 17l5-5-5-5","M21 12H9"],lock:["M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2z","M7 11V7a5 5 0 0 1 10 0v4"],list:["M8 6h13","M8 12h13","M8 18h13","M3 6h.01","M3 12h.01","M3 18h.01"],"bar-chart":["M12 20V10","M18 20V4","M6 20v-4"],gauge:["M12 15l3.5-3.5","M20.39 18.39A10 10 0 1 0 3.61 18.39","M12 15a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"],paperclip:["M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"],filter:["M22 3H2l8 9.46V19l4 2v-8.54L22 3z"],layers:["M12 2L2 7l10 5 10-5-10-5z","M2 17l10 5 10-5","M2 12l10 5 10-5"],"map-pin":["M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z","M15 10a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],"book-open":["M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"],github:["M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"],tag:["M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z","M7 7h.01"],phone:["M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"],"more-vertical":["M12 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","M12 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","M12 20a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"],"check-circle":["M22 11.08V12a10 10 0 1 1-5.93-9.14","M22 4L12 14.01l-3-3"],"alert-circle":["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 8v4","M12 16h.01"],wifi:["M5 12.55a11 11 0 0 1 14.08 0","M1.42 9a16 16 0 0 1 21.16 0","M8.53 16.11a6 6 0 0 1 6.95 0","M12 20h.01"],cpu:["M9 9h6v6H9z","M9 1v4","M15 1v4","M9 19v4","M15 19v4","M1 9h4","M1 15h4","M19 9h4","M19 15h4","M5 5h14v14H5z"],"hard-drive":["M22 12H2","M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z","M6 16h.01","M10 16h.01"],globe:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M2 12h20","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"],briefcase:["M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16","M2 20h20","M4 4h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"],layout:["M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z","M9 3v18","M3 9h18"]},T=async(l,n)=>async t=>{let{name:e,size:o,className:a}=t;return so("svg",{class:`wf-icon${a?" "+a:""}`,width:o??"1em",height:o??"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":1.8,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},Cr[e].map(s=>so("path",{d:s})))};import{h as ao}from"weifuwu/ui-dom";var lt=async(l,n)=>async t=>{let{variant:e="primary",size:o="md",block:a,loading:s,disabled:r,type:i,onClick:c,children:u}=t,d=["wf-btn",`wf-btn--${e}`,`wf-btn--${o}`,a&&"wf-btn--block",s&&"wf-btn--loading"].filter(Boolean).join(" "),m=n?.i18n?.components?.Button??{};return ao("button",{id:t.id,title:t.title,class:d,type:i??"button",disabled:r||s||void 0,"aria-busy":s||void 0,onClick:c},s?[ao("span",{class:"wf-btn-spinner"}),m.loading??"\u52A0\u8F7D\u4E2D..."]:u)};import{h as ct}from"weifuwu/ui-dom";var Ft=async l=>async n=>{let{label:t,name:e,type:o="text",value:a,placeholder:s,required:r,disabled:i,readonly:c,error:u,hint:d,variant:m="default",onInput:p,onChange:f,...g}=n,h=ct("input",{class:`wf-input${m==="borderless"?" wf-input--borderless":""}`,name:e||void 0,type:o,value:a??"",placeholder:s,required:r||void 0,disabled:i||void 0,readonly:c||void 0,onInput:p,onChange:f,...g});if(!t&&!u&&!d)return h;let y=[];if(t){let v=[t];r&&v.push(ct("span",{class:"wf-input-req"},"*")),y.push(ct("label",{class:"wf-input-label"},v))}return y.push(h),u&&y.push(ct("div",{class:"wf-input-err"},u)),d&&!u&&y.push(ct("div",{class:"wf-input-hint"},d)),ct("div",{class:`wf-input-wrap${u?" wf-input--err":""}`},y)};import{h as nt}from"weifuwu/ui-dom";var kr=async(l,n)=>async t=>{let{label:e,value:o,placeholder:a,required:s,disabled:r,error:i,hint:c,rows:u=3,maxLength:d,showCount:m,onInput:p}=t,f=nt("textarea",{class:"wf-textarea",value:o??"",placeholder:a,required:s||void 0,disabled:r||void 0,rows:u,maxLength:d,onInput:p}),g=[];if(e){let h=[e];s&&h.push(nt("span",{class:"wf-textarea-req"},"*")),g.push(nt("label",{class:"wf-textarea-label"},h))}if(g.push(f),m){let h=(o??"").length,y=d!=null&&h>d;g.push(nt("div",{class:`wf-textarea-count${y?" wf-textarea-count--over":""}`,"aria-live":"polite"},d!=null?`${h}/${d}`:String(h)))}return i&&g.push(nt("div",{class:"wf-textarea-err"},i)),c&&!i&&g.push(nt("div",{class:"wf-textarea-hint"},c)),nt("div",{class:`wf-textarea-wrap${i?" wf-textarea--err":""}`},g)};import{h as te}from"weifuwu/ui-dom";function Gt(l){return"options"in l&&!("value"in l)}function hn(l){return l?l.flatMap(n=>Gt(n)?n.options:[n]):[]}var Mr=async(l,n)=>async t=>{let{label:e,value:o,options:a,placeholder:s,required:r,disabled:i,error:c,onChange:u,children:d}=t,m=[];if(s&&m.push(te("option",{value:"",disabled:!0},s)),a)for(let g of a)Gt(g)?m.push(te("optgroup",{label:g.label},g.options.map(h=>te("option",{value:h.value,disabled:h.disabled},h.label)))):m.push(te("option",{value:g.value,disabled:g.disabled},g.label));let p=te("select",{class:"wf-select",value:o??"",required:r||void 0,disabled:i||void 0,onChange:g=>u?.(g.target.value)},d??m),f=[];if(e){let g=[e];r&&g.push(te("span",{class:"wf-select-req"},"*")),f.push(te("label",{class:"wf-select-label"},g))}return f.push(p),c&&f.push(te("div",{class:"wf-select-err"},c)),te("div",{class:`wf-select-wrap${c?" wf-select--err":""}`},f)},Pr=async(l,n)=>{let t=!1,e="",o=[],a=-1,s=!1,r;n.ui.useStableRef?.(()=>{},()=>{s=!0,r&&clearTimeout(r)});let i=null,c=null,u=p=>{p&&(i=p)},d=p=>{p&&(c=p)},m=n.ui.usePopup({trigger:()=>"click",placement:()=>"bottom",center:!1,gap:4,el:()=>i,isOpen:()=>t,setOpen:p=>{t=p,n.ui.render()}});return async p=>{let{label:f,value:g,options:h=[],placeholder:y,required:v,disabled:b,error:w,onChange:C,onSearch:M,multiple:E}=p,S=!!E,D=S?Array.isArray(g)?g:[]:[g],I=(V,H)=>{if(!H)return V;let X=H.toLowerCase();return V.flatMap(G=>{if(Gt(G)){let ee=G.options.filter(re=>re.label.toLowerCase().includes(X));return ee.length?[{label:G.label,options:ee}]:[]}return G.label.toLowerCase().includes(X)?[G]:[]})},O=e&&M&&o.length>0?o:I(h,e),L=hn(O),N=hn(h),P=N.find(V=>V.value===g),R=N.filter(V=>D.includes(V.value)),$=async V=>{if(e=V,t=!0,a=0,n.ui.render(),M&&V){let H=await M(V);H&&(o=H,n.ui.render())}},k=V=>{if(!V.disabled)if(S){let H=Array.isArray(g)?[...g]:[],X=H.indexOf(V.value);X>=0?H.splice(X,1):H.push(V.value),C?.(H)}else e="",t=!1,n.ui.render(),C?.(V.value)},x=V=>{if(!S)return;let H=Array.isArray(g)?[...g]:[];C?.(H.filter(X=>X!==V))},A=V=>{if(!b)if(V.key==="ArrowDown")V.preventDefault(),t=!0,a=Math.min(a+1,L.length-1),n.ui.render();else if(V.key==="ArrowUp")V.preventDefault(),t=!0,a=Math.max(a-1,0),n.ui.render();else if(V.key==="Enter"){V.preventDefault();let H=L[a];H&&k(H)}else V.key==="Escape"&&(V.preventDefault(),t=!1,e="",n.ui.render())},B=S&&R.length>0?R.map(V=>te("span",{class:"wf-select-tag",key:V.value},[V.label,te("button",{type:"button",class:"wf-select-tag-close","aria-label":`\u79FB\u9664 ${V.label}`,onClick:H=>{H.stopPropagation(),x(V.value)}},te(T,{name:"close",size:10}))])):[],z=S?"":t?e:P?.label??"",U=te("div",{key:"select-trigger",class:`wf-select-search-trigger${b?" wf-select-search--disabled":""}${w?" wf-select--err":""}`,ref:u,role:"combobox","aria-haspopup":"listbox","aria-expanded":String(t),onClick:b?void 0:()=>{t=!0,n.ui.render(),c?.focus()}},[...B,te("input",{key:"select-search-input",ref:d,class:"wf-select-search-input",type:"text",value:S?"":t?e:P?.label??"",placeholder:R.length>0?void 0:y??"",disabled:b,readOnly:!t||void 0,onInput:V=>$(V.target.value),onFocus:()=>{b||(t=!0,n.ui.render())},onBlur:()=>{r=setTimeout(()=>{s||(t=!1,e="",n.ui.render())},150)},onKeyDown:A})]),_=[];if(f){let V=[f];v&&V.push(te("span",{class:"wf-select-req"},"*")),_.push(te("label",{class:"wf-select-label"},V))}let j=0,J=(V,H)=>{let X=S?D.includes(V.value):V.value===g,G=te("div",{class:`wf-select-search-opt${X?" wf-select-search-opt--sel":""}${V.disabled?" wf-select-search-opt--dis":""}${a===H?" wf-select-search-opt--hl":""}`,key:V.value,onMouseDown:ee=>{ee.preventDefault(),k(V)}},V.label);return j++,G},Y=[];if(L.length>0)for(let V of O)if(Gt(V)){Y.push(te("div",{class:"wf-select-search-group",key:`group-${V.label}`},V.label));for(let H of V.options)Y.push(J(H,j))}else Y.push(J(V,j));else e&&Y.push(te("div",{class:"wf-select-search-empty"},"\u65E0\u5339\u914D"));let K=te("div",{class:"wf-select-search-menu"},Y),Xe=m.portal(K,"wf-select-menu");return _.push(te("div",{class:"wf-select-search"},[U,Xe].filter(Boolean))),w&&_.push(te("div",{class:"wf-select-err"},w)),te("div",{class:`wf-select-wrap${w?" wf-select--err":""}`},_)}},qt=async(l,n)=>{let t=await Mr(l,n),e=await Pr(l,n);return o=>o.searchable?e(o):t(o)};import{h as Pt}from"weifuwu/ui-dom";var yn=async(l,n)=>async t=>{let{label:e,checked:o,disabled:a,onChange:s}=t,r=Pt("input",{type:"checkbox",class:"wf-checkbox-input",checked:o||void 0,disabled:a||void 0,onChange:s?c=>s(c.target.checked):void 0}),i=Pt("span",{class:"wf-checkbox-visual"});return e?Pt("label",{class:"wf-checkbox"},[r,i,Pt("span",{class:"wf-checkbox-label"},e)]):Pt("label",{class:"wf-checkbox"},[r,i])};import{h as Tt}from"weifuwu/ui-dom";var Ut=async(l,n)=>async t=>{let{label:e,checked:o,disabled:a,onChange:s}=t,r=Tt("input",{type:"checkbox",class:"wf-switch-input",checked:o||void 0,disabled:a||void 0,role:"switch","aria-checked":String(!!o),onChange:s?u=>s(u.target.checked):void 0}),i=Tt("span",{class:"wf-switch-track"}),c=n?.i18n?.components?.Switch??{};return e?Tt("label",{class:"wf-switch"},[r,i,Tt("span",{class:"wf-switch-label"},e)]):Tt("label",{class:"wf-switch","aria-label":c.ariaLabel??"\u5207\u6362"},[r,i])};import{h as St}from"weifuwu/ui-dom";var Tr=async(l,n)=>async t=>{let{name:e,options:o=[],inline:a}=t,s=n?.ui?.useControlled({value:t.value,onChange:t.onChange,name:"RadioGroup"}),r=c=>{let u=s?.controlled;s?.setValue(c),u||t.onChange?.(c)},i=o.map(c=>{let u=St("input",{type:"radio",class:"wf-radio-input",name:e??"radio",value:c.value,checked:s?.value===c.value||void 0,disabled:c.disabled||void 0,onChange:()=>r(c.value)}),d=St("span",{class:"wf-radio-visual"}),m=St("span",{class:"wf-radio-label-text"},c.label);return St("label",{class:"wf-radio",key:c.value},[u,d,m])});return St("div",{class:`wf-radio-group${a?" wf-radio-group--inline":""}`},i)};import{h as ce}from"weifuwu/ui-dom";function Sr(l,n,t,e){if(!t||!e)return l;let o=n.find(s=>s.key===t);if(!o||!o.sortable)return l;let a=[...l];return a.sort((s,r)=>{let i=s[t],c=r[t],u=o.sorter?o.sorter(i,c):String(i??"").localeCompare(String(c??""));return e==="desc"?-u:u}),a}var Er=async(l,n)=>async t=>{let{data:e=[],columns:o,onRowClick:a,sortKey:s,sortOrder:r,onSort:i,emptyText:c,rowSelection:u}=t,d=Sr(e,o,s,r),m=(L,N)=>L[u?.rowKey??"id"]??N,p=u?.selectedRowKeys??[],f=new Set(p.map(String)),g=d.map((L,N)=>String(m(L,N))),h=g.length>0&&g.every(L=>f.has(L)),y=g.some(L=>f.has(L)),v=()=>{if(!u?.onChange)return;let L=h?[]:g.map(N=>d.find((P,R)=>String(m(P,R))===N));u.onChange(h?[]:g,h?[]:L)},b=(L,N)=>{if(!u?.onChange)return;let P=String(m(L,N)),R=f.has(P)?p.filter(k=>String(k)!==P):[...p,P],$=R.map(k=>d.find((x,A)=>String(m(x,A))===String(k))).filter(Boolean);u.onChange(R,$)},w=u?ce("th",{class:"wf-table-th wf-table-th--selection",scope:"col"},ce("input",{type:"checkbox",class:"wf-table-checkbox",checked:h||void 0,indeterminate:y&&!h?"true":void 0,"aria-label":"\u5168\u9009",onChange:v})):null,C=(L,N)=>u?ce("td",{class:"wf-table-td wf-table-td--selection"},ce("input",{type:"checkbox",class:"wf-table-checkbox",checked:f.has(String(m(L,N)))||void 0,"aria-label":"\u9009\u62E9\u884C",onClick:P=>P.stopPropagation(),onChange:()=>b(L,N)})):null,M=o.map(L=>{let N=L.key===s&&r,P=r==="asc",R=L.label,$=L.sortable?ce(T,{name:N?P?"sort-asc":"sort-desc":"sort",className:`wf-table-sort-icon${N?" wf-table-sort-icon--active":""}`}):null,k=L.sortable&&i?()=>i(L.key,N&&P?"desc":"asc"):void 0;return ce("th",{class:`wf-table-th${L.sortable?" wf-table-th--sortable":""}${N?" wf-table-th--sorted":""}`,scope:"col",tabindex:L.sortable?0:void 0,style:L.width?{width:L.width}:void 0,onClick:k,onKeyDown:k?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),k())}:void 0},[R,$].filter(Boolean))}),E=ce("tr",{class:"wf-table-tr"},[w,...M].filter(Boolean)),S=ce("thead",{class:"wf-table-thead"},E),D;if(t.loading){let L=t.loadingRows??3;D=Array.from({length:L},(N,P)=>ce("tr",{class:"wf-table-tr wf-table-tr--loading",key:`loading-${P}`},o.map((R,$)=>ce("td",{class:"wf-table-td",key:`${P}-${$}`},ce("span",{class:"wf-skeleton wf-skeleton--text"})))))}else if(d.length===0&&c){let L=o.length+(u?1:0);D=[ce("tr",{class:"wf-table-tr"},ce("td",{class:"wf-table-td wf-table-empty",colspan:L,style:{textAlign:"center"}},c))]}else D=d.map((L,N)=>{let P=o.map($=>{let k=L[$.key],x=$.render?$.render(k,L,N):String(k??"");return ce("td",{class:"wf-table-td"},x)}),R=C(L,N);return ce("tr",{class:"wf-table-tr",onClick:a?()=>a(L,N):void 0,style:a?{cursor:"pointer"}:void 0},[R,...P].filter(Boolean))});let I=ce("tbody",{class:"wf-table-tbody"},D),O=ce("table",{class:"wf-table",style:t.minWidth?{minWidth:t.minWidth}:void 0},[S,I]);return ce("div",{class:"wf-table-wrap"},O)};import{h as Ge}from"weifuwu/ui-dom";var pt=async(l,n)=>{let t=!1,e=n.ui.usePopup({presence:!0,trapFocus:!0,lockScroll:!0,positioning:"none",closeOnOutside:!1,closeOnEscape:!1,isOpen:()=>t,setOpen:()=>{}}),o;return n.ui.useGlobalKey(a=>{a.key==="Escape"&&e.phase==="open"&&o?.()}),async a=>{let{open:s,title:r,onClose:i,children:c,footer:u,width:d,closable:m=!0,maskClosable:p=!0}=a;o=i,t=!!s;let f=n?.i18n?.components?.Modal??{},g=e.sync(t);if(g==="closed")return null;let h=Ge("div",{class:"wf-modal-overlay",onClick:p?i:void 0}),y=m?Ge("button",{class:"wf-modal-close",onClick:i,type:"button","aria-label":f.closeAria??"\u5173\u95ED"},Ge(T,{name:"close"})):null,v=r?Ge("div",{class:"wf-modal-header"},[r,y].filter(Boolean)):null,b=Ge("div",{class:"wf-modal-body"},c),w=u?Ge("div",{class:"wf-modal-footer"},u):null,C=Ge("div",{class:"wf-modal-content",onClick:E=>E.stopPropagation(),style:d?{minWidth:`min(${d}, calc(100vw - 32px))`,maxWidth:`min(${d}, calc(100vw - 32px))`}:void 0},[v,b,w].filter(Boolean)),M=Ge("div",{class:`wf-modal ${g==="exit"?"wf-modal--exit":"wf-modal--enter"}`,role:"dialog","aria-modal":"true","aria-label":r??f.ariaLabel??"\u5F39\u7A97"},[h,C]);return e.portal(M,"modal")}};import{createClientBrowser as Lr}from"weifuwu/ui-dom";import{h as ut}from"weifuwu/ui-dom";import{mountCommand as $r,unmountCommand as Ir}from"weifuwu/ui-dom";var Jt=Lr();function Ar(){return l=>(l.confirm=(n,t)=>Dr(n,t??{},l),l)}function Dr(l,n,t){return new Promise(e=>{let o=Jt.createElement("div");if(!o){e(!1);return}Jt.bodyAppend(o);let a=!1,s,r=null;r=ut(async(c,u)=>{let d=!0;return s=m=>{if(a)return;a=!0,d=!1,u.ui.render(),e(m);let p=()=>{r&&Ir(o,r,t)},f=Jt.query("#__wf_portal .wf-modal");if(f&&typeof f.addEventListener=="function"){let g=!1,h=()=>{g||(g=!0,p())};f.addEventListener("animationend",h,{once:!0}),Jt.timeout(h,600)}else p()},async()=>ut("div",{class:"wf-confirm-host"},ut(io,{open:d,title:n.title,message:l,confirmText:n.confirmText,cancelText:n.cancelText,variant:n.variant,width:n.width,maskClosable:n.maskClosable,onConfirm:()=>s?.(!0),onCancel:()=>s?.(!1)}))},{}),$r(o,r,t)})}var io=async(l,n)=>async t=>{let{open:e=!1,title:o,message:a,confirmText:s,cancelText:r,variant:i="primary",width:c,maskClosable:u=!1,onConfirm:d,onCancel:m}=t,p=n?.i18n?.components?.Confirm??{},f=[ut(lt,{variant:"secondary",size:"md",onClick:()=>m?.()},r??p.cancelText??"\u53D6\u6D88"),ut(lt,{variant:i,size:"md",onClick:()=>d?.()},s??p.confirmText??"\u786E\u5B9A")];return ut(pt,{open:e,title:o,onClose:m,maskClosable:u,footer:f,width:c,closable:!1},a)};import{createClientBrowser as Or}from"weifuwu/ui-dom";import{h as Ne}from"weifuwu/ui-dom";import{mountCommand as Rr}from"weifuwu/ui-dom";import{animateOut as Br}from"weifuwu/ui-dom";var bn=Or();function Nr(l){return{"top-right":"wf-toast--tr","top-left":"wf-toast--tl","bottom-right":"wf-toast--br","bottom-left":"wf-toast--bl","top-center":"wf-toast--tc"}[l]??"wf-toast--tr"}var lo=async(l,n)=>async t=>{let{toasts:e=[],onRemove:o,position:a="top-right",duration:s=0,max:r=0}=t,i=n.ui.usePopup?.({positioning:"none",closeOnOutside:!1,closeOnEscape:!1,isOpen:()=>!0,setOpen:()=>{}}),c=r>0&&e.length>r?e.slice(-r):e;if(c.length===0)return null;let u=c.map(d=>Ne("div",{class:`wf-toast wf-toast--${d.type}`,key:d.id,role:d.type==="error"?"alert":"status","aria-live":d.type==="error"?"assertive":"polite","data-id":d.id,"data-duration":(d.duration??s)||void 0,onClick:o?()=>o(d.id):void 0},[Ne("span",{class:"wf-toast-icon"},Ne(T,{name:Hr(d.type)})),Ne("span",{class:"wf-toast-msg"},d.message),d.action?Ne("button",{class:`wf-toast-action wf-toast-action--${d.type}`,type:"button",onClick:m=>{m.stopPropagation(),d.action.onClick()}},d.action.label):null].filter(Boolean)));return i.portal(Ne("div",{class:`wf-toast-container ${Nr(a)}`,"data-max":r||void 0},u),"toast")};function Hr(l){switch(l){case"success":return"check";case"error":return"close";case"warning":return"alert";case"info":return"info"}}function zr(l){let n={position:l?.position??"top-right",duration:l?.duration??3e3,max:l?.max??3},t=null,e=null,o=0,a=async(r,i)=>{let c=[],u=()=>i.ui.render();return t={add:d=>{c=[...c,d],u()},remove:d=>{let m=bn.query(`.wf-toast[data-id="${d}"]`);if(m){m.classList.add("wf-toast-out");let p=getComputedStyle(m).animationName;if(p&&p!=="none"){Br(m,()=>{c=c.filter(f=>f.id!==d),u()});return}}c=c.filter(p=>p.id!==d),u()}},async()=>Ne("div",{class:"wf-toast-host"},[Ne(lo,{toasts:c,position:n.position,duration:n.duration,max:n.max,onRemove:d=>t?.remove(d)})])},s=()=>{if(t||!e)return;let r=bn.createElement("div");r&&(bn.bodyAppend(r),Rr(r,Ne(a,{}),e))};return r=>(e=r,r.toast=(i,c="info",u,d)=>{s();let m=String(++o);t?.add({id:m,type:c,message:i,duration:u,action:d});let p=u??n.duration;p>0&&setTimeout(()=>t?.remove(m),p)},r)}import{h as dt}from"weifuwu/ui-dom";var wn=async(l,n)=>async t=>{let{variant:e="info",closable:o,onClose:a,children:s}=t;if(!s)return null;let r=dt("span",{class:"wf-alert-icon"},dt(T,{name:_r(e)})),i=o?dt("button",{class:"wf-alert-close",onClick:a,type:"button","aria-label":"\u5173\u95ED"},dt(T,{name:"close"})):null,c=dt("span",{class:"wf-alert-msg"},s);return dt("div",{class:`wf-alert wf-alert--${e}`,role:"alert"},[r,c,i].filter(Boolean))};function _r(l){switch(l){case"success":return"check";case"error":return"close";case"warning":return"alert";case"info":return"info"}}import{h as vn}from"weifuwu/ui-dom";var jr=async(l,n)=>async t=>{let{text:e="\u52A0\u8F7D\u4E2D..."}=t;return vn("div",{class:"wf-loading",role:"status","aria-live":"polite"},[vn("div",{class:"wf-loading-spinner"}),vn("span",{class:"wf-loading-text"},e)])};import{h as ft}from"weifuwu/ui-dom";var Kr=async(l,n)=>async t=>{let{icon:e=ft(T,{name:"inbox"}),text:o="\u6682\u65E0\u6570\u636E",hint:a,children:s}=t,r=[ft("div",{class:"wf-empty-icon"},e),ft("div",{class:"wf-empty-text"},o)];return a&&r.push(ft("div",{class:"wf-empty-hint"},a)),s&&r.push(ft("div",{class:"wf-empty-action"},s)),ft("div",{class:"wf-empty",role:"status"},r)};import{createClientBrowser as Wr}from"weifuwu/ui-dom";import{h as Et}from"weifuwu/ui-dom";var Vr=async(l,n)=>{let t=n?.browser??Wr(),e=0,o=0,a=null,s=c=>{c&&(e=c.offsetLeft,o=c.offsetWidth,n.ui.render())},r=()=>{a&&s(a.querySelector(".wf-tab--active"))},i=c=>{c&&(a=c,queueMicrotask(r))};return async c=>{let{items:u=[]}=c;if(u.length===0)return null;let d=n?.ui?.useControlled({value:c.active,onChange:c.onChange,name:"Tabs"}),m=b=>{let w=d?.controlled;d?.setValue(b),w||c.onChange?.(b)},p=d?.value??u[0].key,f=b=>{let w=b.currentTarget,C=Array.from(w.querySelectorAll(".wf-tab")),M=C.indexOf(t?.activeElement()??null);if(M<0||!d)return;let E=M;if(b.key==="ArrowRight")E=(M+1)%C.length;else if(b.key==="ArrowLeft")E=(M-1+C.length)%C.length;else if(b.key==="Home")E=0;else if(b.key==="End")E=C.length-1;else return;b.preventDefault();let S=u[E];S&&S.key!==u[M].key&&(m(S.key),C[E].focus(),s(C[E]))},g=u.map(b=>Et("button",{class:`wf-tab${b.key===p?" wf-tab--active":""}`,key:b.key,role:"tab",tabindex:b.key===p?0:-1,"aria-selected":b.key===p?"true":"false",onClick:b.key!==p?(w=>{s(w?.currentTarget),m(b.key)}):void 0},b.label)),h=Et("span",{class:"wf-tab-ink",style:{transform:`translateX(${e}px)`,width:`${o}px`},"aria-hidden":"true"}),y=u.find(b=>b.key===p),v=y?.content?Et("div",{class:"wf-tab-content",role:"tabpanel"},y.content):null;return Et("div",{class:"wf-tabs",role:"tablist",onKeyDown:f},[Et("div",{class:"wf-tab-list",ref:i},[...g,h]),v].filter(Boolean))}};import{h as xn}from"weifuwu/ui-dom";var Fr=async(l,n)=>{let t=null,e=i=>{t=i},o=null,a=0,s=!1,r=n.ui.usePopup({trigger:"click",el:()=>t,isOpen:()=>o?.open??!1,setOpen:i=>o?.setOpen(i)});return async i=>{let{trigger:c,items:u=[]}=i;o=n.ui.useOpen({open:i.open,onOpenChange:i.onOpenChange,name:"Dropdown"});let d=!!o?.open;d&&!s&&(a=0),s=d;let m=g=>{let h=g.key;if(h==="Escape")return;let y=u.map((w,C)=>w.disabled?-1:C).filter(w=>w>=0);if(!y.length)return;let v=y.indexOf(a),b=v>=0?v:0;if(h==="ArrowDown"||h==="ArrowRight")g.preventDefault(),a=y[Math.min(b+1,y.length-1)],n.ui.render();else if(h==="ArrowUp"||h==="ArrowLeft")g.preventDefault(),a=y[Math.max(b-1,0)],n.ui.render();else if(h==="Home")g.preventDefault(),a=y[0],n.ui.render();else if(h==="End")g.preventDefault(),a=y[y.length-1],n.ui.render();else if(h==="Enter"||h===" "){let w=u[a];w&&!w.disabled&&(g.preventDefault(),w.onClick?.(),o?.setOpen(!1))}},p=u.map((g,h)=>xn("button",{class:["wf-dropdown-item",g.variant==="danger"?" wf-dropdown-item--danger":"",h===a&&d?" wf-dropdown-item--hl":""].filter(Boolean).join(" "),key:g.value??h,disabled:g.disabled||void 0,role:"menuitem","aria-selected":String(h===a&&d),onClick:g.disabled?void 0:()=>{g.onClick?.()}},g.label)),f=xn("div",{class:"wf-dropdown-menu",role:"menu",onKeyDown:m},p);return xn("div",{class:`wf-dropdown${o?.open?" wf-dropdown--open":""}`,ref:e,...r.wrapProps,"aria-haspopup":"menu","aria-expanded":String(!!o?.open)},[c,r.portal(f,"dropdown")].filter(Boolean))}};import{h as ot}from"weifuwu/ui-dom";var Gr=async(l,n)=>async t=>{let{total:e,pageSize:o=20}=t,a=n?.ui?.useControlled({value:t.page,onChange:t.onChange,name:"Pagination"}),s=a?.value??1,r=m=>{let p=a?.controlled;a?.setValue(m),p||t.onChange?.(m)},i=n?.i18n?.components?.Pagination??{},c=Math.max(1,Math.ceil(e/o));if(c<=1)return null;let u=[];u.push(ot("button",{class:`wf-page-btn${s<=1?" wf-page-btn--disabled":""}`,disabled:s<=1,"aria-label":i.prevAria??"\u4E0A\u4E00\u9875",onClick:s>1?()=>r(s-1):void 0},ot(T,{name:"chevron-left"})));let d=qr(s,c);for(let m of d)m==="..."?u.push(ot("span",{class:"wf-page-ellipsis"},"...")):u.push(ot("button",{class:`wf-page-btn${m===s?" wf-page-btn--active":""}`,"aria-current":m===s?"page":void 0,onClick:m!==s?()=>r(m):void 0},String(m)));return u.push(ot("button",{class:`wf-page-btn${s>=c?" wf-page-btn--disabled":""}`,disabled:s>=c,"aria-label":i.nextAria??"\u4E0B\u4E00\u9875",onClick:s<c?()=>r(s+1):void 0},ot(T,{name:"chevron-right"}))),ot("nav",{class:"wf-pagination","aria-label":i.ariaLabel??"\u5206\u9875"},u)};function qr(l,n){if(n<=7)return Array.from({length:n},(a,s)=>s+1);let t=[1];l>3&&t.push("...");let e=Math.max(2,l-1),o=Math.min(n-1,l+1);for(let a=e;a<=o;a++)t.push(a);return l<n-2&&t.push("..."),t.push(n),t}import{h as Ur}from"weifuwu/ui-dom";var Cn=async(l,n)=>async t=>{let{variant:e="default",padding:o="md",clickable:a,hover:s,active:r,onClick:i,className:c,style:u,children:d}=t,m=["wf-card",`wf-card--${e}`,`wf-card--pad-${o}`,a&&"wf-card--clickable",s&&"wf-card--hover",r&&"wf-card--active",(a||s)&&"wf-elevate"].filter(Boolean).join(" ");return Ur("div",{class:c?`${m} ${c}`:m,style:u,onClick:i,role:a?"button":void 0,tabindex:a?0:void 0,onKeyDown:a?p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i?.())}:void 0},d)};import{h as kn}from"weifuwu/ui-dom";var Jr=async(l,n)=>async t=>{let{variant:e="default",dot:o,children:a,count:s,overflowCount:r=99,showZero:i=!1}=t;if(o)return kn("span",{class:`wf-badge-dot wf-badge-dot--${e}`});if(s!=null){if(s===0&&!i)return null;let c=s>r?`${r}+`:String(s);return kn("span",{class:`wf-badge wf-badge--count wf-badge--${e}`,"aria-label":`${s>r?`\u8D85\u8FC7 ${r}`:s} \u6761`},c)}return kn("span",{class:`wf-badge wf-badge--${e}`},a??"")};import{h as co}from"weifuwu/ui-dom";var po=["#4f6ef7","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"];function Yr(l){let n=0;for(let t=0;t<l.length;t++)n=l.charCodeAt(t)+((n<<5)-n);return po[Math.abs(n)%po.length]}var Mn=async(l,n)=>async t=>{let{name:e="",src:o,size:a="md",color:s}=t,r=Array.from(e.trim())[0]?.toUpperCase()??"?";return o?co("img",{class:`wf-avatar wf-avatar--${a}`,src:o,alt:e}):co("div",{class:`wf-avatar wf-avatar--${a}`,style:{background:s??Yr(e)}},r)};import{h as Yt}from"weifuwu/ui-dom";var Qr=async(l,n)=>async t=>{let{closable:e,onClose:o,variant:a="default",children:s}=t,r=e?Yt("button",{class:"wf-tag-close",onClick:o,type:"button","aria-label":"\u79FB\u9664"},Yt(T,{name:"close"})):null;return Yt("span",{class:`wf-tag wf-tag--${a}`},[Yt("span",{class:"wf-tag-text"},s),r].filter(Boolean))};import{h as qe}from"weifuwu/ui-dom";var Xr=async(l,n)=>{let t=n.ui.useTween(0,{duration:400,ease:"easeOutCubic"}),e=0,o=null,a,s=()=>{o&&(clearInterval(o),o=null)};return async r=>{let{label:i,value:c,trend:u,trendLabel:d,icon:m,onClick:p,animate:f,countdown:g,onFinish:h}=r;a=h;let y=typeof c=="number"?c:0;f&&typeof c=="number"?t.reset(y):t.value=y,g!==void 0?(e=Math.max(0,Math.ceil((g-Date.now())/1e3)),o||(o=setInterval(()=>{e=Math.max(0,Math.ceil((g-Date.now())/1e3)),e<=0&&(s(),a?.()),n.ui.render()},1e3))):o&&s();let v=g!==void 0?(()=>{let w=Math.floor(e/3600),C=Math.floor(e%3600/60),M=e%60,E=S=>String(S).padStart(2,"0");return w>0?`${E(w)}:${E(C)}:${E(M)}`:`${E(C)}:${E(M)}`})():String(typeof c=="number"?t.value:c??""),b=[];return m&&b.push(qe("div",{class:"wf-stat-icon"},m)),b.push(qe("div",{class:"wf-stat-value wf-nums"},v)),b.push(qe("div",{class:"wf-stat-label"},i)),u&&b.push(qe("div",{class:`wf-stat-trend wf-stat-trend--${u}`},[qe("span",{class:"wf-stat-trend-arrow"},qe(T,{name:u==="up"?"arrow-up":"arrow-down"})),d?qe("span",{class:"wf-stat-trend-label"},d):null].filter(Boolean))),qe("div",{class:`wf-stat${p?" wf-stat--clickable":""}${p?" wf-elevate":""}`,onClick:p,role:p?"button":void 0,tabindex:p?0:void 0,onKeyDown:p?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),p())}:void 0},b)}};import{h as Ue}from"weifuwu/ui-dom";var Zr=async(l,n)=>async t=>{let{items:e=[],active:o,current:a=0}=t,s=o??e[a]?.key,r=e.map((i,c)=>{let u=e.findIndex(v=>v.key===s),d=c<u,m=c===u,p=["wf-step",d&&"wf-step--done",m&&"wf-step--current"].filter(Boolean).join(" "),f=d?Ue("span",{class:"wf-step-num"},Ue(T,{name:"check"})):Ue("span",{class:"wf-step-num"},String(c+1)),g=Ue("span",{class:"wf-step-label"},i.label),h=i.description?Ue("span",{class:"wf-step-desc"},i.description):null,y=c<e.length-1?Ue("span",{class:`wf-step-connector${d?" wf-step-connector--done":""}`}):null;return Ue("div",{class:p,key:i.key,role:"listitem","aria-current":m?"step":void 0},[f,g,h,y].filter(Boolean))});return Ue("div",{class:"wf-steps",role:"list"},r)};import{h as es}from"weifuwu/ui-dom";async function ts(l,n){let t={};for(let[e,o]of Object.entries(n)){let a=l[e]??"";for(let s of o){if(s.required&&!String(a).trim()){t[e]=s.message;break}if(s.pattern&&!s.pattern.test(String(a))){t[e]=s.message;break}if(s.minLength!=null&&String(a).length<s.minLength){t[e]=s.message;break}if(s.maxLength!=null&&String(a).length>s.maxLength){t[e]=s.message;break}if(s.validator){let r=await s.validator(a);if(r!==!0){t[e]=typeof r=="string"?r:s.message;break}}}}return t}var ns=async(l,n)=>async t=>{let{validation:e,onSubmit:o,onError:a,children:s}=t;return es("form",{class:"wf-form",onSubmit:async i=>{i.preventDefault();let c=i.target,u=new FormData(c),d={};for(let[m,p]of u.entries())if(m in d){let f=d[m];d[m]=Array.isArray(f)?[...f,p]:[f,p]}else d[m]=p;if(e){let m=await ts(d,e);if(Object.keys(m).length>0){a?.(m);return}a?.({})}await o?.(d)},noValidate:e?!0:void 0},s)};import{h as Lt}from"weifuwu/ui-dom";var mt=async(l,n)=>async t=>{let{label:e,required:o,error:a,hint:s,children:r}=t,i=[];if(e){let c=[e];o&&c.push(Lt("span",{class:"wf-field-req"},"*")),i.push(Lt("label",{class:"wf-field-label"},c))}return i.push(r),a&&i.push(Lt("div",{class:"wf-field-err"},a)),s&&!a&&i.push(Lt("div",{class:"wf-field-hint"},s)),Lt("div",{class:`wf-field${a?" wf-field--err":""}`},i)};import{h as gt}from"weifuwu/ui-dom";var os=async(l,n)=>async t=>{let{label:e,value:o=0,min:a=0,max:s=100,step:r=1,onChange:i,disabled:c}=t,u=Number(o),d=s>a?(u-a)/(s-a)*100:0,m=`linear-gradient(to right, var(--wf-color-primary) ${d}%, var(--wf-color-border) ${d}%)`,p=gt("input",{type:"range",class:["wf-slider-input",c?"wf-slider-input--dis":""].filter(Boolean).join(" "),value:u,min:a,max:s,step:r,disabled:c||void 0,"aria-label":e,"aria-disabled":c?"true":void 0,style:{background:m},onChange:c||!i?void 0:g=>i(Number(g.target.value))}),f=gt("span",{class:"wf-slider-value"},String(u));return e?gt("div",{class:"wf-slider-wrap"},[gt("label",{class:"wf-slider-label"},e),gt("div",{class:"wf-slider"},[p,f])]):gt("div",{class:"wf-slider"},[p,f])};import{h as ht}from"weifuwu/ui-dom";var rs=async(l,n)=>{let t=!1;return async e=>{let{value:o,placeholder:a="\u641C\u7D22...",onInput:s,onClear:r,disabled:i}=e,c=o!==void 0,u=o??"",d=c&&u&&r?ht("button",{class:"wf-search-clear",type:"button","aria-label":"\u6E05\u9664",onClick:r},ht(T,{name:"close"})):null,m=ht("span",{class:"wf-search-icon"},ht(T,{name:"search"}));return ht("div",{class:d?"wf-search wf-search--has-clear":"wf-search"},[m,ht("input",{class:["wf-search-input",i?"wf-search-input--dis":""].filter(Boolean).join(" "),type:"search",value:c?u:void 0,placeholder:a,disabled:i||void 0,"aria-disabled":i?"true":void 0,onInput:p=>{t||p.isComposing||s?.(p)},onCompositionStart:()=>{t=!0},onCompositionEnd:p=>{t=!1,s?.(p)}}),d].filter(Boolean))}};import{h as uo}from"weifuwu/ui-dom";var ss=async(l,n)=>async t=>{let{options:e,size:o="md",block:a,ariaLabel:s}=t,r=n?.ui?.useControlled({value:t.value,onChange:t.onChange,name:"SegmentedControl"}),i=u=>{let d=r?.controlled;r?.setValue(u),d||t.onChange?.(u)},c=["wf-segmented",o==="sm"&&"wf-segmented--sm",a&&"wf-segmented--block"].filter(Boolean).join(" ");return uo("div",{class:c,role:"group","aria-label":s},e.map(u=>uo("button",{type:"button",class:`wf-segmented-option${u.value===r?.value?" wf-segmented-option--active":""}`,"aria-pressed":u.value===r?.value?"true":"false",disabled:u.disabled||void 0,onClick:u.disabled?void 0:()=>i(u.value)},u.label)))};import{h as $t}from"weifuwu/ui-dom";var as=async(l,n)=>async t=>{let{value:e,max:o=100,label:a,showValue:s,status:r="default",size:i="md"}=t,c=e==null,u=c?0:Math.min(100,Math.max(0,e/o*100)),d=n?.i18n?.components?.ProgressBar??{},m=$t("div",{class:`wf-progress wf-progress--${i}${c?" wf-progress--indeterminate":""}${r!=="default"?` wf-progress--${r}`:""}`,role:"progressbar","aria-valuenow":c?void 0:Math.round(e),"aria-valuemin":0,"aria-valuemax":Math.round(o),"aria-label":a??d.ariaLabel??"\u8FDB\u5EA6"},[$t("div",{class:`wf-progress-fill${r!=="default"?` wf-progress-fill--${r}`:""}`,style:c?void 0:{width:`${u}%`}})]);if(!a&&!s)return m;let p=[];return a&&p.push($t("span",{class:"wf-progress-label"},a)),p.push(m),s&&!c&&p.push($t("span",{class:"wf-progress-value"},`${Math.round(u)}%`)),$t("div",{class:"wf-progress-wrap"},p)};import{createClientBrowser as is}from"weifuwu/ui-dom";import{h as It}from"weifuwu/ui-dom";var ls=async(l,n)=>{let t=n.browser??is(),e=[],o=[],a=new Map,s=r=>{let i=a.get(r);return i||(i=c=>{c&&(o[r]=c)},a.set(r,i)),i};return async r=>{let{items:i=[],active:c,onChange:u,multiple:d=!1}=r;e.length===0&&i.length>0&&(e=i.map(b=>b.key));let m=c!==void 0,p=m?c:e,f=b=>p.includes(b),g=b=>{m?u?.(b):(e=b,n.ui.render())},h=b=>{f(b)?g(p.filter(w=>w!==b)):g(d?[...p,b]:[b])},y=b=>{let w=t?.activeElement()??null,C=o.indexOf(w);if(C<0)return;let M=C;if(b.key==="ArrowDown"||b.key==="ArrowRight")M=(C+1)%i.length;else if(b.key==="ArrowUp"||b.key==="ArrowLeft")M=(C-1+i.length)%i.length;else return;b.preventDefault(),o[M]?.focus()};if(i.length===0)return null;let v=i.map((b,w)=>{let C=f(b.key);return It("div",{class:`wf-accordion-item${C?" wf-accordion-item--open":""}`,key:b.key},[It("button",{type:"button",class:"wf-accordion-summary",ref:s(w),disabled:b.disabled||void 0,"aria-expanded":C?"true":"false",onClick:b.disabled?void 0:()=>h(b.key)},[b.title,It(T,{name:"chevron-down",size:14,className:"wf-accordion-arrow"})]),C&&b.content?It("div",{class:"wf-accordion-content"},b.content):null].filter(Boolean))});return It("div",{class:"wf-accordion",onKeyDown:y},v)}};import{h as At}from"weifuwu/ui-dom";var cs=async(l,n)=>async t=>{let{title:e,sub:o,display:a,children:s}=t;return At("div",{class:"wf-page-head"},[At("div",{class:"wf-page-head-left"},[At("h2",{class:`wf-page-title${a?" wf-page-title--display":""}`},e),o?At("p",{class:"wf-page-sub"},o):null].filter(Boolean)),s?At("div",{class:"wf-page-head-actions"},s):null].filter(Boolean))};import{h as Dt}from"weifuwu/ui-dom";var ps=async(l,n)=>async t=>{let{items:e}=t,o=e.flatMap((s,r)=>{let i=r===e.length-1,c=i?Dt("span",{class:"wf-breadcrumb-current","aria-current":"page"},s.label):s.href?Dt("a",{class:"wf-breadcrumb-link",href:s.href},s.label):Dt("span",{class:"wf-breadcrumb-text"},s.label);return i?c:[c,Dt("span",{class:"wf-breadcrumb-sep","aria-hidden":"true"},"/")]}),a=n?.i18n?.components?.Breadcrumb??{};return Dt("nav",{class:"wf-breadcrumb","aria-label":a.ariaLabel??"\u9762\u5305\u5C51"},o)};import{h as Pn}from"weifuwu/ui-dom";var us=async(l,n)=>async t=>{let{vertical:e,children:o}=t;return e?Pn("div",{class:"wf-divider wf-divider--vertical",role:"separator"}):Pn("div",{class:o?"wf-divider wf-divider--with-text":"wf-divider",role:"separator"},o?Pn("span",{class:"wf-divider-text"},o):void 0)};import{h as ae}from"weifuwu/ui-dom";function fo(l){return l<1024?`${l}B`:l<1024*1024?`${(l/1024).toFixed(1)}KB`:`${(l/(1024*1024)).toFixed(1)}MB`}var Tn=async(l,n)=>{let t=n?.i18n?.components?.FileUpload??{},e=null,o=p=>{p&&(e=p)},a=new Map,s=p=>`${p.name}:${p.size}`,r=p=>{if(!p.type.startsWith("image/"))return;let f=s(p),g=a.get(f);return!g&&typeof URL<"u"&&URL.createObjectURL&&(g=URL.createObjectURL(p),a.set(f,g)),g},i=p=>{if(!p){for(let f of a.values())URL.revokeObjectURL?.(f);a.clear()}},c=!1,u={...l},d=!1,{dropProps:m}=n.ui.useDragDrop({onDrop:p=>{if(d=!1,n.ui.render(),u.disabled)return;let f=Array.from(p.dataTransfer?.files??[]);u.maxSize&&f.filter(h=>h.size>u.maxSize).length>0||u.onChange?.(f)},onDragOver:()=>{d||(d=!0,n.ui.render())},onDragLeave:()=>{d&&(d=!1,n.ui.render())}});return async p=>{Object.assign(u,p);let{accept:f,multiple:g,maxSize:h,disabled:y,error:v,hint:b,value:w,onChange:C,children:M,uploading:E,progress:S}=p,D=w??[];w!==void 0&&!C&&!c&&(c=!0,console.warn(`[weifuwu/FileUpload] value \u5DF2\u4F20\uFF08\u53D7\u63A7\uFF09\u4F46\u672A\u63D0\u4F9B onChange\u2014\u2014\u9009\u62E9/\u5220\u9664\u65E0\u6CD5\u751F\u6548\u3002
1
+ import{h as so}from"weifuwu/ui-dom";var Cr={"chevron-down":["M6 9l6 6 6-6"],"chevron-up":["M6 15l6-6 6 6"],"chevron-left":["M15 18l-6-6 6-6"],"chevron-right":["M9 18l6-6-6-6"],"arrow-left":["M19 12H5","M12 19l-7-7 7-7"],"arrow-up":["M12 19V5","M5 12l7-7 7 7"],"arrow-down":["M12 5v14","M19 12l-7 7-7-7"],"arrow-right":["M5 12h14","M12 5l7 7-7 7"],sort:["M7 15l5 5 5-5","M7 9l5-5 5 5"],"sort-asc":["M12 19V5","M5 12l7-7 7 7"],"sort-desc":["M12 5v14","M19 12l-7 7-7-7"],check:["M20 6L9 17l-5-5"],close:["M18 6L6 18","M6 6l12 12"],alert:["M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","M12 9v4","M12 17h.01"],info:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 16v-4","M12 8h.01"],warning:["M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z","M12 9v4","M12 17h.01"],pause:["M6 4h4v16H6z","M14 4h4v16h-4z"],settings:["M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],search:["M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z","M21 21l-4.35-4.35"],send:["M22 2L11 13","M22 2l-7 20-4-9-9-4 20-7z"],stop:["M6 6h12v12H6z"],retry:["M1 4v6h6","M23 20v-6h-6","M20.49 9A9 9 0 0 0 5.64 5.64L1 10","M3.51 15a9 9 0 0 0 14.85 3.36L23 14"],upload:["M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4","M17 8l-5-5-5 5","M12 3v12"],trash:["M3 6h18","M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2","M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14","M10 11v6","M14 11v6"],edit:["M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7","M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"],plus:["M12 5v14","M5 12h14"],copy:["M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2z","M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"],eye:["M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],"eye-off":["M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94","M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19","M14.12 14.12a3 3 0 1 1-4.24-4.24","M1 1l22 22"],star:["M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"],dashboard:["M3 13h8V3H3z","M21 13h-8V9h8z","M21 21h-8v-8h8z","M3 21h8v-8H3z"],grid:["M3 3h7v7H3z","M14 3h7v7h-7z","M14 14h7v7h-7z","M3 14h7v7H3z"],box:["M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z","M3.27 6.96L12 12.01l8.73-5.05","M12 22.08V12"],users:["M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2","M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z","M23 21v-2a4 4 0 0 0-3-3.87","M16 3.13a4 4 0 0 1 0 7.75"],user:["M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2","M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"],home:["M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M9 22V12h6v10"],folder:["M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"],file:["M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z","M13 2v7h7"],"file-text":["M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z","M13 2v7h7","M9 13h6","M9 17h6"],calendar:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M16 3v4","M8 3v4","M3 11h18"],clock:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 6v6l4 2"],bell:["M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9","M13.73 21a2 2 0 0 1-3.46 0"],menu:["M3 12h18","M3 6h18","M3 18h18"],activity:["M22 12h-4l-3 9L9 3l-3 9H2"],"trending-up":["M23 6l-9.5 9.5-5-5L1 18","M17 6h6v6"],"trending-down":["M23 18l-9.5-9.5-5 5L1 6","M17 18h6v-6"],database:["M12 8c4.97 0 9-1.34 9-3s-4.03-3-9-3-9 1.34-9 3 4.03 3 9 3z","M21 12c0 1.66-4.03 3-9 3s-9-1.34-9-3","M3 5v14c0 1.66 4.03 3 9 3s9-1.34 9-3V5"],server:["M20 4H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z","M4 14h16","M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2","M7 18h.01","M12 18h.01"],heart:["M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"],refresh:["M23 4v6h-6","M1 20v-6h6","M3.51 9a9 9 0 0 1 14.85-3.36L23 10","M20.49 15a9 9 0 0 1-14.85 3.36L1 14"],message:["M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"],inbox:["M22 12h-6l-2 3h-4l-2-3H2","M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"],shield:["M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"],zap:["M13 2L3 14h9l-1 8 10-12h-9l1-8z"],target:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12z","M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"],mail:["M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z","M22 6l-10 7L2 6"],"external-link":["M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6","M15 3h6v6","M10 14L21 3"],"log-out":["M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4","M16 17l5-5-5-5","M21 12H9"],lock:["M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2z","M7 11V7a5 5 0 0 1 10 0v4"],list:["M8 6h13","M8 12h13","M8 18h13","M3 6h.01","M3 12h.01","M3 18h.01"],"bar-chart":["M12 20V10","M18 20V4","M6 20v-4"],gauge:["M12 15l3.5-3.5","M20.39 18.39A10 10 0 1 0 3.61 18.39","M12 15a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"],paperclip:["M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"],filter:["M22 3H2l8 9.46V19l4 2v-8.54L22 3z"],layers:["M12 2L2 7l10 5 10-5-10-5z","M2 17l10 5 10-5","M2 12l10 5 10-5"],"map-pin":["M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z","M15 10a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"],"book-open":["M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"],github:["M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"],tag:["M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z","M7 7h.01"],phone:["M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"],"more-vertical":["M12 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","M12 13.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","M12 20a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"],"check-circle":["M22 11.08V12a10 10 0 1 1-5.93-9.14","M22 4L12 14.01l-3-3"],"alert-circle":["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M12 8v4","M12 16h.01"],wifi:["M5 12.55a11 11 0 0 1 14.08 0","M1.42 9a16 16 0 0 1 21.16 0","M8.53 16.11a6 6 0 0 1 6.95 0","M12 20h.01"],cpu:["M9 9h6v6H9z","M9 1v4","M15 1v4","M9 19v4","M15 19v4","M1 9h4","M1 15h4","M19 9h4","M19 15h4","M5 5h14v14H5z"],"hard-drive":["M22 12H2","M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z","M6 16h.01","M10 16h.01"],globe:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","M2 12h20","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"],briefcase:["M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16","M2 20h20","M4 4h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"],layout:["M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z","M9 3v18","M3 9h18"]},T=async(l,n)=>async t=>{let{name:e,size:o,className:a}=t;return so("svg",{class:`wf-icon${a?" "+a:""}`,width:o??"1em",height:o??"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":1.8,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"},Cr[e].map(s=>so("path",{d:s})))};import{h as ao}from"weifuwu/ui-dom";var lt=async(l,n)=>async t=>{let{variant:e="primary",size:o="md",block:a,loading:s,disabled:r,type:i,onClick:c,children:u}=t,d=["wf-btn",`wf-btn--${e}`,`wf-btn--${o}`,a&&"wf-btn--block",s&&"wf-btn--loading"].filter(Boolean).join(" "),m=n?.i18n?.components?.Button??{};return ao("button",{id:t.id,title:t.title,class:d,type:i??"button",disabled:r||s||void 0,"aria-busy":s||void 0,onClick:c},s?[ao("span",{class:"wf-btn-spinner"}),m.loading??"\u52A0\u8F7D\u4E2D..."]:u)};import{h as ct}from"weifuwu/ui-dom";var Ft=async l=>async n=>{let{label:t,name:e,type:o="text",value:a,placeholder:s,required:r,disabled:i,readonly:c,error:u,hint:d,variant:m="default",onInput:p,onChange:f,...g}=n,h=ct("input",{class:`wf-input${m==="borderless"?" wf-input--borderless":""}`,name:e||void 0,type:o,value:a??"",placeholder:s,required:r||void 0,disabled:i||void 0,readonly:c||void 0,onInput:p,onChange:f,...g});if(!t&&!u&&!d)return h;let y=[];if(t){let v=[t];r&&v.push(ct("span",{class:"wf-input-req"},"*")),y.push(ct("label",{class:"wf-input-label"},v))}return y.push(h),u&&y.push(ct("div",{class:"wf-input-err"},u)),d&&!u&&y.push(ct("div",{class:"wf-input-hint"},d)),ct("div",{class:`wf-input-wrap${u?" wf-input--err":""}`},y)};import{h as nt}from"weifuwu/ui-dom";var kr=async(l,n)=>async t=>{let{label:e,value:o,placeholder:a,required:s,disabled:r,error:i,hint:c,rows:u=3,maxLength:d,showCount:m,onInput:p}=t,f=nt("textarea",{class:"wf-textarea",value:o??"",placeholder:a,required:s||void 0,disabled:r||void 0,rows:u,maxLength:d,onInput:p}),g=[];if(e){let h=[e];s&&h.push(nt("span",{class:"wf-textarea-req"},"*")),g.push(nt("label",{class:"wf-textarea-label"},h))}if(g.push(f),m){let h=(o??"").length,y=d!=null&&h>d;g.push(nt("div",{class:`wf-textarea-count${y?" wf-textarea-count--over":""}`,"aria-live":"polite"},d!=null?`${h}/${d}`:String(h)))}return i&&g.push(nt("div",{class:"wf-textarea-err"},i)),c&&!i&&g.push(nt("div",{class:"wf-textarea-hint"},c)),nt("div",{class:`wf-textarea-wrap${i?" wf-textarea--err":""}`},g)};import{h as te}from"weifuwu/ui-dom";function Gt(l){return"options"in l&&!("value"in l)}function hn(l){return l?l.flatMap(n=>Gt(n)?n.options:[n]):[]}var Mr=async(l,n)=>async t=>{let{label:e,value:o,options:a,placeholder:s,required:r,disabled:i,error:c,onChange:u,children:d}=t,m=[];if(s&&m.push(te("option",{value:"",disabled:!0},s)),a)for(let g of a)Gt(g)?m.push(te("optgroup",{label:g.label},g.options.map(h=>te("option",{value:h.value,disabled:h.disabled},h.label)))):m.push(te("option",{value:g.value,disabled:g.disabled},g.label));let p=te("select",{class:"wf-select",value:o??"",required:r||void 0,disabled:i||void 0,onChange:g=>u?.(g.target.value)},d??m),f=[];if(e){let g=[e];r&&g.push(te("span",{class:"wf-select-req"},"*")),f.push(te("label",{class:"wf-select-label"},g))}return f.push(p),c&&f.push(te("div",{class:"wf-select-err"},c)),te("div",{class:`wf-select-wrap${c?" wf-select--err":""}`},f)},Pr=async(l,n)=>{let t=!1,e="",o=[],a=-1,s=!1,r;n.ui.useStableRef?.(()=>{},()=>{s=!0,r&&clearTimeout(r)});let i=null,c=null,u=p=>{p&&(i=p)},d=p=>{p&&(c=p)},m=n.ui.usePopup({trigger:()=>"click",placement:()=>"bottom",center:!1,gap:4,el:()=>i,isOpen:()=>t,setOpen:p=>{t=p,n.ui.render()}});return async p=>{let{label:f,value:g,options:h=[],placeholder:y,required:v,disabled:b,error:w,onChange:C,onSearch:M,multiple:E}=p,S=!!E,D=S?Array.isArray(g)?g:[]:[g],I=(V,H)=>{if(!H)return V;let X=H.toLowerCase();return V.flatMap(G=>{if(Gt(G)){let ee=G.options.filter(re=>re.label.toLowerCase().includes(X));return ee.length?[{label:G.label,options:ee}]:[]}return G.label.toLowerCase().includes(X)?[G]:[]})},O=e&&M&&o.length>0?o:I(h,e),L=hn(O),N=hn(h),P=N.find(V=>V.value===g),R=N.filter(V=>D.includes(V.value)),$=async V=>{if(e=V,t=!0,a=0,n.ui.render(),M&&V){let H=await M(V);H&&(o=H,n.ui.render())}},k=V=>{if(!V.disabled)if(S){let H=Array.isArray(g)?[...g]:[],X=H.indexOf(V.value);X>=0?H.splice(X,1):H.push(V.value),C?.(H)}else e="",t=!1,n.ui.render(),C?.(V.value)},x=V=>{if(!S)return;let H=Array.isArray(g)?[...g]:[];C?.(H.filter(X=>X!==V))},A=V=>{if(!b)if(V.key==="ArrowDown")V.preventDefault(),t=!0,a=Math.min(a+1,L.length-1),n.ui.render();else if(V.key==="ArrowUp")V.preventDefault(),t=!0,a=Math.max(a-1,0),n.ui.render();else if(V.key==="Enter"){V.preventDefault();let H=L[a];H&&k(H)}else V.key==="Escape"&&(V.preventDefault(),t=!1,e="",n.ui.render())},B=S&&R.length>0?R.map(V=>te("span",{class:"wf-select-tag",key:V.value},[V.label,te("button",{type:"button",class:"wf-select-tag-close","aria-label":`\u79FB\u9664 ${V.label}`,onClick:H=>{H.stopPropagation(),x(V.value)}},te(T,{name:"close",size:10}))])):[],z=S?"":t?e:P?.label??"",U=te("div",{key:"select-trigger",class:`wf-select-search-trigger${b?" wf-select-search--disabled":""}${w?" wf-select--err":""}`,ref:u,role:"combobox","aria-haspopup":"listbox","aria-expanded":String(t),onClick:b?void 0:()=>{t=!0,n.ui.render(),c?.focus()}},[...B,te("input",{key:"select-search-input",ref:d,class:"wf-select-search-input",type:"text",value:S?"":t?e:P?.label??"",placeholder:R.length>0?void 0:y??"",disabled:b,readOnly:!t||void 0,onInput:V=>$(V.target.value),onFocus:()=>{b||(t=!0,n.ui.render())},onBlur:()=>{r=setTimeout(()=>{s||(t=!1,e="",n.ui.render())},150)},onKeyDown:A})]),_=[];if(f){let V=[f];v&&V.push(te("span",{class:"wf-select-req"},"*")),_.push(te("label",{class:"wf-select-label"},V))}let j=0,J=(V,H)=>{let X=S?D.includes(V.value):V.value===g,G=te("div",{class:`wf-select-search-opt${X?" wf-select-search-opt--sel":""}${V.disabled?" wf-select-search-opt--dis":""}${a===H?" wf-select-search-opt--hl":""}`,key:V.value,onMouseDown:ee=>{ee.preventDefault(),k(V)}},V.label);return j++,G},Y=[];if(L.length>0)for(let V of O)if(Gt(V)){Y.push(te("div",{class:"wf-select-search-group",key:`group-${V.label}`},V.label));for(let H of V.options)Y.push(J(H,j))}else Y.push(J(V,j));else e&&Y.push(te("div",{class:"wf-select-search-empty"},"\u65E0\u5339\u914D"));let K=te("div",{class:"wf-select-search-menu"},Y),Xe=m.portal(K,"wf-select-menu");return _.push(te("div",{class:"wf-select-search"},[U,Xe].filter(Boolean))),w&&_.push(te("div",{class:"wf-select-err"},w)),te("div",{class:`wf-select-wrap${w?" wf-select--err":""}`},_)}},qt=async(l,n)=>{let t=await Mr(l,n),e=await Pr(l,n);return o=>o.searchable?e(o):t(o)};import{h as Pt}from"weifuwu/ui-dom";var yn=async(l,n)=>async t=>{let{label:e,checked:o,disabled:a,onChange:s}=t,r=Pt("input",{type:"checkbox",class:"wf-checkbox-input",checked:o||void 0,disabled:a||void 0,onChange:s?c=>s(c.target.checked):void 0}),i=Pt("span",{class:"wf-checkbox-visual"});return e?Pt("label",{class:"wf-checkbox"},[r,i,Pt("span",{class:"wf-checkbox-label"},e)]):Pt("label",{class:"wf-checkbox"},[r,i])};import{h as Tt}from"weifuwu/ui-dom";var Ut=async(l,n)=>async t=>{let{label:e,checked:o,disabled:a,onChange:s}=t,r=Tt("input",{type:"checkbox",class:"wf-switch-input",checked:o||void 0,disabled:a||void 0,role:"switch","aria-checked":String(!!o),onChange:s?u=>s(u.target.checked):void 0}),i=Tt("span",{class:"wf-switch-track"}),c=n?.i18n?.components?.Switch??{};return e?Tt("label",{class:"wf-switch"},[r,i,Tt("span",{class:"wf-switch-label"},e)]):Tt("label",{class:"wf-switch","aria-label":c.ariaLabel??"\u5207\u6362"},[r,i])};import{h as St}from"weifuwu/ui-dom";var Tr=async(l,n)=>async t=>{let{name:e,options:o=[],inline:a}=t,s=n?.ui?.useControlled({value:t.value,onChange:t.onChange,name:"RadioGroup"}),r=c=>{let u=s?.controlled;s?.setValue(c),u||t.onChange?.(c)},i=o.map(c=>{let u=St("input",{type:"radio",class:"wf-radio-input",name:e??"radio",value:c.value,checked:s?.value===c.value||void 0,disabled:c.disabled||void 0,onChange:()=>r(c.value)}),d=St("span",{class:"wf-radio-visual"}),m=St("span",{class:"wf-radio-label-text"},c.label);return St("label",{class:"wf-radio",key:c.value},[u,d,m])});return St("div",{class:`wf-radio-group${a?" wf-radio-group--inline":""}`},i)};import{h as ce}from"weifuwu/ui-dom";function Sr(l,n,t,e){if(!t||!e)return l;let o=n.find(s=>s.key===t);if(!o||!o.sortable)return l;let a=[...l];return a.sort((s,r)=>{let i=s[t],c=r[t],u=o.sorter?o.sorter(i,c):String(i??"").localeCompare(String(c??""));return e==="desc"?-u:u}),a}var Er=async(l,n)=>async t=>{let{data:e=[],columns:o,onRowClick:a,sortKey:s,sortOrder:r,onSort:i,emptyText:c,rowSelection:u}=t,d=Sr(e,o,s,r),m=(L,N)=>L[u?.rowKey??"id"]??N,p=u?.selectedRowKeys??[],f=new Set(p.map(String)),g=d.map((L,N)=>String(m(L,N))),h=g.length>0&&g.every(L=>f.has(L)),y=g.some(L=>f.has(L)),v=()=>{if(!u?.onChange)return;let L=h?[]:g.map(N=>d.find((P,R)=>String(m(P,R))===N));u.onChange(h?[]:g,h?[]:L)},b=(L,N)=>{if(!u?.onChange)return;let P=String(m(L,N)),R=f.has(P)?p.filter(k=>String(k)!==P):[...p,P],$=R.map(k=>d.find((x,A)=>String(m(x,A))===String(k))).filter(Boolean);u.onChange(R,$)},w=u?ce("th",{class:"wf-table-th wf-table-th--selection",scope:"col"},ce("input",{type:"checkbox",class:"wf-table-checkbox",checked:h||void 0,indeterminate:y&&!h?"true":void 0,"aria-label":"\u5168\u9009",onChange:v})):null,C=(L,N)=>u?ce("td",{class:"wf-table-td wf-table-td--selection"},ce("input",{type:"checkbox",class:"wf-table-checkbox",checked:f.has(String(m(L,N)))||void 0,"aria-label":"\u9009\u62E9\u884C",onClick:P=>P.stopPropagation(),onChange:()=>b(L,N)})):null,M=o.map(L=>{let N=L.key===s&&r,P=r==="asc",R=L.label,$=L.sortable?ce(T,{name:N?P?"sort-asc":"sort-desc":"sort",className:`wf-table-sort-icon${N?" wf-table-sort-icon--active":""}`}):null,k=L.sortable&&i?()=>i(L.key,N&&P?"desc":"asc"):void 0;return ce("th",{class:`wf-table-th${L.sortable?" wf-table-th--sortable":""}${N?" wf-table-th--sorted":""}`,scope:"col",tabindex:L.sortable?0:void 0,style:L.width?{width:L.width}:void 0,onClick:k,onKeyDown:k?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),k())}:void 0},[R,$].filter(Boolean))}),E=ce("tr",{class:"wf-table-tr"},[w,...M].filter(Boolean)),S=ce("thead",{class:"wf-table-thead"},E),D;if(t.loading){let L=t.loadingRows??3;D=Array.from({length:L},(N,P)=>ce("tr",{class:"wf-table-tr wf-table-tr--loading",key:`loading-${P}`},o.map((R,$)=>ce("td",{class:"wf-table-td",key:`${P}-${$}`},ce("span",{class:"wf-skeleton wf-skeleton--text"})))))}else if(d.length===0&&c){let L=o.length+(u?1:0);D=[ce("tr",{class:"wf-table-tr"},ce("td",{class:"wf-table-td wf-table-empty",colspan:L,style:{textAlign:"center"}},c))]}else D=d.map((L,N)=>{let P=o.map($=>{let k=L[$.key],x=$.render?$.render(k,L,N):String(k??"");return ce("td",{class:"wf-table-td"},x)}),R=C(L,N);return ce("tr",{class:"wf-table-tr",onClick:a?()=>a(L,N):void 0,style:a?{cursor:"pointer"}:void 0},[R,...P].filter(Boolean))});let I=ce("tbody",{class:"wf-table-tbody"},D),O=ce("table",{class:"wf-table",style:t.minWidth?{minWidth:t.minWidth}:void 0},[S,I]);return ce("div",{class:"wf-table-wrap"},O)};import{h as Ge}from"weifuwu/ui-dom";var pt=async(l,n)=>{let t=!1,e=n.ui.usePopup({presence:!0,trapFocus:!0,lockScroll:!0,positioning:"none",closeOnOutside:!1,closeOnEscape:!1,isOpen:()=>t,setOpen:()=>{}}),o;return n.ui.useGlobalKey(a=>{a.key==="Escape"&&e.phase==="open"&&o?.()}),async a=>{let{open:s,title:r,onClose:i,children:c,footer:u,width:d,closable:m=!0,maskClosable:p=!0}=a;o=i,t=!!s;let f=n?.i18n?.components?.Modal??{},g=e.sync(t);if(g==="closed")return null;let h=Ge("div",{class:"wf-modal-overlay",onClick:p?i:void 0}),y=m?Ge("button",{class:"wf-modal-close",onClick:i,type:"button","aria-label":f.closeAria??"\u5173\u95ED"},Ge(T,{name:"close"})):null,v=r?Ge("div",{class:"wf-modal-header"},[r,y].filter(Boolean)):null,b=Ge("div",{class:"wf-modal-body"},c),w=u?Ge("div",{class:"wf-modal-footer"},u):null,C=Ge("div",{class:"wf-modal-content",onClick:E=>E.stopPropagation(),style:d?{minWidth:`min(${d}, calc(100vw - 32px))`,maxWidth:`min(${d}, calc(100vw - 32px))`}:void 0},[v,b,w].filter(Boolean)),M=Ge("div",{class:`wf-modal ${g==="exit"?"wf-modal--exit":"wf-modal--enter"}`,role:"dialog","aria-modal":"true","aria-label":r??f.ariaLabel??"\u5F39\u7A97"},[h,C]);return e.portal(M,"modal")}};import{createClientBrowser as Lr}from"weifuwu/ui-dom";import{h as ut}from"weifuwu/ui-dom";import{mountCommand as $r,unmountCommand as Ir}from"weifuwu/ui-dom";var Jt=Lr();function Ar(){return l=>(l.confirm=(n,t)=>Dr(n,t??{},l),l)}function Dr(l,n,t){return new Promise(e=>{let o=Jt.createElement("div");if(!o){e(!1);return}Jt.bodyAppend(o);let a=!1,s,r=null;r=ut(async(c,u)=>{let d=!0;return s=m=>{if(a)return;a=!0,d=!1,u.ui.render(),e(m);let p=()=>{r&&Ir(o,r,t)},f=Jt.query("#__wf_portal .wf-modal");if(f&&typeof f.addEventListener=="function"){let g=!1,h=()=>{g||(g=!0,p())};f.addEventListener("animationend",h,{once:!0}),Jt.timeout(h,600)}else p()},async()=>ut("div",{class:"wf-confirm-host"},ut(io,{open:d,title:n.title,message:l,confirmText:n.confirmText,cancelText:n.cancelText,variant:n.variant,width:n.width,maskClosable:n.maskClosable,onConfirm:()=>s?.(!0),onCancel:()=>s?.(!1)}))},{}),$r(o,r,t)})}var io=async(l,n)=>async t=>{let{open:e=!1,title:o,message:a,confirmText:s,cancelText:r,variant:i="primary",width:c,maskClosable:u=!1,onConfirm:d,onCancel:m}=t,p=n?.i18n?.components?.Confirm??{},f=[ut(lt,{variant:"secondary",size:"md",onClick:()=>m?.()},r??p.cancelText??"\u53D6\u6D88"),ut(lt,{variant:i,size:"md",onClick:()=>d?.()},s??p.confirmText??"\u786E\u5B9A")];return ut(pt,{open:e,title:o,onClose:m,maskClosable:u,footer:f,width:c,closable:!1},a)};import{createClientBrowser as Or}from"weifuwu/ui-dom";import{h as Ne}from"weifuwu/ui-dom";import{mountCommand as Rr}from"weifuwu/ui-dom";import{animateOut as Br}from"weifuwu/ui-dom";var bn=Or();function Nr(l){return{"top-right":"wf-toast--tr","top-left":"wf-toast--tl","bottom-right":"wf-toast--br","bottom-left":"wf-toast--bl","top-center":"wf-toast--tc"}[l]??"wf-toast--tr"}var lo=async(l,n)=>async t=>{let{toasts:e=[],onRemove:o,position:a="top-right",duration:s=0,max:r=0}=t,i=n.ui.usePopup?.({positioning:"none",closeOnOutside:!1,closeOnEscape:!1,isOpen:()=>!0,setOpen:()=>{}}),c=r>0&&e.length>r?e.slice(-r):e;if(c.length===0)return null;let u=c.map(d=>Ne("div",{class:`wf-toast wf-toast--${d.type}`,key:d.id,role:d.type==="error"?"alert":"status","aria-live":d.type==="error"?"assertive":"polite","data-id":d.id,"data-duration":(d.duration??s)||void 0,onClick:o?()=>o(d.id):void 0},[Ne("span",{class:"wf-toast-icon"},Ne(T,{name:Hr(d.type)})),Ne("span",{class:"wf-toast-msg"},d.message),d.action?Ne("button",{class:`wf-toast-action wf-toast-action--${d.type}`,type:"button",onClick:m=>{m.stopPropagation(),d.action.onClick()}},d.action.label):null].filter(Boolean)));return i.portal(Ne("div",{class:`wf-toast-container ${Nr(a)}`,"data-max":r||void 0},u),"toast")};function Hr(l){switch(l){case"success":return"check";case"error":return"close";case"warning":return"alert";case"info":return"info"}}function zr(l){let n={position:l?.position??"top-right",duration:l?.duration??3e3,max:l?.max??3},t=null,e=null,o=0,a=async(r,i)=>{let c=[],u=()=>i.ui.render();return t={add:d=>{c=[...c,d],u()},remove:d=>{let m=bn.query(`.wf-toast[data-id="${d}"]`);if(m){m.classList.add("wf-toast-out");let p=getComputedStyle(m).animationName;if(p&&p!=="none"){Br(m,()=>{c=c.filter(f=>f.id!==d),u()});return}}c=c.filter(p=>p.id!==d),u()}},async()=>Ne("div",{class:"wf-toast-host"},[Ne(lo,{toasts:c,position:n.position,duration:n.duration,max:n.max,onRemove:d=>t?.remove(d)})])},s=()=>{if(t||!e)return;let r=bn.createElement("div");r&&(bn.bodyAppend(r),Rr(r,Ne(a,{}),e))};return r=>(e=r,r.toast=(i,c="info",u,d)=>{s();let m=String(++o);t?.add({id:m,type:c,message:i,duration:u,action:d});let p=u??n.duration;p>0&&setTimeout(()=>t?.remove(m),p)},r)}import{h as dt}from"weifuwu/ui-dom";var wn=async(l,n)=>async t=>{let{variant:e="info",closable:o,onClose:a,children:s}=t;if(!s)return null;let r=dt("span",{class:"wf-alert-icon"},dt(T,{name:_r(e)})),i=o?dt("button",{class:"wf-alert-close",onClick:a,type:"button","aria-label":"\u5173\u95ED"},dt(T,{name:"close"})):null,c=dt("span",{class:"wf-alert-msg"},s);return dt("div",{class:`wf-alert wf-alert--${e}`,role:"alert"},[r,c,i].filter(Boolean))};function _r(l){switch(l){case"success":return"check";case"error":return"close";case"warning":return"alert";case"info":return"info"}}import{h as vn}from"weifuwu/ui-dom";var jr=async(l,n)=>async t=>{let{text:e="\u52A0\u8F7D\u4E2D..."}=t;return vn("div",{class:"wf-loading",role:"status","aria-live":"polite"},[vn("div",{class:"wf-loading-spinner"}),vn("span",{class:"wf-loading-text"},e)])};import{h as ft}from"weifuwu/ui-dom";var Kr=async(l,n)=>async t=>{let{icon:e=ft(T,{name:"inbox"}),text:o="\u6682\u65E0\u6570\u636E",hint:a,children:s}=t,r=[ft("div",{class:"wf-empty-icon"},e),ft("div",{class:"wf-empty-text"},o)];return a&&r.push(ft("div",{class:"wf-empty-hint"},a)),s&&r.push(ft("div",{class:"wf-empty-action"},s)),ft("div",{class:"wf-empty",role:"status"},r)};import{createClientBrowser as Wr}from"weifuwu/ui-dom";import{h as Et}from"weifuwu/ui-dom";var Vr=async(l,n)=>{let t=n?.browser??Wr(),e=0,o=0,a=null,s=c=>{c&&(e=c.offsetLeft,o=c.offsetWidth,n.ui.render())},r=()=>{a&&s(a.querySelector(".wf-tab--active"))},i=c=>{c&&(a=c,queueMicrotask(r))};return async c=>{let{items:u=[]}=c;if(u.length===0)return null;let d=n?.ui?.useControlled({value:c.active,onChange:c.onChange,name:"Tabs"}),m=b=>{let w=d?.controlled;d?.setValue(b),w||c.onChange?.(b)},p=d?.value??u[0].key,f=b=>{let w=b.currentTarget,C=Array.from(w.querySelectorAll(".wf-tab")),M=C.indexOf(t?.activeElement()??null);if(M<0||!d)return;let E=M;if(b.key==="ArrowRight")E=(M+1)%C.length;else if(b.key==="ArrowLeft")E=(M-1+C.length)%C.length;else if(b.key==="Home")E=0;else if(b.key==="End")E=C.length-1;else return;b.preventDefault();let S=u[E];S&&S.key!==u[M].key&&(m(S.key),C[E].focus(),s(C[E]))},g=u.map(b=>Et("button",{class:`wf-tab${b.key===p?" wf-tab--active":""}`,key:b.key,role:"tab",tabindex:b.key===p?0:-1,"aria-selected":b.key===p?"true":"false",onClick:b.key!==p?(w=>{s(w?.currentTarget),m(b.key)}):void 0},b.label)),h=Et("span",{class:"wf-tab-ink",style:{transform:`translateX(${e}px)`,width:`${o}px`},"aria-hidden":"true"}),y=u.find(b=>b.key===p),v=y?.content?Et("div",{class:"wf-tab-content",role:"tabpanel"},y.content):null;return Et("div",{class:"wf-tabs",role:"tablist",onKeyDown:f},[Et("div",{class:"wf-tab-list",ref:i},[...g,h]),v].filter(Boolean))}};import{h as xn}from"weifuwu/ui-dom";var Fr=async(l,n)=>{let t=null,e=i=>{t=i},o=null,a=0,s=!1,r=n.ui.usePopup({trigger:"click",el:()=>t,isOpen:()=>o?.open??!1,setOpen:i=>o?.setOpen(i)});return async i=>{let{trigger:c,items:u=[]}=i;o=n.ui.useOpen({open:i.open,onOpenChange:i.onOpenChange,name:"Dropdown"});let d=!!o?.open;d&&!s&&(a=0),s=d;let m=g=>{let h=g.key;if(h==="Escape")return;let y=u.map((w,C)=>w.disabled?-1:C).filter(w=>w>=0);if(!y.length)return;let v=y.indexOf(a),b=v>=0?v:0;if(h==="ArrowDown"||h==="ArrowRight")g.preventDefault(),a=y[Math.min(b+1,y.length-1)],n.ui.render();else if(h==="ArrowUp"||h==="ArrowLeft")g.preventDefault(),a=y[Math.max(b-1,0)],n.ui.render();else if(h==="Home")g.preventDefault(),a=y[0],n.ui.render();else if(h==="End")g.preventDefault(),a=y[y.length-1],n.ui.render();else if(h==="Enter"||h===" "){let w=u[a];w&&!w.disabled&&(g.preventDefault(),w.onClick?.(),o?.setOpen(!1))}},p=u.map((g,h)=>xn("button",{class:["wf-dropdown-item",g.variant==="danger"?" wf-dropdown-item--danger":"",h===a&&d?" wf-dropdown-item--hl":""].filter(Boolean).join(" "),key:g.value??h,disabled:g.disabled||void 0,role:"menuitem","aria-selected":String(h===a&&d),onClick:g.disabled?void 0:()=>{g.onClick?.()}},g.label)),f=xn("div",{class:"wf-dropdown-menu",role:"menu",onKeyDown:m},p);return xn("div",{class:`wf-dropdown${o?.open?" wf-dropdown--open":""}`,ref:e,...r.wrapProps,"aria-haspopup":"menu","aria-expanded":String(!!o?.open)},[c,r.portal(f,"dropdown")].filter(Boolean))}};import{h as ot}from"weifuwu/ui-dom";var Gr=async(l,n)=>async t=>{let{total:e,pageSize:o=20}=t,a=n?.ui?.useControlled({value:t.page,onChange:t.onChange,name:"Pagination"}),s=a?.value??1,r=m=>{let p=a?.controlled;a?.setValue(m),p||t.onChange?.(m)},i=n?.i18n?.components?.Pagination??{},c=Math.max(1,Math.ceil(e/o));if(c<=1)return null;let u=[];u.push(ot("button",{class:`wf-page-btn${s<=1?" wf-page-btn--disabled":""}`,disabled:s<=1,"aria-label":i.prevAria??"\u4E0A\u4E00\u9875",onClick:s>1?()=>r(s-1):void 0},ot(T,{name:"chevron-left"})));let d=qr(s,c);for(let m of d)m==="..."?u.push(ot("span",{class:"wf-page-ellipsis"},"...")):u.push(ot("button",{class:`wf-page-btn${m===s?" wf-page-btn--active":""}`,"aria-current":m===s?"page":void 0,onClick:m!==s?()=>r(m):void 0},String(m)));return u.push(ot("button",{class:`wf-page-btn${s>=c?" wf-page-btn--disabled":""}`,disabled:s>=c,"aria-label":i.nextAria??"\u4E0B\u4E00\u9875",onClick:s<c?()=>r(s+1):void 0},ot(T,{name:"chevron-right"}))),ot("nav",{class:"wf-pagination","aria-label":i.ariaLabel??"\u5206\u9875"},u)};function qr(l,n){if(n<=7)return Array.from({length:n},(a,s)=>s+1);let t=[1];l>3&&t.push("...");let e=Math.max(2,l-1),o=Math.min(n-1,l+1);for(let a=e;a<=o;a++)t.push(a);return l<n-2&&t.push("..."),t.push(n),t}import{h as Ur}from"weifuwu/ui-dom";var Cn=async(l,n)=>async t=>{let{variant:e="default",padding:o="md",clickable:a,hover:s,active:r,onClick:i,className:c,id:u,style:d,children:m}=t,p=["wf-card",`wf-card--${e}`,`wf-card--pad-${o}`,a&&"wf-card--clickable",s&&"wf-card--hover",r&&"wf-card--active",(a||s)&&"wf-elevate"].filter(Boolean).join(" ");return Ur("div",{class:c?`${p} ${c}`:p,id:u,style:d,onClick:i,role:a?"button":void 0,tabindex:a?0:void 0,onKeyDown:a?f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),i?.())}:void 0},m)};import{h as kn}from"weifuwu/ui-dom";var Jr=async(l,n)=>async t=>{let{variant:e="default",dot:o,children:a,count:s,overflowCount:r=99,showZero:i=!1}=t;if(o)return kn("span",{class:`wf-badge-dot wf-badge-dot--${e}`});if(s!=null){if(s===0&&!i)return null;let c=s>r?`${r}+`:String(s);return kn("span",{class:`wf-badge wf-badge--count wf-badge--${e}`,"aria-label":`${s>r?`\u8D85\u8FC7 ${r}`:s} \u6761`},c)}return kn("span",{class:`wf-badge wf-badge--${e}`},a??"")};import{h as co}from"weifuwu/ui-dom";var po=["#4f6ef7","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"];function Yr(l){let n=0;for(let t=0;t<l.length;t++)n=l.charCodeAt(t)+((n<<5)-n);return po[Math.abs(n)%po.length]}var Mn=async(l,n)=>async t=>{let{name:e="",src:o,size:a="md",color:s}=t,r=Array.from(e.trim())[0]?.toUpperCase()??"?";return o?co("img",{class:`wf-avatar wf-avatar--${a}`,src:o,alt:e}):co("div",{class:`wf-avatar wf-avatar--${a}`,style:{background:s??Yr(e)}},r)};import{h as Yt}from"weifuwu/ui-dom";var Qr=async(l,n)=>async t=>{let{closable:e,onClose:o,variant:a="default",children:s}=t,r=e?Yt("button",{class:"wf-tag-close",onClick:o,type:"button","aria-label":"\u79FB\u9664"},Yt(T,{name:"close"})):null;return Yt("span",{class:`wf-tag wf-tag--${a}`},[Yt("span",{class:"wf-tag-text"},s),r].filter(Boolean))};import{h as qe}from"weifuwu/ui-dom";var Xr=async(l,n)=>{let t=n.ui.useTween(0,{duration:400,ease:"easeOutCubic"}),e=0,o=null,a,s=()=>{o&&(clearInterval(o),o=null)};return async r=>{let{label:i,value:c,trend:u,trendLabel:d,icon:m,onClick:p,animate:f,countdown:g,onFinish:h}=r;a=h;let y=typeof c=="number"?c:0;f&&typeof c=="number"?t.reset(y):t.value=y,g!==void 0?(e=Math.max(0,Math.ceil((g-Date.now())/1e3)),o||(o=setInterval(()=>{e=Math.max(0,Math.ceil((g-Date.now())/1e3)),e<=0&&(s(),a?.()),n.ui.render()},1e3))):o&&s();let v=g!==void 0?(()=>{let w=Math.floor(e/3600),C=Math.floor(e%3600/60),M=e%60,E=S=>String(S).padStart(2,"0");return w>0?`${E(w)}:${E(C)}:${E(M)}`:`${E(C)}:${E(M)}`})():String(typeof c=="number"?t.value:c??""),b=[];return m&&b.push(qe("div",{class:"wf-stat-icon"},m)),b.push(qe("div",{class:"wf-stat-value wf-nums"},v)),b.push(qe("div",{class:"wf-stat-label"},i)),u&&b.push(qe("div",{class:`wf-stat-trend wf-stat-trend--${u}`},[qe("span",{class:"wf-stat-trend-arrow"},qe(T,{name:u==="up"?"arrow-up":"arrow-down"})),d?qe("span",{class:"wf-stat-trend-label"},d):null].filter(Boolean))),qe("div",{class:`wf-stat${p?" wf-stat--clickable":""}${p?" wf-elevate":""}`,onClick:p,role:p?"button":void 0,tabindex:p?0:void 0,onKeyDown:p?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),p())}:void 0},b)}};import{h as Ue}from"weifuwu/ui-dom";var Zr=async(l,n)=>async t=>{let{items:e=[],active:o,current:a=0}=t,s=o??e[a]?.key,r=e.map((i,c)=>{let u=e.findIndex(v=>v.key===s),d=c<u,m=c===u,p=["wf-step",d&&"wf-step--done",m&&"wf-step--current"].filter(Boolean).join(" "),f=d?Ue("span",{class:"wf-step-num"},Ue(T,{name:"check"})):Ue("span",{class:"wf-step-num"},String(c+1)),g=Ue("span",{class:"wf-step-label"},i.label),h=i.description?Ue("span",{class:"wf-step-desc"},i.description):null,y=c<e.length-1?Ue("span",{class:`wf-step-connector${d?" wf-step-connector--done":""}`}):null;return Ue("div",{class:p,key:i.key,role:"listitem","aria-current":m?"step":void 0},[f,g,h,y].filter(Boolean))});return Ue("div",{class:"wf-steps",role:"list"},r)};import{h as es}from"weifuwu/ui-dom";async function ts(l,n){let t={};for(let[e,o]of Object.entries(n)){let a=l[e]??"";for(let s of o){if(s.required&&!String(a).trim()){t[e]=s.message;break}if(s.pattern&&!s.pattern.test(String(a))){t[e]=s.message;break}if(s.minLength!=null&&String(a).length<s.minLength){t[e]=s.message;break}if(s.maxLength!=null&&String(a).length>s.maxLength){t[e]=s.message;break}if(s.validator){let r=await s.validator(a);if(r!==!0){t[e]=typeof r=="string"?r:s.message;break}}}}return t}var ns=async(l,n)=>async t=>{let{validation:e,onSubmit:o,onError:a,children:s}=t;return es("form",{class:"wf-form",onSubmit:async i=>{i.preventDefault();let c=i.target,u=new FormData(c),d={};for(let[m,p]of u.entries())if(m in d){let f=d[m];d[m]=Array.isArray(f)?[...f,p]:[f,p]}else d[m]=p;if(e){let m=await ts(d,e);if(Object.keys(m).length>0){a?.(m);return}a?.({})}await o?.(d)},noValidate:e?!0:void 0},s)};import{h as Lt}from"weifuwu/ui-dom";var mt=async(l,n)=>async t=>{let{label:e,required:o,error:a,hint:s,children:r}=t,i=[];if(e){let c=[e];o&&c.push(Lt("span",{class:"wf-field-req"},"*")),i.push(Lt("label",{class:"wf-field-label"},c))}return i.push(r),a&&i.push(Lt("div",{class:"wf-field-err"},a)),s&&!a&&i.push(Lt("div",{class:"wf-field-hint"},s)),Lt("div",{class:`wf-field${a?" wf-field--err":""}`},i)};import{h as gt}from"weifuwu/ui-dom";var os=async(l,n)=>async t=>{let{label:e,value:o=0,min:a=0,max:s=100,step:r=1,onChange:i,disabled:c}=t,u=Number(o),d=s>a?(u-a)/(s-a)*100:0,m=`linear-gradient(to right, var(--wf-color-primary) ${d}%, var(--wf-color-border) ${d}%)`,p=gt("input",{type:"range",class:["wf-slider-input",c?"wf-slider-input--dis":""].filter(Boolean).join(" "),value:u,min:a,max:s,step:r,disabled:c||void 0,"aria-label":e,"aria-disabled":c?"true":void 0,style:{background:m},onChange:c||!i?void 0:g=>i(Number(g.target.value))}),f=gt("span",{class:"wf-slider-value"},String(u));return e?gt("div",{class:"wf-slider-wrap"},[gt("label",{class:"wf-slider-label"},e),gt("div",{class:"wf-slider"},[p,f])]):gt("div",{class:"wf-slider"},[p,f])};import{h as ht}from"weifuwu/ui-dom";var rs=async(l,n)=>{let t=!1;return async e=>{let{value:o,placeholder:a="\u641C\u7D22...",onInput:s,onClear:r,disabled:i}=e,c=o!==void 0,u=o??"",d=c&&u&&r?ht("button",{class:"wf-search-clear",type:"button","aria-label":"\u6E05\u9664",onClick:r},ht(T,{name:"close"})):null,m=ht("span",{class:"wf-search-icon"},ht(T,{name:"search"}));return ht("div",{class:d?"wf-search wf-search--has-clear":"wf-search"},[m,ht("input",{class:["wf-search-input",i?"wf-search-input--dis":""].filter(Boolean).join(" "),type:"search",value:c?u:void 0,placeholder:a,disabled:i||void 0,"aria-disabled":i?"true":void 0,onInput:p=>{t||p.isComposing||s?.(p)},onCompositionStart:()=>{t=!0},onCompositionEnd:p=>{t=!1,s?.(p)}}),d].filter(Boolean))}};import{h as uo}from"weifuwu/ui-dom";var ss=async(l,n)=>async t=>{let{options:e,size:o="md",block:a,ariaLabel:s}=t,r=n?.ui?.useControlled({value:t.value,onChange:t.onChange,name:"SegmentedControl"}),i=u=>{let d=r?.controlled;r?.setValue(u),d||t.onChange?.(u)},c=["wf-segmented",o==="sm"&&"wf-segmented--sm",a&&"wf-segmented--block"].filter(Boolean).join(" ");return uo("div",{class:c,role:"group","aria-label":s},e.map(u=>uo("button",{type:"button",class:`wf-segmented-option${u.value===r?.value?" wf-segmented-option--active":""}`,"aria-pressed":u.value===r?.value?"true":"false",disabled:u.disabled||void 0,onClick:u.disabled?void 0:()=>i(u.value)},u.label)))};import{h as $t}from"weifuwu/ui-dom";var as=async(l,n)=>async t=>{let{value:e,max:o=100,label:a,showValue:s,status:r="default",size:i="md"}=t,c=e==null,u=c?0:Math.min(100,Math.max(0,e/o*100)),d=n?.i18n?.components?.ProgressBar??{},m=$t("div",{class:`wf-progress wf-progress--${i}${c?" wf-progress--indeterminate":""}${r!=="default"?` wf-progress--${r}`:""}`,role:"progressbar","aria-valuenow":c?void 0:Math.round(e),"aria-valuemin":0,"aria-valuemax":Math.round(o),"aria-label":a??d.ariaLabel??"\u8FDB\u5EA6"},[$t("div",{class:`wf-progress-fill${r!=="default"?` wf-progress-fill--${r}`:""}`,style:c?void 0:{width:`${u}%`}})]);if(!a&&!s)return m;let p=[];return a&&p.push($t("span",{class:"wf-progress-label"},a)),p.push(m),s&&!c&&p.push($t("span",{class:"wf-progress-value"},`${Math.round(u)}%`)),$t("div",{class:"wf-progress-wrap"},p)};import{createClientBrowser as is}from"weifuwu/ui-dom";import{h as It}from"weifuwu/ui-dom";var ls=async(l,n)=>{let t=n.browser??is(),e=[],o=[],a=new Map,s=r=>{let i=a.get(r);return i||(i=c=>{c&&(o[r]=c)},a.set(r,i)),i};return async r=>{let{items:i=[],active:c,onChange:u,multiple:d=!1}=r;e.length===0&&i.length>0&&(e=i.map(b=>b.key));let m=c!==void 0,p=m?c:e,f=b=>p.includes(b),g=b=>{m?u?.(b):(e=b,n.ui.render())},h=b=>{f(b)?g(p.filter(w=>w!==b)):g(d?[...p,b]:[b])},y=b=>{let w=t?.activeElement()??null,C=o.indexOf(w);if(C<0)return;let M=C;if(b.key==="ArrowDown"||b.key==="ArrowRight")M=(C+1)%i.length;else if(b.key==="ArrowUp"||b.key==="ArrowLeft")M=(C-1+i.length)%i.length;else return;b.preventDefault(),o[M]?.focus()};if(i.length===0)return null;let v=i.map((b,w)=>{let C=f(b.key);return It("div",{class:`wf-accordion-item${C?" wf-accordion-item--open":""}`,key:b.key},[It("button",{type:"button",class:"wf-accordion-summary",ref:s(w),disabled:b.disabled||void 0,"aria-expanded":C?"true":"false",onClick:b.disabled?void 0:()=>h(b.key)},[b.title,It(T,{name:"chevron-down",size:14,className:"wf-accordion-arrow"})]),C&&b.content?It("div",{class:"wf-accordion-content"},b.content):null].filter(Boolean))});return It("div",{class:"wf-accordion",onKeyDown:y},v)}};import{h as At}from"weifuwu/ui-dom";var cs=async(l,n)=>async t=>{let{title:e,sub:o,display:a,children:s}=t;return At("div",{class:"wf-page-head"},[At("div",{class:"wf-page-head-left"},[At("h2",{class:`wf-page-title${a?" wf-page-title--display":""}`},e),o?At("p",{class:"wf-page-sub"},o):null].filter(Boolean)),s?At("div",{class:"wf-page-head-actions"},s):null].filter(Boolean))};import{h as Dt}from"weifuwu/ui-dom";var ps=async(l,n)=>async t=>{let{items:e}=t,o=e.flatMap((s,r)=>{let i=r===e.length-1,c=i?Dt("span",{class:"wf-breadcrumb-current","aria-current":"page"},s.label):s.href?Dt("a",{class:"wf-breadcrumb-link",href:s.href},s.label):Dt("span",{class:"wf-breadcrumb-text"},s.label);return i?c:[c,Dt("span",{class:"wf-breadcrumb-sep","aria-hidden":"true"},"/")]}),a=n?.i18n?.components?.Breadcrumb??{};return Dt("nav",{class:"wf-breadcrumb","aria-label":a.ariaLabel??"\u9762\u5305\u5C51"},o)};import{h as Pn}from"weifuwu/ui-dom";var us=async(l,n)=>async t=>{let{vertical:e,children:o}=t;return e?Pn("div",{class:"wf-divider wf-divider--vertical",role:"separator"}):Pn("div",{class:o?"wf-divider wf-divider--with-text":"wf-divider",role:"separator"},o?Pn("span",{class:"wf-divider-text"},o):void 0)};import{h as ae}from"weifuwu/ui-dom";function fo(l){return l<1024?`${l}B`:l<1024*1024?`${(l/1024).toFixed(1)}KB`:`${(l/(1024*1024)).toFixed(1)}MB`}var Tn=async(l,n)=>{let t=n?.i18n?.components?.FileUpload??{},e=null,o=p=>{p&&(e=p)},a=new Map,s=p=>`${p.name}:${p.size}`,r=p=>{if(!p.type.startsWith("image/"))return;let f=s(p),g=a.get(f);return!g&&typeof URL<"u"&&URL.createObjectURL&&(g=URL.createObjectURL(p),a.set(f,g)),g},i=p=>{if(!p){for(let f of a.values())URL.revokeObjectURL?.(f);a.clear()}},c=!1,u={...l},d=!1,{dropProps:m}=n.ui.useDragDrop({onDrop:p=>{if(d=!1,n.ui.render(),u.disabled)return;let f=Array.from(p.dataTransfer?.files??[]);u.maxSize&&f.filter(h=>h.size>u.maxSize).length>0||u.onChange?.(f)},onDragOver:()=>{d||(d=!0,n.ui.render())},onDragLeave:()=>{d&&(d=!1,n.ui.render())}});return async p=>{Object.assign(u,p);let{accept:f,multiple:g,maxSize:h,disabled:y,error:v,hint:b,value:w,onChange:C,children:M,uploading:E,progress:S}=p,D=w??[];w!==void 0&&!C&&!c&&(c=!0,console.warn(`[weifuwu/FileUpload] value \u5DF2\u4F20\uFF08\u53D7\u63A7\uFF09\u4F46\u672A\u63D0\u4F9B onChange\u2014\u2014\u9009\u62E9/\u5220\u9664\u65E0\u6CD5\u751F\u6548\u3002
2
2
  \u4F20 onChange \u6216\u7701\u7565 value \u4F7F\u7528\u975E\u53D7\u63A7\u6A21\u5F0F\u3002`));let I=k=>{let x=k.target,A=Array.from(x.files??[]);h&&A.filter(z=>z.size>h).length>0||(C?.(A),x.value="")},O=k=>{let x=D.filter((A,B)=>B!==k);C?.(x)},L=ae("input",{type:"file",class:"wf-upload-input",accept:f||void 0,multiple:g||void 0,disabled:y||void 0,onChange:I,style:{display:"none"},ref:o}),N=ae("div",{class:`wf-upload-zone${y?" wf-upload-zone--disabled":""}${v?" wf-upload-zone--err":""}${d?" wf-upload-zone--drag":""}`,onClick:y?void 0:()=>e?.click(),...m},M??ae("div",{class:"wf-upload-placeholder"},[ae("span",{class:"wf-upload-icon"},"\u{1F4C1}"),ae("span",{class:"wf-upload-text"},t.placeholder??"\u70B9\u51FB\u6216\u62D6\u62FD\u4E0A\u4F20\u6587\u4EF6"),f?ae("span",{class:"wf-upload-hint"},`${t.supportedFormats??"\u652F\u6301\u683C\u5F0F: "}${f}`):null,h?ae("span",{class:"wf-upload-hint"},`${t.maxSize??"\u6700\u5927 "}${fo(h)}`):null].filter(Boolean))),P=D.length>0?ae("ul",{class:"wf-upload-list"},D.map((k,x)=>{let A=r(k),B=[A?ae("img",{class:"wf-upload-thumb",src:A,alt:k.name}):null,ae("span",{class:"wf-upload-item-info"},[ae("span",{class:"wf-upload-item-name"},k.name),ae("span",{class:"wf-upload-item-size"},fo(k.size))]),ae("button",{class:"wf-upload-item-remove","aria-label":`${t.remove??"\u5220\u9664"} ${k.name}`,onClick:()=>O(x)},ae(T,{name:"trash"}))];return ae("li",{class:"wf-upload-item",key:k.name+k.size},B.filter(Boolean))})):null,R=E?ae("div",{class:"wf-upload-progress",role:"progressbar","aria-valuenow":S??0},ae("div",{class:"wf-upload-progress-fill",style:{width:`${S??0}%`}})):null,$=[L,N,P,R];return v&&$.push(ae("div",{class:"wf-upload-err"},v)),b&&!v&&$.push(ae("div",{class:"wf-upload-hint"},b)),ae("div",{class:"wf-upload",ref:i},$)}};import{h as Qt}from"weifuwu/ui-dom";var ds=async(l,n)=>{let t=!1,e="top",o=!1,a=null,s=i=>{i&&(a=i)},r=n.ui.usePopup({trigger:"hover",placement:()=>e,gap:6,el:()=>a,isOpen:()=>t,setOpen:i=>{t=i,n.ui.render()},disabled:()=>o});return async i=>{let{content:c,position:u="top",children:d}=i;e=u,o=!!i.disabled;let m=Qt("div",{class:`wf-tooltip wf-tooltip--${u}`,role:"tooltip"},[Qt("div",{class:"wf-tooltip-arrow"}),Qt("div",{class:"wf-tooltip-content"},c)]);return Qt("div",{class:"wf-tooltip-wrap",ref:s,"aria-haspopup":"tooltip",...r.wrapProps},[d,r.portal(m,"tooltip")].filter(Boolean))}};import{h as Je}from"weifuwu/ui-dom";var fs=async(l,n)=>{let t=!1,e=n.ui.usePopup({presence:!0,trapFocus:!0,lockScroll:!0,positioning:"none",closeOnOutside:!1,closeOnEscape:!1,isOpen:()=>t,setOpen:()=>{}}),o;return n.ui.useGlobalKey(a=>{a.key==="Escape"&&e.phase==="open"&&o?.()}),async a=>{let{open:s,title:r,position:i="right",onClose:c,children:u,footer:d,width:m}=a;o=c;let p=n?.i18n?.components?.Drawer??{};t=!!s;let f=e.sync(t);if(f==="closed")return null;let g=Je("div",{class:"wf-drawer-overlay",onClick:c}),h=Je("button",{class:"wf-drawer-close",onClick:c,type:"button","aria-label":p.closeAria??"\u5173\u95ED"},Je(T,{name:"close"})),y=r?Je("div",{class:"wf-drawer-header"},[r,h]):null,v=Je("div",{class:"wf-drawer-body"},u),b=d?Je("div",{class:"wf-drawer-footer"},d):null,w=Je("div",{class:`wf-drawer-panel wf-drawer-panel--${i}`,style:m?{"--wf-drawer-width":m}:void 0,onClick:M=>M.stopPropagation()},[y,v,b].filter(Boolean)),C=Je("div",{class:`wf-drawer wf-drawer--${i} ${f==="exit"?"wf-drawer--exit":"wf-drawer--enter"}`,role:"dialog","aria-modal":"true","aria-label":r??p.ariaLabel??"\u4FA7\u8FB9\u9762\u677F",tabIndex:-1,onKeyDown:M=>{M.key==="Escape"&&c?.()}},[g,w]);return e.portal(C,"drawer")}};import{h as Xt}from"weifuwu/ui-dom";var Ot=async(l,n)=>{let t="bottom",e="click",o=!1,a=null,s=c=>{c&&(a=c)},r=null,i=n.ui.usePopup({trigger:()=>e,placement:()=>t,gap:6,el:()=>a,isOpen:()=>r?.open??!1,setOpen:c=>r?.setOpen(c),disabled:()=>o});return async c=>{let{content:u,position:d="bottom",trigger:m="click",children:p}=c;t=d,e=m,r=n.ui.useOpen({open:c.open,onOpenChange:c.onOpenChange,name:"Popover"}),o=!!c.disabled;let f=Xt("div",{class:`wf-popover wf-popover--${d} wf-popover--enter`,role:"tooltip"},[Xt("div",{class:"wf-popover-arrow"}),Xt("div",{class:"wf-popover-content"},u)]);return Xt("div",{class:`wf-popover-wrap${r?.open?" wf-popover-wrap--open":""}`,ref:s,"aria-haspopup":"dialog","aria-expanded":String(!!r?.open),...i.wrapProps},[p,i.portal(f,"popover")].filter(Boolean))}};import{h as yt,Fragment as ms}from"weifuwu/ui-dom";var gs=async l=>async n=>{let{variant:t="text",lines:e=1,cols:o=3,width:a,height:s,className:r}=n,i={};a!==void 0&&(i.width=typeof a=="number"?`${a}px`:a),s!==void 0&&(i.height=typeof s=="number"?`${s}px`:s);let c=["wf-skeleton",`wf-skeleton--${t}`,r].filter(Boolean).join(" ");if(t==="table"){let d=Array.from({length:e},(m,p)=>{let f=Array.from({length:o},(g,h)=>{let y=p===e-1&&h===o-1?"40%":void 0;return yt("div",{class:"wf-skeleton wf-skeleton--text",style:y?{width:y}:void 0})});return yt("div",{class:"wf-skeleton-row"},f)});return yt("div",{class:"wf-skeleton-table"},d)}if(e<=1)return yt("div",{class:c,style:Object.keys(i).length?i:void 0});let u=Array.from({length:e},(d,m)=>{let p=m===e-1&&e>1?`${c} wf-skeleton--short`:c;return yt("div",{class:p,style:Object.keys(i).length?i:void 0})});return yt(ms,null,u)};import{h as Rt}from"weifuwu/ui-dom";var hs=async(l,n)=>{let t=!1,e=1,o=null,a=n.ui.usePopup?.({trigger:"click",placement:"bottom",el:()=>o,isOpen:()=>t,setOpen:r=>{t=r,e=r?e:1,n.ui.render()},mask:!0,maskCentered:!0})??{open:!1,setOpen:()=>{},wrapProps:{},portal:()=>null,refresh:()=>{}},s=r=>{o=r};return async r=>{let{src:i,alt:c="",fallback:u,loading:d,width:m,height:p,className:f,style:g,preview:h,previewScale:y=1}=r,v={class:["wf-image",f].filter(Boolean).join(" "),src:i??u??"",alt:c,loading:d??"lazy"};if(m!==void 0&&(v.width=m),p!==void 0&&(v.height=p),g&&(v.style=g),u&&(v.onError=w=>{let C=w.currentTarget;C.src!==u&&(C.src=u)}),!h)return Rt("img",v);let b=a.portal(Rt("img",{class:"wf-img-preview-image",src:i??u??"",alt:c,style:{transform:`scale(${e*y})`,maxWidth:"90vw",maxHeight:"90vh"},onClick:w=>{w.stopPropagation(),e=e===1?2:1,n.ui.render()}}),"img-preview");return Rt("div",{class:"wf-img-preview-wrap"},[Rt("button",{type:"button",class:"wf-img-preview-trigger","aria-label":"\u653E\u5927\u9884\u89C8",ref:s,onClick:()=>{t=!0,n.ui.render()}},Rt("img",v)),b].filter(Boolean))}};import{h as Zt}from"weifuwu/ui-dom";var ys=async(l,n)=>{let t=!1,e={once:!0},o=n.ui.useInView({rootMargin:()=>e.rootMargin??"0px",threshold:()=>e.threshold??0}),a=s=>{s?o.observe(s):o.disconnect()};return async s=>{if(Object.assign(e,s),o.isIn)return t||(t=!0,s.once!==!1&&o.disconnect(),s.onEnter?.()),Zt("div",{class:"wf-inview wf-inview--loaded"},s.children);let r=s.placeholder!==void 0?s.placeholder:Zt("div",{class:"wf-inview-placeholder"});return Zt("div",{class:"wf-inview wf-inview--pending"},[Zt("div",{class:"wf-inview-pending",style:{width:"1px",height:"1px",opacity:0,pointerEvents:"none"},ref:a}),r])}};import{createClientBrowser as vs}from"weifuwu/ui-dom";import{h as q}from"weifuwu/ui-dom";var bs=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];function en(){return bs}function mo(l,n){return new Date(l,n+1,0).getDate()}function ws(l,n){return new Date(l,n,1).getDay()}function Bt(l,n){let t=[],e=mo(l,n),o=ws(l,n),a=n===0?11:n-1,s=n===0?l-1:l,r=mo(s,a),i=new Date,c=[];for(let p=o-1;p>=0;p--){let f=r-p;c.push({year:s,month:a,day:f,isOtherMonth:!0,isToday:s===i.getFullYear()&&a===i.getMonth()&&f===i.getDate()})}for(let p=1;p<=e;p++)c.push({year:l,month:n,day:p,isOtherMonth:!1,isToday:l===i.getFullYear()&&n===i.getMonth()&&p===i.getDate()}),c.length===7&&(t.push(c),c=[]);let u=n===11?0:n+1,d=n===11?l+1:l,m=1;for(;t.length<6;){for(;c.length<7;)c.push({year:d,month:u,day:m++,isOtherMonth:!0,isToday:d===i.getFullYear()&&u===i.getMonth()&&m-1===i.getDate()});t.push(c),c=[]}return t}function He(l,n,t){return`${l}-${String(n+1).padStart(2,"0")}-${String(t).padStart(2,"0")}`}function Sn(l,n){return`${String(l).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function go(l,n,t,e,o){return`${He(l,n,t)} ${Sn(e,o)}`}function En(){return Array.from({length:24},(l,n)=>n)}function Ln(){return Array.from({length:12},(l,n)=>n*5)}var xs=async(l,n)=>{let t=n.browser??vs(),e=!1,o="",a=new Date,s=a.getFullYear(),r=a.getMonth(),i=a.getHours(),c=Math.round(a.getMinutes()/5)*5,u=a.getFullYear(),d=a.getMonth(),m=a.getDate(),p=null,f=null,g=null,h=b=>{g=b},y="date";n.ui.useGlobalKey(b=>{b.key==="Escape"&&e&&(e=!1,n.ui.render())});let v=n.ui.usePopup({trigger:"focus",mask:!0,maskClosable:!0,closeOnEscape:!1,closeDelay:120,el:()=>g,isOpen:()=>e,setOpen:b=>{e=b,n.ui.render()},position:()=>{let b=g?.getBoundingClientRect();if(!b)return{x:0,y:0};let w=y==="range";return{x:b.left,y:b.bottom+4,width:w?void 0:b.width}}});return async b=>{let w=n?.i18n?.components?.DatePicker??{},{mode:C="date",value:M,onChange:E,placeholder:S=w.placeholder??"\u9009\u62E9\u65E5\u671F",disabled:D,error:I}=b;y=C;let O=e,L=H=>{e=H,n.ui.render()},N=H=>{D||L(!e)},P=H=>{if(C==="datetime")u=H.year,d=H.month,m=H.day,s=H.year,r=H.month,n.ui.render();else if(C==="range")if(!p||p&&f)p=He(H.year,H.month,H.day),f=null,n.ui.render();else{f=He(H.year,H.month,H.day);let X=p<f?p:f,G=p<f?f:p;o=`${X} ~ ${G}`,E?.(o),L(!1)}else o=He(H.year,H.month,H.day),E?.(o),L(!1)},R=()=>{r===0?(s--,r=11):r--,n.ui.render()},$=()=>{r===11?(s++,r=0):r++,n.ui.render()},k=()=>{o=Sn(i,c),E?.(o),L(!1)},x=()=>{o=go(u,d,m,i,c),E?.(o),L(!1)},A=Bt(s,r),B=[w.w0,w.w1,w.w2,w.w3,w.w4,w.w5,w.w6].some(H=>H)?[w.w0,w.w1,w.w2,w.w3,w.w4,w.w5,w.w6]:en(),z=(H,X,G)=>q("button",{class:"wf-datepicker-header-btn",type:"button","aria-label":X,onClick:G},q(T,{name:H})),U=q("div",{class:"wf-datepicker-header"},[z("chevron-left",w.prevMonth??"\u4E0A\u4E2A\u6708",R),q("span",{class:"wf-datepicker-header-title"},`${s}\u5E74${r+1}\u6708`),z("chevron-right",w.nextMonth??"\u4E0B\u4E2A\u6708",$)]),_=q("div",{class:"wf-datepicker-weekdays"},B.map(H=>q("span",{class:"wf-datepicker-weekday"},H))),j=A.map((H,X)=>q("div",{class:"wf-datepicker-grid",key:`row-${X}`},H.map((G,ee)=>{let re=["wf-datepicker-cell"];G.isOtherMonth&&re.push("wf-datepicker-cell--other-month"),G.isToday&&re.push("wf-datepicker-cell--today");let ue=He(G.year,G.month,G.day);return C==="range"?ue===p||ue===f?re.push("wf-datepicker-cell--range-edge"):p&&f&&ue>p&&ue<f&&re.push("wf-datepicker-cell--in-range"):C==="datetime"?u===G.year&&d===G.month&&m===G.day&&re.push("wf-datepicker-cell--selected"):ue===o&&re.push("wf-datepicker-cell--selected"),q("button",{class:re.join(" "),key:`${G.year}-${G.month}-${G.day}`,type:"button",onClick:()=>P(G)},String(G.day))}))),J=q("div",{class:"wf-datepicker-range-panel"},[U,_,...j]),Y=H=>{if(H.key==="Escape"){L(!1);return}if(C==="time"||C==="datetime"||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(H.key))return;let X=H.currentTarget,G=Array.from(X.querySelectorAll(".wf-datepicker-cell")),ee=G.indexOf(t?.activeElement()??null);if(ee<0)return;H.preventDefault();let re=7,ue=ee;H.key==="ArrowLeft"?ue--:H.key==="ArrowRight"?ue++:H.key==="ArrowUp"?ue-=re:H.key==="ArrowDown"&&(ue+=re),ue>=0&&ue<G.length&&G[ue].focus()},K=null;if(O)if(C==="time"){let H=En(),X=Ln();K=q("div",{class:"wf-time-picker",role:"dialog",onKeyDown:Y,onMouseDown:ee=>ee.stopPropagation()},[q("div",{class:"wf-time-body"},[q("div",{class:"wf-time-col"},[q("div",{class:"wf-time-col-label"},w.hour??"\u65F6"),q("div",{class:"wf-time-opt-list"},H.map(ee=>q("button",{class:`wf-time-opt${ee===i?" wf-time-opt--selected":""}`,type:"button",key:ee,onClick:()=>{i=ee,n.ui.render()}},String(ee).padStart(2,"0"))))]),q("div",{class:"wf-time-col"},[q("div",{class:"wf-time-col-label"},w.minute??"\u5206"),q("div",{class:"wf-time-opt-list"},X.map(ee=>q("button",{class:`wf-time-opt${ee===c?" wf-time-opt--selected":""}`,type:"button",key:ee,onClick:()=>{c=ee,n.ui.render()}},String(ee).padStart(2,"0"))))])]),q("div",{class:"wf-time-footer"},[q("button",{class:"wf-datepicker-footer-btn",type:"button",onClick:()=>L(!1)},w.cancel??"\u53D6\u6D88"),q("button",{class:"wf-datepicker-footer-btn",type:"button",onClick:k},w.confirm??"\u786E\u5B9A")])])}else if(C==="range"){let H=r===11?0:r+1,X=r===11?s+1:s,G=Bt(X,H);K=q("div",{class:"wf-datepicker-range-wrap",onMouseDown:re=>re.stopPropagation()},[q("div",{class:"wf-datepicker-range-panel"},[q("div",{class:"wf-datepicker-header"},[z("chevron-left",w.prevMonth??"\u4E0A\u4E2A\u6708",R),q("span",{class:"wf-datepicker-header-title"},`${s}\u5E74${r+1}\u6708`),q("span",{class:"wf-datepicker-header-title"})]),_,...j]),q("div",{class:"wf-datepicker-range-panel"},[q("div",{class:"wf-datepicker-header"},[q("span",{class:"wf-datepicker-header-title"}),q("span",{class:"wf-datepicker-header-title"},`${X}\u5E74${H+1}\u6708`),z("chevron-right",w.nextMonth??"\u4E0B\u4E2A\u6708",$)]),q("div",{class:"wf-datepicker-weekdays"},B.map(re=>q("span",{class:"wf-datepicker-weekday"},re))),...G.map((re,ue)=>q("div",{class:"wf-datepicker-grid",key:`row-${ue}`},re.map(Be=>{let Ze=He(Be.year,Be.month,Be.day),et=["wf-datepicker-cell"];return Be.isOtherMonth&&et.push("wf-datepicker-cell--other-month"),Be.isToday&&et.push("wf-datepicker-cell--today"),Ze===p||Ze===f?et.push("wf-datepicker-cell--range-edge"):p&&f&&Ze>p&&Ze<f&&et.push("wf-datepicker-cell--in-range"),q("button",{class:et.join(" "),key:Ze,type:"button",onClick:()=>P(Be)},String(Be.day))})))])])}else{let H=[J];C==="datetime"&&(H.push(q("div",{class:"wf-datetime-time"},[q("span",{class:"wf-datetime-time-label"},(w.time??"\u65F6\u95F4")+"\uFF1A"),q("div",{class:"wf-datetime-time-select"},[q("select",{class:"wf-datetime-select",value:i,onChange:G=>{i=parseInt(G.target.value),n.ui.render()}},En().map(G=>q("option",{value:G,key:G},String(G).padStart(2,"0")))),q("span",{class:"wf-datetime-sep"},":"),q("select",{class:"wf-datetime-select",value:c,onChange:G=>{c=parseInt(G.target.value),n.ui.render()}},Ln().map(G=>q("option",{value:G,key:G},String(G).padStart(2,"0"))))])])),H.push(q("div",{class:"wf-time-footer"},[q("button",{class:"wf-datepicker-footer-btn",type:"button",onClick:x},w.confirm??"\u786E\u5B9A")]))),K=q("div",{class:"wf-datepicker-dropdown",role:"dialog",onKeyDown:Y,onMouseDown:G=>G.stopPropagation()},H)}let Xe=O&&K?v.portal(K,"dp-calendar"):null,V=M??o??"";return q("div",{class:`wf-datepicker${D?" wf-datepicker--disabled":""}`},[q("input",{class:["wf-datepicker-input",I?" wf-datepicker-input--err":""].filter(Boolean).join(" "),"aria-invalid":I?"true":void 0,type:"text",placeholder:S,value:V||"",ref:h,readonly:!0,disabled:D,role:"combobox","aria-haspopup":"dialog","aria-expanded":String(O),onClick:N}),Xe].filter(Boolean))}};import{h as Q}from"weifuwu/ui-dom";function Nt(l,n){let t=(e=>{let o=(e-l[0])/(l[1]-l[0]);return n[0]+o*(n[1]-n[0])});return t.domain=l,t.range=n,t.invert=e=>{let o=(e-n[0])/(n[1]-n[0]);return l[0]+o*(l[1]-l[0])},t}function yo(l,n,t){return l.length===0?"":l.map((e,o)=>{let a=n(o),s=t(e.value);return o===0?`M${a},${s}`:`L${a},${s}`}).join(" ")}function bo(l,n,t,e){if(l.length===0)return"";let o=l.map((r,i)=>{let c=n(i),u=t(r.value);return`${c},${u}`}),a=n(0),s=n(l.length-1);return`M${a},${e}L${o.join("L")}L${s},${e}Z`}function wo(l,n,t,e){let o=e??Math.max(4,(n.range[1]-n.range[0])/l.length*.6);return l.map((a,s)=>({x:n(s)-o/2,y:t(Math.max(0,a.value)),width:o,height:Math.abs(t(a.value)-t(0)),color:a.color??Ht(s),label:a.label,value:a.value}))}function vo(l,n,t,e){let o=l.reduce((s,r)=>s+Math.abs(r.value),0);if(o===0)return[];let a=-Math.PI/2;return l.map((s,r)=>{let i=Math.abs(s.value)/o*Math.PI*2,c=a+i,u=Cs(n,t,e,a,c),d=a+i/2;return a=c,{d:u,color:s.color??Ht(r),label:s.label,value:s.value,centroid:{x:n+Math.cos(d)*e*.6,y:t+Math.sin(d)*e*.6}}})}function Cs(l,n,t,e,o){let a=l+t*Math.cos(e),s=n+t*Math.sin(e),r=l+t*Math.cos(o),i=n+t*Math.sin(o),c=o-e>Math.PI?1:0;return`M${l},${n}L${a},${s}A${t},${t} 0 ${c} 1 ${r},${i}Z`}var ho=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"];function Ht(l){return ho[l%ho.length]}function $n(l,n=5){let[t,e]=l.domain,o=(e-t)/n,a=[];for(let s=0;s<=n;s++){let r=t+o*s;a.push({value:r,y:l(r),label:ks(r)})}return a}function ks(l){return Math.abs(l)>=1e6?(l/1e6).toFixed(1)+"M":Math.abs(l)>=1e3?(l/1e3).toFixed(1)+"k":String(Math.round(l))}var Ms=async(l,n)=>{let t=null,e=null,o=!1,a=n.ui.usePopupPosition({el:()=>e,isOpen:()=>t!==null,compute:s=>({top:s.top-8,left:s.left+s.width/2})});return async s=>{let{type:r="line",data:i,options:c={},title:u,area:d,className:m}=s,p=c.width??320,f=c.height??200,g=c.padding??32,h=p-g*2,y=f-g*2,v=i.map(N=>N.value),b=Math.min(0,...v),w=Math.max(...v),C=w-b||1,M=()=>{let N=Math.max(1,i.length-1),P=Nt([-.5,N+.5],[0,h]),R=Nt([b,w],[y,0]),$=$n(R),k=yo(i,P,R),x=d?bo(i,P,R,R(0)):null,A=i.map((B,z)=>{let U=P(z)+g,_=R(B.value)+g;return Q("circle",{key:`dot-${z}`,cx:U,cy:_,r:3,fill:B.color??Ht(z),stroke:"#fff","stroke-width":1.5,style:{cursor:"pointer"},onMouseEnter:j=>{e=j.target,t={label:B.label,value:B.value},n.ui.render()},onMouseLeave:()=>{e=null,t=null,n.ui.render()}})});return Q("svg",{style:{width:"100%"},height:f,viewBox:`0 0 ${p} ${f}`},[...$.map((B,z)=>Q("g",{key:`tick-${z}`},[Q("line",{x1:g,y1:B.y+g,x2:p-g,y2:B.y+g,stroke:"#e5e7eb","stroke-width":1}),Q("text",{x:g-6,y:B.y+g+4,"text-anchor":"end",fill:"#6b7280","font-size":"11","font-family":"var(--wf-font-sans)"},B.label)])),...x?[Q("path",{key:"area",d:x,fill:"#3b82f620",stroke:"none",transform:`translate(${g},${g})`})]:[],Q("path",{key:"line",d:k,fill:"none",stroke:"#3b82f6","stroke-width":2,"stroke-linejoin":"round","stroke-linecap":"round",transform:`translate(${g},${g})`}),...i.map((B,z)=>{let U=P(z)+g;return Q("text",{key:`xlabel-${z}`,x:U,y:f-g+14,"text-anchor":"middle",fill:"#6b7280","font-size":"10","font-family":"var(--wf-font-sans)"},B.label)}),...A])},E=()=>{let N=Math.max(1,i.length-1),P=Nt([-.5,N+.5],[0,h]),R=Nt([b,w],[y,0]),$=$n(R),k=wo(i,P,R);return Q("svg",{style:{width:"100%"},height:f,viewBox:`0 0 ${p} ${f}`},[...$.map((x,A)=>Q("g",{key:`tick-${A}`},[Q("line",{x1:g,y1:x.y+g,x2:p-g,y2:x.y+g,stroke:"#e5e7eb","stroke-width":1}),Q("text",{x:g-6,y:x.y+g+4,"text-anchor":"end",fill:"#6b7280","font-size":"11","font-family":"var(--wf-font-sans)"},x.label)])),...k.map((x,A)=>Q("rect",{key:`bar-${A}`,x:x.x+g,y:x.y+g,width:x.width,height:x.height,fill:x.color,rx:2,onMouseEnter:B=>{e=B.target,t={label:x.label,value:x.value},n.ui.render()},onMouseLeave:()=>{e=null,t=null,n.ui.render()}})),...i.map((x,A)=>{let B=P(A)+g;return Q("text",{key:`xlabel-${A}`,x:B,y:f-g+14,"text-anchor":"middle",fill:"#6b7280","font-size":"10","font-family":"var(--wf-font-sans)"},x.label)})])},S=()=>{let N=p/2,P=f/2,R=Math.min(h,y)/2-4,$=vo(i,N,P,R);return Q("svg",{style:{width:"100%"},height:f,viewBox:`0 0 ${p} ${f}`},[...$.map((k,x)=>Q("g",{key:`arc-${x}`},[Q("path",{d:k.d,fill:k.color,stroke:"#fff","stroke-width":1.5,onMouseEnter:A=>{e=A.target,t={label:k.label,value:k.value},n.ui.render()},onMouseLeave:()=>{e=null,t=null,n.ui.render()}}),...k.value/i.reduce((A,B)=>A+Math.abs(B.value),0)>.05?[Q("text",{x:k.centroid.x,y:k.centroid.y+3,"text-anchor":"middle",fill:"#fff","font-size":"11","font-weight":"bold","font-family":"var(--wf-font-sans)"},`${Math.round(k.value/i.reduce((A,B)=>A+Math.abs(B.value),0)*100)}%`)]:[]]))])},D;r==="bar"?D=E():r==="pie"?D=S():D=M();let I=i.length>1?Q("div",{class:"wf-chart-legend"},i.map((N,P)=>Q("span",{class:"wf-chart-legend-item",key:`leg-${P}`},[Q("span",{class:"wf-chart-legend-dot",style:{background:N.color??Ht(P)}}),Q("span",{class:"wf-chart-legend-label"},N.label)]))):null,O=t!==null;O&&!o&&a.refresh(),o=O;let L=t?Q("div",{class:"wf-chart-tooltip",style:{position:"fixed",left:a.left,top:a.top}},[Q("div",{class:"wf-chart-tooltip-label"},t.label),Q("div",{class:"wf-chart-tooltip-value"},String(t.value))]):null;return Q("div",{class:`wf-chart${m?" "+m:""}`,role:"img","aria-label":u??n?.i18n?.components?.Chart?.ariaLabel??"\u56FE\u8868"},[u?Q("div",{class:"wf-chart-title"},u):null,D,I,L].filter(Boolean))}};import{createClientBrowser as Os}from"weifuwu/ui-dom";import{h as ie}from"weifuwu/ui-dom";import{createClientBrowser as Ps}from"weifuwu/ui-dom";var ze=Ps();function Ts(){try{let l=ze.getSelection();if(!l||!l.rangeCount)return null;let n=l.getRangeAt(0),t=n.startContainer.nodeType===1?n.startContainer:n.startContainer.parentElement??null;for(;t&&t.getAttribute?.("contenteditable")!=="true";){let o=t.style?.textAlign;if(o)return o;if(t.classList?.contains("wf-text-center"))return"center";if(t.classList?.contains("wf-text-right"))return"right";if(t.classList?.contains("wf-text-left"))return"left";t=t.parentElement}let e=n.startContainer.parentElement;if(e&&e.ownerDocument?.defaultView){let a=e.ownerDocument.defaultView.getComputedStyle(e)?.textAlign;if(a&&a!=="start"&&a!=="initial")return a}return null}catch{return null}}function Ie(){let l={};try{l.bold=ze.queryCommandState("bold"),l.italic=ze.queryCommandState("italic"),l.underline=ze.queryCommandState("underline");let n=ze.queryCommandValue("formatBlock");l.h1=n==="h1"||n==="H1",l.h2=n==="h2"||n==="H2",l.h3=n==="h3"||n==="H3",l.blockquote=n==="blockquote"||n==="BLOCKQUOTE";let t=Ts();l.alignLeft=ze.queryCommandState("justifyLeft")||t==="left",l.alignCenter=ze.queryCommandState("justifyCenter")||t==="center",l.alignRight=ze.queryCommandState("justifyRight")||t==="right"}catch{}return l}function de(l,n){try{ze.execCommand(l,n)}catch{}}var Ss={h1:"<h1>",h2:"<h2>",h3:"<h3>",blockquote:"<blockquote>"},Es="<div>";function xo(l){switch(l){case"bold":de("bold");break;case"italic":de("italic");break;case"underline":de("underline");break;case"h1":case"h2":case"h3":case"blockquote":{let n=Ie();de("formatBlock",n[l]?Es:Ss[l]);break}case"ul":de("insertUnorderedList");break;case"ol":de("insertOrderedList");break;case"alignLeft":de("justifyLeft");break;case"alignCenter":de("justifyCenter");break;case"alignRight":de("justifyRight");break;case"hr":de("insertHorizontalRule");break;case"image":break;case"link":break;case"clear":de("removeFormat"),de("formatBlock","<div>");break;case"source":break}}import{h as In}from"weifuwu/ui-dom";var To=["bold","italic","underline","h1","h2","h3","ul","ol","blockquote","alignLeft","alignCenter","alignRight","hr","image","table","link","clear","source"],Ls={bold:"B",italic:"I",underline:"U",h1:"H1",h2:"H2",h3:"H3",ul:"\u25A1",ol:"1.",blockquote:"\u275D",alignLeft:"\u21E4",alignCenter:"\u21D4",alignRight:"\u21E5",hr:"\u2014",image:"\u{1F5BC}",table:"\u229E",link:"\u{1F517}",clear:"\u2715",source:"</>"},Co={bold:"\u52A0\u7C97 (Ctrl+B)",italic:"\u659C\u4F53 (Ctrl+I)",underline:"\u4E0B\u5212\u7EBF (Ctrl+U)",h1:"\u6807\u9898 1",h2:"\u6807\u9898 2",h3:"\u6807\u9898 3",ul:"\u65E0\u5E8F\u5217\u8868",ol:"\u6709\u5E8F\u5217\u8868",blockquote:"\u5F15\u7528",alignLeft:"\u5DE6\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D",alignRight:"\u53F3\u5BF9\u9F50",hr:"\u5206\u5272\u7EBF",image:"\u63D2\u5165\u56FE\u7247",table:"\u63D2\u5165\u8868\u683C",link:"\u63D2\u5165\u94FE\u63A5",clear:"\u6E05\u9664\u683C\u5F0F",source:"\u6E90\u7801"},$s=["bold","italic","underline"],ko=["h1","h2","h3"],Mo=["ul","ol"],Po=["blockquote","alignLeft","alignCenter","alignRight","hr"],Is=["image","table","link","clear"];function As(l,n){return $s.includes(l)&&ko.includes(n)||ko.includes(l)&&Mo.includes(n)||Mo.includes(l)&&Po.includes(n)||Po.includes(l)&&Is.includes(n)||["link","clear"].includes(l)&&n==="source"}function So(l,n,t,e,o){let a=l.map(r=>{if(o?.[r])return o[r](r);let u=["wf-editor-tb-btn",(r==="source"?t:!!n[r])&&"wf-editor-tb-btn--active",r==="link"&&"wf-editor-tb-btn--link"].filter(Boolean).join(" ");return In("button",{key:r,class:u,type:"button",title:Co[r],"aria-label":Co[r],"data-item":r,onClick:()=>e(r)},Ls[r])}),s=[];return l.forEach((r,i)=>{i>0&&As(l[i-1],r)&&s.push(In("span",{class:"wf-editor-tb-sep",key:`sep-${i}`})),s.push(a[i])}),In("div",{class:"wf-editor-toolbar",role:"toolbar","aria-label":"\u7F16\u8F91\u683C\u5F0F"},s)}import{h as zt}from"weifuwu/ui-dom";import{createClientBrowser as Ds}from"weifuwu/ui-dom";var bt=Ds(),Eo=6;function Lo(l,n){let t=bt.getSelection();if(!t||!t.rangeCount)return;let e=t.getRangeAt(0);if(!e)return;let o=bt.createElement("table"),a=bt.createElement("tbody");if(!o||!a)return;o.className="wf-editor-table";for(let r=0;r<l;r++){let i=bt.createElement("tr");if(i){for(let c=0;c<n;c++){let u=bt.createElement("td");u&&(r===0&&(u.style.fontWeight="var(--wf-font-weight-semibold,600)"),u.innerHTML="&nbsp;",i.appendChild(u))}a.appendChild(i)}}o.appendChild(a);let s=bt.createElement("div");s&&(s.appendChild(o),e.deleteContents(),e.insertNode(s),e.setStartAfter(s),e.collapse(!0),t.removeAllRanges(),t.addRange(e))}function $o(l,n,t,e,o){let a=zt("div",{class:"wf-editor-table-grid",onMouseLeave:o},Array.from({length:Eo},(r,i)=>zt("div",{class:"wf-editor-table-grid-row",key:`r${i}`},Array.from({length:Eo},(c,u)=>{let d=i<=l&&u<=n;return zt("div",{class:`wf-editor-table-grid-cell${d?" wf-editor-table-grid-cell--active":""}`,key:`${i}-${u}`,onMouseEnter:()=>e(i,u),onClick:()=>t(i+1,u+1)})})))),s=l>=0&&n>=0?`${l+1} \xD7 ${n+1} \u8868\u683C`:"\u9009\u62E9\u8868\u683C\u5927\u5C0F";return zt("div",{class:"wf-editor-table-picker",onMouseDown:r=>r.stopPropagation()},[a,zt("div",{class:"wf-editor-table-picker-label"},s)])}function Rs(l,n){if(l===n)return!0;if(!l||!n)return!1;let t=Object.keys(l);if(t.length!==Object.keys(n).length)return!1;for(let e of t)if(l[e]!==n[e])return!1;return!0}var Bs=async(l,n)=>{let t=n.browser??Os(),e=null,o=!1,a="",s="rich",r=!1,i="",c=!1,u=!1,d=-1,m=-1,p="",f=null,g=P=>{P&&(f=P)},h=!1,y=["wf-text-left","wf-text-center","wf-text-right"],v=()=>{if(!f)return;let P=t?.getSelection();if(!P||!P.rangeCount)return;let R=P.getRangeAt(0),$=new Set;for(let k of[R.startContainer,R.endContainer]){let x=k.nodeType===1?k:k.parentNode;for(;x&&x!==f&&x.nodeType===1;)$.add(x),x=x.parentNode}for(let k of $){let x=!1;for(let A of y)k.classList.contains(A)&&(k.classList.remove(A),x=!0);x&&k.className.trim()===""&&k.removeAttribute("class")}},b=()=>{if(!f)return;let P=t?.getSelection();if(!P||!P.rangeCount)return;let R=P.getRangeAt(0),$=new Set;for(let k of[R.startContainer,R.endContainer]){let x=k.nodeType===1?k:k.parentNode;for(;x&&x!==f&&x.nodeType===1;)$.add(x),x=x.parentNode}for(let k of $)k instanceof HTMLElement&&k.style.textAlign&&(k.style.removeProperty("text-align"),k.style.cssText===""&&k.removeAttribute("style"))},w={alignLeft:"justifyLeft",alignCenter:"justifyCenter",alignRight:"justifyRight"},C=null,M=()=>{let P=t?.getSelection();P&&P.rangeCount>0&&(C=P.getRangeAt(0))},E=()=>{if(!f||!C)return;f.focus();let P=t?.getSelection();P&&(P.removeAllRanges(),P.addRange(C))},S=null,D=(P,R)=>{if(!f||!P||P.nodeType!==3)return 0;let $=0,k=f.ownerDocument.createTreeWalker(f,NodeFilter.SHOW_TEXT),x=k.nextNode();for(;x&&x!==P;)$+=String(x.nodeValue??"").length,x=k.nextNode();return $+R},I=P=>{if(!f)return null;let R=f.ownerDocument.createTreeWalker(f,NodeFilter.SHOW_TEXT),$=R.nextNode(),k=0;for(;$;){let x=String($.nodeValue??"").length;if(k+x>=P)return{node:$,off:P-k};k+=x,$=R.nextNode()}return null},O=()=>{let P=t?.getSelection();if(!P||!P.rangeCount||!f)return;let R=P.getRangeAt(0);S={start:D(R.startContainer,R.startOffset),end:D(R.endContainer,R.endOffset)}},L=()=>{if(!f||!S)return;let{start:P,end:R}=S,$=t?.getSelection();if(!$)return;f.focus();let k=I(P);if(!k)return;let x=f.ownerDocument.createRange();if(x.setStart(k.node,k.off),P===R)x.collapse(!0);else{let A=I(R);A&&x.setEnd(A.node,A.off)}$.removeAllRanges(),$.addRange(x),S=null},N=()=>{S!=null&&t.timeout(()=>L(),0)};return async P=>{let{value:R="",onChange:$,onUpload:k,placeholder:x="",disabled:A=!1,minHeight:B="200px"}=P,z=P.toolbar??To,U=s==="rich",_=W=>{h=!0,$?.(W)},j=W=>{if(!A){if(f?.focus(),W==="source"){U?(p=f?.innerHTML??R,s="source",n.ui.render()):(s="rich",e={},h=!1,n.ui.render(),$?.(R));return}if(U){if(W==="image"){r=!0,i="",n.ui.render();return}if(W==="link"){M();let se=t?.getSelection();if(!se||se.isCollapsed){o=!0,a="",n.ui.render();return}t?.execCommand("createLink")?(de("unlink"),e=Ie(),f&&$&&_(f.innerHTML),n.ui.render()):(o=!0,a="",n.ui.render());return}if(W==="alignLeft"||W==="alignCenter"||W==="alignRight"){O(),Ie()[W]?b():de(w[W]),v(),e=Ie(),f&&$&&_(f.innerHTML),n.ui.render(),N();return}O(),xo(W),e=Ie(),f&&$&&_(f.innerHTML),n.ui.render(),N()}}},J=W=>{o=!1,n.ui.render(),W&&(f?.focus(),de("createLink",W),e=Ie(),f&&$&&_(f.innerHTML))},Y=()=>{o=!1,a="",n.ui.render()},K=W=>{W&&(de("insertImage",W),e=Ie(),f&&$&&_(f.innerHTML))},Xe=async W=>{let se=W[0];if(se){c=!0,n.ui.render();try{let tt=await k(se);K(tt),r=!1,i="",n.ui.render()}catch{}finally{c=!1,n.ui.render()}}},V=W=>{r=!1,i="",n.ui.render(),f?.focus(),K(W)},H=()=>{r=!1,i="",n.ui.render()},X=(W,se)=>{u=!1,d=-1,m=-1,E(),Lo(W,se),f&&$&&_(f.innerHTML),n.ui.render()},G=(W,se)=>{d=W,m=se,n.ui.render()},ee=()=>{d=-1,m=-1,n.ui.render()},re=ie("button",{key:"table",class:"wf-editor-tb-btn",type:"button",title:"\u63D2\u5165\u8868\u683C","aria-label":"\u63D2\u5165\u8868\u683C","data-item":"table"},"\u229E"),ue=u?$o(d,m,X,G,ee):null,Be=ie(Ot,{key:"table",open:U&&!!u,onOpenChange:W=>{u=W,W&&M(),n.ui.render()},content:ue},re),Ze=W=>{if(A)return;let se=W.currentTarget,tt=se.innerHTML;!(se.textContent??"").trim()&&!(se.querySelector?.("img,table,hr")??null)&&(tt="",se.innerHTML=""),_(tt)},et=W=>{let se=W.target.value;$?.(se)},hr=W=>{if(A||!U)return;M(),(W.ctrlKey||W.metaKey)&&["b","i","u"].includes(W.key.toLowerCase())&&(O(),e=Ie(),f&&$&&_(f.innerHTML),n.ui.render(),N())},yr=()=>{if(!U)return;M();let W=Ie();if(e===null){e=W,O(),n.ui.render(),N();return}Rs(e,W)||(e=W,n.ui.render())},br=()=>{M();let W=!1;o&&(o=!1,W=!0),r&&(r=!1,W=!0),W&&n.ui.render()},wr=U&&o?ie(pt,{open:!0,title:"\u63D2\u5165\u94FE\u63A5",onClose:Y,footer:[ie("button",{class:"wf-btn wf-btn--ghost wf-btn--sm",type:"button",onClick:Y},"\u53D6\u6D88"),ie("button",{class:"wf-btn wf-btn--primary wf-btn--sm",type:"button",onClick:()=>J(a)},"\u786E\u5B9A")]},ie("input",{type:"url",class:"wf-editor-link-input",placeholder:"https://...",value:a,"data-editor-link-input":!0,onInput:W=>{a=W.target.value,n.ui.render()},onKeyDown:W=>{W.key==="Enter"&&J(W.target.value),W.key==="Escape"&&Y()}})):null,Vt=[];k&&(Vt.push(ie(Tn,{accept:"image/*",multiple:!1,disabled:c,onChange:Xe},ie("div",{class:"wf-editor-img-zone"},[ie("span",{class:"wf-editor-img-zone-icon"},"\u{1F5BC}"),ie("span",{class:"wf-editor-img-zone-text"},c?"\u4E0A\u4F20\u4E2D...":"\u70B9\u51FB\u6216\u62D6\u62FD\u4E0A\u4F20\u56FE\u7247")]))),Vt.push(ie("span",{class:"wf-editor-img-or"},"\u6216"))),Vt.push(ie("input",{type:"url",class:"wf-editor-link-input",placeholder:k?"\u7C98\u8D34\u56FE\u7247\u94FE\u63A5":"https://...",value:i,"data-image-input":!0,disabled:c||void 0,onInput:W=>{i=W.target.value,n.ui.render()},onKeyDown:W=>{W.key==="Enter"&&V(W.target.value),W.key==="Escape"&&H()}}));let vr=U&&r?ie(pt,{open:!0,title:"\u63D2\u5165\u56FE\u7247",onClose:H,footer:[ie("button",{class:"wf-btn wf-btn--ghost wf-btn--sm",type:"button",disabled:c||void 0,onClick:H},"\u53D6\u6D88"),ie("button",{class:"wf-btn wf-btn--primary wf-btn--sm",type:"button",disabled:c||void 0,onClick:()=>V(i)},k?"\u63D2\u5165":"\u786E\u5B9A")]},ie("div",{class:"wf-stack",style:"gap:8px"},Vt)):null,mn=null;if(U){let W=["wf-editor-content",A&&"wf-editor-content--disabled",x&&"wf-editor-content--has-placeholder"].filter(Boolean).join(" "),se=h;h&&f&&f.innerHTML===R&&(h=!1);let tt=!h&&!se,gn={class:W,contentEditable:!A,"data-placeholder":x||void 0,style:{minHeight:B},onInput:Ze,onKeyUp:hr,onMouseUp:yr,onMouseDown:br,ref:g};tt&&(gn.innerHTML=R),mn=ie("div",gn)}else mn=ie("textarea",{class:"wf-editor-source",value:R,disabled:A,style:{minHeight:B},onInput:et});let xr={table:()=>Be};return ie("div",{class:`wf-editor${A?" wf-editor--disabled":""}`},[!A&&z.length>0?So(z,e??{},!U,j,xr):null,mn,wr,vr,ie("input",{type:"hidden",value:R,"aria-hidden":"true"})])}};import{createClientBrowser as Ns}from"weifuwu/ui-dom";import{h as Io}from"weifuwu/ui-dom";var Dn=Ns(),Ao="wf_theme";function Do(l){let n=Dn.storageGet(l);return n==="light"||n==="dark"||n==="auto"?n:null}function Hs(l,n){Dn.storageSet(l,n)}function An(l){let n=Dn.rootElement();n&&(l==="auto"?n.removeAttribute("data-theme"):n.setAttribute("data-theme",l))}function zs(){let l=Do(Ao);return l||"auto"}var _s=async(l,n)=>{let t=l.storageKey??Ao,e=l.mode??Do(t)??"auto";return An(e),async o=>{let a=n?.i18n?.components?.ThemeSwitch??{},r=[{value:"auto",label:a.auto??"\u81EA\u52A8"},{value:"light",label:a.light??"\u4EAE\u8272"},{value:"dark",label:a.dark??"\u6697\u8272"}].map(i=>Io("button",{type:"button",class:`wf-theme-seg${e===i.value?" wf-theme-seg--active":""}`,role:"radio","aria-checked":String(e===i.value),"aria-label":i.label,onClick:()=>{e!==i.value&&(e=i.value,An(e),Hs(t,e),o.onChange?.(e),n.ui.render())}},i.label));return Io("div",{class:"wf-theme-switch",role:"radiogroup","aria-label":a.label??"\u4E3B\u9898\u5207\u6362"},r)}};import{h as Ce}from"weifuwu/ui-dom";import{h as F}from"weifuwu/ui-dom";function Oo(l){return l===null?"wf-json-null":typeof l=="string"?"wf-json-string":typeof l=="number"?"wf-json-number":typeof l=="boolean"?"wf-json-boolean":""}function Ro(l){return l===null?"null":typeof l=="string"?JSON.stringify(l):String(l)}var On=async(l,n)=>{let t={},e,o=(s,r)=>{t[s]=r===void 0?!t[s]:!r,n.ui.render()},a=(s,r,i)=>{if(i){i(s,r);return}n.browser?.copyText(`${s} = ${JSON.stringify(r)}`)};return async s=>{let{data:r,defaultExpandDepth:i=2,maxKeys:c=100,rootName:u="root",onCopy:d,className:m}=s,p=(h,y,v)=>{a(h,y,d);let w=v.currentTarget?.querySelector("path"),C=w?.getAttribute("d");w&&C&&(w.setAttribute("d","M20 6 9 17l-5-5"),n.browser?.timeout(()=>w.setAttribute("d",C),1e3))},f=(h,y,v,b)=>{if(typeof h=="object"&&h!==null){let w=t[y]===!0||v>=i&&t[y]!==!1;if(w){let D=Array.isArray(h)?`Array(${h.length})`:"Object";return F("div",{class:"wf-json-row wf-json-collapse","data-path":y,role:"button",tabIndex:0,onClick:()=>o(y,w),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),o(y,w))}},[F("button",{class:"wf-json-toggle","aria-label":"\u5C55\u5F00",tabIndex:-1,onClick:I=>{I.stopPropagation(),o(y,w)}},F(T,{name:"chevron-right",size:10})),F("span",{class:"wf-json-key"},`${b}:`),F("span",{class:"wf-json-summary"},`${D} {\u2026}`),F("button",{class:"wf-json-copy","aria-label":`\u590D\u5236 ${y}`,tabIndex:-1,onClick:I=>{I.stopPropagation(),p(y,h,I)}},F(T,{name:e===y?"check":"copy",size:10}))])}if(Array.isArray(h)){let D=h.map((I,O)=>f(I,`${y}[${O}]`,v+1,String(O)));return F("div",{class:"wf-json-node","data-path":y},[F("div",{class:"wf-json-row wf-json-row--header",role:"button",tabIndex:0,onClick:()=>o(y,w),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),o(y,w))}},[F("button",{class:"wf-json-toggle","aria-label":"\u6536\u8D77",tabIndex:-1,onClick:I=>{I.stopPropagation(),o(y,w)}},F(T,{name:"chevron-down",size:10})),F("span",{class:"wf-json-key"},`${b}:`),F("span",{class:"wf-json-node-summary"},`Array(${h.length})`)]),F("div",{class:"wf-json-children"},D)])}let C=Object.entries(h),M=C.length>c,S=(M?C.slice(0,c):C).map(([D,I])=>f(I,`${y}.${D}`,v+1,D));return M&&S.push(F("div",{class:"wf-json-more"},`+${C.length-c} \u9879\uFF08\u61D2\u5C55\u5F00\uFF09`)),F("div",{class:"wf-json-node","data-path":y},[F("div",{class:"wf-json-row wf-json-row--header",role:"button",tabIndex:0,onClick:()=>o(y,w),onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),o(y,w))}},[F("button",{class:"wf-json-toggle","aria-label":"\u6536\u8D77",tabIndex:-1,onClick:D=>{D.stopPropagation(),o(y,w)}},F(T,{name:"chevron-down",size:10})),F("span",{class:"wf-json-key"},`${b}:`),F("span",{class:"wf-json-node-summary"},`Object(${C.length})`)]),F("div",{class:"wf-json-children"},S)])}return F("div",{class:"wf-json-row","data-path":y},[F("span",{class:"wf-json-toggle-placeholder"}),F("span",{class:"wf-json-key"},`${b}:`),F("span",{class:`wf-json-value ${Oo(h)}`},Ro(h)),F("button",{class:"wf-json-copy","aria-label":`\u590D\u5236 ${y}`,tabIndex:-1,onClick:w=>p(y,h,w)},F(T,{name:"copy",size:10}))])},g;if(typeof r=="object"&&r!==null){let h=t[u]===!0;g=h?F("div",{class:"wf-json-row wf-json-collapse","data-path":u,role:"button",tabIndex:0,onClick:()=>o(u,h),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o(u,h))}},[F("button",{class:"wf-json-toggle","aria-label":"\u5C55\u5F00",tabIndex:-1,onClick:y=>{y.stopPropagation(),o(u,h)}},F(T,{name:"chevron-right",size:10})),F("span",{class:"wf-json-summary"},"Object {\u2026}")]):Array.isArray(r)?F("div",{class:"wf-json-node","data-path":u},[F("div",{class:"wf-json-row wf-json-row--header",role:"button",tabIndex:0,onClick:()=>o(u,h),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o(u,h))}},[F("button",{class:"wf-json-toggle","aria-label":"\u6536\u8D77",tabIndex:-1,onClick:y=>{y.stopPropagation(),o(u,h)}},F(T,{name:"chevron-down",size:10})),F("span",{class:"wf-json-node-summary"},`Array(${r.length})`)]),F("div",{class:"wf-json-children"},r.map((y,v)=>f(y,`${u}[${v}]`,1,String(v))))]):F("div",{class:"wf-json-node","data-path":u},[F("div",{class:"wf-json-row wf-json-row--header",role:"button",tabIndex:0,onClick:()=>o(u,h),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),o(u,h))}},[F("button",{class:"wf-json-toggle","aria-label":"\u6536\u8D77",tabIndex:-1,onClick:y=>{y.stopPropagation(),o(u,h)}},F(T,{name:"chevron-down",size:10})),F("span",{class:"wf-json-key"},`${u}:`),F("span",{class:"wf-json-node-summary"},`Object(${Object.keys(r).length})`)]),F("div",{class:"wf-json-children"},(()=>{let y=Object.entries(r),v=y.length>c,b=(v?y.slice(0,c):y).map(([w,C])=>f(C,`${u}.${w}`,1,w));return v&&b.push(F("div",{class:"wf-json-more"},`+${y.length-c} \u9879\uFF08\u61D2\u5C55\u5F00\uFF09`)),b})())])}else g=F("div",{class:"wf-json-row"},[F("span",{class:`wf-json-value ${Oo(r)}`},Ro(r))]);return F("div",{class:["wf-json-viewer",m].filter(Boolean).join(" ")},[g])}};var js={running:"settings",ok:"check",error:"close"},Rn=async(l,n)=>async t=>{let{call:e,progress:o,result:a,renderArgs:s}=t,r=a?a.ok?"ok":"error":"running",i=s?s(e.args):Ce(On,{data:e.args,defaultExpandDepth:1,maxKeys:50,rootName:"args"}),c=o?[o.message?Ce("div",{class:"wf-toolcall-msg"},`${o.message} (${o.step}/${o.total})`):null,Ce("div",{class:"wf-toolcall-bar",role:"progressbar","aria-valuenow":o.step,"aria-valuemax":o.total},[Ce("div",{class:"wf-toolcall-bar-fill",style:{width:`${Math.min(100,o.step/Math.max(1,o.total)*100)}%`}})])]:null,u=a&&!a.ok&&a.error?Ce("div",{class:"wf-toolcall-error"},`${a.error.code}: ${a.error.message}`):null;return Ce("div",{class:`wf-toolcall wf-toolcall--${r}`},[Ce("div",{class:"wf-toolcall-header"},[Ce("span",{class:`wf-toolcall-icon wf-toolcall-icon--${r}`},Ce(T,{name:js[r]})),Ce("span",{class:"wf-toolcall-name"},e.name)]),Ce("div",{class:"wf-toolcall-body"},[i,c,u].filter(Boolean))])};import{h as oe}from"weifuwu/ui-dom";import{h as Z}from"weifuwu/ui-dom";import{h as ve}from"weifuwu/ui-dom";var tn=async(l,n)=>{let t,e,o=()=>{},a=r=>{clearTimeout(t),clearInterval(e),o(r),t=setTimeout(()=>{e=setInterval(()=>o(r),60)},500)},s=()=>{clearTimeout(t),clearInterval(e)};return async r=>{let{value:i=null,onChange:c,min:u,max:d,step:m=1,precision:p,label:f,name:g,placeholder:h,disabled:y,error:v,hint:b,required:w,className:C}=r,M=$=>{let k=$;return u!=null&&(k=Math.max(u,k)),d!=null&&(k=Math.min(d,k)),p!=null&&(k=Number(k.toFixed(p))),k},E=$=>{if(y)return;c?.(M(Number(((i??0)+$*m).toFixed(10))))};o=E;let S=$=>{if(y)return;let k=$.target.value.trim();if(k===""||k==="-"){c?.(null);return}if(!/^-?\d*\.?\d+$/.test(k))return;let x=Number(k);Number.isNaN(x)||c?.(M(x))},D=i==null?"":String(p!=null?i.toFixed(p):i),I=f?ve("label",{class:"wf-inputnumber-label"},[f,w?ve("span",{class:"wf-inputnumber-req"},"*"):null].filter(Boolean)):null,O=ve("input",{class:"wf-inputnumber-input",type:"text",inputMode:"decimal",value:D,placeholder:h,name:g,disabled:y,onInput:S,onBlur:()=>{i!=null&&c?.(M(i))}}),L=ve("button",{class:"wf-inputnumber-btn",type:"button","aria-label":"\u589E\u52A0",disabled:y,onClick:()=>E(1),onPointerDown:()=>a(1),onPointerUp:s,onPointerLeave:s},ve(T,{name:"chevron-up",size:12})),N=ve("button",{class:"wf-inputnumber-btn",type:"button","aria-label":"\u51CF\u5C11",disabled:y,onClick:()=>E(-1),onPointerDown:()=>a(-1),onPointerUp:s,onPointerLeave:s},ve(T,{name:"chevron-down",size:12})),P=ve("div",{class:`wf-inputnumber${y?" wf-inputnumber--disabled":""}${v?" wf-inputnumber--err":""}${C?` ${C}`:""}`},[O,ve("div",{class:"wf-inputnumber-btns"},[L,N])]),R=[];return I&&R.push(I),R.push(P),v&&R.push(ve("div",{class:"wf-inputnumber-err"},v)),b&&!v&&R.push(ve("div",{class:"wf-inputnumber-hint"},b)),ve("div",{class:"wf-inputnumber-wrap"},R)}};function Bn(l,n){console.warn(`[JsonSchemaForm] \u5B57\u6BB5 "${l}" \u4E0D\u652F\u6301 ${n}\u2014\u2014\u964D\u7EA7\u4E3A\u6587\u672C\u8F93\u5165`)}function Ks(l){return{...l??{}}}function wt(l,n,t){let e=l;for(let o=0;o<n.length-1;o++){let a=n[o];(e[a]==null||typeof e[a]!="object")&&(e[a]={}),e=e[a]}e[n[n.length-1]]=t}function Ye(l,n){let t=l;for(let e of n){if(t==null||typeof t!="object")return;t=t[e]}return t}function nn(l,n,t){let e=Ye(l,n.slice(0,-1));e&&typeof e=="object"&&(e[n[n.length-1]]=t)}function Ws(l,n,t=!1){if(t&&(n==null||n===""))return"\u5FC5\u586B";if(!(n==null||n==="")){if(l.type==="number"||l.type==="integer"){let e=Number(n);return Number.isNaN(e)?"\u5FC5\u987B\u662F\u6570\u5B57":l.minimum!=null&&e<l.minimum?`\u4E0D\u80FD\u5C0F\u4E8E ${l.minimum}`:l.maximum!=null&&e>l.maximum?`\u4E0D\u80FD\u5927\u4E8E ${l.maximum}`:void 0}if(typeof n=="string"){if(l.minLength!=null&&n.length<l.minLength)return`\u81F3\u5C11 ${l.minLength} \u4E2A\u5B57\u7B26`;if(l.maxLength!=null&&n.length>l.maxLength)return`\u6700\u591A ${l.maxLength} \u4E2A\u5B57\u7B26`}if(l.enum?.length&&!l.enum.includes(n))return"\u4E0D\u5728\u5141\u8BB8\u503C\u8303\u56F4\u5185"}}var Nn=async(l,n)=>{let t=Ks(l.value);function e(){n.ui.render(),l.onChange?.(t)}function o(s,r,i,c,u,d=!1){let m=u[i.join(".")],p=r.title??s;if(r.enum?.length){let f=r.enum.map(g=>({value:String(g),label:String(g)}));return Z(mt,{key:s,label:p,required:d,error:m,hint:r.description},Z(qt,{value:c==null?void 0:String(c),options:f,error:m,onChange:g=>{wt(t,i,g==null?void 0:r.enum?.find(h=>String(h)===g)),e()}}))}switch(r.type){case"number":case"integer":return Z(mt,{key:s,label:p,required:d,error:m,hint:r.description},Z(tn,{value:c==null?null:Number(c),min:r.minimum,max:r.maximum,error:m,onChange:f=>{wt(t,i,f??void 0),e()}}));case"boolean":return Z(mt,{key:s,label:p,required:d,error:m,hint:r.description},Z(Ut,{checked:!!c,onChange:f=>{wt(t,i,f),e()}}));case"object":return Z("div",{key:s,class:"wf-jsf-obj"},[Z("div",{class:"wf-jsf-obj-title"},[p,d?Z("span",{class:"wf-field-req"},"*"):null]),...Object.entries(r.properties??{}).map(([f,g])=>o(f,g,[...i,f],Ye(t,[...i,f]),u,r.required?.includes(f)))]);case"array":{let f=Array.isArray(c)?c:[],g=f.map((h,y)=>{let v=[...i,String(y)];return Z("div",{key:y,class:"wf-jsf-arr-item"},[a(String(y),r.items??{},v,f[y],u),Z("button",{type:"button",class:"wf-jsf-arr-del","aria-label":`\u5220\u9664 ${p} \u7B2C ${y+1} \u9879`,onClick:()=>{let b=Array.isArray(Ye(t,i))?[...Ye(t,i)]:[];b.splice(y,1),wt(t,i,b),e()}},Z(T,{name:"trash"}))])});return Z("div",{key:s,class:"wf-jsf-arr"},[Z("div",{class:"wf-jsf-obj-title"},[p,Z("span",{class:"wf-jsf-arr-add",role:"button",tabindex:0,"aria-label":`\u6DFB\u52A0 ${p} \u9879`,onClick:()=>{let h=Array.isArray(Ye(t,i))?[...Ye(t,i)]:[];h.push(void 0),wt(t,i,h),e()},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.target.click())}},Z(T,{name:"plus"}))]),...g])}default:return r.type&&r.type!=="string"&&Bn(s,`type "${r.type}"`),r.$ref&&Bn(s,`$ref \u5F15\u7528\uFF08${r.$ref}\uFF09`),Z(mt,{key:s,label:p,required:d,error:m,hint:r.description},Z(Ft,{value:c==null?"":String(c),onInput:f=>{wt(t,i,f.target.value),e()}}))}}function a(s,r,i,c,u){if(r.enum?.length){let d=r.enum.map(m=>({value:String(m),label:String(m)}));return Z(qt,{value:c==null?void 0:String(c),options:d,onChange:m=>{nn(t,i,r.enum?.find(p=>String(p)===m)),e()}})}switch(r.type){case"number":case"integer":return Z(tn,{value:c==null?null:Number(c),onChange:d=>{nn(t,i,d??void 0),e()}});case"boolean":return Z(Ut,{checked:!!c,onChange:d=>{nn(t,i,d),e()}});case"object":Bn(i.join("."),"\u6570\u7EC4\u5BF9\u8C61 items\uFF08\u5BF9\u8C61\u6570\u7EC4\uFF09");break;default:return Z(Ft,{value:c==null?"":String(c),onInput:d=>{nn(t,i,d.target.value),e()}})}}return async s=>{let r=s.schema,i={};function c(m,p,f=!1){if(m.type==="object"){for(let[h,y]of Object.entries(m.properties??{}))c(y,[...p,h],m.required?.includes(h));return}let g=Ws(m,Ye(t,p),f);g&&(i[p.join(".")]=g)}for(let[m,p]of Object.entries(r.properties??{}))c(p,[m],r.required?.includes(m));let u=Object.entries(r.properties??{}).map(([m,p])=>o(m,p,[m],Ye(t,[m]),i,r.required?.includes(m))),d=s.onSubmit?Z("button",{type:"button",class:"wf-btn wf-btn--primary wf-jsf-submit",onClick:()=>{Object.keys(i).length>0||s.onSubmit?.(t)}},s.submitLabel??"\u63D0\u4EA4"):null;return Z("div",{class:"wf-jsf"},[r.title?Z("div",{class:"wf-jsf-title"},r.title):null,...u,d])}};var Vs={pending:"\u7B49\u5F85\u5BA1\u6279",approved:"\u5DF2\u6279\u51C6",rejected:"\u5DF2\u62D2\u7EDD",timeout:"\u5BA1\u6279\u8D85\u65F6"},Hn=async(l,n)=>{let t="",e=!1,o=!1;return async a=>{let{request:s,status:r="pending",onApprove:i,onReject:c,renderDetail:u,loading:d,argsSchema:m}=a,p=u?u(s):[oe("div",{class:"wf-approval-name"},s.name),oe("code",{class:"wf-approval-args"},JSON.stringify(s.args))],f=m&&o?oe("div",{class:"wf-approval-modify"},[oe(Nn,{schema:m,value:s.args,submitLabel:"\u4EE5\u4FEE\u6539\u540E\u53C2\u6570\u6279\u51C6",onSubmit:h=>i?.(h)}),oe("button",{type:"button",class:"wf-approval-modify-cancel wf-btn wf-btn--secondary wf-btn--sm",onClick:()=>{o=!1,n.ui.render()}},"\u53D6\u6D88\u4FEE\u6539")]):null,g=r==="pending"?oe("div",{class:"wf-approval-actions"},[e?oe("div",{class:"wf-approval-note"},[oe("input",{class:"wf-approval-note-input",placeholder:"\u5907\u6CE8\uFF08\u62D2\u7EDD\u539F\u56E0\uFF0C\u5C06\u8FDB\u5165 agent \u4E0A\u4E0B\u6587\uFF09\u2026","aria-label":"\u62D2\u7EDD\u5907\u6CE8",value:t,disabled:d||void 0,onInput:h=>{t=h.target.value}})]):null,oe("div",{class:"wf-approval-btns"},[oe("button",{class:"wf-btn wf-btn--primary wf-btn--sm",type:"button",disabled:d||void 0,onClick:d?void 0:()=>i?.(void 0)},d?"\u63D0\u4EA4\u4E2D\u2026":"\u5141\u8BB8"),m&&!o?oe("button",{class:"wf-btn wf-btn--secondary wf-btn--sm wf-approval-modify-btn",type:"button",disabled:d||void 0,onClick:d?void 0:()=>{o=!0,n.ui.render()}},"\u4FEE\u6539\u53C2\u6570"):null,oe("button",{class:"wf-btn wf-btn--danger wf-btn--sm",type:"button",disabled:d||void 0,onClick:d?void 0:()=>{if(!e){e=!0,n.ui.render();return}c?.(t)}},e?"\u786E\u8BA4\u62D2\u7EDD":"\u62D2\u7EDD"),e?oe("button",{class:"wf-btn wf-btn--secondary wf-btn--sm",type:"button",disabled:d||void 0,onClick:()=>{e=!1,t="",n.ui.render()}},"\u53D6\u6D88"):null].filter(Boolean))].filter(Boolean)):oe("div",{class:`wf-approval-status wf-approval-status--${r}`},Vs[r]);return oe("div",{class:`wf-approval wf-approval--${r}`},[oe("div",{class:"wf-approval-header"},[oe("span",{class:"wf-approval-icon"},oe(T,{name:r==="pending"?"pause":r==="approved"?"check":"close"})),oe("span",{class:"wf-approval-title"},"\u5DE5\u5177\u5BA1\u6279")]),oe("div",{class:"wf-approval-detail"},p),s.reason?oe("div",{class:"wf-approval-reason"},s.reason):null,g,f])}};import{createClientBrowser as Fs}from"weifuwu/ui-dom";import{h as he}from"weifuwu/ui-dom";import{h as rt}from"weifuwu/ui-dom";var zn=async(l,n)=>{let t=!!l.defaultExpanded;return async e=>{let{content:o,streaming:a,label:s="\u5DF2\u601D\u8003"}=e,r=()=>{t=!t,n.ui.render()};return rt("div",{class:`wf-reasoning${a?" wf-reasoning--streaming":""}`},[rt("button",{type:"button",class:"wf-reasoning-toggle","aria-expanded":t,onClick:r,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),r())}},[rt("span",{class:`wf-reasoning-chevron${t?" wf-reasoning-chevron--open":""}`},rt(T,{name:"chevron-down"})),rt("span",{class:"wf-reasoning-label"},a?`${s}\u2026`:s),a?rt("span",{class:"wf-reasoning-dot","aria-hidden":"true"}):null]),rt("div",{class:`wf-reasoning-body${t?" wf-reasoning-body--open":""}`,hidden:!t},o)])}};import{h as vt}from"weifuwu/ui-dom";var _n=async(l,n)=>async t=>{let e={send:"\u53D1\u9001",stop:"\u505C\u6B62",retry:"\u91CD\u8BD5",placeholder:"\u8F93\u5165\u6D88\u606F\uFF0C\u56DE\u8F66\u53D1\u9001\u2026",...t.labels},o=n.ui.useControlledInput({value:t.value??"",onChange:t.onChange,name:"ChatInput"});t.control&&(t.control.current={setKeyword:i=>{o.setKeyword(i)},setValue:i=>{o.setKeyword(i),t.onChange?.(i)}});let a=!1,s=()=>{let i=o.keyword.trim();i&&(o.setKeyword(""),t.onSend(i))},r={class:"wf-chat-input",value:o.keyword,placeholder:e.placeholder,disabled:t.disabled,onInput:i=>{a||i.isComposing||(o.setKeyword(i.target.value),t.onChange?.(i.target.value))},onCompositionStart:()=>{a=!0},onCompositionEnd:i=>{a=!1;let c=i.target?.value??"";o.setKeyword(c),t.onChange?.(c)},onKeyDown:i=>{if(i.key==="Enter"&&!(a||i.isComposing)){if(i.ctrlKey||i.metaKey){i.preventDefault(),s();return}t.multiline&&i.shiftKey||(i.preventDefault(),s())}}};return vt("div",{class:"wf-chat-inputbar"},[t.multiline?vt("textarea",{...r,rows:1,style:{resize:"none"}}):vt("input",{...r,type:"text"}),t.actions??null,t.streaming?vt("button",{class:"wf-btn wf-btn--primary wf-btn--sm",type:"button",disabled:t.disabled,onClick:()=>t.onStop?.()},e.stop):vt("button",{class:"wf-btn wf-btn--primary wf-btn--sm",type:"button",disabled:t.disabled,onClick:()=>s()},e.send),!t.streaming&&t.error?vt("button",{class:"wf-btn wf-btn--danger wf-btn--sm",type:"button",onClick:()=>t.onRetry?.()},e.retry):null])};var Gs={send:"\u53D1\u9001",stop:"\u505C\u6B62",retry:"\u91CD\u8BD5",thinking:"\u{1F914} \u601D\u8003\u4E2D\u2026",runningTool:l=>l?`\u6267\u884C\u5DE5\u5177 ${l}`:"\u6267\u884C\u5DE5\u5177\u2026",tokens:l=>`tokens: ${l.prompt_tokens}\u2192${l.completion_tokens}`,error:l=>`${l.code}: ${l.message}`,placeholder:"\u8F93\u5165\u6D88\u606F\uFF0C\u56DE\u8F66\u53D1\u9001\u2026",empty:"\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u5BF9\u8BDD\u3002"},qs=async(l,n)=>{let t=n.browser??Fs(),e,o=!0,a=l.chat,s,r=()=>{s?.();let p=a;s=p?.subscribe?p.subscribe(()=>n.ui.render()):void 0};r();let i=p=>{p||(s?.(),s=void 0)},c=n.ui.useVisualViewport(),u=()=>{e&&(e.scrollTop=e.scrollHeight)},d=n.ui.useScrollPosition({getScroller:()=>e??window}),m=p=>{p&&!e?(e=p,d.refresh(),queueMicrotask(u)):!p&&e&&(e=void 0)};return async p=>{let{chat:f,raiseOnKeyboard:g=!1}=p,h={...Gs,...p.labels};f!==a&&(a=f,r()),e&&(o=e.scrollHeight-d.y-e.clientHeight<48),o&&queueMicrotask(u);let y=f.messages??[],v=[];y.length===0&&v.push(he("p",{class:"wf-aichat-empty"},h.empty));for(let b of y)v.push(Us(b,p,h));return f.step&&v.push(he("div",{class:"wf-aichat-status"},f.step.type==="llm"?h.thinking:h.runningTool(f.step.name))),f.usage&&v.push(he("div",{class:"wf-aichat-usage"},h.tokens(f.usage))),f.error&&v.push(he("div",{class:"wf-aichat-error"},h.error(f.error))),he("div",{class:"wf-aichat",ref:i},[he("div",{class:"wf-aichat-list",style:{maxHeight:p.maxHeight??"70vh"},ref:m},v),he("div",{class:`wf-aichat-inputbar${c.keyboardOpen&&g?" wf-aichat-inputbar--raised":""}`,style:c.keyboardOpen&&g?{position:"fixed",left:"0",right:"0",bottom:`${Math.max(0,t?.viewportHeight()-(c.height+c.offsetTop))+8}px`,zIndex:"var(--wf-z-popover)"}:void 0},[he(_n,{value:f.input??"",onChange:b=>{f.input=b},onSend:b=>{f.input=b,f.send()},streaming:f.streaming,onStop:()=>f.stop(),error:f.error?f.error.message:null,onRetry:()=>f.retry(),labels:{send:h.send,stop:h.stop,retry:h.retry,placeholder:h.placeholder}})])])}};function Us(l,n,t){let e=[];if(l.toolCalls?.length){let o=l.toolCalls.map((a,s)=>he(Rn,{key:`${l.id}-tool-${s}`,call:a.call,progress:a.progress,result:a.result,renderArgs:n.renderToolArgs}));e.push(he("div",{class:"wf-aichat-tools"},o))}if(l.approval){let o=he(Hn,{request:l.approval,argsSchema:n.approveSchema?.(l.approval),onApprove:a=>n.chat.approve(a?"modified":"approved",void 0,a),onReject:a=>n.chat.approve("rejected",a??"\u7528\u6237\u62D2\u7EDD")});e.push(he("div",{class:"wf-aichat-approval"},o))}return l.reasoning&&e.push(he(zn,{content:l.reasoning,streaming:l.status==="streaming"})),e.push(he("div",{class:`wf-aichat-bubble wf-aichat-bubble--${l.role}`},n.renderMessage?n.renderMessage(l):l.content||"\u2026")),he("div",{key:l.id,class:`wf-aichat-msg wf-aichat-msg--${l.role}`},e)}import{h as ke}from"weifuwu/ui-dom";var Js=async l=>async n=>ke("div",{class:"wf-center wf-p-xl wf-bg-secondary",style:{minHeight:"100vh"}},[ke(Cn,{},[ke("div",{class:"wf-stack wf-gap-sm wf-text-center wf-mb-lg"},[n.logo?ke("div",{class:"wf-center"},n.logo):null,ke("div",{class:"wf-text-2xl wf-text-semibold"},n.title),n.subtitle?ke("div",{class:"wf-text-sm wf-text-secondary"},n.subtitle):null]),n.error?ke(wn,{variant:"error"},n.error):null,ke("form",{class:"wf-auth-form",onSubmit:t=>{t.preventDefault(),n.onSubmit?.()}},[ke("div",{class:"wf-stack wf-gap-md"},[n.children,ke(lt,{type:"submit",variant:"primary",loading:n.loading,disabled:n.loading,block:!0},n.submitLabel)])]),n.footer?ke("div",{class:"wf-text-center wf-mt-md wf-text-sm"},n.footer):null])]);import{h as ne,Fragment as ea}from"weifuwu/ui-dom";var Ys=/^https?:\/\//i;function Qs(l){let n=l.trim();return Ys.test(n)?n:null}function ye(l){let n=[],t=0,e="",o=()=>{e&&(n.push({type:"text",text:e}),e="")};for(;t<l.length;){let a=l[t];if(a==="`"){let s=l.indexOf("`",t+1);if(s>t){o(),n.push({type:"code",text:l.slice(t+1,s)}),t=s+1;continue}e+=a,t++;continue}if(a==="*"&&l[t+1]==="*"){let s=l.indexOf("**",t+2);if(s>t){o(),n.push({type:"bold",children:ye(l.slice(t+2,s))}),t=s+2;continue}}if(a==="~"&&l[t+1]==="~"){let s=l.indexOf("~~",t+2);if(s>t){o(),n.push({type:"del",children:ye(l.slice(t+2,s))}),t=s+2;continue}}if(a==="*"){let s=l.indexOf("*",t+1);if(s>t){o(),n.push({type:"italic",children:ye(l.slice(t+1,s))}),t=s+1;continue}}if(a==="["){let s=l.indexOf("]",t+1);if(s>t&&l[s+1]==="("){let r=l.indexOf(")",s+2);if(r>s){let i=l.slice(t+1,s),c=l.slice(s+2,r),u=Qs(c);if(u){o(),n.push({type:"link",href:u,children:ye(i)}),t=r+1;continue}e+=l.slice(t,r+1),t=r+1;continue}}}e+=a,t++}return o(),n}function jn(l){let n=l.replace(/\r\n/g,`
3
3
  `).split(`
4
4
  `),t=[],e=0,o=a=>{a.type==="paragraph"&&a.inline.length===0||t.push(a)};for(;e<n.length;){let a=n[e];if(/^\s*$/.test(a)){e++;continue}if(/^```/.test(a.trim())){let p=a.trim().slice(3).trim(),f=[];for(e++;e<n.length&&!/^\s*```/.test(n[e]);)f.push(n[e]),e++;e++,o({type:"code",lang:p||void 0,code:f.join(`
@@ -1,12 +1,12 @@
1
- function zt(e){let n=[],t=(e||"/").replace(/:(\w+)/g,(o,r)=>(n.push(r),"([^/]+)")).replace(/\*/g,".*");return{re:new RegExp(`^${t}$`),keys:n}}var mn=class{_routes=[];_middlewares=[];_injections=[];_injected=!1;_mode;_notFound;constructor(n={}){this._mode=n.mode??"history"}get mode(){return this._mode}use(n,t){if(typeof n=="string"&&t){let o=this,r=n,i=async(s,l,d)=>{let u=l.__routePath??o.getPath(),a=null;return u===r?a="/":(r==="/"?u!=="/"&&u.startsWith("/"):u.startsWith(r+"/"))&&(a=u.slice(r.length)),a===null?d:async(c,f)=>{let p=await t._handle(a,c,f);return p===null?d(c,f):p}};return this._middlewares.push(i),this}return n.length<=1?(this._injections.push(n),this):(this._middlewares.push(n),this)}async _ensureInjected(n){if(!this._injected){this._injected=!0;for(let t of this._injections){let o=await t(n);o&&o!==n&&Object.assign(n,o)}}}get(n,t,o){return this._routes.push({path:n,handler:t,title:o?.title}),this}notFound(n){return this._notFound=n,this}getPath(){return this._getPath(void 0)}_getPath(n){let t=n?.location??(typeof window<"u"?window.location:null);return this._mode==="hash"?(t?.hash??"").replace(/^#/,"")||"/":t?.pathname??"/"}match(n){let t=null;for(let o of this._routes){let{re:r,keys:i}=zt(o.path),s=n.match(r);if(!s)continue;let l={};for(let d=0;d<i.length;d++)l[i[d]]=decodeURIComponent(s[d+1]);t={handler:o.handler,params:l,title:o.title};break}return t||(t={handler:this._notFound??(()=>null),params:{}}),t}async _handle(n,t,o){await this._ensureInjected(o);let r=this.match(n);r.title&&typeof document<"u"&&(document.title=r.title),o.params=r.params,o.route&&(o.route.params=r.params);let s=r.handler,l=o.__routePath;o.__routePath=n;try{for(let d=this._middlewares.length-1;d>=0;d--){let u=this._middlewares[d],a=s;s=await u(t,o,a)??a}return await s(t,o)}finally{o.__routePath=l}}async execute(n,t,o){await this._ensureInjected(t);let r=this.match(o);r.title&&typeof document<"u"&&(document.title=r.title),t.params=r.params,t.route&&(t.route.params=r.params);let s=r.handler;for(let l=this._middlewares.length-1;l>=0;l--){let d=this._middlewares[l],u=s;s=await d(n,t,u)??u}return await s(n,t)}};var J=Symbol("Fragment"),K=Symbol("Portal");function qe(e){return e!=null&&typeof e=="object"&&typeof e.type=="string"}function ne(e){return e!=null&&typeof e=="object"&&e.type===J}function P(e){return e!=null&&typeof e=="object"&&typeof e.type=="function"}function q(e){return e!=null&&typeof e=="object"&&e.type===K}function Ke(e,n,t=null){return{type:e,props:n,key:t,_child:null,_parentNode:null,_refNode:null,_id:null,_customId:null,_parentVNode:null,_ctxVersion:null,_lifecycle:"fresh"}}function Pe(e,n,t=null){return e===J?{...Ke(e,n,t),type:e}:e===K?{...Ke(e,n,t),type:e,_remoteEl:null,_placement:"remote"}:typeof e=="function"?{...Ke(e,n,t),type:e,_render:null,_outputChild:null}:{...Ke(e,n,t),type:e,el:null}}function ge(e,n,...t){let o=et(n??{});return t.length>0&&(o.children=t.length===1?t[0]:t),Pe(e,o,n?.key??null)}function yn(e,n,t){return Pe(e,et(n),t??null)}var Yt=yn;function Xt(e,n,t){return yn(e,n,t)}function et(e){if(!e)return{};let n={};for(let t of Object.keys(e))t!=="key"&&(n[t]=e[t]);return n}function A(e){return e==null||typeof e=="boolean"?[]:Array.isArray(e)?e:[e]}function Ge(e,n){let t=Pe(K,{children:e,portalKey:n});return t.key=n??null,t}function V(){return{activeElement:()=>typeof document<"u"?document.activeElement:null,byId:e=>typeof document<"u"?document.getElementById(e):null,query:e=>typeof document<"u"?document.querySelector(e):null,queryAll:e=>typeof document<"u"?document.querySelectorAll(e):null,createElement:e=>typeof document<"u"?document.createElement(e):null,createElementNS:(e,n)=>typeof document<"u"?document.createElementNS(e,n):null,createDocumentFragment:()=>typeof document<"u"?document.createDocumentFragment():null,createComment:e=>typeof document<"u"?document.createComment(e):null,createTextNode:e=>typeof document<"u"?document.createTextNode(e):null,addEventListener:(e,n,t)=>{typeof window<"u"&&window.addEventListener(e,n,t)},removeEventListener:(e,n,t)=>{typeof window<"u"&&window.removeEventListener(e,n,t)},scrollTo:e=>{typeof window<"u"&&window.scrollTo(0,e)},matchMedia:e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e):null,visualViewport:()=>(typeof window<"u"?window:null)?.visualViewport??null,scrollingElement:()=>typeof document<"u"?document.scrollingElement:null,bodyElement:()=>typeof document<"u"?document.body:null,bodyAppend:e=>{typeof document<"u"&&document.body.appendChild(e)},bodyRemove:e=>{typeof document<"u"&&e.parentNode&&document.body.removeChild(e)},clearBody:()=>{typeof document<"u"&&(document.body.innerHTML="")},event:(e,n)=>{let t=typeof window<"u"?window:null,o=n&&(n.key||n.code)?"KeyboardEvent":n&&(n.clientX!==void 0||n.clientY!==void 0||n.pointerId!==void 0)?"PointerEvent":"Event";try{return new t[o](e,n)}catch{return new t.Event(e,n)}},dispatchEvent:(e,n)=>typeof e<"u"?e.dispatchEvent(n):!1,navigate:e=>{typeof window>"u"||(window.history.pushState(null,"",e),window.dispatchEvent(new PopStateEvent("popstate",{state:null})))},copyText:async e=>{let n=typeof window<"u"?window:null;if(n?.navigator?.clipboard?.writeText)try{return await n.navigator.clipboard.writeText(e),!0}catch{}try{if(typeof document>"u")return!1;let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let o=document.execCommand("copy");return document.body.removeChild(t),o}catch{return!1}},execCommand:(e,n)=>typeof document<"u"?document.execCommand(e,!1,n):!1,queryCommandState:e=>typeof document<"u"?document.queryCommandState(e):!1,queryCommandValue:e=>typeof document<"u"?document.queryCommandValue(e):"",selectionText:()=>typeof window<"u"?window.getSelection?.()?.toString()??null:null,getSelection:()=>typeof window<"u"?window.getSelection():null,viewportHeight:()=>typeof window<"u"?window.innerHeight:0,viewportWidth:()=>typeof window<"u"?window.innerWidth:0,pathname:()=>typeof window<"u"?window.location.pathname:"",createTreeWalker:(e,n)=>typeof document<"u"?document.createTreeWalker(e,n??NodeFilter.SHOW_ALL):null,scrollTop:()=>{let e=typeof document<"u"?document:null,n=typeof window<"u"?window:null;return e?.scrollingElement?.scrollTop??n?.scrollY??0},hash:()=>typeof window<"u"?window.location?.hash??"":"",setHash:e=>{typeof window<"u"&&(window.location.hash=e)},timeout:(e,n)=>typeof window<"u"?window.setTimeout(e,n):0,rootElement:()=>typeof document<"u"?document.documentElement:null,storageGet:e=>{try{return typeof window<"u"?window.localStorage?.getItem(e)??null:null}catch{return null}},storageSet:(e,n)=>{try{typeof window<"u"&&window.localStorage?.setItem(e,n)}catch{}}}}function Jt(e,n,t=400){let o=!1,r=()=>{o||(o=!0,e.removeEventListener("animationend",r),clearTimeout(i),n())};e.addEventListener("animationend",r);let i=setTimeout(r,t)}function be(e,n){return Object.assign(Object.create(e),n)}function Qt(e){let n={baseURL:e?.baseURL??"",headers:{"Content-Type":"application/json",...e?.headers}},t=e?.onRequest,o=e?.onResponse,r=e?.timeout??0;async function i(s,l,d,u,a=!1){let c=n.baseURL+l,f={method:s,headers:{...n.headers,...u?.headers}},p=e?.token?.();p&&!f.headers.Authorization&&(f.headers.Authorization=`Bearer ${p}`);let m=r>0,g=!!u?.signal,h=null,N=null;(m||g)&&(h=new AbortController,f.signal=h.signal,m&&(N=setTimeout(()=>h.abort(new Error("Request timed out")),r)),g&&u.signal.addEventListener("abort",()=>h.abort())),d!==void 0&&s!=="GET"&&s!=="HEAD"&&(f.body=JSON.stringify(d));let y={url:c,init:f};t&&(y=t(y));try{let v=await fetch(y.url,y.init);if(v.status===401&&await e?.onUnauthorized?.()&&!a)return i(s,l,d,u,!0);if(o)return o(v);if(!v.ok){let W=await v.text().catch(()=>"");throw new gn(v.status,W||v.statusText)}let b=v.headers.get("content-length");if(v.status===204||b==="0")return;let H=(v.headers.get("content-type")||"").toLowerCase();return H.includes("application/json")||H.includes("json")?v.json():v.text()}finally{N&&clearTimeout(N)}}return s=>be(s,{api:{get:(d,u)=>i("GET",d,void 0,u),post:(d,u,a)=>i("POST",d,u,a),put:(d,u,a)=>i("PUT",d,u,a),patch:(d,u,a)=>i("PATCH",d,u,a),delete:(d,u)=>i("DELETE",d,void 0,u)}})}var gn=class extends Error{status;body;constructor(n,t){super(`API Error ${n}: ${t}`),this.name="ApiError",this.status=n,this.body=t}};function Zt(e){try{let n=e.split(".");if(n.length!==3)return null;let t=n[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(t))}catch{return null}}function eo(e){let n=Zt(e);return n?.exp?n.exp*1e3-3e4<Date.now():!0}function no(e){let n=e?.storage??localStorage,t=e?.tokenKey??"weifuwu_token",o=e?.userKey??"weifuwu_user",r=e?.refreshTokenKey??"weifuwu_refresh",i=e?.refreshEndpoint??"/api/auth/refresh";return s=>{let l=n.getItem(t),d=n.getItem(o),u=null,a={token:l,user:d?JSON.parse(d):null,get isLoggedIn(){return this.token!==null},login(f,p,m){a.token=f,a.user=p,n.setItem(t,f),n.setItem(o,JSON.stringify(p)),m&&n.setItem(r,m)},logout(){a.token=null,a.user=null,n.removeItem(t),n.removeItem(o),n.removeItem(r)},setUser(f){a.user=f,n.setItem(o,JSON.stringify(f))},async refresh(){return u||(u=c().finally(()=>{u=null}),u)}};async function c(){let f=n.getItem(r);if(!f)return!1;let p=n.getItem(t);try{let m=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:f})});if(n.getItem(t)!==p)return!1;if(!m.ok)return a.logout(),!1;let g=await m.json();return n.getItem(t)!==p?!1:(a.token=g.token,n.setItem(t,g.token),g.refreshToken&&n.setItem(r,g.refreshToken),!0)}catch{return!1}}return l&&eo(l)&&a.refresh().catch(()=>{}),e?.onAuth?.(a),be(s,{auth:a})}}function to(e={}){let n=e.url??"/ws",t=e.reconnectInterval??3e3,o=e.maxReconnect??10,r=e.pingInterval??3e4,i=e.pingTimeout??1e4;return s=>{let l=new Set,d=null,u=0,a=null,c=null,f=null,p=!1,m=[],g={isConnected:!1,onMessage:b=>(l.add(b),()=>{l.delete(b)}),send:b=>{let H=JSON.stringify(b);d?.readyState===WebSocket.OPEN?d.send(H):m.push(H)},_connect:h,close:()=>{p=!0,v(),d?.close(),d=null,m=[],g.isConnected=!1}};async function h(){if(!p)try{d=new WebSocket(n),d.onopen=()=>{g.isConnected=!0,u=0;for(let b of m)d.send(b);m=[],N()},d.onmessage=b=>{try{let H=JSON.parse(b.data);for(let W of l)W(H)}catch{}y()},d.onclose=()=>{g.isConnected=!1,v(),!p&&u<o&&(u++,a=setTimeout(h,t*Math.min(u,5)))},d.onerror=()=>{d?.close()}}catch{p||(a=setTimeout(h,t))}}function N(){r<=0||(c=setInterval(()=>{d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"ping"})),f=setTimeout(()=>{d?.close()},i)},r))}function y(){clearTimeout(f)}function v(){clearInterval(c),clearTimeout(f),clearTimeout(a)}return h(),be(s,{ws:g})}}var oo={route:"route",lifecycle:"lifecycle",x2y:"diff",keys:"diff",pos:"diff",render:"render",audit:"audit",build:"build",mount:"mount",diff:"diff"};function tt(e){return oo[e]}var Ce=new Set;function Ye(e){return Ce.add(e),()=>{Ce.delete(e)}}var ze=[],ro=0;function Xe(e){let n=`R${++ro}${e?":"+e:""}`;return ze.push(n),n}function Re(){ze.pop()}function io(){return ze[ze.length-1]??""}function S(e){if(Ce.size!==0){e.session||(e.session=io()),typeof e.payload=="function"&&(Ce.size>1||x(tt(e.machine),e.level??"debug"))&&(e.payload=e.payload());for(let n of Ce)try{n(e)}catch{}}}function ot(){return Ce.size>1}function so(e){if(e==null)return"";if(typeof e=="string")return` ${e}`;if(typeof e=="object"){let n=e,t=[];for(let o of["path","i","key","mode","kind","insertedBefore","after","depth"])if(n[o]!==void 0){let r=n[o];t.push(`${o}=${typeof r=="object"?JSON.stringify(r):String(r)}`)}return t.length?" "+t.join(" "):""}return` ${String(e)}`}function lo(e){let n=tt(e.machine);if(!x(n,e.level??"debug"))return;if(e.event==="TRACE"){console.log(`[vdom:${e.machine}] ${e.payload}`);return}let t=e.component?`${e.component}${e.nodeId?`(${e.nodeId})`:""}`:e.nodeId?`(${e.nodeId})`:"";console.log(`[vdom:${e.machine}] ${t?t+" ":""}${e.from} --${e.event}--> ${e.to}${so(e.payload)}`)}Ye(lo);var ao=500,Se=[],nt=!1;function uo(e){Se.push(e),Se.length>ao&&Se.shift()}function rt(){nt||(nt=!0,Ye(uo))}function it(){rt()}function st(e=50,n){return rt(),n?Se.filter(t=>Object.entries(n).every(([o,r])=>t[o]===r)).slice(-e):Se.slice(-e)}var co={fresh:{BUILD_START:"building",BUILD_DONE:"built",PRUNE:"pruned",DISPOSE:"disposed"},building:{BUILD_DONE:"built",DISPOSE:"disposed"},built:{BUILD_START:"building",PRUNE:"pruned",DISPOSE:"disposed"},pruned:{BUILD_START:"building",PRUNE:"pruned",DISPOSE:"disposed"},disposed:{BUILD_START:"building"}};function Q(e){let n=0,t=e._parentVNode??null;for(let o=0;o<10&&t;o++)n++,t=t._parentVNode??null;return{name:typeof e.type=="function"?e.type.name||"anonymous":String(e.type),id:e._id??null,depth:n}}var Je=new Map,fo=50;function po(e,n,t,o){if(!e?.id)return;let r=Je.get(e.id);r||(r={name:e.name??"?",events:[]},Je.set(e.id,r)),r.events.push(`${n}--${t}-->${o}`),r.events.length>fo&&r.events.shift()}function lt(e){if(e){let n=Je.get(e);return n?`${n.name}(${e}): ${n.events.join(" \u2192 ")}`:`no timeline for ${e}`}return[...Je.entries()].map(([n,t])=>`${t.name}(${n}): ${t.events.join(" \u2192 ")}`).join(`
2
- `)}function Z(e,n,t){let o=co[e]?.[n]??null;return o==null?(S({session:"",machine:"lifecycle",nodeId:t?.id??null,component:t?.name??null,from:e,event:n,to:"?",level:"warn",ts:Date.now()}),e):(po(t,e,n,o),S({session:"",machine:"lifecycle",nodeId:t?.id??null,component:t?.name??null,from:e,event:n,to:o,payload:()=>({depth:t?.depth??0}),level:"debug",ts:Date.now()}),o)}function Ve(e){return!e||e._lifecycle==="disposed"||e._child==null?!1:!hn(e._child)}function hn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e)){for(let t of e)if(hn(t))return!0;return!1}let n=e;return!!(n._lifecycle==="disposed"||n._child!=null&&hn(n._child))}var vn={error:0,warn:1,info:2,debug:3,trace:4},dt=["mount","build","render","diff","lifecycle","route","audit"],te={enabled:!1,stages:new Set,level:"info",filter:null},Nn=!1;function mo(e){return e&&e in vn?e:"info"}function at(e){let n=new Set;if(!e)return n;for(let t of e.split(",")){let o=t.trim().split(":")[0];dt.includes(o)&&n.add(o)}return n}function bn(){if(Nn)return te;Nn=!0;try{let e=globalThis,n=new URLSearchParams(typeof e.location?.search=="string"?e.location.search:""),t=n.get("vdom_trace"),o=n.get("vdom_debug"),r=e.__vdom_trace__,i=typeof e.localStorage?.getItem=="function"?e.localStorage.getItem("vdom_trace"):null;if(o==="1"||e?.localStorage?.getItem?.("__WF_VDOM_DEBUG")==="1")te={enabled:!0,stages:new Set(dt),level:"debug",filter:null};else if(t||r||i){let s=new Set;if(t)for(let l of at(t))s.add(l);if(r?.stages){let l=Array.isArray(r.stages)?r.stages:[...r.stages];for(let d of l)s.add(d)}if(i)for(let l of at(i))s.add(l);te={enabled:!0,stages:s,level:t?.includes(":")?mo(t.split(":")[1]):r?.level??"debug",filter:typeof r?.filter=="string"?r.filter:null}}}catch{}return te}function x(e,n="info"){return!te.enabled&&(Nn||bn(),!te.enabled)||te.stages.size&&!te.stages.has(e)?!1:vn[n]<=vn[te.level]}function k(e,n,t,...o){if(!x(e,n)&&!ot())return;let r=te.filter;r&&!t.includes(r)||S({session:"",machine:e,nodeId:null,component:null,from:"",event:"TRACE",to:"",payload:()=>o.length?`${t} ${o.join(" ")}`:t,level:n,ts:Date.now()})}var yo=0;function ut(e){return`R${++yo}${e?`:${e}`:""}`}function G(e,n=12){if(!e)return"\u2205";if(typeof e=="string"||typeof e=="number")return`"${e}"`;if(!Array.isArray(e))return he(e);let t=e.slice(0,n).map(he);return e.length>n&&t.push(`\u2026+${e.length-n}`),`[${t.join(" | ")}]`}function ct(e){return typeof e=="function"?"function":e===J?"fragment":typeof e=="string"?"string":"other"}var go={function:e=>e.name||"Comp",fragment:()=>"Frag",string:e=>String(e),other:e=>String(e)},ho={function:e=>e.name||"anonymous",fragment:()=>"Fragment",string:e=>String(e),other:e=>e===K?"Portal":String(e)};function he(e){if(e==null||typeof e=="boolean")return String(e);if(typeof e=="string")return`"${e.slice(0,16)}"`;if(typeof e=="number")return String(e);if(Array.isArray(e))return`ARR(${e.length})`;let n=e,t=n.type,o=go[ct(t)](t),r=n.props?.id?`#${n.props.id}`:n.key!=null?`@${n.key}`:"";return o+r}function z(e){if(!e)return"null";if(e.nodeType===1){let n=e;return`${n.tagName}${n.id?`#${n.id}`:""}${n.getAttribute?.("data-wf-key")?`@${n.getAttribute("data-wf-key")}`:""}`}return e.nodeType===3?`"${(e.textContent??"").slice(0,12)}"`:e.nodeType===8?`<!--${(e.nodeValue??"").slice(0,40)}-->`:`#${e.nodeType}`}function se(e,n=12){if(!e)return"null";let o=Array.from(e.childNodes).slice(0,n).map(z);return e.childNodes.length>n&&o.push(`\u2026+${e.childNodes.length-n}`),`[${o.join(" | ")}]`}function wn(e,n=0){if(e==null||typeof e=="boolean")return[];if(typeof e=="string"||typeof e=="number")return[`${" ".repeat(n)}"${String(e).slice(0,20)}"`];if(Array.isArray(e))return e.flatMap(u=>wn(u,n));let t=e,o=t.type,r=ho[ct(o)](o),i=t._lifecycle?`[${t._lifecycle}]`:"",s=t._id?`(${t._id})`:"",l=[`${" ".repeat(n)}${r}${s}${i}`],d=t._child;return d!=null&&l.push(...wn(d,n+1)),l}function ft(e){let n=globalThis;if(n.__vdom_dump==null&&(n.__vdom_dump=()=>wn(e()??null).join(`
3
- `)),n.__vdom_lc==null&&(n.__vdom_lc=t=>lt(t)),n.__vdom_events==null){let t=st;n.__vdom_events=(o,r)=>t(o,r)}}function I(e){return typeof e=="function"&&e.name||"anonymous"}function Qe(e){return e.ui?._ctxVersion??0}function Cn(e,n){e.ui?.setMounting?.(n)}var vo=0;function ye(){return{idRegistry:new Map,unmountHooks:[],nextId:()=>`_wf_${vo++}`}}function Ze(e,n){return e.unmountHooks.push(n),()=>{let t=e.unmountHooks.indexOf(n);t>=0&&e.unmountHooks.splice(t,1)}}function pt(e,n){for(let t of[...e.unmountHooks])t(n);e.idRegistry.delete(n),e.idRegistry.delete(`custom:${n}`)}function No(e,n,t,o){try{e(n)}catch(r){console.error(`[weifuwu] ref ${t} error in <${o??"anonymous"}>`,r)}}function U(e,n){if(e==null||typeof e!="object")return;let t=e;if(t._id){let o=Q(t);if(t._customId&&n.idRegistry.delete(t._customId),n.idRegistry.delete(t._id),n.unmountHooks.length>0){let r=[...n.unmountHooks];for(let i of r)i(t._id);if(t._customId)for(let i of r)i(t._customId)}t._id=null,t._customId=null,P(t)&&(t._render=null),t._parentNode=null,t._refNode=null,t._lifecycle=Z(t._lifecycle,"DISPOSE",o)}else(P(t)||t._child!=null)&&(t._lifecycle=Z(t._lifecycle,"DISPOSE",Q(t)));if(t._child!=null){if(Array.isArray(t._child))for(let o of t._child)o&&typeof o=="object"&&U(o,n);else U(t._child,n);t._child=null}if(t.props?.children&&typeof t.type=="string"){let o=Array.isArray(t.props.children)?t.props.children:[t.props.children];for(let r of o)r&&typeof r=="object"&&U(r,n)}if(typeof t.props?.ref=="function"&&No(t.props.ref,null,"cleanup"),q(t)){let o=t._remoteEl;if(o){let r=t._child;if(r!=null)if(Array.isArray(r))for(let i of r)i&&typeof i=="object"&&U(i,n);else typeof r=="object"&&U(r,n);o.remove(),t._remoteEl=null}}}function L(e,n){if(e==null||typeof e!="object")return null;if(Array.isArray(e)||ne(e)){let o=n;if(o&&o.nodeType===8&&o.nodeValue?.includes("type=fragment-start")){let r=[o],i=/fid=([^\s"]+)/.exec(o.nodeValue)?.[1]??"",s=o.nextSibling;for(;s&&(r.push(s),!(s.nodeType===8&&s.nodeValue?.includes("type=fragment-end")&&(/fid=([^\s"]+)/.exec(s.nodeValue)?.[1]??i)===i));)s=s.nextSibling;return r}return null}let t=e;return P(t)?L(t._outputChild??t._child,n):null}function $(e){if(e==null||typeof e=="boolean")return"hole";if(typeof e=="string"||typeof e=="number")return"text";if(Array.isArray(e))return"arr";let n=e;return ne(n)?"frag":q(n)?"portal":P(n)?"comp":"native"}function Vn(e){let n=!1,t=!1;for(let o of e){if(o==null||typeof o=="boolean"||typeof o=="string"||typeof o=="number")continue;if(Array.isArray(o)){t=!0;continue}let r=o;q(r)||(r.key!=null?n=!0:t=!0)}return n&&t?"mixed":n?"keyed":"unkeyed"}function wo(e){if(e===!1)return"false";if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0)return"true";if(typeof e=="object")try{let n=JSON.stringify(e);return`object ${n!=null&&n.length>80?n.slice(0,80)+"\u2026":n??""}`}catch{return`object ${Object.prototype.toString.call(e)}`}return`bad-vnode type=${typeof e}`}function en(e){return/[\s"=]/.test(e)?`"${e.replace(/"/g,"'")}"`:e}function B(e){let n=[`type=${e.type}`];return e.value!==void 0&&n.push(`value=${en(wo(e.value))}`),e.key!=null&&n.push(`key=${en(e.key)}`),e.id!=null&&n.push(`id=${en(e.id)}`),e.fid!=null&&n.push(`fid=${en(e.fid)}`),`wf-hole: ${n.join(" ")}`}function yt(e){return typeof e!="string"&&typeof e!="function"&&e!==J&&e!==K}function gt(e){for(let n=0;n<e.length;n++){let t=e[n];if(t!=null&&typeof t=="object"&&!Array.isArray(t)){let o=t;o.key!==null&&(o.key=String(o.key))}}}var bo=/^on[A-Z]/,Co=/^on[A-Z].*Capture$/;function xn(e){let n=Co.test(e);return{type:(n?e.slice(2,-7):e.slice(2)).toLowerCase(),capture:n}}var En=new Set(["draggable","contenteditable","spellcheck","translate"]),Vo=new Set(["zIndex","opacity","lineHeight","fontWeight","fontSizeAdjust","flex","flexGrow","flexShrink","order","zoom","aspectRatio","gridRow","gridColumn","scale","rotate","animationIterationCount","columnCount","fillOpacity","strokeOpacity","stopOpacity","floodOpacity"]);function Tn(e){return En.has(e.toLowerCase())?"enumerated":e==="class"||e==="className"?"class":e==="style"?"style":e==="ref"?"ref":bo.test(e)?"event":e==="value"?"value":e==="indeterminate"?"indeterminate":e==="innerHTML"?"innerHTML":e.startsWith("aria-")?"aria":"default"}function mt(e,n,t){if(t!==!1){if(t===!0){e.setAttribute(n,"");return}try{e[n]=t,e.getAttribute(n)!==String(t)&&e.setAttribute(n,String(t))}catch{e.setAttribute(n,String(t))}}}var xo={enumerated:(e,n,t)=>{e.setAttribute(n,t?"true":"false")},class:(e,n,t)=>{if(t!==!1)if(typeof t=="object")for(let[o,r]of Object.entries(t))r&&e.classList.add(o);else e.setAttribute("class",String(t))},style:(e,n,t)=>{if(t!==!1)if(typeof t=="string")e.setAttribute("style",t);else{let o=e.style;for(let[r,i]of Object.entries(t))i==null?o[r]="":r.startsWith("--")?o.setProperty(r,String(i)):typeof i=="number"&&!Vo.has(r)?o[r]=`${i}px`:o[r]=String(i)}},ref:(e,n,t)=>{if(typeof t=="function")try{t(e)}catch(o){console.error("[weifuwu] ref error",o)}},event:(e,n,t)=>{if(t===!1)return;let{type:o,capture:r}=xn(n);if(typeof t!="function"){console.warn(`[weifuwu] event prop ${n} expects a function, got ${typeof t} \u2014 ignored`);return}e.addEventListener(o,t,r?{capture:!0}:{})},value:(e,n,t)=>{t!==!1&&(e.value=t)},indeterminate:(e,n,t)=>{t!==!1&&(e.indeterminate=!!t)},innerHTML:(e,n,t)=>{t!==!1&&(e.innerHTML=String(t??""))},aria:(e,n,t)=>{if(t!==!1){if(typeof t=="boolean"){e.setAttribute(n,t?"true":"false");return}mt(e,n,t)}},default:mt};function oe(e,n,t){t!=null&&xo[Tn(n)](e,n,t)}function le(e,n){return e.createComment(B({type:"hole",value:n,key:null,id:null,fid:null}))}function ae(){return!!globalThis?.__WF_VDOM_AUDIT}var ht=!1;function vt(){ht||(ht=!0,Ye(e=>{e.machine!=="render"||e.event!=="PARENT"||ae()&&e.to==="SKIP_DETACHED"&&console.error(`[vdom2/audit] \u6302\u8F7D\u4E0D\u53D8\u91CF\u8FDD\u53CD\uFF1A\u7EC4\u4EF6 ${e.component??"?"}${e.nodeId?`(${e.nodeId})`:""} \u72B6\u6001 ${String(e.payload?.lifecycle)} \u4F46\u65E0 _parentNode/_refNode\uFF08rootEl \u53EA\u5C5E\u4E8E\u6839\u7EC4\u4EF6\uFF09\u2014\u2014\u6302\u8F7D\u4FE1\u606F\u65AD\u88C2\uFF0C\u6E32\u67D3\u88AB\u8DF3\u8FC7\uFF0C\u72B6\u6001\u66F4\u65B0\u5C06\u4E22\u5931`)}))}function nn(e,n,t){if(n==null||n.length===0)return;let o=Array.from(e.childNodes);if(!n.some(i=>{if(i==null||typeof i!="object")return!1;if(Array.isArray(i))return!0;let s=i.type;return s===J||s===K}))for(let i=0;i<n.length;i++){let s=n[i];if(s==null||typeof s=="boolean"){let l=o[i];(!l||l.nodeType!==8||!l.nodeValue?.includes("type=hole"))&&t(`[audit] \u5360\u4F4D\u9519\u4F4D\uFF1A\u4F4D\u7F6E ${i} \u671F\u671B\u6CE8\u91CA(wf-hole)\uFF0C\u5B9E\u9645 ${l?.nodeName??"null"}\uFF08${e.nodeName}\uFF09`)}else if(typeof s=="string"||typeof s=="number"){let l=o[i];l&&l.nodeType!==3&&t(`[audit] \u6587\u672C\u9519\u4F4D\uFF1A\u4F4D\u7F6E ${i} \u671F\u671B\u6587\u672C\u8282\u70B9\uFF0C\u5B9E\u9645 ${l.nodeName}\uFF08${e.nodeName}\uFF09`)}}}function xe(e,n,t){Eo[$(n)](e,n,t)}var Eo={hole:()=>{},text:()=>{},arr:To,portal:()=>{},frag:_o,comp:ko,native:Po};function To(e,n,t){let o=n;nn(e,o,t);for(let r of o)if(r!=null&&typeof r=="object"&&Array.isArray(r))for(let i of r)xe(e,i,t);else r!=null&&typeof r=="object"&&!Array.isArray(r)&&ne(r)&&nn(e,A(r.props?.children),t)}function _o(e,n,t){nn(e,A(n.props?.children),t)}function ko(e,n,t){let o=n,r=o._refNode;r&&r.parentNode!==e&&t(`[audit] \u7EC4\u4EF6\u951A\u70B9\u9519\u4F4D\uFF1A${I(o.type)} _refNode \u4E0D\u5728\u7236\u8282\u70B9\u5185`),o._child!=null&&xe(e,o._child,t)}function Po(e,n,t){let o=n;if(yt(o.type))return;let r=o.el??o._refNode;if(r&&r.nodeType===1&&r.tagName.toLowerCase()!==String(o.type)&&t(`[audit] \u5143\u7D20\u7C7B\u578B\u9519\u4F4D\uFF1A\u671F\u671B <${String(o.type)}>\uFF0C\u5B9E\u9645 ${r.tagName}`),r&&r.nodeType===1&&!("innerHTML"in(o.props??{}))){nn(r,A(o.props?.children),t);for(let i of A(o.props?.children))i!=null&&typeof i=="object"&&!Array.isArray(i)&&P(i)&&xe(r,i,t)}}function So(e,n){if(e===n)return!0;let t=Object.keys(e),o=Object.keys(n);if(t.length!==o.length)return!1;for(let r of t)if(e[r]!==n[r])return!1;return!0}async function Ro(e,n,t,o){let r=e;r._id||(o?.reuse?._id?r._id=o.reuse._id:r._id=t.nextId(),t.idRegistry.set(r._id,r)),o?.reuse&&(o.reuse._parentNode&&(r._parentNode=o.reuse._parentNode),o.reuse._refNode&&(r._refNode=o.reuse._refNode),o.reuse._ctxVersion!=null&&(r._ctxVersion=o.reuse._ctxVersion));let i=Object.create(n);i.ui=Object.create(n.ui);let s=i.ui;if(s._selfId=r._id??null,s._selfVNode=r,s.render=function(l){let d=n.ui;return l==null&&r._id?d.render([r._id]):d.render(l)},typeof r._render!="function"&&P(o?.reuse)&&typeof o.reuse._render=="function"&&(r._render=o.reuse._render),typeof r._render!="function"){Cn(n,!0);let l;try{l=await r.type(r.props??{},i)}finally{Cn(n,!1)}if(typeof l!="function")throw new Error(`Component ${I(e.type)} must return a render function. Use (init_props, ctx) => (props) => VNode pattern.`);r._render=l}return{renderFn:r._render,childCtx:i}}function _n(e){return!!e&&typeof e.then=="function"}function Y(e,n,t,o,r){return Ao[$(e)](e,n,t,o,r)}function kn(e,n){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&e.type===n.type?e:null}var Ao={hole:e=>e,text:e=>e,arr:Io,comp:Lo,frag:Mo,native:Nt,portal:Nt};function Io(e,n,t,o,r){let i=e;x("build")&&k("build","debug","",`array in kids=${G(i)}`);for(let a of i)if(a!=null&&typeof a=="object"&&!Array.isArray(a)&&a._lifecycle==="disposed"){let c=a;S({session:"",machine:"audit",nodeId:c._id??null,component:I(c.type),from:"disposed",event:"CONTRACT_VIOLATION",to:"new-tree",level:"error",ts:Date.now()}),ae()&&console.error(`[vdom2/audit] \u4E24\u9636\u6BB5\u5951\u7EA6\u8FDD\u53CD\uFF1A\u7EC4\u4EF6 ${I(c.type)} \u7684 renderFn \u8FD4\u56DE\u4E86 disposed \u65E7 vnode${c._id?`(${c._id})`:""}\u2014\u2014\u590D\u7528\u65E7\u6811\u5BF9\u8C61\uFF08\u5E94\u4E3A\u6BCF\u6B21\u6E32\u67D3\u751F\u6210\u65B0 vnode\uFF09\u3002\u540C\u4E00\u5BF9\u8C61\u65E2\u662F\u65E7\u6811\u53C8\u88AB dispose \u2192 diff \u81EA dispose \u2192 \u5361\u7247\u9519\u4F4D/\u6D88\u5931\uFF08demo \u641C\u7D22\u6062\u590D\u4E8B\u6545\uFF09`);break}for(let a=0;a<i.length;a++){let c=i[a];if(c!=null&&typeof c=="object"&&!Array.isArray(c)){let f=c;f.key!==null&&(f.key=String(f.key))}}let s=Array.isArray(t)?t:[],l=new Map;for(let a of s)a!=null&&typeof a=="object"&&!Array.isArray(a)&&a.key!=null&&l.set(a.key,a);let d=i.map((a,c)=>{let f=null;return a!=null&&typeof a=="object"&&!Array.isArray(a)&&a.key!=null&&(f=l.get(a.key)??null),f==null&&(f=s[c]??null),Y(a,n,f,o,r)});x("build")&&k("build","debug","",`array out kids=${G(i)}`);let u=!1;for(let a=0;a<d.length;a++)if(_n(d[a])){u=!0;break}return u?Promise.all(d).then(()=>i):i}function Lo(e,n,t,o,r){let i=e,s=o??n.__registry??ye(),l=kn(t,i);i._id||(i._id=l?._id??s.nextId(),s.idRegistry.set(i._id,i)),l&&(l._parentNode&&(i._parentNode=l._parentNode),l._refNode&&(i._refNode=l._refNode),l._ctxVersion!=null&&(i._ctxVersion=l._ctxVersion),P(i)&&P(l)&&typeof l._render=="function"&&(i._render=l._render));let d=So(l?.props??{},i.props??{}),u=Qe(n),a=(l?._ctxVersion??-1)===u;if(!r?.force&&d&&a&&Ve(l)&&typeof i._render=="function"){let c=l;return i._lifecycle=Z(i._lifecycle,"PRUNE",Q(i)),i._child=c._child,i._ctxVersion=c._ctxVersion,x("build")&&k("build","debug","",`prune comp=${he(i)} propsSame=${d} verSame=${a}`),i}return i._lifecycle=Z(i._lifecycle,"BUILD_START",Q(i)),x("build")&&k("build","debug","",`mount comp=${he(i)} propsSame=${d} verSame=${a} force=${!!r?.force}`),(async()=>{let{childCtx:c}=await Ro(i,n,s,{reuse:l??null}),f=await Y(await i._render(i.props),c,l?._child,s,r);return i._child=f??null,i._ctxVersion=u,i._lifecycle=Z(i._lifecycle,"BUILD_DONE",Q(i)),i})()}function Mo(e,n,t,o,r){let i=e,s=o??n.__registry??ye(),l=kn(t,i);x("build")&&k("build","debug","",`fragment kids=${G(A(i.props?.children))}`);let d=Y(i.props?.children??null,n,l?._child??l?.props?.children,s,r);return _n(d)?d.then(u=>(i._child=u??null,i._lifecycle=Z(i._lifecycle,"BUILD_DONE",Q(i)),i)):(i._child=d??null,i._lifecycle=Z(i._lifecycle,"BUILD_DONE",Q(i)),i)}function Nt(e,n,t,o,r){let i=e;if(typeof i.type!="string"&&typeof i.type!="symbol")return i;let s=o??n.__registry??ye(),l=kn(t,i);x("build")&&k("build","trace","",`native <${String(i.type)}> kids=${G(A(i.props?.children))}`);let d=Y(i.props?.children??null,n,l?.props?.children,s,r);return _n(d)?d.then(u=>(i._child=u??null,i._lifecycle=Z(i._lifecycle,"BUILD_DONE",Q(i)),i)):(i._child=d??null,i._lifecycle=Z(i._lifecycle,"BUILD_DONE",Q(i)),i)}var Ho=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);function Ee(e,n){return le(e,n)}function D(e,n,t,o=null,r=null,i=null){let s=n?.browser??t;if(!s)throw new Error("[vdom2] renderValue requires browser env (ctx.browser)");return Ko[$(e)](e,n,s,o,r,i)}function Oo(e,n,t){return null}function Uo(e,n,t){return t.createTextNode(String(e))}function Pn(e,n,t,o,r){if(e==null||typeof e=="boolean")return Ee(t,e);let i=D(e,n,t,String(o),null,r);return i??Ee(t,null)}function $o(e,n,t,o=null,r=null,i=null){let s=e,l=t.createDocumentFragment();if(!l)return null;x("render")&&k("render","debug","",`array kids=${G(s)} fid=${i??"-"} key=${o??"-"}`);let d=t.createComment(B({type:"fragment-start",key:o,id:r,fid:i})),u=t.createComment(B({type:"fragment-end",key:o,id:r,fid:i}));d&&l.appendChild(d);for(let a=0;a<s.length;a++){let c=s[a],f=i!=null?`${i}-${a}`:String(a),p=Pn(c,n,t,a,f);p!=null&&l.appendChild(p)}return u&&l.appendChild(u),l}function Do(e,n,t){let o=e,r=o,i=t.bodyElement();if(!i)return null;let s=i.querySelector("#__wf_portal");s||(s=t.createElement("div"),s&&(s.id="__wf_portal",i.appendChild(s)));let l=t.createElement("div");if(l){l.setAttribute("data-portal",String(o.props?.portalKey??"wf"));let d=D(o.props?.children??null,n,t);d!=null&&l.appendChild(d),s&&s.appendChild(l),r._remoteEl=l;let u=A(o.props?.children);for(let a of u)a!=null&&typeof a=="object"&&!Array.isArray(a)&&(a._parentVNode=o)}return null}function jo(e,n,t,o=null,r=null,i=null){let s=e,l=s,d=t.createDocumentFragment();if(!d)return null;let u=A(s.props?.children);x("render")&&k("render","debug","",`fragment kids=${G(u)} fid=${i??"-"}`);let a=t.createComment(B({type:"fragment-start",key:o,id:r,fid:i})),c=t.createComment(B({type:"fragment-end",key:o,id:r,fid:i}));a&&d.appendChild(a),l._refNode=a;for(let f=0;f<u.length;f++){let p=u[f],m=i!=null?`${i}-${f}`:String(f),g=Pn(p,n,t,f,m);g!=null&&d.appendChild(g)}return c&&d.appendChild(c),d}function Wo(e,n,t){let o=e,r=o._lifecycle??(typeof o._render=="function"?"built":"fresh");return Fo[r](o,n,t)}var Fo={fresh:(e,n,t)=>{throw new Error(`[vdom2] component ${I(e.type)} not built (missing _render) \u2014 buildVNode must run before renderValue`)},building:(e,n,t)=>{throw new Error(`[vdom2] component ${I(e.type)} building in render \u2014 buildVNode must await before renderValue`)},disposed:(e,n,t)=>(console.warn(`[vdom2] disposed \u7EC4\u4EF6 ${I(e.type)} \u5728\u6E32\u67D3\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\u2014\u2014\u7236\u6811\u91CD\u5EFA\u4E2D\uFF08\u5360\u4F4D\u515C\u5E95\uFF09`),Ee(t,null)),built:wt,pruned:wt};function wt(e,n,t){let o=e._child;if(o==null)return e._child=null,null;e._child=o,e._outputChild=o,typeof o=="object"&&!Array.isArray(o)&&(o._parentVNode=e);let r=D(o,n,t);if(r){if(e._refNode=r.nodeType===11?r.firstChild:r,e._id)if(r.nodeType===11)for(let i of Array.from(r.childNodes))i.nodeType===1&&i.setAttribute("data-wf-id",e._id);else r.nodeType===1&&r.setAttribute("data-wf-id",e._id);if(e.key!=null)if(r.nodeType===11)for(let i of Array.from(r.childNodes))i.nodeType===1&&i.setAttribute("data-wf-key",e.key);else r.nodeType===1&&r.setAttribute("data-wf-key",e.key)}return r}function Bo(e,n,t,o,r){let i=e,s=i,l=i.type,d=Ho.has(l)?t.createElementNS("http://www.w3.org/2000/svg",l):t.createElement(l);if(!d)return null;s.el=d,s._refNode=d,x("render")&&k("render","trace","",`native <${l}> key=${i.key??"-"} kids=${G(A(i.props?.children))}`),i.key!=null&&d.setAttribute("data-wf-key",i.key);let u=null;for(let[a,c]of Object.entries(i.props??{}))if(!(a==="children"||a==="key")){if(a==="value"&&d instanceof HTMLSelectElement){u=c;continue}oe(d,a,c)}if(!("innerHTML"in(i.props??{}))){let a=A(i.props?.children);for(let c=0;c<a.length;c++){let f=a[c],p=r!=null?`${r}-${c}`:String(c),m=Pn(f,n,t,c,p);if(m!=null&&(d.appendChild(m),f&&typeof f=="object"&&!Array.isArray(f)&&typeof f.type=="function")){let g=f;g._parentNode||(g._parentNode=d)}}x("render")&&k("render","trace","",`native <${l}> out=${se(d)}`)}return u!==null&&(d.value=String(u)),d}var Ko={hole:Oo,text:Uo,arr:$o,portal:Do,frag:jo,comp:Wo,native:Bo};function de(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=D(e.newInput,r,r.browser??V());if(i==null)return null;if(t?.parentNode){let s=Ae(o,t,n,r);return s&&s.parentNode===n?n.insertBefore(i,s):n.appendChild(i),i}return n.appendChild(i),i}function qo(e){return Ae(e.oldInput,e.oldNode,e.parent,e.ctx),null}function Go(e){let n=e.oldNode;if(n?.nodeType===8){let t=Ee(e.ctx.browser??V(),e.newInput);return t&&n.nodeValue!==t.nodeValue&&(n.nodeValue=t.nodeValue),n}return null}function Te(e){let{parent:n,oldNode:t,ctx:o}=e,r=D(e.newInput,o,o.browser??V());return r==null?null:(t?.parentNode?t.parentNode.replaceChild(r,t):t?n.insertBefore(r,t):n.appendChild(r),r)}function zo(e){let{parent:n,oldNode:t,oldInput:o}=e,r=String(e.newInput);if(String(o)!==r){if(t&&t.nodeType===3)return t.nodeValue=r,t;let i=n.ownerDocument.createTextNode(r);return t?.parentNode?t.parentNode.replaceChild(i,t):n.appendChild(i),i}return t}function Yo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput,s=o&&typeof o=="object"&&!Array.isArray(o)?o:null,l=i.type;if(t&&t.nodeType===1&&(s?.type??null)===l&&qe(i)){let d=t;return i.el=d,i._refNode=d,Ct(d,s?.props??{},i.props??{}),"innerHTML"in(i.props??{})||Ie(d,s?._child??s?.props?.children??null,i._child??i.props?.children??null,r),d}return de(e)}function Xo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput,s=o&&typeof o=="object"&&!Array.isArray(o)?o:null,l=ne(s)?L(s,t):null,d=Sn(n,s??o,i,r,l);return t?.parentNode?t:d[0]??null}function Jo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput;if(!P(i)||typeof i._render!="function")throw new Error(`[vdom2] component ${I(i.type)} not built in diff \u2014 buildVNode must run before patchValue`);let s=o&&typeof o=="object"&&!Array.isArray(o)?o:null;if(s?.type!=null&&s.type!==i.type)return de(e);let l=s?.type===i.type;if(!r.force&&s&&l&&Ve(s)&&i._child===s._child)return t;s?.type===i.type&&s._id&&(i._id=s._id,r.registry.idRegistry.set(i._id,i)),i._parentNode=n,t&&(i._refNode=t);let d=i._child;if(d===null){i._outputChild=null,i._refNode=null;let a=t?.parentNode!=null,c=Ae(s?._child??null,t,n,r);s&&(s._child=null);let f=Ee(r.browser??V(),null);return a&&f?(c&&c.parentNode===n?n.insertBefore(f,c):n.appendChild(f),f):ee(n,t,s?._child,null,r)}i._outputChild=d;let u=ee(n,t,s?._child,d,r);return u&&(i._refNode=u),u}function Qo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e;if(o===e.newInput&&t?.parentNode)return t;let i=n.ownerDocument.createDocumentFragment(),s=Ie(n,o,e.newInput,r,t?[t]:null);for(let l of s)l&&i.appendChild(l);return t?.parentNode?i.contains(t)?n.appendChild(i):t.parentNode.replaceChild(i,t):n.appendChild(i),i}function Zo(e){let{ctx:n,oldInput:t}=e,o=e.newInput,r=t&&typeof t=="object"&&!Array.isArray(t)?t:null;if(q(r)&&q(o)){let i=r._remoteEl;if(i){let s=r._child??r.props?.children??null,l=o._child??o.props?.children??null;Ie(i,s,l,n)}return o._remoteEl=r._remoteEl,null}return de(e)}function ve(e){return{text:de,native:de,frag:de,comp:de,arr:de,hole:qo,portal:de,...e}}var er={text:ve({text:zo}),hole:ve({text:Te,native:Te,frag:Te,comp:Te,arr:Te,portal:Te,hole:Go}),native:ve({native:Yo}),frag:ve({frag:Xo}),comp:ve({comp:Jo}),arr:ve({arr:Qo}),portal:ve({portal:Zo})};function bt(e){let n=$(e.oldInput),t=$(e.newInput);return S({session:"",machine:"x2y",nodeId:null,component:null,from:n,event:"X2Y",to:t,level:"trace",ts:Date.now()}),er[n][t](e)}function re(e,n){if(n&&typeof e.type=="function"&&e._id){try{U(e,n)}catch(t){console.error("[weifuwu] ref cleanup error",t)}pt(n,e._id)}}function Oe(e){if(e==null||typeof e!="object"||Array.isArray(e))return null;let n=e;return q(n)?typeof n.props?.portalKey=="string"?n.props.portalKey:null:n.key}function Rn(e,n){if(n&&e&&typeof e=="object"&&!Array.isArray(e)){let t=L(e,n);if(t&&t.length>1)return t}return[n]}function tn(e,n){let t=A(e.props?.children);for(let o of t){if(o==null||typeof o!="object"||Array.isArray(o))continue;let r=o;nr[$(r)](r,n)}}var nr={comp:(e,n)=>{re(e,n)},frag:(e,n)=>{tn(e,n)},native:(e,n)=>{tn(e,n)},portal:(e,n)=>{tn(e,n)},arr:()=>{},text:()=>{},hole:()=>{}};function Ae(e,n,t,o){return tr[$(e)](e,n,t,o)}var tr={arr:(e,n,t,o)=>{let r=L(e,n);if(r&&r.length){let i=(r[r.length-1]??n)?.nextSibling??null;for(let s of r)s.parentNode&&s.parentNode.removeChild(s);return i&&i.parentNode===t?i:null}return Le(e,n,t,o)},frag:(e,n,t,o)=>{let r=e,s=L(r,n)??[],l=(s[s.length-1]??n)?.nextSibling??null;for(let d of s)d.parentNode&&d.parentNode.removeChild(d);return tn(r,o.registry),l&&l.parentNode===t?l:null},portal:(e,n,t,o)=>{let r=e,i=r._remoteEl;try{U(r.props?.children,o.registry)}catch(s){console.error("[weifuwu] portal ref cleanup error",s)}return i?.parentNode?.removeChild(i),null},comp:(e,n,t,o)=>{let r=e,i=L(r,n);if(re(r,o.registry),i&&i.length>1){let s=(i[i.length-1]??n)?.nextSibling??null;for(let l of i)l.parentNode&&l.parentNode.removeChild(l);return s&&s.parentNode===t?s:null}return Le(e,n,t,o)},native:(e,n,t,o)=>{try{U(e,o.registry)}catch(r){console.error("[weifuwu] ref cleanup error",r)}return Le(e,n,t,o)},text:(e,n,t,o)=>Le(e,n,t,o),hole:(e,n,t,o)=>Le(e,n,t,o)};function Le(e,n,t,o){let r=n?.nextSibling??null;return n?.parentNode&&n.parentNode.removeChild(n),r&&r.parentNode===t?r:null}function ee(e,n,t,o,r){return bt({parent:e,oldNode:n,oldInput:t,newInput:o,ctx:r})}var or={event:(e,n,t,o)=>{let{type:r,capture:i}=xn(n);typeof t=="function"&&e.removeEventListener(r,t,i?{capture:!0}:{}),o!=null&&o!==!1&&(typeof o!="function"?console.warn(`[weifuwu] event prop ${n} expects a function, got ${typeof o} \u2014 ignored`):e.addEventListener(r,o,i?{capture:!0}:{}))},class:(e,n,t,o)=>{o==null||o===!1?e.removeAttribute("class"):(e.className="",oe(e,n,o))},ref:(e,n,t,o)=>{if(o==null||o===!1){if(typeof t=="function")try{t(null)}catch(r){console.error("[weifuwu] ref cleanup error",r)}}else oe(e,n,o)},value:(e,n,t,o)=>{o==null||o===!1?e.value="":oe(e,n,o)},indeterminate:(e,n,t,o)=>{o==null||o===!1?e.indeterminate=!1:oe(e,n,o)},enumerated:Me,style:Me,innerHTML:Me,aria:Me,default:Me};function Me(e,n,t,o){if(o==null||o===!1){e.removeAttribute(n);try{delete e[n]}catch{}}else oe(e,n,o)}function Ct(e,n,t){let o=Object.keys(n),r=Object.keys(t);if(o.length===r.length){let s=!0;for(let l=0;l<o.length;l++)if(o[l]!==r[l]||n[o[l]]!==t[o[l]]){s=!1;break}if(s)return}let i=new Set([...o,...r]);for(let s of i){if(s==="children"||s==="key")continue;let l=n[s],d=t[s];l!==d&&or[Tn(s)](e,s,l,d)}}function Sn(e,n,t,o,r){let i=Array.isArray(n)?n:n?._child??n?.props?.children??null,s=Array.isArray(t)?t:t?._child??t?.props?.children??null;return Ie(e,i,s,o,r)}function Ie(e,n,t,o,r,i){let s=A(n),l=A(t),d=r??Array.from(e.childNodes);x("diff")&&k("diff","debug","",`patchChildren parent=${z(e)} old=${G(s)} new=${G(l)} dom=${se(e)}`);let u=l.some(p=>Array.isArray(p))||s.some(p=>Array.isArray(p)),a=u?"unkeyed":Vn(l);if(S({session:"",machine:"keys",nodeId:null,component:null,from:u?"unkeyed":Vn(l),event:"SELECT",to:a,payload:()=>({len:l.length}),level:"trace",ts:Date.now()}),ae()&&s.length!==l.length)for(let p=0;p<l.length;p++){let m=l[p];m!=null&&typeof m=="object"&&!Array.isArray(m)&&P(m)&&m.key==null&&console.error(`[vdom2/audit] \u52A8\u6001\u6570\u7EC4\u4F4D\u7F6E ${p} \u7684\u7EC4\u4EF6\u7F3A\u5C11 key\u2014\u2014\u5217\u8868\u589E\u5220/\u91CD\u6392\u4F1A\u9519\u4F4D\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002\u8BF7\u63D0\u4F9B\u4E1A\u52A1\u8EAB\u4EFD key\uFF08\u5982 key={item.id}\uFF09\uFF1B\u65E0\u72B6\u6001 native \u9879\u8C41\u514D\u3002`)}let c=r&&r.length?r[r.length-1]:null;a==="mixed"&&(on(l),on(s));let f=(()=>{let p=d;p.length>=2&&p[0]?.nodeType===8&&p[0].nodeValue?.includes("fragment-start")&&p[p.length-1]?.nodeType===8&&p[p.length-1].nodeValue?.includes("fragment-end")&&(p=p.slice(1,-1));let m=[],g=0;for(let h=0;h<s.length;h++){let N=s[h];if(Array.isArray(N)){let v=p[g]??null;m.push(v);let b=L(N,v);g+=b?.length??1;continue}if(N==null||typeof N=="boolean"||typeof N=="string"||typeof N=="number"){m.push(p[g]??null),g++;continue}let y=N;if(q(y)){m.push(y._remoteEl??null);continue}if(m.push(y._refNode??p[g]??null),typeof y.type=="function"||ne(y)){let v=L(y,y._refNode??p[g]??null);g+=v?.length??1}else g++}return m})();return Vr[a]({parent:e,oldChildren:s,newChildren:l,oldNodes:f,ctx:o,arrEnd:c,anchorOut:i})}function He(e){return e==null||typeof e=="boolean"?"hole":Array.isArray(e)||e&&typeof e=="object"&&ne(e)?"multi":"real"}function rr(e){let{parent:n,oldC:t,oldNode:o,oldNodes:r,i,ctx:s,out:l,pushA:d}=e;if(Array.isArray(t)){x("diff")&&k("diff","trace","",`remove-arr-item i=${i} range=[${(L(t,r[i])??[]).map(z).join(" | ")}] before=${se(n)}`);let u=L(t,o);for(let a of u??[])a.parentNode?.removeChild(a);x("diff")&&k("diff","trace","",`remove-arr-item after=${se(n)}`);for(let a of t)a!=null&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="function"&&re(a,s.registry)}else if(t&&typeof t=="object"&&!Array.isArray(t)){if(typeof t.type=="function")re(t,s.registry);else try{U(t,s.registry)}catch(u){console.error("[weifuwu] ref cleanup error",u)}o?.parentNode&&o.parentNode.removeChild(o)}else o?.parentNode&&o.parentNode.removeChild(o);l.push(null),d(null)}function ir(e){let{parent:n,newC:t,oldNode:o,i:r,oldNodes:i,out:s,pushA:l,ctx:d}=e,u=le(d.browser??V(),t);if(o?.nodeType===8){u&&o.nodeValue!==u.nodeValue&&(o.nodeValue=u.nodeValue),s.push(o),l(o);return}if(u&&o?.parentNode)o.parentNode.replaceChild(u,o);else if(u){let a=null;for(let c=r+1;c<i.length;c++){let f=i[c];if(f&&f.parentNode===n){a=f;break}}if(!a){let c=null;for(let f=s.length-1;f>=0;f--)if(s[f]){c=s[f];break}c&&c.parentNode===n&&(a=c.nextSibling)}a&&a.parentNode===n?n.insertBefore(u,a):n.appendChild(u),s.push(u),l(u)}else s.push(u),l(u)}function Vt(e){let{parent:n,newC:t,oldNode:o,i:r,oldNodes:i,out:s,pushA:l,ctx:d}=e,u=D(t,d,d.browser??V(),String(r));if(u==null){s.push(null),l(null);return}if(o&&o.nodeType===8&&o.nodeValue?.includes("type=hole")){S({session:"",machine:"pos",nodeId:null,component:null,from:"hole",event:"HOLE_FILL",to:"real",payload:()=>({i:r,replaced:z(o)}),level:"trace",ts:Date.now()}),o.parentNode?.replaceChild(u,o),s.push(u),l(u);return}let a=null;for(let c=r+1;c<i.length;c++){let f=i[c];if(f&&f.parentNode===n){a=f;break}}if(a==null){let c=null;for(let f=s.length-1;f>=0;f--)if(s[f]){c=s[f];break}if(c&&c.parentNode===n)a=c.nextSibling;else{let f=i[i.length-1];f&&f.parentNode===n&&(a=f.nextSibling)}}a&&a.parentNode===n?n.insertBefore(u,a):n.appendChild(u),S({session:"",machine:"pos",nodeId:null,component:null,from:"hole",event:"INSERT",to:"real",payload:()=>({i:r,insertedBefore:a?z(a):"END",node:z(u)}),level:"trace",ts:Date.now()}),s.push(u),l(u)}function sr(e){let{parent:n,oldC:t,newC:o,oldNode:r,out:i,pushA:s,ctx:l}=e;if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.type=="function"){let u=Tt(n,t,r,o,l);i.push(u),s(u);return}let d=_t(n,t,r,o,l);i.push(d),s(d)}function lr(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,out:s,pushA:l,ctx:d}=e,u=d.browser??V(),a=D(o,d,u,String(i));if(a==null){s.push(null),l(null);return}let c=t&&typeof t=="object"?L(t,r):null;if(c&&c.length>1){let p=(c[c.length-1]??r)?.nextSibling??null;for(let m of c)m.parentNode&&m.parentNode.removeChild(m);if(t&&typeof t=="object"&&!Array.isArray(t))if(typeof t.type=="function")re(t,d.registry);else try{U(t,d.registry)}catch(m){console.error("[weifuwu] ref cleanup error",m)}p&&p.parentNode===n?n.insertBefore(a,p):n.appendChild(a)}else r?.parentNode?r.parentNode.replaceChild(a,r):n.appendChild(a);let f=a.nodeType===11?Array.from(a.childNodes):[a];s.push(...f),l(f[0]??a)}function ar(e){let{parent:n,oldC:t,newC:o,oldNode:r,out:i,pushA:s,ctx:l}=e,d=Et(n,t,r,o,l);i.push(d),s(d)}function dr(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,oldNodes:s,out:l,pushA:d,ctx:u}=e,a=u.browser??V(),c=L(t,r);x("diff")&&k("diff","debug","",`multi-remove i=${i} range=${c?c.map(z).join(" | "):"null"}`);for(let m of c??[])m.parentNode?.removeChild(m);for(let m of A(t?.props?.children))m!=null&&typeof m=="object"&&!Array.isArray(m)&&typeof m.type=="function"&&re(m,u.registry);let f=D(o,u,a,String(i));if(f==null){l.push(null),d(null);return}let p=s[i+1]??null;p?.parentNode?p.parentNode.insertBefore(f,p):n.appendChild(f),l.push(f),d(f)}function ur(e){let{parent:n,oldC:t,newC:o,oldNode:r,oldNodes:i,i:s,out:l,pushA:d,ctx:u}=e,a=L(t,r),c=Sn(n,t,o,u,a);l.push(...c),d(i[s]??c[0]??null)}function cr(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,out:s,pushA:l,ctx:d}=e;if(o&&typeof o=="object"&&!Array.isArray(o)&&typeof o.type=="function"&&o._lifecycle==="disposed"){let c=Pt(n,r,d,I(o.type));s.push(c),l(c);return}let u=ee(n,r,t,o,d);x("diff")&&k("diff","trace","",`after-patch i=${i} new=${he(o)} node=${z(u)} dom=${se(n)}`);let a=Rn(o,u);s.push(...a),l(a[0]??u??null)}function Et(e,n,t,o,r){let i=le(r.browser??V(),o),s=L(n,t),l=((s??[])[s?.length?s.length-1:0]??t)?.nextSibling??null;for(let d of s??[])d.parentNode?.removeChild(d);for(let d of A(n?.props?.children))d!=null&&typeof d=="object"&&!Array.isArray(d)&&typeof d.type=="function"&&re(d,r.registry);return i&&l&&l.parentNode===e?e.insertBefore(i,l):i&&e.appendChild(i),i}function Tt(e,n,t,o,r){let i=le(r.browser??V(),o),s=Ae(n,t,e,r);return i&&s?e.insertBefore(i,s):i&&e.appendChild(i),i}function _t(e,n,t,o,r){let i=le(r.browser??V(),o);if(n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")re(n,r.registry);else try{U(n,r.registry)}catch(s){console.error("[weifuwu] ref cleanup error",s)}return i&&t?.parentNode?t.parentNode.replaceChild(i,t):i&&e.appendChild(i),i}var fr={hole:{hole:ir,real:Vt,multi:Vt},real:{hole:sr,real:cr,multi:lr},multi:{hole:ar,real:dr,multi:ur}};function pr(e){let{parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,anchorOut:s}=e,l=Math.max(t.length,o.length),d=[],u=a=>{s&&s.push(a)};for(let a=0;a<l;a++){let c=a<t.length?t[a]:null,f=a<o.length?o[a]:null;if(a>=o.length){rr({parent:n,oldC:c,newC:f,oldNode:r[a],i:a,oldNodes:r,newChildren:o,out:d,pushA:u,ctx:i});continue}if(c!=null&&typeof c=="object"&&!Array.isArray(c)&&f!=null&&typeof f=="object"&&!Array.isArray(f)&&f===c&&Ve(c)){d.push(r[a]),u(r[a]);continue}let p=fr[He(c)][He(f)];S({session:"",machine:"pos",nodeId:null,component:null,from:He(c),event:p.name,to:He(f),payload:()=>({i:a}),level:"trace",ts:Date.now()}),p({parent:n,oldC:c,newC:f,oldNode:r[a],i:a,oldNodes:r,newChildren:o,out:d,pushA:u,ctx:i})}return d}function xt(e){let{parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,anchorOut:s,arrEnd:l}=e,d=new Map;t.forEach((p,m)=>{let g=Oe(p);g!==null&&p&&typeof p=="object"&&!Array.isArray(p)&&d.set(g,{vnode:p,nodes:[r[m]??null].filter(Boolean),index:m})});let u=[],a=new Set,c=p=>{s&&s.push(p)},f=null;return o.forEach((p,m)=>{let g=Oe(p),h=p;if(g!==null&&d.has(g)){let N=d.get(g),y=N.nodes[0]??null;if(a.add(g),h&&typeof h=="object"&&typeof h.type=="function"&&h._lifecycle==="disposed"){let C=Pt(n,y,i,I(h.type));u.push(C),c(C),C&&(f=C);return}let v=ee(n,y,N.vnode,h,i),b=Rn(h,v),H=b[0]??v,W=b[b.length-1]??v;if(H&&H.parentNode===n&&f&&H.previousSibling!==f){x("diff")&&k("diff","debug","",`keyed-correct i=${m} k=${g} move=[${b.map(z).join(" | ")}] after=${z(f)} before=${se(n)}`);let C=f.nextSibling;for(let E of b)E&&E.parentNode===n&&n.insertBefore(E,C);x("diff")&&k("diff","debug","",`keyed-correct after=${se(n)}`)}u.push(...b),c(b[0]??v??null),W&&(f=W)}else{let N={current:f};Nr[vr(p)]({parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,out:u,pushA:c,arrEnd:l,c:p,i:m},N),f=N.current}}),t.forEach((p,m)=>{yr[mr(Oe(p),a)](n,p,m,r,i,o.length)}),u}function mr(e,n){return e===null?"unkeyed":n.has(e)?"moved":"stale-keyed"}var yr={moved:()=>{},"stale-keyed":gr,unkeyed:hr};function gr(e,n,t,o,r){let i=n&&typeof n=="object"&&!Array.isArray(n)?L(n,o[t]):null;if(x("diff")&&k("diff","trace","",`keyed-delete i=${t} k=${Oe(n)} range=${i?.length??0} oldNode=${z(o[t])}`),n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")re(n,r.registry);else try{U(n,r.registry)}catch(s){console.error("[weifuwu] ref cleanup error",s)}kt(i,o[t])}function hr(e,n,t,o,r,i){let s=o[t];if(s?.nodeType===8&&s.nodeValue?.includes("type=hole")&&t<i)return;if(n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")re(n,r.registry);else try{U(n,r.registry)}catch(u){console.error("[weifuwu] ref cleanup error",u)}let d=n&&typeof n=="object"&&!Array.isArray(n)?L(n,s):null;kt(d,s)}function kt(e,n){if(e&&e.length>1)for(let t of e)t.parentNode&&t.parentNode.removeChild(t);else n?.parentNode&&n.parentNode.removeChild(n)}function vr(e){return e==null||typeof e=="boolean"?"hole":e&&typeof e=="object"&&!Array.isArray(e)&&q(e)?"portal":"real"}var Nr={hole:wr,portal:br,real:Cr};function wr(e,n){let{parent:t,oldChildren:o,oldNodes:r,ctx:i,out:s,pushA:l,c:d,i:u}=e,a=o[u]??null,c=r[u]??null,f=He(a);if(f==="hole"){let m=le(i.browser??V(),d);c?.nodeType===8?(m&&c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue),s.push(c),l(c),c&&(n.current=c)):(m&&c?.parentNode?c.parentNode.replaceChild(m,c):m&&t.appendChild(m),s.push(m),l(m),m&&(n.current=m));return}let p=f==="multi"?Et(t,a,c,d,i):a&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="function"?Tt(t,a,c,d,i):_t(t,a,c,d,i);s.push(p),l(p),p&&(n.current=p)}function br(e,n){let{parent:t,oldChildren:o,oldNodes:r,ctx:i,out:s,pushA:l,c:d,i:u}=e,a=d,c=o[u]??null,f=ee(t,r[u]??null,c,a,i),p=Rn(a,f);s.push(...p),l(p[0]??f??null);let m=p[p.length-1]??f;m&&(n.current=m)}function Cr(e,n){let{parent:t,oldNodes:o,ctx:r,out:i,pushA:s,arrEnd:l,c:d,i:u}=e,c=D(d,r,r.browser??V());if(i.push(c),s(c??null),c!=null){let f=o[u];f&&f.nodeType===8&&f.nodeValue?.includes("type=hole")?(f.parentNode?.replaceChild(c,f),n.current=c):(n.current?t.insertBefore(c,n.current.nextSibling):l&&l.parentNode===t?t.insertBefore(c,l):t.insertBefore(c,t.firstChild),n.current=c)}}function on(e){for(let n=0;n<e.length;n++){let t=e[n];t&&typeof t=="object"&&!Array.isArray(t)&&Oe(t)===null&&(t.key=`pos:${n}`)}}function Pt(e,n,t,o){ae()?console.error(`[vdom2/audit] I1 \u8FDD\u53CD\uFF1Adiff \u6536\u5230 disposed \u7EC4\u4EF6 ${o}\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\uFF08portal \u5185\u5BB9\u72EC\u7ACB dispose\uFF09\u2014\u2014\u7236\u6811\u5C06\u91CD\u5EFA`):console.warn(`[vdom2] disposed \u7EC4\u4EF6 ${o} \u5728 diff\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\u2014\u2014\u7236\u6811\u91CD\u5EFA\u4E2D\uFF08\u5360\u4F4D\u515C\u5E95\uFF09`);let r=le(t.browser??V(),null);if(r==null)return null;let i=n;if(i){let s=i.parentNode;s?s.replaceChild(r,i):e.appendChild(r)}else e.appendChild(r);return r}var Vr={unkeyed:pr,keyed:xt,mixed:e=>(on(e.newChildren),on(e.oldChildren),xt(e))};function rn(e){let{registry:n,ctx:t}=e,o=new Map;async function r(s){let l=n.idRegistry.get(s);if(!l||!P(l)||typeof l._render!="function")return;let d=l,u=Xe("render");try{let a=await d._render(d.props),c=await Y(a,t,d._child,n)??null,f=d._child;if(d._child=c,d._lifecycle==="building"){S({session:u,machine:"render",nodeId:d._id??null,component:St(d),from:"IDLE",event:"PARENT",to:"SKIP_BUILDING",payload:()=>({lifecycle:d._lifecycle}),level:"debug",ts:Date.now()});return}let p=d._id!=null&&d._id===t.ui?._rootVNodeId,m=d._parentNode??d._refNode?.parentNode??null;m==null&&p&&(m=e.rootEl??null);let g=m?p&&!d._parentNode?"ROOT":"MOUNTED":"SKIP_DETACHED";if(S({session:u,machine:"render",nodeId:d._id??null,component:St(d),from:"IDLE",event:"PARENT",to:g,payload:()=>({lifecycle:d._lifecycle}),level:"debug",ts:Date.now()}),m){let h={browser:t.browser??V(),registry:n,ctxVersion:Qe(t)},N=ee(m,d._refNode??null,f,c,h);if(d._refNode=N,ae())try{let y=[];xe(m,c,v=>y.push(v)),y.length&&console.error("[vdom2/audit] "+y.join(" | "))}catch(y){console.error("[vdom2/audit] \u6821\u9A8C\u5F02\u5E38:",y)}}}catch(a){e.onError?e.onError(a):console.error("[vdom2] render error:",a?.stack??a)}finally{Re()}}function i(s){return s==null?Promise.resolve():Promise.all(s.map(l=>{let u=(o.get(l)??Promise.resolve()).then(()=>r(l));return o.set(l,u),u.finally(()=>{o.get(l)===u&&o.delete(l)})})).then(()=>{})}return{render:i}}function St(e){return typeof e.type=="function"&&e.type.name?e.type.name:"anonymous"}function Rt(e){let{ctx:n,browser:t}=e,o=e.registry??ye(),r=e.renderer??rn({registry:o,ctx:n,rootEl:e.root,onError:e.onError}),i=n.ui,s=null,l=null,d={ctx:n,registry:o,renderer:r,async mount(u){s=u;let a=await Y(u,n,null,o);e.root.innerHTML="";let c=D(a,n,t);if(c!=null&&e.root.appendChild(c),l=a?._child??a,i&&(i._rootVNodeId=a?._id??null),ae())try{let f=[];xe(e.root,a,p=>f.push(p)),f.length&&console.error("[vdom2/audit] "+f.join(" | "))}catch(f){console.error("[vdom2/audit] \u6821\u9A8C\u5F02\u5E38:",f)}},async rerender(){if(s==null)return;let u=[];for(let[,a]of o.idRegistry)P(a)&&typeof a._render=="function"&&a._id&&u.push(a._id);await r.render(u)},unmount(){for(let[,u]of o.idRegistry)try{U(u,o)}catch{}e.root.innerHTML=""}};return d.close=()=>d.unmount(),d}var At=V();function It(e,n="bottom",t=6,o=!0){switch(n){case"bottom":return{top:e.bottom+t,left:o?e.left+e.width/2:e.left};case"top":return{top:e.top-t,left:o?e.left+e.width/2:e.left};case"left":return{top:o?e.top+e.height/2:e.top,left:e.left-t};case"right":return{top:o?e.top+e.height/2:e.top,left:e.right+t}}}function sn(e,n,t=8){if(!n)return e;let o=n.getBoundingClientRect();if(o.width===0&&o.height===0)return e;let r=Number.parseFloat(n.style.top)||o.top,i=Number.parseFloat(n.style.left)||o.left,s=e.top-r,l=e.left-i,d={top:o.top+s,bottom:o.bottom+s,left:o.left+l,right:o.right+l},u=At.viewportWidth(),a=At.viewportHeight(),c=e.top,f=e.left;return d.bottom>a-t&&(c=Math.max(t,c-(d.bottom-(a-t)))),d.top<t&&(c=Math.max(t,c+(t-d.top))),d.right>u-t&&(f=Math.max(t,f-(d.right-(u-t)))),d.left<t&&(f=Math.max(t,f+(t-d.left))),{top:c,left:f,width:e.width}}var _e=V();function Lt(e){let n=new Map,t=new Map,o=!1,r=0;function i(){r||(r=requestAnimationFrame(()=>{r=0;let a=[];for(let[c,f]of n){if(!f.isOpen())continue;let p=f.getEl();if(!p)continue;let m=p.getBoundingClientRect();if(m.width===0&&m.height===0)continue;let g=f.compute(m);Object.assign(f.pos,sn(g,f.panel?.(),f.margin)),a.push(c)}for(let[c,f]of t){let p=f.getScroller(),m=p instanceof Window?_e.scrollingElement()?.scrollTop??_e.scrollTop():p.scrollTop??0;m!==f.handle.y&&(f.handle.y=m,a.push(c))}a.length>0&&e(a)}))}function s(){o||(o=!0,_e.addEventListener("scroll",i,{capture:!0,passive:!0}),_e.addEventListener("resize",i))}function l(){o&&(_e.removeEventListener("scroll",i,{capture:!0}),_e.removeEventListener("resize",i),o=!1)}function d(a){for(let c of[...n.keys()])(c.startsWith(`popup:${a}:`)||c===`popup:${a}`||c===a)&&n.delete(c);t.delete(a)}function u(){l(),r&&(cancelAnimationFrame(r),r=0),n.clear(),t.clear()}return{popupTrackers:n,scrollTrackers:t,schedulePopupRecompute:i,ensurePopupListeners:s,destroyPopupListeners:l,cleanupTrackers:d,destroy:u}}function An(e,n,t){return r=>{r?n(r):t?.()}}function Ue(e){return typeof window<"u"&&!!window.matchMedia?.("(hover: hover)").matches}function ln(e){return typeof window<"u"&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function In(e,n,t){let o=null,r=()=>{n(),t?.once&&o&&o.removeEventListener("animationend",r)};return s=>{s?(o=s,s.addEventListener("animationend",r)):o&&(o.removeEventListener("animationend",r),o=null)}}function Ln(e,n){let{onLongPress:t,duration:o=500}=n,r,i=0,s=0,l=null,d=()=>{clearTimeout(r),r=void 0},u=e.selfId();if(u){let a=e.onUnmount(c=>{c===u&&(d(),a())})}return{onPointerDown:a=>{i=a.clientX??0,s=a.clientY??0,l=a,d(),r=setTimeout(()=>{r=void 0,l&&t(l)},o)},onPointerUp:d,onPointerLeave:d,onPointerMove:a=>{let c=Math.abs((a.clientX??0)-i),f=Math.abs((a.clientY??0)-s);(c>10||f>10)&&d()},onContextMenu:a=>{a.preventDefault(),t(a)}}}function $e(e,n){let t=e.selfId(),o="closed",r,i=()=>{o="closed",t?e.render([t]):e.render()};return{get phase(){return o},ref:l=>{l?r||(r=()=>{o==="exit"&&i()},l.addEventListener("animationend",r)):r=void 0},sync:l=>(l?o="open":o==="open"&&(o="exit"),o)}}function Mn(e,n,t){let o=e.selfId(),r=ln(e),i=t?.duration??400,s=t?.ease==="linear"?f=>f:f=>1-Math.pow(1-f,3),l,d=n,u={value:r?n:0,reset:()=>{}},a=()=>{o?e.render([o]):e.render()},c=f=>{if(d=f,r){u.value=f,a();return}if(f===u.value)return;l&&cancelAnimationFrame(l);let p=u.value,m=performance.now(),g=h=>{let N=Math.min(1,(h-m)/i);u.value=Math.round(p+(f-p)*s(N)),N<1?(l=requestAnimationFrame(g),a()):(l=void 0,a())};l=requestAnimationFrame(g)};if(u.reset=f=>{f===d&&l||c(f)},o){let f=e.onUnmount(p=>{p===o&&(l&&(cancelAnimationFrame(l),l=void 0),f())})}return queueMicrotask(()=>c(n)),u}function Hn(e,n,t){let o=e.selfId(),r=e.browser,i=`media:${o}:${n}`;if(!e.mediaRegistry.has(i)){let s=r.matchMedia(n);t(s.matches);let l=u=>t(u.matches);s.addEventListener("change",l),e.mediaRegistry.set(i,{mql:s,handler:l});let d=e.onUnmount(u=>{if(u!==o)return;let a=e.mediaRegistry.get(i);if(a?.mql&&a.handler)try{a.mql.removeEventListener("change",a.handler)}catch{}e.mediaRegistry.delete(i),d()})}}function On(e,n,t){let o=e.browser,r=typeof n=="function"?{mobile:"(max-width: 639px)",tablet:"(min-width: 640px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"}:n,i=typeof n=="function"?n:t,s=e.selfId(),l=`bp:${s}`;function d(){for(let[u,a]of Object.entries(r))if(o.matchMedia(a).matches)return u;return Object.keys(r)[0]??""}if(!e.mediaRegistry.has(l)){i(d());let u=[];for(let c of Object.values(r)){let f=o.matchMedia(c),p=()=>i(d());f.addEventListener("change",p),u.push({mql:f,handler:p})}e.mediaRegistry.set(l,{mqls:u});let a=e.onUnmount(c=>{if(c!==s)return;let f=e.mediaRegistry.get(l);if(f?.mqls)for(let p of f.mqls)try{p.mql.removeEventListener("change",p.handler)}catch{}e.mediaRegistry.delete(l),a()})}}function Un(e){let n=e.selfId(),t=e.browser,o={height:t.viewportHeight(),offsetTop:0,keyboardOpen:!1},r=()=>{n?e.render([n]):e.render()},i=()=>{let l=t.visualViewport();o.height=l?.height??t.viewportHeight(),o.offsetTop=l?.offsetTop??0,o.keyboardOpen=o.height<t.viewportHeight()*.9,r()},s=t.visualViewport();if(s?.addEventListener?(s.addEventListener("resize",i),s.addEventListener("scroll",i)):t.addEventListener("resize",i),n){let l=e.onUnmount(d=>{d===n&&(s?.removeEventListener?(s.removeEventListener("resize",i),s.removeEventListener("scroll",i)):t.removeEventListener("resize",i),l())})}return o}function $n(e,n){let t=e.selfId(),o={isIn:!1,ready:!1,observe:d,refresh:u,disconnect:a},r=null,i=null,s=()=>{t?e.render([t]):e.render()};function l(){if(i?.disconnect(),i=null,!r)return;let c=typeof n.rootMargin=="function"?n.rootMargin():n.rootMargin,f=typeof n.threshold=="function"?n.threshold():n.threshold;i=new IntersectionObserver(p=>{let m=p[p.length-1];if(!m)return;let g=m.isIntersecting,h=g!==o.isIn,N=!o.ready;o.isIn=g,o.ready=!0,n.onChange?.(m,g),(h||N)&&s()},{root:n.root?n.root():null,rootMargin:c??"0px",threshold:f??0}),i.observe(r)}function d(c){r=c,c?l():(i?.disconnect(),i=null,o.isIn=!1)}function u(){l()}function a(){i?.disconnect(),i=null}if(t){let c=e.onUnmount(f=>{f===t&&(a(),c())})}return o}function Dn(e,n){let t=e.selfId(),o=e.browser,r={y:0,refresh(){let l=i.getScroller();r.y=l instanceof Window?o.scrollingElement()?.scrollTop??o.scrollTop():l.scrollTop??0}},i={handle:r,getScroller:n.getScroller??(()=>window)};if(!t)return r.refresh(),r;e.scrollTrackers.set(t,i),e.ensurePopupListeners(),r.refresh();let s=e.onUnmount(l=>{l===t&&(e.scrollTrackers.delete(t),s())});return r}function an(e,n){let t=e.selfId(),o=n.value!==void 0;if(o&&!n.onChange&&n.name&&(e.warned.has(n.name)||(e.warned.add(n.name),console.warn(`[weifuwu/${n.name}] \u53D7\u63A7\u6A21\u5F0F\uFF08value \u5DF2\u4F20\uFF09\u4F46\u672A\u63D0\u4F9B onChange\uFF0C\u4EA4\u4E92\u65E0\u6CD5\u751F\u6548\u3002
4
- \u975E\u53D7\u63A7\uFF1A\u53BB\u6389 value\uFF1B\u53D7\u63A7\uFF1A\u4F20\u5165 onChange={(v) => setValue(v)}`))),!o&&t&&!e.uncontrolledValues.has(t)){e.uncontrolledValues.set(t,n.value);let i=e.onUnmount(s=>{s===t&&(e.uncontrolledValues.delete(t),i())})}let r=i=>{if(o){n.onChange?.(i);return}t&&e.uncontrolledValues.set(t,i),t?e.render([t]):e.render()};return{value:o?n.value:t?e.uncontrolledValues.get(t):n.value,setValue:r,controlled:o}}function jn(e,n){let t=e.selfId(),o=an(e,{value:n.value,onChange:n.onChange,name:n.name});if(t&&!e.inputStates.has(t)){e.inputStates.set(t,{keyword:"",selectedLabel:""});let s=e.onUnmount(l=>{l===t&&(e.inputStates.delete(t),s())})}let r=t?e.inputStates.get(t):{keyword:"",selectedLabel:""},i=()=>{t?e.render([t]):e.render()};return{...o,get keyword(){return r.keyword},setKeyword(s){r.keyword=s,i()},get selectedLabel(){return r.selectedLabel},setSelectedLabel(s){r.selectedLabel=s,i()}}}function Wn(e,n){let t=e.selfId(),o=!1;if(t){let d=e.onUnmount(u=>{u===t&&(o=!0,d())})}let r=()=>{o||(t?e.render([t]):e.render())},i={data:void 0,loading:!1,error:void 0},s=0,l=()=>{let d=++s;i.loading=!0,i.error=null,r(),Promise.resolve().then(()=>n()).then(u=>{s===d&&(i.data=u,i.loading=!1,r())}).catch(u=>{s===d&&(i.error=u,i.loading=!1,r())})};return l(),i.reload=l,i}function Fn(e,n){let t=e.selfId(),o=e.browser;if(typeof window>"u")return()=>{};if(o.addEventListener("keydown",n),t){let r=e.onUnmount(i=>{i===t&&(o.removeEventListener("keydown",n),r())})}return()=>o.removeEventListener("keydown",n)}function Bn(e,n){let t=e.browser,o=0,r=0,i=!1,s=a=>{i&&n.onMove(a,{x:a.clientX-o,y:a.clientY-r})},l=a=>{i&&(i=!1,t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",l),n.onEnd?.(a))},d=a=>{i||(a.preventDefault(),i=!0,o=a.clientX,r=a.clientY,t.addEventListener("pointermove",s),t.addEventListener("pointerup",l),n.onStart?.(a))},u=e.selfId();if(u){let a=e.onUnmount(c=>{c===u&&(i&&(t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",l),i=!1),a())})}return{onPointerDown:d}}function Kn(e,n){let t={};n.onDrop&&(t.onDrop=r=>{r.preventDefault(),n.onDrop(r)}),n.onDragOver&&(t.onDragOver=r=>{r.preventDefault(),n.onDragOver(r)}),n.onDragLeave&&(t.onDragLeave=r=>n.onDragLeave(r));let o={draggable:!0};if(n.onDragStart){let r=n.onDragStart;o.onDragStart=i=>{typeof document<"u"&&document.body.classList.add("wf-dragging"),r(i)}}if(n.onDragEnd){let r=n.onDragEnd;o.onDragEnd=i=>{typeof document<"u"&&document.body.classList.remove("wf-dragging"),r(i)}}return{dropProps:t,dragProps:o}}function un(e,n){let t=e.selfId(),o={top:0,left:0,refresh:()=>{}};if(!t)return o;let r={pos:o,getEl:n.el,isOpen:n.isOpen,compute:n.compute,panel:n.panel,margin:n.margin??8};e.popupTrackers.set(t,r),e.ensurePopupListeners();let i=e.onUnmount(s=>{s===t&&(e.popupTrackers.delete(t),i())});return o.refresh=()=>{let s=r.getEl();if(!s)return;let l=s.getBoundingClientRect();if(l.width===0&&l.height===0)return;let d=r.compute(l);Object.assign(o,sn(d,r.panel?.(),r.margin))},o}function qn(e,n){let t=e.selfId(),o=e.browser,r=Ue(e),i=()=>typeof n.trigger=="function"?n.trigger():n.trigger??"manual",s=n.open!==void 0,l=()=>!!n.disabled?.(),d=()=>s?typeof n.open=="function"?!!n.open():!!n.open:n.isOpen(),u=n.presence?$e(e,{name:n.name}):null,a,c=!1,f=w=>{if(!u)return w?"open":"closed";let T=u.sync(w);return w&&n.lockScroll&&!c&&(xr(),c=!0),T},p=w=>{l()||(s?n.onOpenChange?.(w):u?w?f(!0):d()&&f(!1):n.setOpen(w))},m=()=>{let w=n.placement;return typeof w=="function"?w():w??"bottom"},g=null,h=!1,N=un(e,{el:n.el??(()=>null),isOpen:()=>d(),compute:w=>{if(n.position){let T=n.position();return{top:T.y,left:T.x,width:T.width}}return It(w,m(),n.gap??6,n.center!==!1)},panel:()=>g,margin:n.margin??8}),y=w=>{if(n.closeOnOutside===!1||n.mask||!d())return;let T=w.target;if(!(T instanceof Node))return;let X=n.el?.()??null;X&&X.contains(T)||g&&g.contains(T)||p(!1)},v=w=>{n.closeOnEscape!==!1&&(w.key!=="Escape"||!d()||p(!1))};if(o.addEventListener("mousedown",y),o.addEventListener("keydown",v),t){let w=e.onUnmount(T=>{T===t&&(o.removeEventListener("mousedown",y),o.removeEventListener("keydown",v),w())})}let b={},H=w=>typeof w=="function"?w():w??0,W=()=>H(n.openDelay),C=()=>H(n.closeDelay),E,_,ce=()=>{clearTimeout(E),clearTimeout(_),E=void 0,_=void 0},F=w=>{if(l())return;let T=w.currentTarget,X=w.relatedTarget;T.contains(X)||(clearTimeout(_),_=void 0,E=setTimeout(()=>{E=void 0,p(!0)},W()))},j=w=>{if(l())return;let T=w.currentTarget,X=w.relatedTarget;T.contains(X)||(clearTimeout(E),E=void 0,_=setTimeout(()=>{_=void 0,p(!1)},C()))},ie=()=>{l()||(clearTimeout(_),_=void 0,E=setTimeout(()=>{E=void 0,p(!0)},W()))},fe=()=>{l()||(clearTimeout(E),E=void 0,_=setTimeout(()=>{_=void 0,p(!1)},C()))},O=()=>i()==="hover";if(b.onMouseOver=w=>{O()&&F(w)},b.onMouseOut=w=>{O()&&j(w)},b.onClick=()=>{O()?r||p(!d()):i()==="click"&&p(!0)},b.onFocus=()=>{O()?ie():i()==="focus"&&(clearTimeout(_),_=void 0,p(!0))},b.onBlur=()=>{O()?fe():i()==="focus"&&(clearTimeout(E),E=void 0,_=setTimeout(()=>{_=void 0,p(!1)},C()))},i()==="longpress"){let w,T=0,X=0,me=()=>{clearTimeout(w),w=void 0};b.onPointerDown=M=>{l()||(T=M.clientX??0,X=M.clientY??0,me(),w=setTimeout(()=>{w=void 0,n.onTrigger?.({clientX:T,clientY:X}),p(!0)},n.longPressDuration??500))},b.onPointerUp=me,b.onPointerLeave=me,b.onPointerMove=M=>{let fn=Math.abs((M.clientX??0)-T),pn=Math.abs((M.clientY??0)-X);(fn>10||pn>10)&&me()},b.onContextMenu=M=>{M.preventDefault(),n.onTrigger?.({clientX:M.clientX??0,clientY:M.clientY??0}),p(!0)}}if(b.onKeyDown=w=>{w.key==="Escape"&&n.closeOnEscape!==!1&&p(!1)},t){let w=e.onUnmount(T=>{T===t&&(ce(),w())})}let R=w=>{if(w){g=w;let T=()=>N.refresh();w.addEventListener("animationend",T,{once:!0})}else g=null},pe=null,ke=null,Zn=w=>{R(w),ke&&ke(w),u?.ref(w),n.trapFocus&&(w?a=_r(w):(a?.(),a=void 0)),n.lockScroll&&!w&&c&&(Er(),c=!1)};return{get open(){return d()},setOpen:p,get phase(){return u?u.phase:d()?"open":"closed"},sync:f,wrapProps:b,portal:(w,T="popover")=>{if(l())return null;if(!(u?u.phase!=="closed":d()))return h=!1,pe=null,null;let me=n.el?.()??null;(!h||me!==pe)&&(me?N.refresh():queueMicrotask(()=>{d()&&N.refresh()}),h=!0,pe=me);let M=w.props??{};ke=M.ref??null;let fn=n.positioning==="none"?M.class??"":["wf-popup",M.class].filter(Boolean).join(" "),pn=n.positioning==="none"?{...M.style??{},position:"fixed"}:{...M.style??{},position:"fixed",top:`${N.top}px`,left:`${N.left}px`,...N.width!==void 0?{width:`${N.width}px`}:{},maxWidth:(()=>{let Be=typeof n.width=="function"?n.width():n.width;return Be!==void 0?`min(${Be}px, calc(100vw - 32px))`:"calc(100vw - 32px)"})()},we={...w,props:{...M,class:fn,style:pn,ref:Zn}};if(n.mask){let Be=typeof n.mask=="object"?n.mask:ge("div",{class:"wf-popup-mask","data-portal-mask":T,onClick:n.maskClosable===!1?void 0:()=>p(!1)}),Kt=n.maskCentered?ge("div",{class:"wf-cover",style:{"--wf-z":"var(--wf-z-popover)",pointerEvents:"none"}},{...we,props:{...we.props,style:{...M.style??{},pointerEvents:"auto"},ref:Zn}}):null,qt=n.maskCentered?void 0:{...we.props?.style??{},zIndex:"var(--wf-z-popover)"},Gt=n.maskCentered?Kt:{...we,props:{...we.props,style:qt}};return Ge([Be,Gt],T)}return Ge(we,T)},refresh:()=>N.refresh()}}function Gn(e,n){let t=e.selfId();if(t&&!e.openStates.has(t)){e.openStates.set(t,!1);let l=e.onUnmount(d=>{d===t&&(e.openStates.delete(t),l())})}let o=n.open!==void 0;o&&!n.onOpenChange&&n.name&&!e.warned.has(n.name)&&(e.warned.add(n.name),console.warn(`[weifuwu/${n.name}] \u53D7\u63A7\u6A21\u5F0F\uFF08open \u5DF2\u4F20\uFF09\u4F46\u672A\u63D0\u4F9B onOpenChange\uFF0C\u4EA4\u4E92\u65E0\u6CD5\u751F\u6548\u3002
5
- \u975E\u53D7\u63A7\uFF1A\u53BB\u6389 open\uFF1B\u53D7\u63A7\uFF1A\u4F20\u5165 onOpenChange={(o) => setOpen(o)}`));let r=()=>o?!!n.open:t?e.openStates.get(t)??!1:!1,i=()=>{t?e.render([t]):e.render()},s=l=>{if(o){n.onOpenChange?.(l);return}t&&e.openStates.set(t,l),i()};return{get open(){return r()},setOpen:s,triggerProps:{onClick:()=>s(!0),onFocus:()=>{n.openOnFocus&&s(!0)}}}}var Ne=V(),De=0,Mt="",Ht="",Ot="",Ut="",dn=0;function $t(){return typeof window<"u"&&typeof document<"u"}function xr(){if(De++,De>1||!$t())return;dn=Ne.scrollTop();let e=Ne.bodyElement();Mt=e.style.overflow,Ht=e.style.position,Ot=e.style.top,Ut=e.style.width,e.style.overflow="hidden",(/iPhone|iPad|iPod/.test(navigator.platform)||/Mac/.test(navigator.platform)&&"ontouchend"in document)&&(e.style.position="fixed",e.style.top=`-${dn}px`,e.style.width="100%")}function Er(){if(De===0||(De--,De>0)||!$t())return;let e=Ne.bodyElement();e.style.overflow=Mt,e.style.position=Ht,e.style.top=Ot,e.style.width=Ut,dn>0&&Ne.scrollTo(dn)}var Tr='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function _r(e){let n;return queueMicrotask(()=>{let t=e.querySelectorAll(Tr);if(t.length===0)return;let o=t[0],r=t[t.length-1],i=l=>{l.key==="Tab"&&(l.shiftKey&&Ne.activeElement()===o?(l.preventDefault(),r.focus()):!l.shiftKey&&Ne.activeElement()===r&&(l.preventDefault(),o.focus()))},s=Ne.activeElement();o.focus(),e.addEventListener("keydown",i),n=()=>{e.removeEventListener("keydown",i),s?.focus()}}),()=>n?.()}function kr(e){return e.map(n=>{let t={role:n.role,content:n.content};return n.reasoning&&(t.reasoning_content=n.reasoning),t})}function zn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Dt(e,n,t,o){t.initialMessages?e.messages=structuredClone(t.initialMessages):e.messages===void 0&&(e.messages=[]),e.input===void 0&&(e.input=""),e.streaming===void 0&&(e.streaming=!1),e.error===void 0&&(e.error=null),e.usage===void 0&&(e.usage=null),e.step===void 0&&(e.step=null);let r=null;function i(){if(!e.streaming)return;let m=e.messages[e.messages.length-1];return m&&m.role==="assistant"&&m.status==="streaming"?m:void 0}function s(m,g,h){let N=i();switch(m){case"wf:token":N&&(N.content+=g.text);break;case"wf:tool_call":{N&&(N.toolCalls||(N.toolCalls=[]),N.toolCalls.push({call:g,status:"running"}));break}case"wf:tool_progress":{let y=g,v=N?.toolCalls?.find(b=>b.call.id===y.toolCallId);v&&(v.progress=y);break}case"wf:tool_result":{let y=g,v=N?.toolCalls?.find(b=>b.call.id===y.id);v&&(v.result=y,v.status=y.ok?"ok":"error");break}case"wf:approval_request":N&&(N.approval=g);break;case"wf:usage":N&&(N.usage=g);break;case"wf:step":e.step=g;break;case"wf:done":if(N){N.status="done",N.approval=void 0;let y=g;y.reasoning&&(N.reasoning=y.reasoning)}e.streaming=!1,e.step=null;break;case"wf:error":N&&(N.status="error",N.error=g,N.approval=void 0),e.error=g,e.streaming=!1,e.step=null;break;default:h?.(m,g);break}o?.()}function l(){let m=t.body?t.body(e.messages):{messages:kr(e.messages)};r=n(t.url,m,{onToken:h=>s("wf:token",{text:h}),onToolCall:h=>s("wf:tool_call",h),onToolProgress:h=>s("wf:tool_progress",h),onToolResult:h=>s("wf:tool_result",h),onApproval:h=>s("wf:approval_request",h),onUsage:h=>s("wf:usage",h),onStep:h=>s("wf:step",h),onDone:h=>s("wf:done",h),onError:h=>s("wf:error",h),onEvent:(h,N)=>s(h,N,t.onEvent)},{signal:t.signal,headers:t.headers}),e.streaming=!0;let g=i();g&&r?.traceId&&(g.id=r.traceId)}function d(){if(e.streaming)return;let m=String(e.input??"").trim();m&&(e.input="",e.error=null,e.usage=null,e.step=null,e.messages.push({id:zn(),role:"user",content:m,status:"done"},{id:zn(),role:"assistant",content:"",status:"streaming",toolCalls:[]}),l(),o?.())}function u(){r?.abort(),e.streaming=!1,e.step=null;let m=e.messages[e.messages.length-1];m&&m.role==="assistant"&&m.status==="streaming"&&(!m.content&&(!m.toolCalls||m.toolCalls.length===0)?e.messages.pop():m.status="done"),o?.()}function a(){if(e.streaming)return;let m=-1;for(let g=e.messages.length-1;g>=0;g--)if(e.messages[g].role==="user"){m=g;break}m!==-1&&(e.messages.splice(m+1),e.error=null,e.usage=null,e.step=null,e.messages.push({id:zn(),role:"assistant",content:"",status:"streaming",toolCalls:[]}),l(),o?.())}function c(){r?.abort(),e.messages=[],e.input="",e.streaming=!1,e.error=null,e.usage=null,e.step=null,o?.()}async function f(m,g,h){let N=e.messages[e.messages.length-1],y=N?.role==="assistant"?N.approval:void 0;if(y&&(N.approval=void 0,o?.(),!!t.approveUrl))try{await fetch(t.approveUrl,{method:"POST",headers:{"Content-Type":"application/json",...t.headers},body:JSON.stringify(h?{id:y.id,decision:m,note:g,modifiedArgs:h}:{id:y.id,decision:m,note:g}),signal:t.signal})}catch(v){if(t.signal?.aborted)return;e.error={code:"provider_error",message:v instanceof Error?v.message:String(v)},o?.()}}function p(){r?.abort(),r=null}return{send:d,stop:u,retry:a,clear:c,approve:f,dispose:p}}function jt(e,n,t){let o=new AbortController,r=t?.signal;r&&(r.aborted?o.abort():r.addEventListener("abort",()=>o.abort(),{once:!0}));let i=t?.traceId??Ir(),s=t?.record!==!1,l=[],d=(async()=>{let u;try{u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Trace-Id":i,Accept:"text/event-stream",...t?.headers},body:JSON.stringify(n),signal:o.signal})}catch(a){if(o.signal.aborted)return;t?.onError?.({code:"provider_error",message:a instanceof Error?a.message:String(a)});return}if(!u.ok){t?.onError?.({code:Ar(u.status),message:`HTTP ${u.status} ${u.statusText}`});return}try{for await(let{name:a,data:c}of Sr(u.body)){if(o.signal.aborted)return;Rr(l,{name:a,data:c},s),Pr(a,c,t??{})}}catch(a){if(o.signal.aborted)return;t?.onError?.({code:"provider_error",message:a instanceof Error?a.message:String(a)})}})();return{abort:()=>o.abort(),done:d,traceId:i,events:l}}function Pr(e,n,t){switch(e){case"wf:token":return t.onToken?.(n.text);case"wf:tool_call":return t.onToolCall?.(n);case"wf:tool_result":return t.onToolResult?.(n);case"wf:tool_progress":return t.onToolProgress?.(n);case"wf:step":return t.onStep?.(n);case"wf:approval_request":return t.onApproval?.(n);case"wf:usage":return t.onUsage?.(n);case"wf:done":return t.onDone?.(n);case"wf:error":return t.onError?.(n);default:return t.onEvent?.(e,n)}}async function*Sr(e){let n=e.getReader(),t=new TextDecoder,o="";try{for(;;){let{done:r,value:i}=await n.read();if(r)break;o+=t.decode(i,{stream:!0});let s=o.split(`
1
+ function Yt(e){let n=[],t=(e||"/").replace(/:(\w+)/g,(o,r)=>(n.push(r),"([^/]+)")).replace(/\*/g,".*");return{re:new RegExp(`^${t}$`),keys:n}}var gn=class{_routes=[];_middlewares=[];_injections=[];_injected=!1;_mode;_notFound;constructor(n={}){this._mode=n.mode??"history"}get mode(){return this._mode}use(n,t){if(typeof n=="string"&&t){let o=this,r=n,i=async(s,l,d)=>{let u=l.__routePath??o.getPath(),a=null;return u===r?a="/":(r==="/"?u!=="/"&&u.startsWith("/"):u.startsWith(r+"/"))&&(a=u.slice(r.length)),a===null?d:async(c,f)=>{let p=await t._handle(a,c,f);return p===null?d(c,f):p}};return this._middlewares.push(i),this}return n.length<=1?(this._injections.push(n),this):(this._middlewares.push(n),this)}async _ensureInjected(n){if(!this._injected){this._injected=!0;for(let t of this._injections){let o=await t(n);o&&o!==n&&Object.assign(n,o)}}}get(n,t,o){return this._routes.push({path:n,handler:t,title:o?.title}),this}notFound(n){return this._notFound=n,this}getPath(){return this._getPath(void 0)}_getPath(n){let t=n?.location??(typeof window<"u"?window.location:null);return this._mode==="hash"?(t?.hash??"").replace(/^#/,"")||"/":t?.pathname??"/"}match(n){let t=null;for(let o of this._routes){let{re:r,keys:i}=Yt(o.path),s=n.match(r);if(!s)continue;let l={};for(let d=0;d<i.length;d++)l[i[d]]=decodeURIComponent(s[d+1]);t={handler:o.handler,params:l,title:o.title};break}return t||(t={handler:this._notFound??(()=>null),params:{}}),t}async _handle(n,t,o){await this._ensureInjected(o);let r=this.match(n);r.title&&typeof document<"u"&&(document.title=r.title),o.params=r.params,o.route&&(o.route.params=r.params);let s=r.handler,l=o.__routePath;o.__routePath=n;try{for(let d=this._middlewares.length-1;d>=0;d--){let u=this._middlewares[d],a=s;s=await u(t,o,a)??a}return await s(t,o)}finally{o.__routePath=l}}async execute(n,t,o){await this._ensureInjected(t);let r=this.match(o);r.title&&typeof document<"u"&&(document.title=r.title),t.params=r.params,t.route&&(t.route.params=r.params);let s=r.handler;for(let l=this._middlewares.length-1;l>=0;l--){let d=this._middlewares[l],u=s;s=await d(n,t,u)??u}return await s(n,t)}};var Q=Symbol("Fragment"),q=Symbol("Portal");function ze(e){return e!=null&&typeof e=="object"&&typeof e.type=="string"}function te(e){return e!=null&&typeof e=="object"&&e.type===Q}function k(e){return e!=null&&typeof e=="object"&&typeof e.type=="function"}function G(e){return e!=null&&typeof e=="object"&&e.type===q}function Ge(e,n,t=null){return{type:e,props:n,key:t,_child:null,_parentNode:null,_refNode:null,_id:null,_customId:null,_parentVNode:null,_ctxVersion:null,_lifecycle:"fresh"}}function Se(e,n,t=null){return e===Q?{...Ge(e,n,t),type:e}:e===q?{...Ge(e,n,t),type:e,_remoteEl:null,_placement:"remote"}:typeof e=="function"?{...Ge(e,n,t),type:e,_render:null,_outputChild:null}:{...Ge(e,n,t),type:e,el:null}}function he(e,n,...t){let o=nt(n??{});return t.length>0&&(o.children=t.length===1?t[0]:t),Se(e,o,n?.key??null)}function hn(e,n,t){return Se(e,nt(n),t??null)}var Jt=hn;function Xt(e,n,t){return hn(e,n,t)}function nt(e){if(!e)return{};let n={};for(let t of Object.keys(e))t!=="key"&&(n[t]=e[t]);return n}function S(e){return e==null||typeof e=="boolean"?[]:Array.isArray(e)?e:[e]}function Ye(e,n){let t=Se(q,{children:e,portalKey:n});return t.key=n??null,t}function x(){return{activeElement:()=>typeof document<"u"?document.activeElement:null,byId:e=>typeof document<"u"?document.getElementById(e):null,query:e=>typeof document<"u"?document.querySelector(e):null,queryAll:e=>typeof document<"u"?document.querySelectorAll(e):null,createElement:e=>typeof document<"u"?document.createElement(e):null,createElementNS:(e,n)=>typeof document<"u"?document.createElementNS(e,n):null,createDocumentFragment:()=>typeof document<"u"?document.createDocumentFragment():null,createComment:e=>typeof document<"u"?document.createComment(e):null,createTextNode:e=>typeof document<"u"?document.createTextNode(e):null,addEventListener:(e,n,t)=>{typeof window<"u"&&window.addEventListener(e,n,t)},removeEventListener:(e,n,t)=>{typeof window<"u"&&window.removeEventListener(e,n,t)},scrollTo:e=>{typeof window<"u"&&window.scrollTo(0,e)},matchMedia:e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e):null,visualViewport:()=>(typeof window<"u"?window:null)?.visualViewport??null,scrollingElement:()=>typeof document<"u"?document.scrollingElement:null,bodyElement:()=>typeof document<"u"?document.body:null,bodyAppend:e=>{typeof document<"u"&&document.body.appendChild(e)},bodyRemove:e=>{typeof document<"u"&&e.parentNode&&document.body.removeChild(e)},clearBody:()=>{typeof document<"u"&&(document.body.innerHTML="")},event:(e,n)=>{let t=typeof window<"u"?window:null,o=n&&(n.key||n.code)?"KeyboardEvent":n&&(n.clientX!==void 0||n.clientY!==void 0||n.pointerId!==void 0)?"PointerEvent":"Event";try{return new t[o](e,n)}catch{return new t.Event(e,n)}},dispatchEvent:(e,n)=>typeof e<"u"?e.dispatchEvent(n):!1,navigate:e=>{typeof window>"u"||(window.history.pushState(null,"",e),window.dispatchEvent(new PopStateEvent("popstate",{state:null})))},copyText:async e=>{let n=typeof window<"u"?window:null;if(n?.navigator?.clipboard?.writeText)try{return await n.navigator.clipboard.writeText(e),!0}catch{}try{if(typeof document>"u")return!1;let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let o=document.execCommand("copy");return document.body.removeChild(t),o}catch{return!1}},execCommand:(e,n)=>typeof document<"u"?document.execCommand(e,!1,n):!1,queryCommandState:e=>typeof document<"u"?document.queryCommandState(e):!1,queryCommandValue:e=>typeof document<"u"?document.queryCommandValue(e):"",selectionText:()=>typeof window<"u"?window.getSelection?.()?.toString()??null:null,getSelection:()=>typeof window<"u"?window.getSelection():null,viewportHeight:()=>typeof window<"u"?window.innerHeight:0,viewportWidth:()=>typeof window<"u"?window.innerWidth:0,pathname:()=>typeof window<"u"?window.location.pathname:"",createTreeWalker:(e,n)=>typeof document<"u"?document.createTreeWalker(e,n??NodeFilter.SHOW_ALL):null,scrollTop:()=>{let e=typeof document<"u"?document:null,n=typeof window<"u"?window:null;return e?.scrollingElement?.scrollTop??n?.scrollY??0},hash:()=>typeof window<"u"?window.location?.hash??"":"",setHash:e=>{typeof window<"u"&&(window.location.hash=e)},timeout:(e,n)=>typeof window<"u"?window.setTimeout(e,n):0,rootElement:()=>typeof document<"u"?document.documentElement:null,storageGet:e=>{try{return typeof window<"u"?window.localStorage?.getItem(e)??null:null}catch{return null}},storageSet:(e,n)=>{try{typeof window<"u"&&window.localStorage?.setItem(e,n)}catch{}}}}function Qt(e,n,t=400){let o=!1,r=()=>{o||(o=!0,e.removeEventListener("animationend",r),clearTimeout(i),n())};e.addEventListener("animationend",r);let i=setTimeout(r,t)}function Ve(e,n){return Object.assign(Object.create(e),n)}function Zt(e){let n={baseURL:e?.baseURL??"",headers:{"Content-Type":"application/json",...e?.headers}},t=e?.onRequest,o=e?.onResponse,r=e?.timeout??0;async function i(s,l,d,u,a=!1){let c=n.baseURL+l,f={method:s,headers:{...n.headers,...u?.headers}},p=e?.token?.();p&&!f.headers.Authorization&&(f.headers.Authorization=`Bearer ${p}`);let m=r>0,g=!!u?.signal,h=null,w=null;(m||g)&&(h=new AbortController,f.signal=h.signal,m&&(w=setTimeout(()=>h.abort(new Error("Request timed out")),r)),g&&u.signal.addEventListener("abort",()=>h.abort())),d!==void 0&&s!=="GET"&&s!=="HEAD"&&(f.body=JSON.stringify(d));let y={url:c,init:f};t&&(y=t(y));try{let v=await fetch(y.url,y.init);if(v.status===401&&await e?.onUnauthorized?.()&&!a)return i(s,l,d,u,!0);if(o)return o(v);if(!v.ok){let B=await v.text().catch(()=>"");throw new vn(v.status,B||v.statusText)}let b=v.headers.get("content-length");if(v.status===204||b==="0")return;let I=(v.headers.get("content-type")||"").toLowerCase();return I.includes("application/json")||I.includes("json")?v.json():v.text()}finally{w&&clearTimeout(w)}}return s=>Ve(s,{api:{get:(d,u)=>i("GET",d,void 0,u),post:(d,u,a)=>i("POST",d,u,a),put:(d,u,a)=>i("PUT",d,u,a),patch:(d,u,a)=>i("PATCH",d,u,a),delete:(d,u)=>i("DELETE",d,void 0,u)}})}var vn=class extends Error{status;body;constructor(n,t){super(`API Error ${n}: ${t}`),this.name="ApiError",this.status=n,this.body=t}};function eo(e){try{let n=e.split(".");if(n.length!==3)return null;let t=n[1].replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(t))}catch{return null}}function no(e){let n=eo(e);return n?.exp?n.exp*1e3-3e4<Date.now():!0}function to(e){let n=e?.storage??localStorage,t=e?.tokenKey??"weifuwu_token",o=e?.userKey??"weifuwu_user",r=e?.refreshTokenKey??"weifuwu_refresh",i=e?.refreshEndpoint??"/api/auth/refresh";return s=>{let l=n.getItem(t),d=n.getItem(o),u=null,a={token:l,user:d?JSON.parse(d):null,get isLoggedIn(){return this.token!==null},login(f,p,m){a.token=f,a.user=p,n.setItem(t,f),n.setItem(o,JSON.stringify(p)),m&&n.setItem(r,m)},logout(){a.token=null,a.user=null,n.removeItem(t),n.removeItem(o),n.removeItem(r)},setUser(f){a.user=f,n.setItem(o,JSON.stringify(f))},async refresh(){return u||(u=c().finally(()=>{u=null}),u)}};async function c(){let f=n.getItem(r);if(!f)return!1;let p=n.getItem(t);try{let m=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:f})});if(n.getItem(t)!==p)return!1;if(!m.ok)return a.logout(),!1;let g=await m.json();return n.getItem(t)!==p?!1:(a.token=g.token,n.setItem(t,g.token),g.refreshToken&&n.setItem(r,g.refreshToken),!0)}catch{return!1}}return l&&no(l)&&a.refresh().catch(()=>{}),e?.onAuth?.(a),Ve(s,{auth:a})}}function oo(e={}){let n=e.url??"/ws",t=e.reconnectInterval??3e3,o=e.maxReconnect??10,r=e.pingInterval??3e4,i=e.pingTimeout??1e4;return s=>{let l=new Set,d=null,u=0,a=null,c=null,f=null,p=!1,m=[],g={isConnected:!1,onMessage:b=>(l.add(b),()=>{l.delete(b)}),send:b=>{let I=JSON.stringify(b);d?.readyState===WebSocket.OPEN?d.send(I):m.push(I)},_connect:h,close:()=>{p=!0,v(),d?.close(),d=null,m=[],g.isConnected=!1}};async function h(){if(!p)try{d=new WebSocket(n),d.onopen=()=>{g.isConnected=!0,u=0;for(let b of m)d.send(b);m=[],w()},d.onmessage=b=>{try{let I=JSON.parse(b.data);for(let B of l)B(I)}catch{}y()},d.onclose=()=>{g.isConnected=!1,v(),!p&&u<o&&(u++,a=setTimeout(h,t*Math.min(u,5)))},d.onerror=()=>{d?.close()}}catch{p||(a=setTimeout(h,t))}}function w(){r<=0||(c=setInterval(()=>{d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"ping"})),f=setTimeout(()=>{d?.close()},i)},r))}function y(){clearTimeout(f)}function v(){clearInterval(c),clearTimeout(f),clearTimeout(a)}return h(),Ve(s,{ws:g})}}var ro={route:"route",lifecycle:"lifecycle",x2y:"diff",keys:"diff",pos:"diff",render:"render",audit:"audit",build:"build",mount:"mount",diff:"diff"};function ot(e){return ro[e]}var xe=new Set;function Xe(e){return xe.add(e),()=>{xe.delete(e)}}var Je=[],io=0;function Qe(e){let n=`R${++io}${e?":"+e:""}`;return Je.push(n),n}function Ae(){Je.pop()}function so(){return Je[Je.length-1]??""}function P(e){if(xe.size!==0){e.session||(e.session=so()),typeof e.payload=="function"&&(xe.size>1||E(ot(e.machine),e.level??"debug"))&&(e.payload=e.payload());for(let n of xe)try{n(e)}catch{}}}function rt(){return xe.size>1}function lo(e){if(e==null)return"";if(typeof e=="string")return` ${e}`;if(typeof e=="object"){let n=e,t=[];for(let o of["path","i","key","mode","kind","insertedBefore","after","depth"])if(n[o]!==void 0){let r=n[o];t.push(`${o}=${typeof r=="object"?JSON.stringify(r):String(r)}`)}return t.length?" "+t.join(" "):""}return` ${String(e)}`}function ao(e){let n=ot(e.machine);if(!E(n,e.level??"debug"))return;if(e.event==="TRACE"){console.log(`[vdom:${e.machine}] ${e.payload}`);return}let t=e.component?`${e.component}${e.nodeId?`(${e.nodeId})`:""}`:e.nodeId?`(${e.nodeId})`:"";console.log(`[vdom:${e.machine}] ${t?t+" ":""}${e.from} --${e.event}--> ${e.to}${lo(e.payload)}`)}Xe(ao);var uo=500,Re=[],tt=!1;function co(e){Re.push(e),Re.length>uo&&Re.shift()}function it(){tt||(tt=!0,Xe(co))}function st(){it()}function lt(e=50,n){return it(),n?Re.filter(t=>Object.entries(n).every(([o,r])=>t[o]===r)).slice(-e):Re.slice(-e)}var fo={fresh:{BUILD_START:"building",BUILD_DONE:"built",PRUNE:"pruned",DISPOSE:"disposed"},building:{BUILD_DONE:"built",DISPOSE:"disposed"},built:{BUILD_START:"building",PRUNE:"pruned",DISPOSE:"disposed"},pruned:{BUILD_START:"building",PRUNE:"pruned",DISPOSE:"disposed"},disposed:{BUILD_START:"building"}};function Z(e){let n=0,t=e._parentVNode??null;for(let o=0;o<10&&t;o++)n++,t=t._parentVNode??null;return{name:typeof e.type=="function"?e.type.name||"anonymous":String(e.type),id:e._id??null,depth:n}}var Ze=new Map,po=50;function mo(e,n,t,o){if(!e?.id)return;let r=Ze.get(e.id);r||(r={name:e.name??"?",events:[]},Ze.set(e.id,r)),r.events.push(`${n}--${t}-->${o}`),r.events.length>po&&r.events.shift()}function at(e){if(e){let n=Ze.get(e);return n?`${n.name}(${e}): ${n.events.join(" \u2192 ")}`:`no timeline for ${e}`}return[...Ze.entries()].map(([n,t])=>`${t.name}(${n}): ${t.events.join(" \u2192 ")}`).join(`
2
+ `)}function ee(e,n,t){let o=fo[e]?.[n]??null;return o==null?(P({session:"",machine:"lifecycle",nodeId:t?.id??null,component:t?.name??null,from:e,event:n,to:"?",level:"warn",ts:Date.now()}),e):(mo(t,e,n,o),P({session:"",machine:"lifecycle",nodeId:t?.id??null,component:t?.name??null,from:e,event:n,to:o,payload:()=>({depth:t?.depth??0}),level:"debug",ts:Date.now()}),o)}function Ee(e){return!e||e._lifecycle==="disposed"||e._child==null?!1:!Nn(e._child)}function Nn(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e)){for(let t of e)if(Nn(t))return!0;return!1}let n=e;return!!(n._lifecycle==="disposed"||n._child!=null&&Nn(n._child))}var wn={error:0,warn:1,info:2,debug:3,trace:4},ut=["mount","build","render","diff","lifecycle","route","audit"],oe={enabled:!1,stages:new Set,level:"info",filter:null},bn=!1;function yo(e){return e&&e in wn?e:"info"}function dt(e){let n=new Set;if(!e)return n;for(let t of e.split(",")){let o=t.trim().split(":")[0];ut.includes(o)&&n.add(o)}return n}function Vn(){if(bn)return oe;bn=!0;try{let e=globalThis,n=new URLSearchParams(typeof e.location?.search=="string"?e.location.search:""),t=n.get("vdom_trace"),o=n.get("vdom_debug"),r=e.__vdom_trace__,i=typeof e.localStorage?.getItem=="function"?e.localStorage.getItem("vdom_trace"):null;if(o==="1"||e?.localStorage?.getItem?.("__WF_VDOM_DEBUG")==="1")oe={enabled:!0,stages:new Set(ut),level:"debug",filter:null};else if(t||r||i){let s=new Set;if(t)for(let l of dt(t))s.add(l);if(r?.stages){let l=Array.isArray(r.stages)?r.stages:[...r.stages];for(let d of l)s.add(d)}if(i)for(let l of dt(i))s.add(l);oe={enabled:!0,stages:s,level:t?.includes(":")?yo(t.split(":")[1]):r?.level??"debug",filter:typeof r?.filter=="string"?r.filter:null}}}catch{}return oe}function E(e,n="info"){return!oe.enabled&&(bn||Vn(),!oe.enabled)||oe.stages.size&&!oe.stages.has(e)?!1:wn[n]<=wn[oe.level]}function _(e,n,t,...o){if(!E(e,n)&&!rt())return;let r=oe.filter;r&&!t.includes(r)||P({session:"",machine:e,nodeId:null,component:null,from:"",event:"TRACE",to:"",payload:()=>o.length?`${t} ${o.join(" ")}`:t,level:n,ts:Date.now()})}var go=0;function ct(e){return`R${++go}${e?`:${e}`:""}`}function z(e,n=12){if(!e)return"\u2205";if(typeof e=="string"||typeof e=="number")return`"${e}"`;if(!Array.isArray(e))return ve(e);let t=e.slice(0,n).map(ve);return e.length>n&&t.push(`\u2026+${e.length-n}`),`[${t.join(" | ")}]`}function ft(e){return typeof e=="function"?"function":e===Q?"fragment":typeof e=="string"?"string":"other"}var ho={function:e=>e.name||"Comp",fragment:()=>"Frag",string:e=>String(e),other:e=>String(e)},vo={function:e=>e.name||"anonymous",fragment:()=>"Fragment",string:e=>String(e),other:e=>e===q?"Portal":String(e)};function ve(e){if(e==null||typeof e=="boolean")return String(e);if(typeof e=="string")return`"${e.slice(0,16)}"`;if(typeof e=="number")return String(e);if(Array.isArray(e))return`ARR(${e.length})`;let n=e,t=n.type,o=ho[ft(t)](t),r=n.props?.id?`#${n.props.id}`:n.key!=null?`@${n.key}`:"";return o+r}function Y(e){if(!e)return"null";if(e.nodeType===1){let n=e;return`${n.tagName}${n.id?`#${n.id}`:""}${n.getAttribute?.("data-wf-key")?`@${n.getAttribute("data-wf-key")}`:""}`}return e.nodeType===3?`"${(e.textContent??"").slice(0,12)}"`:e.nodeType===8?`<!--${(e.nodeValue??"").slice(0,40)}-->`:`#${e.nodeType}`}function de(e,n=12){if(!e)return"null";let o=Array.from(e.childNodes).slice(0,n).map(Y);return e.childNodes.length>n&&o.push(`\u2026+${e.childNodes.length-n}`),`[${o.join(" | ")}]`}function Cn(e,n=0){if(e==null||typeof e=="boolean")return[];if(typeof e=="string"||typeof e=="number")return[`${" ".repeat(n)}"${String(e).slice(0,20)}"`];if(Array.isArray(e))return e.flatMap(u=>Cn(u,n));let t=e,o=t.type,r=vo[ft(o)](o),i=t._lifecycle?`[${t._lifecycle}]`:"",s=t._id?`(${t._id})`:"",l=[`${" ".repeat(n)}${r}${s}${i}`],d=t._child;return d!=null&&l.push(...Cn(d,n+1)),l}function pt(e){let n=globalThis;if(n.__vdom_dump==null&&(n.__vdom_dump=()=>Cn(e()??null).join(`
3
+ `)),n.__vdom_lc==null&&(n.__vdom_lc=t=>at(t)),n.__vdom_events==null){let t=lt;n.__vdom_events=(o,r)=>t(o,r)}}function R(e){return typeof e=="function"&&e.name||"anonymous"}function en(e){return e.ui?._ctxVersion??0}function xn(e,n){e.ui?.setMounting?.(n)}var No=0;function ye(){return{idRegistry:new Map,unmountHooks:[],nextId:()=>`_wf_${No++}`}}function nn(e,n){return e.unmountHooks.push(n),()=>{let t=e.unmountHooks.indexOf(n);t>=0&&e.unmountHooks.splice(t,1)}}function mt(e,n){for(let t of[...e.unmountHooks])t(n);e.idRegistry.delete(n),e.idRegistry.delete(`custom:${n}`)}function wo(e,n,t,o){try{e(n)}catch(r){console.error(`[weifuwu] ref ${t} error in <${o??"anonymous"}>`,r)}}function H(e,n){if(e==null||typeof e!="object")return;let t=e;if(t._id){let o=Z(t);if(t._customId&&n.idRegistry.delete(t._customId),n.idRegistry.delete(t._id),n.unmountHooks.length>0){let r=[...n.unmountHooks];for(let i of r)i(t._id);if(t._customId)for(let i of r)i(t._customId)}t._id=null,t._customId=null,k(t)&&(t._render=null),t._parentNode=null,t._refNode=null,t._lifecycle=ee(t._lifecycle,"DISPOSE",o)}else(k(t)||t._child!=null)&&(t._lifecycle=ee(t._lifecycle,"DISPOSE",Z(t)));if(t._child!=null){if(Array.isArray(t._child))for(let o of t._child)o&&typeof o=="object"&&H(o,n);else H(t._child,n);t._child=null}if(t.props?.children&&typeof t.type=="string"){let o=Array.isArray(t.props.children)?t.props.children:[t.props.children];for(let r of o)r&&typeof r=="object"&&H(r,n)}if(typeof t.props?.ref=="function"&&wo(t.props.ref,null,"cleanup"),G(t)){let o=t._remoteEl;if(o){let r=t._child;if(r!=null)if(Array.isArray(r))for(let i of r)i&&typeof i=="object"&&H(i,n);else typeof r=="object"&&H(r,n);o.remove(),t._remoteEl=null}}}function A(e,n){if(e==null||typeof e!="object")return null;if(Array.isArray(e)||te(e)){let o=n;if(o&&o.nodeType===8&&o.nodeValue?.includes("type=fragment-start")){let r=[o],i=/fid=([^\s"]+)/.exec(o.nodeValue)?.[1]??"",s=o.nextSibling;for(;s&&(r.push(s),!(s.nodeType===8&&s.nodeValue?.includes("type=fragment-end")&&(/fid=([^\s"]+)/.exec(s.nodeValue)?.[1]??i)===i));)s=s.nextSibling;return r}return null}let t=e;return k(t)?A(t._outputChild??t._child,n):null}function O(e){if(e==null||typeof e=="boolean")return"hole";if(typeof e=="string"||typeof e=="number")return"text";if(Array.isArray(e))return"arr";let n=e;return te(n)?"frag":G(n)?"portal":k(n)?"comp":"native"}function En(e){let n=!1,t=!1;for(let o of e){if(o==null||typeof o=="boolean"||typeof o=="string"||typeof o=="number")continue;if(Array.isArray(o)){t=!0;continue}let r=o;G(r)||(r.key!=null?n=!0:t=!0)}return n&&t?"mixed":n?"keyed":"unkeyed"}function bo(e){if(e===!1)return"false";if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0)return"true";if(typeof e=="object")try{let n=JSON.stringify(e);return`object ${n!=null&&n.length>80?n.slice(0,80)+"\u2026":n??""}`}catch{return`object ${Object.prototype.toString.call(e)}`}return`bad-vnode type=${typeof e}`}function tn(e){return/[\s"=]/.test(e)?`"${e.replace(/"/g,"'")}"`:e}function F(e){let n=[`type=${e.type}`];return e.value!==void 0&&n.push(`value=${tn(bo(e.value))}`),e.key!=null&&n.push(`key=${tn(e.key)}`),e.id!=null&&n.push(`id=${tn(e.id)}`),e.fid!=null&&n.push(`fid=${tn(e.fid)}`),`wf-hole: ${n.join(" ")}`}function gt(e){return typeof e!="string"&&typeof e!="function"&&e!==Q&&e!==q}function ht(e){for(let n=0;n<e.length;n++){let t=e[n];if(t!=null&&typeof t=="object"&&!Array.isArray(t)){let o=t;o.key!==null&&(o.key=String(o.key))}}}var Co=/^on[A-Z]/,Vo=/^on[A-Z].*Capture$/;function Tn(e){let n=Vo.test(e);return{type:(n?e.slice(2,-7):e.slice(2)).toLowerCase(),capture:n}}var _n=new Set(["draggable","contenteditable","spellcheck","translate"]),xo=new Set(["zIndex","opacity","lineHeight","fontWeight","fontSizeAdjust","flex","flexGrow","flexShrink","order","zoom","aspectRatio","gridRow","gridColumn","scale","rotate","animationIterationCount","columnCount","fillOpacity","strokeOpacity","stopOpacity","floodOpacity"]);function kn(e){return _n.has(e.toLowerCase())?"enumerated":e==="class"||e==="className"?"class":e==="style"?"style":e==="ref"?"ref":Co.test(e)?"event":e==="value"?"value":e==="indeterminate"?"indeterminate":e==="innerHTML"?"innerHTML":e.startsWith("aria-")?"aria":"default"}function yt(e,n,t){if(t!==!1){if(t===!0){e.setAttribute(n,"");return}try{e[n]=t,e.getAttribute(n)!==String(t)&&e.setAttribute(n,String(t))}catch{e.setAttribute(n,String(t))}}}var Eo={enumerated:(e,n,t)=>{e.setAttribute(n,t?"true":"false")},class:(e,n,t)=>{if(t!==!1)if(typeof t=="object")for(let[o,r]of Object.entries(t))r&&e.classList.add(o);else e.setAttribute("class",String(t))},style:(e,n,t)=>{if(t!==!1)if(typeof t=="string")e.setAttribute("style",t);else{let o=e.style;for(let[r,i]of Object.entries(t))i==null?o[r]="":r.startsWith("--")?o.setProperty(r,String(i)):typeof i=="number"&&!xo.has(r)?o[r]=`${i}px`:o[r]=String(i)}},ref:(e,n,t)=>{if(typeof t=="function")try{t(e)}catch(o){console.error("[weifuwu] ref error",o)}},event:(e,n,t)=>{if(t===!1)return;let{type:o,capture:r}=Tn(n);if(typeof t!="function"){console.warn(`[weifuwu] event prop ${n} expects a function, got ${typeof t} \u2014 ignored`);return}e.addEventListener(o,t,r?{capture:!0}:{})},value:(e,n,t)=>{t!==!1&&(e.value=t)},indeterminate:(e,n,t)=>{t!==!1&&(e.indeterminate=!!t)},innerHTML:(e,n,t)=>{t!==!1&&(e.innerHTML=String(t??""))},aria:(e,n,t)=>{if(t!==!1){if(typeof t=="boolean"){e.setAttribute(n,t?"true":"false");return}yt(e,n,t)}},default:yt};function re(e,n,t){t!=null&&Eo[kn(n)](e,n,t)}function ue(e,n){return e.createComment(F({type:"hole",value:n,key:null,id:null,fid:null}))}function ce(){return!!globalThis?.__WF_VDOM_AUDIT}var vt=!1;function Nt(){vt||(vt=!0,Xe(e=>{e.machine!=="render"||e.event!=="PARENT"||ce()&&e.to==="SKIP_DETACHED"&&console.error(`[vdom2/audit] \u6302\u8F7D\u4E0D\u53D8\u91CF\u8FDD\u53CD\uFF1A\u7EC4\u4EF6 ${e.component??"?"}${e.nodeId?`(${e.nodeId})`:""} \u72B6\u6001 ${String(e.payload?.lifecycle)} \u4F46\u65E0 _parentNode/_refNode\uFF08rootEl \u53EA\u5C5E\u4E8E\u6839\u7EC4\u4EF6\uFF09\u2014\u2014\u6302\u8F7D\u4FE1\u606F\u65AD\u88C2\uFF0C\u6E32\u67D3\u88AB\u8DF3\u8FC7\uFF0C\u72B6\u6001\u66F4\u65B0\u5C06\u4E22\u5931`)}))}function on(e,n,t){if(n==null||n.length===0)return;let o=Array.from(e.childNodes);if(!n.some(i=>{if(i==null||typeof i!="object")return!1;if(Array.isArray(i))return!0;let s=i.type;return s===Q||s===q}))for(let i=0;i<n.length;i++){let s=n[i];if(s==null||typeof s=="boolean"){let l=o[i];(!l||l.nodeType!==8||!l.nodeValue?.includes("type=hole"))&&t(`[audit] \u5360\u4F4D\u9519\u4F4D\uFF1A\u4F4D\u7F6E ${i} \u671F\u671B\u6CE8\u91CA(wf-hole)\uFF0C\u5B9E\u9645 ${l?.nodeName??"null"}\uFF08${e.nodeName}\uFF09`)}else if(typeof s=="string"||typeof s=="number"){let l=o[i];l&&l.nodeType!==3&&t(`[audit] \u6587\u672C\u9519\u4F4D\uFF1A\u4F4D\u7F6E ${i} \u671F\u671B\u6587\u672C\u8282\u70B9\uFF0C\u5B9E\u9645 ${l.nodeName}\uFF08${e.nodeName}\uFF09`)}}}function Te(e,n,t){To[O(n)](e,n,t)}var To={hole:()=>{},text:()=>{},arr:_o,portal:()=>{},frag:ko,comp:Po,native:So};function _o(e,n,t){let o=n;on(e,o,t);for(let r of o)if(r!=null&&typeof r=="object"&&Array.isArray(r))for(let i of r)Te(e,i,t);else r!=null&&typeof r=="object"&&!Array.isArray(r)&&te(r)&&on(e,S(r.props?.children),t)}function ko(e,n,t){on(e,S(n.props?.children),t)}function Po(e,n,t){let o=n,r=o._refNode;r&&r.parentNode!==e&&t(`[audit] \u7EC4\u4EF6\u951A\u70B9\u9519\u4F4D\uFF1A${R(o.type)} _refNode \u4E0D\u5728\u7236\u8282\u70B9\u5185`),o._child!=null&&Te(e,o._child,t)}function So(e,n,t){let o=n;if(gt(o.type))return;let r=o.el??o._refNode;if(r&&r.nodeType===1&&r.tagName.toLowerCase()!==String(o.type)&&t(`[audit] \u5143\u7D20\u7C7B\u578B\u9519\u4F4D\uFF1A\u671F\u671B <${String(o.type)}>\uFF0C\u5B9E\u9645 ${r.tagName}`),r&&r.nodeType===1&&!("innerHTML"in(o.props??{}))){on(r,S(o.props?.children),t);for(let i of S(o.props?.children))i!=null&&typeof i=="object"&&!Array.isArray(i)&&k(i)&&Te(r,i,t)}}function Ro(e,n){if(e===n)return!0;let t=Object.keys(e),o=Object.keys(n);if(t.length!==o.length)return!1;for(let r of t)if(e[r]!==n[r])return!1;return!0}async function Ao(e,n,t,o){let r=e;r._id||(o?.reuse?._id?r._id=o.reuse._id:r._id=t.nextId(),t.idRegistry.set(r._id,r)),o?.reuse&&(o.reuse._parentNode&&(r._parentNode=o.reuse._parentNode),o.reuse._refNode&&(r._refNode=o.reuse._refNode),o.reuse._ctxVersion!=null&&(r._ctxVersion=o.reuse._ctxVersion));let i=Object.create(n);i.ui=Object.create(n.ui);let s=i.ui;if(s._selfId=r._id??null,s._selfVNode=r,s.render=function(l){let d=n.ui;return l==null&&r._id?d.render([r._id]):d.render(l)},typeof r._render!="function"&&k(o?.reuse)&&typeof o.reuse._render=="function"&&(r._render=o.reuse._render),typeof r._render!="function"){xn(n,!0);let l;try{l=await r.type(r.props??{},i)}finally{xn(n,!1)}if(typeof l!="function")throw new Error(`Component ${R(e.type)} must return a render function. Use (init_props, ctx) => (props) => VNode pattern.`);r._render=l}return{renderFn:r._render,childCtx:i}}function Pn(e){return!!e&&typeof e.then=="function"}function J(e,n,t,o,r){return Io[O(e)](e,n,t,o,r)}function Sn(e,n){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&e.type===n.type?e:null}var Io={hole:e=>e,text:e=>e,arr:Lo,comp:Mo,frag:Ho,native:wt,portal:wt};function Lo(e,n,t,o,r){let i=e;E("build")&&_("build","debug","",`array in kids=${z(i)}`);for(let a of i)if(a!=null&&typeof a=="object"&&!Array.isArray(a)&&a._lifecycle==="disposed"){let c=a;P({session:"",machine:"audit",nodeId:c._id??null,component:R(c.type),from:"disposed",event:"CONTRACT_VIOLATION",to:"new-tree",level:"error",ts:Date.now()}),ce()&&console.error(`[vdom2/audit] \u4E24\u9636\u6BB5\u5951\u7EA6\u8FDD\u53CD\uFF1A\u7EC4\u4EF6 ${R(c.type)} \u7684 renderFn \u8FD4\u56DE\u4E86 disposed \u65E7 vnode${c._id?`(${c._id})`:""}\u2014\u2014\u590D\u7528\u65E7\u6811\u5BF9\u8C61\uFF08\u5E94\u4E3A\u6BCF\u6B21\u6E32\u67D3\u751F\u6210\u65B0 vnode\uFF09\u3002\u540C\u4E00\u5BF9\u8C61\u65E2\u662F\u65E7\u6811\u53C8\u88AB dispose \u2192 diff \u81EA dispose \u2192 \u5361\u7247\u9519\u4F4D/\u6D88\u5931\uFF08demo \u641C\u7D22\u6062\u590D\u4E8B\u6545\uFF09`);break}for(let a=0;a<i.length;a++){let c=i[a];if(c!=null&&typeof c=="object"&&!Array.isArray(c)){let f=c;f.key!==null&&(f.key=String(f.key))}}let s=Array.isArray(t)?t:[],l=new Map;for(let a of s)a!=null&&typeof a=="object"&&!Array.isArray(a)&&a.key!=null&&l.set(a.key,a);let d=i.map((a,c)=>{let f=null;return a!=null&&typeof a=="object"&&!Array.isArray(a)&&a.key!=null&&(f=l.get(a.key)??null),f==null&&(f=s[c]??null),J(a,n,f,o,r)});E("build")&&_("build","debug","",`array out kids=${z(i)}`);let u=!1;for(let a=0;a<d.length;a++)if(Pn(d[a])){u=!0;break}return u?Promise.all(d).then(()=>i):i}function Mo(e,n,t,o,r){let i=e,s=o??n.__registry??ye(),l=Sn(t,i);i._id||(i._id=l?._id??s.nextId(),s.idRegistry.set(i._id,i)),l&&(l._parentNode&&(i._parentNode=l._parentNode),l._refNode&&(i._refNode=l._refNode),l._ctxVersion!=null&&(i._ctxVersion=l._ctxVersion),k(i)&&k(l)&&typeof l._render=="function"&&(i._render=l._render));let d=Ro(l?.props??{},i.props??{}),u=en(n),a=(l?._ctxVersion??-1)===u;if(!r?.force&&d&&a&&Ee(l)&&typeof i._render=="function"){let c=l;return i._lifecycle=ee(i._lifecycle,"PRUNE",Z(i)),i._child=c._child,i._ctxVersion=c._ctxVersion,E("build")&&_("build","debug","",`prune comp=${ve(i)} propsSame=${d} verSame=${a}`),i}return i._lifecycle=ee(i._lifecycle,"BUILD_START",Z(i)),E("build")&&_("build","debug","",`mount comp=${ve(i)} propsSame=${d} verSame=${a} force=${!!r?.force}`),(async()=>{let{childCtx:c}=await Ao(i,n,s,{reuse:l??null}),f=await J(await i._render(i.props),c,l?._child,s,r);return i._child=f??null,i._ctxVersion=u,i._lifecycle=ee(i._lifecycle,"BUILD_DONE",Z(i)),i})()}function Ho(e,n,t,o,r){let i=e,s=o??n.__registry??ye(),l=Sn(t,i);E("build")&&_("build","debug","",`fragment kids=${z(S(i.props?.children))}`);let d=J(i.props?.children??null,n,l?._child??l?.props?.children,s,r);return Pn(d)?d.then(u=>(i._child=u??null,i._lifecycle=ee(i._lifecycle,"BUILD_DONE",Z(i)),i)):(i._child=d??null,i._lifecycle=ee(i._lifecycle,"BUILD_DONE",Z(i)),i)}function wt(e,n,t,o,r){let i=e;if(typeof i.type!="string"&&typeof i.type!="symbol")return i;let s=o??n.__registry??ye(),l=Sn(t,i);E("build")&&_("build","trace","",`native <${String(i.type)}> kids=${z(S(i.props?.children))}`);let d=J(i.props?.children??null,n,l?.props?.children,s,r);return Pn(d)?d.then(u=>(i._child=u??null,i._lifecycle=ee(i._lifecycle,"BUILD_DONE",Z(i)),i)):(i._child=d??null,i._lifecycle=ee(i._lifecycle,"BUILD_DONE",Z(i)),i)}var Oo=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);function _e(e,n){return ue(e,n)}function U(e,n,t,o=null,r=null,i=null){let s=n?.browser??t;if(!s)throw new Error("[vdom2] renderValue requires browser env (ctx.browser)");return qo[O(e)](e,n,s,o,r,i)}function Uo(e,n,t){return null}function $o(e,n,t){return t.createTextNode(String(e))}function Rn(e,n,t,o,r){if(e==null||typeof e=="boolean")return _e(t,e);let i=U(e,n,t,String(o),null,r);return i??_e(t,null)}function Do(e,n,t,o=null,r=null,i=null){let s=e,l=t.createDocumentFragment();if(!l)return null;E("render")&&_("render","debug","",`array kids=${z(s)} fid=${i??"-"} key=${o??"-"}`);let d=t.createComment(F({type:"fragment-start",key:o,id:r,fid:i})),u=t.createComment(F({type:"fragment-end",key:o,id:r,fid:i}));d&&l.appendChild(d);for(let a=0;a<s.length;a++){let c=s[a],f=i!=null?`${i}-${a}`:String(a),p=Rn(c,n,t,a,f);p!=null&&l.appendChild(p)}return u&&l.appendChild(u),l}function jo(e,n,t){let o=e,r=o,i=t.bodyElement();if(!i)return null;let s=i.querySelector("#__wf_portal");s||(s=t.createElement("div"),s&&(s.id="__wf_portal",i.appendChild(s)));let l=t.createElement("div");if(l){l.setAttribute("data-portal",String(o.props?.portalKey??"wf"));let d=U(o.props?.children??null,n,t);d!=null&&l.appendChild(d),s&&s.appendChild(l),r._remoteEl=l;let u=S(o.props?.children);for(let a of u)a!=null&&typeof a=="object"&&!Array.isArray(a)&&(a._parentVNode=o)}return null}function Wo(e,n,t,o=null,r=null,i=null){let s=e,l=s,d=t.createDocumentFragment();if(!d)return null;let u=S(s.props?.children);E("render")&&_("render","debug","",`fragment kids=${z(u)} fid=${i??"-"}`);let a=t.createComment(F({type:"fragment-start",key:o,id:r,fid:i})),c=t.createComment(F({type:"fragment-end",key:o,id:r,fid:i}));a&&d.appendChild(a),l._refNode=a;for(let f=0;f<u.length;f++){let p=u[f],m=i!=null?`${i}-${f}`:String(f),g=Rn(p,n,t,f,m);g!=null&&d.appendChild(g)}return c&&d.appendChild(c),d}function Fo(e,n,t){let o=e,r=o._lifecycle??(typeof o._render=="function"?"built":"fresh");return Bo[r](o,n,t)}var Bo={fresh:(e,n,t)=>{throw new Error(`[vdom2] component ${R(e.type)} not built (missing _render) \u2014 buildVNode must run before renderValue`)},building:(e,n,t)=>{throw new Error(`[vdom2] component ${R(e.type)} building in render \u2014 buildVNode must await before renderValue`)},disposed:(e,n,t)=>(console.warn(`[vdom2] disposed \u7EC4\u4EF6 ${R(e.type)} \u5728\u6E32\u67D3\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\u2014\u2014\u7236\u6811\u91CD\u5EFA\u4E2D\uFF08\u5360\u4F4D\u515C\u5E95\uFF09`),_e(t,null)),built:bt,pruned:bt};function bt(e,n,t){let o=e._child;if(o==null)return e._child=null,null;e._child=o,e._outputChild=o,typeof o=="object"&&!Array.isArray(o)&&(o._parentVNode=e);let r=U(o,n,t);if(r){if(e._refNode=r.nodeType===11?r.firstChild:r,e._id)if(r.nodeType===11)for(let i of Array.from(r.childNodes))i.nodeType===1&&i.setAttribute("data-wf-id",e._id);else r.nodeType===1&&r.setAttribute("data-wf-id",e._id);if(e.key!=null)if(r.nodeType===11)for(let i of Array.from(r.childNodes))i.nodeType===1&&i.setAttribute("data-wf-key",e.key);else r.nodeType===1&&r.setAttribute("data-wf-key",e.key)}return r}function Ko(e,n,t,o,r){let i=e,s=i,l=i.type,d=Oo.has(l)?t.createElementNS("http://www.w3.org/2000/svg",l):t.createElement(l);if(!d)return null;s.el=d,s._refNode=d,E("render")&&_("render","trace","",`native <${l}> key=${i.key??"-"} kids=${z(S(i.props?.children))}`),i.key!=null&&d.setAttribute("data-wf-key",i.key);let u=null;for(let[a,c]of Object.entries(i.props??{}))if(!(a==="children"||a==="key")){if(a==="value"&&d instanceof HTMLSelectElement){u=c;continue}re(d,a,c)}if(!("innerHTML"in(i.props??{}))){let a=S(i.props?.children);for(let c=0;c<a.length;c++){let f=a[c],p=r!=null?`${r}-${c}`:String(c),m=Rn(f,n,t,c,p);if(m!=null&&(d.appendChild(m),f&&typeof f=="object"&&!Array.isArray(f)&&typeof f.type=="function")){let g=f;g._parentNode||(g._parentNode=d)}}E("render")&&_("render","trace","",`native <${l}> out=${de(d)}`)}return u!==null&&(d.value=String(u)),d}var qo={hole:Uo,text:$o,arr:Do,portal:jo,frag:Wo,comp:Fo,native:Ko};function fe(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=U(e.newInput,r,r.browser??x());if(i==null)return null;if(t?.parentNode){let s=Ie(o,t,n,r);return s&&s.parentNode===n?n.insertBefore(i,s):n.appendChild(i),i}return n.appendChild(i),i}function Go(e){return Ie(e.oldInput,e.oldNode,e.parent,e.ctx),null}function zo(e){let n=e.oldNode;if(n?.nodeType===8){let t=_e(e.ctx.browser??x(),e.newInput);return t&&n.nodeValue!==t.nodeValue&&(n.nodeValue=t.nodeValue),n}return null}function ke(e){let{parent:n,oldNode:t,ctx:o}=e,r=U(e.newInput,o,o.browser??x());return r==null?null:(t?.parentNode?t.parentNode.replaceChild(r,t):t?n.insertBefore(r,t):n.appendChild(r),r)}function Yo(e){let{parent:n,oldNode:t,oldInput:o}=e,r=String(e.newInput);if(String(o)!==r){if(t&&t.nodeType===3)return t.nodeValue=r,t;let i=n.ownerDocument.createTextNode(r);return t?.parentNode?t.parentNode.replaceChild(i,t):n.appendChild(i),i}return t}function Jo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput,s=o&&typeof o=="object"&&!Array.isArray(o)?o:null,l=i.type;if(t&&t.nodeType===1&&(s?.type??null)===l&&ze(i)){let d=t;return i.el=d,i._refNode=d,Vt(d,s?.props??{},i.props??{}),"innerHTML"in(i.props??{})||Le(d,s?._child??s?.props?.children??null,i._child??i.props?.children??null,r),d}return fe(e)}function Xo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput,s=o&&typeof o=="object"&&!Array.isArray(o)?o:null,l=te(s)?A(s,t):null,d=An(n,s??o,i,r,l);return t?.parentNode?t:d[0]??null}function Qo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e,i=e.newInput;if(!k(i)||typeof i._render!="function")throw new Error(`[vdom2] component ${R(i.type)} not built in diff \u2014 buildVNode must run before patchValue`);let s=o&&typeof o=="object"&&!Array.isArray(o)?o:null;if(s?.type!=null&&s.type!==i.type)return fe(e);let l=s?.type===i.type;if(!r.force&&s&&l&&Ee(s)&&i._child===s._child)return t;s?.type===i.type&&s._id&&(i._id=s._id,r.registry.idRegistry.set(i._id,i)),i._parentNode=n,t&&(i._refNode=t);let d=i._child;if(d===null){i._outputChild=null,i._refNode=null;let a=t?.parentNode!=null,c=Ie(s?._child??null,t,n,r);s&&(s._child=null);let f=_e(r.browser??x(),null);return a&&f?(c&&c.parentNode===n?n.insertBefore(f,c):n.appendChild(f),f):ne(n,t,s?._child,null,r)}i._outputChild=d;let u=ne(n,t,s?._child,d,r);return u&&(i._refNode=u),u}function Zo(e){let{parent:n,oldNode:t,oldInput:o,ctx:r}=e;if(o===e.newInput&&t?.parentNode)return t;let i=n.ownerDocument.createDocumentFragment(),s=Le(n,o,e.newInput,r,t?[t]:null);for(let l of s)l&&i.appendChild(l);return t?.parentNode?i.contains(t)?n.appendChild(i):t.parentNode.replaceChild(i,t):n.appendChild(i),i}function er(e){let{ctx:n,oldInput:t}=e,o=e.newInput,r=t&&typeof t=="object"&&!Array.isArray(t)?t:null;if(G(r)&&G(o)){let i=r._remoteEl;if(i){let s=r._child??r.props?.children??null,l=o._child??o.props?.children??null;Le(i,s,l,n)}return o._remoteEl=r._remoteEl,null}return fe(e)}function Ne(e){return{text:fe,native:fe,frag:fe,comp:fe,arr:fe,hole:Go,portal:fe,...e}}var nr={text:Ne({text:Yo}),hole:Ne({text:ke,native:ke,frag:ke,comp:ke,arr:ke,portal:ke,hole:zo}),native:Ne({native:Jo}),frag:Ne({frag:Xo}),comp:Ne({comp:Qo}),arr:Ne({arr:Zo}),portal:Ne({portal:er})};function Ct(e){let n=O(e.oldInput),t=O(e.newInput);return P({session:"",machine:"x2y",nodeId:null,component:null,from:n,event:"X2Y",to:t,level:"trace",ts:Date.now()}),nr[n][t](e)}function ie(e,n){if(n&&typeof e.type=="function"&&e._id){try{H(e,n)}catch(t){console.error("[weifuwu] ref cleanup error",t)}mt(n,e._id)}}function Ue(e){if(e==null||typeof e!="object"||Array.isArray(e))return null;let n=e;return G(n)?typeof n.props?.portalKey=="string"?n.props.portalKey:null:n.key}function In(e,n){if(n&&e&&typeof e=="object"&&!Array.isArray(e)){let t=A(e,n);if(t&&t.length>1)return t}return[n]}function rn(e,n){let t=S(e.props?.children);for(let o of t){if(o==null||typeof o!="object"||Array.isArray(o))continue;let r=o;tr[O(r)](r,n)}}var tr={comp:(e,n)=>{ie(e,n)},frag:(e,n)=>{rn(e,n)},native:(e,n)=>{rn(e,n)},portal:(e,n)=>{rn(e,n)},arr:()=>{},text:()=>{},hole:()=>{}};function Ie(e,n,t,o){return or[O(e)](e,n,t,o)}var or={arr:(e,n,t,o)=>{let r=A(e,n);if(r&&r.length){let i=(r[r.length-1]??n)?.nextSibling??null;for(let s of r)s.parentNode&&s.parentNode.removeChild(s);return i&&i.parentNode===t?i:null}return Me(e,n,t,o)},frag:(e,n,t,o)=>{let r=e,s=A(r,n)??[],l=(s[s.length-1]??n)?.nextSibling??null;for(let d of s)d.parentNode&&d.parentNode.removeChild(d);return rn(r,o.registry),l&&l.parentNode===t?l:null},portal:(e,n,t,o)=>{let r=e,i=r._remoteEl;try{H(r.props?.children,o.registry)}catch(s){console.error("[weifuwu] portal ref cleanup error",s)}return i?.parentNode?.removeChild(i),null},comp:(e,n,t,o)=>{let r=e,i=A(r,n);if(ie(r,o.registry),i&&i.length>1){let s=(i[i.length-1]??n)?.nextSibling??null;for(let l of i)l.parentNode&&l.parentNode.removeChild(l);return s&&s.parentNode===t?s:null}return Me(e,n,t,o)},native:(e,n,t,o)=>{try{H(e,o.registry)}catch(r){console.error("[weifuwu] ref cleanup error",r)}return Me(e,n,t,o)},text:(e,n,t,o)=>Me(e,n,t,o),hole:(e,n,t,o)=>Me(e,n,t,o)};function Me(e,n,t,o){let r=n?.nextSibling??null;return n?.parentNode&&n.parentNode.removeChild(n),r&&r.parentNode===t?r:null}function ne(e,n,t,o,r){return Ct({parent:e,oldNode:n,oldInput:t,newInput:o,ctx:r})}var rr={event:(e,n,t,o)=>{let{type:r,capture:i}=Tn(n);typeof t=="function"&&e.removeEventListener(r,t,i?{capture:!0}:{}),o!=null&&o!==!1&&(typeof o!="function"?console.warn(`[weifuwu] event prop ${n} expects a function, got ${typeof o} \u2014 ignored`):e.addEventListener(r,o,i?{capture:!0}:{}))},class:(e,n,t,o)=>{o==null||o===!1?e.removeAttribute("class"):(e.className="",re(e,n,o))},ref:(e,n,t,o)=>{if(o==null||o===!1){if(typeof t=="function")try{t(null)}catch(r){console.error("[weifuwu] ref cleanup error",r)}}else re(e,n,o)},value:(e,n,t,o)=>{o==null||o===!1?e.value="":re(e,n,o)},indeterminate:(e,n,t,o)=>{o==null||o===!1?e.indeterminate=!1:re(e,n,o)},enumerated:He,style:He,innerHTML:He,aria:He,default:He};function He(e,n,t,o){if(o==null||o===!1){e.removeAttribute(n);try{delete e[n]}catch{}}else re(e,n,o)}function Vt(e,n,t){let o=Object.keys(n),r=Object.keys(t);if(o.length===r.length){let s=!0;for(let l=0;l<o.length;l++)if(o[l]!==r[l]||n[o[l]]!==t[o[l]]){s=!1;break}if(s)return}let i=new Set([...o,...r]);for(let s of i){if(s==="children"||s==="key")continue;let l=n[s],d=t[s];l!==d&&rr[kn(s)](e,s,l,d)}}function An(e,n,t,o,r){let i=Array.isArray(n)?n:n?._child??n?.props?.children??null,s=Array.isArray(t)?t:t?._child??t?.props?.children??null;return Le(e,i,s,o,r)}function Le(e,n,t,o,r,i){let s=S(n),l=S(t),d=r??Array.from(e.childNodes);E("diff")&&_("diff","debug","",`patchChildren parent=${Y(e)} old=${z(s)} new=${z(l)} dom=${de(e)}`);let u=l.some(p=>Array.isArray(p))||s.some(p=>Array.isArray(p)),a=u?"unkeyed":En(l);if(P({session:"",machine:"keys",nodeId:null,component:null,from:u?"unkeyed":En(l),event:"SELECT",to:a,payload:()=>({len:l.length}),level:"trace",ts:Date.now()}),ce()&&s.length!==l.length)for(let p=0;p<l.length;p++){let m=l[p];m!=null&&typeof m=="object"&&!Array.isArray(m)&&k(m)&&m.key==null&&console.error(`[vdom2/audit] \u52A8\u6001\u6570\u7EC4\u4F4D\u7F6E ${p} \u7684\u7EC4\u4EF6\u7F3A\u5C11 key\u2014\u2014\u5217\u8868\u589E\u5220/\u91CD\u6392\u4F1A\u9519\u4F4D\u7EC4\u4EF6\u5B9E\u4F8B\u72B6\u6001\u3002\u8BF7\u63D0\u4F9B\u4E1A\u52A1\u8EAB\u4EFD key\uFF08\u5982 key={item.id}\uFF09\uFF1B\u65E0\u72B6\u6001 native \u9879\u8C41\u514D\u3002`)}let c=r&&r.length?r[r.length-1]:null;a==="mixed"&&(sn(l),sn(s));let f=(()=>{let p=d;p.length>=2&&p[0]?.nodeType===8&&p[0].nodeValue?.includes("fragment-start")&&p[p.length-1]?.nodeType===8&&p[p.length-1].nodeValue?.includes("fragment-end")&&(p=p.slice(1,-1));let m=[],g=0;for(let h=0;h<s.length;h++){let w=s[h];if(Array.isArray(w)){let v=p[g]??null;m.push(v);let b=A(w,v);g+=b?.length??1;continue}if(w==null||typeof w=="boolean"||typeof w=="string"||typeof w=="number"){m.push(p[g]??null),g++;continue}let y=w;if(G(y)){m.push(y._remoteEl??null);continue}if(m.push(y._refNode??p[g]??null),typeof y.type=="function"||te(y)){let v=A(y,y._refNode??p[g]??null);g+=v?.length??1}else g++}return m})();return xr[a]({parent:e,oldChildren:s,newChildren:l,oldNodes:f,ctx:o,arrEnd:c,anchorOut:i})}function Oe(e){return e==null||typeof e=="boolean"?"hole":Array.isArray(e)||e&&typeof e=="object"&&te(e)?"multi":"real"}function ir(e){let{parent:n,oldC:t,oldNode:o,oldNodes:r,i,ctx:s,out:l,pushA:d}=e;if(Array.isArray(t)){E("diff")&&_("diff","trace","",`remove-arr-item i=${i} range=[${(A(t,r[i])??[]).map(Y).join(" | ")}] before=${de(n)}`);let u=A(t,o);for(let a of u??[])a.parentNode?.removeChild(a);E("diff")&&_("diff","trace","",`remove-arr-item after=${de(n)}`);for(let a of t)a!=null&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="function"&&ie(a,s.registry)}else if(t&&typeof t=="object"&&!Array.isArray(t)){if(typeof t.type=="function")ie(t,s.registry);else try{H(t,s.registry)}catch(u){console.error("[weifuwu] ref cleanup error",u)}o?.parentNode&&o.parentNode.removeChild(o)}else o?.parentNode&&o.parentNode.removeChild(o);l.push(null),d(null)}function sr(e){let{parent:n,newC:t,oldNode:o,i:r,oldNodes:i,out:s,pushA:l,ctx:d}=e,u=ue(d.browser??x(),t);if(o?.nodeType===8){u&&o.nodeValue!==u.nodeValue&&(o.nodeValue=u.nodeValue),s.push(o),l(o);return}if(u&&o?.parentNode)o.parentNode.replaceChild(u,o);else if(u){let a=null;for(let c=r+1;c<i.length;c++){let f=i[c];if(f&&f.parentNode===n){a=f;break}}if(!a){let c=null;for(let f=s.length-1;f>=0;f--)if(s[f]){c=s[f];break}c&&c.parentNode===n&&(a=c.nextSibling)}a&&a.parentNode===n?n.insertBefore(u,a):n.appendChild(u),s.push(u),l(u)}else s.push(u),l(u)}function xt(e){let{parent:n,newC:t,oldNode:o,i:r,oldNodes:i,out:s,pushA:l,ctx:d}=e,u=U(t,d,d.browser??x(),String(r));if(u==null){s.push(null),l(null);return}if(o&&o.nodeType===8&&o.nodeValue?.includes("type=hole")){P({session:"",machine:"pos",nodeId:null,component:null,from:"hole",event:"HOLE_FILL",to:"real",payload:()=>({i:r,replaced:Y(o)}),level:"trace",ts:Date.now()}),o.parentNode?.replaceChild(u,o),s.push(u),l(u);return}let a=null;for(let c=r+1;c<i.length;c++){let f=i[c];if(f&&f.parentNode===n){a=f;break}}if(a==null){let c=null;for(let f=s.length-1;f>=0;f--)if(s[f]){c=s[f];break}if(c&&c.parentNode===n)a=c.nextSibling;else{let f=i[i.length-1];f&&f.parentNode===n&&(a=f.nextSibling)}}a&&a.parentNode===n?n.insertBefore(u,a):n.appendChild(u),P({session:"",machine:"pos",nodeId:null,component:null,from:"hole",event:"INSERT",to:"real",payload:()=>({i:r,insertedBefore:a?Y(a):"END",node:Y(u)}),level:"trace",ts:Date.now()}),s.push(u),l(u)}function lr(e){let{parent:n,oldC:t,newC:o,oldNode:r,out:i,pushA:s,ctx:l}=e;if(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.type=="function"){let u=_t(n,t,r,o,l);i.push(u),s(u);return}let d=kt(n,t,r,o,l);i.push(d),s(d)}function ar(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,out:s,pushA:l,ctx:d}=e,u=d.browser??x(),a=U(o,d,u,String(i));if(a==null){s.push(null),l(null);return}let c=t&&typeof t=="object"?A(t,r):null;if(c&&c.length>1){let p=(c[c.length-1]??r)?.nextSibling??null;for(let m of c)m.parentNode&&m.parentNode.removeChild(m);if(t&&typeof t=="object"&&!Array.isArray(t))if(typeof t.type=="function")ie(t,d.registry);else try{H(t,d.registry)}catch(m){console.error("[weifuwu] ref cleanup error",m)}p&&p.parentNode===n?n.insertBefore(a,p):n.appendChild(a)}else r?.parentNode?r.parentNode.replaceChild(a,r):n.appendChild(a);let f=a.nodeType===11?Array.from(a.childNodes):[a];s.push(...f),l(f[0]??a)}function dr(e){let{parent:n,oldC:t,newC:o,oldNode:r,out:i,pushA:s,ctx:l}=e,d=Tt(n,t,r,o,l);i.push(d),s(d)}function ur(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,oldNodes:s,out:l,pushA:d,ctx:u}=e,a=u.browser??x(),c=A(t,r);E("diff")&&_("diff","debug","",`multi-remove i=${i} range=${c?c.map(Y).join(" | "):"null"}`);for(let m of c??[])m.parentNode?.removeChild(m);for(let m of S(t?.props?.children))m!=null&&typeof m=="object"&&!Array.isArray(m)&&typeof m.type=="function"&&ie(m,u.registry);let f=U(o,u,a,String(i));if(f==null){l.push(null),d(null);return}let p=s[i+1]??null;p?.parentNode?p.parentNode.insertBefore(f,p):n.appendChild(f),l.push(f),d(f)}function cr(e){let{parent:n,oldC:t,newC:o,oldNode:r,oldNodes:i,i:s,out:l,pushA:d,ctx:u}=e,a=A(t,r),c=An(n,t,o,u,a);l.push(...c),d(i[s]??c[0]??null)}function fr(e){let{parent:n,oldC:t,newC:o,oldNode:r,i,out:s,pushA:l,ctx:d}=e;if(o&&typeof o=="object"&&!Array.isArray(o)&&typeof o.type=="function"&&o._lifecycle==="disposed"){let c=St(n,r,d,R(o.type));s.push(c),l(c);return}let u=ne(n,r,t,o,d);E("diff")&&_("diff","trace","",`after-patch i=${i} new=${ve(o)} node=${Y(u)} dom=${de(n)}`);let a=In(o,u);s.push(...a),l(a[0]??u??null)}function Tt(e,n,t,o,r){let i=ue(r.browser??x(),o),s=A(n,t),l=((s??[])[s?.length?s.length-1:0]??t)?.nextSibling??null;for(let d of s??[])d.parentNode?.removeChild(d);for(let d of S(n?.props?.children))d!=null&&typeof d=="object"&&!Array.isArray(d)&&typeof d.type=="function"&&ie(d,r.registry);return i&&l&&l.parentNode===e?e.insertBefore(i,l):i&&e.appendChild(i),i}function _t(e,n,t,o,r){let i=ue(r.browser??x(),o),s=Ie(n,t,e,r);return i&&s?e.insertBefore(i,s):i&&e.appendChild(i),i}function kt(e,n,t,o,r){let i=ue(r.browser??x(),o);if(n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")ie(n,r.registry);else try{H(n,r.registry)}catch(s){console.error("[weifuwu] ref cleanup error",s)}return i&&t?.parentNode?t.parentNode.replaceChild(i,t):i&&e.appendChild(i),i}var pr={hole:{hole:sr,real:xt,multi:xt},real:{hole:lr,real:fr,multi:ar},multi:{hole:dr,real:ur,multi:cr}};function mr(e){let{parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,anchorOut:s}=e,l=Math.max(t.length,o.length),d=[],u=a=>{s&&s.push(a)};for(let a=0;a<l;a++){let c=a<t.length?t[a]:null,f=a<o.length?o[a]:null;if(a>=o.length){ir({parent:n,oldC:c,newC:f,oldNode:r[a],i:a,oldNodes:r,newChildren:o,out:d,pushA:u,ctx:i});continue}if(c!=null&&typeof c=="object"&&!Array.isArray(c)&&f!=null&&typeof f=="object"&&!Array.isArray(f)&&f===c&&Ee(c)){d.push(r[a]),u(r[a]);continue}let p=pr[Oe(c)][Oe(f)];P({session:"",machine:"pos",nodeId:null,component:null,from:Oe(c),event:p.name,to:Oe(f),payload:()=>({i:a}),level:"trace",ts:Date.now()}),p({parent:n,oldC:c,newC:f,oldNode:r[a],i:a,oldNodes:r,newChildren:o,out:d,pushA:u,ctx:i})}return d}function Et(e){let{parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,anchorOut:s,arrEnd:l}=e,d=new Map;t.forEach((p,m)=>{let g=Ue(p);g!==null&&p&&typeof p=="object"&&!Array.isArray(p)&&d.set(g,{vnode:p,nodes:[r[m]??null].filter(Boolean),index:m})});let u=[],a=new Set,c=p=>{s&&s.push(p)},f=null;return o.forEach((p,m)=>{let g=Ue(p),h=p;if(g!==null&&d.has(g)){let w=d.get(g),y=w.nodes[0]??null;if(a.add(g),h&&typeof h=="object"&&typeof h.type=="function"&&h._lifecycle==="disposed"){let D=St(n,y,i,R(h.type));u.push(D),c(D),D&&(f=D);return}let v=ne(n,y,w.vnode,h,i),b=In(h,v),I=b[0]??v,B=b[b.length-1]??v;if(I&&I.parentNode===n&&f&&I.previousSibling!==f){E("diff")&&_("diff","debug","",`keyed-correct i=${m} k=${g} move=[${b.map(Y).join(" | ")}] after=${Y(f)} before=${de(n)}`);let D=f.nextSibling;for(let C of b)C&&C.parentNode===n&&n.insertBefore(C,D);E("diff")&&_("diff","debug","",`keyed-correct after=${de(n)}`)}u.push(...b),c(b[0]??v??null),B&&(f=B)}else{let w={current:f};wr[Nr(p)]({parent:n,oldChildren:t,newChildren:o,oldNodes:r,ctx:i,out:u,pushA:c,arrEnd:l,c:p,i:m},w),f=w.current}}),t.forEach((p,m)=>{gr[yr(Ue(p),a)](n,p,m,r,i,o.length)}),u}function yr(e,n){return e===null?"unkeyed":n.has(e)?"moved":"stale-keyed"}var gr={moved:()=>{},"stale-keyed":hr,unkeyed:vr};function hr(e,n,t,o,r){let i=n&&typeof n=="object"&&!Array.isArray(n)?A(n,o[t]):null;if(E("diff")&&_("diff","trace","",`keyed-delete i=${t} k=${Ue(n)} range=${i?.length??0} oldNode=${Y(o[t])}`),n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")ie(n,r.registry);else try{H(n,r.registry)}catch(s){console.error("[weifuwu] ref cleanup error",s)}Pt(i,o[t])}function vr(e,n,t,o,r,i){let s=o[t];if(s?.nodeType===8&&s.nodeValue?.includes("type=hole")&&t<i)return;if(n&&typeof n=="object"&&!Array.isArray(n))if(typeof n.type=="function")ie(n,r.registry);else try{H(n,r.registry)}catch(u){console.error("[weifuwu] ref cleanup error",u)}let d=n&&typeof n=="object"&&!Array.isArray(n)?A(n,s):null;Pt(d,s)}function Pt(e,n){if(e&&e.length>1)for(let t of e)t.parentNode&&t.parentNode.removeChild(t);else n?.parentNode&&n.parentNode.removeChild(n)}function Nr(e){return e==null||typeof e=="boolean"?"hole":e&&typeof e=="object"&&!Array.isArray(e)&&G(e)?"portal":"real"}var wr={hole:br,portal:Cr,real:Vr};function br(e,n){let{parent:t,oldChildren:o,oldNodes:r,ctx:i,out:s,pushA:l,c:d,i:u}=e,a=o[u]??null,c=r[u]??null,f=Oe(a);if(f==="hole"){let m=ue(i.browser??x(),d);c?.nodeType===8?(m&&c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue),s.push(c),l(c),c&&(n.current=c)):(m&&c?.parentNode?c.parentNode.replaceChild(m,c):m&&t.appendChild(m),s.push(m),l(m),m&&(n.current=m));return}let p=f==="multi"?Tt(t,a,c,d,i):a&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="function"?_t(t,a,c,d,i):kt(t,a,c,d,i);s.push(p),l(p),p&&(n.current=p)}function Cr(e,n){let{parent:t,oldChildren:o,oldNodes:r,ctx:i,out:s,pushA:l,c:d,i:u}=e,a=d,c=o[u]??null,f=ne(t,r[u]??null,c,a,i),p=In(a,f);s.push(...p),l(p[0]??f??null);let m=p[p.length-1]??f;m&&(n.current=m)}function Vr(e,n){let{parent:t,oldNodes:o,ctx:r,out:i,pushA:s,arrEnd:l,c:d,i:u}=e,c=U(d,r,r.browser??x());if(i.push(c),s(c??null),c!=null){let f=o[u];f&&f.nodeType===8&&f.nodeValue?.includes("type=hole")?(f.parentNode?.replaceChild(c,f),n.current=c):(n.current?t.insertBefore(c,n.current.nextSibling):l&&l.parentNode===t?t.insertBefore(c,l):t.insertBefore(c,t.firstChild),n.current=c)}}function sn(e){for(let n=0;n<e.length;n++){let t=e[n];t&&typeof t=="object"&&!Array.isArray(t)&&Ue(t)===null&&(t.key=`pos:${n}`)}}function St(e,n,t,o){ce()?console.error(`[vdom2/audit] I1 \u8FDD\u53CD\uFF1Adiff \u6536\u5230 disposed \u7EC4\u4EF6 ${o}\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\uFF08portal \u5185\u5BB9\u72EC\u7ACB dispose\uFF09\u2014\u2014\u7236\u6811\u5C06\u91CD\u5EFA`):console.warn(`[vdom2] disposed \u7EC4\u4EF6 ${o} \u5728 diff\u2014\u2014\u526A\u679D\u7F13\u5B58\u5931\u6548\u2014\u2014\u7236\u6811\u91CD\u5EFA\u4E2D\uFF08\u5360\u4F4D\u515C\u5E95\uFF09`);let r=ue(t.browser??x(),null);if(r==null)return null;let i=n;if(i){let s=i.parentNode;s?s.replaceChild(r,i):e.appendChild(r)}else e.appendChild(r);return r}var xr={unkeyed:mr,keyed:Et,mixed:e=>(sn(e.newChildren),sn(e.oldChildren),Et(e))};function ln(e){let{registry:n,ctx:t}=e,o=new Map;async function r(s){let l=n.idRegistry.get(s);if(!l||!k(l)||typeof l._render!="function")return;let d=l,u=Qe("render");try{let a=await d._render(d.props),c=await J(a,t,d._child,n)??null,f=d._child;if(d._child=c,d._lifecycle==="building"){P({session:u,machine:"render",nodeId:d._id??null,component:Rt(d),from:"IDLE",event:"PARENT",to:"SKIP_BUILDING",payload:()=>({lifecycle:d._lifecycle}),level:"debug",ts:Date.now()});return}let p=d._id!=null&&d._id===t.ui?._rootVNodeId,m=d._parentNode??d._refNode?.parentNode??null;m==null&&p&&(m=e.rootEl??null);let g=m?p&&!d._parentNode?"ROOT":"MOUNTED":"SKIP_DETACHED";if(P({session:u,machine:"render",nodeId:d._id??null,component:Rt(d),from:"IDLE",event:"PARENT",to:g,payload:()=>({lifecycle:d._lifecycle}),level:"debug",ts:Date.now()}),m){let h={browser:t.browser??x(),registry:n,ctxVersion:en(t)},w=ne(m,d._refNode??null,f,c,h);if(d._refNode=w,ce())try{let y=[];Te(m,c,v=>y.push(v)),y.length&&console.error("[vdom2/audit] "+y.join(" | "))}catch(y){console.error("[vdom2/audit] \u6821\u9A8C\u5F02\u5E38:",y)}}}catch(a){e.onError?e.onError(a):console.error("[vdom2] render error:",a?.stack??a)}finally{Ae()}}function i(s){return s==null?Promise.resolve():Promise.all(s.map(l=>{let u=(o.get(l)??Promise.resolve()).then(()=>r(l));return o.set(l,u),u.finally(()=>{o.get(l)===u&&o.delete(l)})})).then(()=>{})}return{render:i}}function Rt(e){return typeof e.type=="function"&&e.type.name?e.type.name:"anonymous"}function At(e){let{ctx:n,browser:t}=e,o=e.registry??ye(),r=e.renderer??ln({registry:o,ctx:n,rootEl:e.root,onError:e.onError}),i=n.ui,s=null,l=null,d={ctx:n,registry:o,renderer:r,async mount(u){s=u;let a=await J(u,n,null,o);e.root.innerHTML="";let c=U(a,n,t);if(c!=null&&e.root.appendChild(c),l=a?._child??a,i&&(i._rootVNodeId=a?._id??null),ce())try{let f=[];Te(e.root,a,p=>f.push(p)),f.length&&console.error("[vdom2/audit] "+f.join(" | "))}catch(f){console.error("[vdom2/audit] \u6821\u9A8C\u5F02\u5E38:",f)}},async rerender(){if(s==null)return;let u=[];for(let[,a]of o.idRegistry)k(a)&&typeof a._render=="function"&&a._id&&u.push(a._id);await r.render(u)},unmount(){for(let[,u]of o.idRegistry)try{H(u,o)}catch{}e.root.innerHTML=""}};return d.close=()=>d.unmount(),d}var It=x();function Lt(e,n="bottom",t=6,o=!0){switch(n){case"bottom":return{top:e.bottom+t,left:o?e.left+e.width/2:e.left};case"top":return{top:e.top-t,left:o?e.left+e.width/2:e.left};case"left":return{top:o?e.top+e.height/2:e.top,left:e.left-t};case"right":return{top:o?e.top+e.height/2:e.top,left:e.right+t}}}function an(e,n,t=8){if(!n)return e;let o=n.getBoundingClientRect();if(o.width===0&&o.height===0)return e;let r=Number.parseFloat(n.style.top)||o.top,i=Number.parseFloat(n.style.left)||o.left,s=e.top-r,l=e.left-i,d={top:o.top+s,bottom:o.bottom+s,left:o.left+l,right:o.right+l},u=It.viewportWidth(),a=It.viewportHeight(),c=e.top,f=e.left;return d.bottom>a-t&&(c=Math.max(t,c-(d.bottom-(a-t)))),d.top<t&&(c=Math.max(t,c+(t-d.top))),d.right>u-t&&(f=Math.max(t,f-(d.right-(u-t)))),d.left<t&&(f=Math.max(t,f+(t-d.left))),{top:c,left:f,width:e.width}}var Pe=x();function Mt(e){let n=new Map,t=new Map,o=!1,r=0;function i(){r||(r=requestAnimationFrame(()=>{r=0;let a=[];for(let[c,f]of n){if(!f.isOpen())continue;let p=f.getEl();if(!p)continue;let m=p.getBoundingClientRect();if(m.width===0&&m.height===0)continue;let g=f.compute(m);Object.assign(f.pos,an(g,f.panel?.(),f.margin)),a.push(c)}for(let[c,f]of t){let p=f.getScroller(),m=p instanceof Window?Pe.scrollingElement()?.scrollTop??Pe.scrollTop():p.scrollTop??0;m!==f.handle.y&&(f.handle.y=m,a.push(c))}a.length>0&&e(a)}))}function s(){o||(o=!0,Pe.addEventListener("scroll",i,{capture:!0,passive:!0}),Pe.addEventListener("resize",i))}function l(){o&&(Pe.removeEventListener("scroll",i,{capture:!0}),Pe.removeEventListener("resize",i),o=!1)}function d(a){for(let c of[...n.keys()])(c.startsWith(`popup:${a}:`)||c===`popup:${a}`||c===a)&&n.delete(c);t.delete(a)}function u(){l(),r&&(cancelAnimationFrame(r),r=0),n.clear(),t.clear()}return{popupTrackers:n,scrollTrackers:t,schedulePopupRecompute:i,ensurePopupListeners:s,destroyPopupListeners:l,cleanupTrackers:d,destroy:u}}function Ln(e,n,t){return r=>{r?n(r):t?.()}}function $e(e){return typeof window<"u"&&!!window.matchMedia?.("(hover: hover)").matches}function dn(e){return typeof window<"u"&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Mn(e,n,t){let o=null,r=()=>{n(),t?.once&&o&&o.removeEventListener("animationend",r)};return s=>{s?(o=s,s.addEventListener("animationend",r)):o&&(o.removeEventListener("animationend",r),o=null)}}function Hn(e,n){let{onLongPress:t,duration:o=500}=n,r,i=0,s=0,l=null,d=()=>{clearTimeout(r),r=void 0},u=e.selfId();if(u){let a=e.onUnmount(c=>{c===u&&(d(),a())})}return{onPointerDown:a=>{i=a.clientX??0,s=a.clientY??0,l=a,d(),r=setTimeout(()=>{r=void 0,l&&t(l)},o)},onPointerUp:d,onPointerLeave:d,onPointerMove:a=>{let c=Math.abs((a.clientX??0)-i),f=Math.abs((a.clientY??0)-s);(c>10||f>10)&&d()},onContextMenu:a=>{a.preventDefault(),t(a)}}}function De(e,n){let t=e.selfId(),o="closed",r,i=()=>{o="closed",t?e.render([t]):e.render()};return{get phase(){return o},ref:l=>{l?r||(r=()=>{o==="exit"&&i()},l.addEventListener("animationend",r)):r=void 0},sync:l=>(l?o="open":o==="open"&&(o="exit"),o)}}function On(e,n,t){let o=e.selfId(),r=dn(e),i=t?.duration??400,s=t?.ease==="linear"?f=>f:f=>1-Math.pow(1-f,3),l,d=n,u={value:r?n:0,reset:()=>{}},a=()=>{o?e.render([o]):e.render()},c=f=>{if(d=f,r){u.value=f,a();return}if(f===u.value)return;l&&cancelAnimationFrame(l);let p=u.value,m=performance.now(),g=h=>{let w=Math.min(1,(h-m)/i);u.value=Math.round(p+(f-p)*s(w)),w<1?(l=requestAnimationFrame(g),a()):(l=void 0,a())};l=requestAnimationFrame(g)};if(u.reset=f=>{f===d&&l||c(f)},o){let f=e.onUnmount(p=>{p===o&&(l&&(cancelAnimationFrame(l),l=void 0),f())})}return queueMicrotask(()=>c(n)),u}function Un(e,n,t){let o=e.selfId(),r=e.browser,i=`media:${o}:${n}`;if(!e.mediaRegistry.has(i)){let s=r.matchMedia(n);t(s.matches);let l=u=>t(u.matches);s.addEventListener("change",l),e.mediaRegistry.set(i,{mql:s,handler:l});let d=e.onUnmount(u=>{if(u!==o)return;let a=e.mediaRegistry.get(i);if(a?.mql&&a.handler)try{a.mql.removeEventListener("change",a.handler)}catch{}e.mediaRegistry.delete(i),d()})}}function $n(e,n,t){let o=e.browser,r=typeof n=="function"?{mobile:"(max-width: 639px)",tablet:"(min-width: 640px) and (max-width: 1023px)",desktop:"(min-width: 1024px)"}:n,i=typeof n=="function"?n:t,s=e.selfId(),l=`bp:${s}`;function d(){for(let[u,a]of Object.entries(r))if(o.matchMedia(a).matches)return u;return Object.keys(r)[0]??""}if(!e.mediaRegistry.has(l)){i(d());let u=[];for(let c of Object.values(r)){let f=o.matchMedia(c),p=()=>i(d());f.addEventListener("change",p),u.push({mql:f,handler:p})}e.mediaRegistry.set(l,{mqls:u});let a=e.onUnmount(c=>{if(c!==s)return;let f=e.mediaRegistry.get(l);if(f?.mqls)for(let p of f.mqls)try{p.mql.removeEventListener("change",p.handler)}catch{}e.mediaRegistry.delete(l),a()})}}function Dn(e){let n=e.selfId(),t=e.browser,o={height:t.viewportHeight(),offsetTop:0,keyboardOpen:!1},r=()=>{n?e.render([n]):e.render()},i=()=>{let l=t.visualViewport();o.height=l?.height??t.viewportHeight(),o.offsetTop=l?.offsetTop??0,o.keyboardOpen=o.height<t.viewportHeight()*.9,r()},s=t.visualViewport();if(s?.addEventListener?(s.addEventListener("resize",i),s.addEventListener("scroll",i)):t.addEventListener("resize",i),n){let l=e.onUnmount(d=>{d===n&&(s?.removeEventListener?(s.removeEventListener("resize",i),s.removeEventListener("scroll",i)):t.removeEventListener("resize",i),l())})}return o}function jn(e,n){let t=e.selfId(),o={isIn:!1,ready:!1,observe:d,refresh:u,disconnect:a},r=null,i=null,s=()=>{t?e.render([t]):e.render()};function l(){if(i?.disconnect(),i=null,!r)return;let c=typeof n.rootMargin=="function"?n.rootMargin():n.rootMargin,f=typeof n.threshold=="function"?n.threshold():n.threshold;i=new IntersectionObserver(p=>{let m=p[p.length-1];if(!m)return;let g=m.isIntersecting,h=g!==o.isIn,w=!o.ready;o.isIn=g,o.ready=!0,n.onChange?.(m,g),(h||w)&&s()},{root:n.root?n.root():null,rootMargin:c??"0px",threshold:f??0}),i.observe(r)}function d(c){r=c,c?l():(i?.disconnect(),i=null,o.isIn=!1)}function u(){l()}function a(){i?.disconnect(),i=null}if(t){let c=e.onUnmount(f=>{f===t&&(a(),c())})}return o}function Wn(e,n){let t=e.selfId(),o=e.browser,r={y:0,refresh(){let l=i.getScroller();r.y=l instanceof Window?o.scrollingElement()?.scrollTop??o.scrollTop():l.scrollTop??0}},i={handle:r,getScroller:n.getScroller??(()=>window)};if(!t)return r.refresh(),r;e.scrollTrackers.set(t,i),e.ensurePopupListeners(),r.refresh();let s=e.onUnmount(l=>{l===t&&(e.scrollTrackers.delete(t),s())});return r}function un(e,n){let t=e.selfId(),o=n.value!==void 0;if(o&&!n.onChange&&n.name&&(e.warned.has(n.name)||(e.warned.add(n.name),console.warn(`[weifuwu/${n.name}] \u53D7\u63A7\u6A21\u5F0F\uFF08value \u5DF2\u4F20\uFF09\u4F46\u672A\u63D0\u4F9B onChange\uFF0C\u4EA4\u4E92\u65E0\u6CD5\u751F\u6548\u3002
4
+ \u975E\u53D7\u63A7\uFF1A\u53BB\u6389 value\uFF1B\u53D7\u63A7\uFF1A\u4F20\u5165 onChange={(v) => setValue(v)}`))),!o&&t&&!e.uncontrolledValues.has(t)){e.uncontrolledValues.set(t,n.value);let i=e.onUnmount(s=>{s===t&&(e.uncontrolledValues.delete(t),i())})}let r=i=>{if(o){n.onChange?.(i);return}t&&e.uncontrolledValues.set(t,i),t?e.render([t]):e.render()};return{value:o?n.value:t?e.uncontrolledValues.get(t):n.value,setValue:r,controlled:o}}function Fn(e,n){let t=e.selfId(),o=un(e,{value:n.value,onChange:n.onChange,name:n.name});if(t&&!e.inputStates.has(t)){e.inputStates.set(t,{keyword:"",selectedLabel:""});let s=e.onUnmount(l=>{l===t&&(e.inputStates.delete(t),s())})}let r=t?e.inputStates.get(t):{keyword:"",selectedLabel:""},i=()=>{t?e.render([t]):e.render()};return{...o,get keyword(){return r.keyword},setKeyword(s){r.keyword=s,i()},get selectedLabel(){return r.selectedLabel},setSelectedLabel(s){r.selectedLabel=s,i()}}}function Bn(e,n){let t=e.selfId(),o=!1;if(t){let d=e.onUnmount(u=>{u===t&&(o=!0,d())})}let r=()=>{o||(t?e.render([t]):e.render())},i={data:void 0,loading:!1,error:void 0},s=0,l=()=>{let d=++s;i.loading=!0,i.error=null,r(),Promise.resolve().then(()=>n()).then(u=>{s===d&&(i.data=u,i.loading=!1,r())}).catch(u=>{s===d&&(i.error=u,i.loading=!1,r())})};return l(),i.reload=l,i}function Kn(e,n){let t=e.selfId(),o=e.browser;if(typeof window>"u")return()=>{};if(o.addEventListener("keydown",n),t){let r=e.onUnmount(i=>{i===t&&(o.removeEventListener("keydown",n),r())})}return()=>o.removeEventListener("keydown",n)}function qn(e,n){let t=e.browser,o=0,r=0,i=!1,s=a=>{i&&n.onMove(a,{x:a.clientX-o,y:a.clientY-r})},l=a=>{i&&(i=!1,t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",l),n.onEnd?.(a))},d=a=>{i||(a.preventDefault(),i=!0,o=a.clientX,r=a.clientY,t.addEventListener("pointermove",s),t.addEventListener("pointerup",l),n.onStart?.(a))},u=e.selfId();if(u){let a=e.onUnmount(c=>{c===u&&(i&&(t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",l),i=!1),a())})}return{onPointerDown:d}}function Gn(e,n){let t={};n.onDrop&&(t.onDrop=r=>{r.preventDefault(),n.onDrop(r)}),n.onDragOver&&(t.onDragOver=r=>{r.preventDefault(),n.onDragOver(r)}),n.onDragLeave&&(t.onDragLeave=r=>n.onDragLeave(r));let o={draggable:!0};if(n.onDragStart){let r=n.onDragStart;o.onDragStart=i=>{typeof document<"u"&&document.body.classList.add("wf-dragging"),r(i)}}if(n.onDragEnd){let r=n.onDragEnd;o.onDragEnd=i=>{typeof document<"u"&&document.body.classList.remove("wf-dragging"),r(i)}}return{dropProps:t,dragProps:o}}function fn(e,n){let t=e.selfId(),o={top:0,left:0,refresh:()=>{}};if(!t)return o;let r={pos:o,getEl:n.el,isOpen:n.isOpen,compute:n.compute,panel:n.panel,margin:n.margin??8};e.popupTrackers.set(t,r),e.ensurePopupListeners();let i=e.onUnmount(s=>{s===t&&(e.popupTrackers.delete(t),i())});return o.refresh=()=>{let s=r.getEl();if(!s)return;let l=s.getBoundingClientRect();if(l.width===0&&l.height===0)return;let d=r.compute(l);Object.assign(o,an(d,r.panel?.(),r.margin))},o}function zn(e,n){let t=e.selfId(),o=e.browser,r=$e(e),i=()=>typeof n.trigger=="function"?n.trigger():n.trigger??"manual",s=n.open!==void 0,l=()=>!!n.disabled?.(),d=()=>s?typeof n.open=="function"?!!n.open():!!n.open:n.isOpen(),u=n.presence?De(e,{name:n.name}):null,a,c=!1,f=N=>{if(!u)return N?"open":"closed";let V=u.sync(N);return N&&n.lockScroll&&!c&&(Er(),c=!0),V},p=N=>{l()||(s?n.onOpenChange?.(N):u?N?f(!0):d()&&f(!1):n.setOpen(N))},m=()=>{let N=n.placement;return typeof N=="function"?N():N??"bottom"},g=null,h=!1,w=fn(e,{el:n.el??(()=>null),isOpen:()=>d(),compute:N=>{if(n.position){let V=n.position();return{top:V.y,left:V.x,width:V.width}}return Lt(N,m(),n.gap??6,n.center!==!1)},panel:()=>g,margin:n.margin??8}),y=N=>{if(n.closeOnOutside===!1||n.mask||!d())return;let V=N.target;if(!(V instanceof Node))return;let W=n.el?.()??null;W&&W.contains(V)||g&&g.contains(V)||p(!1)},v=N=>{n.closeOnEscape!==!1&&(N.key!=="Escape"||!d()||p(!1))};if(o.addEventListener("mousedown",y),o.addEventListener("keydown",v),t){let N=e.onUnmount(V=>{V===t&&(o.removeEventListener("mousedown",y),o.removeEventListener("keydown",v),N())})}let b={},I=N=>typeof N=="function"?N():N??0,B=()=>I(n.openDelay),D=()=>I(n.closeDelay),C,T,j=()=>{clearTimeout(C),clearTimeout(T),C=void 0,T=void 0},X=N=>{if(l())return;let V=N.currentTarget,W=N.relatedTarget;V.contains(W)||(clearTimeout(T),T=void 0,C=setTimeout(()=>{C=void 0,p(!0)},B()))},L=N=>{if(l())return;let V=N.currentTarget,W=N.relatedTarget;V.contains(W)||(clearTimeout(C),C=void 0,T=setTimeout(()=>{T=void 0,p(!1)},D()))},$=()=>{l()||(clearTimeout(T),T=void 0,C=setTimeout(()=>{C=void 0,p(!0)},B()))},K=()=>{l()||(clearTimeout(C),C=void 0,T=setTimeout(()=>{T=void 0,p(!1)},D()))},se=()=>i()==="hover";if(b.onMouseOver=N=>{se()&&X(N)},b.onMouseOut=N=>{se()&&L(N)},b.onClick=()=>{se()?r||p(!d()):i()==="click"&&p(!0)},b.onFocus=()=>{se()?$():i()==="focus"&&(clearTimeout(T),T=void 0,p(!0))},b.onBlur=()=>{se()?K():i()==="focus"&&(clearTimeout(C),C=void 0,T=setTimeout(()=>{T=void 0,p(!1)},D()))},i()==="longpress"){let N,V=0,W=0,me=()=>{clearTimeout(N),N=void 0};b.onPointerDown=M=>{l()||(V=M.clientX??0,W=M.clientY??0,me(),N=setTimeout(()=>{N=void 0,n.onTrigger?.({clientX:V,clientY:W}),p(!0)},n.longPressDuration??500))},b.onPointerUp=me,b.onPointerLeave=me,b.onPointerMove=M=>{let mn=Math.abs((M.clientX??0)-V),yn=Math.abs((M.clientY??0)-W);(mn>10||yn>10)&&me()},b.onContextMenu=M=>{M.preventDefault(),n.onTrigger?.({clientX:M.clientX??0,clientY:M.clientY??0}),p(!0)}}if(b.onKeyDown=N=>{N.key==="Escape"&&n.closeOnEscape!==!1&&p(!1)},t){let N=e.onUnmount(V=>{V===t&&(j(),N())})}let Ke=N=>{if(N){g=N;let V=()=>w.refresh();N.addEventListener("animationend",V,{once:!0})}else g=null},le=null,be=null,ge=N=>{Ke(N),be&&be(N),u?.ref(N),n.trapFocus&&(N?a=kr(N):(a?.(),a=void 0)),n.lockScroll&&!N&&c&&(Tr(),c=!1)};return{get open(){return d()},setOpen:p,get phase(){return u?u.phase:d()?"open":"closed"},sync:f,wrapProps:b,portal:(N,V="popover")=>{if(l())return null;if(!(u?u.phase!=="closed":d()))return h=!1,le=null,null;let me=n.el?.()??null;(!h||me!==le)&&(me?w.refresh():queueMicrotask(()=>{d()&&w.refresh()}),h=!0,le=me);let M=N.props??{};be=M.ref??null;let mn=n.positioning==="none"?M.class??"":["wf-popup",M.class].filter(Boolean).join(" "),yn=n.positioning==="none"?{...M.style??{},position:"fixed"}:{...M.style??{},position:"fixed",top:`${w.top}px`,left:`${w.left}px`,...w.width!==void 0?{width:`${w.width}px`}:{},maxWidth:(()=>{let qe=typeof n.width=="function"?n.width():n.width;return qe!==void 0?`min(${qe}px, calc(100vw - 32px))`:"calc(100vw - 32px)"})()},Ce={...N,props:{...M,class:mn,style:yn,ref:ge}};if(n.mask){let qe=typeof n.mask=="object"?n.mask:he("div",{class:"wf-popup-mask","data-portal-mask":V,onClick:n.maskClosable===!1?void 0:()=>p(!1)}),qt=n.maskCentered?he("div",{class:"wf-cover",style:{"--wf-z":"var(--wf-z-popover)",pointerEvents:"none"}},{...Ce,props:{...Ce.props,style:{...M.style??{},pointerEvents:"auto"},ref:ge}}):null,Gt=n.maskCentered?void 0:{...Ce.props?.style??{},zIndex:"var(--wf-z-popover)"},zt=n.maskCentered?qt:{...Ce,props:{...Ce.props,style:Gt}};return Ye([qe,zt],V)}return Ye(Ce,V)},refresh:()=>w.refresh()}}function Yn(e,n){let t=e.selfId();if(t&&!e.openStates.has(t)){e.openStates.set(t,!1);let l=e.onUnmount(d=>{d===t&&(e.openStates.delete(t),l())})}let o=n.open!==void 0;o&&!n.onOpenChange&&n.name&&!e.warned.has(n.name)&&(e.warned.add(n.name),console.warn(`[weifuwu/${n.name}] \u53D7\u63A7\u6A21\u5F0F\uFF08open \u5DF2\u4F20\uFF09\u4F46\u672A\u63D0\u4F9B onOpenChange\uFF0C\u4EA4\u4E92\u65E0\u6CD5\u751F\u6548\u3002
5
+ \u975E\u53D7\u63A7\uFF1A\u53BB\u6389 open\uFF1B\u53D7\u63A7\uFF1A\u4F20\u5165 onOpenChange={(o) => setOpen(o)}`));let r=()=>o?!!n.open:t?e.openStates.get(t)??!1:!1,i=()=>{t?e.render([t]):e.render()},s=l=>{if(o){n.onOpenChange?.(l);return}t&&e.openStates.set(t,l),i()};return{get open(){return r()},setOpen:s,triggerProps:{onClick:()=>s(!0),onFocus:()=>{n.openOnFocus&&s(!0)}}}}var we=x(),je=0,Ht="",Ot="",Ut="",$t="",cn=0;function Dt(){return typeof window<"u"&&typeof document<"u"}function Er(){if(je++,je>1||!Dt())return;cn=we.scrollTop();let e=we.bodyElement();Ht=e.style.overflow,Ot=e.style.position,Ut=e.style.top,$t=e.style.width,e.style.overflow="hidden",(/iPhone|iPad|iPod/.test(navigator.platform)||/Mac/.test(navigator.platform)&&"ontouchend"in document)&&(e.style.position="fixed",e.style.top=`-${cn}px`,e.style.width="100%")}function Tr(){if(je===0||(je--,je>0)||!Dt())return;let e=we.bodyElement();e.style.overflow=Ht,e.style.position=Ot,e.style.top=Ut,e.style.width=$t,cn>0&&we.scrollTo(cn)}var _r='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function kr(e){let n;return queueMicrotask(()=>{let t=e.querySelectorAll(_r);if(t.length===0)return;let o=t[0],r=t[t.length-1],i=l=>{l.key==="Tab"&&(l.shiftKey&&we.activeElement()===o?(l.preventDefault(),r.focus()):!l.shiftKey&&we.activeElement()===r&&(l.preventDefault(),o.focus()))},s=we.activeElement();o.focus(),e.addEventListener("keydown",i),n=()=>{e.removeEventListener("keydown",i),s?.focus()}}),()=>n?.()}function Pr(e){return e.map(n=>{let t={role:n.role,content:n.content};return n.reasoning&&(t.reasoning_content=n.reasoning),t})}function Jn(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function jt(e,n,t,o){t.initialMessages?e.messages=structuredClone(t.initialMessages):e.messages===void 0&&(e.messages=[]),e.input===void 0&&(e.input=""),e.streaming===void 0&&(e.streaming=!1),e.error===void 0&&(e.error=null),e.usage===void 0&&(e.usage=null),e.step===void 0&&(e.step=null);let r=null;function i(){if(!e.streaming)return;let m=e.messages[e.messages.length-1];return m&&m.role==="assistant"&&m.status==="streaming"?m:void 0}function s(m,g,h){let w=i();switch(m){case"wf:token":w&&(w.content+=g.text);break;case"wf:tool_call":{w&&(w.toolCalls||(w.toolCalls=[]),w.toolCalls.push({call:g,status:"running"}));break}case"wf:tool_progress":{let y=g,v=w?.toolCalls?.find(b=>b.call.id===y.toolCallId);v&&(v.progress=y);break}case"wf:tool_result":{let y=g,v=w?.toolCalls?.find(b=>b.call.id===y.id);v&&(v.result=y,v.status=y.ok?"ok":"error");break}case"wf:approval_request":w&&(w.approval=g);break;case"wf:usage":w&&(w.usage=g);break;case"wf:step":e.step=g;break;case"wf:done":if(w){w.status="done",w.approval=void 0;let y=g;y.reasoning&&(w.reasoning=y.reasoning)}e.streaming=!1,e.step=null;break;case"wf:error":w&&(w.status="error",w.error=g,w.approval=void 0),e.error=g,e.streaming=!1,e.step=null;break;default:h?.(m,g);break}o?.()}function l(){let m=t.body?t.body(e.messages):{messages:Pr(e.messages)};r=n(t.url,m,{onToken:h=>s("wf:token",{text:h}),onToolCall:h=>s("wf:tool_call",h),onToolProgress:h=>s("wf:tool_progress",h),onToolResult:h=>s("wf:tool_result",h),onApproval:h=>s("wf:approval_request",h),onUsage:h=>s("wf:usage",h),onStep:h=>s("wf:step",h),onDone:h=>s("wf:done",h),onError:h=>s("wf:error",h),onEvent:(h,w)=>s(h,w,t.onEvent)},{signal:t.signal,headers:t.headers}),e.streaming=!0;let g=i();g&&r?.traceId&&(g.id=r.traceId)}function d(){if(e.streaming)return;let m=String(e.input??"").trim();m&&(e.input="",e.error=null,e.usage=null,e.step=null,e.messages.push({id:Jn(),role:"user",content:m,status:"done"},{id:Jn(),role:"assistant",content:"",status:"streaming",toolCalls:[]}),l(),o?.())}function u(){r?.abort(),e.streaming=!1,e.step=null;let m=e.messages[e.messages.length-1];m&&m.role==="assistant"&&m.status==="streaming"&&(!m.content&&(!m.toolCalls||m.toolCalls.length===0)?e.messages.pop():m.status="done"),o?.()}function a(){if(e.streaming)return;let m=-1;for(let g=e.messages.length-1;g>=0;g--)if(e.messages[g].role==="user"){m=g;break}m!==-1&&(e.messages.splice(m+1),e.error=null,e.usage=null,e.step=null,e.messages.push({id:Jn(),role:"assistant",content:"",status:"streaming",toolCalls:[]}),l(),o?.())}function c(){r?.abort(),e.messages=[],e.input="",e.streaming=!1,e.error=null,e.usage=null,e.step=null,o?.()}async function f(m,g,h){let w=e.messages[e.messages.length-1],y=w?.role==="assistant"?w.approval:void 0;if(y&&(w.approval=void 0,o?.(),!!t.approveUrl))try{await fetch(t.approveUrl,{method:"POST",headers:{"Content-Type":"application/json",...t.headers},body:JSON.stringify(h?{id:y.id,decision:m,note:g,modifiedArgs:h}:{id:y.id,decision:m,note:g}),signal:t.signal})}catch(v){if(t.signal?.aborted)return;e.error={code:"provider_error",message:v instanceof Error?v.message:String(v)},o?.()}}function p(){r?.abort(),r=null}return{send:d,stop:u,retry:a,clear:c,approve:f,dispose:p}}function Wt(e,n,t){let o=new AbortController,r=t?.signal;r&&(r.aborted?o.abort():r.addEventListener("abort",()=>o.abort(),{once:!0}));let i=t?.traceId??Lr(),s=t?.record!==!1,l=[],d=(async()=>{let u;try{u=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Trace-Id":i,Accept:"text/event-stream",...t?.headers},body:JSON.stringify(n),signal:o.signal})}catch(a){if(o.signal.aborted)return;t?.onError?.({code:"provider_error",message:a instanceof Error?a.message:String(a)});return}if(!u.ok){t?.onError?.({code:Ir(u.status),message:`HTTP ${u.status} ${u.statusText}`});return}try{for await(let{name:a,data:c}of Rr(u.body)){if(o.signal.aborted)return;Ar(l,{name:a,data:c},s),Sr(a,c,t??{})}}catch(a){if(o.signal.aborted)return;t?.onError?.({code:"provider_error",message:a instanceof Error?a.message:String(a)})}})();return{abort:()=>o.abort(),done:d,traceId:i,events:l}}function Sr(e,n,t){switch(e){case"wf:token":return t.onToken?.(n.text);case"wf:tool_call":return t.onToolCall?.(n);case"wf:tool_result":return t.onToolResult?.(n);case"wf:tool_progress":return t.onToolProgress?.(n);case"wf:step":return t.onStep?.(n);case"wf:approval_request":return t.onApproval?.(n);case"wf:usage":return t.onUsage?.(n);case"wf:done":return t.onDone?.(n);case"wf:error":return t.onError?.(n);default:return t.onEvent?.(e,n)}}async function*Rr(e){let n=e.getReader(),t=new TextDecoder,o="";try{for(;;){let{done:r,value:i}=await n.read();if(r)break;o+=t.decode(i,{stream:!0});let s=o.split(`
6
6
 
7
7
  `);o=s.pop()??"";for(let l of s){let d="message",u="";for(let a of l.split(`
8
- `))a.startsWith("event: ")?d=a.slice(7):a.startsWith("data: ")&&(u+=a.slice(6));if(u)try{yield{name:d,data:JSON.parse(u)}}catch{}}}}finally{n.releaseLock()}}function Rr(e,n,t){t&&(e.length>=1e3&&e.shift(),e.push(n))}function Ar(e){return e===401||e===403?"auth_failed":e===429?"rate_limited":e>=500?"provider_error":"invalid_request"}function Ir(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`trace-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Yn(e,n){let t={messages:[],input:"",streaming:!1,error:null,usage:null,step:null},o=new Set,i=Dt(t,jt,n,()=>{for(let l of[...o])l()});Object.assign(t,i),t.subscribe=l=>(o.add(l),()=>{o.delete(l)});let s=e.selfId();if(s){let l=e.onUnmount(d=>{d===s&&(i.dispose(),l())})}return t}function Xn(e,n){let t=e.selfId(),o;return t&&(o=n.subscribe(()=>e.render([t])),e.onUnmount(()=>o?.())),n}function cn(e){let n=e.registry??ye(),t={_selfId:"_wf_root",_mounting:!1,_ctxVersion:0,_rootVNodeId:null},o={browser:e.browser,__registry:n};o.app={navigate:y=>e.browser.navigate(y)};let r=e.renderer??rn({registry:n,ctx:o,rootEl:e.root,onError:e.onError}),i=Lt(y=>{for(let v of y)r.render([v])}),s=new Map,{popupTrackers:l,scrollTrackers:d,ensurePopupListeners:u,destroyPopupListeners:a,cleanupTrackers:c}=i;Ze(n,y=>{c(y),l.has(y)&&l.delete(y)});let f=new Set,p=new Map,m=new Map,g=new Map,h=y=>({selfId:()=>{let v=y?._selfVNode?._id??y?._selfId;return typeof v=="string"?v:void 0},render:v=>r.render(v),browser:e.browser,onUnmount:v=>Ze(n,v),registry:n,mediaRegistry:s,popupTrackers:l,scrollTrackers:d,isMounting:()=>t._mounting===!0,warned:f,uncontrolledValues:p,inputStates:m,openStates:g,ensurePopupListeners:u}),N=!1;return t.render=function(y){if(y==null){let v=this._selfId!=="_wf_root"&&this._selfId?this._selfId:t._rootVNodeId;return v?r.render([v]):(N||(N=!0,console.warn("[weifuwu] render() \u65E0\u53C2\u4F46\u65E0\u6E32\u67D3\u76EE\u6807\uFF1A\u9875\u9762\u6839\u662F native vnode\uFF08UIHandler \u76F4\u63A5\u8FD4\u56DE vnode \u7684\u9875\u9762\u5F62\u6001\uFF09\u3002\u6539\u7528 async \u7EC4\u4EF6\u5F62\u6001\uFF08const Page: Component = async ... => (props) => ...\uFF09\u6216 createStore + useExternal \u5171\u4EAB\u72B6\u6001\u3002")),Promise.resolve())}return r.render(y)},t.setMounting=y=>{t._mounting=y},t.endMounting=()=>{t._mounting=!1},t.bumpCtxVersion=()=>{t._ctxVersion=(t._ctxVersion??0)+1},t.selfId=function(y){if(typeof y!="string"||!y)throw new Error(`[weifuwu] selfId requires a non-empty string, got ${typeof y}`);if(n.idRegistry.has(y))throw new Error(`[weifuwu] Duplicate component ID: "${y}". Each component must have a unique custom ID.`);let v=this._selfVNode;v&&(v._customId=y,n.idRegistry.set(y,v))},t.onUnmount=function(y){let v=this?._selfVNode?._id??this?._selfId;if(v)return Ze(n,b=>{b===v&&y()})},t.useChat=function(y){return Yn(h(this),y)},t.useMedia=function(y,v){return Hn(h(this),y,v)},t.useBreakpoint=function(y,v){return On(h(this),y,v)},t.usePopupPosition=function(y){return un(h(this),y)},t.useHoverCapable=function(){return Ue(h(this))},t.useStableRef=function(y,v){return An(h(this),y,v)},t.useVisualViewport=function(){return Un(h(this))},t.usePopup=function(y){return qn(h(this),y)},t.useLongPress=function(y){return Ln(h(this),y)},t.useInView=function(y){return $n(h(this),y)},t.useScrollPosition=function(y){return Dn(h(this),y)},t.useAsync=function(y){return Wn(h(this),y)},t.useControlled=function(y){return an(h(this),y)},t.useControlledInput=function(y){return jn(h(this),y)},t.useOpen=function(y){return Gn(h(this),y)},t.usePresence=function(y){return $e(h(this),y)},t.useGlobalKey=function(y){return Fn(h(this),y)},t.useDrag=function(y){return Bn(h(this),y)},t.useDragDrop=function(y){return Kn(h(this),y)},t.useExternal=function(y){return Xn(h(this),y)},t.useReducedMotion=function(){return ln(h(this))},t.useAnimationEnd=function(y,v){return In(h(this),y,v)},t.useTween=function(y,v){return Mn(h(this),y,v)},t.destroyPopupListeners=a,o.ui=t,{ctx:o,registry:n,renderer:r,rootUi:t,destroyPopupListeners:a}}function Lr(e){let{ctx:n,registry:t,renderer:o}=cn(e);return Rt({root:e.root,browser:e.browser,ctx:n,registry:t,renderer:o,onError:e.onError})}var Mr=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);function je(e){e.node=e.node?e.node.nextSibling:null}function Hr(e,n){e.node&&e.node.parentNode?e.node.parentNode.insertBefore(n,e.node):e.parent.appendChild(n)}function Or(e,n){e.node&&e.node.parentNode?(e.node.parentNode.replaceChild(n,e.node),je(e)):e.parent.appendChild(n)}function Ur(e,n){for(let[t,o]of Object.entries(n))t==="children"||t==="key"||t==="innerHTML"||oe(e,t,o)}function We(e,n,t){return $r[$(e)](e,n,t)}var $r={hole:()=>null,text:Dr,arr:jr,portal:Wt,frag:Wt,comp:Wr,native:Fr};function Dr(e,n,t){let o=n.browser??V(),r=String(e);if(t.node&&t.node.nodeType===3)return t.node.textContent!==r&&(t.node.textContent=r),je(t),t.node;let i=o.createTextNode(r);return Hr(t,i),i}function jr(e,n,t){let o=null;for(let r of e){let i=We(r,n,t);i!=null&&!o&&(o=i)}return o}function Wt(e,n,t){let r=e.props?.children,i=r==null?[]:Array.isArray(r)?r:[r],s=null;for(let l of i){let d=We(l,n,t);d!=null&&!s&&(s=d)}return s}function Wr(e,n,t){let o=e,r=o._child;if(r==null){if(typeof o._render!="function")throw new Error(`[vdom2] component ${I(o.type)} not built before hydration`);for(o._child=null;t.node&&t.node.nodeType===8&&t.node.nodeValue?.startsWith("wf-hole:");)je(t);return null}let i=We(r,n,t);return o._refNode||(o._refNode=i),i}function Fr(e,n,t){let o=n.browser??V(),r=e,i=r.type,s=r.props??{};for(;t.node&&t.node.nodeType===8&&t.node.nodeValue?.startsWith("wf-hole:");)je(t);let l;if(t.node&&t.node.nodeType===1&&t.node.tagName.toLowerCase()===i.toLowerCase()?(l=t.node,je(t)):(l=Mr.has(i)?o.createElementNS("http://www.w3.org/2000/svg",i):o.createElement(i),Or(t,l)),r.el=l,Ur(l,s),!("innerHTML"in s)){let d={parent:l,node:l.firstChild},u=(Array.isArray(s.children)?s.children:[s.children]).flat(1/0);for(let a of u){let c=We(a,n,d);if(c!=null&&c.parentNode!==l&&l.appendChild(c),a&&typeof a=="object"&&!Array.isArray(a)&&P(a)){let f=a;f._parentNode||(f._parentNode=l,f._refNode=c)}}for(;d.node;){let a=d.node;d.node=a.nextSibling,a.parentNode?.removeChild(a)}}return"value"in s&&l instanceof HTMLSelectElement&&(l.value=String(s.value??"")),l}async function Jn(e,n,t){let o=t.__registry;await Y(n,t,null,o);let r={parent:e,node:e.firstChild};for(We(n,t,r);r.node;){let i=r.node;r.node=i.nextSibling,i.parentNode?.removeChild(i)}}var Br={idle:{NAVIGATE_START:"navigating"},navigating:{NAVIGATE_DONE:"settled",NAVIGATE_ERROR:"idle"},settled:{NAVIGATE_START:"navigating"}};function Ft(){let e="idle",n=(t,o)=>{let r=Br[e]?.[t]??null;return r==null?(S({session:"",machine:"route",nodeId:null,component:null,from:e,event:t,to:"?",payload:{path:o},level:"debug",ts:Date.now()}),e):(S({session:"",machine:"route",nodeId:null,component:null,from:e,event:t,to:r,payload:{path:o},level:"debug",ts:Date.now()}),e=r,r)};return{get state(){return e},navigateStart:t=>{n("NAVIGATE_START",t)},navigateDone:t=>{n("NAVIGATE_DONE",t)},navigateError:(t,o)=>{n("NAVIGATE_ERROR",t)}}}function Kr(e,n){let t=V(),o=typeof n.root=="string"?t.query(n.root):n.root;if(!o)throw new Error(`uiServe: root not found: ${n.root}`);let r=o,i=!!n.hydrate;!i&&!n.loading&&(r.innerHTML="");try{(new URLSearchParams(globalThis?.location?.search??"").get("vdom_debug")==="1"||globalThis?.localStorage?.getItem?.("__WF_VDOM_DEBUG")==="1")&&(globalThis.__WF_VDOM_DEBUG=!0,console.log("[weifuwu] vdom debug \u5DF2\u5F00\u542F\uFF08?vdom_debug=1\uFF09")),bn()}catch{}try{if(new URLSearchParams(globalThis?.location?.search??"").get("wf_reflow")==="1"||globalThis?.localStorage?.getItem?.("__WF_REFLOW_DEBUG")==="1"){globalThis.__WF_REFLOW_DEBUG=!0,console.log("[weifuwu] reflow debug \u5DF2\u5F00\u542F\uFF08?wf_reflow=1\u2014\u2014\u5E03\u5C40\u8BFB\u53D6\u8FFD\u8E2A\uFF09");let _=(F,j)=>{let ie=typeof document<"u"?document.styleSheets?.length??0:-1,fe=j?.tagName?`<${j.tagName}${j.id?"#"+j.id:""}${j.className?"."+String(j.className).split(" ")[0]:""}>`:"",O=(new Error().stack||"").split(`
9
- `).slice(2,5).map(R=>R.trim().split("/").pop()?.slice(0,80)).join(" \u2190 ");console.log(`[wf-reflow] ${F}${fe} styles=${ie}${ie===0?" \u26A0\uFE0F\u6837\u5F0F\u672A\u52A0\u8F7D\uFF08\u5F3A\u5236\u6392\u7248\u573A\u666F\uFF09":""} :: ${O}`)},ce=Element.prototype.getBoundingClientRect;Element.prototype.getBoundingClientRect=function(...F){return _("rect",this),ce.apply(this,F)};for(let F of["offsetWidth","offsetHeight","offsetTop","offsetLeft","clientWidth","clientHeight","scrollTop","scrollHeight"]){let j=Object.getOwnPropertyDescriptor(Element.prototype,F);if(j?.get){let ie=j.get;Object.defineProperty(Element.prototype,F,{configurable:!0,enumerable:!0,get(){return _(F,this),ie.call(this)}})}}}}catch{}let{ctx:s,registry:l,renderer:d,rootUi:u,destroyPopupListeners:a}=cn({browser:t,root:r}),c=new Map,f=globalThis.__DATA__??window.__DATA__;if(f&&typeof f=="object")for(let[C,E]of Object.entries(f))c.set(C,{value:E});s.data={async get(C,E){let _=c.get(C);if(_&&"value"in _)return _.value;if(_?.promise)return _.promise;if(!E)return;let ce=Promise.resolve().then(()=>E()).then(F=>(c.set(C,{value:F}),F));return c.set(C,{promise:ce}),ce},set(C,E){c.set(C,{value:E})},has(C){return c.has(C)}},s.route={params:{},query:{},path:""};let p=null,m="",g=0,h,N=new Promise(C=>{h=C}),y=!1,v=Ft();async function b(C,E){let _=++g,ce={pathname:C,search:""};s.route.path=C,v.navigateStart(C);let F=Xe(E?"initial":"nav"),j;try{j=await e.execute(ce,s,C)}catch(R){v.navigateError(C,R),j=ge("div",{class:"ui-dom-error"},`\u9875\u9762\u6E32\u67D3\u5931\u8D25: ${R?.message??String(R)}`)}if(y||_!==g){Re();return}let ie=x("mount"),fe=ie?ut("nav"):"";ie&&k("mount","info",fe,`route path=${C} initial=${E}`);let O;try{O=await Y(j,s,p,l)}catch(R){O=ge("div",{class:"ui-dom-error"},`\u7EC4\u4EF6\u6E32\u67D3\u5931\u8D25: ${R?.message??String(R)}`)}if(!(y||_!==g)){if(E)if(i)await Jn(r,O,s),x("mount")&&k("mount","debug",fe,`hydrate done=${r.childNodes.length}`);else{r.innerHTML="";let R=D(O,s,t);x("mount")&&k("mount","debug",fe,`first-render node=${R?.nodeName??"null"} fragKids=${R?.nodeType===11?Array.from(R.childNodes).length:"-"}`),R!=null&&r.appendChild(R),x("mount")&&k("mount","debug",fe,`root-fill done=${r.childNodes.length} first=${r.firstChild?.nodeName}`)}else if(p!==void 0){let R=p;p=O;let pe=R,ke=qe(pe)?pe.el??pe._refNode:pe._refNode;ee(r,ke,R,O,{browser:t,registry:l,ctxVersion:s?.ui?._ctxVersion??0})}p=O,m=C,u._rootVNodeId=O?._id,v.navigateDone(C),Re()}}let H=t.pathname();b(H,!0).finally(()=>{y||h()}),ft(()=>p),it(),vt();let W=()=>{let C=t.pathname();b(C,!1)};return t.addEventListener("popstate",W),{close(){y=!0,t.removeEventListener("popstate",W),a(),l.idRegistry.clear()},ready:N,ctx:s}}function Fe(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function qr(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(Boolean).join(" "):e&&typeof e=="object"?Object.entries(e).filter(([,n])=>n).map(([n])=>n).join(" "):""}function Gr(e){return Object.entries(e).filter(([,n])=>n!=null&&n!==!1).map(([n,t])=>`${n}:${typeof t=="number"?t:String(t)}`).join(";")}var zr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Yr=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);async function ue(e,n){return ii[$(e)](e,n)}async function Xr(e,n){return""}async function Jr(e,n){return Fe(String(e))}function Qr(e){return e==null||typeof e=="boolean"?"hole":Array.isArray(e)?"arr":"vnode"}var Zr={hole:e=>Promise.resolve(`<!--${B({type:"hole",value:e,key:null,id:null,fid:null})}-->`),arr:async(e,n,t,o)=>{let r=await ue(e,{...n,_fidPath:o});return`<!--${B({type:"fragment-start",key:String(t),id:null,fid:o})}-->${r}<!--${B({type:"fragment-end",key:String(t),id:null,fid:o})}-->`},vnode:async(e,n)=>{let t=await ue(e,n);return t===""?`<!--${B({type:"hole",value:null,key:null,id:null,fid:null})}-->`:t}};async function ei(e,n){let t=e;gt(t);let o=n._fidPath;return(await Promise.all(t.map(async(i,s)=>{let l=o!=null?`${o}-${s}`:String(s);return Zr[Qr(i)](i,n,s,l)}))).join("")}async function ni(e,n){let t=e,o=n._fidPath??null,r=await ue(t.props?.children,{...n,_fidPath:o??void 0});return`<!--${B({type:"fragment-start",key:null,id:null,fid:o})}-->${r}<!--${B({type:"fragment-end",key:null,id:null,fid:o})}-->`}async function ti(e,n){return ue(e.props?.children,n)}async function oi(e,n){let t=e,o=Object.create(n);delete o._fidPath;let r=await t.type(t.props??{},o);if(typeof r!="function")throw new Error(`Component ${I(t.type)} must return a render function. Use (init_props, ctx) => (props) => VNode pattern.`);let i=await r(t.props??{});if(t.key!=null&&i!=null&&typeof i=="object")if(Array.isArray(i))for(let s of i)s!=null&&typeof s=="object"&&!Array.isArray(s)&&(s.key=t.key);else i.key=t.key;return ue(i,o)}async function ri(e,n){let t=e,o=t.type,r=t.props??{},i=[],s=null;t.key!=null&&i.push(` data-wf-key="${Fe(String(t.key))}"`);for(let[a,c]of Object.entries(r))if(!(a==="children"||a==="key")&&a!=="ref"&&!(a.startsWith("on")&&typeof c=="function")){if(a==="innerHTML"){s=String(c??"");continue}if(a==="class"||a==="className"){let f=qr(c);f&&i.push(` class="${Fe(f)}"`);continue}if(a==="style"&&c&&typeof c=="object"){i.push(` style="${Fe(Gr(c))}"`);continue}if(En.has(a)){i.push(` ${a}="${c?"true":"false"}"`);continue}if(c===!0){i.push(` ${a}`);continue}c===!1||c==null||i.push(` ${a}="${Fe(String(c))}"`)}let l=i.join(""),d=Yr.has(o);if(zr.has(o))return`<${o}${l}>`;if(s!==null)return`<${o}${l}>${s}</${o}>`;let u=await ue(r.children,n);return d?`<${o}${l}>${u}</${o}>`:`<${o}${l}>${u}</${o}>`}var ii={hole:Xr,text:Jr,arr:ei,portal:ti,frag:ni,comp:oi,native:ri};function Bt(e){return`<script>window.__DATA__=${JSON.stringify(Object.fromEntries(e)).replace(/</g,"\\u003c")};<\/script>`}function Qn(e,n){let t={...e,browser:null,__registry:null,ui:{_rootVNodeId:null,render:()=>Promise.resolve(),setMounting:()=>{},endMounting:()=>{}}},o=new Map;return t.data={async get(r,i){let s=o.get(r);if(s&&"value"in s)return s.value;if(s?.promise)return s.promise;if(!i)return;let l=Promise.resolve().then(()=>i()).then(d=>(o.set(r,{value:d}),n.set(r,d),d));return o.set(r,{promise:l}),l},set(r,i){o.set(r,{value:i}),n.set(r,i)},has(r){return o.has(r)}},t}async function si(e,n,t,o={}){let r=o.data??new Map,i=Qn(t??{},r),s=Pe(e,n??{});return ue(s,i)}async function li(e,n){let t=new Map,r=Qn({params:{},query:{}},t),i=n.url.split("?")[0].split("#")[0],s=e.match(i);r.params=s.params,r.query=Object.fromEntries(new URLSearchParams(n.url.split("?")[1]??""));let l=new URL(n.url.startsWith("http")?n.url:`http://localhost${n.url.startsWith("/")?n.url:"/"+n.url}`),d=await e.execute(l,r,i),u=await ue(d,r),a=Bt(t),c=s.title??n.title??"",f=n.rootId??"root",p=(n.styles??[]).map(g=>` <link rel="stylesheet" href="${g}">`).join(`
8
+ `))a.startsWith("event: ")?d=a.slice(7):a.startsWith("data: ")&&(u+=a.slice(6));if(u)try{yield{name:d,data:JSON.parse(u)}}catch{}}}}finally{n.releaseLock()}}function Ar(e,n,t){t&&(e.length>=1e3&&e.shift(),e.push(n))}function Ir(e){return e===401||e===403?"auth_failed":e===429?"rate_limited":e>=500?"provider_error":"invalid_request"}function Lr(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`trace-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function Xn(e,n){let t={messages:[],input:"",streaming:!1,error:null,usage:null,step:null},o=new Set,i=jt(t,Wt,n,()=>{for(let l of[...o])l()});Object.assign(t,i),t.subscribe=l=>(o.add(l),()=>{o.delete(l)});let s=e.selfId();if(s){let l=e.onUnmount(d=>{d===s&&(i.dispose(),l())})}return t}function Qn(e,n){let t=e.selfId(),o;return t&&(o=n.subscribe(()=>e.render([t])),e.onUnmount(()=>o?.())),n}function pn(e){let n=e.registry??ye(),t={_selfId:"_wf_root",_mounting:!1,_ctxVersion:0,_rootVNodeId:null},o={browser:e.browser,__registry:n};o.app={navigate:y=>e.browser.navigate(y)};let r=e.renderer??ln({registry:n,ctx:o,rootEl:e.root,onError:e.onError}),i=Mt(y=>{for(let v of y)r.render([v])}),s=new Map,{popupTrackers:l,scrollTrackers:d,ensurePopupListeners:u,destroyPopupListeners:a,cleanupTrackers:c}=i;nn(n,y=>{c(y),l.has(y)&&l.delete(y)});let f=new Set,p=new Map,m=new Map,g=new Map,h=y=>({selfId:()=>{let v=y?._selfVNode?._id??y?._selfId;return typeof v=="string"?v:void 0},render:v=>r.render(v),browser:e.browser,onUnmount:v=>nn(n,v),registry:n,mediaRegistry:s,popupTrackers:l,scrollTrackers:d,isMounting:()=>t._mounting===!0,warned:f,uncontrolledValues:p,inputStates:m,openStates:g,ensurePopupListeners:u}),w=!1;return t.render=function(y){if(y==null){let v=this._selfId!=="_wf_root"&&this._selfId?this._selfId:t._rootVNodeId;return v?r.render([v]):(w||(w=!0,console.warn("[weifuwu] render() \u65E0\u53C2\u4F46\u65E0\u6E32\u67D3\u76EE\u6807\uFF1A\u9875\u9762\u6839\u662F native vnode\uFF08UIHandler \u76F4\u63A5\u8FD4\u56DE vnode \u7684\u9875\u9762\u5F62\u6001\uFF09\u3002\u6539\u7528 async \u7EC4\u4EF6\u5F62\u6001\uFF08const Page: Component = async ... => (props) => ...\uFF09\u6216 createStore + useExternal \u5171\u4EAB\u72B6\u6001\u3002")),Promise.resolve())}return r.render(y)},t.setMounting=y=>{t._mounting=y},t.endMounting=()=>{t._mounting=!1},t.bumpCtxVersion=()=>{t._ctxVersion=(t._ctxVersion??0)+1},t.selfId=function(y){if(typeof y!="string"||!y)throw new Error(`[weifuwu] selfId requires a non-empty string, got ${typeof y}`);if(n.idRegistry.has(y))throw new Error(`[weifuwu] Duplicate component ID: "${y}". Each component must have a unique custom ID.`);let v=this._selfVNode;v&&(v._customId=y,n.idRegistry.set(y,v))},t.onUnmount=function(y){let v=this?._selfVNode?._id??this?._selfId;if(v)return nn(n,b=>{b===v&&y()})},t.useChat=function(y){return Xn(h(this),y)},t.useMedia=function(y,v){return Un(h(this),y,v)},t.useBreakpoint=function(y,v){return $n(h(this),y,v)},t.usePopupPosition=function(y){return fn(h(this),y)},t.useHoverCapable=function(){return $e(h(this))},t.useStableRef=function(y,v){return Ln(h(this),y,v)},t.useVisualViewport=function(){return Dn(h(this))},t.usePopup=function(y){return zn(h(this),y)},t.useLongPress=function(y){return Hn(h(this),y)},t.useInView=function(y){return jn(h(this),y)},t.useScrollPosition=function(y){return Wn(h(this),y)},t.useAsync=function(y){return Bn(h(this),y)},t.useControlled=function(y){return un(h(this),y)},t.useControlledInput=function(y){return Fn(h(this),y)},t.useOpen=function(y){return Yn(h(this),y)},t.usePresence=function(y){return De(h(this),y)},t.useGlobalKey=function(y){return Kn(h(this),y)},t.useDrag=function(y){return qn(h(this),y)},t.useDragDrop=function(y){return Gn(h(this),y)},t.useExternal=function(y){return Qn(h(this),y)},t.useReducedMotion=function(){return dn(h(this))},t.useAnimationEnd=function(y,v){return Mn(h(this),y,v)},t.useTween=function(y,v){return On(h(this),y,v)},t.destroyPopupListeners=a,o.ui=t,{ctx:o,registry:n,renderer:r,rootUi:t,destroyPopupListeners:a}}function Mr(e){let{ctx:n,registry:t,renderer:o}=pn(e);return At({root:e.root,browser:e.browser,ctx:n,registry:t,renderer:o,onError:e.onError})}var Hr=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);function We(e){e.node=e.node?e.node.nextSibling:null}function Or(e,n){e.node&&e.node.parentNode?e.node.parentNode.insertBefore(n,e.node):e.parent.appendChild(n)}function Ur(e,n){e.node&&e.node.parentNode?(e.node.parentNode.replaceChild(n,e.node),We(e)):e.parent.appendChild(n)}function $r(e,n){for(let[t,o]of Object.entries(n))t==="children"||t==="key"||t==="innerHTML"||re(e,t,o)}function Fe(e,n,t){return Dr[O(e)](e,n,t)}var Dr={hole:()=>null,text:jr,arr:Wr,portal:Ft,frag:Ft,comp:Fr,native:Br};function jr(e,n,t){let o=n.browser??x(),r=String(e);if(t.node&&t.node.nodeType===3)return t.node.textContent!==r&&(t.node.textContent=r),We(t),t.node;let i=o.createTextNode(r);return Or(t,i),i}function Wr(e,n,t){let o=null;for(let r of e){let i=Fe(r,n,t);i!=null&&!o&&(o=i)}return o}function Ft(e,n,t){let r=e.props?.children,i=r==null?[]:Array.isArray(r)?r:[r],s=null;for(let l of i){let d=Fe(l,n,t);d!=null&&!s&&(s=d)}return s}function Fr(e,n,t){let o=e,r=o._child;if(r==null){if(typeof o._render!="function")throw new Error(`[vdom2] component ${R(o.type)} not built before hydration`);for(o._child=null;t.node&&t.node.nodeType===8&&t.node.nodeValue?.startsWith("wf-hole:");)We(t);return null}let i=Fe(r,n,t);return o._refNode||(o._refNode=i),i}function Br(e,n,t){let o=n.browser??x(),r=e,i=r.type,s=r.props??{};for(;t.node&&t.node.nodeType===8&&t.node.nodeValue?.startsWith("wf-hole:");)We(t);let l;if(t.node&&t.node.nodeType===1&&t.node.tagName.toLowerCase()===i.toLowerCase()?(l=t.node,We(t)):(l=Hr.has(i)?o.createElementNS("http://www.w3.org/2000/svg",i):o.createElement(i),Ur(t,l)),r.el=l,$r(l,s),!("innerHTML"in s)){let d={parent:l,node:l.firstChild},u=(Array.isArray(s.children)?s.children:[s.children]).flat(1/0);for(let a of u){let c=Fe(a,n,d);if(c!=null&&c.parentNode!==l&&l.appendChild(c),a&&typeof a=="object"&&!Array.isArray(a)&&k(a)){let f=a;f._parentNode||(f._parentNode=l,f._refNode=c)}}for(;d.node;){let a=d.node;d.node=a.nextSibling,a.parentNode?.removeChild(a)}}return"value"in s&&l instanceof HTMLSelectElement&&(l.value=String(s.value??"")),l}async function Zn(e,n,t){let o=t.__registry;await J(n,t,null,o);let r={parent:e,node:e.firstChild};for(Fe(n,t,r);r.node;){let i=r.node;r.node=i.nextSibling,i.parentNode?.removeChild(i)}}var Kr={idle:{NAVIGATE_START:"navigating"},navigating:{NAVIGATE_DONE:"settled",NAVIGATE_ERROR:"idle"},settled:{NAVIGATE_START:"navigating"}};function Bt(){let e="idle",n=(t,o)=>{let r=Kr[e]?.[t]??null;return r==null?(P({session:"",machine:"route",nodeId:null,component:null,from:e,event:t,to:"?",payload:{path:o},level:"debug",ts:Date.now()}),e):(P({session:"",machine:"route",nodeId:null,component:null,from:e,event:t,to:r,payload:{path:o},level:"debug",ts:Date.now()}),e=r,r)};return{get state(){return e},navigateStart:t=>{n("NAVIGATE_START",t)},navigateDone:t=>{n("NAVIGATE_DONE",t)},navigateError:(t,o)=>{n("NAVIGATE_ERROR",t)}}}function qr(e,n){let t=x(),o=typeof n.root=="string"?t.query(n.root):n.root;if(!o)throw new Error(`uiServe: root not found: ${n.root}`);let r=o,i=!!n.hydrate;!i&&!n.loading&&(r.innerHTML="");try{(new URLSearchParams(globalThis?.location?.search??"").get("vdom_debug")==="1"||globalThis?.localStorage?.getItem?.("__WF_VDOM_DEBUG")==="1")&&(globalThis.__WF_VDOM_DEBUG=!0,console.log("[weifuwu] vdom debug \u5DF2\u5F00\u542F\uFF08?vdom_debug=1\uFF09")),Vn()}catch{}try{if(new URLSearchParams(globalThis?.location?.search??"").get("wf_reflow")==="1"||globalThis?.localStorage?.getItem?.("__WF_REFLOW_DEBUG")==="1"){globalThis.__WF_REFLOW_DEBUG=!0,console.log("[weifuwu] reflow debug \u5DF2\u5F00\u542F\uFF08?wf_reflow=1\u2014\u2014\u5E03\u5C40\u8BFB\u53D6\u8FFD\u8E2A\uFF09");let j=(L,$)=>{let K=typeof document<"u"?document.styleSheets?.length??0:-1,se=$?.tagName?`<${$.tagName}${$.id?"#"+$.id:""}${$.className?"."+String($.className).split(" ")[0]:""}>`:"",Ke=(new Error().stack||"").split(`
9
+ `).slice(2,5).map(le=>le.trim().split("/").pop()?.slice(0,80)).join(" \u2190 ");console.log(`[wf-reflow] ${L}${se} styles=${K}${K===0?" \u26A0\uFE0F\u6837\u5F0F\u672A\u52A0\u8F7D\uFF08\u5F3A\u5236\u6392\u7248\u573A\u666F\uFF09":""} :: ${Ke}`)},X=Element.prototype.getBoundingClientRect;Element.prototype.getBoundingClientRect=function(...L){return j("rect",this),X.apply(this,L)};for(let L of["offsetWidth","offsetHeight","offsetTop","offsetLeft","clientWidth","clientHeight","scrollTop","scrollHeight"]){let $=Object.getOwnPropertyDescriptor(Element.prototype,L);if($?.get){let K=$.get;Object.defineProperty(Element.prototype,L,{configurable:!0,enumerable:!0,get(){return j(L,this),K.call(this)}})}}}}catch{}let{ctx:s,registry:l,renderer:d,rootUi:u,destroyPopupListeners:a}=pn({browser:t,root:r}),c=new Map,f=globalThis.__DATA__??window.__DATA__;if(f&&typeof f=="object")for(let[C,T]of Object.entries(f))c.set(C,{value:T});s.data={async get(C,T){let j=c.get(C);if(j&&"value"in j)return j.value;if(j?.promise)return j.promise;if(!T)return;let X=Promise.resolve().then(()=>T()).then(L=>(c.set(C,{value:L}),L));return c.set(C,{promise:X}),X},set(C,T){c.set(C,{value:T})},has(C){return c.has(C)}},s.route={params:{},query:{},path:""};let p=null,m="",g=0,h={},w,y=new Promise(C=>{w=C}),v=!1,b=Bt();async function I(C,T){let j=++g,X=C.indexOf("?"),L=X>=0?C.slice(0,X):C,$=X>=0?C.slice(X):"",K={};if($)for(let[N,V]of new URLSearchParams($))K[N]=V;JSON.stringify(K)!==JSON.stringify(h)&&(s.ui.bumpCtxVersion?.(),h=K);let se={pathname:L,search:$,query:K};s.route={params:{},query:K,path:L},b.navigateStart(L);let Ke=Qe(T?"initial":"nav"),le;try{le=await e.execute(se,s,L)}catch(N){b.navigateError(C,N),le=he("div",{class:"ui-dom-error"},`\u9875\u9762\u6E32\u67D3\u5931\u8D25: ${N?.message??String(N)}`)}if(v||j!==g){Ae();return}let be=E("mount"),ge=be?ct("nav"):"";be&&_("mount","info",ge,`route path=${C} initial=${T}`);let ae;try{ae=await J(le,s,p,l)}catch(N){ae=he("div",{class:"ui-dom-error"},`\u7EC4\u4EF6\u6E32\u67D3\u5931\u8D25: ${N?.message??String(N)}`)}if(!(v||j!==g)){if(T)if(i)await Zn(r,ae,s),E("mount")&&_("mount","debug",ge,`hydrate done=${r.childNodes.length}`);else{r.innerHTML="";let N=U(ae,s,t);E("mount")&&_("mount","debug",ge,`first-render node=${N?.nodeName??"null"} fragKids=${N?.nodeType===11?Array.from(N.childNodes).length:"-"}`),N!=null&&r.appendChild(N),E("mount")&&_("mount","debug",ge,`root-fill done=${r.childNodes.length} first=${r.firstChild?.nodeName}`)}else if(p!==void 0){let N=p;p=ae;let V=N,W=ze(V)?V.el??V._refNode:V._refNode;ne(r,W,N,ae,{browser:t,registry:l,ctxVersion:s?.ui?._ctxVersion??0})}p=ae,m=C,u._rootVNodeId=ae?._id,b.navigateDone(C),Ae()}}let B=t.pathname();I(B,!0).finally(()=>{v||w()}),pt(()=>p),st(),Nt();let D=()=>{let C=typeof window<"u"?window.location.pathname+window.location.search:t.pathname();I(C,!1)};return t.addEventListener("popstate",D),{close(){v=!0,t.removeEventListener("popstate",D),a(),l.idRegistry.clear()},ready:y,ctx:s}}function Be(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gr(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(Boolean).join(" "):e&&typeof e=="object"?Object.entries(e).filter(([,n])=>n).map(([n])=>n).join(" "):""}function zr(e){return Object.entries(e).filter(([,n])=>n!=null&&n!==!1).map(([n,t])=>`${n}:${typeof t=="number"?t:String(t)}`).join(";")}var Yr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Jr=new Set(["svg","path","circle","rect","line","polyline","polygon","g","text","defs","use","clipPath"]);async function pe(e,n){return si[O(e)](e,n)}async function Xr(e,n){return""}async function Qr(e,n){return Be(String(e))}function Zr(e){return e==null||typeof e=="boolean"?"hole":Array.isArray(e)?"arr":"vnode"}var ei={hole:e=>Promise.resolve(`<!--${F({type:"hole",value:e,key:null,id:null,fid:null})}-->`),arr:async(e,n,t,o)=>{let r=await pe(e,{...n,_fidPath:o});return`<!--${F({type:"fragment-start",key:String(t),id:null,fid:o})}-->${r}<!--${F({type:"fragment-end",key:String(t),id:null,fid:o})}-->`},vnode:async(e,n)=>{let t=await pe(e,n);return t===""?`<!--${F({type:"hole",value:null,key:null,id:null,fid:null})}-->`:t}};async function ni(e,n){let t=e;ht(t);let o=n._fidPath;return(await Promise.all(t.map(async(i,s)=>{let l=o!=null?`${o}-${s}`:String(s);return ei[Zr(i)](i,n,s,l)}))).join("")}async function ti(e,n){let t=e,o=n._fidPath??null,r=await pe(t.props?.children,{...n,_fidPath:o??void 0});return`<!--${F({type:"fragment-start",key:null,id:null,fid:o})}-->${r}<!--${F({type:"fragment-end",key:null,id:null,fid:o})}-->`}async function oi(e,n){return pe(e.props?.children,n)}async function ri(e,n){let t=e,o=Object.create(n);delete o._fidPath;let r=await t.type(t.props??{},o);if(typeof r!="function")throw new Error(`Component ${R(t.type)} must return a render function. Use (init_props, ctx) => (props) => VNode pattern.`);let i=await r(t.props??{});if(t.key!=null&&i!=null&&typeof i=="object")if(Array.isArray(i))for(let s of i)s!=null&&typeof s=="object"&&!Array.isArray(s)&&(s.key=t.key);else i.key=t.key;return pe(i,o)}async function ii(e,n){let t=e,o=t.type,r=t.props??{},i=[],s=null;t.key!=null&&i.push(` data-wf-key="${Be(String(t.key))}"`);for(let[a,c]of Object.entries(r))if(!(a==="children"||a==="key")&&a!=="ref"&&!(a.startsWith("on")&&typeof c=="function")){if(a==="innerHTML"){s=String(c??"");continue}if(a==="class"||a==="className"){let f=Gr(c);f&&i.push(` class="${Be(f)}"`);continue}if(a==="style"&&c&&typeof c=="object"){i.push(` style="${Be(zr(c))}"`);continue}if(_n.has(a)){i.push(` ${a}="${c?"true":"false"}"`);continue}if(c===!0){i.push(` ${a}`);continue}c===!1||c==null||i.push(` ${a}="${Be(String(c))}"`)}let l=i.join(""),d=Jr.has(o);if(Yr.has(o))return`<${o}${l}>`;if(s!==null)return`<${o}${l}>${s}</${o}>`;let u=await pe(r.children,n);return d?`<${o}${l}>${u}</${o}>`:`<${o}${l}>${u}</${o}>`}var si={hole:Xr,text:Qr,arr:ni,portal:oi,frag:ti,comp:ri,native:ii};function Kt(e){return`<script>window.__DATA__=${JSON.stringify(Object.fromEntries(e)).replace(/</g,"\\u003c")};<\/script>`}function et(e,n){let t={...e,browser:null,__registry:null,ui:{_rootVNodeId:null,render:()=>Promise.resolve(),setMounting:()=>{},endMounting:()=>{}}},o=new Map;return t.data={async get(r,i){let s=o.get(r);if(s&&"value"in s)return s.value;if(s?.promise)return s.promise;if(!i)return;let l=Promise.resolve().then(()=>i()).then(d=>(o.set(r,{value:d}),n.set(r,d),d));return o.set(r,{promise:l}),l},set(r,i){o.set(r,{value:i}),n.set(r,i)},has(r){return o.has(r)}},t}async function li(e,n,t,o={}){let r=o.data??new Map,i=et(t??{},r),s=Se(e,n??{});return pe(s,i)}async function ai(e,n){let t=new Map,r=et({params:{},query:{}},t),i=n.url.split("?")[0].split("#")[0],s=e.match(i);r.params=s.params,r.query=Object.fromEntries(new URLSearchParams(n.url.split("?")[1]??""));let l=new URL(n.url.startsWith("http")?n.url:`http://localhost${n.url.startsWith("/")?n.url:"/"+n.url}`),d=await e.execute(l,r,i),u=await pe(d,r),a=Kt(t),c=s.title??n.title??"",f=n.rootId??"root",p=(n.styles??[]).map(g=>` <link rel="stylesheet" href="${g}">`).join(`
10
10
  `),m=`<!DOCTYPE html>
11
11
  <html lang="${n.lang??"zh-CN"}">
12
12
  <head>
@@ -20,4 +20,4 @@ function zt(e){let n=[],t=(e||"/").replace(/:(\w+)/g,(o,r)=>(n.push(r),"([^/]+)"
20
20
  ${a}
21
21
  <script src="/app.js"><\/script>
22
22
  </body>
23
- </html>`;return{html:u,dataScript:a,page:m}}function ai(e){let n={...e},t=new Set,o=()=>{for(let r of[...t])r()};return{state:n,subscribe(r){return t.add(r),()=>{t.delete(r)}},set(r){Object.assign(n,r),o()},update(r){r(n),o()},notify:o}}export{J as Fragment,K as Portal,mn as UIRouter,Jt as animateOut,Qt as api,no as auth,Y as buildVNode,V as createClientBrowser,Ge as createPortal,rn as createRenderer,Qn as createSsrContext,ai as createStore,cn as createVdomContext,ge as h,Jn as hydrateVNode,yn as jsx,Xt as jsxDEV,Yt as jsxs,Lr as mountRoot,ee as patchValue,D as renderValue,Bt as serializeData,li as ssrPage,si as ssrToString,Kr as uiServe,to as ws};
23
+ </html>`;return{html:u,dataScript:a,page:m}}function di(e){let n={...e},t=new Set,o=()=>{for(let r of[...t])r()};return{state:n,subscribe(r){return t.add(r),()=>{t.delete(r)}},set(r){Object.assign(n,r),o()},update(r){r(n),o()},notify:o}}export{Q as Fragment,q as Portal,gn as UIRouter,Qt as animateOut,Zt as api,to as auth,J as buildVNode,x as createClientBrowser,Ye as createPortal,ln as createRenderer,et as createSsrContext,di as createStore,pn as createVdomContext,he as h,Zn as hydrateVNode,hn as jsx,Xt as jsxDEV,Jt as jsxs,Mr as mountRoot,ne as patchValue,U as renderValue,Kt as serializeData,ai as ssrPage,li as ssrToString,qr as uiServe,oo as ws};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.81.3",
4
+ "version": "0.81.4",
5
5
  "description": "AI SaaS framework — (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": {