@postnzt/docx-js-editor 0.0.33
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.
- package/dist/ClipboardManager-C0rTRkVQ.d.ts +464 -0
- package/dist/ClipboardManager-CgpKW2At.d.mts +464 -0
- package/dist/DocumentAgent-BqA9EJ3F.d.mts +442 -0
- package/dist/DocumentAgent-CRCXiBT7.d.ts +442 -0
- package/dist/FindReplaceDialog-KNJETYJX.js +1 -0
- package/dist/FindReplaceDialog-YW3R4FHM.mjs +1 -0
- package/dist/FootnotePropertiesDialog-452A4UT5.js +1 -0
- package/dist/FootnotePropertiesDialog-H24AC5XK.mjs +1 -0
- package/dist/HyperlinkDialog-GBAYMTUE.js +1 -0
- package/dist/HyperlinkDialog-HNYTXDCB.mjs +1 -0
- package/dist/ImagePositionDialog-B4RLP2W5.mjs +1 -0
- package/dist/ImagePositionDialog-M65BYQQE.js +1 -0
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +1 -0
- package/dist/ImagePropertiesDialog-O4WQSF5M.js +1 -0
- package/dist/PageSetupDialog-2GIBTKMJ.js +1 -0
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +1 -0
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +1 -0
- package/dist/TablePropertiesDialog-WOZ4ES3H.js +1 -0
- package/dist/agentApi-BVHzyk2l.d.mts +2239 -0
- package/dist/agentApi-BVHzyk2l.d.ts +2239 -0
- package/dist/chunk-2HDYCD2Q.mjs +1 -0
- package/dist/chunk-377ZVTSE.js +2 -0
- package/dist/chunk-37SLIJPH.mjs +58 -0
- package/dist/chunk-4VUZBV2S.js +1 -0
- package/dist/chunk-6WPRCJ5A.mjs +1 -0
- package/dist/chunk-7MGFEP2R.mjs +26 -0
- package/dist/chunk-7QTNB64A.mjs +9 -0
- package/dist/chunk-AARNCPWR.js +1 -0
- package/dist/chunk-AU5NVRHP.js +2 -0
- package/dist/chunk-BP3V2HDD.js +261 -0
- package/dist/chunk-BUEMG4NW.js +1 -0
- package/dist/chunk-DC65PJYE.js +4 -0
- package/dist/chunk-DLVLK5FT.mjs +24 -0
- package/dist/chunk-EV3CM6TU.js +1 -0
- package/dist/chunk-FVUGBRDD.js +1 -0
- package/dist/chunk-GZOCOWWB.mjs +2 -0
- package/dist/chunk-H5NTJZO4.js +1 -0
- package/dist/chunk-IFPN3NT3.js +3 -0
- package/dist/chunk-KCOGY3V2.js +10 -0
- package/dist/chunk-KUL2SDYC.js +26 -0
- package/dist/chunk-LFZXSNOF.mjs +261 -0
- package/dist/chunk-LYBG4YI7.mjs +1 -0
- package/dist/chunk-M5F4SK3W.mjs +1 -0
- package/dist/chunk-P7WEP4JU.js +9 -0
- package/dist/chunk-PB7VMDDP.js +24 -0
- package/dist/chunk-QAZ4233N.mjs +1 -0
- package/dist/chunk-QSUPYUOP.js +2 -0
- package/dist/chunk-QTSXJRP6.mjs +1 -0
- package/dist/chunk-QVPR2W5S.js +1 -0
- package/dist/chunk-RTFUE3KK.mjs +10 -0
- package/dist/chunk-SCYTWBF5.mjs +111 -0
- package/dist/chunk-SE5EN2QL.js +1 -0
- package/dist/chunk-T6X4C2QO.js +111 -0
- package/dist/chunk-TAUMSKRE.mjs +1 -0
- package/dist/chunk-W53SI3XW.mjs +1 -0
- package/dist/chunk-WOHFANC5.mjs +3 -0
- package/dist/chunk-X5A54T6S.mjs +4 -0
- package/dist/chunk-YKBSKEBS.mjs +2 -0
- package/dist/chunk-Z26WOH6R.mjs +2 -0
- package/dist/chunk-ZJNGMDRE.js +58 -0
- package/dist/clipboard-Cu80iVDh.d.ts +1181 -0
- package/dist/clipboard-dFROLI95.d.mts +1181 -0
- package/dist/colorResolver-BwI_Uxp3.d.mts +662 -0
- package/dist/colorResolver-Dlmk3itT.d.ts +662 -0
- package/dist/core-plugins-reexport.d.mts +31 -0
- package/dist/core-plugins-reexport.d.ts +31 -0
- package/dist/core-plugins-reexport.js +1 -0
- package/dist/core-plugins-reexport.mjs +1 -0
- package/dist/core-reexport.d.mts +309 -0
- package/dist/core-reexport.d.ts +309 -0
- package/dist/core-reexport.js +1 -0
- package/dist/core-reexport.mjs +1 -0
- package/dist/executor-L2MVKMXO.js +1 -0
- package/dist/executor-XKBCCVNY.mjs +1 -0
- package/dist/fontLoader-BI9ZoACv.d.ts +176 -0
- package/dist/fontLoader-DicgJidU.d.mts +176 -0
- package/dist/headless-reexport.d.mts +195 -0
- package/dist/headless-reexport.d.ts +195 -0
- package/dist/headless-reexport.js +4 -0
- package/dist/headless-reexport.mjs +4 -0
- package/dist/index.css +1 -0
- package/dist/index.d.mts +480 -0
- package/dist/index.d.ts +480 -0
- package/dist/index.js +112 -0
- package/dist/index.mjs +112 -0
- package/dist/lib-BCT2DRYI.mjs +1 -0
- package/dist/lib-U35UU4OU.js +1 -0
- package/dist/mcp-reexport.d.mts +156 -0
- package/dist/mcp-reexport.d.ts +156 -0
- package/dist/mcp-reexport.js +16 -0
- package/dist/mcp-reexport.mjs +16 -0
- package/dist/processTemplate-5ZST2Q5L.js +1 -0
- package/dist/processTemplate-LRHXOWMZ.mjs +1 -0
- package/dist/react-Cl2n0F5S.d.ts +1091 -0
- package/dist/react-DZlAKNXg.d.mts +1091 -0
- package/dist/react.css +1 -0
- package/dist/react.d.mts +10 -0
- package/dist/react.d.ts +10 -0
- package/dist/react.js +1 -0
- package/dist/react.mjs +1 -0
- package/dist/registry-D4FQ9aKX.d.mts +165 -0
- package/dist/registry-DrYyUXQr.d.ts +165 -0
- package/dist/selectionRects-DEX5THEG.js +1 -0
- package/dist/selectionRects-SQTAHMCH.mjs +1 -0
- package/dist/styles.css +1 -0
- package/dist/types-B3LkfO0u.d.mts +310 -0
- package/dist/types-igZ1x_e4.d.ts +310 -0
- package/dist/ui.d.mts +2005 -0
- package/dist/ui.d.ts +2005 -0
- package/dist/ui.js +1 -0
- package/dist/ui.mjs +1 -0
- package/dist/variableDetector-CIqTek7A.d.mts +204 -0
- package/dist/variableDetector-CkYvLv62.d.ts +204 -0
- package/i18n/de.json +745 -0
- package/i18n/en.json +745 -0
- package/i18n/pl.json +745 -0
- package/package.json +127 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},T={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},h={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function b(e){if(!e)return 1;let t=parseInt(e,16);return isNaN(t)?1:t/255}function c(e){let t=e.padStart(6,"0").slice(0,6),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),l=parseInt(t.slice(4,6),16);return {r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(l)?0:l}}function g(e,t,n){let r=l=>Math.max(0,Math.min(255,Math.round(l))).toString(16).padStart(2,"0");return `${r(e)}${r(t)}${r(n)}`.toUpperCase()}function p(e,t,n){e/=255,t/=255,n/=255;let r=Math.max(e,t,n),l=Math.min(e,t,n),o=(r+l)/2;if(r===l)return {h:0,s:0,l:o};let u=r-l,i=o>.5?u/(2-r-l):u/(r+l),a;switch(r){case e:a=((t-n)/u+(t<n?6:0))/6;break;case t:a=((n-e)/u+2)/6;break;case n:a=((e-t)/u+4)/6;break;default:a=0;}return {h:a*360,s:i,l:o}}function C(e,t,n){if(e=e/360,t===0){let u=Math.round(n*255);return {r:u,g:u,b:u}}let r=(u,i,a)=>(a<0&&(a+=1),a>1&&(a-=1),a<1/6?u+(i-u)*6*a:a<1/2?i:a<2/3?u+(i-u)*(2/3-a)*6:u),l=n<.5?n*(1+t):n+t-n*t,o=2*n-l;return {r:Math.round(r(o,l,e+1/3)*255),g:Math.round(r(o,l,e)*255),b:Math.round(r(o,l,e-1/3)*255)}}function f(e,t){if(t<=0||t>=1)return t>=1?"FFFFFF":e;let n=c(e),r=p(n.r,n.g,n.b);r.l=r.l+(1-r.l)*t;let l=C(r.h,r.s,r.l);return g(l.r,l.g,l.b)}function m(e,t){if(t<=0||t>=1)return t<=0?"000000":e;let n=c(e),r=p(n.r,n.g,n.b);r.l=r.l*t;let l=C(r.h,r.s,r.l);return g(l.r,l.g,l.b)}function k(e,t){let n=h[t]??t,r=["dk1","lt1","dk2","lt2","accent1","accent2","accent3","accent4","accent5","accent6","hlink","folHlink"],l=o=>r.includes(o);return e?.colorScheme?l(n)?e.colorScheme[n]??d[n]??"000000":"000000":l(n)?d[n]??"000000":"000000"}function x(e){if(!e)return null;let t=e.toLowerCase();return h[e]??h[t]??null}function s(e,t,n="000000"){if(!e)return `#${n}`;if(e.auto)return `#${n}`;let r;if(e.themeColor){let l=x(e.themeColor);if(l?r=k(t,l):r=e.rgb??n,e.themeTint){let o=b(e.themeTint);r=f(r,o);}else if(e.themeShade){let o=b(e.themeShade);r=m(r,o);}}else e.rgb?r=e.rgb==="auto"?n:e.rgb:r=n;return `#${r.toUpperCase().replace(/^#/,"")}`}function S(e){if(!e||e==="none")return "";let t=T[e];return t?`#${t}`:""}function v(e,t){return e?e.auto?"transparent":s(e,t):""}function M(e,t){if(!e)return false;if(e.auto)return true;let r=s(e,t).replace(/^#/,"").toLowerCase(),l=c(r);return (l.r+l.g+l.b)/3<20}function A(e,t){if(!e)return false;let r=s(e,t).replace(/^#/,"").toLowerCase(),l=c(r);return (l.r+l.g+l.b)/3>235}function H(e,t){if(!e)return "#000000";let r=s(e,t).replace(/^#/,""),l=c(r);return (.299*l.r+.587*l.g+.114*l.b)/255>.5?"#000000":"#FFFFFF"}function R(e){if(!e)return;let t=e.trim();if(t.toLowerCase()==="auto")return {auto:true};let n=x(t);if(n)return {themeColor:n};let r=t.replace(/^#/,"").toUpperCase();return /^[0-9A-F]{6}$/i.test(r)?{rgb:r}:/^[0-9A-F]{3}$/i.test(r)?{rgb:r.split("").map(o=>o+o).join("")}:{rgb:r.padStart(6,"0").slice(0,6)}}function E(e,t,n){let r={themeColor:e};return t!==void 0&&t>0&&t<1&&(r.themeTint=Math.round(t*255).toString(16).toUpperCase().padStart(2,"0")),n!==void 0&&n>0&&n<1&&(r.themeShade=Math.round(n*255).toString(16).toUpperCase().padStart(2,"0")),r}function $(e){return {rgb:e.replace(/^#/,"").toUpperCase()}}function L(e,t,n){let l=s(e,t).replace(/^#/,""),o=1-n/100;return `#${m(l,o)}`}function B(e,t,n){let l=s(e,t).replace(/^#/,""),o=n/100;return `#${f(l,o)}`}function U(e,t,n,r){let l=s(e,r).replace(/^#/,""),o=s(t,r).replace(/^#/,""),u=c(l),i=c(o),a={r:Math.round(u.r*(1-n)+i.r*n),g:Math.round(u.g*(1-n)+i.g*n),b:Math.round(u.b*(1-n)+i.b*n)};return `#${g(a.r,a.g,a.b)}`}function F(e){return e.startsWith("#")?e:`#${e}`}function D(e){return S(e)||F(e)}var y=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],V=[{type:"base",value:0,hexValue:"",labelSuffix:""},{type:"tint",value:.8,hexValue:"CC",labelSuffix:", Lighter 80%"},{type:"tint",value:.6,hexValue:"99",labelSuffix:", Lighter 60%"},{type:"tint",value:.4,hexValue:"66",labelSuffix:", Lighter 40%"},{type:"shade",value:.75,hexValue:"BF",labelSuffix:", Darker 25%"},{type:"shade",value:.5,hexValue:"80",labelSuffix:", Darker 50%"}];function I(e,t,n){return t==="tint"?f(e,n):m(e,n)}function _(e){let t=e??d;return V.map(n=>y.map(r=>{let l=t[r.slot]??d[r.slot]??"000000",o;n.type==="base"?o=l.toUpperCase():n.type==="tint"?o=f(l,n.value):o=m(l,n.value);let u={hex:o,themeSlot:r.slot,label:`${r.name}${n.labelSuffix}`};return n.type==="tint"&&n.hexValue?u.tint=n.hexValue:n.type==="shade"&&n.hexValue&&(u.shade=n.hexValue),u}))}function O(e,t,n){if(!e&&!t)return true;if(!e||!t)return false;let r=s(e,n).toUpperCase(),l=s(t,n).toUpperCase();return r===l}export{s as a,S as b,v as c,M as d,A as e,H as f,R as g,E as h,$ as i,L as j,B as k,U as l,F as m,D as n,I as o,_ as p,O as q};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var p={_lang:"en",common:{cancel:"Cancel",insert:"Insert",apply:"Apply",close:"Close",delete:"Delete",update:"Update",save:"Save",retry:"Retry",send:"Send",edit:"Edit",comment:"Comment",reply:"Reply",accept:"Accept",reject:"Reject",dismiss:"Dismiss",change:"Change",px:"px",closeDialog:"Close dialog"},toolbar:{ariaLabel:"Formatting toolbar",file:"File",format:"Format",insert:"Insert",print:"Print",printShortcut:"Ctrl+P",pageSetup:"Page setup",leftToRight:"Left-to-right text",rightToLeft:"Right-to-left text",image:"Image",table:"Table",pageBreak:"Page break",tableOfContents:"Table of contents",symbol:"Symbol"},formattingBar:{groups:{history:"History",zoom:"Zoom",styles:"Styles",font:"Font",textFormatting:"Text formatting",script:"Script",alignment:"Alignment",listFormatting:"List formatting",image:"Image",table:"Table"},undo:"Undo",undoShortcut:"Undo (Ctrl+Z)",redo:"Redo",redoShortcut:"Redo (Ctrl+Y)",bold:"Bold",boldShortcut:"Bold (Ctrl+B)",italic:"Italic",italicShortcut:"Italic (Ctrl+I)",underline:"Underline",underlineShortcut:"Underline (Ctrl+U)",strikethrough:"Strikethrough",fontColor:"Font Color",highlightColor:"Text Highlight Color",insertLink:"Insert link",insertLinkShortcut:"Insert link (Ctrl+K)",superscript:"Superscript",superscriptShortcut:"Superscript (Ctrl+Shift+=)",subscript:"Subscript",subscriptShortcut:"Subscript (Ctrl+=)",imageProperties:"Image properties",imagePropertiesShortcut:"Image properties (alt text, border)...",clearFormatting:"Clear formatting"},alignment:{alignLeft:"Align Left",alignLeftShortcut:"Ctrl+L",center:"Center",centerShortcut:"Ctrl+E",alignRight:"Align Right",alignRightShortcut:"Ctrl+R",justify:"Justify",justifyShortcut:"Ctrl+J"},lists:{ariaLabel:"List formatting",typeAriaLabel:"List type",indentationAriaLabel:"List indentation",bulletList:"Bullet List",numberedList:"Numbered List",decreaseIndent:"Decrease Indent",increaseIndent:"Increase Indent"},lineSpacing:{single:"Single",double:"Double",lineSpacingTitle:"Line spacing: {label}",paragraphSpacing:"Paragraph spacing"},styles:{selectAriaLabel:"Select paragraph style",normalText:"Normal text",title:"Title",subtitle:"Subtitle",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3"},font:{selectAriaLabel:"Select font family",sansSerif:"Sans Serif",serif:"Serif",monospace:"Monospace"},fontSize:{decrease:"Decrease font size",increase:"Increase font size",label:"Font size",listLabel:"Font sizes"},zoom:{ariaLabel:"Zoom: {label}"},colorPicker:{ariaLabel:"{type} color picker",highlightColors:"Highlight Colors",customColor:"Custom Color",noColor:"No Color",automatic:"Automatic",themeColors:"Theme Colors",standardColors:"Standard Colors",colors:{black:"Black",darkRed:"Dark Red",red:"Red",orange:"Orange",yellow:"Yellow",darkYellow:"Dark Yellow",green:"Green",darkGreen:"Dark Green",teal:"Teal",darkTeal:"Dark Teal",blue:"Blue",darkBlue:"Dark Blue",purple:"Purple",darkPurple:"Dark Purple",brown:"Brown",grey50:"Grey 50%",grey25:"Grey 25%",grey10:"Grey 10%",white:"White",lightRed:"Light Red",lightOrange:"Light Orange",lightYellow:"Light Yellow",lightGreen:"Light Green",lightBlue:"Light Blue",lightPurple:"Light Purple",pink:"Pink",rose:"Rose",gold:"Gold",aqua:"Aqua",lavender:"Lavender",silver:"Silver",darkOrange:"Dark Orange",darkGray:"Dark Gray",gray:"Gray",cyan:"Cyan",magenta:"Magenta",paleGreen:"Pale Green",lightCyan:"Light Cyan",skyBlue:"Sky Blue",lightBlue2:"Light Blue 2",lightMagenta:"Light Magenta",brightGreen:"Bright Green",violet:"Violet"}},dialogs:{findReplace:{titleFind:"Find",titleFindReplace:"Find and Replace",findLabel:"Find:",findPlaceholder:"Enter text to find...",findAriaLabel:"Find text",findPrevious:"Find previous",findPreviousTitle:"Find Previous (Shift+Enter)",findNext:"Find next",findNextTitle:"Find Next (Enter)",matchCount:"{current} of {total} matches",noResults:"No results found",replaceLabel:"Replace:",replacePlaceholder:"Enter replacement text...",replaceAriaLabel:"Replace text",replaceButton:"Replace",replaceCurrentTitle:"Replace current match",replaceAllButton:"Replace All",replaceAllTitle:"Replace all matches",matchCase:"Match case",wholeWords:"Whole words",toggleReplace:"+ Replace"},hyperlink:{titleEdit:"Edit Hyperlink",titleInsert:"Insert Hyperlink",tabWebAddress:"Web Address",tabBookmark:"Bookmark",urlLabel:"URL",urlPlaceholder:"https://example.com",urlHint:"Enter a web address, email (mailto:), or phone (tel:)",bookmarkLabel:"Bookmark",bookmarkPlaceholder:"Select a bookmark...",displayTextLabel:"Display Text",displayTextPlaceholder:"Text to display (optional)",displayTextHint:"Leave empty to use the selected text",tooltipLabel:"Tooltip (optional)",tooltipPlaceholder:"Text shown on hover",removeLink:"Remove Link",invalidUrl:"Please enter a valid URL",urlRequired:"URL is required"},insertTable:{title:"Insert Table",hoverToSelect:"Hover to select size",tableSize:"{cols} x {rows} Table",orSpecifySize:"or specify size",rowsLabel:"Rows:",columnsLabel:"Columns:",insertButton:"Insert Table",sizeSelector:"Table size selector"},insertImage:{title:"Insert Image",uploadAriaLabel:"Click or drag to upload image",uploadText:"Click to select or drag and drop an image",uploadSubtext:"PNG, JPG, GIF up to 10MB",dimensions:"Dimensions",widthLabel:"Width:",heightLabel:"Height:",aspectRatioLocked:"Aspect ratio locked",aspectRatioUnlocked:"Aspect ratio unlocked",altTextLabel:"Alt Text (optional)",altTextPlaceholder:"Describe the image for accessibility",insertButton:"Insert Image",invalidFile:"Please select a valid image file",fileTooLarge:"Image file is too large (max 10MB)",readFailed:"Failed to read image file",loadFailed:"Failed to load image",preview:"Preview"},insertSymbol:{title:"Insert Symbol",searchPlaceholder:"Search symbols (character or Unicode)...",noResults:'No symbols found for "{query}"',decimal:"Decimal: {value}",categories:{common:"Common",arrows:"Arrows",math:"Math",greek:"Greek",shapes:"Shapes",punctuation:"Punctuation",currency:"Currency",music:"Music",emoji:"Emoji"}},imageProperties:{title:"Image Properties",altText:"Alt Text",altTextPlaceholder:"Describe this image for accessibility...",border:"Border",width:"Width",style:"Style",color:"Color",preview:"Preview",borderStyles:{solid:"Solid",dashed:"Dashed",dotted:"Dotted",double:"Double",groove:"Groove",ridge:"Ridge",inset:"Inset",outset:"Outset"}},imagePosition:{title:"Image Position",horizontal:"Horizontal",vertical:"Vertical",position:"Position",alignment:"Alignment",offset:"Offset",offsetPx:"Offset (px)",align:"Align",relativeTo:"Relative to",alignOptions:{left:"Left",center:"Center",right:"Right",top:"Top",bottom:"Bottom"},relativeOptions:{page:"Page",column:"Column",margin:"Margin",character:"Character",paragraph:"Paragraph",line:"Line"}},pageSetup:{title:"Page Setup",pageSize:"PAGE SIZE",sizeLabel:"Size",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"MARGINS",top:"Top",bottom:"Bottom",left:"Left",right:"Right",pageSizes:{letter:'Letter (8.5" \xD7 11")',a4:'A4 (8.27" \xD7 11.69")',legal:'Legal (8.5" \xD7 14")',a3:'A3 (11.69" \xD7 16.54")',a5:'A5 (5.83" \xD7 8.27")',b5:'B5 (6.93" \xD7 9.84")',executive:'Executive (7.25" \xD7 10.5")'}},tableProperties:{title:"Table Properties",widthType:"Width type",widthLabel:"Width",alignmentLabel:"Alignment",widthTypes:{auto:"Auto",fixed:"Fixed (twips)",percentage:"Percentage"},units:{fiftiethsPercent:"(50ths of %)",twips:"tw"},alignOptions:{left:"Left",center:"Center",right:"Right"}},pasteSpecial:{title:"Paste Special",keepFormatting:"Keep Source Formatting",keepFormattingDescription:"Paste with original formatting",keepFormattingShortcut:"Ctrl+V",plainText:"Paste as Plain Text",plainTextDescription:"Paste without any formatting",plainTextShortcut:"Ctrl+Shift+V",readingClipboard:"Reading clipboard...",preview:"Preview:",noContent:"No content available to paste",clipboardError:"Unable to read clipboard. Please use Ctrl+V to paste."},footnoteProperties:{title:"Footnote & Endnote Properties",footnotes:"Footnotes",endnotes:"Endnotes",position:"Position",numberFormat:"Number format",startAt:"Start at",numbering:"Numbering",footnotePositions:{bottomOfPage:"Bottom of page",belowText:"Below text"},endnotePositions:{endOfDocument:"End of document",endOfSection:"End of section"},numberingOptions:{continuous:"Continuous",restartSection:"Restart each section",restartPage:"Restart each page"},formats:{decimal:"1, 2, 3, ...",lowerRoman:"i, ii, iii, ...",upperRoman:"I, II, III, ...",lowerAlpha:"a, b, c, ...",upperAlpha:"A, B, C, ...",symbols:"*, \u2020, \u2021, ..."}},keyboardShortcuts:{ariaLabel:"Keyboard Shortcuts",searchPlaceholder:"Search shortcuts...",categories:{editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},shortcuts:{save:"Save",saveDescription:"Save document",print:"Print",printDescription:"Print document",undo:"Undo",undoDescription:"Undo last action",redo:"Redo",redoDescription:"Redo last action",delete:"Delete",deleteDescription:"Delete selected text",find:"Find",findDescription:"Find text in document",findReplace:"Find & Replace",findReplaceDescription:"Find and replace text",cut:"Cut",cutDescription:"Cut selected text",copy:"Copy",copyDescription:"Copy selected text",paste:"Paste",pasteDescription:"Paste from clipboard",pastePlainText:"Paste as Plain Text",pastePlainTextDescription:"Paste without formatting",bold:"Bold",boldDescription:"Toggle bold formatting",italic:"Italic",italicDescription:"Toggle italic formatting",underline:"Underline",underlineDescription:"Toggle underline formatting",strikethrough:"Strikethrough",strikethroughDescription:"Toggle strikethrough",subscript:"Subscript",subscriptDescription:"Toggle subscript",superscript:"Superscript",superscriptDescription:"Toggle superscript",alignLeft:"Align Left",alignLeftDescription:"Left align paragraph",alignCenter:"Align Center",alignCenterDescription:"Center align paragraph",alignRight:"Align Right",alignRightDescription:"Right align paragraph",justify:"Justify",justifyDescription:"Justify paragraph",increaseIndent:"Increase Indent",increaseIndentDescription:"Increase paragraph indent",decreaseIndent:"Decrease Indent",decreaseIndentDescription:"Decrease paragraph indent",selectAll:"Select All",selectAllDescription:"Select all content",selectWord:"Select Word",selectWordDescription:"Select current word",selectParagraph:"Select Paragraph",selectParagraphDescription:"Select current paragraph",extendSelectionByWord:"Extend Selection by Word",extendSelectionByWordDescription:"Extend selection to next/previous word",extendSelectionToLineEdge:"Extend Selection to Line Edge",extendSelectionToLineEdgeDescription:"Extend selection to line start/end",moveByWord:"Move by Word",moveByWordDescription:"Move cursor to next/previous word",moveToLineStart:"Move to Line Start",moveToLineStartDescription:"Move cursor to start of line",moveToLineEnd:"Move to Line End",moveToLineEndDescription:"Move cursor to end of line",moveToDocumentStart:"Move to Document Start",moveToDocumentStartDescription:"Move cursor to start of document",moveToDocumentEnd:"Move to Document End",moveToDocumentEndDescription:"Move cursor to end of document",pageUp:"Page Up",pageUpDescription:"Scroll up one page",pageDown:"Page Down",pageDownDescription:"Scroll down one page",zoomIn:"Zoom In",zoomInDescription:"Increase zoom level",zoomOut:"Zoom Out",zoomOutDescription:"Decrease zoom level",resetZoom:"Reset Zoom",resetZoomDescription:"Reset zoom to 100%",keyboardShortcuts:"Keyboard Shortcuts",keyboardShortcutsDescription:"Show this help dialog"},noResults:'No shortcuts found matching "{query}"',pressEscToClose:"Press {key} to close",or:"or"}},comments:{resolved:"Resolved",resolve:"Resolve",reopen:"Reopen",moreOptions:"More options",unknown:"Unknown",addComment:"Add a comment...",replyPlaceholder:"Reply or add others with @",replyCount:"{count, plural, one {# reply} other {# replies}}"},trackedChanges:{unknown:"Unknown",replaced:"Replaced",with:"with",added:"Added",deleted:"Deleted"},contextMenu:{ariaLabel:"AI actions menu",textMenuAriaLabel:"Text editing menu",customPromptPlaceholder:"Enter custom prompt...",cut:"Cut",cutShortcut:"Ctrl+X",copy:"Copy",copyShortcut:"Ctrl+C",paste:"Paste",pasteShortcut:"Ctrl+V",pastePlainText:"Paste as Plain Text",pastePlainTextShortcut:"Ctrl+Shift+V",delete:"Delete",deleteShortcut:"Del",selectAll:"Select All",selectAllShortcut:"Ctrl+A",selected:"Selected:",aiActions:{askAi:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom"}},documentOutline:{ariaLabel:"Document outline",closeAriaLabel:"Close outline",closeTitle:"Close outline",title:"Outline",noHeadings:"No headings found. Add headings to your document to see them here."},sidebar:{ariaLabel:"Annotations sidebar"},titleBar:{untitled:"Untitled",documentNameAriaLabel:"Document name",menuBarAriaLabel:"Menu bar"},errors:{loadingDocument:"Loading document...",noDocumentLoaded:"No document loaded",failedToLoad:"Failed to Load Document",unableToParse:"Unable to Parse Document",somethingWentWrong:"Something went wrong",errorDescription:"An error occurred while rendering this component. Please try again or contact support if the problem persists.",errorLabel:"Error:",componentStack:"Component Stack:",tryAgain:"Try Again",showDetails:"Show details",hideDetails:"Hide details",unsavedChanges:"You have unsaved changes. Are you sure you want to leave?"},table:{insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",mergeCells:"Merge cells",splitCell:"Split cell",editingTools:"Table editing tools",label:"Table:",cellFillColor:"Cell Fill Color",borderColor:"Border Color",borderWidth:"Border width",unknownAction:"Unknown Action",borders:{all:"All borders",outside:"Outside borders",inside:"Inside borders",none:"No borders",remove:"Remove borders",top:"Top border",bottom:"Bottom border",left:"Left border",right:"Right border",styleAriaLabel:"Border style",tooltip:"Borders"},moreOptions:"More table options",styles:{title:"Table Styles",label:"Styles",normalTable:"Normal Table",tableGrid:"Table Grid",gridTableLight:"Grid Table Light",plainTable1:"Plain Table 1",plainTable2:"Plain Table 2",plainTable3:"Plain Table 3",plainTable4:"Plain Table 4",gridTable1Light:"Grid Table 1 Light",gridTable4Accent1:"Grid Table 4 Accent 1",gridTable5Dark:"Grid Table 5 Dark",listTable3Accent2:"List Table 3 Accent 2",listTable4Accent3:"List Table 4 Accent 3",gridTable4Accent5:"Grid Table 4 Accent 5",gridTable4Accent6:"Grid Table 4 Accent 6"}},tableAdvanced:{verticalAlignment:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",cellMargins:"Cell margins",textDirection:"Text direction",textDirections:{horizontal:"Horizontal (LR)",verticalRL:"Vertical (top-bottom, RL)",verticalLR:"Vertical (bottom-top, LR)"},toggleNoWrap:"Toggle no-wrap",rowHeight:"Row height",heightRules:{auto:"Auto",atLeast:"At least",exact:"Exact"},rule:"Rule",height:"Height",toggleHeaderRow:"Toggle header row",distributeColumns:"Distribute columns evenly",autoFit:"Auto-fit to contents",tableProperties:"Table properties...",tableAlignment:"Table alignment",alignTableLeft:"Align table left",alignTableCenter:"Align table center",alignTableRight:"Align table right",tableOptionsMenu:"Table options menu",tableOptions:"Table options"},imageTransform:{tooltip:"Transform",rotateClockwise:"Rotate clockwise",rotateCounterClockwise:"Rotate counter-clockwise",flipHorizontal:"Flip horizontal",flipVertical:"Flip vertical"},imageWrap:{inline:"Inline with text",floatLeft:"Float left (wrap right)",floatRight:"Float right (wrap left)",topAndBottom:"Top and bottom",behindText:"Behind text",inFrontOfText:"In front of text",tooltipPrefix:"Wrap: {label}"},responsePreview:{loading:"{action}...",result:"{action} Result",closeEsc:"Close (Esc)",editPrompt:"Edit the result before accepting:",changes:"Changes:",original:"Original:",new:"New:",cancelEdit:"Cancel Edit"},commentMarkers:{resolvedComment:"Resolved comment",comment:"Comment"},editor:{toggleCommentsSidebar:"Toggle comments sidebar",showDocumentOutline:"Show document outline",editing:"Editing",editingDescription:"Edit document directly",suggesting:"Suggesting",suggestingDescription:"Edits become suggestions",viewing:"Viewing",viewingDescription:"Read-only, no edits",failedToParse:"Failed to parse document",linkRemoved:"Link removed",linkCopied:"Link copied to clipboard",failedToSave:"Failed to save document"},hyperlinkPopup:{displayTextPlaceholder:"Display text",urlPlaceholder:"https://example.com",copyLink:"Copy link",editLink:"Edit link",removeLink:"Remove link"},headerFooter:{header:"Header",footer:"Footer",options:"Options",insertPageNumber:"Insert current page number",insertTotalPages:"Insert total page count",remove:"Remove {label}",closeEditing:"Close {label} editing"},image:{placeholder:"Image placeholder",placeholderText:"[Image]",editableAriaLabel:"Editable image"},ruler:{horizontal:"Horizontal ruler",vertical:"Vertical ruler",firstLineIndent:"First line indent",leftIndent:"Left indent",rightIndent:"Right indent",topMargin:"Top margin",bottomMargin:"Bottom margin"},print:{label:"Print",allPages:"All ({totalPages} pages)",singlePage:"Page {start}",pageRange:"Pages {start}-{end}"},unsaved:{unsaved:"Unsaved",saved:"Saved",unsavedTitle:"Document has unsaved changes",savedTitle:"All changes saved",unsavedAriaLabel:"Unsaved changes",savedAriaLabel:"All changes saved"},loading:{label:"Loading"}};var b=p,f=react.createContext(b),T=react.createContext("en");function d(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function y(e,o){if(!o)return e;let t={...e};for(let r of Object.keys(o)){let i=o[r];i!==null&&(d(e[r])&&d(i)?t[r]=y(e[r],i):i!==void 0&&(t[r]=i));}return t}function v(e,o){let t=e;for(let r of o.split(".")){if(!d(t))return;t=t[r];}return typeof t=="string"?t:void 0}function C(e){let o={},t=/(=\d+|\w+)\s*\{([^}]*)\}/g,r;for(;(r=t.exec(e))!==null;)o[r[1]]=r[2];return o}function R(e,o,t){return o?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(i,n,l)=>{let a=Number(o[n]);if(isNaN(a))return i;let s=C(l),g=s[`=${a}`];if(g!==void 0)return g.replace(/#/g,String(a));let c;try{c=new Intl.PluralRules(t||"en").select(a);}catch{c=a===1?"one":"other";}return (s[c]??s.other??"").replace(/#/g,String(a))}).replace(/\{(\w+)\}/g,(i,n)=>{let l=o[n];return l!==void 0?String(l):`{${n}}`}):e}function x({i18n:e,children:o}){let t=e,r=typeof t?._lang=="string"?t._lang:"en",i=react.useMemo(()=>y(b,t),[t]);return jsxRuntime.jsx(T.Provider,{value:r,children:jsxRuntime.jsx(f.Provider,{value:i,children:o})})}function A(){let e=react.useContext(f),o=react.useContext(T);return {t:react.useCallback((r,i)=>{let n=v(e,r);return R(n??r,i,o)},[e,o])}}
|
|
2
|
+
exports.a=x;exports.b=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {d as d$1}from'./chunk-TAUMSKRE.mjs';function E(){return {type:"break",breakType:"page"}}function K(){return {type:"break",breakType:"column"}}function j(t){return {type:"break",breakType:"textWrapping",clear:t}}function Z(){return {type:"run",content:[E()]}}function R(){return {type:"paragraph",content:[],formatting:{pageBreakBefore:true}}}function I(t){return t.content.filter(n=>n.type==="run")}function q(t,n){let{paragraphIndex:e}=n,o=[...t.package.document.content||[]],r=R();return o.splice(e+1,0,r),{...t,package:{...t.package,document:{...t.package.document,content:o}}}}function k(){return {type:"paragraph",content:[],formatting:{borders:{bottom:{style:"single",color:{rgb:"000000"},size:12,space:1}},spaceBefore:120,spaceAfter:120}}}function G(t,n){let{paragraphIndex:e}=n,o=[...t.package.document.content||[]],r=k();return o.splice(e+1,0,r),{...t,package:{...t.package,document:{...t.package.document,content:o}}}}function d(t){return t.type==="break"&&t.breakType==="page"}function Y(t){return t.type==="break"&&t.breakType==="column"}function Q(t){return t.type==="break"&&t.breakType==="textWrapping"}function ee(t){return t.type==="break"}function g(t){return t.formatting?.pageBreakBefore===true}function te(t){let n=0;for(let e of t.package.document.content||[])if(e.type==="paragraph"){let o=e;g(o)&&n++;let r=I(o);for(let a of r)for(let s of a.content)d(s)&&n++;}return n}function ne(t){let n=[],e=t.package.document.content||[];for(let o=0;o<e.length;o++){let r=e[o];if(r.type==="paragraph"){let a=r;g(a)&&n.push({paragraphIndex:o});let s=I(a);for(let l=0;l<s.length;l++){let c=s[l];for(let p of c.content)d(p)&&n.push({paragraphIndex:o,runIndex:l});}}}return n}function oe(t,n){let{paragraphIndex:e,runIndex:o}=n,r=[...t.package.document.content||[]],a=r[e];if(a.type!=="paragraph")return t;let s=a;if(g(s)&&o===void 0)return r[e]={...s,formatting:{...s.formatting,pageBreakBefore:false}},{...t,package:{...t.package,document:{...t.package.document,content:r}}};if(o!==void 0){let l=[],c=0;for(let p of s.content)if(p.type==="run"){if(c===o){let D=p.content.filter(X=>!d(X));D.length>0&&l.push({...p,content:D});}else l.push(p);c++;}else l.push(p);return r[e]={...s,content:l},{...t,package:{...t.package,document:{...t.package.document,content:r}}}}return t}var u=class{constructor(n){d$1(this,"listeners",new Set);d$1(this,"snapshot");d$1(this,"subscribe",n=>(this.listeners.add(n),()=>{this.listeners.delete(n);}));d$1(this,"getSnapshot",()=>this.snapshot);this.snapshot=n;}setSnapshot(n){this.snapshot=n,this.notify();}notify(){for(let n of this.listeners)n();}};var _="docx-editor-autosave",re=3e4,ae=1440*60*1e3,ie=2e3,A=1;function L(){try{let t="__docx_editor_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch{return false}}function P(t){return JSON.stringify({...t,originalBuffer:null})}function se(t){try{let n=JSON.parse(t);return !n||typeof n!="object"||!n.document||!n.savedAt?null:(n.version!==A&&console.warn("Auto-save data version mismatch, may need migration"),n)}catch{return null}}function le(t,n){let e=new Date(t).getTime();return Date.now()-e>n}var h=class extends u{constructor(e={}){super({status:"idle",lastSaveTime:null,hasRecoveryData:false,isEnabled:true});d$1(this,"storageKey");d$1(this,"interval");d$1(this,"maxAge");d$1(this,"saveOnChange");d$1(this,"debounceDelay");d$1(this,"onSaveCallback");d$1(this,"onErrorCallback");d$1(this,"onRecoveryAvailableCallback");d$1(this,"storageAvailable");d$1(this,"currentDocument",null);d$1(this,"lastSavedJson",null);d$1(this,"intervalTimer",null);d$1(this,"debounceTimer",null);d$1(this,"status","idle");d$1(this,"lastSaveTime",null);d$1(this,"_hasRecoveryData",false);d$1(this,"_isEnabled");this.storageKey=e.storageKey??_,this.interval=e.interval??re,this.maxAge=e.maxAge??ae,this.saveOnChange=e.saveOnChange??true,this.debounceDelay=e.debounceDelay??ie,this.onSaveCallback=e.onSave,this.onErrorCallback=e.onError,this.onRecoveryAvailableCallback=e.onRecoveryAvailable,this._isEnabled=true,this.storageAvailable=L(),this.checkRecoveryData();}onDocumentChanged(e){this.currentDocument=e,this._isEnabled&&this.saveOnChange&&e&&this.storageAvailable&&this.debounceSave();}async save(){if(!this.storageAvailable)return this.onErrorCallback?.(new Error("localStorage is not available")),false;let e=this.currentDocument;if(!e)return false;this.updateStatus("saving");try{let o=P(e);if(o===this.lastSavedJson)return this.updateStatus("saved"),!0;this.persistToStorage(o),this.lastSavedJson=o;let r=new Date;return this.lastSaveTime=r,this.updateStatus("saved"),this.onSaveCallback?.(r),!0}catch(o){return console.error("Auto-save failed:",o),this.updateStatus("error"),this.onErrorCallback?.(o),false}}clear(){if(this.storageAvailable)try{localStorage.removeItem(this.storageKey),this._hasRecoveryData=!1,this.lastSavedJson=null,this.emitSnapshot();}catch(e){console.error("Failed to clear auto-save:",e);}}getRecoveryData(){if(!this.storageAvailable)return null;try{let e=localStorage.getItem(this.storageKey);if(!e)return null;let o=se(e);return o?le(o.savedAt,this.maxAge)?(this.clear(),null):o:null}catch{return null}}acceptRecovery(){let e=this.getRecoveryData();return e?(this._hasRecoveryData=false,this.emitSnapshot(),e.document):null}dismissRecovery(){this.clear(),this._hasRecoveryData=false,this.emitSnapshot();}enable(){this._isEnabled=true,this.startInterval(),this.emitSnapshot();}disable(){this._isEnabled=false,this.stopTimers(),this.emitSnapshot();}startInterval(){this.stopTimers(),!(!this._isEnabled||!this.storageAvailable)&&(this.intervalTimer=setInterval(()=>{this.save();},this.interval));}destroy(){if(this.stopTimers(),this._isEnabled&&this.currentDocument&&this.storageAvailable)try{this.persistToStorage(P(this.currentDocument));}catch(e){console.error("Failed to save on destroy:",e);}}checkRecoveryData(){if(!this.storageAvailable)return;let e=this.getRecoveryData();e&&(this._hasRecoveryData=true,this.emitSnapshot(),this.onRecoveryAvailableCallback?.(e));}persistToStorage(e){let o={document:JSON.parse(e),savedAt:new Date().toISOString(),version:A};localStorage.setItem(this.storageKey,JSON.stringify(o));}debounceSave(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.save();},this.debounceDelay);}stopTimers(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null);}updateStatus(e){this.status=e,this.emitSnapshot();}emitSnapshot(){this.setSnapshot({status:this.status,lastSaveTime:this.lastSaveTime,hasRecoveryData:this._hasRecoveryData,isEnabled:this._isEnabled});}};function B(t){if(!t)return "Never";let e=new Date().getTime()-t.getTime(),o=Math.floor(e/1e3),r=Math.floor(o/60),a=Math.floor(r/60);return o<10?"Just now":o<60?`${o} seconds ago`:r<60?`${r} minute${r===1?"":"s"} ago`:a<24?`${a} hour${a===1?"":"s"} ago`:t.toLocaleDateString()}function F(t){return {idle:"Ready",saving:"Saving...",saved:"Saved",error:"Save failed"}[t]}function z(t=_){try{let n=localStorage.getItem(t);return n?new Blob([n]).size:0}catch{return 0}}function w(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function N(){return L()}var m={TABLE_INDEX:"data-table-index",ROW_INDEX:"data-row",COLUMN_INDEX:"data-col",TABLE_CELL:"data-table-cell"};function O(t,n){if(!(t instanceof Element))return null;let e=t;for(;e&&e!==n;){if(e.tagName==="TD"||e.tagName==="TH"){let o=e.getAttribute(m.ROW_INDEX),r=e.getAttribute(m.COLUMN_INDEX);if(o!==null&&r!==null){let a=e;for(;a&&a!==n;){if(a.tagName==="TABLE"){let s=a.getAttribute(m.TABLE_INDEX);if(s!==null)return {tableIndex:parseInt(s,10),rowIndex:parseInt(o,10),columnIndex:parseInt(r,10)};break}a=a.parentElement;}}break}e=e.parentElement;}return null}function M(t,n){if(!t.package?.document?.content)return null;let e=0;for(let o of t.package.document.content)if(o.type==="table"){if(e===n)return o;e++;}return null}function H(t,n,e){if(!t.package?.document?.content)return t;let o=0,r=t.package.document.content.map(a=>{if(a.type==="table"){if(o===n)return o++,e;o++;}return a});return {...t,package:{...t.package,document:{...t.package.document,content:r}}}}function V(t,n){if(!t.package?.document?.content)return t;let e=0,o=t.package.document.content.filter(r=>{if(r.type==="table"){let a=e===n;return e++,!a}return true});return {...t,package:{...t.package,document:{...t.package.document,content:o}}}}var f=class extends u{constructor(){super({selectedCell:null});}selectCell(n){this.setSnapshot({selectedCell:n});}clearSelection(){this.setSnapshot({selectedCell:null});}isCellSelected(n,e,o){let{selectedCell:r}=this.getSnapshot();return r?r.tableIndex===n&&r.rowIndex===e&&r.columnIndex===o:false}getSelectedCell(){return this.getSnapshot().selectedCell}};function W(t){if(!t||t==="transparent"||t==="inherit")return null;if(t.startsWith("#"))return t.slice(1).toUpperCase();let n=t.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(n){let e=parseInt(n[1]).toString(16).padStart(2,"0"),o=parseInt(n[2]).toString(16).padStart(2,"0"),r=parseInt(n[3]).toString(16).padStart(2,"0");return (e+o+r).toUpperCase()}return null}function y(t){let n=window.getComputedStyle(t),e={};(n.fontWeight==="bold"||parseInt(n.fontWeight)>=700)&&(e.bold=true),n.fontStyle==="italic"&&(e.italic=true);let o=n.textDecoration||n.textDecorationLine;o&&o.includes("underline")&&(e.underline={style:"single"}),o&&o.includes("line-through")&&(e.strike=true);let r=parseFloat(n.fontSize);!isNaN(r)&&r>0&&(e.fontSize=Math.round(r/1.333*2));let a=n.fontFamily.replace(/["']/g,"").split(",")[0].trim();a&&(e.fontFamily={ascii:a});let s=n.color;if(s&&s!=="rgb(0, 0, 0)"){let c=W(s);c&&(e.color={rgb:c});}let l=n.backgroundColor;if(l&&l!=="transparent"&&l!=="rgba(0, 0, 0, 0)"){let c=T(l);c&&(e.shading={fill:{rgb:c}});}return Object.keys(e).length>0?e:void 0}function ue(t,n){let e=document.createRange();e.selectNodeContents(t);let o=n.compareBoundaryPoints(Range.START_TO_START,e)>=0&&n.compareBoundaryPoints(Range.START_TO_END,e)<=0,r=n.compareBoundaryPoints(Range.END_TO_START,e)>=0&&n.compareBoundaryPoints(Range.END_TO_END,e)<=0;if(o&&r)return n.toString();if(o){let a=document.createRange();return a.setStart(n.startContainer,n.startOffset),a.selectNodeContents(t),a.setEnd(e.endContainer,e.endOffset),a.toString()}else if(r){let a=document.createRange();return a.selectNodeContents(t),a.setEnd(n.endContainer,n.endOffset),a.setStart(e.startContainer,e.startOffset),a.toString()}else if(n.intersectsNode(t))return t.textContent||"";return ""}function U(t){let n=t;for(;n;){if(n.nodeType===Node.ELEMENT_NODE){let e=n;if(e.hasAttribute("data-paragraph-index"))return e}n=n.parentNode;}return null}function C(){let t=window.getSelection();if(!t||t.isCollapsed)return [];let n=[],e=t.getRangeAt(0),o=e.commonAncestorContainer,r=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;if(!r)return n;if(r.querySelectorAll(".docx-run").forEach(s=>{if(e.intersectsNode(s)){let l=ue(s,e);if(l){let c=y(s);n.push({type:"run",formatting:c,content:[{type:"text",text:l}]});}}}),n.length===0){let s=t.toString();s&&n.push({type:"run",content:[{type:"text",text:s}]});}return n}function $(){let t=window.getSelection();if(!t||t.isCollapsed)return null;let n=C();if(n.length===0)return null;let e=t.toString(),o=t.getRangeAt(0),r=U(o.startContainer),a=U(o.endContainer),s=r?parseInt(r.getAttribute("data-paragraph-index")||"0",10):0,l=a?parseInt(a.getAttribute("data-paragraph-index")||"0",10):0;return {text:e,runs:n,startParagraphIndex:s,startRunIndex:0,startOffset:o.startOffset,endParagraphIndex:l,endRunIndex:0,endOffset:o.endOffset,isMultiParagraph:s!==l}}var T=W;var S=class extends u{constructor(){super({notifications:[]});d$1(this,"notifications",[]);d$1(this,"idCounter",0);d$1(this,"timers",new Set);}showError(e,o){return this.addNotification(e,"error",o)}showWarning(e,o){return this.addNotification(e,"warning",o)}showInfo(e,o){return this.addNotification(e,"info",o)}dismiss(e){this.notifications=this.notifications.map(r=>r.id===e?{...r,dismissed:true}:r),this.emitSnapshot();let o=setTimeout(()=>{this.timers.delete(o),this.notifications=this.notifications.filter(r=>r.id!==e),this.emitSnapshot();},300);this.timers.add(o);}clearAll(){this.notifications=[];for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.emitSnapshot();}destroy(){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.notifications=[];}addNotification(e,o,r){let a=`error-${++this.idCounter}-${Date.now()}`,s={id:a,message:e,severity:o,details:r,timestamp:Date.now()};if(this.notifications=[...this.notifications,s],this.emitSnapshot(),o!=="error"){let l=setTimeout(()=>{this.timers.delete(l),this.dismiss(a);},5e3);this.timers.add(l);}return a}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};function J(t,n){let e=`plugin-styles-${t}`,o=document.getElementById(e);o&&o.remove();let r=document.createElement("style");return r.id=e,r.textContent=n,document.head.appendChild(r),()=>{let a=document.getElementById(e);a&&a.remove();}}var v=class extends u{constructor(){super({states:new Map,version:0});d$1(this,"plugins",[]);d$1(this,"pluginStates",new Map);d$1(this,"version",0);}initialize(e,o){this.destroyPlugins(),this.plugins=e;for(let r of e)r.initialize&&!this.pluginStates.has(r.id)&&this.pluginStates.set(r.id,r.initialize(o));this.emitSnapshot();}updateStates(e){let o=false;for(let r of this.plugins)if(r.onStateChange){let a=r.onStateChange(e);a!==void 0&&(this.pluginStates.set(r.id,a),o=true);}return o&&(this.version++,this.emitSnapshot()),o}getPluginState(e){return this.pluginStates.get(e)}setPluginState(e,o){this.pluginStates.set(e,o),this.version++,this.emitSnapshot();}destroy(){this.destroyPlugins(),this.emitSnapshot();}destroyPlugins(){for(let e of this.plugins)e.destroy&&e.destroy();this.pluginStates.clear(),this.plugins=[];}emitSnapshot(){this.setSnapshot({states:new Map(this.pluginStates),version:this.version});}};var b=class extends u{constructor(){super({hasLayout:false,selectionRects:[],caretPosition:null,selectedImageInfo:null,isFocused:false,isDragging:false,isResizingColumn:false,isImageInteracting:false,version:0});d$1(this,"_hasLayout",false);d$1(this,"_selectionRects",[]);d$1(this,"_caretPosition",null);d$1(this,"_isDragging",false);d$1(this,"_dragAnchor",null);d$1(this,"_columnResize",{isResizing:false,startX:0,columnIndex:0,tablePmStart:0,originalWidths:{left:0,right:0}});d$1(this,"_selectedImageInfo",null);d$1(this,"_isImageInteracting",false);d$1(this,"_isFocused",false);d$1(this,"_version",0);}setLayoutReady(e){this._hasLayout=e,this.emitSnapshot();}updateSelection(e,o){this._selectionRects=e,this._caretPosition=o,this.emitSnapshot();}startDrag(e){this._isDragging=true,this._dragAnchor=e,this.emitSnapshot();}endDrag(){this._isDragging=false,this._dragAnchor=null,this.emitSnapshot();}getDragAnchor(){return this._dragAnchor}startColumnResize(e,o,r,a){this._columnResize={isResizing:true,startX:r,columnIndex:o,tablePmStart:e,originalWidths:a},this.emitSnapshot();}endColumnResize(){this._columnResize={...this._columnResize,isResizing:false},this.emitSnapshot();}getColumnResize(){return this._columnResize}setSelectedImage(e){this._selectedImageInfo=e,this.emitSnapshot();}clearSelectedImage(){this._selectedImageInfo=null,this._isImageInteracting=false,this.emitSnapshot();}setImageInteracting(e){this._isImageInteracting=e,this.emitSnapshot();}setFocused(e){this._isFocused=e,this.emitSnapshot();}emitSnapshot(){this._version++,this.setSnapshot({hasLayout:this._hasLayout,selectionRects:this._selectionRects,caretPosition:this._caretPosition,selectedImageInfo:this._selectedImageInfo,isFocused:this._isFocused,isDragging:this._isDragging,isResizingColumn:this._columnResize.isResizing,isImageInteracting:this._isImageInteracting,version:this._version});}};var x=class extends u{constructor(e={}){let o=e.initialZoom??1;super({loadingState:"idle",parseError:null,isReady:false,zoom:o,fontsLoaded:false,version:0});d$1(this,"_loadingState","idle");d$1(this,"_parseError",null);d$1(this,"_zoom");d$1(this,"_fontsLoaded",false);d$1(this,"_document",null);d$1(this,"_version",0);d$1(this,"onChangeCallback");d$1(this,"onErrorCallback");this._zoom=o,this.onChangeCallback=e.onChange,this.onErrorCallback=e.onError;}setParsingStarted(){this._loadingState="parsing",this._parseError=null,this.emitSnapshot();}setDocumentLoaded(e){this._document=e,this._loadingState="loading-fonts",this._parseError=null,this.emitSnapshot();}setFontsLoaded(){this._fontsLoaded=true,this._loadingState="ready",this.emitSnapshot();}setLoadError(e){this._loadingState="error",this._parseError=e.message,this.onErrorCallback?.(e),this.emitSnapshot();}getDocument(){return this._document}updateDocument(e){this._document=e,this.onChangeCallback?.(e),this.emitSnapshot();}setZoom(e){this._zoom=Math.max(.25,Math.min(4,e)),this.emitSnapshot();}getZoom(){return this._zoom}emitSnapshot(){this._version++,this.setSnapshot({loadingState:this._loadingState,parseError:this._parseError,isReady:this._loadingState==="ready",zoom:this._zoom,fontsLoaded:this._fontsLoaded,version:this._version});}};var pn="0.0.2";export{H as A,V as B,f as C,y as D,C as E,$ as F,T as G,S as H,J as I,v as J,b as K,x as L,pn as M,E as a,K as b,j as c,Z as d,R as e,q as f,k as g,G as h,d as i,Y as j,Q as k,ee as l,g as m,te as n,ne as o,oe as p,u as q,h as r,B as s,F as t,z as u,w as v,N as w,m as x,O as y,M as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function n(e){return {start:e,end:e,collapsed:true}}function r(e,t){return {start:e,end:t,collapsed:e.paragraphIndex===t.paragraphIndex&&e.offset===t.offset}}function o(e,t){return !(e.paragraphIndex<t.start.paragraphIndex||e.paragraphIndex===t.start.paragraphIndex&&e.offset<t.start.offset||e.paragraphIndex>t.end.paragraphIndex||e.paragraphIndex===t.end.paragraphIndex&&e.offset>t.end.offset)}function i(e,t){return e.paragraphIndex<t.paragraphIndex?-1:e.paragraphIndex>t.paragraphIndex?1:e.offset<t.offset?-1:e.offset>t.offset?1:0}function s(e){return {askAI:"Ask AI",rewrite:"Rewrite",expand:"Expand",summarize:"Summarize",translate:"Translate",explain:"Explain",fixGrammar:"Fix Grammar",makeFormal:"Make Formal",makeCasual:"Make Casual",custom:"Custom Prompt"}[e]}function m(e){return {askAI:"Ask AI a question about this text",rewrite:"Rewrite this text in a different way",expand:"Expand this text with more details",summarize:"Summarize this text to be shorter",translate:"Translate this text to another language",explain:"Explain what this text means",fixGrammar:"Fix grammar and spelling errors",makeFormal:"Make the tone more formal",makeCasual:"Make the tone more casual",custom:"Enter a custom prompt"}[e]}var p=["askAI","rewrite","expand","summarize","translate","explain"];function g(e){return {...e,id:a()}}function a(){return `cmd_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}exports.a=n;exports.b=r;exports.c=o;exports.d=i;exports.e=s;exports.f=m;exports.g=p;exports.h=g;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {b as b$1,f as f$1}from'./chunk-DLVLK5FT.mjs';import {n}from'./chunk-7MGFEP2R.mjs';function _(e){return g(e).variables}function g(e){let t=[],n={body:[],headers:[],footers:[],footnotes:[],endnotes:[],textBoxes:[]};if(e.package?.document){let r=A(e.package.document);r.forEach(o=>{t.push({name:o,location:"body"});}),n.body=Array.from(new Set(r)).sort();}if(e.package?.document?.sections&&e.package.document.sections.forEach((r,o)=>{r.properties.headerReferences&&r.properties.headerReferences.forEach(i=>{});}),e.package?.footnotes){let r=C(e.package.footnotes);r.forEach(o=>{t.push({name:o,location:"footnote"});}),n.footnotes=Array.from(new Set(r)).sort();}if(e.package?.endnotes){let r=C(e.package.endnotes);r.forEach(o=>{t.push({name:o,location:"endnote"});}),n.endnotes=Array.from(new Set(r)).sort();}e.templateVariables&&e.templateVariables.forEach(r=>{t.some(o=>o.name===r)||t.push({name:r,location:"body"});});let a=new Set;return t.forEach(r=>a.add(r.name)),{variables:Array.from(a).sort(),totalOccurrences:t.length,byLocation:n,occurrences:t}}function A(e){let t=[];if(e.content&&t.push(...w(e.content)),e.sections)for(let n of e.sections)n.content&&t.push(...w(n.content));return t}function w(e){let t=[];for(let n of e)n.type==="paragraph"?t.push(...b(n)):n.type==="table"&&t.push(...I(n));return t}function b(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="run"?t.push(...d(n)):n.type==="hyperlink"?t.push(...O(n)):n.type==="simpleField"?t.push(...N(n)):n.type==="complexField"&&t.push(...H(n));return t}function d(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="text"&&n.text&&t.push(...P(n.text));return t}function O(e){let t=[];if(!e.children)return t;for(let n of e.children)n.type==="run"&&t.push(...d(n));return t}function N(e){let t=[];if(e.instruction&&t.push(...P(e.instruction)),e.content)for(let n of e.content)n.type==="run"&&t.push(...d(n));return t}function H(e){let t=[];if(e.fieldCode)for(let n of e.fieldCode)n.type==="run"&&t.push(...d(n));if(e.fieldResult)for(let n of e.fieldResult)n.type==="run"&&t.push(...d(n));return t}function I(e){let t=[];if(!e.rows)return t;for(let n of e.rows)if(n.cells)for(let a of n.cells)t.push(...$(a));return t}function $(e){let t=[];if(!e.content)return t;for(let n of e.content)n.type==="paragraph"?t.push(...b(n)):n.type==="table"&&t.push(...I(n));return t}function C(e){let t=[];for(let n of e)if(n.content)for(let a of n.content)t.push(...b(a));return t}var R=/\{([a-zA-Z_][a-zA-Z0-9_\-\.]*)\}/g,D=/\{(.+?)\}/g;function P(e){if(!e)return [];let t=[],n=new RegExp(R),a;for(;(a=n.exec(e))!==null;)t.push(a[1]);return t}function q(e){return R.test(e)}function U(e){return !(!e||typeof e!="string"||e.length===0||e.length>100||!/^[a-zA-Z_]/.test(e)||!/^[a-zA-Z_][a-zA-Z0-9_\-\.]*$/.test(e))}function X(e){if(!e)return "";let t=e.replace(/\s+/g,"_");return t=t.replace(/[^a-zA-Z0-9_\-\.]/g,""),t&&!/^[a-zA-Z_]/.test(t)&&(t="_"+t),t.substring(0,100)}function G(e){return `{${e}}`}function K(e){let t=e.match(/^\{(.+?)\}$/);return t?t[1]:null}function Q(e,t){return e&&e.replace(D,(n,a)=>{let r=a.trim();return r in t?t[r]:n})}function Y(e,t=""){return e&&e.replace(D,t)}function ee(e){return _(e).length>0}function J(e){return typeof e=="object"&&e!==null&&("_def"in e||"parse"in e||"safeParse"in e)}function k(e,t){let n=t,{position:a,variableName:r}=n,o=JSON.parse(JSON.stringify(e)),s=o.package.document.content.filter(u=>u.type==="paragraph");if(a.paragraphIndex>=s.length)throw new Error(`Paragraph index ${a.paragraphIndex} out of bounds`);let c=s[a.paragraphIndex],l=`{${r}}`;return E(c,a.offset,l),o.templateVariables||(o.templateVariables=[]),o.templateVariables.includes(r)||o.templateVariables.push(r),o}function M(e,t){let n=t,{range:a,variableName:r}=n,o=JSON.parse(JSON.stringify(e)),s=o.package.document.content.filter(u=>u.type==="paragraph");if(a.start.paragraphIndex!==a.end.paragraphIndex)throw new Error("Template variable replacement cannot span multiple paragraphs");if(a.start.paragraphIndex>=s.length)throw new Error(`Paragraph index ${a.start.paragraphIndex} out of bounds`);let c=s[a.start.paragraphIndex];L(c,a.start.offset,a.end.offset);let l=`{${r}}`;return E(c,a.start.offset,l),o.templateVariables||(o.templateVariables=[]),o.templateVariables.includes(r)||o.templateVariables.push(r),o}function E(e,t,n){let a=0,r=false;for(let o=0;o<e.content.length;o++){let i=e.content[o];if(i.type==="run"){let s=x(i),c=a,l=a+s.length;if(!r&&t>=c&&t<=l){let u=t-c,h=s.slice(0,u),y=s.slice(u),m=[];for(let p=0;p<o;p++)m.push(e.content[p]);h&&m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:h}]}),m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:n}]}),y&&m.push({type:"run",formatting:i.formatting,content:[{type:"text",text:y}]});for(let p=o+1;p<e.content.length;p++)m.push(e.content[p]);e.content=m,r=true;break}a=l;}else if(i.type==="hyperlink")for(let s of i.children)s.type==="run"&&(a+=x(s).length);}r||e.content.push({type:"run",content:[{type:"text",text:n}]});}function L(e,t,n){let a=[],r=0;for(let o of e.content)if(o.type==="run"){let i=x(o),s=r,c=r+i.length;if(c<=t||s>=n)a.push(o);else {let l="";s<t&&(l+=i.slice(0,t-s)),c>n&&(l+=i.slice(n-s)),l.length>0&&a.push({type:"run",formatting:o.formatting,content:[{type:"text",text:l}]});}r=c;}else a.push(o);e.content=a;}function x(e){return e.content.filter(t=>t.type==="text").map(t=>t.text).join("")}var f={type:"string",description:"Document ID from a previous docx_load call"},F={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)"},offset:{type:"number",description:"Character offset within the paragraph"}},required:["paragraphIndex","offset"]},B={name:"docx_get_variables",description:`List all template variables ({name} format) found in the document.
|
|
2
|
+
Returns variable names without braces, along with their locations (body, headers, footers, etc.).
|
|
3
|
+
Use this to discover what data fields a template document expects.`,inputSchema:{type:"object",properties:{documentId:f},required:["documentId"]},handler:async(e,t)=>{let{documentId:n}=e,a=t.session.documents.get(n);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};try{let r=g(a.document);return {content:[{type:"text",text:JSON.stringify({variables:r.variables,count:r.variables.length,totalOccurrences:r.totalOccurrences,byLocation:r.byLocation},null,2)}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to detect variables: ${r.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low",examples:[{description:"Get all variables from a loaded document",input:{documentId:"doc_123"},output:'{"variables": ["customer_name", "invoice_date"], "count": 2}'}]}},Z={name:"docx_insert_variable",description:`Insert a template variable placeholder ({name}) at a specific position in the document.
|
|
4
|
+
The variable can later be substituted with actual values using docx_apply_template.
|
|
5
|
+
Variable names should follow the pattern: letters, numbers, underscores, starting with a letter.`,inputSchema:{type:"object",properties:{documentId:f,position:F,variableName:{type:"string",description:'Variable name without braces (e.g., "customer_name"). Will be inserted as {customer_name}',pattern:"^[a-zA-Z_][a-zA-Z0-9_]*$"}},required:["documentId","position","variableName"]},handler:async(e,t)=>{let{documentId:n,position:a,variableName:r}=e,o=t.session.documents.get(n);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!/^[a-zA-Z_][a-zA-Z0-9_\-.]*$/.test(r))return {isError:true,content:[{type:"text",text:`Invalid variable name: ${r}. Must start with letter/underscore and contain only alphanumeric, underscore, hyphen, or dot.`}]};try{let{executeCommand:i}=await import('./executor-XKBCCVNY.mjs'),s=i(o.document,{type:"insertText",position:a,text:`{${r}}`});return o.document=s,o.lastModified=Date.now(),s.templateVariables||(s.templateVariables=[]),s.templateVariables.includes(r)||s.templateVariables.push(r),{content:[{type:"text",text:JSON.stringify({success:!0,variable:r,insertedAs:`{${r}}`,position:a})}]}}catch(i){return {isError:true,content:[{type:"text",text:`Failed to insert variable: ${i.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"low",examples:[{description:"Insert customer name variable at start of first paragraph",input:{documentId:"doc_123",position:{paragraphIndex:0,offset:0},variableName:"customer_name"}}]}},z={name:"docx_apply_template",description:`Substitute template variables with actual values in the document.
|
|
6
|
+
Replaces all {variable} placeholders with the corresponding values provided.
|
|
7
|
+
Preserves all formatting (fonts, styles, colors, tables).
|
|
8
|
+
Use docx_get_variables first to discover what variables exist in the document.`,inputSchema:{type:"object",properties:{documentId:f,variables:{type:"object",description:'Map of variable names to values (e.g., {"customer_name": "John Doe", "date": "2024-01-15"})',additionalProperties:{type:"string"}},keepUnmatchedVariables:{type:"boolean",description:"If true, keep {variable} placeholders for variables not in the map. If false, replace with empty string. Default: true",default:true}},required:["documentId","variables"]},handler:async(e,t)=>{let{documentId:n$1,variables:a,keepUnmatchedVariables:r=true}=e,o=t.session.documents.get(n$1);if(!o)return {isError:true,content:[{type:"text",text:`Document not found: ${n$1}`}]};if(!o.buffer)return {isError:true,content:[{type:"text",text:"Cannot apply template: document was not loaded from a DOCX buffer"}]};try{let i=b$1(o.buffer,a,{nullGetter:r?"keep":"empty"}),s=await n(i.buffer);return o.document=s,o.buffer=i.buffer,o.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedVariables:i.replacedVariables,unreplacedVariables:i.unreplacedVariables,warnings:i.warnings})}]}}catch(i){return {isError:true,content:[{type:"text",text:`Failed to apply template: ${i.message}`}]}}},annotations:{category:"template",readOnly:false,complexity:"medium",examples:[{description:"Fill in customer and date values",input:{documentId:"doc_123",variables:{customer_name:"Jane Smith",invoice_date:"2024-02-15",amount:"$1,234.56"}}}]}},j={name:"docx_validate_template",description:`Validate that a document is a valid docxtemplater template.
|
|
9
|
+
Checks for syntax errors like unclosed braces, invalid tag names, etc.
|
|
10
|
+
Returns validation result with any errors found and list of valid tags.`,inputSchema:{type:"object",properties:{documentId:f},required:["documentId"]},handler:async(e,t)=>{let{documentId:n}=e,a=t.session.documents.get(n);if(!a)return {isError:true,content:[{type:"text",text:`Document not found: ${n}`}]};if(!a.buffer)return {isError:true,content:[{type:"text",text:"Cannot validate template: document was not loaded from a DOCX buffer"}]};try{let r=f$1(a.buffer);return {content:[{type:"text",text:JSON.stringify({valid:r.valid,tags:r.tags,errors:r.errors.map(o=>({message:o.message,variable:o.variable,type:o.type}))},null,2)}]}}catch(r){return {isError:true,content:[{type:"text",text:`Failed to validate template: ${r.message}`}]}}},annotations:{category:"template",readOnly:true,complexity:"low"}},S=[B,Z,z,j];var W={id:"docxtemplater",name:"Docxtemplater",version:"1.0.0",description:"Template variable support using standard docxtemplater syntax ({variable})",commandHandlers:{insertTemplateVariable:k,replaceWithTemplateVariable:M},mcpTools:S};export{_ as a,g as b,A as c,b as d,P as e,q as f,U as g,X as h,G as i,K as j,Q as k,Y as l,ee as m,J as n,W as o};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {h,c,b as b$2,d,a,R}from'./chunk-X5A54T6S.mjs';import {b}from'./chunk-GZOCOWWB.mjs';import {g,e,f}from'./chunk-6WPRCJ5A.mjs';import {b as b$1}from'./chunk-QAZ4233N.mjs';import ir,{useRef,useState,useEffect,useCallback,useMemo,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var Zt={askAI:"contextMenu.aiActions.askAi",rewrite:"contextMenu.aiActions.rewrite",expand:"contextMenu.aiActions.expand",summarize:"contextMenu.aiActions.summarize",translate:"contextMenu.aiActions.translate",explain:"contextMenu.aiActions.explain",fixGrammar:"contextMenu.aiActions.fixGrammar",makeFormal:"contextMenu.aiActions.makeFormal",makeCasual:"contextMenu.aiActions.makeCasual",custom:"contextMenu.aiActions.custom"},Xt=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Qt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Jt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),qt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),eo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),to=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),oo=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),ro=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),no=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),io=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function so(e){switch(e){case "askAI":return jsx(Xt,{});case "rewrite":return jsx(Qt,{});case "expand":return jsx(Jt,{});case "summarize":return jsx(qt,{});case "translate":return jsx(eo,{});case "explain":return jsx(to,{});case "fixGrammar":return jsx(oo,{});case "makeFormal":return jsx(ro,{});case "makeCasual":return jsx(no,{});case "custom":return jsx(io,{});default:return null}}var ao=({action:e,onClick:t,isHighlighted:o,onMouseEnter:i})=>{let{t:n}=b(),r=n(Zt[e]),s=f(e),c=so(e);return jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:i,title:s,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:c}),jsx("span",{children:r})]})},lo=({isOpen:e,onSubmit:t,onClose:o,selectedText:i})=>{let[n,r]=useState(""),s=useRef(null),{t:c}=b();useEffect(()=>{e&&s.current&&s.current.focus();},[e]);let l=m=>{m.preventDefault(),n.trim()&&(t(n.trim()),r(""));},a=m=>{m.key==="Escape"&&o();};return e?jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxs("form",{onSubmit:l,children:[jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',i.slice(0,50),i.length>50?"...":"",'"']}),jsx("input",{ref:s,type:"text",value:n,onChange:m=>r(m.target.value),onKeyDown:a,placeholder:c("contextMenu.customPromptPlaceholder"),style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:c("common.cancel")}),jsx("button",{type:"submit",disabled:!n.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:n.trim()?"var(--doc-primary)":"var(--doc-border)",color:n.trim()?"white":"var(--doc-text-placeholder)",cursor:n.trim()?"pointer":"not-allowed",fontSize:"12px"},children:c("common.send")})]})]})}):null},On=({isOpen:e,position:t,selectedText:o,selectionContext:i,onAction:n,onClose:r,actions:s=g,showCustomPrompt:c=true,className:l=""})=>{let a=useRef(null),[m,b$1]=useState(0),[h,p]=useState(false),{t:u}=b(),g=c?[...s,"custom"]:s;useEffect(()=>{if(!e)return;let d=y=>{a.current&&!a.current.contains(y.target)&&r();};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[e,r]),useEffect(()=>{if(!e)return;let d=y=>{switch(y.key){case "Escape":h?p(false):r();break;case "ArrowDown":y.preventDefault(),b$1(L=>(L+1)%g.length);break;case "ArrowUp":y.preventDefault(),b$1(L=>(L-1+g.length)%g.length);break;case "Enter":y.preventDefault();let C=g[m];C==="custom"?p(true):(n(C),r());break}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,m,g,n,r,h]),useEffect(()=>{e&&(b$1(0),p(false));},[e]);let x=useCallback(()=>{let y=g.length*36+16,C=t.x,L=t.y;return typeof window<"u"&&(C+200>window.innerWidth&&(C=window.innerWidth-200-10),L+y>window.innerHeight&&(L=window.innerHeight-y-10),C<10&&(C=10),L<10&&(L=10)),{position:"fixed",top:L,left:C,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,g.length]),k=d=>{d==="custom"?p(true):(n(d),r());},f=d=>{n("custom",d),r();};return !e||!o?null:jsxs("div",{ref:a,className:`docx-context-menu ${l}`,style:x(),role:"menu","aria-label":u("contextMenu.ariaLabel"),children:[jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsx("div",{role:"group",children:g.map((d,y)=>jsx(ao,{action:d,onClick:()=>k(d),isHighlighted:y===m,onMouseEnter:()=>b$1(y)},d))}),c&&jsx(lo,{isOpen:h,onSubmit:f,onClose:()=>p(false),selectedText:o})]})};function An(){let[e,t]=useState(false),[o,i]=useState({x:0,y:0}),[n,r]=useState(""),[s,c]=useState(),l=useCallback((m,b,h)=>{m.preventDefault(),i({x:m.clientX,y:m.clientY}),r(b),c(h),t(true);},[]),a=useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:n,selectionContext:s,openMenu:l,closeMenu:a}}function Mn(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function _n(e,t,o){return !(!t||t.trim().length===0)}function Nn(){return [...g]}function zn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var co=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),dt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),po=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),uo=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),go=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsx("style",{children:`
|
|
2
|
+
@keyframes spin {
|
|
3
|
+
from { transform: rotate(0deg); }
|
|
4
|
+
to { transform: rotate(360deg); }
|
|
5
|
+
}
|
|
6
|
+
`})]});function mo(e,t){let o=[],i=e.split(/(\s+)/),n=t.split(/(\s+)/),r=0,s=0;for(;r<i.length||s<n.length;){if(r>=i.length){o.push({type:"added",text:n.slice(s).join("")});break}if(s>=n.length){o.push({type:"removed",text:i.slice(r).join("")});break}if(i[r]===n[s])o.push({type:"same",text:i[r]}),r++,s++;else {let l=n.indexOf(i[r],s),a=i.indexOf(n[s],r);l===-1&&a===-1?(o.push({type:"removed",text:i[r]}),o.push({type:"added",text:n[s]}),r++,s++):a!==-1&&(l===-1||a-r<=l-s)?(o.push({type:"added",text:n[s]}),s++):(o.push({type:"removed",text:i[r]}),r++);}}let c=[];for(let l of o)c.length>0&&c[c.length-1].type===l.type?c[c.length-1].text+=l.text:c.push(l);return c}var ho=({original:e,modified:t})=>{let o=mo(e,t);return jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((i,n)=>{let r={};switch(i.type){case "removed":r={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":r={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsx("span",{style:r,children:i.text},n)})})},Vn=({originalText:e$1,response:t,action:o,isLoading:i,error:n,onAccept:r,onReject:s,onRetry:c,allowEdit:l=true,showDiff:a=true,className:m="",position:b$1})=>{let{t:h}=b(),[p,u]=useState(false),[g,x]=useState(""),k=useRef(null),f=useRef(null),d=t?.newText||"";useEffect(()=>{d&&x(d);},[d]),useEffect(()=>{p&&k.current&&(k.current.focus(),k.current.select());},[p]),useEffect(()=>{let D=R=>{R.key==="Escape"?p?(u(false),x(d)):s():R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),y());};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,d,s]);let y=useCallback(()=>{r(p?g:d);},[p,g,d,r]),C=useCallback(()=>{u(true);},[]),L=useCallback(()=>{u(false),x(d);},[d]),Y={position:b$1?"fixed":"relative",...b$1&&{left:b$1.x,top:b$1.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return i?jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-loading ${m}`,style:Y,children:jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsx(go,{}),jsx("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:h("responsePreview.loading",{action:e(o)})})]})}):n?jsx("div",{ref:f,className:`docx-response-preview docx-response-preview-error ${m}`,style:Y,children:jsxs("div",{style:{padding:"16px"},children:[jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:n}),jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[c&&jsxs("button",{type:"button",onClick:c,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsx(po,{}),h("common.retry")]}),jsx("button",{type:"button",onClick:s,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:h("common.close")})]})]})}):!t||!d?null:jsxs("div",{ref:f,className:`docx-response-preview ${m}`,style:Y,children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:h("responsePreview.result",{action:e(o)})}),jsx("button",{type:"button",onClick:s,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:h("responsePreview.closeEsc"),children:jsx(dt,{})})]}),jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[p?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.editPrompt")}),jsx("textarea",{ref:k,value:g,onChange:D=>x(D.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):a?jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.changes")}),jsx(ho,{original:e$1,modified:d})]}):jsxs("div",{children:[jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.original")}),jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e$1}),jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.new")}),jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:d})]}),t.warnings&&t.warnings.length>0&&jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((D,R)=>jsx("div",{children:D},R))})]}),jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxs("div",{children:[l&&!p&&jsxs("button",{type:"button",onClick:C,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsx(uo,{}),h("common.edit")]}),p&&jsx("button",{type:"button",onClick:L,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:h("responsePreview.cancelEdit")})]}),jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxs("button",{type:"button",onClick:s,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsx(dt,{}),h("common.reject")]}),jsxs("button",{type:"button",onClick:y,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsx(co,{}),h("common.accept")]})]})]})]})};function $n(){let[e,t]=useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=useCallback((s,c,l)=>{t({isVisible:true,originalText:s,response:null,action:c,isLoading:true,position:l});},[]),i=useCallback(s=>{t(c=>({...c,response:s,isLoading:false}));},[]),n=useCallback(s=>{t(c=>({...c,error:s,isLoading:false}));},[]),r=useCallback(()=>{t(s=>({...s,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:i,setError:n,hidePreview:r}}function Gn(e,t){return {success:true,newText:e,warnings:t}}function jn(e){return {success:false,error:e}}var xo=[{name:"Black",nameKey:"colorPicker.colors.black",hex:"000000"},{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"7F0000"},{name:"Dark Orange",nameKey:"colorPicker.colors.darkOrange",hex:"FF6600"},{name:"Dark Yellow",nameKey:"colorPicker.colors.darkYellow",hex:"808000"},{name:"Dark Green",nameKey:"colorPicker.colors.darkGreen",hex:"006400"},{name:"Dark Teal",nameKey:"colorPicker.colors.darkTeal",hex:"008080"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"000080"},{name:"Dark Purple",nameKey:"colorPicker.colors.darkPurple",hex:"4B0082"},{name:"Dark Gray",nameKey:"colorPicker.colors.darkGray",hex:"404040"},{name:"Gray",nameKey:"colorPicker.colors.gray",hex:"808080"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FF9900"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"00FF00"},{name:"Cyan",nameKey:"colorPicker.colors.cyan",hex:"00FFFF"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"0066FF"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0000FF"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"9900FF"},{name:"Magenta",nameKey:"colorPicker.colors.magenta",hex:"FF00FF"},{name:"Pink",nameKey:"colorPicker.colors.pink",hex:"FF66FF"},{name:"Light Red",nameKey:"colorPicker.colors.lightRed",hex:"FFCCCC"},{name:"Light Orange",nameKey:"colorPicker.colors.lightOrange",hex:"FFE5CC"},{name:"Light Yellow",nameKey:"colorPicker.colors.lightYellow",hex:"FFFFCC"},{name:"Pale Green",nameKey:"colorPicker.colors.paleGreen",hex:"CCFFCC"},{name:"Light Cyan",nameKey:"colorPicker.colors.lightCyan",hex:"CCFFFF"},{name:"Sky Blue",nameKey:"colorPicker.colors.skyBlue",hex:"CCE5FF"},{name:"Light Blue 2",nameKey:"colorPicker.colors.lightBlue2",hex:"CCCCFF"},{name:"Lavender",nameKey:"colorPicker.colors.lavender",hex:"E5CCFF"},{name:"Light Magenta",nameKey:"colorPicker.colors.lightMagenta",hex:"FFCCFF"},{name:"White",nameKey:"colorPicker.colors.white",hex:"FFFFFF"}],bo=[{name:"No Color",nameKey:"colorPicker.noColor",hex:""},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Bright Green",nameKey:"colorPicker.colors.brightGreen",hex:"00FF00"},{name:"Cyan",nameKey:"colorPicker.colors.cyan",hex:"00FFFF"},{name:"Magenta",nameKey:"colorPicker.colors.magenta",hex:"FF00FF"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0000FF"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"00008B"},{name:"Teal",nameKey:"colorPicker.colors.teal",hex:"008080"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"008000"},{name:"Violet",nameKey:"colorPicker.colors.violet",hex:"800080"},{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"8B0000"},{name:"Dark Yellow",nameKey:"colorPicker.colors.darkYellow",hex:"808000"},{name:"Gray 50%",nameKey:"colorPicker.colors.grey50",hex:"808080"},{name:"Gray 25%",nameKey:"colorPicker.colors.grey25",hex:"C0C0C0"},{name:"Black",nameKey:"colorPicker.colors.black",hex:"000000"}],fo={position:"relative",display:"inline-block"},Ie={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},yo={...Ie,backgroundColor:"var(--doc-bg-hover)"},vo={...Ie,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},So={...Ie,cursor:"default",opacity:.38},Co={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},ko={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},wo={display:"grid",gap:"2px"},Le={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},To={...Le,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Po={...Le,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},Eo={...Le,position:"relative",backgroundColor:"#fff"},Io={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ut={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},Lo={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Ro={display:"flex",alignItems:"center",gap:"8px"},Do={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Ko={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Oo=()=>jsx(d,{name:"format_color_text",size:18}),Ao=()=>jsx(d,{name:"ink_highlighter",size:18}),Mo=()=>jsx(d,{name:"arrow_drop_down",size:14});function _o({colors:e,selectedColor:t,onSelect:o,columns:i=10,cellSize:n=20}){let[r,s]=useState(null),{t:c}=b(),l={...wo,gridTemplateColumns:`repeat(${i}, ${n}px)`};return jsx("div",{style:l,className:"docx-color-grid",role:"grid",children:e.map((a,m)=>{let b=t?.toUpperCase()===a.hex.toUpperCase(),h=r===m,p=a.hex==="",u=a.nameKey?c(a.nameKey):a.name,g={...b?Po:h?To:Le,width:`${n}px`,height:`${n}px`};return p||(g.backgroundColor=`#${a.hex}`),jsx("button",{type:"button",style:p?{...Eo,...g}:g,onClick:()=>o(a),onMouseDown:x=>x.preventDefault(),onMouseEnter:()=>s(m),onMouseLeave:()=>s(null),title:u,role:"gridcell","aria-label":u,"aria-selected":b,children:p&&jsx("span",{style:Io})},`${a.hex}-${m}`)})})}function oi({value:e,onChange:t,type:o="text",theme:i,colors:n,disabled:r=false,className:s,style:c,title:l,children:a,dropdownWidth:m=230,showNoColor:b$2=true,showMoreColors:h$1=true}){let[p,u]=useState(false),[g,x]=useState(false),[k,f]=useState(""),{t:d}=b(),y=useCallback(()=>u(false),[]),{containerRef:C,dropdownRef:L,dropdownStyle:Y}=h({isOpen:p,onClose:y}),D=useMemo(()=>{if(o==="highlight")return bo;let A=[...xo];return b$2&&A.unshift({name:"Automatic",nameKey:"colorPicker.automatic",hex:"000000"}),A},[o,b$2]),R=n||D,X=useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?b$1(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]),G=useCallback(A=>{t?.(A.hex),u(false);},[t]),v=useCallback(()=>{let A=k.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(A)&&(t?.(A),u(false),f(""));},[k,t]),T=useCallback(()=>{r||u(A=>!A);},[r]),K=r?So:p?vo:g?yo:Ie,V=d(o==="text"?"formattingBar.fontColor":"formattingBar.highlightColor");return jsxs("div",{ref:C,className:`docx-color-picker docx-color-picker-${o} ${s||""}`,style:{...fo,...c},children:[jsxs("button",{type:"button",className:"docx-color-picker-button",style:K,onClick:T,onMouseDown:A=>A.preventDefault(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),disabled:r,title:l||V,"aria-label":l||V,"aria-haspopup":"true","aria-expanded":p,children:[a||jsxs("div",{style:Co,children:[o==="text"?jsx(Oo,{}):jsx(Ao,{}),jsx("div",{style:{...ko,backgroundColor:X==="transparent"?"#fff":X,border:X==="transparent"?"1px solid #ccc":"none"}})]}),jsx(Mo,{})]}),p&&jsxs("div",{ref:L,className:"docx-color-picker-dropdown",style:{...Y,padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",width:m},role:"dialog","aria-label":d("colorPicker.ariaLabel",{type:o==="text"?"Font":"Highlight"}),onMouseDown:A=>A.preventDefault(),children:[o==="highlight"&&jsx("div",{style:ut,children:d("colorPicker.highlightColors")}),jsx(_o,{colors:R,selectedColor:e,onSelect:G,columns:o==="highlight"?8:10}),h$1&&o==="text"&&jsxs("div",{style:Lo,children:[jsx("div",{style:ut,children:d("colorPicker.customColor")}),jsxs("div",{style:Ro,children:[jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsx("input",{type:"text",style:Do,value:k,onChange:A=>f(A.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:A=>{A.key==="Enter"&&v();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsx("button",{type:"button",style:Ko,onClick:v,disabled:!/^[0-9A-Fa-f]{6}$/.test(k),children:d("common.apply")})]})]})]})]})}var No={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function si({onPrint:e,disabled:t=false,label:o,className:i="",style:n,showIcon:r=true,compact:s=false}){let{t:c}=b(),l=o??c("print.label"),a={display:"flex",alignItems:"center",gap:s?"4px":"6px",padding:s?"4px 8px":"6px 12px",fontSize:s?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...n};return jsxs("button",{className:`docx-print-button ${i}`.trim(),style:a,onClick:e,disabled:t,"aria-label":l,title:l,children:[r&&jsx(zo,{size:s?14:16}),!s&&jsx("span",{children:l})]})}function ai(){return jsx("style",{children:`
|
|
7
|
+
@media print {
|
|
8
|
+
/* Hide everything except print content */
|
|
9
|
+
body * {
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.docx-print-pages,
|
|
14
|
+
.docx-print-pages * {
|
|
15
|
+
visibility: visible;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.docx-print-pages {
|
|
19
|
+
position: absolute;
|
|
20
|
+
left: 0;
|
|
21
|
+
top: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Remove shadows and margins in print */
|
|
25
|
+
.docx-print-page {
|
|
26
|
+
box-shadow: none !important;
|
|
27
|
+
margin: 0 !important;
|
|
28
|
+
page-break-after: always;
|
|
29
|
+
page-break-inside: avoid;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Ensure images print */
|
|
33
|
+
img {
|
|
34
|
+
max-width: 100%;
|
|
35
|
+
page-break-inside: avoid;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Ensure tables don't break badly */
|
|
39
|
+
table {
|
|
40
|
+
page-break-inside: avoid;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
tr {
|
|
44
|
+
page-break-inside: avoid;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Keep headings with content */
|
|
48
|
+
h1, h2, h3, h4, h5, h6 {
|
|
49
|
+
page-break-after: avoid;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Avoid orphan lines */
|
|
53
|
+
p {
|
|
54
|
+
orphans: 3;
|
|
55
|
+
widows: 3;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@page {
|
|
60
|
+
margin: 0;
|
|
61
|
+
size: auto;
|
|
62
|
+
}
|
|
63
|
+
`})}function zo({size:e=18}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function li(){window.print();}function ci(e="Document",t){let o=window.open("","_blank");return o?(o.document.write(`
|
|
64
|
+
<!DOCTYPE html>
|
|
65
|
+
<html>
|
|
66
|
+
<head>
|
|
67
|
+
<title>${e}</title>
|
|
68
|
+
<style>
|
|
69
|
+
@media print {
|
|
70
|
+
body {
|
|
71
|
+
margin: 0;
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
@page {
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
79
|
+
</head>
|
|
80
|
+
<body>
|
|
81
|
+
${t}
|
|
82
|
+
</body>
|
|
83
|
+
</html>
|
|
84
|
+
`),o.document.close(),o):null}function di(){return {...No}}function pi(e,t){if(!e||!e.trim())return null;let o=e.trim();if(/^\d+$/.test(o)){let n=parseInt(o,10);return n>=1&&n<=t?{start:n,end:n}:null}let i=o.match(/^(\d+)-(\d+)$/);if(i){let n=parseInt(i[1],10),r=parseInt(i[2],10);return n>=1&&r<=t&&n<=r?{start:n,end:r}:null}return null}function ui(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function gi(){return typeof window<"u"&&typeof window.print=="function"}function ki({onAction:e,disabled:t=false,canMerge:o=false,canSplit:i=false}){let{t:n}=b(),r=useCallback(m=>{m.preventDefault(),m.stopPropagation();},[]),s=useCallback(()=>{o&&e("mergeCells");},[e,o]),c$1=useCallback(()=>{i&&e("splitCell");},[e,i]),l=jsx(c,{content:n("table.mergeCells"),children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:s,disabled:t||!o,"aria-label":n("table.mergeCells"),"data-testid":"toolbar-table-merge",children:jsx(d,{name:"call_merge",size:20})})}),a$1=jsx(c,{content:n("table.splitCell"),children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!i)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:c$1,disabled:t||!i,"aria-label":n("table.splitCell"),"data-testid":"toolbar-table-split",children:jsx(d,{name:"call_split",size:20})})});return jsxs(Fragment,{children:[l,a$1]})}var Yo=[{action:"addRowAbove",icon:"keyboard_arrow_up",labelKey:"table.insertRowAbove",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",labelKey:"table.insertRowBelow",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",labelKey:"table.insertColumnLeft",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",labelKey:"table.insertColumnRight",testId:"toolbar-table-add-col-right"}];function Oi({onAction:e,disabled:t=false}){let{t:o}=b(),i=useCallback(n=>{n.preventDefault(),n.stopPropagation();},[]);return jsx(Fragment,{children:Yo.map(({action:n,icon:r,labelKey:s,testId:c$1})=>{let l=o(s);return jsx(c,{content:l,children:jsx(b$2,{variant:"ghost",size:"icon-sm",className:a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:i,onClick:()=>!t&&e(n),disabled:t,"aria-label":l,"data-testid":c$1,children:jsx(d,{name:r,size:20})})},typeof n=="string"?n:n.type)})})}var Ho="var(--doc-error)",Vo="var(--doc-success)",$o=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Go=({size:e=16})=>jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),jo=`
|
|
85
|
+
@keyframes docx-unsaved-pulse {
|
|
86
|
+
0%, 100% { opacity: 1; }
|
|
87
|
+
50% { opacity: 0.6; }
|
|
88
|
+
}
|
|
89
|
+
`,Zo=(e,t,o,i,n,r,s)=>{let c={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&i?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(c.position="absolute",c.top="4px",c.right="4px"):t==="absolute-top-left"&&(c.position="absolute",c.top="4px",c.left="4px"),e){case "dot":return {...c,width:`${s}px`,height:`${s}px`,borderRadius:"50%",backgroundColor:o?n:r};case "badge":return {...c,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?n:r,color:"white"};case "text":return {...c,fontSize:"12px",color:o?n:r,fontWeight:500};case "icon":return {...c,color:o?n:r};default:return c}},Bi=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:i=true,label:n,savedLabel:r,showWhenSaved:s=false,unsavedColor:c=Ho,savedColor:l=Vo,size:a=8,className:m="",style:b$1,onClick:h,title:p})=>{let{t:u}=b(),g=n??u("unsaved.unsaved"),x=r??u("unsaved.saved");if(useEffect(()=>{if(!i||!e)return;let C="docx-unsaved-pulse-keyframes";if(!document.getElementById(C)){let L=document.createElement("style");L.id=C,L.textContent=jo,document.head.appendChild(L);}},[i,e]),!e&&!s)return null;let f={...Zo(t,o,e,i,c,l,a),...b$1,cursor:h?"pointer":void 0},d=u(e?"unsaved.unsavedTitle":"unsaved.savedTitle"),y=()=>{switch(t){case "dot":return null;case "badge":return e?g:x;case "text":return e?g:x;case "icon":return e?jsx(Go,{size:a}):jsx($o,{size:a});default:return null}};return jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${m}`,style:f,onClick:h,title:p??d,role:h?"button":"status","aria-label":u(e?"unsaved.unsavedAriaLabel":"unsaved.savedAriaLabel"),children:y()})};function Fi(e={}){let{t}=b(),{document:o,warnBeforeLeave:i=true,warningMessage:n=t("errors.unsavedChanges"),enabled:r=true,onChangeStatusChange:s}=e,[c,l]=useState(false),[a,m]=useState(0),[b$1,h]=useState(null),p=useRef(null),u=useRef(false),g=useCallback(d=>{if(!d)return null;try{return JSON.stringify(d.package)}catch{return null}},[]),x=useCallback(()=>{r&&(l(false),m(0),h(o??null),p.current=g(o));},[r,o,g]),k=useCallback(()=>{r&&(c||(l(true),s?.(true)),m(d=>d+1));},[r,c,s]),f=useCallback(d=>{let y=d!==void 0?d:o;l(false),m(0),h(y??null),p.current=g(y),u.current=true;},[o,g]);return useEffect(()=>{!r||!o||u.current||f(o);},[r,o,f]),useEffect(()=>{if(!r||!o||!u.current)return;let d=g(o),y=p.current;if(d!==y){let C=g(b$1);d!==C?(c||(l(true),s?.(true)),m(L=>L+1)):c&&(l(false),s?.(false)),p.current=d;}},[r,o,b$1,c,g,s]),useEffect(()=>{if(!r||!i||!c)return;let d=y=>(y.preventDefault(),y.returnValue=n,n);return window.addEventListener("beforeunload",d),()=>window.removeEventListener("beforeunload",d)},[r,i,c,n]),{hasUnsavedChanges:c,markAsSaved:x,markAsChanged:k,resetTracking:f,lastSavedDocument:b$1,changeCount:a}}function Wi(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Yi(){return ["dot","badge","text","icon"]}function Ui(){return ["inline","absolute-top-right","absolute-top-left"]}function Hi(){let e=0,t=null,o=false;return {markChanged:()=>{e++,o=true;},markSaved:()=>{o=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:o}),reset:()=>{e=0,t=null,o=false;}}}var Xo={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},Qo="var(--doc-primary)",Jo=300,qo=`
|
|
90
|
+
@keyframes docx-loading-spin {
|
|
91
|
+
0% { transform: rotate(0deg); }
|
|
92
|
+
100% { transform: rotate(360deg); }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes docx-loading-pulse {
|
|
96
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
97
|
+
50% { opacity: 0.5; transform: scale(0.95); }
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes docx-loading-dots {
|
|
101
|
+
0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
|
|
102
|
+
40% { transform: scale(1); opacity: 1; }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@keyframes docx-loading-bar {
|
|
106
|
+
0% { left: -35%; right: 100%; }
|
|
107
|
+
60% { left: 100%; right: -90%; }
|
|
108
|
+
100% { left: 100%; right: -90%; }
|
|
109
|
+
}
|
|
110
|
+
`,er=({size:e,strokeWidth:t,color:o})=>{let i=(e-t)/2,n=i*2*Math.PI;return jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsx("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.75} ${n}`,opacity:.25}),jsx("circle",{cx:e/2,cy:e/2,r:i,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${n*.25} ${n}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},tr=({size:e,color:t})=>{let o=e/4,i=o/2;return jsx("div",{style:{display:"flex",gap:`${i}px`},children:[0,1,2].map(n=>jsx("div",{style:{width:o,height:o,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${n*.16}s infinite both`}},n))})},or=({size:e,color:t})=>jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),rr=({size:e,color:t})=>jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),nr=({size:e,color:t,progress:o,showText:i,fontSize:n})=>{let r=Math.max(0,Math.min(100,o));return jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${r}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),i&&jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n,fontWeight:500,color:r>50?"#fff":t},children:[Math.round(r),"%"]})]})},Xi=({isLoading:e,variant:t="spinner",size:o="medium",message:i,overlay:n=false,overlayOpacity:r=.5,progress:s=0,showProgressText:c=true,color:l=Qo,className:a="",style:m})=>{let{t:b$1}=b(),h=Xo[o];if(useEffect(()=>{let g="docx-loading-keyframes";if(!document.getElementById(g)){let x=document.createElement("style");x.id=g,x.textContent=qo,document.head.appendChild(x);}},[]),!e)return null;let p=()=>{switch(t){case "spinner":return jsx(er,{size:h.size,strokeWidth:h.strokeWidth,color:l});case "dots":return jsx(tr,{size:h.size,color:l});case "bar":return jsx(or,{size:h.size,color:l});case "pulse":return jsx(rr,{size:h.size,color:l});case "progress":return jsx(nr,{size:h.size,color:l,progress:s,showText:c,fontSize:h.fontSize});default:return null}},u=jsxs("div",{className:`docx-loading-content ${a}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...m},children:[p(),i&&jsx("div",{style:{fontSize:h.fontSize,color:n?"white":"var(--doc-text-muted)",textAlign:"center"},children:i})]});return n?jsx("div",{className:`docx-loading-overlay ${a}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${r})`,zIndex:1e4,...m},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?s:void 0,"aria-busy":"true","aria-label":i||b$1("loading.label"),children:u}):jsx("div",{className:`docx-loading-inline ${a}`,style:{display:"inline-flex",alignItems:"center",...m},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?s:void 0,"aria-busy":"true","aria-label":i||"Loading",children:u})};function Qi(e={}){let{initialLoading:t=false,minDuration:o=Jo,onStart:i,onEnd:n}=e,[r,s]=useState(t),[c,l]=useState(null),[a,m]=useState(0),b=useRef(null),h=useRef(null),p=useCallback(x=>{b.current=Date.now(),s(true),l(x||null),m(0),i?.();},[i]),u=useCallback(()=>{let x=b.current,k=Date.now(),f=x?k-x:0,d=Math.max(0,o-f);d>0?h.current=setTimeout(()=>{s(false),l(null),m(0),b.current=null,n?.();},d):(s(false),l(null),m(0),b.current=null,n?.());},[o,n]),g=useCallback(async(x,k)=>{p(k);try{let f=await x();return u(),f}catch(f){throw u(),f}},[p,u]);return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),{isLoading:r,message:c,progress:a,startLoading:p,stopLoading:u,setProgress:m,setMessage:l,withLoading:g}}function Ji(){let[e,t]=useState(new Map),o=useCallback((c,l)=>{t(a=>{let m=new Map(a);return m.set(c,{id:c,message:l,startTime:Date.now()}),m});},[]),i=useCallback((c,l)=>{t(a=>{let m=a.get(c);if(!m)return a;let b=new Map(a);return b.set(c,{...m,...l}),b});},[]),n=useCallback(c=>{t(l=>{let a=new Map(l);return a.delete(c),a});},[]),r=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:r,startOperation:o,updateOperation:i,endOperation:n,getOperation:c=>e.get(c)}}function qi(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function es(){return ["spinner","dots","bar","pulse","progress"]}function ts(){return ["small","medium","large"]}function os(e){return new Promise(t=>setTimeout(t,e))}var yt=4,vt=36,lr=32,cr=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function dr(e){let{containerRef:t,items:o,itemGap:i=yt,overflowButtonWidth:n=vt}=e,[r,s]=useState(o.length),c=useRef(new Map),l=useCallback(()=>{let b=t.current;if(!b){s(o.length);return}let h=b.offsetWidth;if(h===0)return;let p=[...o].sort((x,k)=>x.alwaysVisible&&!k.alwaysVisible?-1:!x.alwaysVisible&&k.alwaysVisible?1:(x.priority||3)-(k.priority||3)),u=0,g=0;for(let x of p){let f=(x.minWidth||c.current.get(x.id)||lr)+(g>0?i:0),d=g<o.length-1?n+i:0;if(u+f+d<=h)u+=f,g++;else if(x.alwaysVisible)u+=f,g++;else break}s(Math.max(0,g));},[t,o,i,n]);useLayoutEffect(()=>{let b=t.current;if(!b)return;l();let h=new ResizeObserver(()=>{l();});return h.observe(b),()=>{h.disconnect();}},[t,l]),useEffect(()=>{l();},[o,l]);let{visibleItems:a,overflowItems:m}=useMemo(()=>{let b=[...o].sort((h,p)=>h.alwaysVisible&&!p.alwaysVisible?-1:!h.alwaysVisible&&p.alwaysVisible?1:(h.priority||3)-(p.priority||3));return {visibleItems:b.slice(0,r),overflowItems:b.slice(r)}},[o,r]);return {visibleItems:a,overflowItems:m,hasOverflow:m.length>0,recalculate:l}}var pr=({items:e,isOpen:t,onClose:o,anchorRef:i})=>{let n=useRef(null);return useEffect(()=>{if(!t)return;let r=s=>{n.current&&!n.current.contains(s.target)&&i.current&&!i.current.contains(s.target)&&o();};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t,o,i]),useEffect(()=>{if(!t)return;let r=s=>{s.key==="Escape"&&o();};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,o]),!t||e.length===0?null:jsx("div",{ref:n,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(r=>jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:r.content},r.id))})},ss=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:i,renderOverflowMenu:n,itemGap:r=yt,padding:s="8px 12px",overflowButtonWidth:c=vt,className:l="",style:a,height:m=44,backgroundColor:b="var(--doc-toolbar-bg)",borderBottom:h="1px solid var(--doc-border)"})=>{let p=useRef(null),u=useRef(null),[g,x]=useState(false),{visibleItems:k,overflowItems:f,hasOverflow:d}=dr({containerRef:p,items:e,itemGap:r,overflowButtonWidth:c}),y=[...f,...t],C=d||o||t.length>0,L=useCallback(()=>{x(R=>!R);},[]),Y=useCallback(()=>{x(false);},[]),D=jsx("button",{ref:u,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:L,"aria-label":`Show ${y.length} more options`,"aria-expanded":g,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${c}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:g?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsx(cr,{})});return jsxs("div",{ref:p,className:`docx-responsive-toolbar ${l}`,style:{display:"flex",alignItems:"center",gap:`${r}px`,height:typeof m=="number"?`${m}px`:m,padding:s,backgroundColor:b,borderBottom:h,position:"relative",...a},children:[k.map(R=>jsxs(ir.Fragment,{children:[jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":R.id,style:{flexShrink:0},children:R.content}),R.separatorAfter&&jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},R.id)),C&&jsx("div",{style:{flex:1,minWidth:0}}),C&&jsxs("div",{style:{position:"relative",flexShrink:0},children:[i?i(y.length,g,L):D,n?g&&n(y,Y):jsx(pr,{items:y,isOpen:g,onClose:Y,anchorRef:u})]})]})},as=({children:e,gap:t=2,separatorAfter:o=false,className:i="",style:n})=>jsxs(Fragment,{children:[jsx("div",{className:`docx-toolbar-group ${i}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...n},children:e}),o&&jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function ls(e,t,o){return {id:e,content:t,priority:3,...o}}function cs(e){return e.map(t=>({...t,priority:t.priority||3}))}function ds(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var mr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},hr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},xr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},br={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},fr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},yr={padding:"20px"},vr={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},Sr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},Pt={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},Cr={...Pt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},kr={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},wr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},Ct={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},kt={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},wt={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},Tt={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Tr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ze={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},Pr={...Ze,backgroundColor:"var(--doc-primary)",color:"white"},Er={...Ze,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Ir={...Ze,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Lr(){return jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function xs({isOpen:e,onClose:t,onInsert:o,maxGridRows:i=8,maxGridColumns:n=10,maxRows:r=100,maxColumns:s=20,className:c,style:l}){let{t:a}=b(),[m,b$1]=useState(0),[h,p]=useState(0),[u,g]=useState(3),[x,k]=useState(3),f=useRef(null);useEffect(()=>{e&&(b$1(0),p(0),g(3),k(3));},[e]),useEffect(()=>{e&&f.current?.focus();},[e]);let d=useCallback((T,K)=>{b$1(T),p(K);},[]),y=useCallback(()=>{m>0&&h>0&&o({rows:m,columns:h});},[m,h,o]),C=useCallback(()=>{let T=Math.min(Math.max(1,u),r),K=Math.min(Math.max(1,x),s);o({rows:T,columns:K});},[u,x,r,s,o]),L=useCallback(T=>{T.key==="Escape"?t():T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),C());},[t,C]),Y=useCallback(T=>{T.target===T.currentTarget&&t();},[t]),D=useCallback(T=>{let K=parseInt(T.target.value,10);isNaN(K)?T.target.value===""&&g(1):g(Math.min(Math.max(1,K),r));},[r]),R=useCallback(T=>{let K=parseInt(T.target.value,10);isNaN(K)?T.target.value===""&&k(1):k(Math.min(Math.max(1,K),s));},[s]);if(!e)return null;let X=[];for(let T=1;T<=i;T++)for(let K=1;K<=n;K++){let V=T<=m&&K<=h;X.push(jsx("div",{style:V?Cr:Pt,onMouseEnter:()=>d(T,K),onClick:y,role:"gridcell","aria-selected":V},`${T}-${K}`));}let G=u>=1&&x>=1,v=m>0&&h>0?a("dialogs.insertTable.tableSize",{cols:h,rows:m}):a("dialogs.insertTable.hoverToSelect");return jsx("div",{className:`docx-insert-table-dialog-overlay ${c||""}`,style:{...mr,...l},onClick:Y,onKeyDown:L,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxs("div",{ref:f,className:"docx-insert-table-dialog",style:hr,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-table-dialog-header",style:xr,children:[jsx("h2",{id:"insert-table-dialog-title",style:br,children:jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsx(Lr,{}),a("dialogs.insertTable.title")]})}),jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:fr,onClick:t,"aria-label":a("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-table-dialog-body",style:yr,children:[jsxs("div",{className:"docx-insert-table-grid-container",style:vr,children:[jsx("div",{className:"docx-insert-table-grid",style:{...Sr,gridTemplateColumns:`repeat(${n}, 1fr)`},onMouseLeave:()=>{b$1(0),p(0);},role:"grid","aria-label":"Table size selector",children:X}),jsx("div",{className:"docx-insert-table-grid-label",style:kr,children:v})]}),jsxs("div",{className:"docx-insert-table-separator",style:wr,children:[jsx("div",{style:Ct}),jsx("span",{children:a("dialogs.insertTable.orSpecifySize")}),jsx("div",{style:Ct})]}),jsxs("div",{className:"docx-insert-table-inputs",children:[jsxs("div",{style:kt,children:[jsx("label",{htmlFor:"insert-table-rows",style:wt,children:a("dialogs.insertTable.rowsLabel")}),jsx("input",{id:"insert-table-rows",type:"number",min:1,max:r,value:u,onChange:D,style:Tt})]}),jsxs("div",{style:kt,children:[jsx("label",{htmlFor:"insert-table-cols",style:wt,children:a("dialogs.insertTable.columnsLabel")}),jsx("input",{id:"insert-table-cols",type:"number",min:1,max:s,value:x,onChange:R,style:Tt})]})]})]}),jsxs("div",{className:"docx-insert-table-dialog-footer",style:Tr,children:[jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:Er,onClick:t,children:a("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:G?Pr:Ir,onClick:C,disabled:!G,children:a("dialogs.insertTable.insertButton")})]})]})})}function bs(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),i=useCallback(()=>t(false),[]),n=useCallback(()=>t(r=>!r),[]);return {isOpen:e,open:o,close:i,toggle:n}}function fs(e=3,t=3){return {rows:e,columns:t}}function ys(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function vs(e,t=100,o=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),o)}}function Ss(e){return `${e.columns} x ${e.rows}`}function Cs(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Dr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Kr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},Or={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Ar={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Mr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},_r={padding:"20px"},Xe={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},Nr={...Xe,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},zr={...Xe,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Br={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},Fr={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},Wr={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Yr={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Ur={fontSize:"12px",color:"var(--doc-text-placeholder)"},It={marginBottom:"16px"},Lt={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Hr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},Vr={display:"flex",alignItems:"center",gap:"12px"},Rt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Kt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},$r={...Kt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Gr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},jr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Qe={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},Zr={...Qe,backgroundColor:"var(--doc-primary)",color:"white"},Xr={...Qe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Qr={...Qe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Jr(){return jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function qr({locked:e}){return e?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function Is({isOpen:e,onClose:t,onInsert:o,maxWidth:i=800,maxHeight:n=600,accept:r="image/*",className:s,style:c}){let{t:l}=b(),[a,m]=useState(null),[b$1,h]=useState(false),[p,u]=useState(0),[g,x]=useState(0),[k,f]=useState(""),[d,y]=useState(true),[C,L]=useState(1),[Y,D]=useState(null),R=useRef(null),X=useRef(null);useEffect(()=>{e&&(m(null),h(false),u(0),x(0),f(""),y(true),L(1),D(null));},[e]);let G=useCallback(E=>{if(!E.type.startsWith("image/")){D(l("dialogs.insertImage.invalidFile"));return}if(E.size>10*1024*1024){D(l("dialogs.insertImage.fileTooLarge"));return}D(null);let F=new FileReader;F.onload=$t=>{let rt=$t.target?.result,ae=new Image;ae.onload=()=>{let le=ae.width,ce=ae.height;if(le>i||ce>n){let Gt=i/le,jt=n/ce,nt=Math.min(Gt,jt);le=Math.round(le*nt),ce=Math.round(ce*nt);}u(le),x(ce),L(ae.width/ae.height),m({src:rt,width:le,height:ce,fileName:E.name,mimeType:E.type});},ae.src=rt;},F.onerror=()=>{D("Failed to read image file");},F.readAsDataURL(E);},[i,n]),v=useCallback(E=>{let F=E.target.files?.[0];F&&G(F);},[G]),T=useCallback(()=>{R.current?.click();},[]),K=useCallback(E=>{E.preventDefault(),h(true);},[]),V=useCallback(E=>{E.preventDefault(),h(false);},[]),A=useCallback(E=>{E.preventDefault(),h(false);let F=E.dataTransfer.files?.[0];F&&G(F);},[G]),Ft=useCallback(E=>{let F=parseInt(E.target.value,10)||0;u(F),d&&C&&x(Math.round(F/C));},[d,C]),Wt=useCallback(E=>{let F=parseInt(E.target.value,10)||0;x(F),d&&C&&u(Math.round(F*C));},[d,C]),ze=useCallback(()=>{a&&o({...a,width:p,height:g,alt:k||void 0});},[a,p,g,k,o]),Yt=useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&a&&!E.shiftKey&&(E.preventDefault(),ze());},[t,a,ze]),Ut=useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Ht=useCallback(()=>{m(null),u(0),x(0),f(""),D(null),R.current&&(R.current.value="");},[]);if(!e)return null;let ot=a!==null&&p>0&&g>0,Vt=()=>a?zr:b$1?Nr:Xe;return jsx("div",{className:`docx-insert-image-dialog-overlay ${s||""}`,style:{...Dr,...c},onClick:Ut,onKeyDown:Yt,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxs("div",{ref:X,className:"docx-insert-image-dialog",style:Kr,tabIndex:-1,children:[jsxs("div",{className:"docx-insert-image-dialog-header",style:Or,children:[jsx("h2",{id:"insert-image-dialog-title",style:Ar,children:l("dialogs.insertImage.title")}),jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Mr,onClick:t,"aria-label":l("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-image-dialog-body",style:_r,children:[jsx("input",{ref:R,type:"file",accept:r,onChange:v,style:{display:"none"}}),jsx("div",{className:"docx-insert-image-dropzone",style:Vt(),onClick:T,onDragOver:K,onDragLeave:V,onDrop:A,role:"button",tabIndex:0,"aria-label":l("dialogs.insertImage.uploadAriaLabel"),children:a?jsx("div",{style:Br,children:jsx("img",{src:a.src,alt:k||"Preview",style:Fr})}):jsxs(Fragment,{children:[jsx("div",{style:Wr,children:jsx(Jr,{})}),jsx("div",{style:Yr,children:l("dialogs.insertImage.uploadText")}),jsx("div",{style:Ur,children:l("dialogs.insertImage.uploadSubtext")})]})}),a?.fileName&&jsxs("div",{style:Gr,children:[a.fileName,jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Ht();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:l("common.change")})]}),Y&&jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:Y}),a&&jsxs(Fragment,{children:[jsxs("div",{style:It,children:[jsx("label",{style:Lt,children:l("dialogs.insertImage.dimensions")}),jsxs("div",{style:Vr,children:[jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("dialogs.insertImage.widthLabel")}),jsx("input",{type:"number",value:p,onChange:Ft,min:1,max:i,style:Rt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("common.px")}),jsx("button",{type:"button",onClick:()=>y(!d),style:d?$r:Kt,title:l(d?"dialogs.insertImage.aspectRatioLocked":"dialogs.insertImage.aspectRatioUnlocked"),children:jsx(qr,{locked:d})}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("dialogs.insertImage.heightLabel")}),jsx("input",{type:"number",value:g,onChange:Wt,min:1,max:n,style:Rt}),jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:l("common.px")})]})]}),jsxs("div",{style:It,children:[jsx("label",{htmlFor:"insert-image-alt",style:Lt,children:l("dialogs.insertImage.altTextLabel")}),jsx("input",{id:"insert-image-alt",type:"text",value:k,onChange:E=>f(E.target.value),placeholder:l("dialogs.insertImage.altTextPlaceholder"),style:Hr})]})]})]}),jsxs("div",{className:"docx-insert-image-dialog-footer",style:jr,children:[jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Xr,onClick:t,children:l("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:ot?Zr:Qr,onClick:ze,disabled:!ot,children:l("dialogs.insertImage.insertButton")})]})]})})}function Ls(){let[e,t]=useState(false),o=useCallback(()=>t(true),[]),i=useCallback(()=>t(false),[]),n=useCallback(()=>t(r=>!r),[]);return {isOpen:e,open:o,close:i,toggle:n}}function Rs(e){return e.type.startsWith("image/")}function Ds(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function Ks(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Os(e,t,o,i){if(e<=o&&t<=i)return {width:e,height:t};let n=o/e,r=i/t,s=Math.min(n,r);return {width:Math.round(e*s),height:Math.round(t*s)}}function As(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",i=atob(t[1]),n=new Uint8Array(i.length);for(let r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return new Blob([n],{type:o})}function Ms(e){return new Promise((t,o)=>{let i=new Image;i.onload=()=>t({width:i.width,height:i.height}),i.onerror=()=>o(new Error("Failed to load image")),i.src=e;})}function _s(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var rn={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},nn={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},sn={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},an={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},ln={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},cn={padding:"20px",flex:1,overflow:"auto"},dn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},pn={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},Ot={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},un={...Ot,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},gn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},mn={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},hn={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},xn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},bn={flex:1},fn={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Je={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},yn={...Je,backgroundColor:"var(--doc-primary)",color:"white"},vn={...Je,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Sn={...Je,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Ce=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function At(){return Ce.flatMap(e=>e.symbols)}function Ys({isOpen:e,onClose:t,onInsert:o,recentSymbols:i=[],className:n,style:r}){let{t:s}=b(),[c,l]=useState("common"),[a,m]=useState(null),[b$1,h]=useState(""),[p,u]=useState(null),g=useRef(null);useEffect(()=>{e&&(m(null),h(""),u(null),setTimeout(()=>g.current?.focus(),100));},[e]);let x=useMemo(()=>{if(!b$1.trim())return c==="recent"?i:Ce.find(V=>V.name===c)?.symbols||[];let v=b$1.toLowerCase();return At().filter(K=>{let V=K.codePointAt(0)?.toString(16).toUpperCase()||"";return K.includes(v)||V.includes(v.toUpperCase())||`U+${V}`.toLowerCase().includes(v)})},[b$1,c,i]),k=useCallback(v=>{m(v);},[]),f=useCallback(v=>{o(v);},[o]),d=useCallback(()=>{a&&o(a);},[a,o]),y=useCallback(v=>{v.key==="Escape"?t():v.key==="Enter"&&a&&(v.preventDefault(),d());},[t,a,d]),C=useCallback(v=>{v.target===v.currentTarget&&t();},[t]),L=v=>{if(!v)return null;let T=v.codePointAt(0);return {character:v,codePoint:T?`U+${T.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:T||0}};if(!e)return null;let D=L(p||a),R=a!==null,X={common:s("dialogs.insertSymbol.categories.common"),arrows:s("dialogs.insertSymbol.categories.arrows"),math:s("dialogs.insertSymbol.categories.math"),greek:s("dialogs.insertSymbol.categories.greek"),shapes:s("dialogs.insertSymbol.categories.shapes"),punctuation:s("dialogs.insertSymbol.categories.punctuation"),currency:s("dialogs.insertSymbol.categories.currency"),music:s("dialogs.insertSymbol.categories.music"),emoji:s("dialogs.insertSymbol.categories.emoji")},G=[...i.length>0?[{name:"recent",label:"Recent"}]:[],...Ce.map(v=>({name:v.name,label:X[v.name]||v.label}))];return jsx("div",{className:`docx-insert-symbol-dialog-overlay ${n||""}`,style:{...rn,...r},onClick:C,onKeyDown:y,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxs("div",{className:"docx-insert-symbol-dialog",style:nn,children:[jsxs("div",{className:"docx-insert-symbol-dialog-header",style:sn,children:[jsx("h2",{id:"insert-symbol-dialog-title",style:an,children:s("dialogs.insertSymbol.title")}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:ln,onClick:t,"aria-label":s("common.closeDialog"),children:"\xD7"})]}),jsxs("div",{className:"docx-insert-symbol-dialog-body",style:cn,children:[jsx("input",{ref:g,type:"text",placeholder:s("dialogs.insertSymbol.searchPlaceholder"),value:b$1,onChange:v=>h(v.target.value),style:dn}),!b$1&&jsx("div",{className:"docx-insert-symbol-categories",style:pn,children:G.map(v=>jsx("button",{type:"button",onClick:()=>l(v.name),style:c===v.name?un:Ot,children:v.label},v.name))}),jsx("div",{className:"docx-insert-symbol-grid",style:gn,children:x.map((v,T)=>jsx("button",{type:"button",onClick:()=>k(v),onDoubleClick:()=>f(v),onMouseEnter:()=>u(v),onMouseLeave:()=>u(null),style:{...mn,...a===v?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${v} - U+${v.codePointAt(0)?.toString(16).toUpperCase()}`,children:v},`${v}-${T}`))}),x.length===0&&jsx("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:s("dialogs.insertSymbol.noResults",{query:b$1})}),D&&jsxs("div",{className:"docx-insert-symbol-preview",style:hn,children:[jsx("div",{style:xn,children:D.character}),jsxs("div",{style:bn,children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:D.codePoint}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:s("dialogs.insertSymbol.decimal",{value:D.decimal})})]})]})]}),jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:fn,children:[jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:vn,onClick:t,children:s("common.cancel")}),jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:R?yn:Sn,onClick:d,disabled:!R,children:s("common.insert")})]})]})})}function Us(e=20){let[t,o]=useState(false),[i,n]=useState([]),r=useCallback(()=>o(true),[]),s=useCallback(()=>o(false),[]),c=useCallback(()=>o(a=>!a),[]),l=useCallback(a=>{n(m=>{let b=m.filter(h=>h!==a);return [a,...b].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:i,open:r,close:s,toggle:c,addRecent:l}}function Hs(){return Ce}function Vs(e){return Ce.find(o=>o.name===e)?.symbols||[]}function $s(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function Gs(e){if(!e.trim())return [];let t=e.toLowerCase();return At().filter(o=>{let i=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||i.includes(t.toUpperCase())||`U+${i}`.toLowerCase().includes(t)})}function js(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),o=parseInt(t,16);return isNaN(o)||o<0||o>1114111?null:String.fromCodePoint(o)}var ie=[{id:"formatted",labelKey:"dialogs.pasteSpecial.keepFormatting",descriptionKey:"dialogs.pasteSpecial.keepFormattingDescription",shortcutKey:"dialogs.pasteSpecial.keepFormattingShortcut"},{id:"plainText",labelKey:"dialogs.pasteSpecial.plainText",descriptionKey:"dialogs.pasteSpecial.plainTextDescription",shortcutKey:"dialogs.pasteSpecial.plainTextShortcut"}],kn=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),wn=()=>jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function Tn(e){switch(e){case "formatted":return jsx(kn,{});case "plainText":return jsx(wn,{});default:return null}}var Pn=({option:e,isSelected:t,onClick:o,onMouseEnter:i})=>jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:i,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:Tn(e.id)}),jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),ta=({isOpen:e,onClose:t,onPaste:o,position:i,className:n=""})=>{let{t:r}=b(),s=useRef(null),[c,l]=useState(0),[a,m]=useState(null),[b$1,h]=useState(false),[p,u]=useState(null),g=ie.map(f=>({id:f.id,label:r(f.labelKey),description:r(f.descriptionKey),shortcut:r(f.shortcutKey)}));useEffect(()=>{if(!e){m(null),u(null),l(0);return}(async()=>{h(true),u(null);try{let d=await R({cleanWordFormatting:!0});m(d),d||u(r("dialogs.pasteSpecial.noContent"));}catch{u(r("dialogs.pasteSpecial.clipboardError"));}finally{h(false);}})();},[e]),useEffect(()=>{if(!e)return;let f=d=>{s.current&&!s.current.contains(d.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),useEffect(()=>{if(!e)return;let f=d=>{switch(d.key){case "Escape":d.preventDefault(),t();break;case "ArrowDown":d.preventDefault(),l(y=>(y+1)%ie.length);break;case "ArrowUp":d.preventDefault(),l(y=>(y-1+ie.length)%ie.length);break;case "Enter":d.preventDefault(),x(ie[c].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,c,t]);let x=useCallback(f=>{if(!a){u(r("dialogs.pasteSpecial.noContent"));return}o(a,f==="plainText"),t();},[a,o,t]),k=useCallback(()=>{let y=i?.x??(typeof window<"u"?window.innerWidth/2-160:100),C=i?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(y+320>window.innerWidth&&(y=window.innerWidth-320-10),C+200>window.innerHeight&&(C=window.innerHeight-200-10),y<10&&(y=10),C<10&&(C=10)),{position:"fixed",top:C,left:y,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[i]);return e?jsxs("div",{ref:s,className:`docx-paste-special-dialog ${n}`,style:k(),role:"dialog","aria-label":r("dialogs.pasteSpecial.title"),children:[jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:r("dialogs.pasteSpecial.title")}),jsx("button",{type:"button",onClick:t,"aria-label":r("common.closeDialog"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsx("div",{style:{padding:"8px"},children:b$1?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:r("dialogs.pasteSpecial.readingClipboard")}):p?jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:p}):jsx("div",{role:"menu",children:g.map((f,d)=>jsx(Pn,{option:f,isSelected:d===c,onClick:()=>x(f.id),onMouseEnter:()=>l(d)},f.id))})}),a&&!b$1&&!p&&jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:r("dialogs.pasteSpecial.preview")}),jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',a.plainText.slice(0,50),a.plainText.length>50?"...":"",'"']})]})]}):null};function oa(e={}){let{onPaste:t,enabled:o=true}=e,[i,n]=useState(false),r=useCallback(()=>{o&&n(true);},[o]),s=useCallback(()=>{n(false);},[]),c=useCallback(async()=>{if(!(!o||!t))try{let a=await R({cleanWordFormatting:!0});a&&t(a,!0);}catch(a){console.error("Failed to paste as plain text:",a);}},[o,t]),l=useCallback(a=>o&&(a.ctrlKey||a.metaKey)&&a.shiftKey&&a.key.toLowerCase()==="v"?(a.preventDefault(),r(),true):false,[o,r]);return {isOpen:i,openDialog:r,closeDialog:s,handleKeyDown:l,pasteAsPlainText:c}}function ra(e){return ie.find(t=>t.id===e)}function na(){return [...ie]}function ia(){return "formatted"}function sa(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Nt={editing:"dialogs.keyboardShortcuts.categories.editing",formatting:"dialogs.keyboardShortcuts.categories.formatting",navigation:"dialogs.keyboardShortcuts.categories.navigation",clipboard:"dialogs.keyboardShortcuts.categories.clipboard",selection:"dialogs.keyboardShortcuts.categories.selection",view:"dialogs.keyboardShortcuts.categories.view",file:"dialogs.keyboardShortcuts.categories.file",other:"dialogs.keyboardShortcuts.categories.other"},zt=["file","editing","clipboard","formatting","selection","navigation","view","other"],Ne=[{id:"save",name:"Save",nameKey:"dialogs.keyboardShortcuts.shortcuts.save",description:"Save document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.saveDescription",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",nameKey:"dialogs.keyboardShortcuts.shortcuts.print",description:"Print document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.printDescription",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",nameKey:"dialogs.keyboardShortcuts.shortcuts.undo",description:"Undo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.undoDescription",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",nameKey:"dialogs.keyboardShortcuts.shortcuts.redo",description:"Redo last action",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.redoDescription",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",nameKey:"dialogs.keyboardShortcuts.shortcuts.delete",description:"Delete selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.deleteDescription",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",nameKey:"dialogs.keyboardShortcuts.shortcuts.find",description:"Find text in document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findDescription",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",nameKey:"dialogs.keyboardShortcuts.shortcuts.findReplace",description:"Find and replace text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.findReplaceDescription",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",nameKey:"dialogs.keyboardShortcuts.shortcuts.cut",description:"Cut selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.cutDescription",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",nameKey:"dialogs.keyboardShortcuts.shortcuts.copy",description:"Copy selected text",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.copyDescription",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",nameKey:"dialogs.keyboardShortcuts.shortcuts.paste",description:"Paste from clipboard",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pasteDescription",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",nameKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainText",description:"Paste without formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pastePlainTextDescription",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",nameKey:"dialogs.keyboardShortcuts.shortcuts.bold",description:"Toggle bold formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.boldDescription",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",nameKey:"dialogs.keyboardShortcuts.shortcuts.italic",description:"Toggle italic formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.italicDescription",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",nameKey:"dialogs.keyboardShortcuts.shortcuts.underline",description:"Toggle underline formatting",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.underlineDescription",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",nameKey:"dialogs.keyboardShortcuts.shortcuts.strikethrough",description:"Toggle strikethrough",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.strikethroughDescription",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.subscript",description:"Toggle subscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.subscriptDescription",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",nameKey:"dialogs.keyboardShortcuts.shortcuts.superscript",description:"Toggle superscript",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.superscriptDescription",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignLeft",description:"Left align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignLeftDescription",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignCenter",description:"Center align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignCenterDescription",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",nameKey:"dialogs.keyboardShortcuts.shortcuts.alignRight",description:"Right align paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.alignRightDescription",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",nameKey:"dialogs.keyboardShortcuts.shortcuts.justify",description:"Justify paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.justifyDescription",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndent",description:"Increase paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.increaseIndentDescription",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",nameKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndent",description:"Decrease paragraph indent",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.decreaseIndentDescription",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectAll",description:"Select all content",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectAllDescription",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectWord",description:"Select current word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectWordDescription",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",nameKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraph",description:"Select current paragraph",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.selectParagraphDescription",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWord",description:"Extend selection to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionByWordDescription",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",nameKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdge",description:"Extend selection to line start/end",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.extendSelectionToLineEdgeDescription",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveByWord",description:"Move cursor to next/previous word",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveByWordDescription",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStart",description:"Move cursor to start of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineStartDescription",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEnd",description:"Move cursor to end of line",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToLineEndDescription",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStart",description:"Move cursor to start of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentStartDescription",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",nameKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEnd",description:"Move cursor to end of document",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.moveToDocumentEndDescription",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageUp",description:"Scroll up one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageUpDescription",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",nameKey:"dialogs.keyboardShortcuts.shortcuts.pageDown",description:"Scroll down one page",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.pageDownDescription",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomIn",description:"Increase zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomInDescription",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",nameKey:"dialogs.keyboardShortcuts.shortcuts.zoomOut",description:"Decrease zoom level",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.zoomOutDescription",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",nameKey:"dialogs.keyboardShortcuts.shortcuts.resetZoom",description:"Reset zoom to 100%",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.resetZoomDescription",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",nameKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcuts",description:"Show this help dialog",descriptionKey:"dialogs.keyboardShortcuts.shortcuts.keyboardShortcutsDescription",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function En(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function tt(e){return En()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var In=({shortcut:e,translatedName:t,translatedDescription:o})=>{let i=tt(e.keys),n=e.altKeys?tt(e.altKeys):null;return jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxs("div",{style:{flex:1},children:[jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:t}),jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:o})]}),jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:i}),n&&jsxs(Fragment,{children:[jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:n})]})]})]})},ua=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:i=true,className:n=""})=>{let{t:r}=b(),s=useRef(null),c=useRef(null),[l,a]=useState(""),m=useMemo(()=>{let p=[...Ne];for(let u of o){let g=p.findIndex(x=>x.id===u.id);g>=0?p[g]=u:p.push(u);}return p},[o]),b$1=useMemo(()=>{if(!l.trim())return m;let p=l.toLowerCase();return m.filter(u=>{let g=u.nameKey?r(u.nameKey):u.name,x=u.descriptionKey?r(u.descriptionKey):u.description;return g.toLowerCase().includes(p)||x.toLowerCase().includes(p)||u.keys.toLowerCase().includes(p)||u.altKeys&&u.altKeys.toLowerCase().includes(p)})},[m,l,r]),h=useMemo(()=>{let p=new Map;for(let g of b$1){let x=p.get(g.category)||[];x.push(g),p.set(g.category,x);}let u=[];for(let g of zt){let x=p.get(g);x&&x.length>0&&u.push({category:g,shortcuts:x});}return u},[b$1]);return useEffect(()=>{e&&i&&c.current&&setTimeout(()=>c.current?.focus(),0);},[e,i]),useEffect(()=>{e||a("");},[e]),useEffect(()=>{if(!e)return;let p=u=>{s.current&&!s.current.contains(u.target)&&t();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,t]),useEffect(()=>{if(!e)return;let p=u=>{u.key==="Escape"&&t();};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),e?jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxs("div",{ref:s,className:`docx-shortcuts-dialog ${n}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":r("dialogs.keyboardShortcuts.ariaLabel"),children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:r("dialogs.keyboardShortcuts.ariaLabel")}),jsx("button",{type:"button",onClick:t,"aria-label":r("common.closeDialog"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),i&&jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsx("input",{ref:c,type:"text",value:l,onChange:p=>a(p.target.value),placeholder:r("dialogs.keyboardShortcuts.searchPlaceholder"),style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:h.length===0?jsx("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:r("dialogs.keyboardShortcuts.noResults",{query:l})}):h.map(({category:p,shortcuts:u})=>jsxs("div",{style:{marginBottom:"24px"},children:[jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:r(Nt[p])}),jsx("div",{children:u.map(g=>jsx(In,{shortcut:g,translatedName:g.nameKey?r(g.nameKey):g.name,translatedDescription:g.descriptionKey?r(g.descriptionKey):g.description},g.id))})]},p))}),jsx("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:(()=>{let u=r("dialogs.keyboardShortcuts.pressEscToClose",{key:"Esc"}).split("Esc");return jsxs(Fragment,{children:[u[0],jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"}),u[1]]})})()})]})}):null};function ga(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[i,n]=useState(false),r=useCallback(()=>{t&&n(true);},[t]),s=useCallback(()=>{n(false);},[]),c=useCallback(()=>{n(a=>!a);},[]),l=useCallback(a=>{if(!t)return;if((a.ctrlKey||a.metaKey)&&(a.key==="/"||a.key==="?")){a.preventDefault(),c();return}if(a.key==="F1"){a.preventDefault(),r();return}},[t,c,r]);return useEffect(()=>{if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,l]),{isOpen:i,open:r,close:s,toggle:c,handleKeyDown:l}}function ma(){return [...Ne]}function ha(e){return Ne.filter(t=>t.category===e)}function xa(){return Ne.filter(e=>e.common)}function ba(e){return Nt[e]}function fa(){return [...zt]}function ya(e){return tt(e)}
|
|
111
|
+
export{As as $,Hi as A,Xi as B,Qi as C,Ji as D,qi as E,es as F,ts as G,os as H,dr as I,ss as J,as as K,ls as L,cs as M,ds as N,xs as O,bs as P,fs as Q,ys as R,vs as S,Ss as T,Cs as U,Is as V,Ls as W,Rs as X,Ds as Y,Ks as Z,Os as _,On as a,Ms as aa,An as b,_s as ba,Mn as c,Ce as ca,_n as d,Ys as da,Nn as e,Us as ea,zn as f,Hs as fa,Vn as g,Vs as ga,$n as h,$s as ha,Gn as i,Gs as ia,jn as j,js as ja,oi as k,ta as ka,si as l,oa as la,ai as m,ra as ma,li as n,na,ci as o,ia as oa,di as p,sa as pa,pi as q,ua as qa,ui as r,ga as ra,gi as s,ma as sa,ki as t,ha as ta,Oi as u,xa as ua,Bi as v,ba as va,Fi as w,fa as wa,Wi as x,ya as xa,Yi as y,Ui as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function u(n){return n/1440*96}function o(n){return n/96*1440}function P(n){return n==null||isNaN(n)?0:Math.round(n*96/914400)}function _(n){return n/96*914400}function I(n){return n/914400*1440}function E(n){return n/1440*914400}function i(n){return n/72*96}function m(n){return n/144*96}function N(n){return n/2}function H(n){return n/576*96}function t(n,e=2){let r=Math.pow(10,e);return Math.round(n*r)/r}function b(n){return `${t(n)}px`}exports.a=u;exports.b=o;exports.c=P;exports.d=_;exports.e=I;exports.f=E;exports.g=i;exports.h=m;exports.i=N;exports.j=H;exports.k=b;
|