import {b}from'./chunk-ZFZJRL2R.mjs';import'./chunk-BMBP5UFA.mjs';import {useState,useCallback}from'react';import {jsx,jsxs}from'react/jsx-runtime';var T={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},A={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",padding:24,minWidth:400,maxWidth:500},S={marginBottom:16,padding:12,border:"1px solid var(--doc-border)",borderRadius:4},i={display:"block",fontSize:12,color:"var(--doc-text-muted)",marginBottom:4},a={width:"100%",padding:"4px 8px",border:"1px solid var(--doc-border-input)",borderRadius:4,fontSize:13,marginBottom:8},x={width:60,padding:"4px 8px",border:"1px solid var(--doc-border-input)",borderRadius:4,fontSize:13,marginBottom:8},D={display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},h={padding:"6px 16px",border:"1px solid var(--doc-border-input)",borderRadius:4,cursor:"pointer",fontSize:13,backgroundColor:"var(--doc-surface)"},L={...h,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"1px solid var(--doc-primary)"},F=[{value:"decimal",labelKey:"dialogs.footnoteProperties.formats.decimal"},{value:"lowerRoman",labelKey:"dialogs.footnoteProperties.formats.lowerRoman"},{value:"upperRoman",labelKey:"dialogs.footnoteProperties.formats.upperRoman"},{value:"lowerLetter",labelKey:"dialogs.footnoteProperties.formats.lowerAlpha"},{value:"upperLetter",labelKey:"dialogs.footnoteProperties.formats.upperAlpha"},{value:"chicago",labelKey:"dialogs.footnoteProperties.formats.symbols"}];function G({isOpen:C,onClose:s,onApply:f,footnotePr:l,endnotePr:p}){let{t}=b(),[d,R]=useState(l?.position??"pageBottom"),[u,N]=useState(l?.numFmt??"decimal"),[m,E]=useState(l?.numStart??1),[c,k]=useState(l?.numRestart??"continuous"),[g,w]=useState(p?.position??"docEnd"),[b$1,K]=useState(p?.numFmt??"lowerRoman"),[v,O]=useState(p?.numStart??1),[y,z]=useState(p?.numRestart??"continuous"),B=useCallback(()=>{f({position:d,numFmt:u,numStart:m,numRestart:c},{position:g,numFmt:b$1,numStart:v,numRestart:y}),s();},[d,u,m,c,g,b$1,v,y,f,s]);return C?jsx("div",{style:T,onClick:s,children:jsxs("div",{style:A,onClick:e=>e.stopPropagation(),children:[jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:t("dialogs.footnoteProperties.title")}),jsxs("div",{style:S,children:[jsx("h4",{style:{margin:"0 0 8px",fontSize:14},children:t("dialogs.footnoteProperties.footnotes")}),jsx("label",{style:i,children:t("dialogs.footnoteProperties.position")}),jsxs("select",{style:a,value:d,onChange:e=>R(e.target.value),children:[jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]}),jsx("label",{style:i,children:t("dialogs.footnoteProperties.numberFormat")}),jsx("select",{style:a,value:u,onChange:e=>N(e.target.value),children:F.map(e=>jsx("option",{value:e.value,children:t(e.labelKey)},e.value))}),jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[jsxs("div",{children:[jsx("label",{style:i,children:t("dialogs.footnoteProperties.startAt")}),jsx("input",{type:"number",min:1,style:x,value:m,onChange:e=>E(parseInt(e.target.value,10)||1)})]}),jsxs("div",{style:{flex:1},children:[jsx("label",{style:i,children:t("dialogs.footnoteProperties.numbering")}),jsxs("select",{style:a,value:c,onChange:e=>k(e.target.value),children:[jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]})]})]}),jsxs("div",{style:S,children:[jsx("h4",{style:{margin:"0 0 8px",fontSize:14},children:t("dialogs.footnoteProperties.endnotes")}),jsx("label",{style:i,children:t("dialogs.footnoteProperties.position")}),jsxs("select",{style:a,value:g,onChange:e=>w(e.target.value),children:[jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]}),jsx("label",{style:i,children:t("dialogs.footnoteProperties.numberFormat")}),jsx("select",{style:a,value:b$1,onChange:e=>K(e.target.value),children:F.map(e=>jsx("option",{value:e.value,children:t(e.labelKey)},e.value))}),jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[jsxs("div",{children:[jsx("label",{style:i,children:t("dialogs.footnoteProperties.startAt")}),jsx("input",{type:"number",min:1,style:x,value:v,onChange:e=>O(parseInt(e.target.value,10)||1)})]}),jsxs("div",{style:{flex:1},children:[jsx("label",{style:i,children:t("dialogs.footnoteProperties.numbering")}),jsxs("select",{style:a,value:y,onChange:e=>z(e.target.value),children:[jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")})]})]})]})]}),jsxs("div",{style:D,children:[jsx("button",{style:h,onClick:s,children:t("common.cancel")}),jsx("button",{style:L,onClick:B,children:t("common.apply")})]})]})}):null}export{G as FootnotePropertiesDialog};