import{s as e,t,u as n}from"./humanInteraction-8U58N0CI.js";var r=`xyxp-publish-panel-host`,i=[`发布`,`立即发布`];function a(e){return e.replace(/\s+/g,``)}function o(e){return!!e.closest(`#${r}`)}function s(e){return a(e.textContent??``)}function c(e){return i.some(t=>e===a(t))||e.startsWith(`发布`)&&e.length<=8}function l(e){return e.disabled||e.getAttribute(`aria-disabled`)===`true`?!0:[...e.classList].some(e=>/disabled/i.test(e))}function u(){let e=[`button[class*="publish-button"]`,`div[class*="container--"] > button`,`button.ant-btn-primary`,`button.ant-btn`],t=new Set,n=[],r=e=>{t.has(e)||o(e)||(t.add(e),c(s(e))&&n.push(e))};for(let t of e)for(let e of document.querySelectorAll(t))r(e);if(n.length===0)for(let e of document.querySelectorAll(`button`))r(e);let i=n.filter(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0}),a=i.length>0?i:n;return a.length===0?null:a.sort((e,t)=>t.getBoundingClientRect().top-e.getBoundingClientRect().top)[0]??null}async function d(e=15e3){let t=Date.now()+e;for(;Date.now()<t;){let e=u();if(e&&!l(e))return e;await new Promise(e=>setTimeout(e,200))}let n=u();return n&&!l(n)?n:null}async function f(){await n();let r=await d();if(!r){let e=u();return e&&l(e)?{ok:!1,error:`「发布」按钮不可用，请检查表单必填项`}:{ok:!1,error:`未找到「发布」按钮`}}return r.scrollIntoView({block:`center`,inline:`nearest`,behavior:`smooth`}),await e(),await t(r),await e(),{ok:!0}}export{f as submitGoofishPublishForm};