@ttmg/cli 0.4.9-alpha.0 → 0.4.9-alpha.1

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.
Files changed (61) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/package.json +1 -1
  3. package/dist/public/assets/{Card-BC5ydRHh.js → Card-CEOgyxVl.js} +1 -1
  4. package/dist/public/assets/{Detail-DPCqXgFa.js → Detail-DT0QBFHQ.js} +1 -1
  5. package/dist/public/assets/Detail-DT0QBFHQ.js.br +0 -0
  6. package/dist/public/assets/{MonetizationMode-BGXVb7wG.js → MonetizationMode-DPXr6POH.js} +1 -1
  7. package/dist/public/assets/{MonetizationModeSummary-LeYQ02Tv.js → MonetizationModeSummary-CPfEj9Mb.js} +1 -1
  8. package/dist/public/assets/{SectionHeader-BQDU_6TX.js → SectionHeader-B4enohBu.js} +1 -1
  9. package/dist/public/assets/{baseForm-dqhahTXM.js → baseForm-CIfNsMWn.js} +1 -1
  10. package/dist/public/assets/baseForm-CIfNsMWn.js.br +0 -0
  11. package/dist/public/assets/{compass-DfWJoWl3.js → compass-CBzuVE9n.js} +1 -1
  12. package/dist/public/assets/{index-xPCWyPvk.js → index-27xbd6yG.js} +1 -1
  13. package/dist/public/assets/{index-wGfWSqnF.js → index-BPawWJpJ.js} +1 -1
  14. package/dist/public/assets/{index-BqslPc39.js → index-BZHcW0UM.js} +1 -1
  15. package/dist/public/assets/{index-DRKEUX85.js → index-Bm53M3zm.js} +1 -1
  16. package/dist/public/assets/index-Bm53M3zm.js.br +0 -0
  17. package/dist/public/assets/{index-CbUw1wBM.js → index-BpxGSsrf.js} +1 -1
  18. package/dist/public/assets/index-BpxGSsrf.js.br +0 -0
  19. package/dist/public/assets/{index-BAmVtXgk.js → index-BwTml-YL.js} +1 -1
  20. package/dist/public/assets/index-BwTml-YL.js.br +0 -0
  21. package/dist/public/assets/{index-CDxeVVlI.js → index-ByC8p3X-.js} +1 -1
  22. package/dist/public/assets/{index-BBHaV7vS.js → index-BzqMK93o.js} +1 -1
  23. package/dist/public/assets/{index-_IVh5FZw.js → index-C6wDirYQ.js} +1 -1
  24. package/dist/public/assets/{index-CSOt669g.js → index-CD12YHDF.js} +1 -1
  25. package/dist/public/assets/{index-ejkbZVVo.js → index-CIA6EIIH.js} +1 -1
  26. package/dist/public/assets/{index-C947zURI.js → index-CMcI4qIc.js} +1 -1
  27. package/dist/public/assets/index-CMcI4qIc.js.br +0 -0
  28. package/dist/public/assets/{index-BIkx7MZA.js → index-CNakhX9w.js} +1 -1
  29. package/dist/public/assets/index-CNakhX9w.js.br +0 -0
  30. package/dist/public/assets/{index-CC4YJwDI.js → index-CfRDRy52.js} +1 -1
  31. package/dist/public/assets/{index-DcpswdR4.js → index-Ch-x1uku.js} +6 -6
  32. package/dist/public/assets/index-Ch-x1uku.js.br +0 -0
  33. package/dist/public/assets/{index-BkbwTqmH.js → index-D4KyBBg8.js} +1 -1
  34. package/dist/public/assets/{index-BhTApVX6.js → index-DFMqDPCZ.js} +1 -1
  35. package/dist/public/assets/{index-CF4RJ3VA.js → index-DhE2eF0W.js} +1 -1
  36. package/dist/public/assets/{index-BmS73Skw.js → index-DmbSWsd7.js} +1 -1
  37. package/dist/public/assets/{index-FKgvaTum.js → index-DxhUOzZL.js} +1 -1
  38. package/dist/public/assets/index-DxhUOzZL.js.br +0 -0
  39. package/dist/public/assets/{index-Ba7wrRXG.js → index-ZIcS8_nS.js} +1 -1
  40. package/dist/public/assets/index-ZIcS8_nS.js.br +0 -0
  41. package/dist/public/assets/{index-DpCdlpoj.js → index-Zis8_t5U.js} +1 -1
  42. package/dist/public/assets/{index-C0-lsmcf.js → index-aDeXSmT-.js} +1 -1
  43. package/dist/public/assets/{index-DS-Ah-pZ.js → index-bEn3X2ep.js} +1 -1
  44. package/dist/public/assets/{index-3IxvKwO3.js → index-vrpJrBiZ.js} +1 -1
  45. package/dist/public/assets/{layers-kzl3dc3j.js → layers-BNlp0M4b.js} +1 -1
  46. package/dist/public/assets/{list-checks-Ce0l0Ylc.js → list-checks-D93xMCZ8.js} +1 -1
  47. package/dist/public/assets/{sparkles-Dnyv9lnL.js → sparkles-BLvO5p7R.js} +1 -1
  48. package/dist/public/assets/{triangle-alert-BaPLcm_f.js → triangle-alert-BsPYYN9a.js} +1 -1
  49. package/dist/public/assets/{zap-DyzOTCOX.js → zap-BXy9vjyA.js} +1 -1
  50. package/dist/public/index.html +1 -1
  51. package/package.json +1 -1
  52. package/dist/public/assets/Detail-DPCqXgFa.js.br +0 -0
  53. package/dist/public/assets/baseForm-dqhahTXM.js.br +0 -0
  54. package/dist/public/assets/index-BAmVtXgk.js.br +0 -0
  55. package/dist/public/assets/index-BIkx7MZA.js.br +0 -0
  56. package/dist/public/assets/index-Ba7wrRXG.js.br +0 -0
  57. package/dist/public/assets/index-C947zURI.js.br +0 -0
  58. package/dist/public/assets/index-CbUw1wBM.js.br +0 -0
  59. package/dist/public/assets/index-DRKEUX85.js.br +0 -0
  60. package/dist/public/assets/index-DcpswdR4.js.br +0 -0
  61. package/dist/public/assets/index-FKgvaTum.js.br +0 -0
@@ -1 +1 @@
1
- import{w as _,t as N,ac as M,y as k,R as c,z as E,ad as A,V as W,E as z,W as L,m as F,n as B,O as X,H,J as d,K as D,M as T,r as x,ae as S,af as R,ag as q}from"./index-DcpswdR4.js";class w extends _{constructor(n){super(Object.assign(Object.assign({},w.defaultAdapter),n)),this.handleMouseInSideChange=e=>{this._adapter.handleMouseInSideChange(e)},this.getInputWrapperRect=()=>this._adapter.getInputWrapperRect()}hasToast(n){return this._adapter.getState("list").map(t=>{let{id:a}=t;return a}).includes(n)}addToast(n){const e=this._adapter.getState("list");e.push(n),this._adapter.updateToast(e,[],[])}updateToast(n,e){let t=this._adapter.getState("list");t=t.map(s=>s.id===n?Object.assign(Object.assign({},s),e):s);const a=t.filter(s=>s.id===n);this._adapter.updateToast(t,[],a)}removeToast(n){let e=this._adapter.getState("list");const t=[];e=e.filter(a=>a.id===n?(t.push(a),!1):!0),this._adapter.updateToast(e,t,[])}destroyAll(){const n=this._adapter.getState("list");n.length>0&&this._adapter.updateToast([],n,[])}}const P=`${N}-toast`,b={PREFIX:P,WRAPPER:`${P}-wrapper`},y={types:["warning","success","info","error","default"],themes:["normal","light"],directions:["ltr","rtl"]},U={duration:3};class $ extends _{constructor(n){super(Object.assign(Object.assign({},$.defaultAdapter),n)),this._timer=null,this._id=null}init(){this.startCloseTimer_(),this._id=this._adapter.getProp("id")}destroy(){this.clearCloseTimer_()}startCloseTimer_(){const n=this._adapter.getProp("duration");n&&M(n)&&(this._timer=setTimeout(()=>{this.close()},n*1e3))}close(n){n&&n.stopPropagation(),this._adapter.notifyWrapperToRemove(this._id),this._adapter.notifyClose()}clearCloseTimer_(){this._timer&&(clearTimeout(this._timer),this._timer=null)}restartCloseTimer(){this.clearCloseTimer_(),this.startCloseTimer_()}}const f=b.PREFIX;let g=class extends k{constructor(n){super(n),this.toastEle=c.createRef(),this.clearCloseTimer=()=>{this.foundation.clearCloseTimer_()},this.startCloseTimer=()=>{this.foundation.startCloseTimer_()},this.restartCloseTimer=()=>{this.foundation.restartCloseTimer()},this.state={},this.foundation=new $(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{notifyWrapperToRemove:n=>{this.props.close(n)},notifyClose:()=>{this.props.onClose()}})}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}close(n){this.foundation.close(n)}renderIcon(){const{type:n,icon:e}=this.props,a={warning:c.createElement(X,null),success:c.createElement(B,null),info:c.createElement(F,null),error:c.createElement(L,null)}[n],s="large",i=E(`${f}-icon`,`${f}-icon-${n}`);return e?A(e)?c.cloneElement(e,{size:s,className:`${f}-icon`}):e:n&&a?c.cloneElement(a,{size:s,className:i}):null}render(){const{content:n,type:e,theme:t,showClose:a,textMaxWidth:s,className:i,style:r}=this.props,u=this.props.direction||this.context.direction,m=E(f,i,{[`${f}-${e}`]:!0,[`${f}-${t}`]:t==="light",[`${f}-rtl`]:u==="rtl"}),p={};p.maxWidth=s;const h="borderless",I="small",v=this.props.positionInList?this.props.positionInList.length-this.props.positionInList.index-1:0,C=c.createElement("div",{ref:this.toastEle,role:"alert","aria-label":`${e||"default"} type`,className:m,style:Object.assign(Object.assign({},r),{transform:`translate3d(0,0,${v*-10}px)`}),onMouseEnter:this.clearCloseTimer,onMouseLeave:this.startCloseTimer,onAnimationStart:this.props.onAnimationStart,onAnimationEnd:this.props.onAnimationEnd},c.createElement("div",{className:`${f}-content`},this.renderIcon(),c.createElement("span",{className:`${f}-content-text`,style:p,"x-semi-prop":"content"},n),a&&c.createElement("div",{className:`${f}-close-button`},c.createElement(W,{onClick:j=>this.close(j),type:"tertiary",icon:c.createElement(z,{"x-semi-prop":"icon"}),theme:h,size:I}))));if(this.props.stack){const j=this.props.stackExpanded&&this.toastEle.current&&getComputedStyle(this.toastEle.current).height||0;return c.createElement("div",{className:`${f}-zero-height-wrapper`,style:{height:j}},C)}else return C}};g.contextType=H;g.propTypes={onClose:d.func,content:d.node,close:d.func,duration:d.number,theme:d.oneOf(y.themes),type:d.oneOf(y.types),textMaxWidth:d.oneOfType([d.string,d.number]),style:d.object,className:d.string,showClose:d.bool,stack:d.bool,stackExpanded:d.bool,icon:d.node,direction:d.oneOf(y.directions)};g.__SemiComponentName__="Toast";g.defaultProps=D(g.__SemiComponentName__,{onClose:T,content:"",close:T,duration:U.duration,textMaxWidth:450,showClose:!0,stack:!1,stackExpanded:!1,theme:"normal"});var V=function(l,n){var e={};for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&n.indexOf(t)<0&&(e[t]=l[t]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(l);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(l,t[a])&&(e[t[a]]=l[t[a]]);return e};const G=(l,n)=>{var{afterClose:e}=l,t=V(l,["afterClose"]);const[a,s]=x.useState(!0),i=()=>{s(!1)};return c.useImperativeHandle(n,()=>({close:()=>{s(!1)}})),x.useEffect(()=>{a||e(t.id)},[a]),a?c.createElement(g,Object.assign({},t,{close:i})):null},J=c.forwardRef(G),O={motion:!0,zIndex:1010,duration:3};function K(){const[l,n]=c.useState([]);function e(t,a){return n(s=>[{element:t,config:a},...s]),s=>{n(i=>i.filter(r=>{let{config:u}=r;return u.id!==s}))}}return[l,e]}function Q(){const[l,n]=K(),e=x.useRef(new Map),t=s=>{const i=S("semi_toast_"),r=Object.assign(Object.assign({},s),{id:i});let u;const m=c.createElement(J,Object.assign({},r,{key:i,afterClose:p=>u(p),ref:p=>{var h;e.current.set(i,{close:(h=p?.close)!==null&&h!==void 0?h:T})}}));return u=n(m,Object.assign({},r)),i},a=s=>{var i;const{close:r}=(i=e.current.get(s))!==null&&i!==void 0?i:{};r?.()};return[{success:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"success"})),info:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"info"})),error:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"error"})),warning:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"warning"})),open:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"default"})),close:s=>a(s)},c.createElement(c.Fragment,null,Array.isArray(l)&&l.length?c.createElement(c.Fragment,null,l.map(s=>s.element)):null)]}const Y=()=>{var l;return l=class o extends k{constructor(e){super(e),this.stack=!1,this.innerWrapperRef=c.createRef(),this.handleMouseEnter=t=>{this.stack&&this.foundation.handleMouseInSideChange(!0)},this.handleMouseLeave=t=>{var a;this.stack&&!((a=this.foundation.getInputWrapperRect())===null||a===void 0)&&a.height&&this.foundation.handleMouseInSideChange(!1)},this.state={list:[],removedItems:[],updatedItems:[],mouseInSide:!1},this.foundation=new w(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{updateToast:(e,t,a)=>{this.setState({list:e,removedItems:t,updatedItems:a})},handleMouseInSideChange:e=>{this.setState({mouseInSide:e})},getInputWrapperRect:()=>{var e;return(e=this.innerWrapperRef.current)===null||e===void 0?void 0:e.getBoundingClientRect()}})}static create(e){var t;const a=(t=e.id)!==null&&t!==void 0?t:S("toast");if(o.ref){const s=document.querySelector(`#${this.wrapperId}`);["top","left","bottom","right"].map(i=>{i in e&&(s.style[i]=typeof e[i]=="number"?`${e[i]}px`:e[i])}),!!e.stack!==o.ref.stack&&(o.ref.stack=!!e.stack),o.ref.has(a)?o.ref.update(a,Object.assign(Object.assign({},e),{id:a})):o.ref.add(Object.assign(Object.assign({},e),{id:a}))}else{const s=document.createElement("div");this.wrapperId||(this.wrapperId=S("toast-wrapper").slice(0,26)),s.className=b.WRAPPER,s.id=this.wrapperId,s.style.zIndex=String(typeof e.zIndex=="number"?e.zIndex:o.defaultOpts.zIndex),["top","left","bottom","right"].map(i=>{if(i in o.defaultOpts||i in e){const r=e[i]?e[i]:o.defaultOpts[i];s.style[i]=typeof r=="number"?`${r}px`:r}}),o.defaultOpts.getPopupContainer?o.defaultOpts.getPopupContainer().appendChild(s):document.body.appendChild(s),R.render(c.createElement(o,{ref:i=>o.ref=i}),s,()=>{o.ref.add(Object.assign(Object.assign({},e),{id:a})),o.ref.stack=!!e.stack})}return a}static close(e){o.ref&&o.ref.remove(e)}static destroyAll(){if(o.ref){o.ref.destroyAll();const e=document.querySelector(`#${this.wrapperId}`);R.unmountComponentAtNode(e),e&&e.parentNode.removeChild(e),o.ref=null,this.wrapperId=null}}static getWrapperId(){return this.wrapperId}static info(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"info"}))}static warning(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"warning"}))}static error(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"error"}))}static success(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"success"}))}static config(e){["top","left","bottom","right"].forEach(t=>{t in e&&(o.defaultOpts[t]=e[t])}),typeof e.theme=="string"&&y.themes.includes(e.theme)&&(o.defaultOpts.theme=e.theme),typeof e.zIndex=="number"&&(o.defaultOpts.zIndex=e.zIndex),typeof e.duration=="number"&&(o.defaultOpts.duration=e.duration),typeof e.getPopupContainer=="function"&&(o.defaultOpts.getPopupContainer=e.getPopupContainer)}has(e){return this.foundation.hasToast(e)}add(e){return this.foundation.addToast(e)}update(e,t){return this.foundation.updateToast(e,t)}remove(e){return this.foundation.removeToast(e)}destroyAll(){return this.foundation.destroyAll()}render(){let{list:e}=this.state;const{removedItems:t,updatedItems:a}=this.state;e=Array.from(new Set([...e,...t]));const s=a.map(r=>{let{id:u}=r;return u}),i=r=>{var u;!((u=r?.foundation)===null||u===void 0)&&u._id&&s.includes(r.foundation._id)&&r.foundation.restartCloseTimer()};return c.createElement(c.Fragment,null,c.createElement("div",{className:E({[`${b.PREFIX}-innerWrapper`]:!0,[`${b.PREFIX}-innerWrapper-hover`]:this.state.mouseInSide}),ref:this.innerWrapperRef,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},e.map((r,u)=>{const m=t.find(p=>p.id===r.id)!==void 0;return c.createElement(q,{key:r.id,motion:r.motion,animationState:m?"leave":"enter",startClassName:m?`${b.PREFIX}-animation-hide`:`${b.PREFIX}-animation-show`},p=>{let{animationClassName:h,animationEventsNeedBind:I,isAnimating:v}=p;return m&&!v?null:c.createElement(g,Object.assign({},r,{stack:this.stack,stackExpanded:this.state.mouseInSide,positionInList:{length:e.length,index:u},className:E({[r.className]:!!r.className,[h]:!0})},I,{style:Object.assign({},r.style),close:C=>this.remove(C),ref:i}))})})))}},l.defaultOpts={motion:!0,zIndex:1010,content:""},l.propTypes={content:d.node,duration:d.number,onClose:d.func,icon:d.node,direction:d.oneOf(y.directions),stack:d.bool},l.defaultProps={},l};class Z{static create(n){const e=Y();return e.useToast=Q,n&&e.config(n),e}}const se=Z.create();export{se as T};
1
+ import{w as _,t as N,ac as M,y as k,R as c,z as E,ad as A,V as W,E as z,W as L,m as F,n as B,O as X,H,J as d,K as D,M as T,r as x,ae as S,af as R,ag as q}from"./index-Ch-x1uku.js";class w extends _{constructor(n){super(Object.assign(Object.assign({},w.defaultAdapter),n)),this.handleMouseInSideChange=e=>{this._adapter.handleMouseInSideChange(e)},this.getInputWrapperRect=()=>this._adapter.getInputWrapperRect()}hasToast(n){return this._adapter.getState("list").map(t=>{let{id:a}=t;return a}).includes(n)}addToast(n){const e=this._adapter.getState("list");e.push(n),this._adapter.updateToast(e,[],[])}updateToast(n,e){let t=this._adapter.getState("list");t=t.map(s=>s.id===n?Object.assign(Object.assign({},s),e):s);const a=t.filter(s=>s.id===n);this._adapter.updateToast(t,[],a)}removeToast(n){let e=this._adapter.getState("list");const t=[];e=e.filter(a=>a.id===n?(t.push(a),!1):!0),this._adapter.updateToast(e,t,[])}destroyAll(){const n=this._adapter.getState("list");n.length>0&&this._adapter.updateToast([],n,[])}}const P=`${N}-toast`,b={PREFIX:P,WRAPPER:`${P}-wrapper`},y={types:["warning","success","info","error","default"],themes:["normal","light"],directions:["ltr","rtl"]},U={duration:3};class $ extends _{constructor(n){super(Object.assign(Object.assign({},$.defaultAdapter),n)),this._timer=null,this._id=null}init(){this.startCloseTimer_(),this._id=this._adapter.getProp("id")}destroy(){this.clearCloseTimer_()}startCloseTimer_(){const n=this._adapter.getProp("duration");n&&M(n)&&(this._timer=setTimeout(()=>{this.close()},n*1e3))}close(n){n&&n.stopPropagation(),this._adapter.notifyWrapperToRemove(this._id),this._adapter.notifyClose()}clearCloseTimer_(){this._timer&&(clearTimeout(this._timer),this._timer=null)}restartCloseTimer(){this.clearCloseTimer_(),this.startCloseTimer_()}}const f=b.PREFIX;let g=class extends k{constructor(n){super(n),this.toastEle=c.createRef(),this.clearCloseTimer=()=>{this.foundation.clearCloseTimer_()},this.startCloseTimer=()=>{this.foundation.startCloseTimer_()},this.restartCloseTimer=()=>{this.foundation.restartCloseTimer()},this.state={},this.foundation=new $(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{notifyWrapperToRemove:n=>{this.props.close(n)},notifyClose:()=>{this.props.onClose()}})}componentDidMount(){this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}close(n){this.foundation.close(n)}renderIcon(){const{type:n,icon:e}=this.props,a={warning:c.createElement(X,null),success:c.createElement(B,null),info:c.createElement(F,null),error:c.createElement(L,null)}[n],s="large",i=E(`${f}-icon`,`${f}-icon-${n}`);return e?A(e)?c.cloneElement(e,{size:s,className:`${f}-icon`}):e:n&&a?c.cloneElement(a,{size:s,className:i}):null}render(){const{content:n,type:e,theme:t,showClose:a,textMaxWidth:s,className:i,style:r}=this.props,u=this.props.direction||this.context.direction,m=E(f,i,{[`${f}-${e}`]:!0,[`${f}-${t}`]:t==="light",[`${f}-rtl`]:u==="rtl"}),p={};p.maxWidth=s;const h="borderless",I="small",v=this.props.positionInList?this.props.positionInList.length-this.props.positionInList.index-1:0,C=c.createElement("div",{ref:this.toastEle,role:"alert","aria-label":`${e||"default"} type`,className:m,style:Object.assign(Object.assign({},r),{transform:`translate3d(0,0,${v*-10}px)`}),onMouseEnter:this.clearCloseTimer,onMouseLeave:this.startCloseTimer,onAnimationStart:this.props.onAnimationStart,onAnimationEnd:this.props.onAnimationEnd},c.createElement("div",{className:`${f}-content`},this.renderIcon(),c.createElement("span",{className:`${f}-content-text`,style:p,"x-semi-prop":"content"},n),a&&c.createElement("div",{className:`${f}-close-button`},c.createElement(W,{onClick:j=>this.close(j),type:"tertiary",icon:c.createElement(z,{"x-semi-prop":"icon"}),theme:h,size:I}))));if(this.props.stack){const j=this.props.stackExpanded&&this.toastEle.current&&getComputedStyle(this.toastEle.current).height||0;return c.createElement("div",{className:`${f}-zero-height-wrapper`,style:{height:j}},C)}else return C}};g.contextType=H;g.propTypes={onClose:d.func,content:d.node,close:d.func,duration:d.number,theme:d.oneOf(y.themes),type:d.oneOf(y.types),textMaxWidth:d.oneOfType([d.string,d.number]),style:d.object,className:d.string,showClose:d.bool,stack:d.bool,stackExpanded:d.bool,icon:d.node,direction:d.oneOf(y.directions)};g.__SemiComponentName__="Toast";g.defaultProps=D(g.__SemiComponentName__,{onClose:T,content:"",close:T,duration:U.duration,textMaxWidth:450,showClose:!0,stack:!1,stackExpanded:!1,theme:"normal"});var V=function(l,n){var e={};for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&n.indexOf(t)<0&&(e[t]=l[t]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(l);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(l,t[a])&&(e[t[a]]=l[t[a]]);return e};const G=(l,n)=>{var{afterClose:e}=l,t=V(l,["afterClose"]);const[a,s]=x.useState(!0),i=()=>{s(!1)};return c.useImperativeHandle(n,()=>({close:()=>{s(!1)}})),x.useEffect(()=>{a||e(t.id)},[a]),a?c.createElement(g,Object.assign({},t,{close:i})):null},J=c.forwardRef(G),O={motion:!0,zIndex:1010,duration:3};function K(){const[l,n]=c.useState([]);function e(t,a){return n(s=>[{element:t,config:a},...s]),s=>{n(i=>i.filter(r=>{let{config:u}=r;return u.id!==s}))}}return[l,e]}function Q(){const[l,n]=K(),e=x.useRef(new Map),t=s=>{const i=S("semi_toast_"),r=Object.assign(Object.assign({},s),{id:i});let u;const m=c.createElement(J,Object.assign({},r,{key:i,afterClose:p=>u(p),ref:p=>{var h;e.current.set(i,{close:(h=p?.close)!==null&&h!==void 0?h:T})}}));return u=n(m,Object.assign({},r)),i},a=s=>{var i;const{close:r}=(i=e.current.get(s))!==null&&i!==void 0?i:{};r?.()};return[{success:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"success"})),info:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"info"})),error:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"error"})),warning:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"warning"})),open:s=>t(Object.assign(Object.assign(Object.assign({},O),s),{type:"default"})),close:s=>a(s)},c.createElement(c.Fragment,null,Array.isArray(l)&&l.length?c.createElement(c.Fragment,null,l.map(s=>s.element)):null)]}const Y=()=>{var l;return l=class o extends k{constructor(e){super(e),this.stack=!1,this.innerWrapperRef=c.createRef(),this.handleMouseEnter=t=>{this.stack&&this.foundation.handleMouseInSideChange(!0)},this.handleMouseLeave=t=>{var a;this.stack&&!((a=this.foundation.getInputWrapperRect())===null||a===void 0)&&a.height&&this.foundation.handleMouseInSideChange(!1)},this.state={list:[],removedItems:[],updatedItems:[],mouseInSide:!1},this.foundation=new w(this.adapter)}get adapter(){return Object.assign(Object.assign({},super.adapter),{updateToast:(e,t,a)=>{this.setState({list:e,removedItems:t,updatedItems:a})},handleMouseInSideChange:e=>{this.setState({mouseInSide:e})},getInputWrapperRect:()=>{var e;return(e=this.innerWrapperRef.current)===null||e===void 0?void 0:e.getBoundingClientRect()}})}static create(e){var t;const a=(t=e.id)!==null&&t!==void 0?t:S("toast");if(o.ref){const s=document.querySelector(`#${this.wrapperId}`);["top","left","bottom","right"].map(i=>{i in e&&(s.style[i]=typeof e[i]=="number"?`${e[i]}px`:e[i])}),!!e.stack!==o.ref.stack&&(o.ref.stack=!!e.stack),o.ref.has(a)?o.ref.update(a,Object.assign(Object.assign({},e),{id:a})):o.ref.add(Object.assign(Object.assign({},e),{id:a}))}else{const s=document.createElement("div");this.wrapperId||(this.wrapperId=S("toast-wrapper").slice(0,26)),s.className=b.WRAPPER,s.id=this.wrapperId,s.style.zIndex=String(typeof e.zIndex=="number"?e.zIndex:o.defaultOpts.zIndex),["top","left","bottom","right"].map(i=>{if(i in o.defaultOpts||i in e){const r=e[i]?e[i]:o.defaultOpts[i];s.style[i]=typeof r=="number"?`${r}px`:r}}),o.defaultOpts.getPopupContainer?o.defaultOpts.getPopupContainer().appendChild(s):document.body.appendChild(s),R.render(c.createElement(o,{ref:i=>o.ref=i}),s,()=>{o.ref.add(Object.assign(Object.assign({},e),{id:a})),o.ref.stack=!!e.stack})}return a}static close(e){o.ref&&o.ref.remove(e)}static destroyAll(){if(o.ref){o.ref.destroyAll();const e=document.querySelector(`#${this.wrapperId}`);R.unmountComponentAtNode(e),e&&e.parentNode.removeChild(e),o.ref=null,this.wrapperId=null}}static getWrapperId(){return this.wrapperId}static info(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"info"}))}static warning(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"warning"}))}static error(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"error"}))}static success(e){return typeof e=="string"&&(e={content:e}),this.create(Object.assign(Object.assign(Object.assign({},o.defaultOpts),e),{type:"success"}))}static config(e){["top","left","bottom","right"].forEach(t=>{t in e&&(o.defaultOpts[t]=e[t])}),typeof e.theme=="string"&&y.themes.includes(e.theme)&&(o.defaultOpts.theme=e.theme),typeof e.zIndex=="number"&&(o.defaultOpts.zIndex=e.zIndex),typeof e.duration=="number"&&(o.defaultOpts.duration=e.duration),typeof e.getPopupContainer=="function"&&(o.defaultOpts.getPopupContainer=e.getPopupContainer)}has(e){return this.foundation.hasToast(e)}add(e){return this.foundation.addToast(e)}update(e,t){return this.foundation.updateToast(e,t)}remove(e){return this.foundation.removeToast(e)}destroyAll(){return this.foundation.destroyAll()}render(){let{list:e}=this.state;const{removedItems:t,updatedItems:a}=this.state;e=Array.from(new Set([...e,...t]));const s=a.map(r=>{let{id:u}=r;return u}),i=r=>{var u;!((u=r?.foundation)===null||u===void 0)&&u._id&&s.includes(r.foundation._id)&&r.foundation.restartCloseTimer()};return c.createElement(c.Fragment,null,c.createElement("div",{className:E({[`${b.PREFIX}-innerWrapper`]:!0,[`${b.PREFIX}-innerWrapper-hover`]:this.state.mouseInSide}),ref:this.innerWrapperRef,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},e.map((r,u)=>{const m=t.find(p=>p.id===r.id)!==void 0;return c.createElement(q,{key:r.id,motion:r.motion,animationState:m?"leave":"enter",startClassName:m?`${b.PREFIX}-animation-hide`:`${b.PREFIX}-animation-show`},p=>{let{animationClassName:h,animationEventsNeedBind:I,isAnimating:v}=p;return m&&!v?null:c.createElement(g,Object.assign({},r,{stack:this.stack,stackExpanded:this.state.mouseInSide,positionInList:{length:e.length,index:u},className:E({[r.className]:!!r.className,[h]:!0})},I,{style:Object.assign({},r.style),close:C=>this.remove(C),ref:i}))})})))}},l.defaultOpts={motion:!0,zIndex:1010,content:""},l.propTypes={content:d.node,duration:d.number,onClose:d.func,icon:d.node,direction:d.oneOf(y.directions),stack:d.bool},l.defaultProps={},l};class Z{static create(n){const e=Y();return e.useToast=Q,n&&e.config(n),e}}const se=Z.create();export{se as T};
@@ -1 +1 @@
1
- import{t as P,w as N,x as O,_ as p,y as T,z as E,R as i,B as v,E as V,F as L,L as R,G as k,p as I,H as B,J as n,K as j,M as C,O as w}from"./index-DcpswdR4.js";const S={PREFIX:`${P}-popconfirm`,POPOVER:`${P}-popconfirm-popover`},$={DEFAULT_Z_INDEX:1030};class D extends N{init(){}destroy(){}handleCancel(e){const t=this._adapter.notifyCancel(e);O(t)?(this._adapter.updateCancelLoading(!0),t.then(o=>{this.handleVisibleChange(!1),this._adapter.updateCancelLoading(!1)},o=>{this._adapter.updateCancelLoading(!1)})):this.handleVisibleChange(!1)}handleConfirm(e){const t=this._adapter.notifyConfirm(e);O(t)?(this._adapter.updateConfirmLoading(!0),t.then(o=>{this._adapter.updateConfirmLoading(!1),this.handleVisibleChange(!1)},o=>{this._adapter.updateConfirmLoading(!1)})):this.handleVisibleChange(!1)}handleClickOutSide(e){this._adapter.notifyClickOutSide(e)}handleVisibleChange(e){this._isControlledComponent("visible")||this._adapter.setVisible(e),e?this.handleFocusOperateButton():this._adapter.focusPrevFocusElement(),this._adapter.notifyVisibleChange(e)}handleFocusOperateButton(){const{cancelButtonProps:e,okButtonProps:t}=this._adapter.getProps();p(e,"autoFocus")&&!p(e,"disabled")?this._adapter.focusCancelButton():p(t,"autoFocus")&&!p(t,"disabled")&&this._adapter.focusOkButton()}}var z=function(l,e){var t={};for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&e.indexOf(o)<0&&(t[o]=l[o]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(l);s<o.length;s++)e.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(l,o[s])&&(t[o[s]]=l[o[s]]);return t};class f extends T{constructor(e){super(e),this.handleCancel=t=>this.foundation.handleCancel(t&&t.nativeEvent),this.handleConfirm=t=>this.foundation.handleConfirm(t&&t.nativeEvent),this.handleVisibleChange=t=>this.foundation.handleVisibleChange(t),this.handleClickOutSide=t=>this.foundation.handleClickOutSide(t),this.stopImmediatePropagation=t=>t&&t.nativeEvent&&t.nativeEvent.stopImmediatePropagation(),this.renderConfirmPopCard=t=>{let{initialFocusRef:o}=t;const{content:s,title:c,className:u,style:d,cancelType:h,icon:r,prefixCls:a,showCloseIcon:b}=this.props,{direction:m}=this.context,g=E(a,u,{[`${a}-rtl`]:m==="rtl"}),y=c!==null&&typeof c<"u",x=!(s===null||typeof s>"u"),_=i.isValidElement(r),F=E({[`${a}-body`]:!0,[`${a}-body-withIcon`]:_});return i.createElement("div",{className:g,onClick:this.stopImmediatePropagation,style:d},i.createElement("div",{className:`${a}-inner`},i.createElement("div",{className:`${a}-header`},_?i.createElement("i",{className:`${a}-header-icon`,"x-semi-prop":"icon"},r):null,i.createElement("div",{className:`${a}-header-body`},y?i.createElement("div",{className:`${a}-header-title`,"x-semi-prop":"title"},c):null),b?i.createElement(v,{className:`${a}-btn-close`,icon:i.createElement(V,null),size:"small",theme:"borderless",type:h,onClick:this.handleCancel}):null),x?i.createElement("div",{className:F,"x-semi-prop":"content"},L(s)?s({initialFocusRef:o}):s):null,i.createElement("div",{className:`${a}-footer`,ref:this.footerRef},this.renderControls())))},this.state={cancelLoading:!1,confirmLoading:!1,visible:e.defaultVisible||!1},this.foundation=new D(this.adapter),this.footerRef=i.createRef(),this.popoverRef=i.createRef()}static getDerivedStateFromProps(e,t){const o={},{hasOwnProperty:s}=Object.prototype;return s.call(e,"visible")&&(o.visible=e.visible),o}get adapter(){return Object.assign(Object.assign({},super.adapter),{setVisible:e=>this.setState({visible:e}),updateConfirmLoading:e=>this.setState({confirmLoading:e}),updateCancelLoading:e=>this.setState({cancelLoading:e}),notifyConfirm:e=>this.props.onConfirm(e),notifyCancel:e=>this.props.onCancel(e),notifyVisibleChange:e=>this.props.onVisibleChange(e),notifyClickOutSide:e=>this.props.onClickOutSide(e),focusCancelButton:()=>{var e,t;const o=(t=(e=this.footerRef)===null||e===void 0?void 0:e.current)===null||t===void 0?void 0:t.querySelector("[data-type=cancel]");o?.focus({preventScroll:!0})},focusOkButton:()=>{var e,t;const o=(t=(e=this.footerRef)===null||e===void 0?void 0:e.current)===null||t===void 0?void 0:t.querySelector("[data-type=ok]");o?.focus({preventScroll:!0})},focusPrevFocusElement:()=>{var e;(e=this.popoverRef.current)===null||e===void 0||e.focusTrigger()}})}renderControls(){const{okText:e,cancelText:t,okType:o,cancelType:s,cancelButtonProps:c,okButtonProps:u}=this.props,{cancelLoading:d,confirmLoading:h}=this.state;return i.createElement(R,{componentName:"Popconfirm"},(r,a)=>i.createElement(i.Fragment,null,i.createElement(v,Object.assign({"data-type":"cancel",type:s,onClick:this.handleCancel,loading:d},k(c,"autoFocus")),t||p(r,"cancel")),i.createElement(v,Object.assign({"data-type":"ok",type:o,theme:"solid",onClick:this.handleConfirm,loading:h},k(u,"autoFocus")),e||p(r,"confirm"))))}render(){const{direction:e}=this.context,t=e==="rtl"?"bottomRight":"bottomLeft",o=this.props,{className:s,prefixCls:c,disabled:u,children:d,style:h,position:r=t}=o,a=z(o,["className","prefixCls","disabled","children","style","position"]);if(u)return d;const{visible:b}=this.state,m={onVisibleChange:this.handleVisibleChange,className:S.POPOVER,onClickOutSide:this.handleClickOutSide};return this.isControlled("visible")&&(m.trigger="custom"),i.createElement(I,Object.assign({ref:this.popoverRef},a,{content:g=>{let{initialFocusRef:y}=g;return this.renderConfirmPopCard({initialFocusRef:y})},visible:b,position:r},m),d)}}f.contextType=B;f.propTypes={motion:n.oneOfType([n.bool,n.func,n.object]),disabled:n.bool,content:n.oneOfType([n.node,n.func]),title:n.any,prefixCls:n.string,className:n.string,style:n.object,icon:n.node,okText:n.string,okType:n.string,cancelText:n.string,cancelType:n.string,onCancel:n.func,onConfirm:n.func,onClickOutSide:n.func,onVisibleChange:n.func,visible:n.bool,defaultVisible:n.bool,okButtonProps:n.object,cancelButtonProps:n.object,stopPropagation:n.oneOfType([n.bool,n.string]),showCloseIcon:n.bool,zIndex:n.number,trigger:n.string,position:n.string};f.__SemiComponentName__="Popconfirm";f.defaultProps=j(f.__SemiComponentName__,{stopPropagation:!0,trigger:"click",onVisibleChange:C,disabled:!1,icon:i.createElement(w,{size:"extra-large"}),okType:"primary",cancelType:"tertiary",prefixCls:S.PREFIX,zIndex:$.DEFAULT_Z_INDEX,showCloseIcon:!0,onCancel:C,onConfirm:C,onClickOutSide:C});export{f as P};
1
+ import{t as P,w as N,x as O,_ as p,y as T,z as E,R as i,B as v,E as V,F as L,L as R,G as k,p as I,H as B,J as n,K as j,M as C,O as w}from"./index-Ch-x1uku.js";const S={PREFIX:`${P}-popconfirm`,POPOVER:`${P}-popconfirm-popover`},$={DEFAULT_Z_INDEX:1030};class D extends N{init(){}destroy(){}handleCancel(e){const t=this._adapter.notifyCancel(e);O(t)?(this._adapter.updateCancelLoading(!0),t.then(o=>{this.handleVisibleChange(!1),this._adapter.updateCancelLoading(!1)},o=>{this._adapter.updateCancelLoading(!1)})):this.handleVisibleChange(!1)}handleConfirm(e){const t=this._adapter.notifyConfirm(e);O(t)?(this._adapter.updateConfirmLoading(!0),t.then(o=>{this._adapter.updateConfirmLoading(!1),this.handleVisibleChange(!1)},o=>{this._adapter.updateConfirmLoading(!1)})):this.handleVisibleChange(!1)}handleClickOutSide(e){this._adapter.notifyClickOutSide(e)}handleVisibleChange(e){this._isControlledComponent("visible")||this._adapter.setVisible(e),e?this.handleFocusOperateButton():this._adapter.focusPrevFocusElement(),this._adapter.notifyVisibleChange(e)}handleFocusOperateButton(){const{cancelButtonProps:e,okButtonProps:t}=this._adapter.getProps();p(e,"autoFocus")&&!p(e,"disabled")?this._adapter.focusCancelButton():p(t,"autoFocus")&&!p(t,"disabled")&&this._adapter.focusOkButton()}}var z=function(l,e){var t={};for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&e.indexOf(o)<0&&(t[o]=l[o]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(l);s<o.length;s++)e.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(l,o[s])&&(t[o[s]]=l[o[s]]);return t};class f extends T{constructor(e){super(e),this.handleCancel=t=>this.foundation.handleCancel(t&&t.nativeEvent),this.handleConfirm=t=>this.foundation.handleConfirm(t&&t.nativeEvent),this.handleVisibleChange=t=>this.foundation.handleVisibleChange(t),this.handleClickOutSide=t=>this.foundation.handleClickOutSide(t),this.stopImmediatePropagation=t=>t&&t.nativeEvent&&t.nativeEvent.stopImmediatePropagation(),this.renderConfirmPopCard=t=>{let{initialFocusRef:o}=t;const{content:s,title:c,className:u,style:d,cancelType:h,icon:r,prefixCls:a,showCloseIcon:b}=this.props,{direction:m}=this.context,g=E(a,u,{[`${a}-rtl`]:m==="rtl"}),y=c!==null&&typeof c<"u",x=!(s===null||typeof s>"u"),_=i.isValidElement(r),F=E({[`${a}-body`]:!0,[`${a}-body-withIcon`]:_});return i.createElement("div",{className:g,onClick:this.stopImmediatePropagation,style:d},i.createElement("div",{className:`${a}-inner`},i.createElement("div",{className:`${a}-header`},_?i.createElement("i",{className:`${a}-header-icon`,"x-semi-prop":"icon"},r):null,i.createElement("div",{className:`${a}-header-body`},y?i.createElement("div",{className:`${a}-header-title`,"x-semi-prop":"title"},c):null),b?i.createElement(v,{className:`${a}-btn-close`,icon:i.createElement(V,null),size:"small",theme:"borderless",type:h,onClick:this.handleCancel}):null),x?i.createElement("div",{className:F,"x-semi-prop":"content"},L(s)?s({initialFocusRef:o}):s):null,i.createElement("div",{className:`${a}-footer`,ref:this.footerRef},this.renderControls())))},this.state={cancelLoading:!1,confirmLoading:!1,visible:e.defaultVisible||!1},this.foundation=new D(this.adapter),this.footerRef=i.createRef(),this.popoverRef=i.createRef()}static getDerivedStateFromProps(e,t){const o={},{hasOwnProperty:s}=Object.prototype;return s.call(e,"visible")&&(o.visible=e.visible),o}get adapter(){return Object.assign(Object.assign({},super.adapter),{setVisible:e=>this.setState({visible:e}),updateConfirmLoading:e=>this.setState({confirmLoading:e}),updateCancelLoading:e=>this.setState({cancelLoading:e}),notifyConfirm:e=>this.props.onConfirm(e),notifyCancel:e=>this.props.onCancel(e),notifyVisibleChange:e=>this.props.onVisibleChange(e),notifyClickOutSide:e=>this.props.onClickOutSide(e),focusCancelButton:()=>{var e,t;const o=(t=(e=this.footerRef)===null||e===void 0?void 0:e.current)===null||t===void 0?void 0:t.querySelector("[data-type=cancel]");o?.focus({preventScroll:!0})},focusOkButton:()=>{var e,t;const o=(t=(e=this.footerRef)===null||e===void 0?void 0:e.current)===null||t===void 0?void 0:t.querySelector("[data-type=ok]");o?.focus({preventScroll:!0})},focusPrevFocusElement:()=>{var e;(e=this.popoverRef.current)===null||e===void 0||e.focusTrigger()}})}renderControls(){const{okText:e,cancelText:t,okType:o,cancelType:s,cancelButtonProps:c,okButtonProps:u}=this.props,{cancelLoading:d,confirmLoading:h}=this.state;return i.createElement(R,{componentName:"Popconfirm"},(r,a)=>i.createElement(i.Fragment,null,i.createElement(v,Object.assign({"data-type":"cancel",type:s,onClick:this.handleCancel,loading:d},k(c,"autoFocus")),t||p(r,"cancel")),i.createElement(v,Object.assign({"data-type":"ok",type:o,theme:"solid",onClick:this.handleConfirm,loading:h},k(u,"autoFocus")),e||p(r,"confirm"))))}render(){const{direction:e}=this.context,t=e==="rtl"?"bottomRight":"bottomLeft",o=this.props,{className:s,prefixCls:c,disabled:u,children:d,style:h,position:r=t}=o,a=z(o,["className","prefixCls","disabled","children","style","position"]);if(u)return d;const{visible:b}=this.state,m={onVisibleChange:this.handleVisibleChange,className:S.POPOVER,onClickOutSide:this.handleClickOutSide};return this.isControlled("visible")&&(m.trigger="custom"),i.createElement(I,Object.assign({ref:this.popoverRef},a,{content:g=>{let{initialFocusRef:y}=g;return this.renderConfirmPopCard({initialFocusRef:y})},visible:b,position:r},m),d)}}f.contextType=B;f.propTypes={motion:n.oneOfType([n.bool,n.func,n.object]),disabled:n.bool,content:n.oneOfType([n.node,n.func]),title:n.any,prefixCls:n.string,className:n.string,style:n.object,icon:n.node,okText:n.string,okType:n.string,cancelText:n.string,cancelType:n.string,onCancel:n.func,onConfirm:n.func,onClickOutSide:n.func,onVisibleChange:n.func,visible:n.bool,defaultVisible:n.bool,okButtonProps:n.object,cancelButtonProps:n.object,stopPropagation:n.oneOfType([n.bool,n.string]),showCloseIcon:n.bool,zIndex:n.number,trigger:n.string,position:n.string};f.__SemiComponentName__="Popconfirm";f.defaultProps=j(f.__SemiComponentName__,{stopPropagation:!0,trigger:"click",onVisibleChange:C,disabled:!1,icon:i.createElement(w,{size:"extra-large"}),okType:"primary",cancelType:"tertiary",prefixCls:S.PREFIX,zIndex:$.DEFAULT_Z_INDEX,showCloseIcon:!0,onCancel:C,onConfirm:C,onClickOutSide:C});export{f as P};
@@ -1 +1 @@
1
- import{X as a,Y as t}from"./index-DcpswdR4.js";const s=[{key:"login",icon:"🔐",titleKey:"ia.menu.login",summaryKey:"ia.login.summary",sceneKey:"scene_scan_qrcode",apiTags:["tt.login","auth_code","user.info.open_id"],highlightKeys:["ia.login.highlight1","ia.login.highlight2"],prerequisiteKeys:["ia.login.prerequisite1","ia.login.prerequisite2"],stepKeys:["ia.login.step1","ia.login.step2","ia.login.step3"],tipKeys:["ia.login.requirementScope","ia.login.tip1","ia.login.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CG6wdxffcouMY3xIqQTlDEyWgBe?302from=wiki",target:"_blank",theme:"solid"}]},{key:"authorize",icon:"🛂",titleKey:"ia.menu.authorize",summaryKey:"ia.authorize.summary",sceneKey:"scene_scan_qrcode",apiTags:["tt.authorize","user.info.basic","access_token"],highlightKeys:["ia.authorize.highlight1","ia.authorize.highlight2"],prerequisiteKeys:["ia.authorize.prerequisite1","ia.authorize.prerequisite2"],stepKeys:["ia.authorize.step1","ia.authorize.step2","ia.authorize.step3"],tipKeys:["ia.authorize.tip1","ia.authorize.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CewRdCPcCoxcKFxBTftlRXnSgOc",target:"_blank",theme:"solid"},{labelKey:"ia.action.goProjectDetail",type:"route",path:"/project_overview"}]},{key:"payment",icon:"💳",titleKey:"ia.menu.payment",summaryKey:"ia.payment.summary",sceneKey:"scene_scan_qrcode",apiTags:["IAP Mock","TikTok Beans","order verify"],highlightKeys:["ia.payment.highlight1","ia.payment.highlight2"],prerequisiteKeys:["ia.payment.prerequisite1","ia.payment.prerequisite2"],stepKeys:["ia.payment.step1","ia.payment.step2","ia.payment.step3"],tipKeys:["ia.payment.tip1","ia.payment.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/MYsLdpeGGoulzDxZ6VelG8Gggoe?302from=wiki",target:"_blank",theme:"solid"},{labelKey:"ia.action.goPrecheck",type:"route",path:"/upload_publish"}]},{key:"ad",icon:"📺",titleKey:"ia.menu.ad",summaryKey:"ia.ad.summary",sceneKey:"scene_ad",apiTags:["createRewardedVideoAd","createInterstitialAd","placement id"],highlightKeys:["ia.ad.highlight1","ia.ad.highlight2"],prerequisiteKeys:["ia.ad.prerequisite1","ia.ad.prerequisite2"],stepKeys:["ia.ad.step1","ia.ad.step2","ia.ad.step3"],tipKeys:["ia.ad.tip1","ia.ad.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/JTEiw409LiLkUSk2SltcsAqonkg",target:"_blank",theme:"solid"},{labelKey:"ia.action.goPrecheck",type:"route",path:"/upload_publish"}]},{key:"ui_adaptation",icon:"📱",titleKey:"ia.menu.uiAdaptation",summaryKey:"ia.uiAdaptation.summary",apiTags:["safeArea","screen adaptation","capsule button"],highlightKeys:["ia.uiAdaptation.highlight1","ia.uiAdaptation.highlight2"],prerequisiteKeys:["ia.uiAdaptation.prerequisite1","ia.uiAdaptation.prerequisite2"],stepKeys:["ia.uiAdaptation.step1","ia.uiAdaptation.step2","ia.uiAdaptation.step3"],tipKeys:["ia.uiAdaptation.tip1","ia.uiAdaptation.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/docx/Zes2dVS3ooIm55x67OhcXTxWnud",target:"_blank",theme:"solid"}]},{key:"share_message",icon:"🔗",titleKey:"ia.menu.shareMessage",summaryKey:"ia.shareMessage.summary",apiTags:["shareAppMessage","query","game basic info"],highlightKeys:["ia.shareMessage.highlight1","ia.shareMessage.highlight2"],prerequisiteKeys:["ia.shareMessage.prerequisite1","ia.shareMessage.prerequisite2"],stepKeys:["ia.shareMessage.step1","ia.shareMessage.step2","ia.shareMessage.step3"],tipKeys:["ia.shareMessage.tip1","ia.shareMessage.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CesGdxcyJorqE1xIuf3lAXEhguh",target:"_blank",theme:"solid"}]},{key:"share_story",icon:"📣",titleKey:"ia.menu.shareStory",summaryKey:"ia.shareStory.summary",hidden:!0,apiTags:["shareToStory","query","story asset"],highlightKeys:["ia.shareStory.highlight1","ia.shareStory.highlight2"],prerequisiteKeys:["ia.shareStory.prerequisite1","ia.shareStory.prerequisite2"],stepKeys:["ia.shareStory.step1","ia.shareStory.step2","ia.shareStory.step3"],tipKeys:["ia.shareStory.tip1","ia.shareStory.tip2"],actions:[]},{key:"subpackage",icon:"📦",titleKey:"ia.menu.subpackage",summaryKey:"ia.subpackage.summary",apiTags:["preDownloadSubpackage","loadSubpackage","loadSubpackageSync"],highlightKeys:["ia.subpackage.highlight1","ia.subpackage.highlight2"],prerequisiteKeys:["ia.subpackage.prerequisite1","ia.subpackage.prerequisite2"],stepKeys:["ia.subpackage.step1","ia.subpackage.step2","ia.subpackage.step3"],tipKeys:["ia.subpackage.tip1","ia.subpackage.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://developers.tiktok.com/docs/en/mini-games-sdk-subpackage-loading",target:"_blank"},{labelKey:"ia.action.goSubpackageCollect",type:"route",path:"/subpackage_collect"}]},{key:"network",icon:"🌐",titleKey:"ia.menu.network",summaryKey:"ia.network.summary",apiTags:["request","downloadFile","connectSocket"],highlightKeys:["ia.network.highlight1","ia.network.highlight2"],prerequisiteKeys:["ia.network.prerequisite1","ia.network.prerequisite2"],stepKeys:["ia.network.step1","ia.network.step2","ia.network.step3"],tipKeys:["ia.network.tip1","ia.network.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://developers.tiktok.com/docs/en/mini-games-sdk-network-request",target:"_blank"},{labelKey:"ia.action.goNetworkDiagnostics",type:"route",path:"/network_diagnostics"}]},{key:"sidebar_revisit",icon:"🧭",titleKey:"ia.menu.sidebarRevisit",summaryKey:"ia.sidebar.summary",sceneKey:"scene_center",apiTags:["startEntranceMission","getEntranceMissionReward","canIUse"],highlightKeys:["ia.sidebar.highlight1","ia.sidebar.highlight2"],prerequisiteKeys:["ia.sidebar.prerequisite1","ia.sidebar.prerequisite2"],stepKeys:["ia.sidebar.step1","ia.sidebar.step2","ia.sidebar.step3"],tipKeys:["ia.sidebar.tip1","ia.sidebar.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/Pl9Jwg8ujiZp6ckhhQzcujujnfb",target:"_blank",theme:"solid"},{labelKey:"ia.action.goLaunchMode",type:"route",path:"/launch_mode"}]},{key:"shortcut_revisit",icon:"📌",titleKey:"ia.menu.shortcutRevisit",summaryKey:"ia.shortcut.summary",sceneKey:"scene_shortcut",apiTags:["addShortcut","getShortcutMissionReward","canIUse"],highlightKeys:["ia.shortcut.highlight1","ia.shortcut.highlight2"],prerequisiteKeys:["ia.shortcut.prerequisite1","ia.shortcut.prerequisite2"],stepKeys:["ia.shortcut.step1","ia.shortcut.step2","ia.shortcut.step3"],tipKeys:["ia.shortcut.tip1","ia.shortcut.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/AW4JwueaXiiKtTkK0c9cIo4lnud",target:"_blank",theme:"solid"},{labelKey:"ia.action.goLaunchMode",type:"route",path:"/launch_mode"}]},{key:"direct_play_card",icon:"🎯",titleKey:"ia.menu.directPlayCard",summaryKey:"ia.directPlay.summary",sceneKey:"scene_fyf_promotion_direct_feed_play",experimentOnly:!0,apiTags:["Play now","For You Feed","revisit"],highlightKeys:["ia.directPlay.highlight1","ia.directPlay.highlight2"],prerequisiteKeys:["ia.directPlay.prerequisite1","ia.directPlay.prerequisite2"],stepKeys:["ia.directPlay.step1","ia.directPlay.step2","ia.directPlay.step3"],tipKeys:["ia.directPlay.tip1","ia.directPlay.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/VZ3odoD8DoSxFXxANh5lLxVMgPx",target:"_blank",theme:"solid"}]},{key:"wasm_split",icon:"🧩",titleKey:"ia.menu.wasmSplit",summaryKey:"ia.wasmSplit.summary",apiTags:["Unity","Wasm"],highlightKeys:[],prerequisiteKeys:[],stepKeys:[],tipKeys:[],actions:[],customPath:"/wasm_split"}],o=s.reduce((e,i)=>(e[i.key]=i,e),{});function p(e){return!!(!e||e.hidden||e.experimentOnly&&!a()||e.localDevOnly&&!t())}export{o as c,p as i};
1
+ import{X as a,Y as t}from"./index-Ch-x1uku.js";const s=[{key:"login",icon:"🔐",titleKey:"ia.menu.login",summaryKey:"ia.login.summary",sceneKey:"scene_scan_qrcode",apiTags:["tt.login","auth_code","user.info.open_id"],highlightKeys:["ia.login.highlight1","ia.login.highlight2"],prerequisiteKeys:["ia.login.prerequisite1","ia.login.prerequisite2"],stepKeys:["ia.login.step1","ia.login.step2","ia.login.step3"],tipKeys:["ia.login.requirementScope","ia.login.tip1","ia.login.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CG6wdxffcouMY3xIqQTlDEyWgBe?302from=wiki",target:"_blank",theme:"solid"}]},{key:"authorize",icon:"🛂",titleKey:"ia.menu.authorize",summaryKey:"ia.authorize.summary",sceneKey:"scene_scan_qrcode",apiTags:["tt.authorize","user.info.basic","access_token"],highlightKeys:["ia.authorize.highlight1","ia.authorize.highlight2"],prerequisiteKeys:["ia.authorize.prerequisite1","ia.authorize.prerequisite2"],stepKeys:["ia.authorize.step1","ia.authorize.step2","ia.authorize.step3"],tipKeys:["ia.authorize.tip1","ia.authorize.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CewRdCPcCoxcKFxBTftlRXnSgOc",target:"_blank",theme:"solid"},{labelKey:"ia.action.goProjectDetail",type:"route",path:"/project_overview"}]},{key:"payment",icon:"💳",titleKey:"ia.menu.payment",summaryKey:"ia.payment.summary",sceneKey:"scene_scan_qrcode",apiTags:["IAP Mock","TikTok Beans","order verify"],highlightKeys:["ia.payment.highlight1","ia.payment.highlight2"],prerequisiteKeys:["ia.payment.prerequisite1","ia.payment.prerequisite2"],stepKeys:["ia.payment.step1","ia.payment.step2","ia.payment.step3"],tipKeys:["ia.payment.tip1","ia.payment.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/MYsLdpeGGoulzDxZ6VelG8Gggoe?302from=wiki",target:"_blank",theme:"solid"},{labelKey:"ia.action.goPrecheck",type:"route",path:"/upload_publish"}]},{key:"ad",icon:"📺",titleKey:"ia.menu.ad",summaryKey:"ia.ad.summary",sceneKey:"scene_ad",apiTags:["createRewardedVideoAd","createInterstitialAd","placement id"],highlightKeys:["ia.ad.highlight1","ia.ad.highlight2"],prerequisiteKeys:["ia.ad.prerequisite1","ia.ad.prerequisite2"],stepKeys:["ia.ad.step1","ia.ad.step2","ia.ad.step3"],tipKeys:["ia.ad.tip1","ia.ad.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/JTEiw409LiLkUSk2SltcsAqonkg",target:"_blank",theme:"solid"},{labelKey:"ia.action.goPrecheck",type:"route",path:"/upload_publish"}]},{key:"ui_adaptation",icon:"📱",titleKey:"ia.menu.uiAdaptation",summaryKey:"ia.uiAdaptation.summary",apiTags:["safeArea","screen adaptation","capsule button"],highlightKeys:["ia.uiAdaptation.highlight1","ia.uiAdaptation.highlight2"],prerequisiteKeys:["ia.uiAdaptation.prerequisite1","ia.uiAdaptation.prerequisite2"],stepKeys:["ia.uiAdaptation.step1","ia.uiAdaptation.step2","ia.uiAdaptation.step3"],tipKeys:["ia.uiAdaptation.tip1","ia.uiAdaptation.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/docx/Zes2dVS3ooIm55x67OhcXTxWnud",target:"_blank",theme:"solid"}]},{key:"share_message",icon:"🔗",titleKey:"ia.menu.shareMessage",summaryKey:"ia.shareMessage.summary",apiTags:["shareAppMessage","query","game basic info"],highlightKeys:["ia.shareMessage.highlight1","ia.shareMessage.highlight2"],prerequisiteKeys:["ia.shareMessage.prerequisite1","ia.shareMessage.prerequisite2"],stepKeys:["ia.shareMessage.step1","ia.shareMessage.step2","ia.shareMessage.step3"],tipKeys:["ia.shareMessage.tip1","ia.shareMessage.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/CesGdxcyJorqE1xIuf3lAXEhguh",target:"_blank",theme:"solid"}]},{key:"share_story",icon:"📣",titleKey:"ia.menu.shareStory",summaryKey:"ia.shareStory.summary",hidden:!0,apiTags:["shareToStory","query","story asset"],highlightKeys:["ia.shareStory.highlight1","ia.shareStory.highlight2"],prerequisiteKeys:["ia.shareStory.prerequisite1","ia.shareStory.prerequisite2"],stepKeys:["ia.shareStory.step1","ia.shareStory.step2","ia.shareStory.step3"],tipKeys:["ia.shareStory.tip1","ia.shareStory.tip2"],actions:[]},{key:"subpackage",icon:"📦",titleKey:"ia.menu.subpackage",summaryKey:"ia.subpackage.summary",apiTags:["preDownloadSubpackage","loadSubpackage","loadSubpackageSync"],highlightKeys:["ia.subpackage.highlight1","ia.subpackage.highlight2"],prerequisiteKeys:["ia.subpackage.prerequisite1","ia.subpackage.prerequisite2"],stepKeys:["ia.subpackage.step1","ia.subpackage.step2","ia.subpackage.step3"],tipKeys:["ia.subpackage.tip1","ia.subpackage.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://developers.tiktok.com/docs/en/mini-games-sdk-subpackage-loading",target:"_blank"},{labelKey:"ia.action.goSubpackageCollect",type:"route",path:"/subpackage_collect"}]},{key:"network",icon:"🌐",titleKey:"ia.menu.network",summaryKey:"ia.network.summary",apiTags:["request","downloadFile","connectSocket"],highlightKeys:["ia.network.highlight1","ia.network.highlight2"],prerequisiteKeys:["ia.network.prerequisite1","ia.network.prerequisite2"],stepKeys:["ia.network.step1","ia.network.step2","ia.network.step3"],tipKeys:["ia.network.tip1","ia.network.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://developers.tiktok.com/docs/en/mini-games-sdk-network-request",target:"_blank"},{labelKey:"ia.action.goNetworkDiagnostics",type:"route",path:"/network_diagnostics"}]},{key:"sidebar_revisit",icon:"🧭",titleKey:"ia.menu.sidebarRevisit",summaryKey:"ia.sidebar.summary",sceneKey:"scene_center",apiTags:["startEntranceMission","getEntranceMissionReward","canIUse"],highlightKeys:["ia.sidebar.highlight1","ia.sidebar.highlight2"],prerequisiteKeys:["ia.sidebar.prerequisite1","ia.sidebar.prerequisite2"],stepKeys:["ia.sidebar.step1","ia.sidebar.step2","ia.sidebar.step3"],tipKeys:["ia.sidebar.tip1","ia.sidebar.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/Pl9Jwg8ujiZp6ckhhQzcujujnfb",target:"_blank",theme:"solid"},{labelKey:"ia.action.goLaunchMode",type:"route",path:"/launch_mode"}]},{key:"shortcut_revisit",icon:"📌",titleKey:"ia.menu.shortcutRevisit",summaryKey:"ia.shortcut.summary",sceneKey:"scene_shortcut",apiTags:["addShortcut","getShortcutMissionReward","canIUse"],highlightKeys:["ia.shortcut.highlight1","ia.shortcut.highlight2"],prerequisiteKeys:["ia.shortcut.prerequisite1","ia.shortcut.prerequisite2"],stepKeys:["ia.shortcut.step1","ia.shortcut.step2","ia.shortcut.step3"],tipKeys:["ia.shortcut.tip1","ia.shortcut.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.larkoffice.com/wiki/AW4JwueaXiiKtTkK0c9cIo4lnud",target:"_blank",theme:"solid"},{labelKey:"ia.action.goLaunchMode",type:"route",path:"/launch_mode"}]},{key:"direct_play_card",icon:"🎯",titleKey:"ia.menu.directPlayCard",summaryKey:"ia.directPlay.summary",sceneKey:"scene_fyf_promotion_direct_feed_play",experimentOnly:!0,apiTags:["Play now","For You Feed","revisit"],highlightKeys:["ia.directPlay.highlight1","ia.directPlay.highlight2"],prerequisiteKeys:["ia.directPlay.prerequisite1","ia.directPlay.prerequisite2"],stepKeys:["ia.directPlay.step1","ia.directPlay.step2","ia.directPlay.step3"],tipKeys:["ia.directPlay.tip1","ia.directPlay.tip2"],actions:[{labelKey:"ia.action.openCapabilityDoc",type:"external",href:"https://bytedance.sg.larkoffice.com/docx/VZ3odoD8DoSxFXxANh5lLxVMgPx",target:"_blank",theme:"solid"}]},{key:"wasm_split",icon:"🧩",titleKey:"ia.menu.wasmSplit",summaryKey:"ia.wasmSplit.summary",apiTags:["Unity","Wasm"],highlightKeys:[],prerequisiteKeys:[],stepKeys:[],tipKeys:[],actions:[],customPath:"/wasm_split"}],o=s.reduce((e,i)=>(e[i.key]=i,e),{});function p(e){return!!(!e||e.hidden||e.experimentOnly&&!a()||e.localDevOnly&&!t())}export{o as c,p as i};
@@ -1 +1 @@
1
- import{c as m,r as d,a2 as p,i as n,j as t}from"./index-DcpswdR4.js";const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],f=m("circle-alert",x);const w=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],b=m("circle-check",w),j=()=>{const[c,r]=d.useState({kind:"idle"}),l=d.useRef(null);if(d.useEffect(()=>{const e=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=({status:k,msg:g,progress:h})=>{switch(k){case"start":e(),r({kind:"uploading",progress:0});break;case"process":e(),r({kind:"uploading",progress:Math.max(0,Math.min(1,h??0))});break;case"success":e(),r({kind:"success"}),l.current=window.setTimeout(()=>{r({kind:"idle"}),l.current=null},2500);break;case"restart":e(),r({kind:"restart"});break;case"error":e(),r({kind:"error",msg:g});break}};return p.on("uploadGame",u),()=>{p.off("uploadGame",u),e()}},[]),c.kind==="idle")return null;let s="",a="",i="0%",o="uploading";switch(c.kind){case"uploading":{const e=Math.round(c.progress*100);s=n("uploadStart"),a=`${e}%`,i=`${e}%`,o="uploading";break}case"success":s=n("uploadSuccess"),a="100%",i="100%",o="success";break;case"restart":s=n("uploadStart"),a="",i="0%",o="uploading";break;case"error":s=n("uploadError"),c.msg&&(s=`${s}: ${c.msg}`),a="",i="100%",o="error";break}return t.jsxs("div",{className:`tt-wasm-upload-progress tt-wasm-upload-progress--${o}`,role:"status","aria-live":"polite",title:s,children:[t.jsxs("div",{className:"tt-wasm-upload-progress-meta",children:[t.jsx("span",{className:"tt-wasm-upload-progress-label",children:s}),a&&t.jsx("span",{className:"tt-wasm-upload-progress-percent",children:a})]}),t.jsx("div",{className:"tt-wasm-upload-progress-track",children:t.jsx("div",{className:"tt-wasm-upload-progress-fill",style:{width:i}})})]})};export{b as C,j as U,f as a};
1
+ import{c as m,r as d,a2 as p,i as n,j as t}from"./index-Ch-x1uku.js";const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],f=m("circle-alert",x);const w=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],b=m("circle-check",w),j=()=>{const[c,r]=d.useState({kind:"idle"}),l=d.useRef(null);if(d.useEffect(()=>{const e=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=({status:k,msg:g,progress:h})=>{switch(k){case"start":e(),r({kind:"uploading",progress:0});break;case"process":e(),r({kind:"uploading",progress:Math.max(0,Math.min(1,h??0))});break;case"success":e(),r({kind:"success"}),l.current=window.setTimeout(()=>{r({kind:"idle"}),l.current=null},2500);break;case"restart":e(),r({kind:"restart"});break;case"error":e(),r({kind:"error",msg:g});break}};return p.on("uploadGame",u),()=>{p.off("uploadGame",u),e()}},[]),c.kind==="idle")return null;let s="",a="",i="0%",o="uploading";switch(c.kind){case"uploading":{const e=Math.round(c.progress*100);s=n("uploadStart"),a=`${e}%`,i=`${e}%`,o="uploading";break}case"success":s=n("uploadSuccess"),a="100%",i="100%",o="success";break;case"restart":s=n("uploadStart"),a="",i="0%",o="uploading";break;case"error":s=n("uploadError"),c.msg&&(s=`${s}: ${c.msg}`),a="",i="100%",o="error";break}return t.jsxs("div",{className:`tt-wasm-upload-progress tt-wasm-upload-progress--${o}`,role:"status","aria-live":"polite",title:s,children:[t.jsxs("div",{className:"tt-wasm-upload-progress-meta",children:[t.jsx("span",{className:"tt-wasm-upload-progress-label",children:s}),a&&t.jsx("span",{className:"tt-wasm-upload-progress-percent",children:a})]}),t.jsx("div",{className:"tt-wasm-upload-progress-track",children:t.jsx("div",{className:"tt-wasm-upload-progress-fill",style:{width:i}})})]})};export{b as C,j as U,f as a};
@@ -1 +1 @@
1
- import{k as l,j as e,T as s,i,B as t,D as u}from"./index-DcpswdR4.js";import{B as b}from"./index-BqslPc39.js";const n="https://bytedance.larkoffice.com/wiki/PeIawT4M4ia9R8kYyLMcjwHknOg",g=[{titleKey:"basicDebugGuide.available.scan.title",descKey:"basicDebugGuide.available.scan.desc"},{titleKey:"basicDebugGuide.available.launch.title",descKey:"basicDebugGuide.available.launch.desc"},{titleKey:"basicDebugGuide.available.preview.title",descKey:"basicDebugGuide.available.preview.desc"},{titleKey:"basicDebugGuide.available.network.title",descKey:"basicDebugGuide.available.network.desc"},{titleKey:"basicDebugGuide.available.manual.title",descKey:"basicDebugGuide.available.manual.desc"}],r=[{titleKey:"basicDebugGuide.locked.project.title",descKey:"basicDebugGuide.locked.project.desc"},{titleKey:"basicDebugGuide.locked.upload.title",descKey:"basicDebugGuide.locked.upload.desc"},{titleKey:"basicDebugGuide.locked.platform.title",descKey:"basicDebugGuide.locked.platform.desc"}],o=["basicDebugGuide.step1","basicDebugGuide.step2","basicDebugGuide.step3","basicDebugGuide.step4"],h=()=>{const d=l();return e.jsxs("div",{className:"basic-debug-guide-page",children:[e.jsx(b,{className:"basic-debug-guide-banner",fullMode:!1,bordered:!1,closeIcon:null,type:"info",description:e.jsxs("div",{className:"basic-debug-guide-banner-copy",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.bannerTitle")}),e.jsx(s.Text,{children:i("basicDebugGuide.bannerDesc")})]})}),e.jsxs("section",{className:"basic-debug-guide-hero",children:[e.jsxs("div",{className:"basic-debug-guide-hero-copy",children:[e.jsx(s.Title,{heading:3,children:i("basicDebugGuide.title")}),e.jsx(s.Paragraph,{className:"basic-debug-guide-hero-desc",children:i("basicDebugGuide.desc")})]}),e.jsxs("div",{className:"basic-debug-guide-actions",children:[e.jsx(t,{theme:"solid",type:"primary",onClick:()=>d("/"),children:i("basicDebugGuide.actionScan")}),e.jsx(t,{theme:"light",onClick:()=>d("/network_diagnostics"),children:i("basicDebugGuide.actionNetwork")}),e.jsx(u,{href:n,children:i("basicDebugGuide.actionProxy")})]})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.availableTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.availableDesc")})]}),e.jsx("div",{className:"basic-debug-guide-list",children:g.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-item",children:[e.jsx("span",{className:"basic-debug-guide-item-index",children:a+1}),e.jsxs("div",{className:"basic-debug-guide-item-copy",children:[e.jsx(s.Text,{strong:!0,children:i(c.titleKey)}),e.jsx(s.Text,{children:i(c.descKey)})]})]},c.titleKey))})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.lockedTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.lockedDesc")})]}),e.jsx("div",{className:"basic-debug-guide-list",children:r.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-item basic-debug-guide-item-muted",children:[e.jsx("span",{className:"basic-debug-guide-item-index",children:a+1}),e.jsxs("div",{className:"basic-debug-guide-item-copy",children:[e.jsx(s.Text,{strong:!0,children:i(c.titleKey)}),e.jsx(s.Text,{children:i(c.descKey)})]})]},c.titleKey))})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.stepsTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.stepsDesc")})]}),e.jsx("div",{className:"basic-debug-guide-steps",children:o.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-step",children:[e.jsx("span",{className:"basic-debug-guide-step-index",children:a+1}),e.jsx(s.Text,{children:i(c)})]},c))}),e.jsxs("div",{className:"basic-debug-guide-command-list",children:[e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandProxy")}),e.jsx("code",{children:"ttmg config set proxy http://127.0.0.1:7890"}),e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandProxyHint")})]}),e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandLogin")}),e.jsx("code",{children:"ttmg login"})]}),e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandDev")}),e.jsx("code",{children:"ttmg dev"})]})]})]})]})};export{h as BasicDebugGuide};
1
+ import{k as l,j as e,T as s,i,B as t,D as u}from"./index-Ch-x1uku.js";import{B as b}from"./index-BZHcW0UM.js";const n="https://bytedance.larkoffice.com/wiki/PeIawT4M4ia9R8kYyLMcjwHknOg",g=[{titleKey:"basicDebugGuide.available.scan.title",descKey:"basicDebugGuide.available.scan.desc"},{titleKey:"basicDebugGuide.available.launch.title",descKey:"basicDebugGuide.available.launch.desc"},{titleKey:"basicDebugGuide.available.preview.title",descKey:"basicDebugGuide.available.preview.desc"},{titleKey:"basicDebugGuide.available.network.title",descKey:"basicDebugGuide.available.network.desc"},{titleKey:"basicDebugGuide.available.manual.title",descKey:"basicDebugGuide.available.manual.desc"}],r=[{titleKey:"basicDebugGuide.locked.project.title",descKey:"basicDebugGuide.locked.project.desc"},{titleKey:"basicDebugGuide.locked.upload.title",descKey:"basicDebugGuide.locked.upload.desc"},{titleKey:"basicDebugGuide.locked.platform.title",descKey:"basicDebugGuide.locked.platform.desc"}],o=["basicDebugGuide.step1","basicDebugGuide.step2","basicDebugGuide.step3","basicDebugGuide.step4"],h=()=>{const d=l();return e.jsxs("div",{className:"basic-debug-guide-page",children:[e.jsx(b,{className:"basic-debug-guide-banner",fullMode:!1,bordered:!1,closeIcon:null,type:"info",description:e.jsxs("div",{className:"basic-debug-guide-banner-copy",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.bannerTitle")}),e.jsx(s.Text,{children:i("basicDebugGuide.bannerDesc")})]})}),e.jsxs("section",{className:"basic-debug-guide-hero",children:[e.jsxs("div",{className:"basic-debug-guide-hero-copy",children:[e.jsx(s.Title,{heading:3,children:i("basicDebugGuide.title")}),e.jsx(s.Paragraph,{className:"basic-debug-guide-hero-desc",children:i("basicDebugGuide.desc")})]}),e.jsxs("div",{className:"basic-debug-guide-actions",children:[e.jsx(t,{theme:"solid",type:"primary",onClick:()=>d("/"),children:i("basicDebugGuide.actionScan")}),e.jsx(t,{theme:"light",onClick:()=>d("/network_diagnostics"),children:i("basicDebugGuide.actionNetwork")}),e.jsx(u,{href:n,children:i("basicDebugGuide.actionProxy")})]})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.availableTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.availableDesc")})]}),e.jsx("div",{className:"basic-debug-guide-list",children:g.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-item",children:[e.jsx("span",{className:"basic-debug-guide-item-index",children:a+1}),e.jsxs("div",{className:"basic-debug-guide-item-copy",children:[e.jsx(s.Text,{strong:!0,children:i(c.titleKey)}),e.jsx(s.Text,{children:i(c.descKey)})]})]},c.titleKey))})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.lockedTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.lockedDesc")})]}),e.jsx("div",{className:"basic-debug-guide-list",children:r.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-item basic-debug-guide-item-muted",children:[e.jsx("span",{className:"basic-debug-guide-item-index",children:a+1}),e.jsxs("div",{className:"basic-debug-guide-item-copy",children:[e.jsx(s.Text,{strong:!0,children:i(c.titleKey)}),e.jsx(s.Text,{children:i(c.descKey)})]})]},c.titleKey))})]}),e.jsxs("section",{className:"basic-debug-guide-section",children:[e.jsxs("div",{className:"basic-debug-guide-section-head",children:[e.jsx(s.Text,{strong:!0,children:i("basicDebugGuide.stepsTitle")}),e.jsx(s.Text,{className:"basic-debug-guide-section-desc",children:i("basicDebugGuide.stepsDesc")})]}),e.jsx("div",{className:"basic-debug-guide-steps",children:o.map((c,a)=>e.jsxs("div",{className:"basic-debug-guide-step",children:[e.jsx("span",{className:"basic-debug-guide-step-index",children:a+1}),e.jsx(s.Text,{children:i(c)})]},c))}),e.jsxs("div",{className:"basic-debug-guide-command-list",children:[e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandProxy")}),e.jsx("code",{children:"ttmg config set proxy http://127.0.0.1:7890"}),e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandProxyHint")})]}),e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandLogin")}),e.jsx("code",{children:"ttmg login"})]}),e.jsxs("div",{className:"basic-debug-guide-command-item",children:[e.jsx(s.Text,{type:"tertiary",children:i("basicDebugGuide.commandDev")}),e.jsx("code",{children:"ttmg dev"})]})]})]})]})};export{h as BasicDebugGuide};
@@ -1 +1 @@
1
- import{c as o,k as c,j as e,P as r,i as a}from"./index-DcpswdR4.js";import{S as t}from"./SectionHeader-BQDU_6TX.js";import{C as d,m,M as l,a as h,o as p}from"./MonetizationModeSummary-LeYQ02Tv.js";import"./index-BBHaV7vS.js";import{L as x,C as v}from"./layers-kzl3dc3j.js";import{C as y}from"./compass-DfWJoWl3.js";import"./Card-BC5ydRHh.js";const j=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],u=o("credit-card",j);const g=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],k=o("megaphone",g),N={iaa:k,iap:u,iaap:x},C=s=>a(s),A=()=>{const s=c();return e.jsxs("div",{className:"ia-page",children:[e.jsx(r,{title:a("ia.overview.title"),subtitle:a("ia.overview.desc")}),e.jsxs("section",{className:"ia-section ia-section-modes",children:[e.jsx(t,{icon:d,title:a("ia.monetization.title"),subtitle:a("ia.monetization.desc")}),e.jsx("div",{className:"ia-mode-grid",children:m.map(i=>{const n=N[i.key];return e.jsxs("button",{type:"button",className:`ia-mode-card ia-mode-card-${i.key}`,onClick:()=>s(`/integration_assistant/mode/${i.key}`),children:[e.jsxs("header",{className:"ia-mode-card-head",children:[e.jsx("span",{className:"ia-mode-card-badge","aria-hidden":"true",children:e.jsx(n,{size:17,strokeWidth:2})}),e.jsx("h4",{className:"ia-mode-card-title",children:C(i.titleKey)}),e.jsx("span",{className:"ia-mode-card-chevron","aria-hidden":"true",children:e.jsx(v,{size:14,strokeWidth:2})})]}),e.jsx(l,{mode:i,compact:!0})]},i.key)})})]}),e.jsxs("section",{className:"ia-section",children:[e.jsx(t,{icon:y,title:a("ia.overview.groups.title"),subtitle:a("ia.overview.groups.desc")}),e.jsx("div",{className:"ia-section-stack",children:e.jsx(h,{sections:p})})]})]})};export{A as IntegrationAssistant};
1
+ import{c as o,k as c,j as e,P as r,i as a}from"./index-Ch-x1uku.js";import{S as t}from"./SectionHeader-B4enohBu.js";import{C as d,m,M as l,a as h,o as p}from"./MonetizationModeSummary-CPfEj9Mb.js";import"./index-BzqMK93o.js";import{L as x,C as v}from"./layers-BNlp0M4b.js";import{C as y}from"./compass-CBzuVE9n.js";import"./Card-CEOgyxVl.js";const j=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],u=o("credit-card",j);const g=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],k=o("megaphone",g),N={iaa:k,iap:u,iaap:x},C=s=>a(s),A=()=>{const s=c();return e.jsxs("div",{className:"ia-page",children:[e.jsx(r,{title:a("ia.overview.title"),subtitle:a("ia.overview.desc")}),e.jsxs("section",{className:"ia-section ia-section-modes",children:[e.jsx(t,{icon:d,title:a("ia.monetization.title"),subtitle:a("ia.monetization.desc")}),e.jsx("div",{className:"ia-mode-grid",children:m.map(i=>{const n=N[i.key];return e.jsxs("button",{type:"button",className:`ia-mode-card ia-mode-card-${i.key}`,onClick:()=>s(`/integration_assistant/mode/${i.key}`),children:[e.jsxs("header",{className:"ia-mode-card-head",children:[e.jsx("span",{className:"ia-mode-card-badge","aria-hidden":"true",children:e.jsx(n,{size:17,strokeWidth:2})}),e.jsx("h4",{className:"ia-mode-card-title",children:C(i.titleKey)}),e.jsx("span",{className:"ia-mode-card-chevron","aria-hidden":"true",children:e.jsx(v,{size:14,strokeWidth:2})})]}),e.jsx(l,{mode:i,compact:!0})]},i.key)})})]}),e.jsxs("section",{className:"ia-section",children:[e.jsx(t,{icon:y,title:a("ia.overview.groups.title"),subtitle:a("ia.overview.groups.desc")}),e.jsx("div",{className:"ia-section-stack",children:e.jsx(h,{sections:p})})]})]})};export{A as IntegrationAssistant};
@@ -1 +1 @@
1
- import{t as ae,z as W,R as g,O as oe,n as de,W as pe,J as p,r as f,$ as Q,d as $,j as e,i as r,B as N,a as we,u as me,a0 as xe,f as H,D as ue,Q as be,a1 as je,k as ye,A as K,P as V,b as ve}from"./index-DcpswdR4.js";import{S as Ce}from"./SectionHeader-BQDU_6TX.js";import{C as B}from"./Card-BC5ydRHh.js";import{C as Se,a as re,U as Ne}from"./index-_IVh5FZw.js";import{I as ke,a as Ee,R as Pe,F as le}from"./baseForm-dqhahTXM.js";import{T as X}from"./index-BAmVtXgk.js";/* empty css */import{L as Oe}from"./list-checks-Ce0l0Ylc.js";import{S as $e}from"./sparkles-Dnyv9lnL.js";const z={PREFIX:`${ae}-steps`,ITEM:`${ae}-steps-item`};var A;(function(t){t.small="large",t.default="extra-large"})(A||(A={}));const Y=t=>{const{prefixCls:s,className:l,size:a,title:n,description:d,status:h,style:b,active:o,done:i,icon:c,stepNumber:w,onClick:C,onChange:m,onKeyDown:j}=t,v=()=>{let x,P;if("icon"in t)g.isValidElement(c)&&(x=c);else if("status"in t)switch(h){case"error":x=g.createElement(pe,{size:A[a]});break;case"wait":x=g.createElement("span",{className:`${s}-number-icon`},w);break;case"process":x=g.createElement("span",{className:`${s}-number-icon`},w),P=!0;break;case"finish":x=g.createElement(de,{size:A[a]});break;case"warning":x=g.createElement(oe,{size:A[a]});break;default:x=null;break}const _=W({[`${s}-icon`]:!0,[`${s}-custom-icon`]:"icon"in t,[`${s}-icon-process`]:P});return x?g.createElement("span",{className:_},x):null},S=W(s,`${s}-${h}`,{[`${s}-active`]:o,[`${s}-done`]:i,[`${s}-hover`]:m||t.onClick,[`${s}-clickable`]:m||C,[`${s}-${h}-hover`]:m||t.onClick},l),u=x=>{C?.(x),m?.()},y=x=>{x.key==="Enter"&&(j?.(x),m?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],tabIndex:0,"aria-current":"step",className:S,style:b,onClick:x=>u(x),onKeyDown:y},g.createElement("div",{className:`${s}-container`},g.createElement("div",{className:`${s}-left`},v()),g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`},g.createElement("div",{className:`${s}-title-text`},n)),d&&g.createElement("div",{className:`${s}-description`},d))))};Y.propTypes={prefixCls:p.string,description:p.node,icon:p.node,status:p.oneOf(["wait","process","finish","error","warning"]),title:p.node,className:p.string,style:p.object,onClick:p.func,active:p.bool,done:p.bool};Y.defaultProps={prefixCls:z.ITEM,active:!1,done:!1,status:"wait",className:""};const J=t=>{const{prefixCls:s,className:l,title:a,description:n,status:d,style:h,onClick:b,icon:o,onChange:i,stepNumber:c,onKeyDown:w}=t,C=()=>{let v,S;if("icon"in t)v=o;else if("status"in t)switch(d){case"error":v=g.createElement(pe,{size:"extra-large"});break;case"wait":v=c;break;case"process":v=c,S=!0;break;case"finish":v=g.createElement(de,{size:"extra-large"});break;case"warning":v=g.createElement(oe,{size:"extra-large"});break;default:v=null;break}const u=W({[`${s}-left`]:!0,[`${s}-icon`]:"icon"in t,[`${s}-plain`]:!("icon"in t),[`${s}-icon-process`]:S,[`${s}-hover`]:i||b});return v?g.createElement("div",{className:u},v):null},m=v=>{b?.(v),i?.()},j=v=>{v.key==="Enter"&&(w?.(v),i?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],"aria-current":"step",tabIndex:0,className:W({[s]:!0,[`${s}-${d}`]:!!d,[`${s}-${d}-hover`]:!!d&&(i||b),[`${s}-${d}-active`]:!!d&&(i||b),[`${s}-clickable`]:i||b},l),style:h,onClick:v=>{m(v)},onKeyDown:j},C(),g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`,title:typeof a=="string"?a:null},g.createElement("span",{className:`${s}-title-text`},a)),g.createElement("div",{className:`${s}-description`,title:typeof n=="string"?n:null},n)))};J.propTypes={prefixCls:p.string,description:p.node,icon:p.node,status:p.oneOf(["wait","process","finish","error","warning"]),title:p.node,className:p.string,style:p.object,onClick:p.func};J.defaultProps={prefixCls:z.ITEM,status:"wait",className:""};const Z=t=>{const{prefixCls:s,className:l,title:a,style:n,active:d,index:h,total:b,onClick:o,onKeyDown:i,onChange:c}=t,w=W(s,{[`${s}-active`]:d},l),C=j=>{o?.(j),c?.()},m=j=>{j.key==="Enter"&&(i?.(j),c?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],"aria-current":"step",tabIndex:0,className:w,style:n,onClick:j=>C(j),onKeyDown:m},g.createElement("div",{className:`${s}-container`},g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`},a)),h!==b-1&&g.createElement("div",{className:`${s}-icon`},g.createElement(ke,{size:"small"}))))};Z.propTypes={prefixCls:p.string,title:p.node,className:p.string,style:p.object,onClick:p.func,active:p.bool};Z.defaultProps={prefixCls:z.ITEM,active:!1,className:""};const fe=g.createContext(null),Te=t=>{const{type:s}=f.useContext(fe);return(()=>{switch(s){case"fill":return g.createElement(J,Object.assign({},t));case"basic":return g.createElement(Y,Object.assign({},t));case"nav":return g.createElement(Z,Object.assign({},t));default:return null}})()};var _e=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const ee=t=>{const{current:s,status:l,children:a,prefixCls:n,initial:d,direction:h,className:b,style:o,onChange:i}=t,c=_e(t,["current","status","children","prefixCls","initial","direction","className","style","onChange"]),w=f.useMemo(()=>{const m=f.Children.toArray(a).filter(S=>f.isValidElement(S)),j=h==="vertical"?null:{width:`${100/m.length}%`};return f.Children.map(m,(S,u)=>{if(!S)return null;const y=d+u,x=Object.assign({stepNumber:`${y+1}`,direction:h},S.props);return l==="error"&&u===s-1&&(x.className=`${n}-next-error`),S.props.status||(y===s?x.status=l:y<s?x.status="finish":x.status="wait"),x.onChange=i?()=>{u!==s&&i(u+d)}:void 0,g.createElement(Ee,{style:j},f.cloneElement(S,Object.assign({},x)))})},[a,d,n,h,l,s,i]),C=W(b,{[n]:!0,[`${n}-${h}`]:!0});return g.createElement("div",Object.assign({className:C,style:o,"aria-label":t["aria-label"]},Q(c)),g.createElement(Pe,{type:"flex",justify:"start"},w))};ee.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,direction:p.oneOf(["horizontal","vertical"]),status:p.oneOf(["wait","process","finish","error","warning"])};ee.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",initial:0,status:"process"};var We=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const te=t=>{const{size:s,current:l,status:a,children:n,prefixCls:d,initial:h,direction:b,className:o,style:i,hasLine:c,onChange:w}=t,C=We(t,["size","current","status","children","prefixCls","initial","direction","className","style","hasLine","onChange"]),m=f.useMemo(()=>{const v=f.Children.toArray(n).filter(u=>f.isValidElement(u));return f.Children.map(v,(u,y)=>{if(!u)return null;const x=h+y,P=Object.assign({stepNumber:`${x+1}`,size:s},u.props);return a==="error"&&y===l-1&&(P.className=`${d}-next-error`),u.props.status||(x===l?P.status=a:x<l?P.status="finish":P.status="wait"),P.active=x===l,P.done=x<l,P.onChange=w?()=>{y!==l&&w(y+h)}:void 0,f.cloneElement(u,Object.assign({},P))})},[n,h,d,b,a,l,s,w]),j=W(o,{[`${d}-basic`]:!0,[`${d}-${b}`]:!0,[`${d}-${s}`]:s!=="default",[`${d}-hasline`]:c});return g.createElement("div",Object.assign({"aria-label":t["aria-label"],className:j,style:i},Q(C)),m)};te.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,direction:p.oneOf(["horizontal","vertical"]),status:p.oneOf(["wait","process","finish","error","warning"]),hasLine:p.bool};te.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",size:"",initial:0,hasLine:!0,status:"process"};var Re=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const se=t=>{const{size:s,current:l,initial:a,children:n,prefixCls:d,className:h,style:b,onChange:o}=t,i=Re(t,["size","current","initial","children","prefixCls","className","style","onChange"]),c=f.useMemo(()=>{const C=f.Children.toArray(n).filter(v=>f.isValidElement(v)),m=C.length;return f.Children.map(C,(v,S)=>{if(!v)return null;const u=Object.assign({index:S,total:m},v.props);return u.active=S===l,u.onChange=o?()=>{S!==l&&o(S+a)}:void 0,f.cloneElement(v,Object.assign({},u))})},[n,d,l,s,a,o]),w=W(h,{[`${d}-nav`]:!0,[`${d}-${s}`]:s!=="default"});return g.createElement("div",Object.assign({"aria-label":t["aria-label"],className:w,style:b},Q(i)),c)};se.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,size:p.oneOf(["small","default"])};se.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",size:"default",initial:0,status:"process"};var De=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};class F extends f.Component{renderComponent(){const s=this.props,{type:l}=s,a=De(s,["type"]);switch(l){case"fill":return g.createElement(ee,Object.assign({},a));case"basic":return g.createElement(te,Object.assign({},a));case"nav":return g.createElement(se,Object.assign({},a));default:return null}}render(){const{type:s}=this.props;return g.createElement(fe.Provider,{value:{type:s}},this.renderComponent())}}F.Step=Te;F.propTypes={onChange:p.func,type:p.oneOf(["fill","basic","nav"]),size:p.oneOf(["small","default"])};F.defaultProps={type:"fill",size:"default"};const D={Idle:0,WasmPreparing:1,WasmPrepared:2,WasmSplitIssued:3,WasmSplitting:4,WasmSplitDone:5,WasmReadyToPrepare:6,WasmSplitPreparing:7,WasmPreparedSuccess:8,WasmCollecting:9,WasmUploadFail:-1,WasmDownloadFail:-2,WasmFileNotExist:-3,WasmSplitFail:-4,WasmSplitUpdateDBFail:-5,WasmSplitPrepareFail:-6,WasmPrepareFailed:-1};function ne({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-split-config",method:"GET",data:{codeMd5:t,clientKey:s}})}function Fe(t){const{codePath:s,codeMd5:l,clientKey:a,desc:n}=t;return $({url:"/game/wasm-prepare",method:"POST",data:{codePath:s,clientKey:a,codeMd5:l,desc:n}})}function Ie({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-prepare-result",method:"POST",data:{codeMd5:t,clientKey:s}})}function ze(t,s){const l=s?.intervalMs,a=s?.maxAttempts,n=s?.signal||new AbortController().signal;let d=0;return new Promise((h,b)=>{if(n?.aborted){b(new DOMException("Polling aborted","AbortError"));return}const o=()=>{clearTimeout(i),b(new DOMException("Polling aborted","AbortError"))};n?.addEventListener("abort",o,{once:!0});let i;const c=async()=>{d+=1;try{const w=await Ie(t),{status:C}=w.data;if(C===D.WasmPreparedSuccess||C===D.WasmSplitDone){h(w);return}if(C<0){h(w);return}if(d>=a){b(new Error(`Polling timeout after ${a} attempts`));return}i=window.setTimeout(c,l)}catch(w){if(d>=a){b(w);return}i=window.setTimeout(c,l)}};c()})}function Me({codeMd5:t,clientKey:s,codePath:l}){return $({url:"/game/wasm-prepare-download",method:"POST",data:{codeMd5:t,clientKey:s,codePath:l}})}function qe(t){const{codeMd5:s,clientKey:l,archive:a}=t;return $({url:"/game/wasm-split",method:"POST",data:{codeMd5:s,clientKey:l,archive:a??!1}})}function Ae(t){return $({url:"/game/wasm-split-download",method:"POST",data:t})}function he(t){const{codeMd5:s,clientKey:l,codePath:a}=t;return $({url:"/game/wasm-split-reset",method:"POST",data:{codeMd5:s,clientKey:l,codePath:a}})}function Le({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-taskinfo",method:"GET",data:{codeMd5:t,clientKey:s}})}function Ue({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-collect-start",method:"POST",data:{codeMd5:t,clientKey:s}})}function Be({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-set-collect",method:"POST",data:{codeMd5:t,clientKey:s}})}function ie(t){return $({url:"/game/wasm-collect-funcids",method:"GET",data:t})}function He(t){return $({url:"/game/wasm-collect-info",method:"GET",data:t})}const Ge=({onSubmit:t,onCancel:s,onChange:l})=>e.jsxs(le,{style:{width:"100%"},onChange:l,onSubmit:t,children:[e.jsx(le.TextArea,{rules:[{required:!0,message:r("inputSplitDesc")}],label:r("splitDesc"),placeholder:r("inputSplitDesc"),field:"desc"}),e.jsxs("div",{className:"wasm-prepare-form-button-container",children:[e.jsx(N,{type:"primary",htmlType:"submit",style:{marginRight:12},children:r("startPrepare")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancel")})]})]}),E={init:"init",start:"start",processing:D.WasmPreparing,processingReady:D.WasmReadyToPrepare,success:D.WasmPreparedSuccess,failed:D.WasmPrepareFailed,splitDone:D.WasmSplitDone},Ke=({codePath:t,codeMd5:s,clientKey:l,onCancel:a,onNext:n,onHide:d})=>{const[h,b]=f.useState(""),[o,i]=f.useState({code:0,data:{status:E.init}}),c=f.useRef(null),w=f.useMemo(()=>o?.data?.status,[o?.data?.status]),C=()=>{c.current?.abort(),a(),he({codeMd5:s,clientKey:l,codePath:t}).then(u=>{u.code===0&&i({...o,data:{...o?.data,status:E.init}})})},m=async()=>{c.current=new AbortController,i({code:0,data:{status:E.start}}),Fe({codePath:t,codeMd5:s,clientKey:l,desc:h}).then(u=>{u.code===0||u?.error?.code===10024||u?.error?.code===10028?(i({...u,data:{...u?.data,status:E.processing}}),j()):i({...o,error:u?.error||{code:-1,message:"Internal server error, please try again later..."},data:{...o?.data,status:E.failed}})})},j=()=>{ze({codeMd5:s,clientKey:l},{intervalMs:2e3,maxAttempts:240,signal:c.current?.signal}).then(u=>{u.code===0?Me({codeMd5:s,clientKey:l,codePath:t}).then(y=>{y.code===0?n():i({...o,error:{code:-1,message:y?.error?.message||"Download prepared wasm failed"},data:{...o?.data,status:E.failed}})}).catch(y=>{i({...o,error:{code:-1,message:y?.message||"Download prepared wasm failed"},data:{...o?.data,status:E.failed}})}):i({...o,data:{...o?.data,status:E.failed}})}).catch(u=>{u?.name!=="AbortError"&&i(y=>({...y,error:{code:-1,message:u?.message||"Polling failed"},data:{...y?.data,status:E.failed}}))})},v=u=>{b(u?.values?.desc)};let S=null;switch(w){case E.init:S=e.jsx(Ge,{onSubmit:m,onCancel:a,onChange:v});break;case E.start:S=e.jsxs("div",{className:"wasm-prepare-processing-content",children:[e.jsx("div",{className:"wasm-prepare-processing-spinner",role:"status","aria-label":r("startingPrepare")}),e.jsx("div",{className:"wasm-prepare-processing-text",children:r("startingPrepare")}),e.jsxs("div",{className:"wasm-prepare-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:a,children:r("cancelPrepare")}),e.jsx(N,{type:"primary",onClick:()=>d(),children:r("backgroundRun")})]})]});break;case E.processing:case E.processingReady:S=e.jsxs("div",{className:"wasm-prepare-processing-content",children:[e.jsx("div",{className:"wasm-prepare-processing-spinner",role:"status","aria-label":r("preparingSplit")}),e.jsx("div",{className:"wasm-prepare-processing-text",children:r("preparingSplit")}),e.jsx("div",{className:"wasm-prepare-processing-warning",children:r("warningDuringPreparing")}),e.jsxs("div",{className:"wasm-prepare-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:()=>{C()},children:r("cancelPrepare")}),e.jsx(N,{type:"primary",onClick:()=>d(),children:r("backgroundRun")})]})]});break;case E.success:case E.splitDone:break;case E.failed:const u=o?.error?.message||"Unknown error";S=e.jsxs("div",{className:"wasm-prepare-failed-content",children:[e.jsx("div",{className:"wasm-prepare-failed-text",children:r("preparingSplitFailed")}),o?.data?.status===E.failed&&e.jsx("div",{className:"wasm-prepare-failed-warning",children:u}),e.jsx(N,{type:"tertiary",style:{marginTop:12},onClick:m,children:r("retryPrepare")})]});break;default:S=null}return e.jsx("div",{className:"wasm-prepare-content-container",children:S})},Ve=({data:t})=>{const s={...t||{}},l=[{label:"Client key",value:"app_id"},{label:r("wasmSize"),value:"wasm_size",render:a=>`${(a/1024/1024).toFixed(2)} MB`},{label:r("totalFuncCount"),value:"total_wasm_func_count",render:a=>a>=1e3?`${(a/1e3).toFixed(2)} K`:`${a}`},{label:r("collectedFuncCount"),value:"collected_func_count",render:a=>a>=1e3?`${(a/1e3).toFixed(2)} K`:`${a}`},{label:"Wasm md5",value:"wasm_md5"}];return e.jsx("div",{className:"wasm-collect-status",children:l.map(a=>e.jsxs("div",{className:"wasm-collect-status-item",children:[e.jsx(we,{size:"small",className:"wasm-collect-status-item-label",children:a.label}),e.jsx("span",{className:"wasm-collect-status-item-value",children:a.render?.(s[a.value])||s[a.value]})]},a.value))})},Xe="https://bytedance.larkoffice.com/wiki/OyGMwHVW9iSeneknlOcc2qb6nUh",Qe=({onNext:t,onCancel:s,codeMd5:l,clientKey:a,onHide:n})=>{const{state:{devSchema:d,schema:h,selectedLaunchOption:b,isConnected:o}}=me(),i=f.useMemo(()=>{if(h)return xe({baseSchema:h,option:b,debugMode:"clientPreview"});if(!d)return"";if(/([?&])debugMode=/.test(d))return d.replace(/([?&])debugMode=[^&]*/,"$1debugMode=clientPreview");const O=d.includes("?")?"&":"?";return`${d}${O}debugMode=clientPreview`},[d,h,b]),[c,w]=f.useState("startCollect"),[C,m]=f.useState(),[j,v]=f.useState(),[S,u]=f.useState(0),y=f.useRef(null),x=f.useRef(!1),P=f.useRef(!1),_=.08,I=f.useMemo(()=>{if(!j)return!1;const O=j?.total_wasm_func_count;return O?S/O>=_:!1},[j,S]);f.useEffect(()=>{if(c!=="collecting"){y.current&&(window.clearInterval(y.current),y.current=null);return}if(y.current)return;const O=T=>{u(T.data?.collected_func_count||0);const q=T.data?.collect_state;q==="closed"&&!x.current?(x.current=!0,X.warning({content:r("collect.sessionClosed"),duration:5})):q==="open"&&(x.current=!1)};return ie({codeMd5:l,clientKey:a}).then(O).catch(console.error),y.current=window.setInterval(()=>{ie({codeMd5:l,clientKey:a}).then(O).catch(T=>{console.error(T)})},2e3),()=>{y.current&&(window.clearInterval(y.current),y.current=null)}},[c,l,a]);const M=async()=>{if(c!=="collecting")try{if(w("startCollect"),(await Ue({codeMd5:l,clientKey:a})).code!==0){w("willCollect");return}Be({codeMd5:l,clientKey:a}).catch(console.error),w("collecting"),Le({codeMd5:l,clientKey:a}).then(T=>{m(T.data)}).catch(console.error),He({codeMd5:l,clientKey:a}).then(T=>{v(T.data||{})}).catch(console.error)}catch(O){console.error(O),X.error({content:r("collect.startFailed"),duration:4}),w("willCollect")}};f.useEffect(()=>{P.current||(P.current=!0,M())},[]);const L=()=>{y.current&&(window.clearInterval(y.current),y.current=null),w("willCollect"),t()};return e.jsxs("div",{className:"wasm-collect-content-container",children:[c!=="willCollect"&&(C?e.jsx(Ve,{data:{...C||{},total_wasm_func_count:j?.total_wasm_func_count,collected_func_count:S}}):e.jsxs("div",{className:"wasm-collect-status-loading",children:[e.jsx(H,{size:"middle"}),e.jsx("span",{className:"wasm-collect-status-loading-text",children:r("startingCollect")})]})),e.jsxs("div",{className:"collect-requirements-notice",role:"note",children:[e.jsx("span",{className:"collect-requirements-notice-title",children:r("collect.requirements.title")}),e.jsxs("span",{className:"collect-requirements-notice-desc",children:[r("collect.requirements.desc")," ",e.jsx(ue,{href:Xe,children:r("collect.requirements.link")})]})]}),o&&c!=="willCollect"?e.jsxs("div",{className:"collect-connected-panel",children:[e.jsx("span",{className:"collect-connected-dot",role:"status","aria-label":r("collectConnectedTitle")}),e.jsx("div",{className:"collect-connected-title",children:r("collectConnectedTitle")}),e.jsx("div",{className:"collect-qrcode-desc",children:r("collectConnectedDesc")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"collect-qrcode-container",children:e.jsx(be,{value:i})}),e.jsx("div",{className:"collect-qrcode-desc",children:r("collectDesc")})]}),e.jsxs("div",{className:"collect-qrcode-button-container",children:[c==="willCollect"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"primary",onClick:M,children:r("startCollect")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancelSplit")})]}),c!=="willCollect"&&e.jsxs(e.Fragment,{children:[I?e.jsx(N,{type:"primary",onClick:L,children:r("startSplit")}):e.jsx(je,{content:r("cannotSplitTip"),children:e.jsx(N,{type:"primary",disabled:!0,children:r("startSplit")})}),e.jsx(N,{type:"tertiary",onClick:n,children:r("backgroundRun")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancelSplit")})]})]})]})},Ye=({onCancel:t,onHide:s,codeMd5:l,clientKey:a,archive:n})=>{const[d,h]=f.useState("spliting"),[b,o]=f.useState(""),i=()=>{h("spliting"),o(""),qe({codeMd5:l,clientKey:a,archive:n}).then(w=>{if(w.code===0){const C=w.data?.func_count;return h("writing"),Ae({}).then(m=>{m.code===0?(h("success"),typeof C=="number"&&C>0&&X.success({content:r("wasmSplit.splitDoneToast",{count:String(C)}),duration:3})):(o(m?.error?.message||m?.error?.errorMsg||m?.msg||r("splitFailed")),h("writeFailed"))})}else o(w?.error?.message||w?.msg||r("splitFailed")),h("splitFailed")}).catch(w=>{o(w?.message||r("splitFailed")),h("splitFailed")})};f.useEffect(()=>{i()},[]);let c=null;switch(d){case"spliting":c=e.jsxs("div",{className:"wasm-split-processing",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"wasm-split-processing-content",children:r("splittingDesc")}),e.jsxs("div",{className:"wasm-split-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:()=>t(),children:r("cancelSplit")}),e.jsx(N,{type:"primary",onClick:()=>s(),children:r("backgroundRun")})]})]});break;case"writing":c=e.jsxs("div",{className:"wasm-split-processing",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"wasm-split-processing-content",children:r("writingSplitResult")||"正在写入分包产物..."})]});break;case"splitFailed":case"writeFailed":c=e.jsxs("div",{className:"wasm-split-failed",children:[e.jsx("div",{className:"wasm-split-failed-content",children:b||r("splitFailed")}),e.jsxs("div",{className:"wasm-split-failed-retry",children:[e.jsx(N,{type:"primary",onClick:()=>i(),children:r("retry")||"重试"}),e.jsx(N,{type:"tertiary",onClick:()=>t(),children:r("cancelSplit")})]})]});break;case"success":c=e.jsxs("div",{className:"wasm-split-success",children:[e.jsx("div",{className:"wasm-split-success-content",children:r("downloadSplitResultSuccess")}),e.jsx("div",{className:"wasm-split-success-tip",children:r("downloadSplitResultTip")})]});break;default:c=null}return e.jsx("div",{className:"wasm-split-content-container",children:c})},Je=({onCancel:t})=>e.jsx("div",{className:"wasm-splitted",children:e.jsxs("div",{className:"wasm-splitted-panel",children:[e.jsx("div",{className:"wasm-splitted-icon","aria-hidden":"true",children:e.jsx(Se,{size:26,strokeWidth:2})}),e.jsx("div",{className:"wasm-splitted-title",children:r("hasSplitedTitle")}),e.jsx("div",{className:"wasm-splitted-desc",children:r("hasSplitedDesc")}),e.jsx("div",{className:"wasm-splitted-actions",children:e.jsx(N,{type:"primary",onClick:t,children:r("hasSplitedDiscard")})})]})}),R={prepare:{number:0,get title(){return r("splitPrepare")},get description(){return r("splitPrepare.desc")}},collect:{number:1,get title(){return r("splitCollect")},get description(){return r("splitCollect.desc")}},split:{number:2,get title(){return r("splitCode")},get description(){return r("splitCode.desc")}},rollback:{number:3,get title(){return r("rollback")},description:""}},Ze=({stage:t})=>e.jsxs(F,{type:"basic",current:R[t].number,className:"tt-wasm-steps",children:[e.jsx(F.Step,{title:R.prepare.title,description:R.prepare.description}),e.jsx(F.Step,{title:R.collect.title,description:R.collect.description}),e.jsx(F.Step,{title:R.split.title,description:R.split.description})]}),et=({onCancel:t,errorType:s,onHide:l})=>e.jsxs("div",{className:"wasm-code-split-error",children:[s==="noWasmCode"&&e.jsxs("div",{className:"wasm-code-split-error-container",children:[e.jsx("div",{className:"wasm-code-split-error-title",children:r("noWasmCode")}),e.jsx("div",{className:"wasm-code-split-error-desc",children:r("noWasmCodeDesc")})]}),s==="noSplitConfig"&&e.jsxs("div",{className:"wasm-code-split-error-container",children:[e.jsx("div",{className:"wasm-code-split-error-title",children:r("noSplitConfigTitle")}),e.jsx("div",{className:"wasm-code-split-error-desc",children:r("noSplitConfigDesc")})]})]}),ce=()=>e.jsxs("div",{className:"split-loading",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"split-loading-text",children:r("wasmSplit.initializingEnv")})]}),tt=({codeMd5:t,clientKey:s,codePath:l,onHide:a,onReset:n})=>{const[d,h]=f.useState("rollbacking"),b=()=>{h("rollbacking"),he({codeMd5:t,clientKey:s,codePath:l}).then(c=>{c.code===0?(h("rollbackSuccess"),n()):h("rollbackFailed")})};f.useEffect(()=>{b()},[]);let o="",i=null;switch(d){case"rollbacking":o=r("rollback.rollbacking"),i=e.jsx(N,{onClick:()=>{h("rollbackFailed")},children:r("rollback.backgroundRun")});break;case"rollbackSuccess":o=r("rollback.success"),i=e.jsx(N,{onClick:()=>{a()},children:r("rollback.close")});break;case"rollbackFailed":o=r("rollback.failed"),i=e.jsx(N,{onClick:()=>{b()},children:r("rollback.retry")});break}return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"wasm-split-rollback-container",children:[e.jsx("div",{className:"wasm-split-rollback-text",children:o}),i]})})};function st({enableWasmCollect:t,enableWasmSplit:s}){return typeof t=="boolean"&&(typeof s=="string"||s===!1)?t:!1}function at({enableWasmSplit:t,hasWasmCode:s}){return t===!0?{errorType:"hasSplited",hasError:!0}:s?{hasError:!1}:{errorType:"noWasmCode",hasError:!0}}const rt="https://bytedance.larkoffice.com/wiki/OyGMwHVW9iSeneknlOcc2qb6nUh",lt={loading:"neutral",prepare:"accent",collect:"accent",split:"success",splitted:"success",rollback:"warn",error:"error"},nt=t=>({label:r(`wasmSplit.stage.${t}`),tone:lt[t]}),it=t=>{const s=a=>r(`wasmSplit.help.${t}.${a}`),l={loading:["line1"],prepare:["line1","line2"],collect:["line1","line2","line3"],split:["line1","line2"],splitted:["line1"],rollback:["line1"],error:["line1"]};return{title:s("title"),lines:l[t].map(s)}},wt=()=>{const t=ye(),{state:{engine:s,packages:l,gameDetail:a,debugMode:n},setDebugMode:d,setPackages:h}=me();f.useEffect(()=>{s==="unity"&&n!=="clientPreview"&&d("clientPreview")},[s,n,d]);const b=l?.find(k=>k.name==="wasmcode"),o=b?.root||"",i=b?.md5||"",c=a?.client_key||"",[w,C]=f.useState(""),[m,j]=f.useState("loading"),[v,S]=f.useState(null),u=a===null,y=!u&&(!i||!c);f.useEffect(()=>{u||y||(j("loading"),ne({codeMd5:i,clientKey:c}).then(k=>{if(k.code===0){const{errorType:U,hasError:G}=at({enableWasmSplit:k.data.enableWasmSplit,hasWasmCode:!!o});G?(C(U),j(U==="hasSplited"?"splitted":"error")):st(k.data)?j("collect"):j("prepare"),S(k.data)}else C("noSplitConfig"),j("error")}))},[i,c,o,u,y]);const x=()=>{j("rollback")},P=f.useCallback(async()=>{try{const k=await $({url:"/game/config",method:"GET"});!k.error&&k.data?.packages&&h(k.data.packages)}catch{}j("prepare")},[h]),_=()=>{t("/")},I=()=>{t("/performance")},M=(k,U,G,ge)=>e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit")})]}),e.jsxs(B,{padding:"lg",className:"tt-wasm-split-empty-card",children:[e.jsx("div",{className:"tt-wasm-split-empty-icon","aria-hidden":"true",children:e.jsx(re,{size:24,strokeWidth:1.75})}),e.jsx("h2",{className:"tt-wasm-split-empty-title",children:k}),e.jsx("p",{className:"tt-wasm-split-empty",children:U}),e.jsx("div",{className:"tt-wasm-split-empty-actions",children:e.jsx("button",{type:"button",className:"tt-wasm-split-empty-cta",onClick:()=>t(ge),children:G})})]})]});if(u)return e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit")})]}),e.jsx(B,{padding:"lg",children:e.jsx(ce,{})})]});if(s&&s!=="unity")return M(r("wasmSplit.empty.unityOnly.title"),r("wasmSplit.empty.unityOnly.desc"),r("performance.back"),"/performance");if(y)return M(r("wasmSplit.empty.needDevice.title"),r("wasmSplit.empty.needDevice.desc"),r("wasmSplit.empty.connectDevice"),"/");const L=nt(m),O=it(m),T=m==="collect"||m==="split",q=m!=="error"&&m!=="loading"&&m!=="splitted";return e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit"),subtitle:r("wasmSplit.subtitle"),action:e.jsx(ve,{tone:L.tone,withDot:!0,variant:"solid",children:L.label})})]}),e.jsxs("div",{className:"tt-wasm-requirements-notice",role:"note",children:[e.jsx("span",{className:"tt-wasm-requirements-notice-icon","aria-hidden":"true",children:e.jsx(Oe,{size:18,strokeWidth:2})}),e.jsxs("span",{className:"tt-wasm-requirements-notice-copy",children:[e.jsx("span",{className:"tt-wasm-requirements-notice-title",children:r("wasmSplit.requirements.title")}),e.jsxs("ul",{className:"tt-wasm-requirements-notice-list",children:[e.jsx("li",{children:r("wasmSplit.requirements.account")}),e.jsxs("li",{children:[r("wasmSplit.requirements.unityPlugin")," ",e.jsx(ue,{href:rt,children:r("wasmSplit.requirements.unityPluginLink")})]})]})]})]}),e.jsxs("div",{className:"tt-wasm-split-grid",children:[e.jsx("aside",{className:"tt-wasm-split-helper",children:e.jsx(B,{padding:"lg",className:"tt-wasm-split-helper-card",children:e.jsx("div",{className:"tt-wasm-split-helper-grid",children:e.jsxs("div",{className:"tt-wasm-split-helper-main",children:[e.jsx(Ce,{icon:m==="error"?re:$e,title:O.title}),e.jsx("ul",{className:"tt-wasm-split-helper-list",children:O.lines.map(k=>e.jsx("li",{children:k},k))})]})})})}),e.jsxs(B,{padding:"lg",className:"tt-wasm-split-workflow-card",children:[m==="loading"&&e.jsx(ce,{}),m==="splitted"&&e.jsx(Je,{onCancel:x}),m==="error"&&w&&e.jsx(et,{errorType:w,onCancel:x,onHide:_}),T&&e.jsx("div",{className:"tt-wasm-split-upload-row",children:e.jsx(Ne,{})}),q&&e.jsx("div",{className:"tt-wasm-split-steps-wrap",children:e.jsx(Ze,{stage:m})}),q&&e.jsxs("div",{className:"tt-wasm-split-stage",children:[m==="prepare"&&e.jsx(Ke,{codeMd5:i,codePath:o,clientKey:c,onCancel:I,onNext:()=>j("collect"),onHide:_}),m==="collect"&&e.jsx(Qe,{codeMd5:i,clientKey:c,onCancel:x,onHide:_,onNext:()=>{ne({codeMd5:i,clientKey:c}).then(k=>{k.code===0&&S(k.data),j("split")})}}),m==="split"&&e.jsx(Ye,{codePath:o,codeMd5:i,clientKey:c,archive:v?.enableArchiveMode===!0,onCancel:x,onHide:_}),m==="rollback"&&e.jsx(tt,{codeMd5:i,clientKey:c,codePath:o,onHide:_,onReset:P})]})]})]})]})};export{wt as WasmCodeSplit};
1
+ import{t as ae,z as W,R as g,O as oe,n as de,W as pe,J as p,r as f,$ as Q,d as $,j as e,i as r,B as N,a as we,u as me,a0 as xe,f as H,D as ue,Q as be,a1 as je,k as ye,A as K,P as V,b as ve}from"./index-Ch-x1uku.js";import{S as Ce}from"./SectionHeader-B4enohBu.js";import{C as B}from"./Card-CEOgyxVl.js";import{C as Se,a as re,U as Ne}from"./index-C6wDirYQ.js";import{I as ke,a as Ee,R as Pe,F as le}from"./baseForm-CIfNsMWn.js";import{T as X}from"./index-BwTml-YL.js";/* empty css */import{L as Oe}from"./list-checks-D93xMCZ8.js";import{S as $e}from"./sparkles-BLvO5p7R.js";const z={PREFIX:`${ae}-steps`,ITEM:`${ae}-steps-item`};var A;(function(t){t.small="large",t.default="extra-large"})(A||(A={}));const Y=t=>{const{prefixCls:s,className:l,size:a,title:n,description:d,status:h,style:b,active:o,done:i,icon:c,stepNumber:w,onClick:C,onChange:m,onKeyDown:j}=t,v=()=>{let x,P;if("icon"in t)g.isValidElement(c)&&(x=c);else if("status"in t)switch(h){case"error":x=g.createElement(pe,{size:A[a]});break;case"wait":x=g.createElement("span",{className:`${s}-number-icon`},w);break;case"process":x=g.createElement("span",{className:`${s}-number-icon`},w),P=!0;break;case"finish":x=g.createElement(de,{size:A[a]});break;case"warning":x=g.createElement(oe,{size:A[a]});break;default:x=null;break}const _=W({[`${s}-icon`]:!0,[`${s}-custom-icon`]:"icon"in t,[`${s}-icon-process`]:P});return x?g.createElement("span",{className:_},x):null},S=W(s,`${s}-${h}`,{[`${s}-active`]:o,[`${s}-done`]:i,[`${s}-hover`]:m||t.onClick,[`${s}-clickable`]:m||C,[`${s}-${h}-hover`]:m||t.onClick},l),u=x=>{C?.(x),m?.()},y=x=>{x.key==="Enter"&&(j?.(x),m?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],tabIndex:0,"aria-current":"step",className:S,style:b,onClick:x=>u(x),onKeyDown:y},g.createElement("div",{className:`${s}-container`},g.createElement("div",{className:`${s}-left`},v()),g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`},g.createElement("div",{className:`${s}-title-text`},n)),d&&g.createElement("div",{className:`${s}-description`},d))))};Y.propTypes={prefixCls:p.string,description:p.node,icon:p.node,status:p.oneOf(["wait","process","finish","error","warning"]),title:p.node,className:p.string,style:p.object,onClick:p.func,active:p.bool,done:p.bool};Y.defaultProps={prefixCls:z.ITEM,active:!1,done:!1,status:"wait",className:""};const J=t=>{const{prefixCls:s,className:l,title:a,description:n,status:d,style:h,onClick:b,icon:o,onChange:i,stepNumber:c,onKeyDown:w}=t,C=()=>{let v,S;if("icon"in t)v=o;else if("status"in t)switch(d){case"error":v=g.createElement(pe,{size:"extra-large"});break;case"wait":v=c;break;case"process":v=c,S=!0;break;case"finish":v=g.createElement(de,{size:"extra-large"});break;case"warning":v=g.createElement(oe,{size:"extra-large"});break;default:v=null;break}const u=W({[`${s}-left`]:!0,[`${s}-icon`]:"icon"in t,[`${s}-plain`]:!("icon"in t),[`${s}-icon-process`]:S,[`${s}-hover`]:i||b});return v?g.createElement("div",{className:u},v):null},m=v=>{b?.(v),i?.()},j=v=>{v.key==="Enter"&&(w?.(v),i?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],"aria-current":"step",tabIndex:0,className:W({[s]:!0,[`${s}-${d}`]:!!d,[`${s}-${d}-hover`]:!!d&&(i||b),[`${s}-${d}-active`]:!!d&&(i||b),[`${s}-clickable`]:i||b},l),style:h,onClick:v=>{m(v)},onKeyDown:j},C(),g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`,title:typeof a=="string"?a:null},g.createElement("span",{className:`${s}-title-text`},a)),g.createElement("div",{className:`${s}-description`,title:typeof n=="string"?n:null},n)))};J.propTypes={prefixCls:p.string,description:p.node,icon:p.node,status:p.oneOf(["wait","process","finish","error","warning"]),title:p.node,className:p.string,style:p.object,onClick:p.func};J.defaultProps={prefixCls:z.ITEM,status:"wait",className:""};const Z=t=>{const{prefixCls:s,className:l,title:a,style:n,active:d,index:h,total:b,onClick:o,onKeyDown:i,onChange:c}=t,w=W(s,{[`${s}-active`]:d},l),C=j=>{o?.(j),c?.()},m=j=>{j.key==="Enter"&&(i?.(j),c?.())};return g.createElement("div",{role:t.role,"aria-label":t["aria-label"],"aria-current":"step",tabIndex:0,className:w,style:n,onClick:j=>C(j),onKeyDown:m},g.createElement("div",{className:`${s}-container`},g.createElement("div",{className:`${s}-content`},g.createElement("div",{className:`${s}-title`},a)),h!==b-1&&g.createElement("div",{className:`${s}-icon`},g.createElement(ke,{size:"small"}))))};Z.propTypes={prefixCls:p.string,title:p.node,className:p.string,style:p.object,onClick:p.func,active:p.bool};Z.defaultProps={prefixCls:z.ITEM,active:!1,className:""};const fe=g.createContext(null),Te=t=>{const{type:s}=f.useContext(fe);return(()=>{switch(s){case"fill":return g.createElement(J,Object.assign({},t));case"basic":return g.createElement(Y,Object.assign({},t));case"nav":return g.createElement(Z,Object.assign({},t));default:return null}})()};var _e=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const ee=t=>{const{current:s,status:l,children:a,prefixCls:n,initial:d,direction:h,className:b,style:o,onChange:i}=t,c=_e(t,["current","status","children","prefixCls","initial","direction","className","style","onChange"]),w=f.useMemo(()=>{const m=f.Children.toArray(a).filter(S=>f.isValidElement(S)),j=h==="vertical"?null:{width:`${100/m.length}%`};return f.Children.map(m,(S,u)=>{if(!S)return null;const y=d+u,x=Object.assign({stepNumber:`${y+1}`,direction:h},S.props);return l==="error"&&u===s-1&&(x.className=`${n}-next-error`),S.props.status||(y===s?x.status=l:y<s?x.status="finish":x.status="wait"),x.onChange=i?()=>{u!==s&&i(u+d)}:void 0,g.createElement(Ee,{style:j},f.cloneElement(S,Object.assign({},x)))})},[a,d,n,h,l,s,i]),C=W(b,{[n]:!0,[`${n}-${h}`]:!0});return g.createElement("div",Object.assign({className:C,style:o,"aria-label":t["aria-label"]},Q(c)),g.createElement(Pe,{type:"flex",justify:"start"},w))};ee.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,direction:p.oneOf(["horizontal","vertical"]),status:p.oneOf(["wait","process","finish","error","warning"])};ee.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",initial:0,status:"process"};var We=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const te=t=>{const{size:s,current:l,status:a,children:n,prefixCls:d,initial:h,direction:b,className:o,style:i,hasLine:c,onChange:w}=t,C=We(t,["size","current","status","children","prefixCls","initial","direction","className","style","hasLine","onChange"]),m=f.useMemo(()=>{const v=f.Children.toArray(n).filter(u=>f.isValidElement(u));return f.Children.map(v,(u,y)=>{if(!u)return null;const x=h+y,P=Object.assign({stepNumber:`${x+1}`,size:s},u.props);return a==="error"&&y===l-1&&(P.className=`${d}-next-error`),u.props.status||(x===l?P.status=a:x<l?P.status="finish":P.status="wait"),P.active=x===l,P.done=x<l,P.onChange=w?()=>{y!==l&&w(y+h)}:void 0,f.cloneElement(u,Object.assign({},P))})},[n,h,d,b,a,l,s,w]),j=W(o,{[`${d}-basic`]:!0,[`${d}-${b}`]:!0,[`${d}-${s}`]:s!=="default",[`${d}-hasline`]:c});return g.createElement("div",Object.assign({"aria-label":t["aria-label"],className:j,style:i},Q(C)),m)};te.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,direction:p.oneOf(["horizontal","vertical"]),status:p.oneOf(["wait","process","finish","error","warning"]),hasLine:p.bool};te.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",size:"",initial:0,hasLine:!0,status:"process"};var Re=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};const se=t=>{const{size:s,current:l,initial:a,children:n,prefixCls:d,className:h,style:b,onChange:o}=t,i=Re(t,["size","current","initial","children","prefixCls","className","style","onChange"]),c=f.useMemo(()=>{const C=f.Children.toArray(n).filter(v=>f.isValidElement(v)),m=C.length;return f.Children.map(C,(v,S)=>{if(!v)return null;const u=Object.assign({index:S,total:m},v.props);return u.active=S===l,u.onChange=o?()=>{S!==l&&o(S+a)}:void 0,f.cloneElement(v,Object.assign({},u))})},[n,d,l,s,a,o]),w=W(h,{[`${d}-nav`]:!0,[`${d}-${s}`]:s!=="default"});return g.createElement("div",Object.assign({"aria-label":t["aria-label"],className:w,style:b},Q(i)),c)};se.propTypes={prefixCls:p.string,className:p.string,style:p.object,current:p.number,initial:p.number,size:p.oneOf(["small","default"])};se.defaultProps={prefixCls:z.PREFIX,current:0,direction:"horizontal",size:"default",initial:0,status:"process"};var De=function(t,s){var l={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(l[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(t);n<a.length;n++)s.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(t,a[n])&&(l[a[n]]=t[a[n]]);return l};class F extends f.Component{renderComponent(){const s=this.props,{type:l}=s,a=De(s,["type"]);switch(l){case"fill":return g.createElement(ee,Object.assign({},a));case"basic":return g.createElement(te,Object.assign({},a));case"nav":return g.createElement(se,Object.assign({},a));default:return null}}render(){const{type:s}=this.props;return g.createElement(fe.Provider,{value:{type:s}},this.renderComponent())}}F.Step=Te;F.propTypes={onChange:p.func,type:p.oneOf(["fill","basic","nav"]),size:p.oneOf(["small","default"])};F.defaultProps={type:"fill",size:"default"};const D={Idle:0,WasmPreparing:1,WasmPrepared:2,WasmSplitIssued:3,WasmSplitting:4,WasmSplitDone:5,WasmReadyToPrepare:6,WasmSplitPreparing:7,WasmPreparedSuccess:8,WasmCollecting:9,WasmUploadFail:-1,WasmDownloadFail:-2,WasmFileNotExist:-3,WasmSplitFail:-4,WasmSplitUpdateDBFail:-5,WasmSplitPrepareFail:-6,WasmPrepareFailed:-1};function ne({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-split-config",method:"GET",data:{codeMd5:t,clientKey:s}})}function Fe(t){const{codePath:s,codeMd5:l,clientKey:a,desc:n}=t;return $({url:"/game/wasm-prepare",method:"POST",data:{codePath:s,clientKey:a,codeMd5:l,desc:n}})}function Ie({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-prepare-result",method:"POST",data:{codeMd5:t,clientKey:s}})}function ze(t,s){const l=s?.intervalMs,a=s?.maxAttempts,n=s?.signal||new AbortController().signal;let d=0;return new Promise((h,b)=>{if(n?.aborted){b(new DOMException("Polling aborted","AbortError"));return}const o=()=>{clearTimeout(i),b(new DOMException("Polling aborted","AbortError"))};n?.addEventListener("abort",o,{once:!0});let i;const c=async()=>{d+=1;try{const w=await Ie(t),{status:C}=w.data;if(C===D.WasmPreparedSuccess||C===D.WasmSplitDone){h(w);return}if(C<0){h(w);return}if(d>=a){b(new Error(`Polling timeout after ${a} attempts`));return}i=window.setTimeout(c,l)}catch(w){if(d>=a){b(w);return}i=window.setTimeout(c,l)}};c()})}function Me({codeMd5:t,clientKey:s,codePath:l}){return $({url:"/game/wasm-prepare-download",method:"POST",data:{codeMd5:t,clientKey:s,codePath:l}})}function qe(t){const{codeMd5:s,clientKey:l,archive:a}=t;return $({url:"/game/wasm-split",method:"POST",data:{codeMd5:s,clientKey:l,archive:a??!1}})}function Ae(t){return $({url:"/game/wasm-split-download",method:"POST",data:t})}function he(t){const{codeMd5:s,clientKey:l,codePath:a}=t;return $({url:"/game/wasm-split-reset",method:"POST",data:{codeMd5:s,clientKey:l,codePath:a}})}function Le({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-taskinfo",method:"GET",data:{codeMd5:t,clientKey:s}})}function Ue({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-collect-start",method:"POST",data:{codeMd5:t,clientKey:s}})}function Be({codeMd5:t,clientKey:s}){return $({url:"/game/wasm-set-collect",method:"POST",data:{codeMd5:t,clientKey:s}})}function ie(t){return $({url:"/game/wasm-collect-funcids",method:"GET",data:t})}function He(t){return $({url:"/game/wasm-collect-info",method:"GET",data:t})}const Ge=({onSubmit:t,onCancel:s,onChange:l})=>e.jsxs(le,{style:{width:"100%"},onChange:l,onSubmit:t,children:[e.jsx(le.TextArea,{rules:[{required:!0,message:r("inputSplitDesc")}],label:r("splitDesc"),placeholder:r("inputSplitDesc"),field:"desc"}),e.jsxs("div",{className:"wasm-prepare-form-button-container",children:[e.jsx(N,{type:"primary",htmlType:"submit",style:{marginRight:12},children:r("startPrepare")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancel")})]})]}),E={init:"init",start:"start",processing:D.WasmPreparing,processingReady:D.WasmReadyToPrepare,success:D.WasmPreparedSuccess,failed:D.WasmPrepareFailed,splitDone:D.WasmSplitDone},Ke=({codePath:t,codeMd5:s,clientKey:l,onCancel:a,onNext:n,onHide:d})=>{const[h,b]=f.useState(""),[o,i]=f.useState({code:0,data:{status:E.init}}),c=f.useRef(null),w=f.useMemo(()=>o?.data?.status,[o?.data?.status]),C=()=>{c.current?.abort(),a(),he({codeMd5:s,clientKey:l,codePath:t}).then(u=>{u.code===0&&i({...o,data:{...o?.data,status:E.init}})})},m=async()=>{c.current=new AbortController,i({code:0,data:{status:E.start}}),Fe({codePath:t,codeMd5:s,clientKey:l,desc:h}).then(u=>{u.code===0||u?.error?.code===10024||u?.error?.code===10028?(i({...u,data:{...u?.data,status:E.processing}}),j()):i({...o,error:u?.error||{code:-1,message:"Internal server error, please try again later..."},data:{...o?.data,status:E.failed}})})},j=()=>{ze({codeMd5:s,clientKey:l},{intervalMs:2e3,maxAttempts:240,signal:c.current?.signal}).then(u=>{u.code===0?Me({codeMd5:s,clientKey:l,codePath:t}).then(y=>{y.code===0?n():i({...o,error:{code:-1,message:y?.error?.message||"Download prepared wasm failed"},data:{...o?.data,status:E.failed}})}).catch(y=>{i({...o,error:{code:-1,message:y?.message||"Download prepared wasm failed"},data:{...o?.data,status:E.failed}})}):i({...o,data:{...o?.data,status:E.failed}})}).catch(u=>{u?.name!=="AbortError"&&i(y=>({...y,error:{code:-1,message:u?.message||"Polling failed"},data:{...y?.data,status:E.failed}}))})},v=u=>{b(u?.values?.desc)};let S=null;switch(w){case E.init:S=e.jsx(Ge,{onSubmit:m,onCancel:a,onChange:v});break;case E.start:S=e.jsxs("div",{className:"wasm-prepare-processing-content",children:[e.jsx("div",{className:"wasm-prepare-processing-spinner",role:"status","aria-label":r("startingPrepare")}),e.jsx("div",{className:"wasm-prepare-processing-text",children:r("startingPrepare")}),e.jsxs("div",{className:"wasm-prepare-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:a,children:r("cancelPrepare")}),e.jsx(N,{type:"primary",onClick:()=>d(),children:r("backgroundRun")})]})]});break;case E.processing:case E.processingReady:S=e.jsxs("div",{className:"wasm-prepare-processing-content",children:[e.jsx("div",{className:"wasm-prepare-processing-spinner",role:"status","aria-label":r("preparingSplit")}),e.jsx("div",{className:"wasm-prepare-processing-text",children:r("preparingSplit")}),e.jsx("div",{className:"wasm-prepare-processing-warning",children:r("warningDuringPreparing")}),e.jsxs("div",{className:"wasm-prepare-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:()=>{C()},children:r("cancelPrepare")}),e.jsx(N,{type:"primary",onClick:()=>d(),children:r("backgroundRun")})]})]});break;case E.success:case E.splitDone:break;case E.failed:const u=o?.error?.message||"Unknown error";S=e.jsxs("div",{className:"wasm-prepare-failed-content",children:[e.jsx("div",{className:"wasm-prepare-failed-text",children:r("preparingSplitFailed")}),o?.data?.status===E.failed&&e.jsx("div",{className:"wasm-prepare-failed-warning",children:u}),e.jsx(N,{type:"tertiary",style:{marginTop:12},onClick:m,children:r("retryPrepare")})]});break;default:S=null}return e.jsx("div",{className:"wasm-prepare-content-container",children:S})},Ve=({data:t})=>{const s={...t||{}},l=[{label:"Client key",value:"app_id"},{label:r("wasmSize"),value:"wasm_size",render:a=>`${(a/1024/1024).toFixed(2)} MB`},{label:r("totalFuncCount"),value:"total_wasm_func_count",render:a=>a>=1e3?`${(a/1e3).toFixed(2)} K`:`${a}`},{label:r("collectedFuncCount"),value:"collected_func_count",render:a=>a>=1e3?`${(a/1e3).toFixed(2)} K`:`${a}`},{label:"Wasm md5",value:"wasm_md5"}];return e.jsx("div",{className:"wasm-collect-status",children:l.map(a=>e.jsxs("div",{className:"wasm-collect-status-item",children:[e.jsx(we,{size:"small",className:"wasm-collect-status-item-label",children:a.label}),e.jsx("span",{className:"wasm-collect-status-item-value",children:a.render?.(s[a.value])||s[a.value]})]},a.value))})},Xe="https://bytedance.larkoffice.com/wiki/OyGMwHVW9iSeneknlOcc2qb6nUh",Qe=({onNext:t,onCancel:s,codeMd5:l,clientKey:a,onHide:n})=>{const{state:{devSchema:d,schema:h,selectedLaunchOption:b,isConnected:o}}=me(),i=f.useMemo(()=>{if(h)return xe({baseSchema:h,option:b,debugMode:"clientPreview"});if(!d)return"";if(/([?&])debugMode=/.test(d))return d.replace(/([?&])debugMode=[^&]*/,"$1debugMode=clientPreview");const O=d.includes("?")?"&":"?";return`${d}${O}debugMode=clientPreview`},[d,h,b]),[c,w]=f.useState("startCollect"),[C,m]=f.useState(),[j,v]=f.useState(),[S,u]=f.useState(0),y=f.useRef(null),x=f.useRef(!1),P=f.useRef(!1),_=.08,I=f.useMemo(()=>{if(!j)return!1;const O=j?.total_wasm_func_count;return O?S/O>=_:!1},[j,S]);f.useEffect(()=>{if(c!=="collecting"){y.current&&(window.clearInterval(y.current),y.current=null);return}if(y.current)return;const O=T=>{u(T.data?.collected_func_count||0);const q=T.data?.collect_state;q==="closed"&&!x.current?(x.current=!0,X.warning({content:r("collect.sessionClosed"),duration:5})):q==="open"&&(x.current=!1)};return ie({codeMd5:l,clientKey:a}).then(O).catch(console.error),y.current=window.setInterval(()=>{ie({codeMd5:l,clientKey:a}).then(O).catch(T=>{console.error(T)})},2e3),()=>{y.current&&(window.clearInterval(y.current),y.current=null)}},[c,l,a]);const M=async()=>{if(c!=="collecting")try{if(w("startCollect"),(await Ue({codeMd5:l,clientKey:a})).code!==0){w("willCollect");return}Be({codeMd5:l,clientKey:a}).catch(console.error),w("collecting"),Le({codeMd5:l,clientKey:a}).then(T=>{m(T.data)}).catch(console.error),He({codeMd5:l,clientKey:a}).then(T=>{v(T.data||{})}).catch(console.error)}catch(O){console.error(O),X.error({content:r("collect.startFailed"),duration:4}),w("willCollect")}};f.useEffect(()=>{P.current||(P.current=!0,M())},[]);const L=()=>{y.current&&(window.clearInterval(y.current),y.current=null),w("willCollect"),t()};return e.jsxs("div",{className:"wasm-collect-content-container",children:[c!=="willCollect"&&(C?e.jsx(Ve,{data:{...C||{},total_wasm_func_count:j?.total_wasm_func_count,collected_func_count:S}}):e.jsxs("div",{className:"wasm-collect-status-loading",children:[e.jsx(H,{size:"middle"}),e.jsx("span",{className:"wasm-collect-status-loading-text",children:r("startingCollect")})]})),e.jsxs("div",{className:"collect-requirements-notice",role:"note",children:[e.jsx("span",{className:"collect-requirements-notice-title",children:r("collect.requirements.title")}),e.jsxs("span",{className:"collect-requirements-notice-desc",children:[r("collect.requirements.desc")," ",e.jsx(ue,{href:Xe,children:r("collect.requirements.link")})]})]}),o&&c!=="willCollect"?e.jsxs("div",{className:"collect-connected-panel",children:[e.jsx("span",{className:"collect-connected-dot",role:"status","aria-label":r("collectConnectedTitle")}),e.jsx("div",{className:"collect-connected-title",children:r("collectConnectedTitle")}),e.jsx("div",{className:"collect-qrcode-desc",children:r("collectConnectedDesc")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"collect-qrcode-container",children:e.jsx(be,{value:i})}),e.jsx("div",{className:"collect-qrcode-desc",children:r("collectDesc")})]}),e.jsxs("div",{className:"collect-qrcode-button-container",children:[c==="willCollect"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"primary",onClick:M,children:r("startCollect")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancelSplit")})]}),c!=="willCollect"&&e.jsxs(e.Fragment,{children:[I?e.jsx(N,{type:"primary",onClick:L,children:r("startSplit")}):e.jsx(je,{content:r("cannotSplitTip"),children:e.jsx(N,{type:"primary",disabled:!0,children:r("startSplit")})}),e.jsx(N,{type:"tertiary",onClick:n,children:r("backgroundRun")}),e.jsx(N,{type:"tertiary",onClick:s,children:r("cancelSplit")})]})]})]})},Ye=({onCancel:t,onHide:s,codeMd5:l,clientKey:a,archive:n})=>{const[d,h]=f.useState("spliting"),[b,o]=f.useState(""),i=()=>{h("spliting"),o(""),qe({codeMd5:l,clientKey:a,archive:n}).then(w=>{if(w.code===0){const C=w.data?.func_count;return h("writing"),Ae({}).then(m=>{m.code===0?(h("success"),typeof C=="number"&&C>0&&X.success({content:r("wasmSplit.splitDoneToast",{count:String(C)}),duration:3})):(o(m?.error?.message||m?.error?.errorMsg||m?.msg||r("splitFailed")),h("writeFailed"))})}else o(w?.error?.message||w?.msg||r("splitFailed")),h("splitFailed")}).catch(w=>{o(w?.message||r("splitFailed")),h("splitFailed")})};f.useEffect(()=>{i()},[]);let c=null;switch(d){case"spliting":c=e.jsxs("div",{className:"wasm-split-processing",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"wasm-split-processing-content",children:r("splittingDesc")}),e.jsxs("div",{className:"wasm-split-processing-cancel",children:[e.jsx(N,{type:"tertiary",onClick:()=>t(),children:r("cancelSplit")}),e.jsx(N,{type:"primary",onClick:()=>s(),children:r("backgroundRun")})]})]});break;case"writing":c=e.jsxs("div",{className:"wasm-split-processing",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"wasm-split-processing-content",children:r("writingSplitResult")||"正在写入分包产物..."})]});break;case"splitFailed":case"writeFailed":c=e.jsxs("div",{className:"wasm-split-failed",children:[e.jsx("div",{className:"wasm-split-failed-content",children:b||r("splitFailed")}),e.jsxs("div",{className:"wasm-split-failed-retry",children:[e.jsx(N,{type:"primary",onClick:()=>i(),children:r("retry")||"重试"}),e.jsx(N,{type:"tertiary",onClick:()=>t(),children:r("cancelSplit")})]})]});break;case"success":c=e.jsxs("div",{className:"wasm-split-success",children:[e.jsx("div",{className:"wasm-split-success-content",children:r("downloadSplitResultSuccess")}),e.jsx("div",{className:"wasm-split-success-tip",children:r("downloadSplitResultTip")})]});break;default:c=null}return e.jsx("div",{className:"wasm-split-content-container",children:c})},Je=({onCancel:t})=>e.jsx("div",{className:"wasm-splitted",children:e.jsxs("div",{className:"wasm-splitted-panel",children:[e.jsx("div",{className:"wasm-splitted-icon","aria-hidden":"true",children:e.jsx(Se,{size:26,strokeWidth:2})}),e.jsx("div",{className:"wasm-splitted-title",children:r("hasSplitedTitle")}),e.jsx("div",{className:"wasm-splitted-desc",children:r("hasSplitedDesc")}),e.jsx("div",{className:"wasm-splitted-actions",children:e.jsx(N,{type:"primary",onClick:t,children:r("hasSplitedDiscard")})})]})}),R={prepare:{number:0,get title(){return r("splitPrepare")},get description(){return r("splitPrepare.desc")}},collect:{number:1,get title(){return r("splitCollect")},get description(){return r("splitCollect.desc")}},split:{number:2,get title(){return r("splitCode")},get description(){return r("splitCode.desc")}},rollback:{number:3,get title(){return r("rollback")},description:""}},Ze=({stage:t})=>e.jsxs(F,{type:"basic",current:R[t].number,className:"tt-wasm-steps",children:[e.jsx(F.Step,{title:R.prepare.title,description:R.prepare.description}),e.jsx(F.Step,{title:R.collect.title,description:R.collect.description}),e.jsx(F.Step,{title:R.split.title,description:R.split.description})]}),et=({onCancel:t,errorType:s,onHide:l})=>e.jsxs("div",{className:"wasm-code-split-error",children:[s==="noWasmCode"&&e.jsxs("div",{className:"wasm-code-split-error-container",children:[e.jsx("div",{className:"wasm-code-split-error-title",children:r("noWasmCode")}),e.jsx("div",{className:"wasm-code-split-error-desc",children:r("noWasmCodeDesc")})]}),s==="noSplitConfig"&&e.jsxs("div",{className:"wasm-code-split-error-container",children:[e.jsx("div",{className:"wasm-code-split-error-title",children:r("noSplitConfigTitle")}),e.jsx("div",{className:"wasm-code-split-error-desc",children:r("noSplitConfigDesc")})]})]}),ce=()=>e.jsxs("div",{className:"split-loading",children:[e.jsx(H,{size:"large",color:"primary"}),e.jsx("div",{className:"split-loading-text",children:r("wasmSplit.initializingEnv")})]}),tt=({codeMd5:t,clientKey:s,codePath:l,onHide:a,onReset:n})=>{const[d,h]=f.useState("rollbacking"),b=()=>{h("rollbacking"),he({codeMd5:t,clientKey:s,codePath:l}).then(c=>{c.code===0?(h("rollbackSuccess"),n()):h("rollbackFailed")})};f.useEffect(()=>{b()},[]);let o="",i=null;switch(d){case"rollbacking":o=r("rollback.rollbacking"),i=e.jsx(N,{onClick:()=>{h("rollbackFailed")},children:r("rollback.backgroundRun")});break;case"rollbackSuccess":o=r("rollback.success"),i=e.jsx(N,{onClick:()=>{a()},children:r("rollback.close")});break;case"rollbackFailed":o=r("rollback.failed"),i=e.jsx(N,{onClick:()=>{b()},children:r("rollback.retry")});break}return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"wasm-split-rollback-container",children:[e.jsx("div",{className:"wasm-split-rollback-text",children:o}),i]})})};function st({enableWasmCollect:t,enableWasmSplit:s}){return typeof t=="boolean"&&(typeof s=="string"||s===!1)?t:!1}function at({enableWasmSplit:t,hasWasmCode:s}){return t===!0?{errorType:"hasSplited",hasError:!0}:s?{hasError:!1}:{errorType:"noWasmCode",hasError:!0}}const rt="https://bytedance.larkoffice.com/wiki/OyGMwHVW9iSeneknlOcc2qb6nUh",lt={loading:"neutral",prepare:"accent",collect:"accent",split:"success",splitted:"success",rollback:"warn",error:"error"},nt=t=>({label:r(`wasmSplit.stage.${t}`),tone:lt[t]}),it=t=>{const s=a=>r(`wasmSplit.help.${t}.${a}`),l={loading:["line1"],prepare:["line1","line2"],collect:["line1","line2","line3"],split:["line1","line2"],splitted:["line1"],rollback:["line1"],error:["line1"]};return{title:s("title"),lines:l[t].map(s)}},wt=()=>{const t=ye(),{state:{engine:s,packages:l,gameDetail:a,debugMode:n},setDebugMode:d,setPackages:h}=me();f.useEffect(()=>{s==="unity"&&n!=="clientPreview"&&d("clientPreview")},[s,n,d]);const b=l?.find(k=>k.name==="wasmcode"),o=b?.root||"",i=b?.md5||"",c=a?.client_key||"",[w,C]=f.useState(""),[m,j]=f.useState("loading"),[v,S]=f.useState(null),u=a===null,y=!u&&(!i||!c);f.useEffect(()=>{u||y||(j("loading"),ne({codeMd5:i,clientKey:c}).then(k=>{if(k.code===0){const{errorType:U,hasError:G}=at({enableWasmSplit:k.data.enableWasmSplit,hasWasmCode:!!o});G?(C(U),j(U==="hasSplited"?"splitted":"error")):st(k.data)?j("collect"):j("prepare"),S(k.data)}else C("noSplitConfig"),j("error")}))},[i,c,o,u,y]);const x=()=>{j("rollback")},P=f.useCallback(async()=>{try{const k=await $({url:"/game/config",method:"GET"});!k.error&&k.data?.packages&&h(k.data.packages)}catch{}j("prepare")},[h]),_=()=>{t("/")},I=()=>{t("/performance")},M=(k,U,G,ge)=>e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit")})]}),e.jsxs(B,{padding:"lg",className:"tt-wasm-split-empty-card",children:[e.jsx("div",{className:"tt-wasm-split-empty-icon","aria-hidden":"true",children:e.jsx(re,{size:24,strokeWidth:1.75})}),e.jsx("h2",{className:"tt-wasm-split-empty-title",children:k}),e.jsx("p",{className:"tt-wasm-split-empty",children:U}),e.jsx("div",{className:"tt-wasm-split-empty-actions",children:e.jsx("button",{type:"button",className:"tt-wasm-split-empty-cta",onClick:()=>t(ge),children:G})})]})]});if(u)return e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit")})]}),e.jsx(B,{padding:"lg",children:e.jsx(ce,{})})]});if(s&&s!=="unity")return M(r("wasmSplit.empty.unityOnly.title"),r("wasmSplit.empty.unityOnly.desc"),r("performance.back"),"/performance");if(y)return M(r("wasmSplit.empty.needDevice.title"),r("wasmSplit.empty.needDevice.desc"),r("wasmSplit.empty.connectDevice"),"/");const L=nt(m),O=it(m),T=m==="collect"||m==="split",q=m!=="error"&&m!=="loading"&&m!=="splitted";return e.jsxs("div",{className:"tt-wasm-split-shell tt-wasm-split-page",children:[e.jsxs("div",{className:"tt-wasm-split-hero-strip",children:[e.jsxs("button",{type:"button",className:"tt-wasm-split-back",onClick:I,children:[e.jsx(K,{size:14,strokeWidth:2}),e.jsx("span",{children:r("performance.back")})]}),e.jsx(V,{title:r("wasmSplit"),subtitle:r("wasmSplit.subtitle"),action:e.jsx(ve,{tone:L.tone,withDot:!0,variant:"solid",children:L.label})})]}),e.jsxs("div",{className:"tt-wasm-requirements-notice",role:"note",children:[e.jsx("span",{className:"tt-wasm-requirements-notice-icon","aria-hidden":"true",children:e.jsx(Oe,{size:18,strokeWidth:2})}),e.jsxs("span",{className:"tt-wasm-requirements-notice-copy",children:[e.jsx("span",{className:"tt-wasm-requirements-notice-title",children:r("wasmSplit.requirements.title")}),e.jsxs("ul",{className:"tt-wasm-requirements-notice-list",children:[e.jsx("li",{children:r("wasmSplit.requirements.account")}),e.jsxs("li",{children:[r("wasmSplit.requirements.unityPlugin")," ",e.jsx(ue,{href:rt,children:r("wasmSplit.requirements.unityPluginLink")})]})]})]})]}),e.jsxs("div",{className:"tt-wasm-split-grid",children:[e.jsx("aside",{className:"tt-wasm-split-helper",children:e.jsx(B,{padding:"lg",className:"tt-wasm-split-helper-card",children:e.jsx("div",{className:"tt-wasm-split-helper-grid",children:e.jsxs("div",{className:"tt-wasm-split-helper-main",children:[e.jsx(Ce,{icon:m==="error"?re:$e,title:O.title}),e.jsx("ul",{className:"tt-wasm-split-helper-list",children:O.lines.map(k=>e.jsx("li",{children:k},k))})]})})})}),e.jsxs(B,{padding:"lg",className:"tt-wasm-split-workflow-card",children:[m==="loading"&&e.jsx(ce,{}),m==="splitted"&&e.jsx(Je,{onCancel:x}),m==="error"&&w&&e.jsx(et,{errorType:w,onCancel:x,onHide:_}),T&&e.jsx("div",{className:"tt-wasm-split-upload-row",children:e.jsx(Ne,{})}),q&&e.jsx("div",{className:"tt-wasm-split-steps-wrap",children:e.jsx(Ze,{stage:m})}),q&&e.jsxs("div",{className:"tt-wasm-split-stage",children:[m==="prepare"&&e.jsx(Ke,{codeMd5:i,codePath:o,clientKey:c,onCancel:I,onNext:()=>j("collect"),onHide:_}),m==="collect"&&e.jsx(Qe,{codeMd5:i,clientKey:c,onCancel:x,onHide:_,onNext:()=>{ne({codeMd5:i,clientKey:c}).then(k=>{k.code===0&&S(k.data),j("split")})}}),m==="split"&&e.jsx(Ye,{codePath:o,codeMd5:i,clientKey:c,archive:v?.enableArchiveMode===!0,onCancel:x,onHide:_}),m==="rollback"&&e.jsx(tt,{codeMd5:i,clientKey:c,codePath:o,onHide:_,onReset:P})]})]})]})]})};export{wt as WasmCodeSplit};
@@ -1 +1 @@
1
- import{c as f,j as e,d as L,k as Me,u as Ee,r as t,i as s,e as Ge,a2 as Y,A as _e,P as Le,D as X,b as ee,B as o,Q as Pe,a3 as ze,a4 as De,a5 as Ae,a6 as Re,a7 as qe,a8 as se}from"./index-DcpswdR4.js";import{S as G}from"./SectionHeader-BQDU_6TX.js";import{C as d}from"./Card-BC5ydRHh.js";import{a as ae,C as te,U as Oe}from"./index-_IVh5FZw.js";import{T as ce}from"./triangle-alert-BaPLcm_f.js";const We=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],le=f("boxes",We);const Ie=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Be=f("link",Ie);const Ue=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],U=f("loader",Ue);const $e=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fe=f("refresh-cw",$e);const Ve=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Ke=f("smartphone",Ve),ne=({entries:c,emptyText:i})=>{if(!c.length)return e.jsx("div",{className:"subpkg-preview-empty",children:i});const h=JSON.stringify({parallelPreloadSubpackages:c},null,2);return e.jsx("pre",{className:"subpkg-json",children:h})},b="__GAME__",He=9999;function Qe(c){return L({url:"/game/preload-subpackages-config",method:"GET",data:{entry:c}})}function Ze(c){return L({url:"/game/preload-subpackage-candidates",method:"GET",data:{entry:c}})}function Je(c,i){return L({url:"/game/collect-preload-subpackages",method:"POST",data:{entry:c,subpackages:i}})}function Ye(c){return L({url:"/game/clear-preload-subpackages-config",method:"POST",data:{entry:c}})}const Xe=2e4,ie="https://bytedance.my.larkoffice.com/docx/MIyMdmzb0oOQAKxNHGNmR5hDyAh",es=!1,_=[{subPkgName:"configBundle",isStartup:!0},{subPkgName:"gameplayBundle",isStartup:!1}];function ss(){if(!ze())return null;switch(De()){case"subpackage.collecting":return{shot:"subpackage-collecting",stage:"collecting",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!1,collected:_,result:[]};case"subpackage.ready":return{shot:"subpackage-ready",stage:"collecting",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!0,collected:_,result:[]};case"subpackage.success":return{shot:"subpackage-success",stage:"success",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!0,collected:_,result:_};case"subpackage.collect-ready":return{shot:"subpackage-entry",stage:"entry",entry:b,entryLabel:"",isConnected:!1,windowClosed:!1,collected:[],result:[]};default:return null}}const as={entry:"neutral",empty:"neutral",collecting:"accent",processing:"accent",success:"success",failed:"error"},os=()=>{const c=Me(),i=ss(),{state:{devSchema:h,engine:re,packages:P,isConnected:oe},setMessage:w,setShowManualBindIP:$}=Ee(),z=t.useMemo(()=>{const a=(P||[]).filter(n=>n.type==="independent").map(n=>({value:n.name,label:n.name,isGame:!1}));return[{value:b,label:s("subpackageCollect.entry.game"),isGame:!0},...a]},[P,Ge]),D=(P?.length??0)>0,j=z.length>1,y=re==="unity",N=oe||!!i?.isConnected,[l,p]=t.useState(()=>i?.stage??"entry"),[de,v]=t.useState("idle"),[m,ue]=t.useState(()=>i?.entry??b),[F,pe]=t.useState(()=>i?.entryLabel??""),[g,S]=t.useState(()=>i?.collected??[]),[ts,A]=t.useState([]),[k,T]=t.useState([]),[R,M]=t.useState(()=>i?.result??[]),[u,E]=t.useState(()=>i?.windowClosed??!1),[ge,q]=t.useState(!1),[ke,O]=t.useState(""),[be,W]=t.useState(""),I=t.useRef(!1),B=t.useRef("entry");I.current=u,B.current=l;const V=t.useMemo(()=>{if(!h)return"";const a=h.includes("?")?"&":"?";return`${h}${a}startupRoot=${encodeURIComponent(m)}`},[h,m]);t.useEffect(()=>{const a=Y.on("predownloadSubpackage",r=>{if(B.current!=="collecting"||I.current)return;const{subPkgName:x,isStartup:Se}=r;!x||x===b||(S(C=>C.some(Te=>Te.subPkgName===x)?C:[...C,{subPkgName:x,isStartup:Se}]),v(C=>C==="idle"?"running":C))}),n=Y.on("reportScene",r=>{B.current!=="collecting"||I.current||r.sceneId===He&&(E(!0),v("interactive"),w({type:"success",title:s("subpackageCollect.reportScene.toastTitle"),desc:s("subpackageCollect.reportScene.toastDesc")}))});return()=>{a(),n()}},[w]),t.useEffect(()=>{if(i||l!=="collecting"||u||!N){q(!1);return}const a=window.setTimeout(()=>q(!0),Xe);return()=>window.clearTimeout(a)},[i,l,u,N,de]);const K=async a=>{ue(a.value),pe(a.label),S([]),M([]),E(!1),v("idle"),T([]),A([]),p("collecting");const[n,r]=await Promise.all([Qe(a.value),Ze(a.value)]);if(n?.code===0&&n.data){const x=n.data.parallelPreloadSubpackages||[];T(x)}r?.code===0&&r.data&&(A(r.data.candidates||[]),r.data.totalSubpackages===0&&p("empty"))};t.useEffect(()=>{y||l==="entry"&&D&&!j&&K(z[0])},[l,D,j,y]);const H=async()=>{W(s("subpackageCollect.processing.write")),p("processing");const a=g.slice(),n=await Je(m,a);if(n?.code===0&&n.data){const r=n.data.parallelPreloadSubpackages||[];M(r),T(r),p("success")}else O(n?.error?.message||s("subpackageCollect.error.generic")),p("failed")},he=()=>{if(g.length===0&&k.length>0){se.confirm({title:s("subpackageCollect.finish.clearTitle"),content:s("subpackageCollect.finish.clearConfirm",{existing:k.length}),okText:s("subpackageCollect.finish.okClear"),cancelText:s("subpackageCollect.finish.cancel"),onOk:H});return}H()},me=()=>{S([]),M([]),T([]),E(!1),v("idle"),q(!1),O(""),W(""),p("collecting")},xe=async()=>{W(s("subpackageCollect.processing.clear")),p("processing");const a=await Ye(m);if(a?.code===0){me();return}O(a?.error?.message||s("subpackageCollect.error.generic")),p("failed")},Q=()=>{se.confirm({title:s("subpackageCollect.recollect.clearTitle"),content:s("subpackageCollect.recollect.clearDesc"),okText:s("subpackageCollect.recollect.clearAction"),cancelText:s("subpackageCollect.finish.cancel"),onOk:xe})},Z=()=>{S([]),M([]),A([]),E(!1),v("idle"),p("entry")},Ce=()=>c("/performance"),je=()=>{c("/performance")},ye=()=>{$(!0)},Ne=()=>{const a=Ae();if(!Re(a)){w({type:"warning",title:s("subpackageCollect.manualConnect.noRecordTitle"),desc:s("subpackageCollect.manualConnect.noRecordDesc")}),$(!0);return}qe(a),w({type:"info",title:s("subpackageCollect.manualConnect.retryTitle"),desc:s("subpackageCollect.manualConnect.retryDesc",{ip:String(a.ip),port:String(a.wsPort)})})},ve=t.useMemo(()=>l==="success"?R:g.length?g:u?[]:k,[l,R,g,k,u]),J=l==="collecting"&&!N,fe=y?s("subpackageCollect.stage.unsupported"):J?s("subpackageCollect.stage.notStarted"):s(`subpackageCollect.stage.${l}`),we=y?"warn":J?"neutral":as[l];return e.jsxs("div",{className:"subpkg-page","data-doc-shot":i?.shot||"subpackage-collection",children:[e.jsxs("div",{className:"subpkg-hero-strip",children:[e.jsxs("button",{type:"button",className:"subpkg-back",onClick:()=>c("/performance"),children:[e.jsx(_e,{size:14,strokeWidth:2}),e.jsx("span",{children:s("performance.back")})]}),e.jsx(Le,{title:s("subpackageCollect"),subtitle:s("subpackageCollect.subtitle"),action:e.jsxs("div",{className:"subpkg-hero-actions",children:[e.jsx(X,{href:ie,children:s("subpackageCollect.devGuide.link")}),e.jsx(ee,{tone:we,withDot:!0,variant:"solid",children:fe})]})})]}),y?e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-unsupported-card",children:[e.jsx("div",{className:"subpkg-unsupported-icon","aria-hidden":"true",children:e.jsx(ce,{size:22,strokeWidth:1.75})}),e.jsx("h2",{className:"subpkg-unsupported-title",children:s("subpackageCollect.unsupported.unity.title")}),e.jsx("p",{className:"subpkg-unsupported-desc",children:s("subpackageCollect.unsupported.unity.desc")}),e.jsx("div",{className:"subpkg-unsupported-actions",children:e.jsx(o,{type:"primary",theme:"solid",onClick:()=>c("/wasm_split"),children:s("subpackageCollect.unsupported.unity.action")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(d,{padding:"md",className:"subpkg-card subpkg-version-card",children:e.jsxs("div",{className:"subpkg-client-version",role:"list","aria-label":s("subpackageCollect.devGuide.clientVersion"),children:[e.jsxs("div",{className:"subpkg-client-version-title",children:[e.jsx(Ke,{size:16,strokeWidth:2}),e.jsx("span",{children:s("subpackageCollect.devGuide.clientVersion")})]}),e.jsx("span",{className:"subpkg-client-version-chip",role:"listitem",children:s("subpackageCollect.devGuide.android")}),e.jsx("span",{className:"subpkg-client-version-chip",role:"listitem",children:s("subpackageCollect.devGuide.ios")})]})}),e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-dev-guide-card",children:[e.jsx(G,{className:"subpkg-section-header",title:s("subpackageCollect.devGuide.stepsTitle")}),e.jsxs("div",{className:"subpkg-required-integration",children:[e.jsx("span",{className:"subpkg-required-label",children:s("subpackageCollect.devGuide.required.badge")}),e.jsxs("div",{className:"subpkg-required-copy",children:[e.jsxs("div",{className:"subpkg-required-title",children:[s("subpackageCollect.devGuide.required.title"),e.jsx("code",{children:s("subpackageCollect.devGuide.required.code")})]}),e.jsx("div",{className:"subpkg-required-desc",children:s("subpackageCollect.devGuide.required.desc")})]})]}),e.jsxs("ol",{className:"subpkg-dev-guide-list",children:[e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"1"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step1.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step1.desc")})]})]}),e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"2"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step2.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step2.desc")})]})]}),e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"3"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step3.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step3.desc")})]})]})]})]}),l==="entry"&&(D&&j?e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsx(G,{icon:le,title:s("subpackageCollect.entry.title"),subtitle:s("subpackageCollect.entry.subtitle")}),e.jsx("div",{className:"subpkg-entry-grid",children:z.map(a=>e.jsxs("button",{type:"button",className:"subpkg-entry-card",onClick:()=>K(a),children:[e.jsx("span",{className:"subpkg-entry-name",children:a.label}),e.jsx(ee,{tone:a.isGame?"accent":"info",size:"sm",variant:"outline",children:a.isGame?s("subpackageCollect.entry.gameTag"):s("subpackageCollect.entry.independentTag")})]},a.value))})]}):e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(U,{size:28,strokeWidth:1.75,className:"subpkg-wait-spin"}),e.jsx("p",{className:"subpkg-center-text",children:s("subpackageCollect.loading")})]})),l==="empty"&&e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(le,{size:28,strokeWidth:1.5,className:"subpkg-empty-icon"}),e.jsx("p",{className:"subpkg-empty-title",children:s("subpackageCollect.empty.title")}),e.jsx("p",{className:"subpkg-empty-desc",children:s("subpackageCollect.empty.desc")}),e.jsx("div",{className:"subpkg-actions subpkg-actions-center",children:e.jsx(o,{type:"primary",theme:"solid",onClick:()=>c("/performance"),children:s("subpackageCollect.empty.back")})})]}),l==="collecting"&&e.jsxs("div",{className:"subpkg-collect-grid",children:[e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-collect-card",children:[e.jsx(G,{className:"subpkg-section-header",title:e.jsxs("span",{className:"subpkg-entry-title",children:[e.jsx("span",{className:"subpkg-entry-title-label",children:s("subpackageCollect.preview.currentEntry")}),e.jsx("span",{className:"subpkg-entry-title-value",children:F||m})]})}),!u&&!N&&e.jsxs("div",{className:"subpkg-scan",children:[e.jsx("div",{className:"subpkg-qr",children:V?e.jsx(Pe,{value:V,size:164}):e.jsx("div",{className:"subpkg-qr-empty",children:s("subpackageCollect.preview.noSchema")})}),e.jsxs("div",{className:"subpkg-scan-main",children:[e.jsxs("div",{className:"subpkg-scan-heading",children:[e.jsx("div",{className:"subpkg-scan-title",children:s("subpackageCollect.scan.title")}),e.jsx("div",{className:"subpkg-scan-subtitle",children:s("subpackageCollect.scan.subtitle")})]}),e.jsxs("ol",{className:"subpkg-guide",children:[e.jsx("li",{children:s("subpackageCollect.guide.step2")}),e.jsx("li",{className:"subpkg-guide-key",children:s("subpackageCollect.guide.step3")})]})]}),e.jsxs("div",{className:"subpkg-connect-tools",role:"group","aria-label":s("subpackageCollect.manualConnect.title"),children:[e.jsxs("div",{className:"subpkg-connect-copy",children:[e.jsx("span",{className:"subpkg-connect-icon","aria-hidden":"true",children:e.jsx(ae,{size:16,strokeWidth:2})}),e.jsxs("span",{className:"subpkg-connect-text",children:[e.jsx("span",{className:"subpkg-connect-title",children:s("subpackageCollect.manualConnect.title")}),e.jsx("span",{className:"subpkg-connect-hint",children:s("subpackageCollect.manualConnect.desc")})]})]}),e.jsxs("div",{className:"subpkg-connect-actions",children:[e.jsx(o,{className:"subpkg-connect-button subpkg-connect-button-secondary",size:"small",type:"tertiary",icon:e.jsx(Fe,{size:14,strokeWidth:2}),onClick:Ne,children:s("subpackageCollect.manualConnect.retry")}),e.jsx(o,{className:"subpkg-connect-button subpkg-connect-button-primary",size:"small",theme:"light",icon:e.jsx(Be,{size:14,strokeWidth:2}),onClick:ye,children:s("subpackageCollect.manualConnect.action")})]})]})]}),u?e.jsxs("div",{className:"subpkg-banner subpkg-banner-success",role:"status",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(te,{size:18,strokeWidth:2})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.reportScene.readyTitle")}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.reportScene.readyDesc")})]}),e.jsx(o,{className:"subpkg-banner-action",size:"small",type:"primary",theme:"solid",onClick:he,children:s("subpackageCollect.action.finish")})]}):N&&(ge?e.jsxs("div",{className:"subpkg-banner subpkg-banner-warn",role:"alert",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(ce,{size:18,strokeWidth:2})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.wait.timeoutTitle")}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.wait.timeout")})]}),e.jsx(X,{className:"subpkg-banner-cta",href:ie,children:s("subpackageCollect.wait.docLink")})]}):e.jsxs("div",{className:"subpkg-banner subpkg-banner-accent",role:"status",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(U,{size:18,strokeWidth:2,className:"subpkg-wait-spin"})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.wait.runningTitle")}),e.jsx("div",{className:"subpkg-banner-progress",children:e.jsx(Oe,{})}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.wait.running")})]})]})),es]}),e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-side",children:[e.jsx(G,{title:s("subpackageCollect.preview.collectedTitle"),subtitle:g.length?s("subpackageCollect.preview.collectedDesc"):u?s("subpackageCollect.preview.emptyResultDesc"):k.length?s("subpackageCollect.preview.existingDesc"):s("subpackageCollect.preview.waitingDesc")}),e.jsx(ne,{entries:ve,emptyText:s("subpackageCollect.preview.empty")}),u&&k.length>0&&e.jsx("p",{className:`subpkg-finish-note${g.length?"":" subpkg-finish-note-clear"}`,children:g.length?s("subpackageCollect.finish.overwriteNote",{current:g.length,existing:k.length}):s("subpackageCollect.finish.clearNote",{existing:k.length})}),!u&&e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"tertiary",onClick:Ce,children:s("subpackageCollect.action.cancel")}),e.jsx(o,{type:"tertiary",onClick:je,children:s("subpackageCollect.action.exit")})]})]})]}),l==="processing"&&e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(U,{size:28,strokeWidth:1.75,className:"subpkg-wait-spin"}),e.jsx("p",{className:"subpkg-center-text",children:be||s("subpackageCollect.processing.write")})]}),l==="success"&&e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsxs("div",{className:"subpkg-result-head subpkg-result-success",children:[e.jsx(te,{size:20,strokeWidth:1.75}),e.jsx("span",{children:s("subpackageCollect.success.title")})]}),e.jsxs("div",{className:"subpkg-entry-hint",children:[s("subpackageCollect.preview.currentEntry"),":",e.jsx("strong",{children:F||m})]}),e.jsx(ne,{entries:R,emptyText:s("subpackageCollect.success.empty")}),e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"primary",theme:"solid",onClick:Q,children:s("subpackageCollect.action.recollect")}),j&&e.jsx(o,{type:"tertiary",onClick:Z,children:s("subpackageCollect.action.switch")})]})]}),l==="failed"&&e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsxs("div",{className:"subpkg-result-head subpkg-result-failed",children:[e.jsx(ae,{size:20,strokeWidth:1.75}),e.jsx("span",{children:s("subpackageCollect.failed.title")})]}),e.jsx("p",{className:"subpkg-error-msg",children:ke}),e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"primary",theme:"solid",onClick:Q,children:s("subpackageCollect.action.recollect")}),j&&e.jsx(o,{type:"tertiary",onClick:Z,children:s("subpackageCollect.action.switch")})]})]})]})]})};export{os as SubpackageCollect};
1
+ import{c as f,j as e,d as L,k as Me,u as Ee,r as t,i as s,e as Ge,a2 as Y,A as _e,P as Le,D as X,b as ee,B as o,Q as Pe,a3 as ze,a4 as De,a5 as Ae,a6 as Re,a7 as qe,a8 as se}from"./index-Ch-x1uku.js";import{S as G}from"./SectionHeader-B4enohBu.js";import{C as d}from"./Card-CEOgyxVl.js";import{a as ae,C as te,U as Oe}from"./index-C6wDirYQ.js";import{T as ce}from"./triangle-alert-BsPYYN9a.js";const We=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],le=f("boxes",We);const Ie=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Be=f("link",Ie);const Ue=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],U=f("loader",Ue);const $e=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fe=f("refresh-cw",$e);const Ve=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Ke=f("smartphone",Ve),ne=({entries:c,emptyText:i})=>{if(!c.length)return e.jsx("div",{className:"subpkg-preview-empty",children:i});const h=JSON.stringify({parallelPreloadSubpackages:c},null,2);return e.jsx("pre",{className:"subpkg-json",children:h})},b="__GAME__",He=9999;function Qe(c){return L({url:"/game/preload-subpackages-config",method:"GET",data:{entry:c}})}function Ze(c){return L({url:"/game/preload-subpackage-candidates",method:"GET",data:{entry:c}})}function Je(c,i){return L({url:"/game/collect-preload-subpackages",method:"POST",data:{entry:c,subpackages:i}})}function Ye(c){return L({url:"/game/clear-preload-subpackages-config",method:"POST",data:{entry:c}})}const Xe=2e4,ie="https://bytedance.my.larkoffice.com/docx/MIyMdmzb0oOQAKxNHGNmR5hDyAh",es=!1,_=[{subPkgName:"configBundle",isStartup:!0},{subPkgName:"gameplayBundle",isStartup:!1}];function ss(){if(!ze())return null;switch(De()){case"subpackage.collecting":return{shot:"subpackage-collecting",stage:"collecting",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!1,collected:_,result:[]};case"subpackage.ready":return{shot:"subpackage-ready",stage:"collecting",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!0,collected:_,result:[]};case"subpackage.success":return{shot:"subpackage-success",stage:"success",entry:b,entryLabel:s("subpackageCollect.entry.game"),isConnected:!0,windowClosed:!0,collected:_,result:_};case"subpackage.collect-ready":return{shot:"subpackage-entry",stage:"entry",entry:b,entryLabel:"",isConnected:!1,windowClosed:!1,collected:[],result:[]};default:return null}}const as={entry:"neutral",empty:"neutral",collecting:"accent",processing:"accent",success:"success",failed:"error"},os=()=>{const c=Me(),i=ss(),{state:{devSchema:h,engine:re,packages:P,isConnected:oe},setMessage:w,setShowManualBindIP:$}=Ee(),z=t.useMemo(()=>{const a=(P||[]).filter(n=>n.type==="independent").map(n=>({value:n.name,label:n.name,isGame:!1}));return[{value:b,label:s("subpackageCollect.entry.game"),isGame:!0},...a]},[P,Ge]),D=(P?.length??0)>0,j=z.length>1,y=re==="unity",N=oe||!!i?.isConnected,[l,p]=t.useState(()=>i?.stage??"entry"),[de,v]=t.useState("idle"),[m,ue]=t.useState(()=>i?.entry??b),[F,pe]=t.useState(()=>i?.entryLabel??""),[g,S]=t.useState(()=>i?.collected??[]),[ts,A]=t.useState([]),[k,T]=t.useState([]),[R,M]=t.useState(()=>i?.result??[]),[u,E]=t.useState(()=>i?.windowClosed??!1),[ge,q]=t.useState(!1),[ke,O]=t.useState(""),[be,W]=t.useState(""),I=t.useRef(!1),B=t.useRef("entry");I.current=u,B.current=l;const V=t.useMemo(()=>{if(!h)return"";const a=h.includes("?")?"&":"?";return`${h}${a}startupRoot=${encodeURIComponent(m)}`},[h,m]);t.useEffect(()=>{const a=Y.on("predownloadSubpackage",r=>{if(B.current!=="collecting"||I.current)return;const{subPkgName:x,isStartup:Se}=r;!x||x===b||(S(C=>C.some(Te=>Te.subPkgName===x)?C:[...C,{subPkgName:x,isStartup:Se}]),v(C=>C==="idle"?"running":C))}),n=Y.on("reportScene",r=>{B.current!=="collecting"||I.current||r.sceneId===He&&(E(!0),v("interactive"),w({type:"success",title:s("subpackageCollect.reportScene.toastTitle"),desc:s("subpackageCollect.reportScene.toastDesc")}))});return()=>{a(),n()}},[w]),t.useEffect(()=>{if(i||l!=="collecting"||u||!N){q(!1);return}const a=window.setTimeout(()=>q(!0),Xe);return()=>window.clearTimeout(a)},[i,l,u,N,de]);const K=async a=>{ue(a.value),pe(a.label),S([]),M([]),E(!1),v("idle"),T([]),A([]),p("collecting");const[n,r]=await Promise.all([Qe(a.value),Ze(a.value)]);if(n?.code===0&&n.data){const x=n.data.parallelPreloadSubpackages||[];T(x)}r?.code===0&&r.data&&(A(r.data.candidates||[]),r.data.totalSubpackages===0&&p("empty"))};t.useEffect(()=>{y||l==="entry"&&D&&!j&&K(z[0])},[l,D,j,y]);const H=async()=>{W(s("subpackageCollect.processing.write")),p("processing");const a=g.slice(),n=await Je(m,a);if(n?.code===0&&n.data){const r=n.data.parallelPreloadSubpackages||[];M(r),T(r),p("success")}else O(n?.error?.message||s("subpackageCollect.error.generic")),p("failed")},he=()=>{if(g.length===0&&k.length>0){se.confirm({title:s("subpackageCollect.finish.clearTitle"),content:s("subpackageCollect.finish.clearConfirm",{existing:k.length}),okText:s("subpackageCollect.finish.okClear"),cancelText:s("subpackageCollect.finish.cancel"),onOk:H});return}H()},me=()=>{S([]),M([]),T([]),E(!1),v("idle"),q(!1),O(""),W(""),p("collecting")},xe=async()=>{W(s("subpackageCollect.processing.clear")),p("processing");const a=await Ye(m);if(a?.code===0){me();return}O(a?.error?.message||s("subpackageCollect.error.generic")),p("failed")},Q=()=>{se.confirm({title:s("subpackageCollect.recollect.clearTitle"),content:s("subpackageCollect.recollect.clearDesc"),okText:s("subpackageCollect.recollect.clearAction"),cancelText:s("subpackageCollect.finish.cancel"),onOk:xe})},Z=()=>{S([]),M([]),A([]),E(!1),v("idle"),p("entry")},Ce=()=>c("/performance"),je=()=>{c("/performance")},ye=()=>{$(!0)},Ne=()=>{const a=Ae();if(!Re(a)){w({type:"warning",title:s("subpackageCollect.manualConnect.noRecordTitle"),desc:s("subpackageCollect.manualConnect.noRecordDesc")}),$(!0);return}qe(a),w({type:"info",title:s("subpackageCollect.manualConnect.retryTitle"),desc:s("subpackageCollect.manualConnect.retryDesc",{ip:String(a.ip),port:String(a.wsPort)})})},ve=t.useMemo(()=>l==="success"?R:g.length?g:u?[]:k,[l,R,g,k,u]),J=l==="collecting"&&!N,fe=y?s("subpackageCollect.stage.unsupported"):J?s("subpackageCollect.stage.notStarted"):s(`subpackageCollect.stage.${l}`),we=y?"warn":J?"neutral":as[l];return e.jsxs("div",{className:"subpkg-page","data-doc-shot":i?.shot||"subpackage-collection",children:[e.jsxs("div",{className:"subpkg-hero-strip",children:[e.jsxs("button",{type:"button",className:"subpkg-back",onClick:()=>c("/performance"),children:[e.jsx(_e,{size:14,strokeWidth:2}),e.jsx("span",{children:s("performance.back")})]}),e.jsx(Le,{title:s("subpackageCollect"),subtitle:s("subpackageCollect.subtitle"),action:e.jsxs("div",{className:"subpkg-hero-actions",children:[e.jsx(X,{href:ie,children:s("subpackageCollect.devGuide.link")}),e.jsx(ee,{tone:we,withDot:!0,variant:"solid",children:fe})]})})]}),y?e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-unsupported-card",children:[e.jsx("div",{className:"subpkg-unsupported-icon","aria-hidden":"true",children:e.jsx(ce,{size:22,strokeWidth:1.75})}),e.jsx("h2",{className:"subpkg-unsupported-title",children:s("subpackageCollect.unsupported.unity.title")}),e.jsx("p",{className:"subpkg-unsupported-desc",children:s("subpackageCollect.unsupported.unity.desc")}),e.jsx("div",{className:"subpkg-unsupported-actions",children:e.jsx(o,{type:"primary",theme:"solid",onClick:()=>c("/wasm_split"),children:s("subpackageCollect.unsupported.unity.action")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(d,{padding:"md",className:"subpkg-card subpkg-version-card",children:e.jsxs("div",{className:"subpkg-client-version",role:"list","aria-label":s("subpackageCollect.devGuide.clientVersion"),children:[e.jsxs("div",{className:"subpkg-client-version-title",children:[e.jsx(Ke,{size:16,strokeWidth:2}),e.jsx("span",{children:s("subpackageCollect.devGuide.clientVersion")})]}),e.jsx("span",{className:"subpkg-client-version-chip",role:"listitem",children:s("subpackageCollect.devGuide.android")}),e.jsx("span",{className:"subpkg-client-version-chip",role:"listitem",children:s("subpackageCollect.devGuide.ios")})]})}),e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-dev-guide-card",children:[e.jsx(G,{className:"subpkg-section-header",title:s("subpackageCollect.devGuide.stepsTitle")}),e.jsxs("div",{className:"subpkg-required-integration",children:[e.jsx("span",{className:"subpkg-required-label",children:s("subpackageCollect.devGuide.required.badge")}),e.jsxs("div",{className:"subpkg-required-copy",children:[e.jsxs("div",{className:"subpkg-required-title",children:[s("subpackageCollect.devGuide.required.title"),e.jsx("code",{children:s("subpackageCollect.devGuide.required.code")})]}),e.jsx("div",{className:"subpkg-required-desc",children:s("subpackageCollect.devGuide.required.desc")})]})]}),e.jsxs("ol",{className:"subpkg-dev-guide-list",children:[e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"1"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step1.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step1.desc")})]})]}),e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"2"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step2.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step2.desc")})]})]}),e.jsxs("li",{children:[e.jsx("span",{className:"subpkg-dev-guide-index",children:"3"}),e.jsxs("span",{className:"subpkg-dev-guide-copy",children:[e.jsx("strong",{children:s("subpackageCollect.devGuide.step3.title")}),e.jsx("span",{children:s("subpackageCollect.devGuide.step3.desc")})]})]})]})]}),l==="entry"&&(D&&j?e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsx(G,{icon:le,title:s("subpackageCollect.entry.title"),subtitle:s("subpackageCollect.entry.subtitle")}),e.jsx("div",{className:"subpkg-entry-grid",children:z.map(a=>e.jsxs("button",{type:"button",className:"subpkg-entry-card",onClick:()=>K(a),children:[e.jsx("span",{className:"subpkg-entry-name",children:a.label}),e.jsx(ee,{tone:a.isGame?"accent":"info",size:"sm",variant:"outline",children:a.isGame?s("subpackageCollect.entry.gameTag"):s("subpackageCollect.entry.independentTag")})]},a.value))})]}):e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(U,{size:28,strokeWidth:1.75,className:"subpkg-wait-spin"}),e.jsx("p",{className:"subpkg-center-text",children:s("subpackageCollect.loading")})]})),l==="empty"&&e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(le,{size:28,strokeWidth:1.5,className:"subpkg-empty-icon"}),e.jsx("p",{className:"subpkg-empty-title",children:s("subpackageCollect.empty.title")}),e.jsx("p",{className:"subpkg-empty-desc",children:s("subpackageCollect.empty.desc")}),e.jsx("div",{className:"subpkg-actions subpkg-actions-center",children:e.jsx(o,{type:"primary",theme:"solid",onClick:()=>c("/performance"),children:s("subpackageCollect.empty.back")})})]}),l==="collecting"&&e.jsxs("div",{className:"subpkg-collect-grid",children:[e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-collect-card",children:[e.jsx(G,{className:"subpkg-section-header",title:e.jsxs("span",{className:"subpkg-entry-title",children:[e.jsx("span",{className:"subpkg-entry-title-label",children:s("subpackageCollect.preview.currentEntry")}),e.jsx("span",{className:"subpkg-entry-title-value",children:F||m})]})}),!u&&!N&&e.jsxs("div",{className:"subpkg-scan",children:[e.jsx("div",{className:"subpkg-qr",children:V?e.jsx(Pe,{value:V,size:164}):e.jsx("div",{className:"subpkg-qr-empty",children:s("subpackageCollect.preview.noSchema")})}),e.jsxs("div",{className:"subpkg-scan-main",children:[e.jsxs("div",{className:"subpkg-scan-heading",children:[e.jsx("div",{className:"subpkg-scan-title",children:s("subpackageCollect.scan.title")}),e.jsx("div",{className:"subpkg-scan-subtitle",children:s("subpackageCollect.scan.subtitle")})]}),e.jsxs("ol",{className:"subpkg-guide",children:[e.jsx("li",{children:s("subpackageCollect.guide.step2")}),e.jsx("li",{className:"subpkg-guide-key",children:s("subpackageCollect.guide.step3")})]})]}),e.jsxs("div",{className:"subpkg-connect-tools",role:"group","aria-label":s("subpackageCollect.manualConnect.title"),children:[e.jsxs("div",{className:"subpkg-connect-copy",children:[e.jsx("span",{className:"subpkg-connect-icon","aria-hidden":"true",children:e.jsx(ae,{size:16,strokeWidth:2})}),e.jsxs("span",{className:"subpkg-connect-text",children:[e.jsx("span",{className:"subpkg-connect-title",children:s("subpackageCollect.manualConnect.title")}),e.jsx("span",{className:"subpkg-connect-hint",children:s("subpackageCollect.manualConnect.desc")})]})]}),e.jsxs("div",{className:"subpkg-connect-actions",children:[e.jsx(o,{className:"subpkg-connect-button subpkg-connect-button-secondary",size:"small",type:"tertiary",icon:e.jsx(Fe,{size:14,strokeWidth:2}),onClick:Ne,children:s("subpackageCollect.manualConnect.retry")}),e.jsx(o,{className:"subpkg-connect-button subpkg-connect-button-primary",size:"small",theme:"light",icon:e.jsx(Be,{size:14,strokeWidth:2}),onClick:ye,children:s("subpackageCollect.manualConnect.action")})]})]})]}),u?e.jsxs("div",{className:"subpkg-banner subpkg-banner-success",role:"status",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(te,{size:18,strokeWidth:2})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.reportScene.readyTitle")}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.reportScene.readyDesc")})]}),e.jsx(o,{className:"subpkg-banner-action",size:"small",type:"primary",theme:"solid",onClick:he,children:s("subpackageCollect.action.finish")})]}):N&&(ge?e.jsxs("div",{className:"subpkg-banner subpkg-banner-warn",role:"alert",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(ce,{size:18,strokeWidth:2})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.wait.timeoutTitle")}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.wait.timeout")})]}),e.jsx(X,{className:"subpkg-banner-cta",href:ie,children:s("subpackageCollect.wait.docLink")})]}):e.jsxs("div",{className:"subpkg-banner subpkg-banner-accent",role:"status",children:[e.jsx("span",{className:"subpkg-banner-bar","aria-hidden":"true"}),e.jsx("span",{className:"subpkg-banner-icon",children:e.jsx(U,{size:18,strokeWidth:2,className:"subpkg-wait-spin"})}),e.jsxs("div",{className:"subpkg-banner-body",children:[e.jsx("div",{className:"subpkg-banner-title",children:s("subpackageCollect.wait.runningTitle")}),e.jsx("div",{className:"subpkg-banner-progress",children:e.jsx(Oe,{})}),e.jsx("div",{className:"subpkg-banner-text",children:s("subpackageCollect.wait.running")})]})]})),es]}),e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-side",children:[e.jsx(G,{title:s("subpackageCollect.preview.collectedTitle"),subtitle:g.length?s("subpackageCollect.preview.collectedDesc"):u?s("subpackageCollect.preview.emptyResultDesc"):k.length?s("subpackageCollect.preview.existingDesc"):s("subpackageCollect.preview.waitingDesc")}),e.jsx(ne,{entries:ve,emptyText:s("subpackageCollect.preview.empty")}),u&&k.length>0&&e.jsx("p",{className:`subpkg-finish-note${g.length?"":" subpkg-finish-note-clear"}`,children:g.length?s("subpackageCollect.finish.overwriteNote",{current:g.length,existing:k.length}):s("subpackageCollect.finish.clearNote",{existing:k.length})}),!u&&e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"tertiary",onClick:Ce,children:s("subpackageCollect.action.cancel")}),e.jsx(o,{type:"tertiary",onClick:je,children:s("subpackageCollect.action.exit")})]})]})]}),l==="processing"&&e.jsxs(d,{padding:"lg",className:"subpkg-card subpkg-center",children:[e.jsx(U,{size:28,strokeWidth:1.75,className:"subpkg-wait-spin"}),e.jsx("p",{className:"subpkg-center-text",children:be||s("subpackageCollect.processing.write")})]}),l==="success"&&e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsxs("div",{className:"subpkg-result-head subpkg-result-success",children:[e.jsx(te,{size:20,strokeWidth:1.75}),e.jsx("span",{children:s("subpackageCollect.success.title")})]}),e.jsxs("div",{className:"subpkg-entry-hint",children:[s("subpackageCollect.preview.currentEntry"),":",e.jsx("strong",{children:F||m})]}),e.jsx(ne,{entries:R,emptyText:s("subpackageCollect.success.empty")}),e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"primary",theme:"solid",onClick:Q,children:s("subpackageCollect.action.recollect")}),j&&e.jsx(o,{type:"tertiary",onClick:Z,children:s("subpackageCollect.action.switch")})]})]}),l==="failed"&&e.jsxs(d,{padding:"lg",className:"subpkg-card",children:[e.jsxs("div",{className:"subpkg-result-head subpkg-result-failed",children:[e.jsx(ae,{size:20,strokeWidth:1.75}),e.jsx("span",{children:s("subpackageCollect.failed.title")})]}),e.jsx("p",{className:"subpkg-error-msg",children:ke}),e.jsxs("div",{className:"subpkg-actions",children:[e.jsx(o,{type:"primary",theme:"solid",onClick:Q,children:s("subpackageCollect.action.recollect")}),j&&e.jsx(o,{type:"tertiary",onClick:Z,children:s("subpackageCollect.action.switch")})]})]})]})]})};export{os as SubpackageCollect};
@@ -1 +1 @@
1
- import{j as e,T as i,i as n,I as o}from"./index-DcpswdR4.js";import{D as c}from"./index-BkbwTqmH.js";const s=[{node:"item",get name(){return n("quickStart")},link:"https://bytedance.sg.larkoffice.com/docx/MarqdNvQLoihvjxN4rFllgjBgwb"},{node:"item",get name(){return n("jsApiList")},link:"https://bytedance.larkoffice.com/wiki/GQscwDOQSiPxyjkbzyfckh2pnDg"},{node:"item",get name(){return n("advancedGuide")},link:"https://bytedance.larkoffice.com/wiki/AGqRwu0qQiXZpVkkToUcRP99nwc"},{node:"item",get name(){return n("faq")},link:"https://bytedance.larkoffice.com/wiki/O6aWwFhDBiEglwkcnJ4ccJpdnmb"}],d=()=>e.jsx(c,{trigger:"hover",position:"bottomRight",render:e.jsx(e.Fragment,{children:s.map(t=>e.jsx(c.Item,{onClick:()=>{window.open(t.link)},children:t.name},t.name))}),children:e.jsxs("div",{className:"access-docs tt-header-chip",role:"button",tabIndex:0,children:[e.jsx(i.Text,{className:"access-docs-text",type:"primary",children:n("docs")}),e.jsx(o,{className:"access-docs-icon"})]})});export{d as AccessDocs};
1
+ import{j as e,T as i,i as n,I as o}from"./index-Ch-x1uku.js";import{D as c}from"./index-D4KyBBg8.js";const s=[{node:"item",get name(){return n("quickStart")},link:"https://bytedance.sg.larkoffice.com/docx/MarqdNvQLoihvjxN4rFllgjBgwb"},{node:"item",get name(){return n("jsApiList")},link:"https://bytedance.larkoffice.com/wiki/GQscwDOQSiPxyjkbzyfckh2pnDg"},{node:"item",get name(){return n("advancedGuide")},link:"https://bytedance.larkoffice.com/wiki/AGqRwu0qQiXZpVkkToUcRP99nwc"},{node:"item",get name(){return n("faq")},link:"https://bytedance.larkoffice.com/wiki/O6aWwFhDBiEglwkcnJ4ccJpdnmb"}],d=()=>e.jsx(c,{trigger:"hover",position:"bottomRight",render:e.jsx(e.Fragment,{children:s.map(t=>e.jsx(c.Item,{onClick:()=>{window.open(t.link)},children:t.name},t.name))}),children:e.jsxs("div",{className:"access-docs tt-header-chip",role:"button",tabIndex:0,children:[e.jsx(i.Text,{className:"access-docs-text",type:"primary",children:n("docs")}),e.jsx(o,{className:"access-docs-icon"})]})});export{d as AccessDocs};