PageSourceSearch

https://www.copus.io/assets/index-BM0c6shJ.js

js copus.io collected 2026-10-02 00:03:03 UTC 67,106 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CGeHaFxe.js","assets/index-B9sDMNBb.js","assets/react-vendor-D8m9dEpm.js","assets/router-vendor-Dd05clGk.js","assets/antd-vendor-DHL82ETZ.js","assets/index-CVImDqk_.css"])))=>i.map(i=>d[i]);
2var Wt=Object.defineProperty,Xt=Object.defineProperties;var Zt=Object.getOwnPropertyDescriptors;var ot=Object.getOwnPropertySymbols;var Kt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable;var lt=(t,s,n)=>s in t?Wt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n,w=(t,s)=>{for(var n in s||(s={}))Kt.call(s,n)&&lt(t,n,s[n]);if(ot)for(var n of ot(s))Qt.call(s,n)&&lt(t,n,s[n]);return t},_=(t,s)=>Xt(t,Zt(s));import{cL as kt,g as Tt,bI as es,j as e,as as ct,at as Z,cM as ts,u as se,_ as _t,bH as fe,cN as ss,cO as ns,cP as Me,E as Et,n as he,cQ as rs,cR as as,t as o,cS as is,ba as os,P as ls,Q as cs,X as Oe,h as De,cT as ds,c4 as us,Y as ps,c1 as xs,c2 as ms,af as Fe,cU as fs,cV as ce,cH as hs,cW as Rt,cX as gs,cY as vs,bJ as bs,a as ys,cZ as js,c_ as dt,c$ as Cs,d0 as Ns,c0 as ws,aB as ut,c3 as Is,d1 as Ss,d2 as Ps,d3 as Us,aM as pt,H as ks,cr as Ts,d4 as _s,d5 as Es,aV as Rs,p as Ls,e as As,d6 as Os,d7 as Ds,O as Ms,cJ as Fs}from"./index-B9sDMNBb.js";import{L as zs}from"./index-CPdAfm52.js";import{r as a,c as $s,g as Gs}from"./router-vendor-Dd05clGk.js";import{E as xt,a as Bs,b as Ys,i as Hs,r as qs,s as Vs,g as Js,h as be,c as Ws,R as Xs}from"./reader-image-gallery-CDEXOdAe.js";import{_ as Ce,i as Zs,Q as Ks,I as ge,s as E,B as J,S as we,R as z,g as Qs,a as Lt,d as K,f as en,b as tn,j as sn}from"./antd-vendor-DHL82ETZ.js";import{S as nn}from"./index-GOMwHBqb.js";import{W as rn,c as Ae,T as an}from"./index-B0-5b41h.js";import{R as At,a as Ot}from"./lodash-BXqK-eh-.js";import{u as on,b as ln,S as cn,a as dn}from"./icon-home-post2-3RiKt-WX.js";import"./react-vendor-D8m9dEpm.js";import"./zetachain-BMJKVYBN-BJbpImGn.js";var un=function(s,n){return a.createElement(kt,Ce(Ce({},s),{},{ref:n,icon:Zs}))},pn=a.forwardRef(un),xn=function(s,n){return a.createElement(kt,Ce(Ce({},s),{},{ref:n,icon:Ks}))},mn=a.forwardRef(xn);const Dt=a.createContext(null),mt=t=>a.createElement("svg",w({width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),a.createElement("rect",{width:14.0011,height:14,rx:7,fill:"#E41A1A"}),a.createElement("path",{d:"M7.93979 6.99943L10.8041 4.14179C10.9295 4.01635 11 3.84623 11 3.66884C11 3.49146 10.9295 3.32133 10.8041 3.1959C10.6787 3.07047 10.5085 3 10.3312 3C10.1538 3 9.98365 3.07047 9.85821 3.1959L7.00057 6.06021L4.14292 3.1959C4.01749 3.07047 3.84737 3 3.66998 3C3.49259 3 3.32247 3.07047 3.19704 3.1959C3.0716 3.32133 3.00114 3.49146 3.00114 3.66884C3.00114 3.84623 3.0716 4.01635 3.19704 4.14179L6.06134 6.99943L3.19704 9.85708C3.1346 9.919 3.08505 9.99267 3.05123 10.0738C3.01741 10.155 3 10.2421 3 10.33C3 10.418 3.01741 10.505 3.05123 10.5862C3.08505 10.6674 3.1346 10.741 3.19704 10.803C3.25896 10.8654 3.33263 10.915 3.41381 10.9488C3.49498 10.9826 3.58204 11 3.66998 11C3.75792 11 3.84498 10.9826 3.92615 10.9488C4.00733 10.915 4.081 10.8654 4.14292 
210.803L7.00057 7.93866L9.85821 10.803C9.92014 10.8654 9.99381 10.915 10.075 10.9488C10.1562 10.9826 10.2432 11 10.3312 11C10.4191 11 10.5062 10.9826 10.5873 10.9488C10.6685 10.915 10.7422 10.8654 10.8041 10.803C10.8665 10.741 10.9161 10.6674 10.9499 10.5862C10.9837 10.505 11.0011 10.418 11.0011 10.33C11.0011 10.2421 10.9837 10.155 10.9499 10.0738C10.9161 9.99267 10.8665 9.919 10.8041 9.85708L7.93979 6.99943Z",fill:"white"})),ae=()=>a.useContext(Dt),fn="_titleInput_eoa3r_17",hn="_subTitleInput_eoa3r_37",ye={"text-editor-main":"_text-editor-main_eoa3r_1","game-editor-main":"_game-editor-main_eoa3r_14",titleInput:fn,subTitleInput:hn,"content-wrapper":"_content-wrapper_eoa3r_53"},gn=new Set(["link","autolink","mark","mention","inline-image","hashtag"]);function Mt(t,s){var r;if(t.type==="linebreak"||t.type==="tab"){s.text+=1,s.gate+=1;return}const n=t.children;if(!Array.isArray(n)){const l=typeof t.text=="string"?t.text.length:0;s.text+=l,s.gate+=l;return}for(let l=0;l<n.length;l+=1){const c=n[l];Mt(c,s);const u=Array.isArray(c.children),g=gn.has((r=c.type)!=null?r:"");u&&!g&&l!==n.length-1&&(s.gate+=2)}}function ft(t){const s={text:0,gate:0};if(!t)return s;let n=t;if(typeof t=="string")try{n=JSON.parse(t)}catch(l){return s}const r=n==null?void 0:n.root;if(!r)return s;try{Mt(r,s)}catch(l){return{text:0,gate:0}}return s}const je=5e4;function vn(t){return je+Math.max(0,t.gate-t.text)}const bn={empty:98,fallback:97,async:96,selfix:95};function de(t,s){try{const n="https://api.client.prod.copus.io",r=Object.entries(s).map(([c,u])=>"".concat(c,"=").concat(encodeURIComponent(String(u)))).join("&"),l="copus-paste://".concat(t,"?").concat(r).slice(0,400);window.fetch("".concat(n,"/client/common/user/behavior/enterPage"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({behaviorType:1,page:1,pageEventType:bn[t],pageUrl:l,pageEventName:"copus-paste"}),keepalive:!0}).catch(()=>{})}catch(n){}}function ue(){const t=navigator.userAgent||"";if(/iPad|iPhone|iPod/.test(t)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)return"ios";const n=/Chrome\/(\d+)/.exec(t);return/Android/.test(t)?"android".concat(n?n[1]:""):n?"chrome".concat(n[1]):"other"}function yn(t){var c;const s=t?Array.from(t.types||[]):[];let n="",r="";try{n=(t==null?void 0:t.getData("text/plain"))||""}catch(u){n=""}try{r=(t==null?void 0:t.getData("text/html"))||""}catch(u){r=""}const l=((c=t==null?void 0:t.files)==null?void 0:c.length)||0;return{types:s,plain:n,html:r,files:l}}function ht(t,s){try{return t.focus(),document.execCommand("insertText",!1,s)}catch(n){return!1}}function jn(t){try{t.focus();const s=window.getSelection();if(!s)return;const n=document.createRange();n.selectNodeContents(t),n.collapse(!1),s.removeAllRanges(),s.addRange(n)}catch(s){}}function Cn(t,s){const n=r=>{var N,U,x;const l=r,c=l.target,u=(N=c==null?void 0:c.closest)==null?void 0:N.call(c,'[contenteditable="true"]');if(!u||!t.contains(u))return;const{types:g,plain:m,html:S,files:b}=yn(l.clipboardData),y=(x=(U=u.textContent)==null?void 0:U.length)!=null?x:0;if(!m&&!S&&b===0){l.preventDefault(),l.stopPropagation(),(async()=>{var j,L;let k="";try{k=await((L=(j=navigator.clipboard)==null?void 0:j.readText)==null?void 0:L.call(j))||""}catch(i){k=""}if(k&&ht(u,k)){de("async",{t:g.join("|")||"none",len:k.length,ua:ue()});return}de("empty",{t:g.join("|")||"none",ua:ue()}),s.notify("empty")})();return}if(b>0)return;let f=!1;const h=()=>{var O,Y;if(f)return;f=!0,((Y=(O=u.textContent)==null?void 0:O.length)!=null?Y:0)-y<1&&m&&(ht(u,m)?(de("fallback",{t:g.join("|")||"none",p:m.length,h:S.length,ua:ue()}),s.notify("fallback")):(de("empty",{t:g.join("|")||"none",p:m.length,h:S.length,ua:ue()}),s.notify("empty")));const L=window.getSelection(),i=L&&L.rangeCount>0?L.anchorNode:null,p=!i||!u.contains(i),T=document.activeElement;p&&(T===u||T===document.body||T===null)&&(jn(u),de("selfix",{t:g.join("|")||"none",ua:ue()}))};requestAnimationFrame(()=>requestAnimationFrame(h)),window.setTimeout(h,200)};return t.addEventListener("paste",n,!0),()=>t.removeEventListener("paste",n,!0)}function Nn({onBackToText:t}){const{data:s,setData:n}=ae(),{data:r}=Tt(),[l,c]=a.useState(!1),[u,g]=a.useState(""),[m,S]=a.useState(!1),b=es(s.content);async function y(f){if(f){c(!0),g("");try{r&&await ct("/api/account",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:r.id,displayName:r.username})});const h=await ct("/api/works",{method:"POST",headers:{"X-Game-Title":encodeURIComponent(s.title||"未命名游戏"),"X-Game-Instructions":encodeURIComponent(s.subTitle||"开始游戏"),"X-Game-Metric":"score"},body:f});n(N=>_(w({}
2,N),{opusType:Z,uuid:N.uuid,content:JSON.stringify({schemaVersion:1,kind:"game",workId:h.work.id,entryUrl:h.work.entryUrl,instructions:N.subTitle||"开始游戏",metric:h.work.metric||"score"})}))}catch(h){g(h instanceof Error?h.message:"上传失败")}finally{c(!1)}}}return e.jsxs("section",{className:"mx-auto my-[30px] w-full max-w-[820px] rounded-[20px] border border-[#ded9d4] bg-white p-[28px]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-[26px] font-[600]",children:"游戏正文"}),t&&e.jsx("button",{type:"button",className:"rounded-full border border-[#d7d2ce] px-[13px] py-[6px] text-[13px]",onClick:t,children:"返回图文"})]}),e.jsx("p",{className:"mt-[8px] text-[#666]",children:"上传包含 index.html 的 ZIP,游戏将显示为这篇作品的正文。"}),e.jsxs("label",{className:"mt-[22px] flex min-h-[180px] cursor-pointer flex-col items-center justify-center rounded-[16px] border-2 border-dashed p-[24px] text-center ".concat(b?"border-[#2b8649] bg-[#f2faf4]":"border-[#f23a00] bg-[#fff7f3]"),children:[e.jsx("b",{className:"text-[18px] ".concat(b?"text-[#2b8649]":"text-[#f23a00]"),children:l?"正在校验并上传…":b?"✓ 游戏包验证通过,点击可替换":"上传游戏压缩包"}),e.jsx("span",{className:"mt-[8px] text-[13px] text-[#777]",children:"最大 20 MiB,ZIP 根目录必须有 index.html"}),e.jsx("input",{className:"hidden",type:"file",accept:".zip,application/zip",disabled:l,onChange:f=>{var h;return void y((h=f.target.files)==null?void 0:h[0])}})]}),u&&e.jsx("p",{className:"mt-[12px] text-[#d22]",children:u}),e.jsxs("details",{className:"mt-[24px] rounded-[14px] bg-[#f7f5f2] p-[18px]",open:!0,children:[e.jsx("summary",{className:"cursor-pointer text-[17px] font-[600]",children:"小游戏接入指南"}),e.jsxs("div",{className:"mt-[14px] space-y-[12px] text-[14px] leading-[1.65] text-[#484848]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-[10px] rounded-[10px] bg-white p-[12px]",children:[e.jsx("a",{className:"font-[600] text-[#f23a00] underline",href:"/game-creator-guide.md",target:"_blank",rel:"noreferrer",children:"给 AI 的完整制作文档"}),e.jsx("button",{type:"button",className:"rounded-full border border-[#d7d2ce] px-[12px] py-[4px] text-[13px]",onClick:async()=>{await navigator.clipboard.writeText("".concat(window.location.origin,"/game-creator-guide.md")),S(!0),setTimeout(()=>S(!1),1600)},children:m?"已复制链接":"复制文档链接"}),e.jsx("span",{className:"text-[13px] text-[#777]",children:"把链接和你的玩法想法一起发给 AI,即可让它生成上传包。"})]}),e.jsxs("p",{children:[e.jsx("b",{children:"1. 游戏包(必需):"}),"把 ",e.jsx("code",{children:"index.html"})," 放在 ZIP 根目录,图片、CSS 和普通 JavaScript 使用相对路径。游戏所需的操作和界面都放在游戏画面内。"]}),e.jsxs("p",{children:[e.jsx("b",{children:"2. 接入平台能力(可选):"}),"只有需要 Copus 用户身份、成绩、排行榜、分享或保存时,才把示例包中的 ",e.jsx("code",{children:"sdk.js"})," 放进游戏,并在 HTML 中用 ",e.jsx("code",{children:'<script src="sdk.js"><\/script>'})," 引入。"]}),e.jsxs("p",{children:[e.jsx("b",{children:"3. 保存成绩(可选):"}),"接入时必须让玩家选择是否匿名,默认建议匿名。开始时调用 ",e.jsxs("code",{children:["const ","{ runId }"," = await CopusGame.startRun(","{ anonymous }",")"]}),";结束时调用 ",e.jsxs("code",{children:["await CopusGame.submitScore(","{ runId, score }",")"]}),"。匿名成绩仍按账户去重并保留个人最高分,但榜单不显示用户名。"]}),e.jsxs("p",{children:[e.jsx("b",{children:"4. 游戏内榜单(可选):"}),"调用 ",e.jsxs("code",{children:["const ","{ entries }"," = await CopusGame.getLeaderboard()"]}),",自行把返回的 ",e.jsx("code",{children:"rank、displayName、bestValue"})," 画在游戏界面中。需要重新开始按钮时,也由游戏自己提供。"]}),e.jsxs("p",{children:[e.jsx("b",{children:"5. 分享与保存(可选):"}),"图像、测试结果或成绩类游戏可以调用 ",e.jsx("code",{children:"CopusGame.shareToComments(...)"})," 请求把结果图分享到当前作品评论区,也可调用 ",e.jsx("code",{children:"shareResult(...)"})," 系统分享或 ",e.jsx("code",{children:"saveFile(...)"})," 保存。评论区发布前平台会显示预览、文字和公开身份,必须由玩家确认。"]}),e.jsx("pre",{className:"overflow-x-auto rounded-[10px] bg-[#231f20] p-[14px] text-[12px] leading-[1.55] text-white",children:"const player = await CopusGame.getPlayer();\nconst { runId } = await CopusGame.startRun({ anonymous: true });\nconst result = await CopusGame.submitScore({ runId, score: 42 });\nconst { entries } = await CopusGame.getLeaderboard();\nawait CopusGame.shareResult({ title, text, image });\nawait CopusGame.shareToComments({ image, filename: 'result.png', text });\nawait CopusGame.saveFile({ filename: 'result.png', file: image });"}),e.jsxs("p",{children:["可直接参考本项目的 ",e.jsx("code",{children:"examples/games/click-score"}),"。当前支持最高分排行;游戏包最大 20 MiB、最多 500 个文件,不能依赖外部 CDN 或网络请求。"]}
2)]})]})]})}const wn=10;Hs();const Ft=()=>_t(()=>import("./index-CGeHaFxe.js").then(t=>t.y),__vite__mapDeps([0,1,2,3,4,5])),In=a.lazy(Ft),gt=ge.TextArea,vt='{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}',bt=e.jsx("div",{className:"flex min-h-[400px] items-center justify-center bg-white/80",children:e.jsx(we,{indicator:e.jsx(Me,{style:{fontSize:48},spin:!0})})}),Sn=t=>{const s=a.useRef(null),[n,r]=a.useState(null),l=a.useCallback(v=>{s.current=v,r(v)},[]),{hint:c,scrollForward:u,scrollBack:g}=ts(a.useCallback(()=>{var v,I;return(I=(v=s.current)==null?void 0:v.querySelector(".toolbar"))!=null?I:null},[])),{t:m,i18n:S}=se(),[b,y]=a.useState({}),f=Object.values(b),h=f.filter(v=>v.status==="failed"),N=f.reduce((v,I)=>v+I.bytes,0);a.useEffect(()=>{const v=I=>{const C=I.detail;if(!(C!=null&&C.id))return;const A="editor-media-upload-".concat(C.id);if(y(X=>{const V=w({},X);return C.status==="success"?delete V[C.id]:V[C.id]=C,V}),C.status==="success"){E.destroy(A);return}if(C.status==="retrying"){E.open({key:A,type:"loading",duration:0,content:m("clientUI.startCreating.mediaUploadRetrying")});return}C.status==="failed"&&E.open({key:A,type:"error",duration:0,content:e.jsxs("span",{className:"inline-flex items-center gap-[4px]",children:[e.jsx("span",{children:m("clientUI.startCreating.mediaUploadFailed")}),e.jsx(J,{type:"text",size:"small",className:"!h-auto !px-[8px] !py-0 !font-[600] !text-[#F23A00]",onClick:()=>Ys(C.id),children:m("clientUI.startCreating.retryUpload")})]})})};return window.addEventListener(xt,v),()=>window.removeEventListener(xt,v)},[m]);const{onRender:U}=t,[x,k]=a.useState(),{data:j,setData:L}=ae(),i=a.useMemo(()=>["history","block-format","font","insert-image","insert-audio","insert-video","bold","italic","underline","strikethrough","link","font-color","bg-color","font-more","insert-more","code-format","divider","element-format","first-line-indent"],[]),p=j.opusType===Z,T=a.useRef(),O=a.useRef(),Y=v=>{const I=v===Z;if(I!==p){p?O.current=j.content:T.current=j.content;const C=I?O.current||"":T.current||vt;I||k(fe(C)),L(A=>_(w({},A),{opusType:v,content:C,contentPublic:void 0}))}else L(C=>_(w({},C),{opusType:v}))},[H,F]=a.useState(null);a.useEffect(()=>{const v=n;if(!v)return;let I=null;const C=()=>{var V;const X=(V=v.querySelector(".toolbar i.video"))==null?void 0:V.closest("button");X!=null&&X.parentElement&&(I||(I=document.createElement("span"),I.dataset.copusGameUpload="",I.className="inline-flex flex-none",F(I)),X.nextElementSibling!==I&&X.insertAdjacentElement("afterend",I))};C();const A=new MutationObserver(C);return A.observe(v,{childList:!0,subtree:!0}),()=>{A.disconnect(),I==null||I.remove(),F(null)}},[p,n]),a.useEffect(()=>{if(n)return Cn(n,{notify:v=>{E.open({key:"copus-paste-rescue",type:v==="empty"?"warning":"info",duration:v==="empty"?9:4,content:m(v==="empty"?"clientUI.startCreating.pasteEmpty":"clientUI.startCreating.pastePlainFallback")})}})},[n,m]),a.useEffect(()=>{p||Ft()},[p]);const q=j==null?void 0:j.content;a.useEffect(()=>{if(p){U==null||U(!0);return}q&&(k(v=>v!=null?v:fe(q)),U==null||U(!0))},[q,p,U]);const[M]=a.useState({title:"",content:""}),[W,ne]=a.useState({text:0,gate:0});a.useEffect(()=>{ne(ft(q))},[x]);const Se=a.useCallback((v,I)=>{j.opusType!==Z&&v.read(async()=>{const C=v.toJSON();ne(ft(C)),L(A=>A.opusType===Z?A:_(w({},A),{content:JSON.stringify(C),contentPublic:JSON.stringify(I.publicContent)}))})},[j,L]),ie="".concat(j.uuid,"_").concat(j.editTime);return a.useEffect(()=>()=>ss(),[ie]),!p&&!x?bt:e.jsx(a.Suspense,{fallback:bt,children:e.jsxs("div",{className:"mx-auto flex w-full max-w-[800px] flex-1 flex-col bg-white/80 pb-[40px] pt-[40px] sm:px-[12px] sm:pb-[80px] sm:pt-[10px]",children:[e.jsxs("div",{children:[e.jsx(gt,{className:ye.titleInput,placeholder:m("clientUI.startCreating.titleTitle"),value:j==null?void 0:j.title,variant:"borderless",onChange:v=>{v.target.value.trim().length<=75?L(I=>_(w({},I),{title:v.target.value})):E.warning(m("clientUI.startCreating.titleWarning"))},autoSize:{minRows:1,maxRows:3}}),M.title&&e.jsxs("div",{className:"flex mt-[2px] h-[18px] items-center text-[14px] text-error",children:[e.jsx(mt,{className:"mr-[5px]"}),M.title]})]}),e.jsx("div",{children:e.jsx(gt,{className:ye.subTitleInput,placeholder:m("
2clientUI.startCreating.subTitle"),variant:"borderless",value:j==null?void 0:j.subTitle,maxLength:300,autoSize:!0,onKeyDown:v=>{v.key==="Enter"&&v.preventDefault()},onChange:v=>{if(v.target.value.trim().length>300)E.warning(m("clientUI.startCreating.subTitleWarning"));else{const I=v.target.value.replace(/[\r\n]/g," ");L(C=>_(w({},C),{subTitle:I}))}}})}),e.jsxs("div",{ref:l,translate:"no",className:"notranslate relative ".concat(ye[p?"game-editor-main":"text-editor-main"]," ").concat(ye["content-wrapper"]),onClickCapture:v=>{if(!p)return;const I=v.target;!I.closest(".toolbar")||I.closest("[data-copus-game-upload]")||(v.preventDefault(),v.stopPropagation(),Y(wn))},children:[e.jsxs("div",{children:[!p&&f.length>0&&e.jsxs("div",{className:"mb-[12px] flex items-center justify-between gap-[12px] rounded-[12px] border px-[14px] py-[10px] text-[13px] leading-[1.45]",style:{borderColor:h.length?"rgba(242,58,0,0.35)":"rgba(33,145,251,0.28)",background:h.length?"#FFF4EF":"#F2F8FF",color:"#484848"},role:"status","aria-live":"polite",children:[e.jsxs("span",{children:[m("clientUI.startCreating.mediaUploadProgress",{count:f.length,size:"".concat((N/1024/1024).toFixed(1)," MB")}),h.length>0&&e.jsx("span",{className:"ml-[8px] font-[600] text-[#F23A00]",children:m("clientUI.startCreating.mediaUploadFailedCount",{count:h.length})})]}),h.length>0&&e.jsx(J,{type:"text",size:"small",className:"!h-auto !flex-shrink-0 !px-[8px] !py-[2px] !font-[600] !text-[#F23A00]",onClick:()=>Bs(),children:m("clientUI.startCreating.retryAllUploads")})]}),e.jsx(ns,{hint:c,onClick:u,onBack:g,label:m("clientUI.scrollRight"),backLabel:m("clientUI.scrollLeft")}),e.jsx(In,{locale:S.language,onChange:Se,initialValue:x||vt,toolbar:i,showLabel:!1,maxLength:vn(W)},ie)]}),p&&e.jsx(Nn,{})]}),H&&$s.createPortal(e.jsx("button",{type:"button",className:"toolbar-item ".concat(p?"active":""),"aria-label":"上传游戏",title:"上传游戏",onClick:()=>Y(Z),children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M7.25 4.5h9.5c2.55 0 4.55 2 5.05 4.65l.85 5.2c.65 3.8-2.15 6.25-5.15 4.05l-2.3-1.7H8.8l-2.3 1.7c-3 2.2-5.8-.25-5.15-4.05l.85-5.2C2.7 6.5 4.7 4.5 7.25 4.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),e.jsx("path",{d:"M6.3 10.75h4.2M8.4 8.65v4.2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"15.6",cy:"9.8",r:"1.2",fill:"currentColor"}),e.jsx("circle",{cx:"18.4",cy:"12.6",r:"1.2",fill:"currentColor"})]})}),H),!p&&e.jsxs("div",{className:"mt-auto pt-[6px] pr-[4px] text-right text-[12px] leading-[18px] ".concat(W.text>=je?"text-error":"text-third"),children:[m("clientUI.startCreating.wordCount",{n:W.text.toLocaleString(),max:je.toLocaleString()}),W.text>=je&&e.jsx("span",{className:"ml-[6px]",children:m("clientUI.startCreating.wordCountFull")})]}),M.content&&e.jsxs("div",{className:"flex h-[18px] items-center mt-[5px] text-[14px] text-error ",children:[e.jsx(mt,{className:"mr-[5px]"}),M.content]})]})})};function Pn(t){return Et(t?["/client/user/opus/creator/draftDetail",t]:null,([s,n])=>he.get(s,{params:{uuid:n}}).then(r=>r.data.data),{revalidateFirstPage:!1,revalidateOnMount:!1,refreshInterval:0})}var pe={},yt;function Un(){if(yt)return pe;yt=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.recoilPersist=void 0;const t=(s={})=>
2{if(typeof window>"u")return{persistAtom:()=>{}};const{key:n="recoil-persist",storage:r=localStorage,converter:l=JSON}=s,c=({onSet:b,node:y,trigger:f,setSelf:h})=>{if(f==="get"){const N=g();typeof N.then=="function"&&N.then(U=>{U.hasOwnProperty(y.key)&&h(U[y.key])}),N.hasOwnProperty(y.key)&&h(N[y.key])}b(async(N,U,x)=>{const k=g();typeof k.then=="function"?k.then(j=>u(N,j,y.key,x)):u(N,k,y.key,x)})},u=(b,y,f,h)=>{h?delete y[f]:y[f]=b,S(y)},g=()=>{const b=r.getItem(n);return b==null?{}:typeof b=="string"?m(b):typeof b.then=="function"?b.then(m):{}},m=b=>{if(b===void 0)return{};try{return l.parse(b)}catch(y){return console.error(y),{}}},S=b=>{try{typeof r.mergeItem=="function"?r.mergeItem(n,l.stringify(b)):r.setItem(n,l.stringify(b))}catch(y){console.error(y)}};return{persistAtom:c}};return pe.recoilPersist=t,pe}var kn=Un();const{persistAtom:Tn}=kn.recoilPersist(),_n=rs({key:"upstream",default:null,effects_UNSTABLE:[Tn]}),xe=t=>t.kind==="work"?"work:".concat(t.item.id):"url:".concat(t.info.url);function En({value:t,onChange:s}){const{t:n}=se(),r=a.useMemo(()=>t.flatMap(c=>c.kind==="work"&&c.item.id?[c.item.id]:[]),[t]),l=a.useCallback(c=>{const u=c!=null&&c.url&&!(c!=null&&c.id)?{kind:"url",info:c}:{kind:"work",item:c};t.some(g=>xe(g)===xe(u))||s([...t,u])},[t,s]);return e.jsxs("div",{className:"mt-[15px]",children:[e.jsx("div",{className:"text-[16px] font-[500] mb-[6px]",children:n("clientUI.createPost.addConnectionTitle")}),e.jsx("div",{className:"text-[14px] leading-[1.4] text-[#8a8a8a] mb-[10px]",children:n("clientUI.createPost.addConnectionTip")}),e.jsx(nn,{onAddItem:l,existIds:r,defaultType:2,compact:!0,placeholder:n("clientUI.createPost.addConnectionPlaceholder")}),t.length>0&&e.jsx("div",{className:"mt-[10px] flex flex-col gap-[8px]",children:t.map(c=>e.jsxs("div",{className:"flex items-center gap-[8px] rounded-[10px] bg-[rgba(var(--text-third),0.10)] px-[10px] py-[7px]",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-[14px] text-first",children:c.kind==="work"?c.item.title:c.info.title||c.info.url}),e.jsx("span",{className:"cursor-pointer text-[14px] text-third hover:text-first",onClick:()=>s(t.filter(u=>xe(u)!==xe(c))),children:"×"})]},xe(c)))})]})}async function Rn(t,s){for(const n of s)try{await as(n.kind==="work"?{currWorkId:n.item.id,targetType:0,targetWorkId:t}:{currWorkId:t,targetType:1,tagetUrlInfo:n.info})}catch(r){console.error("[publish] 连接失败",n,r)}}const Ln=t=>a.createElement("svg",w({width:25,height:25,viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),a.createElement("path",{d:"m23.726 7.276-10.405-6.06a1.676 1.676 0 0 0-1.642 0L1.274 7.275A.55.55 0 0 0 1 7.75v14.594c0 .431.167.846.466 1.155.298.31.705.489 1.133.5h19.714a1.633 1.633 0 0 0 1.19-.469A1.655 1.655 0 0 0 24 22.344V7.75a.556.556 0 0 0-.274-.474zm-11.5-5.1a.544.544 0 0 1 .548 0l10 5.817-10 5.818a.545.545 0 0 1-.548 0l-10-5.818 10-5.817zm10.131 20.72H2.643a.556.556 0 0 1-.548-.552V9.185l9.584 5.586a1.643 1.643 0 0 0 1.642 0l9.584-5.586v13.159a.546.546 0 0 1-.548.552z",fill:"#696969",stroke:"#696969"}));function An(){const{data:t,setData:s}=ae(),n=a.useCallback(r=>{if(r.file.status!=="uploading"&&(r.file.status==="done"&&(r.file.response.data?(E.success(o("clientUI.uploadSuccess")+"!"),s(l=>_(w({},l),{coverUrl:r.file.response.data}))):E.error(r.file.response.msg)),r.file.status==="error")){E.error(o("clientUI.toast.fileTypeNotSupported"));return}},[]);return e.jsxs("div",{className:"pb-[25px] border-b border-[#e0e0e0]",children:[e.jsx("div",{className:"text-[#231f20] text-[16px] font-[500]",children:o("clientUI.createPost.coverImage")}),e.jsx("div",{className:"mt-[12px]",children:t.coverUrl?e.jsxs("div",{className:"relative inline-block",children:[e.jsx("img",{src:t.coverUrl,alt:"",className:"block max-h-[120px] w-auto max-w-full rounded-[6px] border border-[#e0e0e0]"}),e.jsx(is,{className:"absolute right-[6px] top-[6px] text-[18px] bg-white rounded-[18px] overflow-hidden text-[#696969] cursor-pointer hover:text-[#333] transition-colors",onClick:()=>{s(r=>_(w({},r),{coverUrl:""}))}})]}):e.jsx(os,{onChange:n,autoFit:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center gap-[6px] rounded-[50px] border border-[#a9a9a9] bg-white px-[16px] py-[7px] text-[14px] text-[#484848] cursor-pointer hover:border-[#484848] transition-colors",children:o("clientUI.createPost.UploadCover")})})})]})}function On(){var y;const{data:t,setData:s}=ae(),[n,r]=a.useState(!1),[l,c]=a.useState(!0),u=a.useRef(null);a.useEffect(()=>{const f=()=>{var h;c(!0),(h=u.current)==null||h.scrollIntoView({behavior:"smooth",block:"center"})};return ls("openRatingSection",f),()=>cs("openRatingSection",f)},[]);const g=a.useCallback(f=>
2{s(h=>_(w({},h),{accessLevel:f.target.value})),f.preventDefault()},[]),m=a.useCallback((f,h)=>{s(N=>_(w({},N),{emails:f,readers:h}))},[]);a.useEffect(()=>{s(f=>_(w({},f),{lockState:0,unlockPrice:0}))},[]);const S=a.useMemo(()=>{switch(t.rating){case 0:return o("clientUI.rating.allLabel");case 1:return o("clientUI.rating.teenLabel");case 2:return o("clientUI.rating.explicitLabel");case-1:return o("clientUI.rating.notRatedLabel");default:return o("clientUI.rating.notSelected")}},[t.rating]),b=a.useCallback(f=>{const h=f.target.value;s(N=>h===2?_(w({},N),{rating:h,isSensitiveCover:!0}):_(w({},N),{rating:h}))},[]);return e.jsxs("div",{className:"text-[#231f20] leading-[23px] ",children:[e.jsx("div",{className:"label-required text-[16px] font-[500]",children:o("clientUI.createPost.Visibility")}),e.jsx("div",{className:"mt-[12px]",children:e.jsxs("div",{className:"text-[#696969] text-[14px]",children:[e.jsx(z.Group,{onChange:g,value:t.accessLevel,children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx(z,{value:0,children:e.jsx("div",{className:"text-[#231f20] text-[14px]",children:o("clientUI.createPost.Public")})}),e.jsx("div",{className:"text-[#696969] text-[14px] ml-[24px] mt-[5px]",children:o("clientUI.createPost.EveryoneCanView")}),e.jsxs("div",{className:"mt-[10px]",children:[e.jsx(z,{value:20,children:e.jsx("div",{className:"text-[#231f20] text-[14px]",children:o("clientUI.createPost.Private")})}),e.jsx(Qs,{title:o("clientUI.createPost.OnlyPeopleYouChooseCanView"),children:e.jsx(mn,{className:"text-[14px]"})})]})]})}),e.jsxs("div",{ref:u,className:"mt-[15px] pt-[15px] border-t border-[#e0e0e0]",children:[e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-[10px]",onClick:()=>c(f=>!f),children:[e.jsx("div",{className:"label-required text-[#231f20] text-[16px] font-[500]",children:o("clientUI.rating.title")}),e.jsxs("div",{className:"flex items-center gap-[10px] text-[14px] text-[#696969]",children:[!l&&e.jsx("span",{children:S}),l?e.jsx(At,{className:"text-[12px]"}):e.jsx(Ot,{className:"text-[12px]"})]})]}),e.jsx(z.Group,{className:l?"mt-[12px] block":"hidden",value:t.rating,onChange:b,children:e.jsxs("div",{className:"flex flex-col gap-[10px]",children:[e.jsxs("div",{children:[e.jsx(z,{value:0,children:e.jsxs("div",{className:"text-[#231f20] text-[14px] flex items-center gap-[5px]",children:[e.jsx("div",{className:"w-0 h-0 border-l-[8px] border-l-transparent border-b-[12px] border-b-green-500 border-r-[8px] border-r-transparent"}),o("clientUI.rating.allLabel")]})}),e.jsx("div",{className:"text-[#696969] text-[14px] ml-[24px]",children:o("clientUI.rating.allDesc")})]}),e.jsxs("div",{children:[e.jsx(z,{value:1,children:e.jsxs("div",{className:"text-[#231f20] text-[14px] flex items-center gap-[5px]",children:[e.jsx("div",{className:"w-0 h-0 border-l-[8px] border-l-transparent border-b-[12px] border-b-orange-500 border-r-[8px] border-r-transparent"}),o("clientUI.rating.teenLabel")]})}),e.jsx("div",{className:"text-[#696969] text-[14px] ml-[24px]",children:o("clientUI.rating.teenDesc")})]}),e.jsxs("div",{children:[e.jsx(z,{value:2,children:e.jsxs("div",{className:"text-[#231f20] text-[14px] flex items-center gap-[5px]",children:[e.jsx("div",{className:"w-0 h-0 border-l-[8px] border-l-transparent border-b-[12px] border-b-red-500 border-r-[8px] border-r-transparent"}),o("clientUI.rating.explicitLabel")]})}),e.jsx("div",{className:"text-[#696969] text-[14px] ml-[24px]",children:o("clientUI.rating.explicitDesc")})]}),e.jsx("div",{children:e.jsxs("div",{className:"text-[#231f20] text-[14px] ml-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-[10px]",children:[e.jsx("div",{children:o("clientUI.rating.sensitive")}),e.jsx(Lt,{checked:(y=t.isSensitiveCover)!=null?y:!1,onChange:f=>{s(h=>_(w({},h),{isSensitiveCover:f}))}})]}),e.jsxs("div",{className:"text-[#696969] text-[14px]",children:[" ",o("clientUI.rating.sensitiveDesc")]})]})}),e.jsxs("div",{children:[e.jsx(z,{value:-1,children:e.jsxs("div",{className:"text-[#231f20] text-[14px] flex items-center gap-[5px]",children:[e.jsx("div",{className:"w-0 h-0 border-l-[8px] border-l-transparent border-b-[12px] border-b-gray-400 border-r-[8px] border-r-transparent"}),o("clientUI.rating.notRatedLabel")]})}),e.jsx("div",{className:"text-[#696969] text-[14px] ml-[24px]",children:o("clientUI.rating.notRatedDesc")})]})]})})]})]})}),e.jsx(Oe,{open:n,handleCancelCallback:()=>{r(!1)},children:e.jsx(rn,{opus:t,close:()=>{r(!1)},dataCallBack:(f,h)=>{m(f,h)}})})]})}
2const Dn="_headerActions_dl75u_21",Mn="_previewModal_dl75u_57",Fn="_translationNotesInput_dl75u_95",zn="_publishAction_dl75u_98",$n="_presetBar_dl75u_104",Gn="_publishModal_dl75u_153",Bn="_publishContent_dl75u_207",Yn="_presetSelect_dl75u_230",Hn="_presetDropdown_dl75u_237",B={"header-container":"_header-container_dl75u_1",headerActions:Dn,"publish-btn":"_publish-btn_dl75u_27","preview-btn":"_preview-btn_dl75u_35",previewModal:Mn,translationNotesInput:Fn,publishAction:zn,presetBar:$n,publishModal:Gn,publishContent:Bn,presetSelect:Yn,presetDropdown:Hn},qn="_field_1vw62_1",Vn="_text_1vw62_15",Jn="_placeholder_1vw62_22",Wn="_icon_1vw62_25",Xn="_native_1vw62_31",me={field:qn,text:Vn,placeholder:Jn,icon:Wn,native:Xn},Zn={date:"YYYY-MM-DD",time:"HH:mm"},Kn=(t,s)=>s?s.format(Zn[t]):"",Qn=(t,s)=>{if(!s)return null;if(t==="date"){const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s);return r?K(new Date(Number(r[1]),Number(r[2])-1,Number(r[3]))):null}const n=/^(\d{2}):(\d{2})/.exec(s);return n?K().hour(Number(n[1])).minute(Number(n[2])).second(0).millisecond(0):null},er=t=>{var n;if(typeof window>"u"||!window.matchMedia("(pointer: fine)").matches)return;const s=t.currentTarget;try{(n=s.showPicker)==null||n.call(s)}catch(r){}};function jt(t){const{mode:s,value:n,onChange:r,placeholder:l,min:c,className:u}=t,g=Kn(s,n),m=s==="date"?pn:ds;return e.jsxs("div",{className:De(me.field,u),children:[e.jsx("span",{className:De(me.text,!g&&me.placeholder),children:g||l}),e.jsx(m,{className:me.icon}),e.jsx("input",{className:me.native,type:s,value:g,min:c,"aria-label":l,onClick:er,onChange:S=>r(Qn(s,S.target.value))})]})}const tr="_section_mo7yl_1",sr="_search_mo7yl_7",nr="_list_mo7yl_23",rr="_row_mo7yl_27",ar="_toggle_mo7yl_36",ir="_selected_mo7yl_52",or="_more_mo7yl_57",te={section:tr,search:sr,list:nr,row:rr,toggle:ar,selected:ir,more:or},lr=4;function cr({uuid:t,value:s,onChange:n}){const{t:r}=se(),[l,c]=a.useState(""),[u,g]=a.useState(""),[m,S]=a.useState(!1),b=a.useRef(null),{data:y,error:f,total:h,size:N,setSize:U,isValidating:x}=on({pageSize:t?lr:0,keyword:u,uuid:t});a.useEffect(()=>{const p=window.setTimeout(()=>g(l.trim()),400);return()=>window.clearTimeout(p)},[l]),a.useEffect(()=>{U(1)},[u,U,t]),a.useEffect(()=>{const p=T=>{var O;(O=b.current)!=null&&O.contains(T.target)||S(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const k=a.useMemo(()=>y?[].concat(...y):[],[y]),j=a.useMemo(()=>new Set(s),[s]),L=k.length<h,i=p=>{p&&n(j.has(p)?s.filter(T=>T!==p):[...s,p])};return e.jsxs("section",{className:te.section,ref:b,children:[e.jsxs("div",{className:"flex items-start justify-between gap-[12px]",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-first text-[16px] font-[500]",children:r("clientUI.createPost.submitSpaces")}),e.jsx("div",{className:"mt-[4px] text-[13px] leading-[1.4] text-[#8a8a8a]",children:r("clientUI.createPost.submitSpacesTip")})]}),s.length>0&&e.jsx("span",{className:"shrink-0 text-[13px] text-[#696969]",children:r("clientUI.createPost.submitSpacesCount",{count:s.length})})]}),e.jsx(ge,{className:te.search,value:l,allowClear:!0,placeholder:r("clientUI.curatorCenter.searchSpaceName"),prefix:e.jsx(us,{className:"h-[16px] w-[16px] text-first"}),onFocus:()=>S(!0),onKeyDown:p=>{p.key==="Escape"&&(S(!1),p.currentTarget.blur())},onChange:p=>c(p.target.value)}),m&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:te.list,children:[k.map(p=>e.jsx(dr,{item:p,selected:p.id!=null&&j.has(p.id),onToggle:()=>i(p.id)},p.id)),x&&k.length===0&&e.jsx("div",{className:"flex h-[96px] items-center justify-center text-[#696969]",children:e.jsx(Me,{})}),!x&&k.length===0&&e.jsx("div",{className:"flex min-h-[72px] items-center justify-center px-[16px] text-center text-[14px] text-[#8a8a8a]",children:r(f?"clientUI.createPost.submitSpacesLoadFailed":"clientUI.createPost.submitSpacesEmpty")})]}),L&&e.jsx("button",{type:"button",className:te.more,"aria-label":r("clientUI.showBatch"),title:r("clientUI.showBatch"),disabled:x,onClick:()=>U(N+1),children:e.jsx(ln,{className:x?"fa-spin":""})})]})]})}function dr({item:t,selected:s,onToggle:n}){var l,c;const{t:r}=se();return e.jsxs("div",{className:te.row,children:[e.jsxs("div",{className:"flex min-w-0 items-center",children:[e.jsx("div",{className:"shrink-0",children:ps(t.logoUrl,t.title,42,"text-[24px]")}),e.jsxs("div",{className:"ml-[12px] min-w-0",children:[e.jsx("div",{className:"line-clamp-1 text-[16px] font-[500] leading-[21px] text-first",children:t.title}),e.jsxs("div",{className:"mt-[6px] flex items-center text-[13px] text-[#696969]",children:[e.jsx(cn,{className:"mr-[4px] h-[14px] w-[16px]"}),e.jsx("span",{children:(l=t.userCount)!=null?l:0}),e.jsx("span",{className:"w-[14px]"}),e.jsx(dn,{className:"mr-[4px] h-[14px] w-[13px]"}),e.jsx("span",{children:(c=t.downstreamCount)!=null?c:0})]})]})]}),e.jsxs("button",{type:"button",className:De(te.toggle,s&&te.selected),"aria-pressed":s,onClick:n,children:[s?e.jsx(xs,{}):e.jsx(ms,{}
2),e.jsx("span",{children:r(s?"clientUI.createPost.submitSpacesChosen":"clientUI.curatorCenter.submit")})]})]})}function Ct(){return he.get("/client/user/publishTemplate/list")}function Ne(t){return he.post("/client/user/publishTemplate/save",t)}function ur(t){return he.post("/client/user/publishTemplate/delete",{id:t})}const Nt="copus:publish-defaults:",pr="last",xr=10,zt=20,wt={presets:[]};function Ie(t){return t!=null&&t!==""}function mr(t){try{const s=JSON.parse(t);return s&&typeof s=="object"?s:null}catch(s){return null}}function It(t){const s={presets:[]};return t.forEach(n=>{const r=mr(n.fields);if(!r)return;const l=n.updateTime&&Date.parse(n.updateTime)||0;if(!n.name){s.last=r;return}s.presets.push({id:String(n.id),name:n.name,fields:r,at:l})}),s}async function fr(t,s){var r;if(!s)return!1;let n=null;try{n=window.localStorage.getItem(Nt+t)}catch(l){return!1}if(!n)return!1;try{const l=JSON.parse(n),c=[];if(((r=l.presets)!=null?r:[]).forEach(u=>{!(u!=null&&u.name)||!(u!=null&&u.fields)||c.push(Ne({name:u.name,fields:JSON.stringify(u.fields)}))}),l.last&&c.push(Ne({name:"",fields:JSON.stringify(l.last)})),!c.length)return!1;await Promise.all(c);try{window.localStorage.removeItem(Nt+t)}catch(u){}return!0}catch(l){return!1}}async function hr(t){var s,n,r;if(!Ie(t))return w({},wt);try{const{data:l}=await Ct(),c=(s=l==null?void 0:l.data)!=null?s:[];if(await fr(t,c.length===0)){const g=await Ct();return It((r=(n=g.data)==null?void 0:n.data)!=null?r:[])}return It(c)}catch(l){return w({},wt)}}async function gr(t,s){if(Ie(t))try{await Ne({name:"",fields:JSON.stringify(s)})}catch(n){}}async function vr(t,s,n){if(!Ie(t))return!1;const r=s.trim().slice(0,zt);if(!r)return!1;try{const{data:l}=await Ne({name:r,fields:JSON.stringify(n)});return!!(l!=null&&l.status)}catch(l){return!1}}async function br(t,s){if(!Ie(t))return;const n=Number(s);if(n)try{await ur(n)}catch(r){}}function yr(t){const s=[];return t.last&&s.push({id:pr,fields:t.last,at:0}),s.concat(t.presets)}function St(t){var n,r,l,c,u,g,m;const s=Fe("tagsRetired");return{topics:s?[]:(n=t.topics)!=null?n:[],tagList:s?[]:(r=t.tagList)!=null?r:[],connectionIntent:(l=t.connectionIntent)!=null?l:"",accessLevel:(c=t.accessLevel)!=null?c:0,rating:(u=t.rating)!=null?u:-1,isSensitiveCover:(g=t.isSensitiveCover)!=null?g:!1,coverUrl:(m=t.coverUrl)!=null?m:""}}function jr(t,s,n){var g,m,S,b;const r=[],l=w({},t),c=Fe("tagsRetired"),u=c?[]:((g=s.topics)!=null?g:[]).filter(y=>!n||n.has(y.id));return u.length&&(l.topics=u,r.push("topics")),!c&&((m=s.tagList)!=null&&m.length)&&(l.tagList=s.tagList,r.push("tagList")),(S=s.connectionIntent)!=null&&S.trim()&&(l.connectionIntent=s.connectionIntent,r.push("connectionIntent")),s.accessLevel!==void 0&&(l.accessLevel=s.accessLevel,r.push("accessLevel")),s.rating!==void 0&&(l.rating=s.rating,r.push("rating"),l.isSensitiveCover=s.rating===2?!0:(b=s.isSensitiveCover)!=null?b:!1),s.coverUrl&&(l.coverUrl=s.coverUrl,r.push("coverUrl")),{next:l,applied:r}}async function Cr(t,s,n){const r=new Set(t),l=new Set(s),c=[...[...r].filter(g=>!l.has(g)),...[...l].filter(g=>!r.has(g))];let u=!0;for(const g of c)try{if(!await n(g)){u=!1;continue}l.has(g)?r.add(g):r.delete(g)}catch(m){u=!1}return{success:u,confirmedIds:[...r]}}async function Nr(t,s,n=[]){const r=await Cr(n,s,async l=>{const c=await vs({opusId:t,tagId:l});return c.data.status===1&&c.data.data===!0});return Rt(),r}function wr({value:t,onChange:s,disabled:n=!1}){const{t:r}=se(),{data:l,isLoading:c,mutate:u}=fs(),[g,m]=a.useState(!1),[S,b]=a.useState(!1),[y,f]=a.useState(""),[h,N]=a.useState(Ae[0].color),U=a.useMemo(()=>(l!=null?l:[]).filter(i=>!i.isDeleted),[l]),x=a.useMemo(()=>new Set(t),[t]),k=i=>{if(!n){if(!x.has(i)&&x.size>=ce){E.info(r("clientUI.createPost.tagLimit",{count:ce}));return}s(x.has(i)?t.filter(p=>p!==i):[...t,i])}},j=()=>{m(!1),f(""),N(Ae[0].color)},L=async()=>{const i=y.trim();if(!(!i||S||n)){if(x.size>=ce){E.info(r("clientUI.createPost.tagLimit",{count:ce}));return}try{b(!0);const p=await gs({tag:i,tagColor:h}),T=p.data.data;if(!p.data.status||!(T!=null&&T.id))return;await u(O=>[...(O!=null?O:[]).filter(H=>H.id!==T.id),T],{revalidate:!1}),s(Array.from(new Set([...t,T.id]))),Rt(),E.success(r("clientUI.success")),j()}catch(p){E.error(p.message)}finally{b(!1)}}};return e.jsxs("section",{className:"mt-[18px] border-b border-[#e0e0e0] pb-[18px]","aria-labelledby":"publish-profile-tags-title",children:[e.jsxs("div",{id:"publish-profile-tags-title",className:"text-[16px] font-[500] mb-[6px]",children:[r("clientUI.createPost.profileTags"),e.jsxs("span",{className:"ml-[8px] text-[13px] text-secondV2",children:[x.size,"/",ce]})]}),e.jsx("div",{className:"text-[13px] leading-[1.4] text-[#8a8a8a] mb-[10px]",children:r("clientUI.createPost.profileTagsTip")}),c?e.jsx(we,{size:"small"}):U.length>0?e.jsx("div",{className:"flex flex-wrap gap-[10px]",children:U.map(i=>e.jsx("div",{role:"button",tabIndex:0,"aria-pressed":x.has(i.id),onClick:()=>k(i.id),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),k(i.id))},children:hs(i,void 0,!x.has(i.id))},i.id))}):e.jsx("div",{className:"text-[14px] leading-[1.5] text-secondV2",children:r("clientUI.curatorCenter.profileTagEmpty")}),g?e.jsxs("div",{className:"mt-[12px] rounded-[10px] border border-borderColor p-[14px]",children:[e.jsx("label",{htmlFor:"publish-new-profile-tag",className:"mb-[6px] block text-[14px] font-[500] text-first",children:r("clientUI.spaceSetting.tagSetting.tagName")}
2),e.jsx(ge,{id:"publish-new-profile-tag",autoFocus:!0,value:y,maxLength:an,showCount:!0,onChange:i=>f(i.target.value),onPressEnter:L}),e.jsx("div",{className:"mb-[7px] mt-[14px] text-[14px] font-[500] text-first",children:r("clientUI.spaceSetting.tagSetting.tagColor")}),e.jsx("div",{className:"flex flex-wrap gap-[9px]",role:"radiogroup","aria-label":r("clientUI.spaceSetting.tagSetting.tagColor"),children:Ae.map(({color:i})=>{const p=i===h;return e.jsx("button",{type:"button",role:"radio","aria-label":i,"aria-checked":p,className:"h-[28px] w-[28px] rounded-full border-[3px]",style:{backgroundColor:i,borderColor:p?"rgb(var(--text-first))":"transparent",boxShadow:p?"0 0 0 2px ".concat(i):void 0},onClick:()=>N(i)},i)})}),e.jsxs("div",{className:"mt-[16px] flex gap-[10px]",children:[e.jsx(J,{type:"primary",shape:"round",loading:S,disabled:!y.trim(),onClick:L,children:r("clientUI.spaceSetting.tagSetting.create")}),e.jsx(J,{shape:"round",disabled:S,onClick:j,children:r("clientUI.cancel")})]})]}):e.jsxs("button",{type:"button",className:"mt-[12px] rounded-full border border-borderColor px-[14px] py-[7px] text-[14px] font-[500] text-first",onClick:()=>m(!0),children:["+ ",r("clientUI.spaceSetting.tagSetting.addTag")]})]})}const Ir="_preview_1xca9_1",Sr="_cover_1xca9_8",Pr="_title_1xca9_11",Ur="_subtitle_1xca9_18",kr="_divider_1xca9_24",Tr="_content_1xca9_28",_r="_loading_1xca9_40",ee={preview:Ir,cover:Sr,title:Pr,subtitle:Ur,divider:kr,content:Tr,loading:_r},Er=a.lazy(()=>_t(()=>import("./index-CGeHaFxe.js").then(t=>t.y),__vite__mapDeps([0,1,2,3,4,5])));function Rr(){const{data:t}=ae(),{i18n:s}=se(),n=a.useMemo(()=>{const r=qs(fe(Vs(t.content||"")));return Js(r.content)},[t.content]);return e.jsxs("article",{className:ee.preview,children:[t.coverUrl&&e.jsx("div",{className:ee.cover,children:e.jsx(bs,{src:t.coverUrl,aspectRatio:0,natural:!0})}),e.jsx("h1",{className:ee.title,children:t.title}),t.subTitle&&e.jsx("div",{className:ee.subtitle,children:t.subTitle}),e.jsx(en,{className:ee.divider}),e.jsx("div",{className:ee.content,translate:"no",children:e.jsx(a.Suspense,{fallback:e.jsx("div",{className:ee.loading}),children:e.jsx(Er,{locale:s.language,readOnly:!0,initialValue:n,copus:{opusUuid:t.uuid}},t.content)})})]})}const{TextArea:Pt}=ge,Lr=100,Ut=300;function Ar(t){var Xe,Ze,Ke,Qe,et,tt,st,nt,rt,at,it;const{spaceId:s,initialProfileTagIds:n,profileTagsError:r,onRetryProfileTags:l}=t,c=Fe("tagsRetired"),[u,g]=a.useState(!1),[m,S]=a.useState(),[b,y]=a.useState([]),[f,h]=a.useState("now"),[N,U]=a.useState(null),[x,k]=a.useState(null),j=a.useMemo(()=>N&&x?N.hour(x.hour()).minute(x.minute()).second(0).millisecond(0):null,[N,x]),L=d=>{U(d),k(d)},{data:i,setData:p}=ae(),T=(m==null?void 0:m.uuid)===i.uuid?m:void 0,O=(Ze=(Xe=T==null?void 0:T.selected)!=null?Xe:n)!=null?Ze:[],Y=(Qe=(Ke=T==null?void 0:T.previous)!=null?Ke:n)!=null?Qe:[],H=n!==void 0,F=d=>S({uuid:i.uuid,selected:d,previous:Y}),q=!!(i.translationNotesEditableAt&&i.translationNotesEditableAt>Date.now()),{data:M}=ys();a.useEffect(()=>{if(i.scheduledPublishAt){h("scheduled");const d=K(i.scheduledPublishAt);U(d),k(d)}},[i.scheduledPublishAt]);const[W,ne]=a.useState(!1),[Se,ie]=a.useState(!1),[v,I]=a.useState(!1),C=M==null?void 0:M.id,[A,X]=a.useState([]),[V,Pe]=a.useState(""),[$t,Ue]=a.useState(!1),[ke,ve]=a.useState(""),Te=a.useRef(i);a.useEffect(()=>{Te.current=i},[i]);const _e=a.useCallback(d=>d.name||o("clientUI.createPost.presetLastPublish"),[]),re=a.useCallback(async()=>{const d=await hr(C);return X(yr(d)),d},[C]);a.useEffect(()=>{re()},[re]);const ze=a.useCallback(async d=>{var G;let P;if((G=d.fields.topics)!=null&&G.length)try{const Q=await js({topicId:0});P=new Set(Q.map(Jt=>Jt.id))}catch(Q){}const $=Te.current,{next:R,applied:D}=jr($,d.fields,P);return D.length?(p(R),!0):!1},[p]),Gt=a.useCallback(async d=>{Pe(d);const P=A.find(R=>R.id===d);if(!P)return;await ze(P)&&E.success(o("clientUI.createPost.presetApplied",{name:_e(P)}))},[ze,_e,A]),$e=a.useCallback(async()=>{const d=ke.trim();if(!d){E.error(o("clientUI.createPost.presetNameRequired"));return}if(!await vr(C,d,St(Te.current))){E.error(o("clientUI.createPost.presetLimitReached",{count:xr}));return}const R=(await re()).presets.find(D=>D.name===d);R&&Pe(R.id),Ue(!1),ve(""),E.success(o("clientUI.createPost.presetSaved",{name:d}))},[C,ke,re]),Bt=a.useCallback(async()=>{const d=A.find(P=>P.id===V);!d||!d.name||(await br(C,d.id),await re(),Pe(""),E.success(o("clientUI.createPost.presetDeleted",{name:d.name})))},[V,C,A,re]),Ge=a.useCallback(()=>{var P,$;
2if(be(i.content)||be(i.contentPublic))return o(Ws()?"clientUI.startCreating.mediaUploadPending":"clientUI.startCreating.mediaReuploadRequired");let d="";if(i.opusType===Z)try{const R=JSON.parse(i.content||"");if(!(R!=null&&R.workId)||!(R!=null&&R.entryUrl))return"请先上传游戏 ZIP";d=String(i.subTitle||R.instructions||"").substring(0,140)}catch(R){return"请先上传游戏 ZIP"}else try{const R={root:JSON.parse(i.content).root};d=(dt(R)||"").substring(0,140)}catch(R){console.error("[publish] 正文解析失败,摘要留空",R)}return i.contentPrefix=d,(P=i==null?void 0:i.title)!=null&&P.trim()?!c&&(!(i!=null&&i.topics)||(($=i.topics)==null?void 0:$.length)===0)?o("clientUI.startCreating.topicErrorMsg"):i.rating===void 0||i.rating===null?o("clientUI.submitLink.ratingRequired"):null:o("clientUI.startCreating.titleErrorMsg")},[i]),[Ee,Re]=a.useState(!1),Be=a.useCallback(async()=>{var P;const d=Ge();if(d){E.error(d);return}if(i.rating===-1&&!Ee){Re(!0);return}if(Re(!1),Le.current=!0,le.cancel(),f==="scheduled"){if(!N||!x){E.error(o("clientUI.createPost.scheduleIncomplete"));return}if(!j||j.valueOf()<=Date.now()+3e4){E.error(o("clientUI.createPost.scheduleFutureError"));return}}try{g(!0);const R=await(f==="scheduled"?Cs:Ns)(_(w({},i),{scheduledPublishAt:f==="scheduled"?j.valueOf():void 0}),s);if(R.data.status===1){const D=R.data.data;if(ws(),gr(C,St(i)),D.id&&H){const G=await Nr(D.id,O,Y);S({uuid:i.uuid,selected:O,previous:G.confirmedIds}),G.success||E.error(o("clientUI.createPost.profileTagsFailed"))}if(D.scheduledPublishAt){E.success(o("clientUI.createPost.scheduledSuccess",{time:K(D.scheduledPublishAt).format("YYYY-MM-DD HH:mm")})),ne(!1),ut.replace("/creatorCenter?postTab=drafts");return}if(D.id&&((P=i.submitSpaceIds)!=null&&P.length))try{const G=await Is({opusIds:[D.id],spaceIds:i.submitSpaceIds});(G.data.status!==1||G.data.data!==!0)&&E.error(o("clientUI.createPost.submitSpacesFailed"))}catch(G){E.error(o("clientUI.createPost.submitSpacesFailed"))}if(D.id&&b.length>0&&await Rn(D.id,b),D.uuid){sessionStorage.setItem("copus:published-opus-back-home",D.uuid);const G=new URLSearchParams(window.location.search).get("cburl");ut.replace(Ss({uuid:D.uuid,opusId:D.id,callbackUrl:G}))}}}catch($){E.error($.message,5),g(!1),Le.current=!1}finally{g(!1)}},[i,s,Ee,Ge,f,j,N,x,b,C,O,Y,H]),[Ye,Yt]=a.useState(!1),[He,qe]=a.useState(!1),[Ve,Je]=a.useState(!1),Le=a.useRef(!1),oe=a.useCallback(async d=>{var $,R,D,G;if(Le.current||be(d.content)||be(d.contentPublic))return;let P=!1;try{const Q=JSON.parse(d.content);P=!!(($=dt({root:Q.root}))!=null&&$.trim())}catch(Q){P=!!((R=d.content)!=null&&R.trim())}if(!(!((D=d==null?void 0:d.title)!=null&&D.trim())&&!P)){Yt(!0),qe(!0),Je(!1);try{await Ps(_(w({},d),{title:((G=d.title)==null?void 0:G.trim())||""}))}catch(Q){console.error("❌ Save draft failed",Q),Je(!0)}finally{qe(!1)}}},[]),le=a.useMemo(()=>Us(oe,5e3),[oe]),Ht=a.useRef(Date.now());a.useEffect(()=>{Date.now()<Ht.current+3e3||le(i)},[i,le]),a.useEffect(()=>()=>{le.cancel()},[le]);const qt=a.useMemo(()=>Ye?He?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2",children:e.jsx("i",{className:"fa fa-circle-o-notch fa-spin "})}),o("clientUI.saving")]}):Ve?e.jsx("span",{className:"text-[#F23A00] cursor-pointer",onClick:()=>oe(i),children:o("clientUI.saveFailed")}):e.jsxs("span",{children:[o("clientUI.savedTo"),e.jsx(pt,{href:"/creatorCenter?postTab=drafts",className:"underline text-inherit hover:text-inherit",children:o("clientUI.creatorCenter.name")})]}):null,[Ye,He,Ve,i,oe]),We=(d=!1)=>e.jsxs("div",{className:"mt-[15px] pt-[15px] border-t border-[#e0e0e0]",children:[e.jsx("div",{className:"text-first text-[16px] font-[500] mb-[10px]",children:o("clientUI.createPost.publishTiming")}),e.jsx(z.Group,{value:f,onChange:P=>h(P.target.value),children:e.jsxs("div",{className:"flex flex-col gap-[12px] text-first",children:[e.jsx(z,{value:"now",children:o("clientUI.createPost.publishImmediately")}),e.jsx(z,{value:"scheduled",children:o("clientUI.createPost.schedulePublish")})]})}),f==="scheduled"&&e.jsxs("div",{className:"ml-[24px] mt-[12px]",children:[d?e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_110px] gap-[8px]",children:[e.jsx(jt,{mode:"date",value:N,onChange:U,min:K().format("YYYY-MM-DD"),placeholder:o("clientUI.createPost.choosePublishDate")}),e.jsx(jt,{mode:"time",value:x,onChange:k,placeholder:o("clientUI.createPost.choosePublishClock")})]}):e.jsx(sn,{className:"w-full",value:j,onChange:L,showTime:{format:"HH:mm"},format:"YYYY-MM-DD HH:mm",disabledDate:P=>P.endOf("day").isBefore(K()),placeholder:o("clientUI.createPost.choosePublishTime"),inputReadOnly:!0,allowClear:!1}),e.jsx("div",{className:"text-secondV2 text-[14px] mt-[8px]",children:o("clientUI.createPost.currentTimezone",{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,offset:K().format("Z")})})]})]}),Vt=C?$t?e.jsxs("div",{className:B.presetBar,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-[10px]",children:[e.jsx(ge,{value:ke,onChange:d=>ve(d.target.value),onPressEnter:$e,placeholder:o("clientUI.createPost.presetNamePlaceholder"),maxLength:zt,className:"h-[36px] w-[240px] sm:w-full",autoFocus:!0}),e.jsx(J,{className:"h-[36px]",type:"primary",onClick:$e,children:o("clientUI.createPost.presetSave")}),e.jsx(J,{className:"h-[36px]",onClick:()=>{Ue(!1),ve("")},children:o("clientUI.createPost.presetCancel")})]}),e.jsx("div",{className:"mt-[6px] text-right text-[14px] leading-[1.4] text-[#8a8a8a]",children:o("clientUI.createPost.presetTip")})]}):e.jsxs("div",{className:"".concat(B.presetBar," flex flex-wrap items-center gap-[10px] text-[13px]"),children:[e.jsx("span",{className:"text-[#8a8a8a]",children:o("clientUI.createPost.presetLabel")}),A.length>0&&e.jsx(tn,{value:V,onChange:Gt,className:B.presetSelect,size:"small",placement:ks?"topLeft":"bottomLeft",getPopupContainer:d=>d.parentElement||document.body,popupClassName:B.presetDropdown,options:[{value:"",label:o("clientUI.createPost.presetNone")},...A.map(d=>({value:d.id,label:_e(d)}))]}),e.jsx("span",{className:"cursor-pointer text-five underline",onClick:()=>{var P;const d=A.find($=>
2$.id===V);ve((P=d==null?void 0:d.name)!=null?P:""),Ue(!0)},children:o("clientUI.createPost.presetSaveAs")}),((et=A.find(d=>d.id===V))==null?void 0:et.name)&&e.jsx("span",{className:"cursor-pointer text-[#8a8a8a] underline",onClick:Bt,children:o("clientUI.createPost.presetDelete")})]}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:B["header-container"],children:[e.jsx(pt,{className:"logo sm:hidden",href:"/user/".concat(M==null?void 0:M.namespace),children:e.jsx(Ts,{width:40,height:40})}),e.jsxs("div",{className:"relative flex justify-center items-center gap-[30px] ".concat(B.headerActions),children:[e.jsx("div",{className:"text-[16px] text-[#696969]",children:e.jsxs("div",{className:"text-first flex",children:[qt,e.jsx(Ln,{className:"w-[23px] h-[23px] ml-[15px] cursor-pointer",onClick:()=>{oe(i)}})]})}),e.jsxs("div",{className:"flex items-center gap-[10px]",children:[i.opusType!==Z&&e.jsx(J,{className:B["preview-btn"],onClick:()=>ie(!0),children:o("clientUI.createPost.Preview")}),e.jsx(J,{type:"primary",className:B["publish-btn"],onClick:()=>{ne(!0)},children:o("clientUI.next")})]})]})]}),e.jsx(Oe,{open:Se,width:900,title:o("clientUI.createPost.Preview"),className:B.previewModal,handleCancelCallback:()=>ie(!1),children:i.opusType!==Z&&e.jsx(Rr,{})}),e.jsxs(Oe,{title:"",open:W,width:960,mobileFullscreen:!0,className:B.publishModal,handleCancelCallback:()=>ne(!1),children:[e.jsxs("div",{className:"grid grid-cols-2 mt-[12px] gap-x-[40px] sm:grid-cols-1 sm:px-[20px] sm:pt-[20px] sm:gap-y-[30px] ".concat(B.publishContent),children:[e.jsxs("div",{className:"w-full",children:[e.jsx(An,{}),!c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"label-required text-[20px] font-[500] my-[15px]",children:o("clientUI.createPost.AddTopics")}),e.jsx(_s,{value:i.topics,onChange:d=>{p(_(w({},i),{topics:d}))}}),e.jsx("div",{className:"text-[20px] font-[500] mt-[15px] mb-[6px]",children:o("clientUI.createPost.AddTags")}),e.jsx("div",{className:"text-[13px] leading-[1.4] text-[#8a8a8a] mb-[10px]",children:o("clientUI.createPost.tagWarning")}),e.jsx(Es,{value:i.tagList,onChange:d=>{p(_(w({},i),{tagList:d}))}})]}),e.jsx(we,{spinning:!H&&!r,children:e.jsx("fieldset",{disabled:!H,className:"m-0 min-w-0 border-0 p-0",children:e.jsx(wr,{value:O,onChange:F,disabled:!H})})}),r&&e.jsxs("div",{role:"alert",className:"text-[13px] text-secondV2",children:[o("clientUI.createPost.profileTagsLoadFailed"),e.jsx(J,{type:"link",onClick:l,children:o("clientUI.retry")})]}),e.jsx(En,{value:b,onChange:y}),e.jsx("div",{className:"text-[16px] font-[500] mt-[15px] mb-[6px]",children:o("clientUI.createPost.connectionIntent")}),e.jsx("div",{className:"text-[14px] leading-[1.4] text-[#8a8a8a] mb-[10px]",children:o("clientUI.createPost.connectionIntentTip")}),e.jsx(Pt,{value:(tt=i.connectionIntent)!=null?tt:"",onChange:d=>{p(_(w({},i),{connectionIntent:d.target.value}))},placeholder:o("clientUI.createPost.connectionIntentPlaceholder"),maxLength:Lr,showCount:!0,autoSize:{minRows:2,maxRows:4}}),e.jsxs("div",{className:"mt-[30px] pt-[15px] border-t border-[#e0e0e0]",children:[e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-[16px]",onClick:()=>I(d=>!d),children:[e.jsx("div",{className:"text-[16px] font-[500]",children:o("clientUI.multilingual.label")}),e.jsxs("div",{className:"flex items-center gap-[10px]",children:[e.jsx("span",{onClick:d=>d.stopPropagation(),children:e.jsx(Lt,{checked:(st=i.isMultilingual)!=null?st:!0,onChange:d=>p(_(w({},i),{isMultilingual:d}))})}),v?e.jsx(At,{className:"text-[12px] text-[#696969]"}):e.jsx(Ot,{className:"text-[12px] text-[#696969]"})]})]}),v&&e.jsx("div",{className:"text-[14px] leading-[1.4] text-[#8a8a8a] mt-[8px]",children:o("clientUI.multilingual.publishDesc")}),v&&((nt=i.isMultilingual)!=null?nt:!0)&&e.jsxs("div",{className:"mt-[12px]",children:[e.jsx("div",{className:"text-[14px] font-[500] mb-[5px]",children:o("clientUI.multilingual.translationNotes")}),e.jsx("div",{className:"text-[14px] leading-[1.4] text-[#8a8a8a] mb-[8px]",children:o("clientUI.multilingual.translationNotesTip")}),e.jsx(Pt,{className:B.translationNotesInput,value:(rt=i.translationNotes)!=null?rt:"",onChange:d=>{const P=Array.from(d.target.value).slice(0,Ut).join("");p(_(w({},i),{translationNotes:P}))},placeholder:o("clientUI.multilingual.translationNotesPlaceholder"),showCount:{formatter:({value:d})=>"".concat(Array.from(d).length," / ").concat(Ut)},disabled:q,autoSize:{minRows:2,maxRows:5}}),q&&i.translationNotesEditableAt&&e.jsx("div",{className:"text-[14px] leading-[1.4] text-[#8a8a8a] mt-[6px]",children:o("clientUI.multilingual.translationNotesCooldown",{date:K(i.translationNotesEditableAt).format("YYYY-MM-DD HH:mm")}
2)})]})]}),e.jsxs("div",{className:"mt-[30px] pt-[20px] border-t border-[#e0e0e0]",children:[e.jsx("div",{className:"text-first text-[16px] font-[500] mb-[6px]",children:o("clientUI.createPost.curationPolicy")}),e.jsx("div",{className:"text-[13px] leading-[1.4] text-[#8a8a8a] mb-[12px]",children:o("clientUI.createPost.curationPolicyTip")}),e.jsx(z.Group,{value:(at=i.curationPolicy)!=null?at:0,onChange:d=>{p(_(w({},i),{curationPolicy:d.target.value}))},children:e.jsxs("div",{className:"flex flex-col gap-[12px] text-first",children:[e.jsxs(z,{value:0,children:[o("clientUI.createPost.curationOpen"),e.jsx("span",{className:"ml-[6px] text-[12px] text-[#8a8a8a]",children:o("clientUI.createPost.curationOpenDesc")})]}),e.jsxs(z,{value:10,children:[o("clientUI.createPost.curationApply"),e.jsx("span",{className:"ml-[6px] text-[12px] text-[#8a8a8a]",children:o("clientUI.createPost.curationApplyDesc")})]}),e.jsxs(z,{value:20,children:[o("clientUI.createPost.curationClosed"),e.jsx("span",{className:"ml-[6px] text-[12px] text-[#8a8a8a]",children:o("clientUI.createPost.curationClosedDesc")})]})]})})]})]}),e.jsxs("div",{className:"w-full",children:[e.jsx(On,{}),e.jsx("div",{className:"sm:hidden",children:We()}),e.jsx("div",{className:"hidden sm:block",children:We(!0)}),e.jsx(cr,{uuid:i.uuid,value:(it=i.submitSpaceIds)!=null?it:[],onChange:d=>p(_(w({},i),{submitSpaceIds:d}))})]})]}),e.jsxs("div",{className:B.publishAction,children:[Vt,e.jsx(J,{type:"primary",className:B["publish-btn"],onClick:Be,loading:u,size:"large",shape:"round",children:f==="scheduled"?o("clientUI.createPost.schedulePublish"):o("clientUI.createPost.PublishNow")})]})]}),e.jsx(Rs,{open:Ee,title:o("clientUI.rating.unratedConfirmTitle"),body:o("clientUI.rating.unratedConfirmBody"),okText:o("clientUI.rating.unratedConfirmOk"),cancelText:o("clientUI.rating.unratedConfirmBack"),onOk:Be,onCancel:()=>{Re(!1),Ls("openRatingSection")}})]})}const Or={"edit-wrap":"_edit-wrap_30cpe_1"},Dr='{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1,"textFormat":0}],"direction":null,"format":"","indent":0,"type":"root","version":1}}',Mr='{"root":{"children":[{"children":[{"type":"linebreak","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;","text":"People use Copus to ","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;background-color: #f8e71c;","text":"map creative processes","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;","text":" and","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;background-color: #f8e71c;","text":" inspire each other.","type":"text","version":1},{"type":"linebreak","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;","text":"The main difference here is that","type":"text","version":1},{"detail":0,"format":1,"mode":"normal","style":"font-size: 20px;","text":" ","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 20px;background-color: #f8e71c;","text":"works are connected.","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph-x","version":1,"textFormat":0,"textStyle":"font-size: 20px;","id":"rNAf"},{"children":[{"type":"linebreak","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 25px;","text":"Get a quick start:","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph-x","version":1,"textFormat":0,"textStyle":"font-size: 25px;","id":"gNcT"},{"children":[{"children":[{"detail":0,"format":1,"mode":"normal","style":"font-size: 16px;","text":"Add a source using “Add Source” on the left","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":", and your work will be connected to its sources—just like the dots in the mini-map. (Any hyperlink you add here will also be recognized as a source.)  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","ver
2sion":1,"value":1},{"children":[{"detail":0,"format":1,"mode":"normal","style":"font-size: 16px;","text":"You can add any URL from the web as a source.","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":" Others can also reference your works as their sources. ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":2},{"children":[{"detail":0,"format":1,"mode":"normal","style":"font-size: 16px;","text":"Publish","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":3}],"direction":"ltr","format":"","indent":0,"type":"list-x","version":1,"listType":"bullet","start":1,"tag":"ul","id":"Dn8C"},{"children":[],"direction":"ltr","format":"","indent":0,"type":"paragraph-x","version":1,"textFormat":0,"textStyle":"","id":"zWWJ"},{"children":[{"detail":0,"format":0,"mode":"normal","style":"font-size: 25px;","text":"Learn more:  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"heading-x","version":1,"tag":"h1","id":"860r"},{"children":[{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":"A more complete guide","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"https://www.copus.io/work/8cc15b3208504dc8be9c16c63664ea85"},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":": Explore all the features and how to get the most out of Copus.  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":1},{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":"Our official space","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"https://www.copus.io/copus"},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":": Follow us to stay updated.  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":2},{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":"Revenue sharing","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"https://www.copus.io/work/4c9f2444987641aa896487be85e25de0"},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":": Your works share future revenue with their sources, and your branches share revenue with you.","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":3},{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":"The project\'s story","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"link","version":1,"rel":"noreferrer","target":null,"title":null,"url":"https://www.copus.io/work/01acce79be524f389655b9658fd3568b"},{"detail":0,"format":0,"mode":"normal","style":"font-size: 16px;","text":": Discover how Copus evolved from a collaborative fiction project into what it is today.  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":4}],"direction":"ltr","format":"","indent":0,"type":"list-x","version":1,"listType":"bullet","start":1,"tag":"ul","id":"zfMz"},{"children":[],"direction":"ltr","format":"","indent":0,"type":"paragraph-x","version":1,"textFormat":0,"textStyle":"","id":"8mOY"},{"children":[{"detail":0,"format":3,"mode":"normal","style":"font-size: 16px;color: #4a90e2;font-family: Maven Pro;","text":"We hope you enjoy your journey with Copus!  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph-x","version":1,"textFormat":3,"textStyle":"font-size: 16px;color: #4a90e2;font-family: Maven Pro;","id":"HMqI"}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}',Fr=()=>{var T,O,Y,H;const{t}=se(),{spaceId:s}=As(),[n]=Gs(),r=(T=n.get("uuid"))!=null?T:void 0,l=(O=n.get("from"))!=null?O:void 0,{data:c,error:u,isLoading:g,mutate:m}=Et(r?["/client/common/opus/detail",r]:null,([F,q])=>he.get("".concat(F,"/").concat(q)).then(M=>{var W;if(M.data.status!==1||!((W=M.data.data)!=null&&W.id))throw new Error("Failed to load w
2ork tags");return M.data.data}),{revalidateOnFocus:!1,shouldRetryOnError:!1}),[S,b]=a.useState(!1),y=Os(_n),[f,h]=a.useState({accessLevel:0,content:"",coverUrl:"",emails:[],opusType:10,readers:[],storeOnChain:!0,subTitle:"",title:"",upstreamList:[],uuid:r,editTime:0,lockState:void 0,unlockPrice:void 0,isSensitiveCover:!1,isMultilingual:!0,translationNotes:"",curationPolicy:0,rating:-1}),[N,U]=a.useState(!1),{data:x,mutate:k}=Pn(r),j=!r||!g&&!c&&String(u==null?void 0:u.code)==="1102"&&!(x!=null&&x.scheduledPublishAt),L=a.useCallback(async()=>{const F=w(_(w({},f),{content:Dr}),l==="firstLogin"?{title:"Welcome & Getting Started",subTitle:"Welcome to Copus—where you can “Map your creative process” and “Inspire each other.”",content:fe(Mr),accessLevel:20,storeOnChain:!1,isSensitive:!1}:{});h(_(w({},F),{uuid:Ds()}))},[]),[i,p]=a.useState(!1);return a.useEffect(()=>{r?k().finally(()=>{p(!0)}):(L(),p(!0))},[]),a.useEffect(()=>{y&&(U(!0),h(F=>_(w({},F),{upstreamList:[y]})))},[y]),a.useEffect(()=>{var F,q,M;x&&h({accessLevel:x.accessLevel,content:fe((F=x.content)!=null?F:""),coverUrl:x.coverUrl,emails:[],opusType:x.opusType,readers:[],storeOnChain:x.storeOnChain,subTitle:x.subTitle,title:x.title,uuid:x.uuid,editTime:x.editTime,lockState:x.lockState,unlockPrice:x.unlockPrice,tagList:x.tagList,topics:x.topics,rating:x.rating,isSensitiveCover:x.isSensitiveCover,isMultilingual:(q=x.isMultilingual)!=null?q:!0,translationNotes:(M=x.translationNotes)!=null?M:"",translationNotesEditableAt:x.translationNotesEditableAt,connectionIntent:x.connectionIntent,scheduledPublishAt:x.scheduledPublishAt,curationPolicy:x.curationPolicy,submitSpaceIds:x.currState===10&&!x.scheduledPublishAt?[]:x.submitSpaceIds})},[x]),e.jsxs(Dt.Provider,{value:{data:f,setData:h},children:[e.jsx(Ar,{spaceId:s,initialProfileTagIds:j?[]:(H=(Y=c==null?void 0:c.spaceTopics)==null?void 0:Y.map(F=>F.id))!=null?H:c?[]:void 0,profileTagsError:!!u&&!j,onRetryProfileTags:()=>{m()}}),e.jsx(Xs,{draggable:!0,alwaysVisible:!0}),e.jsx("div",{className:"box-border flex-1 h-screen sm:h-full overflow-auto pt-[63px]",children:i?e.jsx("div",{className:Or["edit-wrap"],children:e.jsx(Sn,{onRender:F=>{b(F)}})}):e.jsx("div",{className:"flex items-center justify-center h-[400px]",children:e.jsx(we,{indicator:e.jsx(Me,{style:{fontSize:48},spin:!0})})})})]})},Kr=()=>{const{data:t}=Tt(),s=Ms();return Fs("Create - Copus"),t===void 0?null:t?e.jsx(zs,{children:e.jsx(Fr,{})}):(s.push("/"),null)};export{Kr as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.