function l(t,a,i=50){return new Promise((m,o)=>{setTimeout(()=>{t.Exists(a)&&(t.Item(a).Select(),Application.Selection.Cut()),m()},i)})}function F(t,a){return new Promise((i,m)=>{const o=t.Bookmarks,s=[l(o,"Header",0),l(o,"Footer",100)];Promise.all(s).then(()=>{console.log("删除成功"),a.Activate();const n=a.Bookmarks,r=n.Item("Header"),e=n.Item("Footer");r.Range.Copy(),t.Activate(),t.Range(0,0).PasteAndFormat(16),e.Range.Copy(),t.Content.InsertParagraphAfter(),t.Range(t.Content.End,t.Content.End).PasteAndFormat(16),o.Item("Footer").Select(),i()})})}function p(t,a){return new Promise((i,m)=>{const o={};a.Activate();const s=a.Bookmarks;for(let n=1;n<=s.Count;n++){const r=s.Item(n);if(r.Name==="Main"||/P[0-9]+/.test(r.Name)){const e=r.Range,c=e.Style;o[r.Name]={NameLocal:c.NameLocal,LineSpacingRule:e.ParagraphFormat.LineSpacingRule,CharacterUnitFirstLineIndent:e.ParagraphFormat.CharacterUnitFirstLineIndent,SpaceBefore:e.ParagraphFormat.SpaceBefore,Alignment:e.ParagraphFormat.Alignment,Font:{Name:e.Font.Name,NameAscii:e.Font.NameAscii,NameBi:e.Font.NameBi,NameFarEast:e.Font.NameFarEast,NameOther:e.Font.NameOther,Size:e.Font.Size,SizeBi:e.Font.SizeBi,Bold:e.Font.Bold,BoldBi:e.Font.BoldBi,Italic:e.Font.Italic,ItalicBi:e.Font.ItalicBi}}}}t.Activate(),i(o)})}export{F as a,p as g};
