@f-office/docs-react 0.0.0-stage → 0.2.2

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/index.js ADDED
@@ -0,0 +1,1406 @@
1
+ import { COMMANDS as e, NARROW as t, TARGETS as n, ariaKeys as r, available as i, commandIsCmd as a, copiedAddress as o, docxFile as s, fixedValue as c, keyTexts as l, linkOfElement as u, noInstalledFonts as d, pageCommand as f, parseView as ee, printTarget as te, readZoom as ne, setUrlTarget as re, setUrlValue as ie, shortcutRows as p, urlTarget as ae } from "@f-office/docs/chrome";
2
+ import { createContext as m, use as h, useCallback as g, useEffect as _, useEffectEvent as v, useMemo as y, useRef as b, useState as x } from "react";
3
+ import { DEFAULT_COMPATIFONT_CDN as oe, canReadInstalledFonts as se, compatifontCdnSource as ce, defineFOfficeDocsElement as le, fontFolder as ue, installedFonts as de, installedSource as fe, urlFontMode as pe } from "@f-office/docs";
4
+ import { clsx as me } from "clsx";
5
+ import { twMerge as S } from "tailwind-merge";
6
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
7
+ import { CheckIcon as E, ChevronRightIcon as D, CircleIcon as he, FileUpIcon as ge, ListIcon as O, MonitorIcon as _e, MoonIcon as ve, SunIcon as k, XIcon as ye } from "lucide-react";
8
+ import { ContextMenu as A, Dialog as j, Menubar as M } from "radix-ui";
9
+ // src/assets/logo-mark-dark.svg
10
+ var be = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%202346%20512'%20width='2346'%20height='512'%3e%3ctitle%3eF-Office%20logo%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%20transform='translate(256%20256)'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cpath%20id='wordmark'%20fill='%23FFFFFF'%20transform='translate(662.00%20421)%20scale(0.46348)'%20d='M1241%20-729%20C1135%20-729%201050%20-693%20984%20-623%20C918%20-552%20886%20-463%20886%20-356%20C886%20-246%20918%20-156%20983%20-87%20C1047%20-17%201134%2017%201243%2017%20C1348%2017%201432%20-18%201495%20-88%20C1558%20-158%201590%20-247%201590%20-355%20C1590%20-469%201558%20-559%201495%20-627%20C1431%20-695%201347%20-729%201241%20-729Z%20M1896.7%20-713%20C1827.7%20-713%201777.7%20-700%201746.7%20-674%20C1714.7%20-648%201699.7%20-603%201699.7%20-539%20V-516%20H1617.7%20V-404%20H1699.7%20V0%20H1869.7%20V-404%20H1923.6%20H1969.7%20H2005.6%20V0%20H2175.6%20V-404%20H2275.6%20V-516%20H2173.6%20V-547%20C2173.6%20-565%202177.6%20-577%202185.6%20-583%20C2193.6%20-589%202210.6%20-592%202235.6%20-592%20C2251.6%20-592%202267.6%20-591%202281.6%20-590%20L2282.6%20-711%20C2246.6%20-712%202219.6%20-713%202202.6%20-713%20C2133.6%20-713%202083.6%20-700%202052.6%20-674%20C2020.6%20-648%202005.6%20-603%202005.6%20-539%20V-516%20H1969.7%20H1923.6%20H1867.7%20V-547%20C1867.7%20-565%201871.7%20-577%201879.7%20-583%20C1887.7%20-589%201904.7%20-592%201929.7%20-592%20C1945.7%20-592%201961.7%20-591%201975.7%20-590%20L1976.7%20-711%20C1940.7%20-712%201913.7%20-713%201896.7%20-713Z%20M0%20-712%20V0%20H187%20V-274%20H481%20V-420%20H187%20V-557%20H526%20V-712Z%20M2316.6%20-712%20V-584%20H2486.6%20V-712Z%20M1239%20-577%20C1289%20-577%201328%20-558%201357%20-519%20C1385%20-481%201400%20-428%201400%20-360%20C1400%20-289%201386%20-234%201358%20-195%20C1330%20-155%201290%20-136%201240%20-136%20C1188%20-136%201148%20-155%201119%20-195%20C1090%20-234%201076%20-288%201076%20-357%20C1076%20-425%201090%20-478%201120%20-518%20C1149%20-558%201189%20-577%201239%20-577Z%20M2795.6%20-530%20C2713.6%20-530%202647.6%20-504%202597.6%20-454%20C2547.6%20-403%202522.6%20-336%202522.6%20-253%20C2522.6%20-173%202547.6%20-109%202597.6%20-60%20C2647.6%20-11%202712.6%2014%202792.6%2014%20C2867.6%2014%202927.6%20-5%202972.6%20-42%20C3017.6%20-80%203044.6%20-133%203053.6%20-202%20L2891.6%20-203%20C2880.6%20-143%202849.6%20-113%202797.6%20-113%20C2763.6%20-113%202738.6%20-125%202720.6%20-150%20C2702.6%20-174%202693.6%20-209%202693.6%20-255%20C2693.6%20-303%202702.6%20-340%202720.6%20-367%20C2738.6%20-393%202764.6%20-407%202797.6%20-407%20C2821.6%20-407%202840.6%20-400%202856.6%20-386%20C2872.6%20-372%202881.6%20-353%202885.6%20-328%20H3049.6%20C3045.6%20-389%203019.6%20-438%202973.6%20-475%20C2927.6%20-511%202867.6%20-530%202795.6%20-530Z%20M3358.1%20-529%20C3276.1%20-529%203210.1%20-503%203159.1%20-451%20C3107.1%20-399%203082.1%20-333%203082.1%20-252%20C3082.1%20-170%203108.1%20-104%203161.1%20-56%20C3214.1%20-8%203282.1%2016%203364.1%2016%20C3429.1%2016%203484.1%201%203529.1%20-29%20C3574.1%20-59%203605.1%20-101%203622.1%20-157%20H3463.1%20C3441.1%20-117%203408.1%20-97%203366.1%20-97%20C3330.1%20-97%203301.1%20-107%203280.1%20-128%20C3259.1%20-149%203248.1%20-179%203248.1%20-217%20H3632.1%20V-232%20C3632.1%20-324%203607.1%20-396%203558.1%20-449%20C3509.1%20-502%203442.1%20-529%203358.1%20-529Z%20M2316.6%20-516%20V0%20H2486.6%20V-516Z%20M537%20-420%20V-274%20H848%20V-420Z%20M3359.1%20-415%20C3390.1%20-415%203415.1%20-405%203433.1%20-387%20C3451.1%20-369%203462.1%20-344%203465.1%20-314%20H3250.1%20C3260.1%20-381%203297.1%20-415%203359.1%20-415Z'/%3e%3c/svg%3e", N = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%202346%20512'%20width='2346'%20height='512'%3e%3ctitle%3eF-Office%20logo%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%20transform='translate(256%20256)'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3cpath%20id='wordmark'%20fill='%231D1D1F'%20transform='translate(662.00%20421)%20scale(0.46348)'%20d='M1241%20-729%20C1135%20-729%201050%20-693%20984%20-623%20C918%20-552%20886%20-463%20886%20-356%20C886%20-246%20918%20-156%20983%20-87%20C1047%20-17%201134%2017%201243%2017%20C1348%2017%201432%20-18%201495%20-88%20C1558%20-158%201590%20-247%201590%20-355%20C1590%20-469%201558%20-559%201495%20-627%20C1431%20-695%201347%20-729%201241%20-729Z%20M1896.7%20-713%20C1827.7%20-713%201777.7%20-700%201746.7%20-674%20C1714.7%20-648%201699.7%20-603%201699.7%20-539%20V-516%20H1617.7%20V-404%20H1699.7%20V0%20H1869.7%20V-404%20H1923.6%20H1969.7%20H2005.6%20V0%20H2175.6%20V-404%20H2275.6%20V-516%20H2173.6%20V-547%20C2173.6%20-565%202177.6%20-577%202185.6%20-583%20C2193.6%20-589%202210.6%20-592%202235.6%20-592%20C2251.6%20-592%202267.6%20-591%202281.6%20-590%20L2282.6%20-711%20C2246.6%20-712%202219.6%20-713%202202.6%20-713%20C2133.6%20-713%202083.6%20-700%202052.6%20-674%20C2020.6%20-648%202005.6%20-603%202005.6%20-539%20V-516%20H1969.7%20H1923.6%20H1867.7%20V-547%20C1867.7%20-565%201871.7%20-577%201879.7%20-583%20C1887.7%20-589%201904.7%20-592%201929.7%20-592%20C1945.7%20-592%201961.7%20-591%201975.7%20-590%20L1976.7%20-711%20C1940.7%20-712%201913.7%20-713%201896.7%20-713Z%20M0%20-712%20V0%20H187%20V-274%20H481%20V-420%20H187%20V-557%20H526%20V-712Z%20M2316.6%20-712%20V-584%20H2486.6%20V-712Z%20M1239%20-577%20C1289%20-577%201328%20-558%201357%20-519%20C1385%20-481%201400%20-428%201400%20-360%20C1400%20-289%201386%20-234%201358%20-195%20C1330%20-155%201290%20-136%201240%20-136%20C1188%20-136%201148%20-155%201119%20-195%20C1090%20-234%201076%20-288%201076%20-357%20C1076%20-425%201090%20-478%201120%20-518%20C1149%20-558%201189%20-577%201239%20-577Z%20M2795.6%20-530%20C2713.6%20-530%202647.6%20-504%202597.6%20-454%20C2547.6%20-403%202522.6%20-336%202522.6%20-253%20C2522.6%20-173%202547.6%20-109%202597.6%20-60%20C2647.6%20-11%202712.6%2014%202792.6%2014%20C2867.6%2014%202927.6%20-5%202972.6%20-42%20C3017.6%20-80%203044.6%20-133%203053.6%20-202%20L2891.6%20-203%20C2880.6%20-143%202849.6%20-113%202797.6%20-113%20C2763.6%20-113%202738.6%20-125%202720.6%20-150%20C2702.6%20-174%202693.6%20-209%202693.6%20-255%20C2693.6%20-303%202702.6%20-340%202720.6%20-367%20C2738.6%20-393%202764.6%20-407%202797.6%20-407%20C2821.6%20-407%202840.6%20-400%202856.6%20-386%20C2872.6%20-372%202881.6%20-353%202885.6%20-328%20H3049.6%20C3045.6%20-389%203019.6%20-438%202973.6%20-475%20C2927.6%20-511%202867.6%20-530%202795.6%20-530Z%20M3358.1%20-529%20C3276.1%20-529%203210.1%20-503%203159.1%20-451%20C3107.1%20-399%203082.1%20-333%203082.1%20-252%20C3082.1%20-170%203108.1%20-104%203161.1%20-56%20C3214.1%20-8%203282.1%2016%203364.1%2016%20C3429.1%2016%203484.1%201%203529.1%20-29%20C3574.1%20-59%203605.1%20-101%203622.1%20-157%20H3463.1%20C3441.1%20-117%203408.1%20-97%203366.1%20-97%20C3330.1%20-97%203301.1%20-107%203280.1%20-128%20C3259.1%20-149%203248.1%20-179%203248.1%20-217%20H3632.1%20V-232%20C3632.1%20-324%203607.1%20-396%203558.1%20-449%20C3509.1%20-502%203442.1%20-529%203358.1%20-529Z%20M2316.6%20-516%20V0%20H2486.6%20V-516Z%20M537%20-420%20V-274%20H848%20V-420Z%20M3359.1%20-415%20C3390.1%20-415%203415.1%20-405%203433.1%20-387%20C3451.1%20-369%203462.1%20-344%203465.1%20-314%20H3250.1%20C3260.1%20-381%203297.1%20-415%203359.1%20-415Z'/%3e%3c/svg%3e", xe = 5e7, Se = 400, Ce = {
11
+ kept: "Kept in this browser until you close it",
12
+ "too-large": `Not kept across a reload: larger than ${String(xe / 1e6)} MB`,
13
+ failed: "Not kept across a reload: the browser's storage is blocked or full"
14
+ };
15
+ function P(e) {
16
+ return new TextEncoder().encode(JSON.stringify(e)).slice().buffer;
17
+ }
18
+ function we(e) {
19
+ return e === null ? null : JSON.parse(new TextDecoder().decode(e));
20
+ }
21
+ function F(e) {
22
+ let t = we(e);
23
+ return typeof t == "string" ? t : null;
24
+ }
25
+ function I(e) {
26
+ let t = we(e);
27
+ return t === null ? null : ee(t);
28
+ }
29
+ var L = class {
30
+ #e;
31
+ #t;
32
+ #n = Promise.resolve();
33
+ #r = !1;
34
+ #i = null;
35
+ #a = void 0;
36
+ constructor(e, t = 400) {
37
+ this.#e = e.catch(() => null), this.#t = t;
38
+ }
39
+ load() {
40
+ return this.#s(null, async (e) => {
41
+ let t = F(await e.read("name")), n = await e.read("bytes");
42
+ return t === null || n === null ? null : (this.#r = !0, {
43
+ name: t,
44
+ bytes: n,
45
+ view: I(await e.read("view"))
46
+ });
47
+ });
48
+ }
49
+ keep(e, t) {
50
+ return this.#o(), this.#r = !1, t.byteLength > 5e7 ? this.forget().then(() => "too-large") : this.#s("failed", async (n) => (await n.remove("name"), await n.remove("view"), await n.write("bytes", t.slice(0)), await n.write("name", P(e)), this.#r = !0, "kept"));
51
+ }
52
+ keepView(e) {
53
+ this.#o(), this.#i = e, this.#a = setTimeout(() => void this.flush(), this.#t);
54
+ }
55
+ flush() {
56
+ let e = this.#i;
57
+ return this.#o(), this.#s(void 0, async (t) => {
58
+ e && this.#r && await t.write("view", P(e));
59
+ });
60
+ }
61
+ forget() {
62
+ return this.#o(), this.#r = !1, this.#s(void 0, async (e) => {
63
+ for (let t of [
64
+ "name",
65
+ "view",
66
+ "bytes"
67
+ ]) await e.remove(t);
68
+ });
69
+ }
70
+ #o() {
71
+ clearTimeout(this.#a), this.#a = void 0, this.#i = null;
72
+ }
73
+ #s(e, t) {
74
+ let n = this.#n.then(async () => {
75
+ let n = await this.#e;
76
+ return n ? await t(n) : e;
77
+ }).catch(() => e);
78
+ return this.#n = n, n;
79
+ }
80
+ };
81
+ function R(e) {
82
+ return e instanceof DOMException && e.name === "NotFoundError";
83
+ }
84
+ function z(e) {
85
+ let t = (e) => `${e}.bin`;
86
+ return {
87
+ read: async (n) => {
88
+ try {
89
+ return await (await (await e.getFileHandle(t(n))).getFile()).arrayBuffer();
90
+ } catch (e) {
91
+ if (R(e)) return null;
92
+ throw e;
93
+ }
94
+ },
95
+ write: async (n, r) => {
96
+ let i = await (await e.getFileHandle(t(n), { create: !0 })).createWritable();
97
+ await i.write(r), await i.close();
98
+ },
99
+ remove: async (n) => {
100
+ await e.removeEntry(t(n)).catch((e) => {
101
+ if (!R(e)) throw e;
102
+ });
103
+ }
104
+ };
105
+ }
106
+ var B = "f-office-viewer", V = "kept";
107
+ function Te(e) {
108
+ let t = (t, n) => new Promise((r, i) => {
109
+ let a = e.transaction(V, t), o = n(a.objectStore(V));
110
+ a.oncomplete = () => {
111
+ r(o.result);
112
+ }, a.onerror = a.onabort = () => {
113
+ i(a.error ?? /* @__PURE__ */ Error("the browser's storage refused"));
114
+ };
115
+ });
116
+ return {
117
+ read: async (e) => {
118
+ let n = await t("readonly", (t) => t.get(e));
119
+ return n instanceof ArrayBuffer ? n : null;
120
+ },
121
+ write: async (e, n) => {
122
+ await t("readwrite", (t) => t.put(n, e));
123
+ },
124
+ remove: async (e) => {
125
+ await t("readwrite", (t) => t.delete(e));
126
+ }
127
+ };
128
+ }
129
+ function H(e) {
130
+ return new Promise((t) => {
131
+ let n = e.open(B, 1);
132
+ n.onupgradeneeded = () => {
133
+ n.result.createObjectStore(V);
134
+ }, n.onsuccess = () => {
135
+ t(n.result);
136
+ }, n.onerror = () => {
137
+ t(null);
138
+ };
139
+ });
140
+ }
141
+ async function U() {
142
+ try {
143
+ if (typeof FileSystemFileHandle < "u" && "createWritable" in FileSystemFileHandle.prototype) return z(await (await navigator.storage.getDirectory()).getDirectoryHandle(B, { create: !0 }));
144
+ } catch {}
145
+ try {
146
+ if (typeof indexedDB < "u") {
147
+ let e = await H(indexedDB);
148
+ return e && Te(e);
149
+ }
150
+ } catch {
151
+ return null;
152
+ }
153
+ return null;
154
+ }
155
+ // src/page-keys.ts
156
+ function Ee(e, t) {
157
+ let n = e.composedPath(), r = n[0];
158
+ return {
159
+ inViewer: t !== null && n.includes(t),
160
+ inField: r instanceof HTMLInputElement || r instanceof HTMLSelectElement || r instanceof HTMLTextAreaElement,
161
+ inDialog: n.some((e) => e instanceof Element && e.getAttribute("role") === "dialog")
162
+ };
163
+ }
164
+ function De(e, t) {
165
+ let n = e.target === document.body || e.target === document.documentElement, r = !(e.ctrlKey || e.metaKey || e.altKey);
166
+ return !t || !n || !r || !t.scrollByKey(e.key, e.shiftKey) ? !1 : (t.focus(), !0);
167
+ }
168
+ function Oe(e, t) {
169
+ let n = v((n) => {
170
+ if (n.defaultPrevented) return;
171
+ let r = t.current;
172
+ if (De(n, r)) {
173
+ n.preventDefault();
174
+ return;
175
+ }
176
+ let i = f(n, Ee(n, r));
177
+ i !== null && e.takes(i) && (n.preventDefault(), e.run(i));
178
+ });
179
+ _(() => (window.addEventListener("keydown", n), () => {
180
+ window.removeEventListener("keydown", n);
181
+ }), []);
182
+ }
183
+ // src/theme.ts
184
+ var W = [
185
+ "system",
186
+ "light",
187
+ "dark"
188
+ ], G = {
189
+ system: "System",
190
+ light: "Light",
191
+ dark: "Dark"
192
+ }, K = "f-office-viewer:theme", q = () => window.localStorage;
193
+ function ke(e) {
194
+ return W.includes(e);
195
+ }
196
+ function Ae(e = q, t = K) {
197
+ try {
198
+ let n = e().getItem(t);
199
+ return ke(n) ? n : "system";
200
+ } catch {
201
+ return "system";
202
+ }
203
+ }
204
+ function je(e, t = q, n = K) {
205
+ try {
206
+ t().setItem(n, e);
207
+ } catch {}
208
+ }
209
+ function Me(e, t = document.documentElement) {
210
+ e === "system" ? delete t.dataset.theme : t.dataset.theme = e;
211
+ }
212
+ function Ne(e) {
213
+ return W[(W.indexOf(e) + 1) % W.length] ?? "system";
214
+ }
215
+ // src/ui/utils.ts
216
+ function J(...e) {
217
+ return S(me(e));
218
+ }
219
+ // src/url-file.ts
220
+ var Pe = "file";
221
+ function Fe(e, t) {
222
+ return `The address names a file on ${e.origin}. F-Office Docs opens files only from ${t.origin}, the site of this page.`;
223
+ }
224
+ function Ie(e, t) {
225
+ let n = new URLSearchParams(e).get(Pe);
226
+ if (n === null || n === "") return null;
227
+ let r = new URL(t), i;
228
+ try {
229
+ i = new URL(n, r);
230
+ } catch {
231
+ return {
232
+ kind: "refused",
233
+ why: `"${n}" is not an address.`
234
+ };
235
+ }
236
+ return i.origin === r.origin ? {
237
+ kind: "address",
238
+ address: i
239
+ } : {
240
+ kind: "refused",
241
+ why: Fe(i, r)
242
+ };
243
+ }
244
+ function Y(e) {
245
+ let t = e.pathname.split("/").pop() ?? "", n = t;
246
+ try {
247
+ n = decodeURIComponent(t);
248
+ } catch {}
249
+ return n || "document.docx";
250
+ }
251
+ async function X(e, t, n = fetch) {
252
+ let r = await n(e.href, t ? { signal: t } : {}), i = r.url ? new URL(r.url) : e;
253
+ if (i.origin !== e.origin) throw Error(Fe(i, e));
254
+ if (!r.ok) throw Error(`The file ${Y(e)} cannot be read: the server answered HTTP ${String(r.status)}.`);
255
+ return {
256
+ name: Y(e),
257
+ bytes: await r.arrayBuffer()
258
+ };
259
+ }
260
+ function Le() {
261
+ let e = new URLSearchParams(window.location.search);
262
+ if (!e.has("file")) return;
263
+ e.delete(Pe);
264
+ let t = e.toString();
265
+ window.history.replaceState(null, "", t ? `?${t}` : window.location.pathname);
266
+ }
267
+ function Re(e) {
268
+ return e instanceof Error ? e.message : String(e);
269
+ }
270
+ function ze(e, t, n) {
271
+ let r = v(t), i = v(n);
272
+ _(() => {
273
+ if (e?.kind === "refused" && i(e.why), e?.kind !== "address") return;
274
+ let t = new AbortController();
275
+ return X(e.address, t.signal).then((e) => {
276
+ r(e);
277
+ }, (e) => {
278
+ t.signal.aborted || i(Re(e));
279
+ }), () => {
280
+ t.abort();
281
+ };
282
+ }, [e]);
283
+ }
284
+ // src/docs-provider.tsx
285
+ var Be = null;
286
+ function Ve() {
287
+ return Be ||= new L(U()), Be;
288
+ }
289
+ var He = {
290
+ selected: !1,
291
+ outline: !1,
292
+ zoom: "fixed:1",
293
+ zoomSteps: [],
294
+ page: 0,
295
+ pageCount: 0
296
+ };
297
+ function Ue(e) {
298
+ return e.zoom === "fixed" ? c(e.factor) : e.zoom;
299
+ }
300
+ function We(e) {
301
+ return `The installed fonts cannot be read (${e instanceof Error ? e.message : String(e)}), so the pages use the open fonts.`;
302
+ }
303
+ function Ge(e) {
304
+ let t = URL.createObjectURL(new Blob([e.bytes])), n = document.createElement("a");
305
+ n.href = t, n.download = e.name, n.click(), URL.revokeObjectURL(t);
306
+ }
307
+ var Ke = m(null);
308
+ function qe() {
309
+ let e = h(Ke);
310
+ if (!e) throw Error("useDocs must be used inside a <DocsProvider>");
311
+ return e;
312
+ }
313
+ function Z() {
314
+ return qe().publicValue;
315
+ }
316
+ function Je() {
317
+ return qe().internal;
318
+ }
319
+ function Ye({ children: e, keeper: n, fontCdnUrl: r = oe, fontFolderUrl: a, fontSource: o, moduleUrls: c, theme: l, onThemeChange: u, applyDocumentTheme: d = !0, themeStorageKey: f = K, syncDocumentTitle: ee = !1, readUrlParams: p = !0, initialFile: m, initialUrl: h, className: me }) {
320
+ le();
321
+ let S = n === void 0 ? Ve() : n, C = b(null), E = b(null), [D, he] = x(() => p ? ae(window.location.search) : "word-win"), [ge] = x(() => h ? Ie(`?${Pe}=${encodeURIComponent(h)}`, window.location.href) : p ? Ie(window.location.search, window.location.href) : null), [O, _e] = x(null), [ve, k] = x(null), [ye, A] = x(0), [j, M] = x(!1), [be, N] = x(null), [xe, Se] = x(() => Ae(void 0, f)), P = l ?? xe, we = g((e) => {
322
+ l === void 0 && (je(e, void 0, f), Se(e)), u?.(e);
323
+ }, [
324
+ l,
325
+ u,
326
+ f
327
+ ]);
328
+ _(() => {
329
+ d && Me(P);
330
+ }, [P, d]);
331
+ let [F, I] = x(() => p ? pe(window.location.search) : "open"), [L, R] = x(null), [z, B] = x(He), [V, Te] = x(null), H = y(() => {
332
+ if (o) return o;
333
+ let e = a ? ue(typeof a == "string" ? new URL(a, document.baseURI) : a, F === "installed" ? "installed" : "open") : ce(r);
334
+ return F === "installed" && L ? fe(L, e) : e;
335
+ }, [
336
+ o,
337
+ a,
338
+ r,
339
+ F,
340
+ L
341
+ ]), U = g(({ name: e, bytes: t }) => {
342
+ _e({
343
+ name: e,
344
+ bytes: t,
345
+ view: null
346
+ }), k(null), S && S.keep(e, t).then((e) => {
347
+ k(Ce[e]);
348
+ });
349
+ }, [S]);
350
+ ze(ge, U, g((e) => {
351
+ N({ problem: e });
352
+ }, [])), _(() => {
353
+ if (!m) return;
354
+ let e = !0;
355
+ return m.arrayBuffer().then((t) => {
356
+ e && U({
357
+ name: m.name,
358
+ bytes: t
359
+ });
360
+ }), () => {
361
+ e = !1;
362
+ };
363
+ }, [m, U]), _(() => {
364
+ if (!S) return;
365
+ S.load().then((e) => {
366
+ e && ge?.kind !== "address" && !m && (_e((t) => t ?? e), k((e) => e ?? Ce.kept));
367
+ });
368
+ let e = () => void S.flush();
369
+ return window.addEventListener("pagehide", e), () => {
370
+ window.removeEventListener("pagehide", e);
371
+ };
372
+ }, [
373
+ S,
374
+ ge,
375
+ m
376
+ ]), _(() => {
377
+ F !== "installed" || L || de().then(R, (e) => {
378
+ I("open"), k(We(e));
379
+ });
380
+ }, [F, L]);
381
+ let [Ee, De] = x(0), W = v((e) => {
382
+ let t = e.detail;
383
+ S?.keepView(t), B((e) => ({
384
+ ...e,
385
+ zoom: Ue(t)
386
+ }));
387
+ }), G = v((e) => {
388
+ let { pageCount: t, zoomSteps: n } = e.detail;
389
+ B((e) => ({
390
+ ...e,
391
+ pageCount: t,
392
+ zoomSteps: n,
393
+ page: 0
394
+ }));
395
+ }), q = v((e) => {
396
+ let { page: t } = e.detail;
397
+ B((e) => ({
398
+ ...e,
399
+ page: t
400
+ }));
401
+ }), ke = v((e) => {
402
+ let { open: t } = e.detail;
403
+ B((e) => ({
404
+ ...e,
405
+ outline: t
406
+ }));
407
+ }), Ne = v((e) => {
408
+ let { selected: t } = e.detail;
409
+ B((e) => ({
410
+ ...e,
411
+ selected: t
412
+ }));
413
+ }), Fe = v((e) => {
414
+ e.preventDefault(), Te(e.detail);
415
+ }), Y = g((e) => (E.current = e, De((e) => e + 1), () => {
416
+ E.current = null, B(He);
417
+ }), []);
418
+ _(() => {
419
+ let e = E.current;
420
+ if (e) return e.addEventListener("viewchange", W), e.addEventListener("open", G), e.addEventListener("pagechange", q), e.addEventListener("outlinechange", ke), e.addEventListener("selectionchange", Ne), e.addEventListener("menu", Fe), () => {
421
+ e.removeEventListener("viewchange", W), e.removeEventListener("open", G), e.removeEventListener("pagechange", q), e.removeEventListener("outlinechange", ke), e.removeEventListener("selectionchange", Ne), e.removeEventListener("menu", Fe);
422
+ };
423
+ }, [Ee]), _(() => {
424
+ let e = E.current;
425
+ if (e && (F !== "installed" || L) && (e.target = D, e.fontSource = H, O)) {
426
+ let { view: n } = O;
427
+ e.open(O.bytes, O.name).then(() => {
428
+ n ? e.showView(n) : e.clientWidth < t && e.setZoom("fit-width");
429
+ }, () => void 0);
430
+ }
431
+ }, [
432
+ Ee,
433
+ D,
434
+ O,
435
+ ye,
436
+ F,
437
+ L,
438
+ H
439
+ ]), _(() => {
440
+ ee && (document.title = O ? `${O.name} — F-Office Docs` : "F-Office Docs");
441
+ }, [O, ee]);
442
+ let X = g((e) => {
443
+ e && e.arrayBuffer().then((t) => {
444
+ p && Le(), U({
445
+ name: e.name,
446
+ bytes: t
447
+ });
448
+ });
449
+ }, [p, U]), Re = g((e) => {
450
+ let t = E.current;
451
+ switch (e) {
452
+ case "open":
453
+ C.current?.click();
454
+ return;
455
+ case "print":
456
+ if (t) {
457
+ let e = te();
458
+ t.pdf().then(e.print, e.cancel);
459
+ }
460
+ return;
461
+ case "download":
462
+ O && Ge(O);
463
+ return;
464
+ case "close":
465
+ p && Le(), S?.forget(), _e(null), k(null), A((e) => e + 1);
466
+ return;
467
+ case "copy":
468
+ t?.copyText(null);
469
+ return;
470
+ case "select-all":
471
+ t?.selectAll();
472
+ return;
473
+ case "find":
474
+ t?.find();
475
+ return;
476
+ case "zoom-in":
477
+ t?.zoomStep(!0);
478
+ return;
479
+ case "zoom-out":
480
+ t?.zoomStep(!1);
481
+ return;
482
+ case "actual-size":
483
+ t?.setZoom("fixed", 1);
484
+ return;
485
+ case "advanced":
486
+ N("advanced");
487
+ return;
488
+ case "shortcuts":
489
+ N("shortcuts");
490
+ return;
491
+ case "about":
492
+ N("about");
493
+ return;
494
+ default: return;
495
+ }
496
+ }, [
497
+ O,
498
+ S,
499
+ p
500
+ ]);
501
+ Oe({
502
+ takes: (e) => i(e, O !== null, z.selected),
503
+ run: Re
504
+ }, E);
505
+ let Be = g((e) => {
506
+ he(e), p && re(e);
507
+ }, [p]), qe = g(() => {
508
+ N(null);
509
+ }, []), Z = y(() => ({
510
+ run: Re,
511
+ setOutline: (e) => {
512
+ E.current && (E.current.outlineOpen = e);
513
+ },
514
+ setZoom: (e) => {
515
+ let { zoom: t, factor: n } = ne(e);
516
+ E.current?.setZoom(t, n);
517
+ },
518
+ setTheme: we,
519
+ setFonts: (e) => {
520
+ e === "open" ? (p && ie("fonts", e), I(e)) : de().then((t) => {
521
+ p && ie("fonts", e), R(t), I(e);
522
+ }, (e) => {
523
+ k(We(e));
524
+ });
525
+ },
526
+ focusPages: () => {
527
+ E.current?.focus();
528
+ }
529
+ }), [
530
+ Re,
531
+ we,
532
+ p
533
+ ]), Je = y(() => ({
534
+ ...z,
535
+ name: O?.name ?? null,
536
+ note: ve,
537
+ theme: P,
538
+ fonts: F,
539
+ installedFonts: se()
540
+ }), [
541
+ z,
542
+ O,
543
+ ve,
544
+ P,
545
+ F
546
+ ]), Ye = y(() => ({
547
+ publicValue: {
548
+ state: Je,
549
+ calls: Z,
550
+ openFile: X,
551
+ elementRef: E,
552
+ target: D,
553
+ setTarget: Be,
554
+ dialog: be,
555
+ closeDialog: qe
556
+ },
557
+ internal: {
558
+ file: O,
559
+ dragging: j,
560
+ generation: ye,
561
+ menu: V,
562
+ moduleUrls: c,
563
+ attachElement: Y
564
+ }
565
+ }), [
566
+ Je,
567
+ Z,
568
+ X,
569
+ D,
570
+ Be,
571
+ be,
572
+ qe,
573
+ O,
574
+ j,
575
+ ye,
576
+ V,
577
+ c,
578
+ Y
579
+ ]);
580
+ return /* @__PURE__ */ w(Ke, {
581
+ value: Ye,
582
+ children: /* @__PURE__ */ T("div", {
583
+ "data-f-office-theme": P,
584
+ className: J("f-office-docs-root flex h-full min-h-0 flex-col bg-background text-foreground", me),
585
+ onDragOver: (e) => {
586
+ e.preventDefault(), M(!0);
587
+ },
588
+ onDragLeave: () => {
589
+ M(!1);
590
+ },
591
+ onDrop: (e) => {
592
+ e.preventDefault(), M(!1), X(s(e.dataTransfer.files));
593
+ },
594
+ children: [e, /* @__PURE__ */ w("input", {
595
+ ref: C,
596
+ className: "hidden",
597
+ type: "file",
598
+ accept: ".docx",
599
+ "aria-label": "DOCX file",
600
+ onChange: (e) => {
601
+ X(s(e.target.files)), e.target.value = "";
602
+ }
603
+ })]
604
+ })
605
+ });
606
+ }
607
+ // src/ui/dialog.tsx
608
+ var Xe = j.Root;
609
+ function Ze({ className: e, children: t, ...n }) {
610
+ return /* @__PURE__ */ T(j.Portal, { children: [/* @__PURE__ */ w(j.Overlay, { className: "fixed inset-0 z-50 bg-black/40" }), /* @__PURE__ */ T(j.Content, {
611
+ "data-slot": "dialog-content",
612
+ className: J("fixed top-1/2 left-1/2 z-50 grid w-[min(28rem,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover p-6 text-popover-foreground shadow-xl", e),
613
+ ...n,
614
+ children: [t, /* @__PURE__ */ w(j.Close, {
615
+ className: "absolute top-4 right-4 rounded-full p-1 text-muted-foreground hover:bg-accent",
616
+ "aria-label": "Close",
617
+ children: /* @__PURE__ */ w(ye, { className: "size-4" })
618
+ })]
619
+ })] });
620
+ }
621
+ function Qe({ className: e, ...t }) {
622
+ return /* @__PURE__ */ w(j.Title, {
623
+ "data-slot": "dialog-title",
624
+ className: J("text-lg font-medium", e),
625
+ ...t
626
+ });
627
+ }
628
+ function $e({ className: e, ...t }) {
629
+ return /* @__PURE__ */ w(j.Description, {
630
+ "data-slot": "dialog-description",
631
+ className: J("text-sm text-muted-foreground", e),
632
+ ...t
633
+ });
634
+ }
635
+ // src/dialogs.tsx
636
+ function et({ className: e }) {
637
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("img", {
638
+ src: N,
639
+ alt: "F-Office",
640
+ className: `f-office-logo-light ${e}`
641
+ }), /* @__PURE__ */ w("img", {
642
+ src: be,
643
+ alt: "F-Office",
644
+ className: `f-office-logo-dark ${e}`
645
+ })] });
646
+ }
647
+ function tt() {
648
+ let e = a(navigator.userAgent);
649
+ return /* @__PURE__ */ T(C, { children: [
650
+ /* @__PURE__ */ w(Qe, { children: "Keyboard shortcuts" }),
651
+ /* @__PURE__ */ w($e, { children: "Click the pages first, so that the keys of the text reach the document." }),
652
+ /* @__PURE__ */ w("table", {
653
+ className: "text-sm",
654
+ children: /* @__PURE__ */ w("tbody", { children: p(e).map(([e, t]) => /* @__PURE__ */ T("tr", {
655
+ className: "border-t border-border",
656
+ children: [/* @__PURE__ */ w("td", {
657
+ className: "py-1.5 pr-4 font-mono text-xs",
658
+ children: e
659
+ }), /* @__PURE__ */ w("td", {
660
+ className: "py-1.5",
661
+ children: t
662
+ })]
663
+ }, e)) })
664
+ })
665
+ ] });
666
+ }
667
+ function nt() {
668
+ return /* @__PURE__ */ T(C, { children: [
669
+ /* @__PURE__ */ w(Qe, {
670
+ className: "sr-only",
671
+ children: "About F-Office"
672
+ }),
673
+ /* @__PURE__ */ w(et, { className: "h-8 w-auto self-start" }),
674
+ /* @__PURE__ */ w($e, { children: "F-Office draws the pages of DOCX files as Word lays them out, in your browser. The file that you open stays in this browser." })
675
+ ] });
676
+ }
677
+ function rt({ why: e }) {
678
+ return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Qe, { children: "The file cannot be opened" }), /* @__PURE__ */ w($e, { children: e })] });
679
+ }
680
+ function it({ target: e, setTarget: t }) {
681
+ return /* @__PURE__ */ T(C, { children: [
682
+ /* @__PURE__ */ w(Qe, { children: "Advanced settings" }),
683
+ /* @__PURE__ */ w($e, { children: "Target: which Word the layout copies. Not ready yet: this setting exists only for testing." }),
684
+ /* @__PURE__ */ T("label", {
685
+ className: "flex items-center gap-3 text-sm",
686
+ children: ["Target", /* @__PURE__ */ w("select", {
687
+ className: "h-9 rounded-md border border-border bg-transparent px-2",
688
+ value: e,
689
+ onChange: (e) => {
690
+ t(e.target.value);
691
+ },
692
+ children: n.map((e) => /* @__PURE__ */ w("option", {
693
+ value: e.id,
694
+ children: e.label
695
+ }, e.id))
696
+ })]
697
+ })
698
+ ] });
699
+ }
700
+ function at() {
701
+ let { dialog: e, closeDialog: t, calls: n, target: r, setTarget: i } = Z();
702
+ return /* @__PURE__ */ w(Xe, {
703
+ open: e !== null,
704
+ onOpenChange: (e) => {
705
+ e || t();
706
+ },
707
+ children: /* @__PURE__ */ T(Ze, {
708
+ onCloseAutoFocus: (e) => {
709
+ e.preventDefault(), n.focusPages();
710
+ },
711
+ children: [
712
+ e === "shortcuts" && /* @__PURE__ */ w(tt, {}),
713
+ e === "about" && /* @__PURE__ */ w(nt, {}),
714
+ e === "advanced" && /* @__PURE__ */ w(it, {
715
+ target: r,
716
+ setTarget: i
717
+ }),
718
+ typeof e == "object" && !!e && /* @__PURE__ */ w(rt, { why: e.problem })
719
+ ]
720
+ })
721
+ });
722
+ }
723
+ // src/ui/context-menu.tsx
724
+ var ot = "relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", st = "z-50 min-w-48 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg", ct = A.Root, lt = A.Trigger;
725
+ function ut({ className: e, ...t }) {
726
+ return /* @__PURE__ */ w(A.Portal, { children: /* @__PURE__ */ w(A.Content, {
727
+ "data-slot": "context-menu-content",
728
+ className: J(st, e),
729
+ ...t
730
+ }) });
731
+ }
732
+ function dt({ className: e, ...t }) {
733
+ return /* @__PURE__ */ w(A.Item, {
734
+ "data-slot": "context-menu-item",
735
+ className: J(ot, e),
736
+ ...t
737
+ });
738
+ }
739
+ function ft({ className: e, ...t }) {
740
+ return /* @__PURE__ */ w(A.Separator, {
741
+ "data-slot": "context-menu-separator",
742
+ className: J("-mx-1 my-1 h-px bg-border", e),
743
+ ...t
744
+ });
745
+ }
746
+ // src/ui/menu-shortcut.tsx
747
+ function pt({ className: e, ...t }) {
748
+ return /* @__PURE__ */ w("span", {
749
+ "data-slot": "menu-shortcut",
750
+ "aria-hidden": "true",
751
+ className: J("ml-auto pl-6 text-xs tracking-widest text-muted-foreground", e),
752
+ ...t
753
+ });
754
+ }
755
+ // src/page-menu.tsx
756
+ function mt(t, n, i) {
757
+ let o = a(navigator.userAgent), s = l(t, o)[0];
758
+ return {
759
+ name: e[t].name,
760
+ key: s,
761
+ aria: r(t, o),
762
+ disabled: n,
763
+ run: i
764
+ };
765
+ }
766
+ function ht(e) {
767
+ let t = e?.link ?? null, n = t && o(t), r = [];
768
+ return t && r.push({
769
+ name: "Open link",
770
+ key: void 0,
771
+ aria: void 0,
772
+ disabled: !1,
773
+ run: (e) => {
774
+ e.followLink(t);
775
+ }
776
+ }), n !== null && r.push({
777
+ name: "Copy link",
778
+ key: void 0,
779
+ aria: void 0,
780
+ disabled: !1,
781
+ run: (e) => {
782
+ e.copyText(n);
783
+ }
784
+ }), [
785
+ ...r,
786
+ ...t ? [null] : [],
787
+ mt("copy", !e?.selected, (e) => {
788
+ e.copyText(null);
789
+ }),
790
+ mt("select-all", !1, (e) => {
791
+ e.selectAll();
792
+ })
793
+ ];
794
+ }
795
+ function gt({ request: e, elementRef: t }) {
796
+ let n = b(null), r = b(null), i = b(null);
797
+ return _(() => {
798
+ if (e) {
799
+ let r = t.current?.shadowRoot?.activeElement ?? null;
800
+ i.current = r instanceof HTMLElement && u(r) ? r : null, n.current?.dispatchEvent(new MouseEvent("contextmenu", {
801
+ bubbles: !0,
802
+ cancelable: !0,
803
+ clientX: e.x,
804
+ clientY: e.y
805
+ }));
806
+ }
807
+ }, [e, t]), /* @__PURE__ */ T(ct, { children: [/* @__PURE__ */ w(lt, {
808
+ ref: n,
809
+ className: "hidden"
810
+ }), /* @__PURE__ */ w(ut, {
811
+ "aria-label": "Page",
812
+ onContextMenu: (e) => {
813
+ e.preventDefault();
814
+ },
815
+ onCloseAutoFocus: (e) => {
816
+ e.preventDefault();
817
+ let n = t.current, a = r.current;
818
+ r.current = null;
819
+ let o = i.current;
820
+ i.current = null, o?.isConnected ? o.focus() : n?.focus(), n && a?.(n);
821
+ },
822
+ children: ht(e).map((e) => e === null ? /* @__PURE__ */ w(ft, {}, "separator") : /* @__PURE__ */ T(dt, {
823
+ disabled: e.disabled,
824
+ "aria-keyshortcuts": e.aria,
825
+ onSelect: () => {
826
+ r.current = e.run;
827
+ },
828
+ children: [e.name, e.key !== void 0 && /* @__PURE__ */ w(pt, { children: e.key })]
829
+ }, e.name))
830
+ })] });
831
+ }
832
+ // src/start.tsx
833
+ function _t() {
834
+ let { calls: e } = Z();
835
+ return /* @__PURE__ */ T("div", {
836
+ className: "flex h-full flex-col items-center justify-center gap-10 overflow-auto p-6",
837
+ children: [/* @__PURE__ */ w(et, { className: "h-10 w-auto sm:h-14" }), /* @__PURE__ */ T("button", {
838
+ type: "button",
839
+ className: "flex w-full max-w-xl flex-col items-center gap-3 rounded-2xl border-2 border-dashed border-border bg-[var(--drop)] px-6 py-14 text-center hover:border-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
840
+ onClick: () => {
841
+ e.run("open");
842
+ },
843
+ children: [
844
+ /* @__PURE__ */ w(ge, {
845
+ className: "size-10 text-primary",
846
+ "aria-hidden": "true"
847
+ }),
848
+ /* @__PURE__ */ w("span", {
849
+ className: "text-lg font-medium",
850
+ children: "Open a DOCX file or drop it here"
851
+ }),
852
+ /* @__PURE__ */ w("span", {
853
+ className: "text-sm text-muted-foreground",
854
+ children: "The file stays in this browser."
855
+ })
856
+ ]
857
+ })]
858
+ });
859
+ }
860
+ // src/docs-canvas.tsx
861
+ function vt({ emptyState: e, className: t }) {
862
+ let { elementRef: n } = Z(), { file: r, dragging: i, generation: a, menu: o, moduleUrls: s, attachElement: c } = Je();
863
+ return /* @__PURE__ */ T("main", {
864
+ className: J("relative min-h-0 flex-1", t),
865
+ children: [
866
+ /* @__PURE__ */ w("div", {
867
+ className: r === null ? "hidden" : "f-office-docs-holder h-full",
868
+ children: /* @__PURE__ */ w("f-office-docs", {
869
+ ref: c,
870
+ chrome: "none",
871
+ className: "h-full",
872
+ ...s?.module ? { module: s.module } : {},
873
+ ...s?.wasm ? { wasm: s.wasm } : {},
874
+ ...s?.dictionaries ? { dictionaries: s.dictionaries } : {}
875
+ }, a)
876
+ }),
877
+ /* @__PURE__ */ w(gt, {
878
+ request: o,
879
+ elementRef: n
880
+ }),
881
+ r === null && (e ?? /* @__PURE__ */ w(_t, {})),
882
+ i && /* @__PURE__ */ w("div", {
883
+ className: "pointer-events-none absolute inset-0 grid place-items-center bg-background/85 text-lg font-medium",
884
+ children: "Drop the file to open it"
885
+ })
886
+ ]
887
+ });
888
+ }
889
+ // src/assets/mark.svg
890
+ var yt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='-256%20-256%20512%20512'%20width='512'%20height='512'%3e%3ctitle%3eF-Office%20mark%3c/title%3e%3cdefs%3e%3c!--%20One%20puzzle%20piece%20(the%20top-left%20one),%20origin%20at%20the%20puzzle%20center.%20The%20other%20three%20pieces%20are%20this%20outline%20rotated%20by%2090,%20180,%20270.%20--%3e%3cpath%20id='piece'%20d='M-134%20-256%20H-3%20A2.5%202.5%200%200%201%20-0.5%20-253.5%20V-185.97%20A17.5%2017.5%200%200%200%2022.45%20-169.34%20A43.5%2043.5%200%201%201%2022.45%20-86.66%20A17.5%2017.5%200%200%200%20-0.5%20-70.03%20V-0.5%20H-70.03%20A16.5%2016.5%200%200%201%20-85.71%20-22.14%20A44.5%2044.5%200%201%200%20-170.29%20-22.14%20A16.5%2016.5%200%200%201%20-185.97%20-0.5%20H-253.5%20A2.5%202.5%200%200%201%20-256%20-3%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20The%20whole%20puzzle%20square:%20drawn%20in%20the%20seam%20color%20under%20the%20pieces,%20and%20used%20to%20keep%20the%20edge%20shading%20inside%20the%20puzzle.%20--%3e%3cpath%20id='plate'%20d='M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3cclipPath%20id='plate-clip'%3e%3cuse%20xlink:href='%23plate'/%3e%3c/clipPath%3e%3cpath%20id='outside'%20fill-rule='evenodd'%20d='M-320%20-320%20H320%20V320%20H-320%20Z%20M-134%20-256%20H134%20C158%20-256%20194%20-256%20225%20-225%20C256%20-194%20256%20-158%20256%20-134%20V134%20C256%20158%20256%20194%20225%20225%20C194%20256%20158%20256%20134%20256%20H-134%20C-158%20256%20-194%20256%20-225%20225%20C-256%20194%20-256%20158%20-256%20134%20V-134%20C-256%20-158%20-256%20-194%20-225%20-225%20C-194%20-256%20-158%20-256%20-134%20-256%20Z'/%3e%3c!--%20Piece%20fills:%20light%20at%20the%20top%20left%20of%20every%20piece,%20so%20each%20gradient%20is%20turned%20back%20by%20the%20rotation%20of%20its%20piece.%20--%3e%3clinearGradient%20id='fill-purple'%20x1='-170.31'%20y1='-254.74'%20x2='-1.36'%20y2='5.42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23D697FF'/%3e%3cstop%20offset='0.5'%20stop-color='%237E5AF4'/%3e%3cstop%20offset='1'%20stop-color='%234137C8'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-pink'%20x1='40.82'%20y1='-222.24'%20x2='219.77'%20y2='53.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-90)'%3e%3cstop%20offset='0'%20stop-color='%23FFB0D8'/%3e%3cstop%20offset='0.5'%20stop-color='%23FB5D99'/%3e%3cstop%20offset='1'%20stop-color='%23C71878'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-cyan'%20x1='5.69'%20y1='1.26'%20x2='174.64'%20y2='261.42'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-180)'%3e%3cstop%20offset='0'%20stop-color='%238EF1FC'/%3e%3cstop%20offset='0.5'%20stop-color='%2300CEE7'/%3e%3cstop%20offset='1'%20stop-color='%23009DB7'/%3e%3c/linearGradient%3e%3clinearGradient%20id='fill-orange'%20x1='-215.18'%20y1='-46.24'%20x2='-36.23'%20y2='229.31'%20gradientUnits='userSpaceOnUse'%20gradientTransform='rotate(-270)'%3e%3cstop%20offset='0'%20stop-color='%23FCDD64'/%3e%3cstop%20offset='0.5'%20stop-color='%23FF9525'/%3e%3cstop%20offset='1'%20stop-color='%23F57B20'/%3e%3c/linearGradient%3e%3c!--%20Edge%20shading%20of%20the%20pieces.%20'shade':%20a%20crisp%20dark%20rim%20inside%20the%20edges%20that%20face%20down%20and%20right,%20a%20soft%20band%20behind%20it,%20and%20a%20tight%20shadow%20cast%20onto%20the%20neighbors.%20'light':%20a%20crisp%20light%20rim%20inside%20the%20edges%20that%20face%20up%20and%20left,%20and%20a%20soft%20band%20behind%20it;%20the%20outside%20of%20the%20puzzle%20counts%20as%20filled%20there,%20so%20only%20the%20seams%20get%20it.%20--%3e%3cfilter%20id='shade'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='-1'%20dy='-1'%20result='up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='up'%20operator='out'%20result='dark-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='2'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='-5'%20dy='-5'%20result='soft-up'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-up'%20operator='out'%20result='dark-band'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='0.7'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dx='0.8'%20dy='1.2'%20result='tight-off'/%3e%3cfeComposite%20in='tight-off'%20in2='SourceAlpha'%20operator='out'%20result='cast'/%3e%3cfeFlood%20flood-color='%23120C3A'%20flood-opacity='0.15'/%3e%3cfeComposite%20in2='cast'%20operator='in'%20result='cast-shadow'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.1'/%3e%3cfeComposite%20in2='dark-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23140A50'%20flood-opacity='0.4'/%3e%3cfeComposite%20in2='dark-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='cast-shadow'/%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3cfilter%20id='light'%20x='-5%25'%20y='-5%25'%20width='110%25'%20height='110%25'%20color-interpolation-filters='sRGB'%3e%3cfeOffset%20in='SourceAlpha'%20dx='1'%20dy='1'%20result='down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='down'%20operator='out'%20result='light-line'/%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='1.5'%20result='soft'/%3e%3cfeOffset%20in='soft'%20dx='4'%20dy='4'%20result='soft-down'/%3e%3cfeComposite%20in='SourceAlpha'%20in2='soft-down'%20operator='out'%20result='light-band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.38'/%3e%3cfeComposite%20in2='light-band'%20operator='in'%20result='band'/%3e%3cfeFlood%20flood-color='%23FFFFFF'%20flood-opacity='0.45'/%3e%3cfeComposite%20in2='light-line'%20operator='in'%20result='line'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='band'/%3e%3cfeMergeNode%20in='line'/%3e%3c/feMerge%3e%3c/filter%3e%3c!--%20Colored%20glow%20and%20contact%20shadow%20under%20the%20pieces%20--%3e%3cfilter%20id='glow'%20x='-40%25'%20y='-40%25'%20width='180%25'%20height='180%25'%20color-interpolation-filters='sRGB'%3e%3cfeGaussianBlur%20in='SourceGraphic'%20stdDeviation='34'%20result='wide'/%3e%3cfeOffset%20in='wide'%20dy='16'%20result='wide-off'/%3e%3cfeComponentTransfer%20in='wide-off'%20result='color-glow'%3e%3cfeFuncA%20type='linear'%20slope='0.5'/%3e%3c/feComponentTransfer%3e%3cfeGaussianBlur%20in='SourceAlpha'%20stdDeviation='9'%20result='tight'/%3e%3cfeOffset%20in='tight'%20dy='10'%20result='tight-off'/%3e%3cfeFlood%20flood-color='%23202848'%20flood-opacity='0.07'/%3e%3cfeComposite%20in2='tight-off'%20operator='in'%20result='contact'/%3e%3cfeMerge%3e%3cfeMergeNode%20in='color-glow'/%3e%3cfeMergeNode%20in='contact'/%3e%3c/feMerge%3e%3c/filter%3e%3c/defs%3e%3cg%20id='puzzle'%3e%3cg%20id='puzzle-glow'%20filter='url(%23glow)'%20clip-path='url(%23plate-clip)'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='pieces'%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-purple)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-pink)'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-cyan)'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23piece'%20fill='url(%23fill-orange)'%20transform='rotate(270)'/%3e%3c/g%3e%3cg%20id='edge-shade'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3c/g%3e%3cg%20filter='url(%23shade)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3c/g%3e%3c/g%3e%3cg%20id='edge-light'%20clip-path='url(%23plate-clip)'%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(90)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(180)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3cg%20filter='url(%23light)'%3e%3cuse%20xlink:href='%23piece'%20transform='rotate(270)'/%3e%3cuse%20xlink:href='%23outside'/%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
891
+ // src/chrome.ts
892
+ function bt(e) {
893
+ return `${String(Math.round(e * 100))}%`;
894
+ }
895
+ function xt(e, t) {
896
+ let n = [
897
+ {
898
+ value: "fit-width",
899
+ label: "Fit width"
900
+ },
901
+ {
902
+ value: "fit-page",
903
+ label: "Fit page"
904
+ },
905
+ ...e.map((e) => ({
906
+ value: c(e),
907
+ label: bt(e)
908
+ }))
909
+ ];
910
+ return t.startsWith("fixed:") && !n.some((e) => e.value === t) && n.push({
911
+ value: t,
912
+ label: bt(Number(t.slice(6)))
913
+ }), n;
914
+ }
915
+ // src/ui/menubar.tsx
916
+ var St = "relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", Ct = "z-50 min-w-48 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg";
917
+ function wt(e) {
918
+ return /* @__PURE__ */ w(M.Menu, { ...e });
919
+ }
920
+ function Tt(e) {
921
+ return /* @__PURE__ */ w(M.Sub, { ...e });
922
+ }
923
+ function Et(e) {
924
+ return /* @__PURE__ */ w(M.RadioGroup, { ...e });
925
+ }
926
+ function Dt({ className: e, ...t }) {
927
+ return /* @__PURE__ */ w(M.Root, {
928
+ "data-slot": "menubar",
929
+ className: J("flex items-center gap-0.5", e),
930
+ ...t
931
+ });
932
+ }
933
+ function Ot({ className: e, ...t }) {
934
+ return /* @__PURE__ */ w(M.Trigger, {
935
+ "data-slot": "menubar-trigger",
936
+ className: J("rounded px-1.5 py-0.5 text-sm outline-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-[highlighted]:bg-accent data-[state=open]:bg-accent", e),
937
+ ...t
938
+ });
939
+ }
940
+ function kt({ className: e, align: t = "start", sideOffset: n = 4, ...r }) {
941
+ return /* @__PURE__ */ w(M.Portal, { children: /* @__PURE__ */ w(M.Content, {
942
+ "data-slot": "menubar-content",
943
+ align: t,
944
+ sideOffset: n,
945
+ className: J(Ct, e),
946
+ ...r
947
+ }) });
948
+ }
949
+ function At({ className: e, ...t }) {
950
+ return /* @__PURE__ */ w(M.Item, {
951
+ "data-slot": "menubar-item",
952
+ className: J(St, e),
953
+ ...t
954
+ });
955
+ }
956
+ function jt({ className: e, children: t, ...n }) {
957
+ return /* @__PURE__ */ T(M.CheckboxItem, {
958
+ "data-slot": "menubar-checkbox-item",
959
+ className: J(St, "pl-8", e),
960
+ ...n,
961
+ children: [/* @__PURE__ */ w("span", {
962
+ className: "absolute left-2 flex size-4 items-center justify-center",
963
+ children: /* @__PURE__ */ w(M.ItemIndicator, { children: /* @__PURE__ */ w(E, { className: "size-4" }) })
964
+ }), t]
965
+ });
966
+ }
967
+ function Mt({ className: e, children: t, ...n }) {
968
+ return /* @__PURE__ */ T(M.RadioItem, {
969
+ "data-slot": "menubar-radio-item",
970
+ className: J(St, "pl-8", e),
971
+ ...n,
972
+ children: [/* @__PURE__ */ w("span", {
973
+ className: "absolute left-2 flex size-4 items-center justify-center",
974
+ children: /* @__PURE__ */ w(M.ItemIndicator, { children: /* @__PURE__ */ w(he, { className: "size-2 fill-current" }) })
975
+ }), t]
976
+ });
977
+ }
978
+ function Nt({ className: e, children: t, ...n }) {
979
+ return /* @__PURE__ */ T(M.SubTrigger, {
980
+ "data-slot": "menubar-sub-trigger",
981
+ className: J(St, "data-[state=open]:bg-accent", e),
982
+ ...n,
983
+ children: [t, /* @__PURE__ */ w(D, { className: "ml-auto size-4" })]
984
+ });
985
+ }
986
+ function Pt({ className: e, ...t }) {
987
+ return /* @__PURE__ */ w(M.Portal, { children: /* @__PURE__ */ w(M.SubContent, {
988
+ "data-slot": "menubar-sub-content",
989
+ className: J(Ct, "min-w-36", e),
990
+ ...t
991
+ }) });
992
+ }
993
+ function Ft({ className: e, ...t }) {
994
+ return /* @__PURE__ */ w(M.Separator, {
995
+ "data-slot": "menubar-separator",
996
+ className: J("-mx-1 my-1 h-px bg-border", e),
997
+ ...t
998
+ });
999
+ }
1000
+ function It({ className: e, ...t }) {
1001
+ return /* @__PURE__ */ w(M.Label, {
1002
+ "data-slot": "menubar-label",
1003
+ className: J("px-2 py-1.5 text-xs text-muted-foreground", e),
1004
+ ...t
1005
+ });
1006
+ }
1007
+ // src/menus.tsx
1008
+ function Q({ id: t, state: n, calls: o, choice: s }) {
1009
+ let c = a(navigator.userAgent), u = l(t, c)[0], d = !i(t, n.name !== null, n.selected);
1010
+ return /* @__PURE__ */ T(At, {
1011
+ disabled: d,
1012
+ "aria-keyshortcuts": r(t, c),
1013
+ onSelect: () => {
1014
+ s.choose(() => {
1015
+ o.run(t);
1016
+ });
1017
+ },
1018
+ children: [e[t].name, u !== void 0 && /* @__PURE__ */ w(pt, { children: u })]
1019
+ });
1020
+ }
1021
+ function $({ title: e, calls: t, choice: n, children: r }) {
1022
+ return /* @__PURE__ */ T(wt, { children: [/* @__PURE__ */ w(Ot, { children: e }), /* @__PURE__ */ w(kt, {
1023
+ onCloseAutoFocus: (e) => {
1024
+ let r = n.take();
1025
+ r && (e.preventDefault(), t.focusPages(), r());
1026
+ },
1027
+ children: r
1028
+ })] });
1029
+ }
1030
+ function Lt(e) {
1031
+ let { state: t } = e;
1032
+ return /* @__PURE__ */ T($, {
1033
+ title: "File",
1034
+ calls: e.calls,
1035
+ choice: e.choice,
1036
+ children: [
1037
+ /* @__PURE__ */ w(Q, {
1038
+ id: "open",
1039
+ ...e
1040
+ }),
1041
+ /* @__PURE__ */ w(Q, {
1042
+ id: "download",
1043
+ ...e
1044
+ }),
1045
+ /* @__PURE__ */ w(Q, {
1046
+ id: "print",
1047
+ ...e
1048
+ }),
1049
+ /* @__PURE__ */ w(Q, {
1050
+ id: "close",
1051
+ ...e
1052
+ }),
1053
+ t.note && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Ft, {}), /* @__PURE__ */ w(It, {
1054
+ className: "max-w-64",
1055
+ children: t.note
1056
+ })] })
1057
+ ]
1058
+ });
1059
+ }
1060
+ function Rt(e) {
1061
+ return /* @__PURE__ */ T($, {
1062
+ title: "Edit",
1063
+ calls: e.calls,
1064
+ choice: e.choice,
1065
+ children: [
1066
+ /* @__PURE__ */ w(Q, {
1067
+ id: "copy",
1068
+ ...e
1069
+ }),
1070
+ /* @__PURE__ */ w(Q, {
1071
+ id: "select-all",
1072
+ ...e
1073
+ }),
1074
+ /* @__PURE__ */ w(Ft, {}),
1075
+ /* @__PURE__ */ w(Q, {
1076
+ id: "find",
1077
+ ...e
1078
+ })
1079
+ ]
1080
+ });
1081
+ }
1082
+ function zt(e) {
1083
+ let { state: t, calls: n } = e;
1084
+ return /* @__PURE__ */ T(Tt, { children: [/* @__PURE__ */ w(Nt, {
1085
+ disabled: t.name === null,
1086
+ children: "Zoom"
1087
+ }), /* @__PURE__ */ T(Pt, { children: [
1088
+ /* @__PURE__ */ w(Q, {
1089
+ id: "zoom-in",
1090
+ ...e
1091
+ }),
1092
+ /* @__PURE__ */ w(Q, {
1093
+ id: "zoom-out",
1094
+ ...e
1095
+ }),
1096
+ /* @__PURE__ */ w(Q, {
1097
+ id: "actual-size",
1098
+ ...e
1099
+ }),
1100
+ /* @__PURE__ */ w(Ft, {}),
1101
+ /* @__PURE__ */ w(Et, {
1102
+ value: t.zoom,
1103
+ onValueChange: (t) => {
1104
+ e.choice.choose(() => {
1105
+ n.setZoom(t);
1106
+ });
1107
+ },
1108
+ children: xt(t.zoomSteps, t.zoom).map((e) => /* @__PURE__ */ w(Mt, {
1109
+ value: e.value,
1110
+ children: e.label
1111
+ }, e.value))
1112
+ })
1113
+ ] })] });
1114
+ }
1115
+ var Bt = {
1116
+ open: "Open fonts",
1117
+ installed: "Installed fonts"
1118
+ };
1119
+ function Vt({ state: e, calls: t, choice: n }) {
1120
+ return /* @__PURE__ */ T(Tt, { children: [/* @__PURE__ */ w(Nt, { children: "Fonts" }), /* @__PURE__ */ T(Pt, { children: [/* @__PURE__ */ T(Et, {
1121
+ value: e.fonts,
1122
+ onValueChange: (e) => {
1123
+ n.choose(() => {
1124
+ t.setFonts(e);
1125
+ });
1126
+ },
1127
+ children: [/* @__PURE__ */ w(Mt, {
1128
+ value: "open",
1129
+ children: Bt.open
1130
+ }), /* @__PURE__ */ w(Mt, {
1131
+ value: "installed",
1132
+ disabled: !e.installedFonts,
1133
+ children: Bt.installed
1134
+ })]
1135
+ }), !e.installedFonts && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(Ft, {}), /* @__PURE__ */ w(It, {
1136
+ className: "max-w-64 font-normal text-muted-foreground",
1137
+ children: d()
1138
+ })] })] })] });
1139
+ }
1140
+ function Ht(e) {
1141
+ let { state: t, calls: n } = e;
1142
+ return /* @__PURE__ */ T($, {
1143
+ title: "View",
1144
+ calls: n,
1145
+ choice: e.choice,
1146
+ children: [
1147
+ /* @__PURE__ */ w(jt, {
1148
+ disabled: t.name === null,
1149
+ checked: t.outline,
1150
+ onCheckedChange: (t) => {
1151
+ e.choice.choose(() => {
1152
+ n.setOutline(t);
1153
+ });
1154
+ },
1155
+ children: "Outline"
1156
+ }),
1157
+ /* @__PURE__ */ w(zt, { ...e }),
1158
+ /* @__PURE__ */ w(Vt, { ...e }),
1159
+ /* @__PURE__ */ T(Tt, { children: [/* @__PURE__ */ w(Nt, { children: "Theme" }), /* @__PURE__ */ w(Pt, { children: /* @__PURE__ */ w(Et, {
1160
+ value: t.theme,
1161
+ onValueChange: (t) => {
1162
+ e.choice.choose(() => {
1163
+ n.setTheme(t);
1164
+ });
1165
+ },
1166
+ children: W.map((e) => /* @__PURE__ */ w(Mt, {
1167
+ value: e,
1168
+ children: G[e]
1169
+ }, e))
1170
+ }) })] })
1171
+ ]
1172
+ });
1173
+ }
1174
+ function Ut({ className: e }) {
1175
+ let { state: t, calls: n } = Z(), r = b(null), i = {
1176
+ choose: (e) => {
1177
+ r.current = e;
1178
+ },
1179
+ take: () => {
1180
+ let e = r.current;
1181
+ return r.current = null, e;
1182
+ }
1183
+ }, a = {
1184
+ state: t,
1185
+ calls: n,
1186
+ choice: i
1187
+ };
1188
+ return /* @__PURE__ */ T(Dt, {
1189
+ "aria-label": "Menus",
1190
+ className: e ?? "-ml-1.5",
1191
+ children: [
1192
+ /* @__PURE__ */ w(Lt, { ...a }),
1193
+ /* @__PURE__ */ w(Rt, { ...a }),
1194
+ /* @__PURE__ */ w(Ht, { ...a }),
1195
+ /* @__PURE__ */ w($, {
1196
+ title: "Tools",
1197
+ calls: n,
1198
+ choice: i,
1199
+ children: /* @__PURE__ */ w(Q, {
1200
+ id: "advanced",
1201
+ ...a
1202
+ })
1203
+ }),
1204
+ /* @__PURE__ */ T($, {
1205
+ title: "Help",
1206
+ calls: n,
1207
+ choice: i,
1208
+ children: [/* @__PURE__ */ w(Q, {
1209
+ id: "shortcuts",
1210
+ ...a
1211
+ }), /* @__PURE__ */ w(Q, {
1212
+ id: "about",
1213
+ ...a
1214
+ })]
1215
+ })
1216
+ ]
1217
+ });
1218
+ }
1219
+ // src/header.tsx
1220
+ var Wt = {
1221
+ system: _e,
1222
+ light: k,
1223
+ dark: ve
1224
+ };
1225
+ function Gt({ className: e, alt: t = "" }) {
1226
+ return /* @__PURE__ */ w("img", {
1227
+ src: yt,
1228
+ alt: t,
1229
+ className: J("size-10 p-1", e)
1230
+ });
1231
+ }
1232
+ function Kt({ className: e }) {
1233
+ let { state: t, calls: n } = Z();
1234
+ return t.name === null || t.outline ? null : /* @__PURE__ */ w("button", {
1235
+ type: "button",
1236
+ className: J("grid size-10 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring sm:hidden", e),
1237
+ "aria-label": "Show outline",
1238
+ title: "Show outline",
1239
+ onClick: () => {
1240
+ n.setOutline(!0);
1241
+ },
1242
+ children: /* @__PURE__ */ w(O, { className: "size-5" })
1243
+ });
1244
+ }
1245
+ function qt({ fallback: e = "F-Office Docs", className: t }) {
1246
+ let { state: n } = Z();
1247
+ return /* @__PURE__ */ T("div", {
1248
+ className: J("min-w-0 flex-1", t),
1249
+ children: [/* @__PURE__ */ w("h1", {
1250
+ className: "truncate text-lg leading-6",
1251
+ children: n.name ?? e
1252
+ }), /* @__PURE__ */ w(Ut, {})]
1253
+ });
1254
+ }
1255
+ function Jt({ className: e }) {
1256
+ let { state: t, calls: n } = Z();
1257
+ return t.name === null ? null : /* @__PURE__ */ T("div", {
1258
+ className: J("hidden shrink-0 items-center gap-3 text-sm text-muted-foreground md:flex", e),
1259
+ children: [/* @__PURE__ */ T("span", { children: [
1260
+ "Page ",
1261
+ t.page + 1,
1262
+ " of ",
1263
+ t.pageCount
1264
+ ] }), /* @__PURE__ */ w("select", {
1265
+ "aria-label": "Zoom",
1266
+ className: "h-8 rounded-md border border-border bg-transparent px-2 text-foreground",
1267
+ value: t.zoom,
1268
+ onChange: (e) => {
1269
+ n.setZoom(e.target.value);
1270
+ },
1271
+ children: xt(t.zoomSteps, t.zoom).map((e) => /* @__PURE__ */ w("option", {
1272
+ value: e.value,
1273
+ children: e.label
1274
+ }, e.value))
1275
+ })]
1276
+ });
1277
+ }
1278
+ function Yt({ className: e }) {
1279
+ let { state: t, calls: n } = Z(), r = Wt[t.theme], i = `Theme: ${G[t.theme]}`;
1280
+ return /* @__PURE__ */ w("button", {
1281
+ type: "button",
1282
+ className: J("grid size-10 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring", e),
1283
+ "aria-label": i,
1284
+ title: i,
1285
+ onClick: () => {
1286
+ n.setTheme(Ne(t.theme));
1287
+ },
1288
+ children: /* @__PURE__ */ w(r, { className: "size-5" })
1289
+ });
1290
+ }
1291
+ function Xt({ className: e }) {
1292
+ let { calls: t } = Z();
1293
+ return /* @__PURE__ */ T("button", {
1294
+ type: "button",
1295
+ className: J("h-10 shrink-0 rounded-full bg-primary px-4 text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring sm:px-5", e),
1296
+ "aria-label": "Open a DOCX file",
1297
+ onClick: () => {
1298
+ t.run("open");
1299
+ },
1300
+ children: [/* @__PURE__ */ w("span", {
1301
+ className: "hidden sm:inline",
1302
+ children: "Open a DOCX file"
1303
+ }), /* @__PURE__ */ w("span", {
1304
+ className: "sm:hidden",
1305
+ children: "Open"
1306
+ })]
1307
+ });
1308
+ }
1309
+ function Zt({ className: e }) {
1310
+ return /* @__PURE__ */ T("header", {
1311
+ className: J("flex h-16 shrink-0 items-center gap-2 px-3 sm:gap-3 sm:px-4", e),
1312
+ children: [
1313
+ /* @__PURE__ */ w(Gt, { className: "shrink-0" }),
1314
+ /* @__PURE__ */ w(Kt, {}),
1315
+ /* @__PURE__ */ w(qt, {}),
1316
+ /* @__PURE__ */ w(Jt, {}),
1317
+ /* @__PURE__ */ w(Yt, {}),
1318
+ /* @__PURE__ */ w(Xt, {})
1319
+ ]
1320
+ });
1321
+ }
1322
+ // src/docs-app.tsx
1323
+ function Qt(e) {
1324
+ return /* @__PURE__ */ T(Ye, {
1325
+ ...e,
1326
+ children: [
1327
+ /* @__PURE__ */ w(Zt, {}),
1328
+ /* @__PURE__ */ w(vt, {}),
1329
+ /* @__PURE__ */ w(at, {})
1330
+ ]
1331
+ });
1332
+ }
1333
+ // src/f-office-docs.tsx
1334
+ function $t(e, t) {
1335
+ if (e) {
1336
+ if (typeof e == "function") return e(t) ?? void 0;
1337
+ e.current = t;
1338
+ }
1339
+ }
1340
+ function en({ ref: e, source: t, name: n, zoom: r, target: i, chrome: a = "none", readOnly: o = !0, outlineOpen: s, fontSource: c, highlights: l, moduleUrls: u, className: d, style: f, onOpen: ee, onViewChange: te, onPageChange: ne, onOutlineChange: re, onSelectionChange: ie, onMenu: p, onError: ae }) {
1341
+ le();
1342
+ let m = b(null), h = v((e) => {
1343
+ ee?.(e.detail);
1344
+ }), y = v((e) => {
1345
+ te?.(e.detail);
1346
+ }), x = v((e) => {
1347
+ ne?.(e.detail);
1348
+ }), oe = v((e) => {
1349
+ re?.(e.detail);
1350
+ }), se = v((e) => {
1351
+ ie?.(e.detail);
1352
+ }), ce = v((e) => {
1353
+ p && (e.preventDefault(), p(e.detail));
1354
+ }), ue = v((e) => {
1355
+ ae?.(e.detail);
1356
+ }), de = g((t) => {
1357
+ m.current = t;
1358
+ let n = $t(e, t);
1359
+ return () => {
1360
+ m.current = null, typeof n == "function" ? n() : $t(e, null);
1361
+ };
1362
+ }, [e]);
1363
+ return _(() => {
1364
+ let e = m.current;
1365
+ if (e) return e.addEventListener("open", h), e.addEventListener("viewchange", y), e.addEventListener("pagechange", x), e.addEventListener("outlinechange", oe), e.addEventListener("selectionchange", se), e.addEventListener("menu", ce), e.addEventListener("error", ue), () => {
1366
+ e.removeEventListener("open", h), e.removeEventListener("viewchange", y), e.removeEventListener("pagechange", x), e.removeEventListener("outlinechange", oe), e.removeEventListener("selectionchange", se), e.removeEventListener("menu", ce), e.removeEventListener("error", ue);
1367
+ };
1368
+ }, []), _(() => {
1369
+ let e = m.current;
1370
+ e && (e.readOnly = o);
1371
+ }, [o]), _(() => {
1372
+ let e = m.current;
1373
+ e && c !== void 0 && (e.fontSource = c);
1374
+ }, [c]), _(() => {
1375
+ let e = m.current;
1376
+ e && s !== void 0 && (e.outlineOpen = s);
1377
+ }, [s]), _(() => {
1378
+ let e = m.current;
1379
+ e && i !== void 0 && (e.target = i);
1380
+ }, [i]), _(() => {
1381
+ let e = m.current;
1382
+ e && r !== void 0 && e.applyZoomSetting(r);
1383
+ }, [r]), _(() => {
1384
+ let e = m.current;
1385
+ e && l !== void 0 && e.setDocsHighlights(l);
1386
+ }, [l]), _(() => {
1387
+ let e = m.current;
1388
+ e && t && e.openSource(t, n).catch(() => void 0);
1389
+ }, [t, n]), /* @__PURE__ */ w("f-office-docs", {
1390
+ ref: de,
1391
+ chrome: a,
1392
+ "read-only": o ? "true" : "false",
1393
+ ...i ? { target: i } : {},
1394
+ ...u?.module ? { module: u.module } : {},
1395
+ ...u?.wasm ? { wasm: u.wasm } : {},
1396
+ ...u?.dictionaries ? { dictionaries: u.dictionaries } : {},
1397
+ className: d,
1398
+ style: {
1399
+ display: "block",
1400
+ width: "100%",
1401
+ height: "100%",
1402
+ ...f
1403
+ }
1404
+ });
1405
+ }
1406
+ export { K as DEFAULT_THEME_STORAGE_KEY, Qt as DocsApp, vt as DocsCanvas, at as DocsDialogs, Zt as DocsHeader, Gt as DocsMark, Ut as DocsMenuBar, Xt as DocsOpenButton, Kt as DocsOutlineButton, Jt as DocsPageControls, Ye as DocsProvider, _t as DocsStart, Yt as DocsThemeButton, qt as DocsTitle, et as DocsWordmark, Pe as FILE_PARAMETER, en as FOfficeDocs, xe as KEEP_LIMIT, Ce as KEEP_NOTES, L as Keeper, W as THEMES, G as THEME_NAMES, Se as VIEW_DELAY, Me as applyTheme, Ie as askedFile, U as browserSlots, Te as databaseSlots, Le as dropFileParameter, X as fetchAskedFile, Y as fileName, z as folderSlots, Ae as loadTheme, Ne as nextTheme, H as openDatabase, je as saveTheme, Z as useDocs, xt as zoomOptions };