efficient-shell 15.8.0 → 15.9.0

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.
Files changed (156) hide show
  1. package/README.md +1 -1
  2. package/dist/{Browser-5QLDJ74Z.js → Browser-FEZ2X7B5.js} +16 -16
  3. package/dist/{Calculator-6WNTZLWL.js → Calculator-MBHZSFJ6.js} +22 -22
  4. package/dist/{CurrencyConverter-C4KCZWUM.js → CurrencyConverter-7FPB7WJE.js} +10 -10
  5. package/dist/{Files-VFRXPQLV.js → Files-DHTF6LGF.js} +59 -59
  6. package/dist/{Notepad-S5JMXH2O.js → Notepad-KS37VSPL.js} +9 -9
  7. package/dist/{PdfViewer-AIAVQYZ6.js → PdfViewer-KS2BCFSA.js} +1 -1
  8. package/dist/PomodoroTimer-TYSJOYDJ.js +91 -0
  9. package/dist/{Preview-HTFTEL7K.js → Preview-NXCA3X4S.js} +28 -28
  10. package/dist/Sidebar-IU4EG3D3.js +44 -0
  11. package/dist/{Stock-LIOPTQG5.js → Stock-Y74YC25V.js} +3 -3
  12. package/dist/{Weather-K3BVAFRV.js → Weather-EO4LYAPA.js} +22 -22
  13. package/dist/{WorldClock-RHAHXLW4.js → WorldClock-3E3KLHSD.js} +7 -7
  14. package/dist/ai/index.js +37 -37
  15. package/dist/apps/ImageAnnotator.js +1 -1
  16. package/dist/apps/index.js +1 -1
  17. package/dist/bin/browser-check.js +1 -1
  18. package/dist/bin/media-host-check.js +1 -1
  19. package/dist/bin/ui-check.js +1 -1
  20. package/dist/brand.css +1 -1
  21. package/dist/charts/FlowChart.js +1 -1
  22. package/dist/{chunk-LFUXWZV7.js → chunk-2EBHJGMM.js} +1 -1
  23. package/dist/chunk-37FQVY2O.js +2 -0
  24. package/dist/{chunk-VHBRVW5O.js → chunk-3OK5VZOU.js} +3 -3
  25. package/dist/{chunk-UYM7562M.js → chunk-43YU7YWL.js} +2 -2
  26. package/dist/{chunk-XYVFJLAU.js → chunk-452LT77I.js} +1 -1
  27. package/dist/chunk-4YH7U7WL.js +1 -0
  28. package/dist/{chunk-KERCZSIA.js → chunk-54WCVNJJ.js} +1 -1
  29. package/dist/{chunk-OK2J6WSC.js → chunk-6ZQC6XFU.js} +1 -1
  30. package/dist/{chunk-A3RD7AQ2.js → chunk-7AF5JGRM.js} +1 -1
  31. package/dist/{chunk-RIA6KKIB.js → chunk-7EPCBDS5.js} +6 -6
  32. package/dist/{chunk-4NTAZLT3.js → chunk-7KUHILEA.js} +3 -3
  33. package/dist/chunk-ATTQTQJI.js +14 -0
  34. package/dist/chunk-AYTGYEOI.js +8 -0
  35. package/dist/{chunk-S6C7X6CR.js → chunk-AZANUXJT.js} +16 -16
  36. package/dist/{chunk-QSFQTMWV.js → chunk-BGLUOC7W.js} +1 -1
  37. package/dist/{chunk-D7MRZZVV.js → chunk-BYTQRQ5P.js} +1 -1
  38. package/dist/{chunk-DVKOVZJ2.js → chunk-DFI5EHSV.js} +12 -12
  39. package/dist/{chunk-GUUBFQ6L.js → chunk-DYJQIZX2.js} +2 -2
  40. package/dist/{chunk-KTI4ZJVX.js → chunk-GNB6KUCT.js} +1 -1
  41. package/dist/chunk-GURLMAZM.js +3 -0
  42. package/dist/{chunk-YFVQKS5U.js → chunk-GYY7GS2I.js} +1 -1
  43. package/dist/{chunk-GUOAPXUY.js → chunk-GZ57F6PN.js} +4 -4
  44. package/dist/{chunk-EA423N2F.js → chunk-HPDNKHIO.js} +2 -2
  45. package/dist/chunk-IDH323EU.js +6 -0
  46. package/dist/{chunk-5OXQ5M5S.js → chunk-JKO4JZPO.js} +1 -1
  47. package/dist/{chunk-YEDAXZYO.js → chunk-JU6VBLTU.js} +1 -1
  48. package/dist/{chunk-ZVKUOJNS.js → chunk-JUGRSO5J.js} +1 -1
  49. package/dist/{chunk-PCNFY6EK.js → chunk-LH7ZKPHJ.js} +12 -12
  50. package/dist/{chunk-5QHNDAZ6.js → chunk-LLXI57MB.js} +1 -1
  51. package/dist/chunk-LRASKGEZ.js +4 -0
  52. package/dist/chunk-LYGIOJ3J.js +1 -0
  53. package/dist/{chunk-V62FEHS4.js → chunk-MDXZ7YAC.js} +1 -1
  54. package/dist/{chunk-62UNBUTU.js → chunk-NO5BMPT5.js} +1 -1
  55. package/dist/{chunk-3AVXNZY5.js → chunk-NPBRNEMR.js} +1 -1
  56. package/dist/{chunk-WGDVYCQX.js → chunk-OHRKENEP.js} +21 -21
  57. package/dist/{chunk-JRKD7SD3.js → chunk-OLXUMB2V.js} +16 -16
  58. package/dist/chunk-ONUNFTZD.js +11 -0
  59. package/dist/{chunk-KIIZNION.js → chunk-OX7Q5PPR.js} +5 -5
  60. package/dist/{chunk-ASNRA3ZL.js → chunk-P7X4PWJJ.js} +1 -1
  61. package/dist/chunk-PLJB4H3G.js +1 -0
  62. package/dist/{chunk-UMIRPFQJ.js → chunk-QD7IODP2.js} +1 -1
  63. package/dist/{chunk-NM7U42KL.js → chunk-QO2CN2ND.js} +8 -8
  64. package/dist/{chunk-QSOBETAI.js → chunk-QY2DGLCJ.js} +6 -6
  65. package/dist/chunk-R7OZ2AQD.js +6 -0
  66. package/dist/{chunk-U7PA4KNZ.js → chunk-RBOGLXMV.js} +8 -8
  67. package/dist/{chunk-OEWBWKKD.js → chunk-SWH3IEUT.js} +9 -9
  68. package/dist/{chunk-LGVVXYW7.js → chunk-SYASK4QG.js} +1 -1
  69. package/dist/{chunk-YXMXATYP.js → chunk-THVE54FN.js} +1 -1
  70. package/dist/{chunk-TEYG2W7A.js → chunk-TM5NQTFA.js} +2 -2
  71. package/dist/{chunk-FQ3SYDKI.js → chunk-US7F3NC3.js} +1 -1
  72. package/dist/{chunk-XZKVGJIB.js → chunk-V77UETV3.js} +1 -1
  73. package/dist/{chunk-I2NVBDKH.js → chunk-VLT4ZEHT.js} +1 -1
  74. package/dist/chunk-WUNZBM53.js +28 -0
  75. package/dist/{chunk-GD5NGS6D.js → chunk-XNPCOWOO.js} +45 -45
  76. package/dist/{chunk-EULBBS5L.js → chunk-XOEYCDWT.js} +1 -1
  77. package/dist/{chunk-QJ3X2PHY.js → chunk-YCA2XXAB.js} +1 -1
  78. package/dist/{chunk-AKEED2BC.js → chunk-YQKNRT7L.js} +1 -1
  79. package/dist/{chunk-QYOIS4BN.js → chunk-ZKWAWQ74.js} +3 -3
  80. package/dist/{chunk-RRWQBWLW.js → chunk-ZV2ZAHZV.js} +1 -1
  81. package/dist/data/EntityList.js +1 -1
  82. package/dist/data/ListLoadError.js +1 -1
  83. package/dist/forms/BorderInput.js +1 -1
  84. package/dist/forms/BrandAssetEditor.js +1 -1
  85. package/dist/forms/Button.d.ts +1 -0
  86. package/dist/forms/Button.js +1 -1
  87. package/dist/forms/ColorPicker.js +1 -1
  88. package/dist/forms/ComposerAttachments.js +1 -1
  89. package/dist/forms/CornersInput.js +1 -1
  90. package/dist/forms/DateRangePicker.js +1 -1
  91. package/dist/forms/IconButton.js +1 -1
  92. package/dist/forms/IconPicker.js +1 -1
  93. package/dist/forms/Input.js +1 -1
  94. package/dist/forms/InputNumber.js +1 -1
  95. package/dist/forms/LinkPicker.js +1 -1
  96. package/dist/forms/MediaLibrary.js +1 -1
  97. package/dist/forms/MediaUsedInList.js +1 -1
  98. package/dist/forms/NumericKeypad.js +1 -1
  99. package/dist/forms/PositionInput.js +1 -1
  100. package/dist/forms/RenameField.js +1 -1
  101. package/dist/forms/SearchInput.js +1 -1
  102. package/dist/forms/SidesInput.js +1 -1
  103. package/dist/forms/Slider.js +1 -1
  104. package/dist/forms/Snippet.js +1 -1
  105. package/dist/forms/SplitButton.js +1 -1
  106. package/dist/forms/TextToolbar.js +1 -1
  107. package/dist/forms/WidthsBar.js +1 -1
  108. package/dist/forms/buttonStyles.d.ts +8 -1
  109. package/dist/forms/buttonStyles.js +1 -1
  110. package/dist/icons/index.js +1 -1
  111. package/dist/index.js +172 -172
  112. package/dist/map/index.js +3 -3
  113. package/dist/page-tabs/index.js +5 -5
  114. package/dist/pdf/index.js +1 -1
  115. package/dist/routine-index.json +1 -1
  116. package/dist/shell/AppUpdateBanner.js +1 -1
  117. package/dist/shell/ConfirmDialog.js +1 -1
  118. package/dist/shell/Dialog.js +1 -1
  119. package/dist/shell/Drawer.js +1 -1
  120. package/dist/shell/HelpCenter.js +1 -1
  121. package/dist/shell/ImageLightbox.js +1 -1
  122. package/dist/shell/LanguageSelect.js +1 -1
  123. package/dist/shell/Markdown.js +1 -1
  124. package/dist/shell/Popover.js +1 -1
  125. package/dist/shell/SearchableSelect.js +1 -1
  126. package/dist/shell/discardGuard.js +1 -1
  127. package/dist/shell/toast.js +1 -1
  128. package/dist/telemetry/index.js +1 -1
  129. package/dist/templates/AuthScreen.js +1 -1
  130. package/dist/templates/ChatTemplate.js +1 -1
  131. package/dist/templates/CheckoutTemplate.js +1 -1
  132. package/dist/templates/DashboardTemplate.js +1 -1
  133. package/dist/templates/DataTablePage.js +1 -1
  134. package/dist/templates/EmailTemplate.js +1 -1
  135. package/dist/templates/ErrorBoundary.js +1 -1
  136. package/dist/templates/FormLayoutPage.js +1 -1
  137. package/dist/templates/GalleryTemplate.js +1 -1
  138. package/dist/ui/index.js +1 -1
  139. package/dist/value-index.json +1 -1
  140. package/dist/version.js +1 -1
  141. package/package.json +1 -1
  142. package/dist/PomodoroTimer-BGTCWT53.js +0 -91
  143. package/dist/Sidebar-KAALEIIX.js +0 -44
  144. package/dist/chunk-345FP3IX.js +0 -4
  145. package/dist/chunk-5RCKE4X2.js +0 -6
  146. package/dist/chunk-6FOLK4HD.js +0 -1
  147. package/dist/chunk-A4ROXNUF.js +0 -2
  148. package/dist/chunk-APFDZ2HG.js +0 -1
  149. package/dist/chunk-DEV3ZHPP.js +0 -8
  150. package/dist/chunk-E4WVF6AS.js +0 -28
  151. package/dist/chunk-MQNSKFZY.js +0 -11
  152. package/dist/chunk-OHPDB4UN.js +0 -14
  153. package/dist/chunk-QXEZBS3H.js +0 -6
  154. package/dist/chunk-R6YVKP6D.js +0 -3
  155. package/dist/chunk-UQYNPYF4.js +0 -1
  156. /package/dist/{chunk-TEQ5ZPAL.js → chunk-NQWORKZD.js} +0 -0
package/README.md CHANGED
@@ -1804,7 +1804,7 @@ All exports are named — `import { Modal, ... } from 'efficient-shell'`.
1804
1804
  | `Accordion` | Folds with a heading button each (`h3` by default, `level`), in the editor's look, ONE group band for the editors and the portals (B2 plan C, option 1, Lewis 2026-10-26: efficient-easel's `SettingsGroup`, moved here whole, with its `es-group…` classes): `tier="band"` (default) is a square grey band 32 tall, title 12 / 600, a − / + sign at its right end, one grey step darker on hover; `tier="row"` is the quiet tier under it (11 / 600, uppercase, grey). A band item can carry a `count` of changed settings (a small accent pill after the title, read as "2 changed") and an `icon`. **The gap under a band is the band's:** its body keeps 32px above and below whatever it holds (setting rows, a chart, a list), as margins, so a setting row's own top margin and the air above the next band fold into it. The band's side inset is 16px; an editor's panel sets its own, and the air above a band is its host's. `keepMounted` keeps a folded body mounted and `hidden`; an item's `headId` names its button (its body is then `<headId>-body`). |
1805
1805
  | `ShowWhen` / `isShown` / `ShowWhenRule` | The ONE rule for "show this settings row only when another setting has a value" (owner ruling 2026-10-17). The rule is data, never a function: `{ field: 'country_selector_enabled', is: true }`, `{ field, in: [...] }` (is one of), `{ field, set: true }` (holds anything: not `undefined`/`null`/`false`/blank/empty list; `0` counts), `default` for an unset field, a dotted `field` (`'source.slug'`), `{ context: 'parentType', in: ['Flex'] }` (where the row is, not what it stores), and `{ not }` / `{ all: [] }` / `{ any: [] }`. `isShown(rule, values, context)` is the only reader; `SettingRow`'s `showWhen` and the `<ShowWhen rule values>` wrapper both use it. A hidden row keeps its stored value — nothing here writes — and a rule it cannot read shows the row. |
1806
1806
  | `withShowWhen` / `withRowRules` / `truthy` / `showWhenFactsContext` | Put the rule on field definitions, as data, from `efficient-shell/format` (no React, no UI kit), for every editor. `withShowWhen(field, rule)` puts it on one row and `showWhenOf(field)` reads it back. `withRowsShownWhen(fields, keys, rule)` and `withRowRules(fields, [[keys, rule], …])` do it for rows of a panel: a row's own rule is kept (`all`), and the same input hands back the same object. `truthy(field)` reads a value as `if (value)` does. `shownForOption(field, known, fallback, shownFor)` reads an unknown option as its fallback. A block's facts (`showWhenFacts`: name → `(data, params) => answer`) are what its `{ context }` rules read: `showWhenFactsContext(facts, data, params)` reads each one only when a rule asks, and `withShowWhenFacts` / `addShowWhenFacts` attach them to a block. |
1807
- | `Button`, `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`, `FormField`, `Label` | Form controls — controlled (`value`/`onChange`); `Button`'s `variant` is `primary` (the default), `secondary` (outlined), `secondary-danger` (outlined in red: a destructive action in a footer of outlined buttons, e.g. Delete beside Archive — the same size and shape as `secondary`, red border and text, a light red wash on hover), `ghost`, `ghost-danger` (red text, no box: a destructive action among quiet `ghost` buttons), `danger` (solid red: the one action a confirm dialog asks for) or `link`; `Button` takes `pressed` (or follows `aria-pressed`) for a toggle that is on, with `IconButton`'s accent wash and ink on `ghost` and `secondary` (`secondary` keeps its border, tinted, so it does not move; `buttonClasses({ pressed })` gives a link the same); `Input`/`Textarea` forward native props for react-hook-form. `Button` and `Switch` take `disabledReason`: persistent text beside the control wired with `aria-describedby`, never a `title` — a tooltip needs a hover a disabled control does not reliably get. `Switch` also takes `disabledReasonId`, so a panel whose controls are all dead for one reason states it once and points every control at it. A `Select` option carries an optional `description`, rendered as a second muted line **in the open list only** — the closed trigger stays one line, so one explained option cannot change the height of every field in the row. `NativeSelect` (and so `Select` on touch) ignores it: an `<option>` holds text and nothing else. An option also takes `lang` (a BCP 47 tag) when its label is written in another language than the page's — a language picker naming each language in its own words: it goes on the option in the open list, on the native `<option>` and on the closed trigger's label while chosen, so a screen reader and the font fallback treat each name as its own language (WCAG 3.1.2). On the desktop listbox, `title` joins `aria-label` / `aria-labelledby` / `aria-describedby` on the VISIBLE trigger button — it used to ride the native spread onto the `sr-only` `<select>`, where a tooltip has no pointer that can reach it and a fallback name sits on an `aria-hidden` element. `name`, `required` and the forwarded ref stay on the native control, which is what it is for. A `Checkbox` or `Radio` with both a `label` and a `description` is NAMED by the label and DESCRIBED by the description (`aria-labelledby` / `aria-describedby`); the whole row is still its `<label>`, so its words still tick it. `FormField` points its one child at the hint or error on screen with `aria-describedby`, and marks it `aria-invalid` while `error` is set. A child that already has its own `aria-describedby` (a react-hook-form binding often does) keeps it: the ids are merged, the child's own first, and each id is said once — a repeated id is a message a screen reader reads twice. |
1807
+ | `Button`, `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `Switch`, `FormField`, `Label` | Form controls — controlled (`value`/`onChange`); `Button`'s `variant` is `primary` (the default), `secondary` (outlined), `secondary-danger` (outlined in red: a destructive action in a footer of outlined buttons, e.g. Delete beside Archive — the same size and shape as `secondary`, red border and text, a light red wash on hover), `secondary-warning` (outlined in amber: a step back to an earlier status, e.g. Revert to Submitted or Reopen beside the blue Primary, harness UI-56; the same shape as `secondary`), `ghost`, `ghost-danger` (red text, no box: a destructive action among quiet `ghost` buttons), `danger` (solid red: the one action a confirm dialog asks for) or `link`; `Button` takes `pressed` (or follows `aria-pressed`) for a toggle that is on, with `IconButton`'s accent wash and ink on `ghost` and `secondary` (`secondary` keeps its border, tinted, so it does not move; `buttonClasses({ pressed })` gives a link the same); `Input`/`Textarea` forward native props for react-hook-form. `Button` and `Switch` take `disabledReason`: persistent text beside the control wired with `aria-describedby`, never a `title` — a tooltip needs a hover a disabled control does not reliably get. `Switch` also takes `disabledReasonId`, so a panel whose controls are all dead for one reason states it once and points every control at it. A `Select` option carries an optional `description`, rendered as a second muted line **in the open list only** — the closed trigger stays one line, so one explained option cannot change the height of every field in the row. `NativeSelect` (and so `Select` on touch) ignores it: an `<option>` holds text and nothing else. An option also takes `lang` (a BCP 47 tag) when its label is written in another language than the page's — a language picker naming each language in its own words: it goes on the option in the open list, on the native `<option>` and on the closed trigger's label while chosen, so a screen reader and the font fallback treat each name as its own language (WCAG 3.1.2). On the desktop listbox, `title` joins `aria-label` / `aria-labelledby` / `aria-describedby` on the VISIBLE trigger button — it used to ride the native spread onto the `sr-only` `<select>`, where a tooltip has no pointer that can reach it and a fallback name sits on an `aria-hidden` element. `name`, `required` and the forwarded ref stay on the native control, which is what it is for. A `Checkbox` or `Radio` with both a `label` and a `description` is NAMED by the label and DESCRIBED by the description (`aria-labelledby` / `aria-describedby`); the whole row is still its `<label>`, so its words still tick it. `FormField` points its one child at the hint or error on screen with `aria-describedby`, and marks it `aria-invalid` while `error` is set. A child that already has its own `aria-describedby` (a react-hook-form binding often does) keeps it: the ids are merged, the child's own first, and each id is said once — a repeated id is a message a screen reader reads twice. |
1808
1808
  | `buttonClasses`, `iconButtonClasses` | `Button`'s and `IconButton`'s look as a class string, for something that must navigate and so cannot be a `<button>`: `<Link href="/organisations/new" className={buttonClasses({ variant: 'secondary' })}>Add a business</Link>`. Same options and defaults as the component (`variant`, `size`, `block`, `className`), and the components render through these functions, so the two cannot drift. What the string cannot give an `<a>`: a disabled state (`disabled:` never matches an anchor — drop the `href`, add `role="link"` and `aria-disabled="true"`, or render a disabled `Button`), and the cursor (an `<a href>` gets the browser's pointer, a `<button>` the host's preflight; set it once for both). Keep its `inline-flex` — ask for `block` rather than passing a display utility. An icon-only link still needs the `aria-label` `IconButton` would have required. Client references, like every kit function: call them in a `'use client'` file. |
1809
1809
  | `labelClasses` | `Label`'s look as a class string, for a `<label>` a host lays out itself — beside a check box, in a row with its control, `sr-only`: `<label htmlFor="x" className={labelClasses({ inline: true, className: 'flex gap-2' })}>`. `inline: true` drops `Label`'s block layout (`mb-1 block`) and keeps its size, weight and ink; without it the string is exactly what `Label` renders. A client reference: call it in a `'use client'` file. |
1810
1810
  | `Segmented` | A row of mutually exclusive options, all visible: a button group, or with `name` a real radio group that submits. It looks exactly like `Tabs variant="pill"`: the chosen option is solid blue with white text on the grey track, the others grey text. Both draw through one shared strip, so they cannot drift apart; only the roles differ (a value here, a tab panel there). `size` is `sm` / `md` / `lg` (24 / 32 / 40, the control-height ladder) or `touch` (56, as `Button size="touch"`). Icon-only: give the option its `icon` and its word as a visually hidden label (`sr-only`); the word names it and the icon is hidden from screen readers. A word is never cut and never broken inside itself, at any width and with no script measuring: with `block` every option is an equal share while the words fit; an option of several words wider than its share wraps at its spaces and grows (the size is a minimum height, so a one-line option keeps 24 / 32 / 40, with or without an icon up to that height); a single word wider than its share sends the options that do not fit to a second row of the track. Without `block` the track wraps first: a whole option moves to the second row before a label wraps. The track never scrolls. Named by `label`, or by an element already on the page (`aria-labelledby`, a list row's own heading) and described by another (`aria-describedby`); an option's `title` says on hover what choosing it means. |
@@ -1,32 +1,32 @@
1
- import{InputEndActionButton as e}from"./chunk-D7MRZZVV.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-EA423N2F.js";import{WindowTitle as n}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as s}from"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-6FOLK4HD.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as i}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var p="react-os-shell:browser-bookmarks",d="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(p);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(d)||k}function N(){const h=a(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,N]=l(k||b),[C,R]=l(w),[D,W]=l([w]),[P,H]=l(0),[S,Z]=l(0),[z,T]=l(x),[U,E]=l(!1),[G,L]=l(null),A=a(null),F=a(null);c(()=>{try{localStorage.setItem(p,JSON.stringify(z))}catch{}},[z]);const M=e=>{const t=f(e);t&&(N(t),R(t),W(e=>{const o=e.slice(0,P+1);return o.push(t),o}),H(e=>e+1),E(!1))},J=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},Y=()=>{const e=G?.trim();e?(T(t=>[...t,{label:e,url:w}]),L(null)):L(null)};c(()=>{if(null===G)return;A.current?.focus(),A.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||L(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==G]);const B=e=>{T(t=>t.filter((t,o)=>o!==e))},K=P>0,O=P<D.length-1,V=z.some(e=>e.url===w),Q="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
1
+ import{InputEndActionButton as e}from"./chunk-BYTQRQ5P.js";import"./chunk-AYZY3YNC.js";import{peekBrowserStartUrl as t,claimBrowserStartUrl as o}from"./chunk-LWLCNQY7.js";import{AboutApp as r}from"./chunk-HPDNKHIO.js";import{WindowTitle as n}from"./chunk-XNPCOWOO.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import{confirm as s}from"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-PLJB4H3G.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import{Icon as i}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useRef as a,useEffect as c,useState as l}from"react";import{jsxs as m,jsx as u,Fragment as h}from"react/jsx-runtime";var p="react-os-shell:browser-bookmarks",d="react-os-shell:browser-homepage",k="https://en.wikipedia.org/wiki/Main_Page",b=[{label:"Wikipedia",url:"https://en.wikipedia.org/wiki/Main_Page"},{label:"DevDocs",url:"https://devdocs.io"},{label:"Example",url:"https://example.com"}],g=new Set(["ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi","bj bm bn bo br bs bt bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu cv","cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gd","ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id ie il","im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc","li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms mt mu","mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pl","pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sk sl sm sn","so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt tv tw tz","ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw","com net org edu gov mil int info biz name pro app dev xyz online site tech","store shop cloud design digital agency studio media news blog live life","world today email systems solutions services software page link space host","press wiki team group works careers finance capital energy academy"].join(" ").split(" "));function f(e){let t=e.trim();return t?/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:function(e){const t=/^([\w-]+\.)+([a-z]{2,})(\/.*)?$/i.exec(e);return null!==t&&g.has(t[2].toLowerCase())}(t)?"https://"+t:"https://duckduckgo.com/?q="+encodeURIComponent(t):""}var w=["duckduckgo.com","developer.mozilla.org","google.com","gmail.com","youtube.com","facebook.com","instagram.com","whatsapp.com","twitter.com","x.com","github.com","gitlab.com","linkedin.com","reddit.com","pinterest.com","amazon.com","amazon.ca","amazon.co.uk","apple.com","icloud.com","microsoft.com","outlook.com","live.com","office.com","netflix.com","spotify.com","paypal.com","stripe.com","chat.openai.com","chatgpt.com","claude.ai"];function x(){if("undefined"==typeof window)return b;try{const e=localStorage.getItem(p);if(!e)return b;const t=JSON.parse(e);if(Array.isArray(t)&&t.every(e=>"string"==typeof e?.url))return t}catch{}return b}function y(){return"undefined"==typeof window?k:localStorage.getItem(d)||k}function j(){const h=a(void 0);void 0===h.current&&(h.current=t()),c(()=>{null!=h.current&&o(h.current)},[]);const k=h.current?f(h.current.url):"",[b,g]=l(y),[w,j]=l(k||b),[C,R]=l(w),[W,P]=l([w]),[H,L]=l(0),[O,z]=l(0),[S,T]=l(x),[U,D]=l(!1),[B,G]=l(null),Z=a(null),J=a(null);c(()=>{try{localStorage.setItem(p,JSON.stringify(S))}catch{}},[S]);const M=e=>{const t=f(e);t&&(j(t),R(t),P(e=>{const o=e.slice(0,H+1);return o.push(t),o}),L(e=>e+1),D(!1))},Y=()=>{"undefined"!=typeof window&&window.open(w,"_blank","noopener,noreferrer")},E=()=>{const e=B?.trim();e?(T(t=>[...t,{label:e,url:w}]),G(null)):G(null)};c(()=>{if(null===B)return;Z.current?.focus(),Z.current?.select();const e=e=>{const t=e.target;t?.closest("[data-bookmark-popover]")||G(null)},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[null!==B]);const Q=e=>{T(t=>t.filter((t,o)=>o!==e))},A=H>0,I=H<W.length-1,V=S.some(e=>e.url===w),K="p-2 rounded hover:bg-gray-200 transition-colors text-gray-600 disabled:opacity-30";/* @__PURE__ */
2
2
  return m("div",{className:"relative flex flex-col h-full bg-white",children:[
3
- /* @__PURE__ */u(n,{title:`Browser - ${j(w)}`}),
3
+ /* @__PURE__ */u(n,{title:`Browser - ${N(w)}`}),
4
4
  /* @__PURE__ */u(r,{app:"browser"}),
5
5
  /* @__PURE__ */m("div",{className:"flex items-center gap-1 px-2 py-2 border-b border-line bg-surface-sunken shrink-0",children:[
6
- /* @__PURE__ */u("button",{onClick:()=>{if(P>0){const e=P-1;H(e),N(D[e]),R(D[e]),E(!1)}},disabled:!K,className:Q,title:"Back",children:/* @__PURE__ */u(i,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
- /* @__PURE__ */u("button",{onClick:()=>{if(P<D.length-1){const e=P+1;H(e),N(D[e]),R(D[e]),E(!1)}},disabled:!O,className:Q,title:"Forward",children:/* @__PURE__ */u(i,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
- /* @__PURE__ */u("button",{onClick:()=>Z(e=>e+1),className:Q,title:"Refresh",children:/* @__PURE__ */u(i,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
- /* @__PURE__ */u("button",{onClick:()=>M(b),className:Q,title:"Home",children:/* @__PURE__ */u(i,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
6
+ /* @__PURE__ */u("button",{onClick:()=>{if(H>0){const e=H-1;L(e),j(W[e]),R(W[e]),D(!1)}},disabled:!A,className:K,title:"Back",children:/* @__PURE__ */u(i,{name:"chevron-left",className:"h-4 w-4",strokeWidth:2})}),
7
+ /* @__PURE__ */u("button",{onClick:()=>{if(H<W.length-1){const e=H+1;L(e),j(W[e]),R(W[e]),D(!1)}},disabled:!I,className:K,title:"Forward",children:/* @__PURE__ */u(i,{name:"chevron-right",className:"h-4 w-4",strokeWidth:2})}),
8
+ /* @__PURE__ */u("button",{onClick:()=>z(e=>e+1),className:K,title:"Refresh",children:/* @__PURE__ */u(i,{name:"refresh",className:"h-4 w-4",strokeWidth:1.8})}),
9
+ /* @__PURE__ */u("button",{onClick:()=>M(b),className:K,title:"Home",children:/* @__PURE__ */u(i,{name:"home",className:"h-4 w-4",strokeWidth:1.8})}),
10
10
  /* @__PURE__ */u("form",{onSubmit:e=>{e.preventDefault(),M(C)},className:"flex-1 flex items-center mx-1",children:/* @__PURE__ */m("div",{className:"flex items-center w-full bg-white border border-gray-300 rounded focus-within:border-blue-400 focus-within:ring-1 focus-within:ring-blue-200",children:[
11
11
  /* @__PURE__ */u("span",{className:"px-2 text-gray-400 text-xs",children:w.startsWith("https://")?"🔒":"⚠️"}),
12
12
  /* @__PURE__ */u("input",{type:"text",value:C,onChange:e=>R(e.target.value),onFocus:e=>e.target.select(),className:"flex-1 px-1 py-1 text-sm bg-transparent outline-none font-mono",spellCheck:!1,placeholder:"Enter URL or search…"}),w!==C&&
13
13
  /* @__PURE__ */u("span",{className:"flex pr-1",children:/* @__PURE__ */u(e,{action:{label:"Reset to current URL",icon:/* @__PURE__ */u(i,{name:"close"}),onClick:()=>R(w)}})})]})}),
14
- /* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>V?B(z.findIndex(e=>e.url===w)):void L(j(w)),className:Q+" "+(V?"text-yellow-500":""),title:V?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(i,{name:"star",className:"h-4 w-4",fill:V?"currentColor":"none",strokeWidth:1.5})}),
15
- /* @__PURE__ */u("button",{onClick:J,className:Q,title:"Open in new tab",children:/* @__PURE__ */u(i,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
16
- /* @__PURE__ */u("button",{onClick:()=>E(e=>!e),className:Q,title:"Embedding help",children:/* @__PURE__ */u(i,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==G&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
14
+ /* @__PURE__ */u("button",{"data-bookmark-popover":!0,onClick:()=>V?Q(S.findIndex(e=>e.url===w)):void G(N(w)),className:K+" "+(V?"text-yellow-500":""),title:V?"Remove bookmark":"Add bookmark",children:/* @__PURE__ */u(i,{name:"star",className:"h-4 w-4",fill:V?"currentColor":"none",strokeWidth:1.5})}),
15
+ /* @__PURE__ */u("button",{onClick:Y,className:K,title:"Open in new tab",children:/* @__PURE__ */u(i,{name:"external",className:"h-4 w-4",strokeWidth:1.5})}),
16
+ /* @__PURE__ */u("button",{onClick:()=>D(e=>!e),className:K,title:"Embedding help",children:/* @__PURE__ */u(i,{name:"help",className:"h-4 w-4",strokeWidth:1.5})})]}),null!==B&&/* @__PURE__ */m("div",{"data-bookmark-popover":!0,className:"absolute right-3 top-12 z-30 w-72 bg-white border border-gray-200 rounded-md shadow-lg p-3",children:[
17
17
  /* @__PURE__ */u("div",{className:"text-2xs font-semibold uppercase tracking-wide text-ink-faint mb-1",children:"Bookmark this page"}),
18
18
  /* @__PURE__ */u("div",{className:"text-2xs text-ink-faintest truncate mb-2 font-mono",title:w,children:w}),
19
- /* @__PURE__ */u("input",{ref:A,type:"text",value:G,onChange:e=>L(e.target.value),onKeyDown:e=>{"Enter"===e.key?Y():"Escape"===e.key&&L(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
19
+ /* @__PURE__ */u("input",{ref:Z,type:"text",value:B,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key?E():"Escape"===e.key&&G(null)},placeholder:"Name",className:"w-full text-sm px-2 h-8 border border-line-strong rounded focus:outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-200"}),
20
20
  /* @__PURE__ */m("div",{className:"flex justify-end gap-1 mt-2",children:[
21
- /* @__PURE__ */u("button",{onClick:()=>L(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
22
- /* @__PURE__ */u("button",{onClick:Y,disabled:!G.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
23
- /* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===z.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),z.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>M(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&B(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
21
+ /* @__PURE__ */u("button",{onClick:()=>G(null),className:"px-2 py-1 text-xs text-gray-600 hover:bg-gray-100 rounded",children:"Cancel"}),
22
+ /* @__PURE__ */u("button",{onClick:E,disabled:!B.trim(),className:"px-2 py-1 text-xs bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-40",children:"Save"})]})]}),
23
+ /* @__PURE__ */m("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-gray-200 bg-white shrink-0 overflow-x-auto",children:[0===S.length&&/* @__PURE__ */u("span",{className:"text-2xs text-ink-faintest italic px-2",children:"No bookmarks yet — star the address bar to add one."}),S.map((e,t)=>/* @__PURE__ */m("button",{onClick:()=>M(e.url),onContextMenu:async o=>{o.preventDefault();await s({title:"Remove bookmark",message:`"${e.label}" will be removed from your bookmarks.`,confirmLabel:"Remove",variant:"danger"})&&Q(t)},className:"flex items-center gap-2 px-2 py-0.5 rounded text-xs text-ink hover:bg-gray-100 whitespace-nowrap",title:`${e.url}\n(right-click to remove)`,children:[
24
24
  /* @__PURE__ */u("img",{src:`https://icons.duckduckgo.com/ip3/${new URL(e.url).hostname}.ico`,alt:"",className:"h-3.5 w-3.5",onError:e=>{e.target.style.visibility="hidden"}}),e.label]},t)),
25
25
  /* @__PURE__ */u("div",{className:"flex-1"}),
26
26
  /* @__PURE__ */u("button",{onClick:()=>{g(w);try{localStorage.setItem(d,w)}catch{}},className:"px-2 py-0.5 text-2xs text-ink-faint hover:text-ink-strong",title:"Set current page as homepage",children:"Set as home"})]}),
27
- /* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(v,{url:w,iframeKey:S,iframeRef:F,openExternal:J,showHelp:U,dismissHelp:()=>E(!1)})})]})}function j(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function v({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[a,p]=l(!1);c(()=>{p(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!a?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
27
+ /* @__PURE__ */u("div",{className:"flex-1 relative min-h-0 bg-gray-50",children:/* @__PURE__ */u(v,{url:w,iframeKey:O,iframeRef:J,openExternal:Y,showHelp:U,dismissHelp:()=>D(!1)})})]})}function N(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function v({url:e,iframeKey:t,iframeRef:o,openExternal:r,showHelp:n,dismissHelp:s}){const[a,p]=l(!1);c(()=>{p(!1)},[e]);return function(e){try{const t=new URL(e).hostname.toLowerCase();return w.some(e=>t===e||t.endsWith("."+e))}catch{return!1}}(e)&&!a?/* @__PURE__ */u("div",{className:"absolute inset-0 flex items-center justify-center bg-white p-8",children:/* @__PURE__ */m("div",{className:"max-w-md text-center",children:[
28
28
  /* @__PURE__ */u(i,{name:"no-symbol",className:"h-14 w-14 mx-auto text-gray-300 mb-3",strokeWidth:1.2}),
29
- /* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[j(e)," can't be embedded"]}),
29
+ /* @__PURE__ */m("h3",{className:"text-base font-semibold text-gray-800 mb-1",children:[N(e)," can't be embedded"]}),
30
30
  /* @__PURE__ */m("p",{className:"text-sm text-gray-500 mb-4",children:["This site sends an ",
31
31
  /* @__PURE__ */u("span",{className:"font-mono text-xs",children:"X-Frame-Options"})," ","or ",
32
32
  /* @__PURE__ */u("span",{className:"font-mono text-xs",children:"Content-Security-Policy"})," header that refuses iframe embedding. The browser blocks the load before our app can do anything about it."]}),
@@ -41,4 +41,4 @@ return m("div",{className:"relative flex flex-col h-full bg-white",children:[
41
41
  /* @__PURE__ */m("p",{children:["Hit the ",
42
42
  /* @__PURE__ */u("span",{className:"font-medium",children:"↗"})," button to open the page in a real new tab. Sites that ",
43
43
  /* @__PURE__ */u("em",{children:"do"})," allow embedding (Wikipedia, DevDocs, your own apps) work fine in here."]}),
44
- /* @__PURE__ */u("button",{onClick:s,className:"mt-2 text-2xs text-blue-600 hover:underline",children:"Got it"})]})]})}export{N as default};
44
+ /* @__PURE__ */u("button",{onClick:s,className:"mt-2 text-2xs text-blue-600 hover:underline",children:"Got it"})]})]})}export{j as default};
@@ -1,29 +1,29 @@
1
- import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-RRWQBWLW.js";import{useWidgetSettings as n}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import{Icon as r}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as l,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[j,b]=c(null),[g,N]=c(!1),[C,y]=c(""),[x,f]=c([]),[v,$]=c(!1),[T,P]=c(()=>t(h)),[E,R]=c(!1),[Z,A]=c(T),D=i(null);n(o(()=>{A({...T}),R(!0)},[T]));const W=o(t=>{y(""),k(e=>g||"0"===e?(N(!1),"."===t?"0.":t):"."===t&&e.includes(".")?e:e+t)},[g]),G=o(()=>{k("0"),d(null),b(null),N(!1)},[]),S=o((t,e,n)=>{switch(n){case"+":return t+e;case"-":return t-e;case"×":return t*e;case"÷":return 0===e?0:t/e;default:return e}},[]),B=o(t=>{const e=parseFloat(m);if(null!==p&&j&&!g){const t=S(p,e,j);k(String(t)),d(t),f(n=>[`${p} ${j} ${e} = ${t}`,...n].slice(0,20))}else d(e);b(t),N(!0)},[m,p,j,g,S]),F=o(()=>{if(null===p||!j)return;const t=parseFloat(m),e=S(p,t,j),n=`${p} ${j} ${t} =`;f(t=>[`${n} ${e}`,...t].slice(0,20)),y(n),k(String(e)),d(null),b(null),N(!0)},[m,p,j,S]),U=o(()=>{k(t=>String(parseFloat(t)/100))},[]),H=o(()=>{k(t=>t.startsWith("-")?t.slice(1):"0"===t?t:"-"+t)},[]);s(()=>{const t=t=>{const e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e&&"SELECT"!==e&&(t.key>="0"&&t.key<="9"?W(t.key):"."===t.key?W("."):"+"===t.key?B("+"):"-"===t.key?B("-"):"*"===t.key?B("×"):"/"===t.key?(t.preventDefault(),B("÷")):"Enter"===t.key||"="===t.key?("Enter"===t.key&&t.target instanceof Node&&D.current?.contains(t.target)&&t.preventDefault(),F()):"Escape"===t.key?G():"Backspace"===t.key?k(t=>t.length>1?t.slice(0,-1):"0"):"%"===t.key&&U())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[W,B,F,G,U]);const J="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",Q=`${J} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,M=`${J} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,V=`${J} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,Y=`${J} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-ZV2ZAHZV.js";import{useWidgetSettings as n}from"./chunk-XNPCOWOO.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import{Icon as r}from"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as c,useRef as i,useCallback as o,useEffect as s}from"react";import{jsxs as l,Fragment as a,jsx as u}from"react/jsx-runtime";var h="calc_appearance";function m(){const[m,k]=c("0"),[p,d]=c(null),[j,b]=c(null),[g,N]=c(!1),[C,y]=c(""),[x,f]=c([]),[v,$]=c(!1),[Z,T]=c(()=>t(h)),[P,W]=c(!1),[B,E]=c(Z),O=i(null);n(o(()=>{E({...Z}),W(!0)},[Z]));const V=o(t=>{y(""),k(e=>g||"0"===e?(N(!1),"."===t?"0.":t):"."===t&&e.includes(".")?e:e+t)},[g]),A=o(()=>{k("0"),d(null),b(null),N(!1)},[]),J=o((t,e,n)=>{switch(n){case"+":return t+e;case"-":return t-e;case"×":return t*e;case"÷":return 0===e?0:t/e;default:return e}},[]),R=o(t=>{const e=parseFloat(m);if(null!==p&&j&&!g){const t=J(p,e,j);k(String(t)),d(t),f(n=>[`${p} ${j} ${e} = ${t}`,...n].slice(0,20))}else d(e);b(t),N(!0)},[m,p,j,g,J]),U=o(()=>{if(null===p||!j)return;const t=parseFloat(m),e=J(p,t,j),n=`${p} ${j} ${t} =`;f(t=>[`${n} ${e}`,...t].slice(0,20)),y(n),k(String(e)),d(null),b(null),N(!0)},[m,p,j,J]),G=o(()=>{k(t=>String(parseFloat(t)/100))},[]),H=o(()=>{k(t=>t.startsWith("-")?t.slice(1):"0"===t?t:"-"+t)},[]);s(()=>{const t=t=>{const e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e&&"SELECT"!==e&&(t.key>="0"&&t.key<="9"?V(t.key):"."===t.key?V("."):"+"===t.key?R("+"):"-"===t.key?R("-"):"*"===t.key?R("×"):"/"===t.key?(t.preventDefault(),R("÷")):"Enter"===t.key||"="===t.key?("Enter"===t.key&&t.target instanceof Node&&O.current?.contains(t.target)&&t.preventDefault(),U()):"Escape"===t.key?A():"Backspace"===t.key?k(t=>t.length>1?t.slice(0,-1):"0"):"%"===t.key&&G())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[V,R,U,A,G]);const M="flex items-center justify-center rounded-lg text-sm font-medium transition-colors",S=`${M} bg-white border border-gray-200 text-gray-900 hover:bg-gray-50 active:bg-gray-100`,D=`${M} bg-blue-50 border border-blue-200 text-blue-700 hover:bg-blue-100 active:bg-blue-200`,F=`${M} bg-gray-100 border border-gray-200 text-gray-600 hover:bg-gray-200 active:bg-gray-300`,L=`${M} bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800`;/* @__PURE__ */
2
2
  return l(a,{children:[
3
- /* @__PURE__ */l("div",{ref:D,className:"flex flex-col h-full",style:{opacity:T.activeOpacity/100,backdropFilter:T.activeBlur>0?`blur(${T.activeBlur}px)`:void 0},children:[
3
+ /* @__PURE__ */l("div",{ref:O,className:"flex flex-col h-full",style:{opacity:Z.activeOpacity/100,backdropFilter:Z.activeBlur>0?`blur(${Z.activeBlur}px)`:void 0},children:[
4
4
  /* @__PURE__ */l("div",{className:"bg-slate-200 rounded-t-lg px-4 py-2 group/display relative flex flex-col justify-end min-h-[120px] border-b border-slate-300",children:[
5
5
  /* @__PURE__ */u("div",{className:"flex flex-col justify-end flex-1 overflow-hidden",children:x.slice(0,3).reverse().map((t,e)=>/* @__PURE__ */u("div",{className:"text-2xs text-slate-400 text-right font-mono truncate",children:t},e))}),(C||j&&null!==p)&&/* @__PURE__ */u("div",{className:"text-base text-slate-600 text-right font-mono",children:C||`${p} ${j} ${g?"":m}`}),
6
6
  /* @__PURE__ */l("div",{className:"flex items-center gap-2",children:[
7
7
  /* @__PURE__ */u("button",{onClick:()=>{navigator.clipboard.writeText(m),$(!0),setTimeout(()=>$(!1),1200)},title:"Copy result",className:"shrink-0 text-slate-300 hover:text-slate-500 transition-colors opacity-0 group-hover/display:opacity-100",children:/* @__PURE__ */u(r,v?{name:"check",className:"h-5 w-5 text-green-500",strokeWidth:2}:{name:"copy",className:"h-5 w-5",strokeWidth:2})}),
8
8
  /* @__PURE__ */u("div",{className:"text-right text-4xl font-mono font-bold text-slate-800 truncate flex-1",children:(t=>{const e=parseFloat(t);return isNaN(e)||t.endsWith(".")||t.endsWith(".0")||Math.abs(e)<1e15&&t.length<16?t:e.toExponential(6)})(m)})]})]}),
9
9
  /* @__PURE__ */l("div",{className:"grid grid-cols-4 grid-rows-5 gap-2 flex-1 min-h-0 p-2",children:[
10
- /* @__PURE__ */u("button",{onClick:G,className:V,children:"AC"}),
11
- /* @__PURE__ */u("button",{onClick:H,className:V,children:"+/−"}),
12
- /* @__PURE__ */u("button",{onClick:U,className:V,children:"%"}),
13
- /* @__PURE__ */u("button",{onClick:()=>B("÷"),className:`${M} ${"÷"===j?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
- /* @__PURE__ */u("button",{onClick:()=>W("7"),className:Q,children:"7"}),
15
- /* @__PURE__ */u("button",{onClick:()=>W("8"),className:Q,children:"8"}),
16
- /* @__PURE__ */u("button",{onClick:()=>W("9"),className:Q,children:"9"}),
17
- /* @__PURE__ */u("button",{onClick:()=>B("×"),className:`${M} ${"×"===j?"ring-2 ring-blue-400":""}`,children:"×"}),
18
- /* @__PURE__ */u("button",{onClick:()=>W("4"),className:Q,children:"4"}),
19
- /* @__PURE__ */u("button",{onClick:()=>W("5"),className:Q,children:"5"}),
20
- /* @__PURE__ */u("button",{onClick:()=>W("6"),className:Q,children:"6"}),
21
- /* @__PURE__ */u("button",{onClick:()=>B("-"),className:`${M} ${"-"===j?"ring-2 ring-blue-400":""}`,children:"−"}),
22
- /* @__PURE__ */u("button",{onClick:()=>W("1"),className:Q,children:"1"}),
23
- /* @__PURE__ */u("button",{onClick:()=>W("2"),className:Q,children:"2"}),
24
- /* @__PURE__ */u("button",{onClick:()=>W("3"),className:Q,children:"3"}),
25
- /* @__PURE__ */u("button",{onClick:()=>B("+"),className:`${M} ${"+"===j?"ring-2 ring-blue-400":""}`,children:"+"}),
26
- /* @__PURE__ */u("button",{onClick:()=>W("0"),className:`${Q} col-span-2`,children:"0"}),
27
- /* @__PURE__ */u("button",{onClick:()=>W("."),className:Q,children:"."}),
28
- /* @__PURE__ */u("button",{onClick:F,className:Y,children:"="})]})]}),
29
- /* @__PURE__ */u(e,{open:E,onClose:()=>R(!1),title:"Calculator Settings",appearance:Z,onAppearanceChange:A,onSave:()=>{P(Z),localStorage.setItem(h,JSON.stringify(Z)),R(!1)}})]})}export{m as default};
10
+ /* @__PURE__ */u("button",{onClick:A,className:F,children:"AC"}),
11
+ /* @__PURE__ */u("button",{onClick:H,className:F,children:"+/−"}),
12
+ /* @__PURE__ */u("button",{onClick:G,className:F,children:"%"}),
13
+ /* @__PURE__ */u("button",{onClick:()=>R("÷"),className:`${D} ${"÷"===j?"ring-2 ring-blue-400":""}`,children:"÷"}),
14
+ /* @__PURE__ */u("button",{onClick:()=>V("7"),className:S,children:"7"}),
15
+ /* @__PURE__ */u("button",{onClick:()=>V("8"),className:S,children:"8"}),
16
+ /* @__PURE__ */u("button",{onClick:()=>V("9"),className:S,children:"9"}),
17
+ /* @__PURE__ */u("button",{onClick:()=>R("×"),className:`${D} ${"×"===j?"ring-2 ring-blue-400":""}`,children:"×"}),
18
+ /* @__PURE__ */u("button",{onClick:()=>V("4"),className:S,children:"4"}),
19
+ /* @__PURE__ */u("button",{onClick:()=>V("5"),className:S,children:"5"}),
20
+ /* @__PURE__ */u("button",{onClick:()=>V("6"),className:S,children:"6"}),
21
+ /* @__PURE__ */u("button",{onClick:()=>R("-"),className:`${D} ${"-"===j?"ring-2 ring-blue-400":""}`,children:"−"}),
22
+ /* @__PURE__ */u("button",{onClick:()=>V("1"),className:S,children:"1"}),
23
+ /* @__PURE__ */u("button",{onClick:()=>V("2"),className:S,children:"2"}),
24
+ /* @__PURE__ */u("button",{onClick:()=>V("3"),className:S,children:"3"}),
25
+ /* @__PURE__ */u("button",{onClick:()=>R("+"),className:`${D} ${"+"===j?"ring-2 ring-blue-400":""}`,children:"+"}),
26
+ /* @__PURE__ */u("button",{onClick:()=>V("0"),className:`${S} col-span-2`,children:"0"}),
27
+ /* @__PURE__ */u("button",{onClick:()=>V("."),className:S,children:"."}),
28
+ /* @__PURE__ */u("button",{onClick:U,className:L,children:"="})]})]}),
29
+ /* @__PURE__ */u(e,{open:P,onClose:()=>W(!1),title:"Calculator Settings",appearance:B,onAppearanceChange:E,onSave:()=>{T(B),localStorage.setItem(h,JSON.stringify(B)),W(!1)}})]})}export{m as default};
@@ -1,21 +1,21 @@
1
- import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-RRWQBWLW.js";import{useWidgetSettings as r}from"./chunk-GD5NGS6D.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-JRKD7SD3.js";import"./chunk-5RCKE4X2.js";import"./chunk-ZLB5GRL6.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-5QHNDAZ6.js";import"./chunk-TEQ5ZPAL.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-APFDZ2HG.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-A4ROXNUF.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-UQYNPYF4.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as i,Fragment as a,jsx as m}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",h="currency_appearance",k="currency_rates_cache";function d(t){try{const e=JSON.parse(localStorage.getItem(k)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function j(t,e){try{const r=JSON.parse(localStorage.getItem(k)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(k,JSON.stringify(r))}catch{}}function N(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var g={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,k]=s(N),[f,x]=s(()=>t(h)),[D,y]=s({}),[b,S]=s(!1),[C,U]=s(!1),[v,P]=s([]),[R,J]=s(f),[A,B]=s("USD"),[G,H]=s("CNY");r(o(()=>{P([...u]),J({...f}),U(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=d(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,j(e,n.rates))}catch{}}e&&(y(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
1
+ import{loadAppearance as t,WidgetSettingsModal as e}from"./chunk-ZV2ZAHZV.js";import{useWidgetSettings as r}from"./chunk-XNPCOWOO.js";import"./chunk-4LXCCZDM.js";import"./chunk-KNUR2UEG.js";import"./chunk-JDCM2VHG.js";import"./chunk-PSVGB7KT.js";import"./chunk-YI4T5I5D.js";import"./chunk-5A7MWTXX.js";import"./chunk-TJ5YMXVB.js";import"./chunk-OLXUMB2V.js";import"./chunk-R7OZ2AQD.js";import"./chunk-EIFNESXS.js";import"./chunk-PO2KNVCC.js";import"./chunk-CJ4OEY3T.js";import"./chunk-LLXI57MB.js";import"./chunk-NQWORKZD.js";import"./chunk-VWGWZY7A.js";import"./chunk-DBQNYJZ6.js";import"./chunk-L2WQOJ3T.js";import"./chunk-ZLB5GRL6.js";import"./chunk-5VJVEKVM.js";import"./chunk-YPXONNBV.js";import"./chunk-4PJFL26P.js";import"./chunk-2QY5BJLA.js";import"./chunk-UGTRSRIW.js";import"./chunk-POBVGDZP.js";import"./chunk-F3ZOO23R.js";import"./chunk-NJY4HPNB.js";import"./chunk-PM6HY5BH.js";import"./chunk-DWGYC7OD.js";import"./chunk-4YH7U7WL.js";import"./chunk-ABIWAS5K.js";import"./chunk-P56YLT73.js";import"./chunk-URHGHXDN.js";import"./chunk-5QFPTDQF.js";import"./chunk-37FQVY2O.js";import"./chunk-TSZPGDU3.js";import"./chunk-ISVODSRP.js";import"./chunk-J75ZT2JQ.js";import{LoadingSpinner as n}from"./chunk-R2VKEMZH.js";import"./chunk-BWJZTHZ6.js";import"./chunk-FAPZFMS3.js";import"./chunk-CIZAUBWA.js";import"./chunk-PGN5ME7B.js";import"./chunk-5QRHQCRG.js";import"./chunk-62LW225J.js";import"./chunk-TAHHZGRH.js";import"./chunk-KEFNQEXZ.js";import"./chunk-PU2GJVMG.js";import"./chunk-3FININUU.js";import"./chunk-STKJA4PV.js";import"./chunk-GZ4AMXEU.js";import"./chunk-M6UKCZHT.js";import"./chunk-3AUPCKBR.js";import"./chunk-LYGIOJ3J.js";import"./chunk-MRJKZWWV.js";import"./chunk-TWVUQUUD.js";import"./chunk-5FYDNH4Y.js";import"./chunk-LNXBTK7Q.js";import"./chunk-MAFUXCPZ.js";import"./chunk-NRHG4R2Q.js";import"./chunk-C3QOHMR6.js";import{useState as s,useCallback as o,useEffect as c}from"react";import{jsxs as i,Fragment as a,jsx as m}from"react/jsx-runtime";var l=["USD","CNY","AUD","GBP","EUR","JPY","CAD","THB","NZD","SGD","HKD","CHF","KRW","INR","MXN","BRL"],u=[["USD","CNY"],["USD","AUD"],["GBP","USD"],["USD","JPY"]],p="currency_pairs",h="currency_appearance",k="currency_rates_cache";function d(t){try{const e=JSON.parse(localStorage.getItem(k)||"{}")[t];if(e&&Date.now()-e.timestamp<36e5)return e.rates}catch{}return null}function j(t,e){try{const r=JSON.parse(localStorage.getItem(k)||"{}");r[t]={rates:e,timestamp:Date.now()},localStorage.setItem(k,JSON.stringify(r))}catch{}}function g(){try{const t=JSON.parse(localStorage.getItem(p)||"");if(Array.isArray(t)&&t.length)return t.slice(0,4)}catch{}return u}var N={USD:"🇺🇸",CNY:"🇨🇳",AUD:"🇦🇺",GBP:"🇬🇧",JPY:"🇯🇵",CAD:"🇨🇦",EUR:"🇪🇺",THB:"🇹🇭",NZD:"🇳🇿",SGD:"🇸🇬",HKD:"🇭🇰",CHF:"🇨🇭",KRW:"🇰🇷",INR:"🇮🇳",MXN:"🇲🇽",BRL:"🇧🇷"};function f(){const[u,k]=s(g),[f,x]=s(()=>t(h)),[y,b]=s({}),[D,S]=s(!1),[C,U]=s(!1),[v,J]=s([]),[B,P]=s(f),[O,R]=s("USD"),[Z,A]=s("CNY");r(o(()=>{J([...u]),P({...f}),U(!0)},[u,f])),c(()=>{const t=[...new Set(u.map(([t])=>t))];let e=!0;return async function(){S(!0);const r={};for(const e of t){const t=d(e);if(t)r[e]=t;else try{const t=await fetch(`https://open.er-api.com/v6/latest/${e}`),n=await t.json();n.rates&&(r[e]=n.rates,j(e,n.rates))}catch{}}e&&(b(r),S(!1))}(),()=>{e=!1}},[u]);/* @__PURE__ */
2
2
  return i(a,{children:[
3
- /* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[b&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=D[t]?.[e];/* @__PURE__ */
3
+ /* @__PURE__ */m("div",{style:{backgroundColor:`rgb(var(--taskbar-bg-rgb, 243 244 246) / ${f.activeOpacity/100})`,backdropFilter:f.activeBlur>0?`blur(${f.activeBlur}px)`:void 0},children:/* @__PURE__ */i("div",{className:"px-4 py-3 space-y-1",children:[D&&/* @__PURE__ */m(n,{size:"sm",padding:"py-4",label:"Loading rates"}),u.map(([t,e],r)=>{const n=y[t]?.[e];/* @__PURE__ */
4
4
  return i("button",{onClick:()=>{const t=u.map((t,e)=>e===r?[t[1],t[0]]:t);k(t),localStorage.setItem(p,JSON.stringify(t))},className:"flex items-center justify-between px-2 py-2 border-b border-gray-200 last:border-0 w-full hover:bg-gray-100 rounded transition-colors cursor-pointer",children:[
5
5
  /* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
6
- /* @__PURE__ */m("span",{className:"text-base",children:g[t]||""}),
6
+ /* @__PURE__ */m("span",{className:"text-base",children:N[t]||""}),
7
7
  /* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:t}),
8
8
  /* @__PURE__ */m("svg",{className:"h-3 w-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */m("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"})}),
9
- /* @__PURE__ */m("span",{className:"text-base",children:g[e]||""}),
9
+ /* @__PURE__ */m("span",{className:"text-base",children:N[e]||""}),
10
10
  /* @__PURE__ */m("span",{className:"text-sm font-semibold text-gray-700",children:e})]}),
11
11
  /* @__PURE__ */m("div",{className:"text-base font-mono font-semibold text-gray-900 tabular-nums",children:null!=n?n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):"—"})]},`${t}-${e}-${r}`)})]})}),
12
- /* @__PURE__ */m(e,{open:C,onClose:()=>U(!1),title:"Currency Settings",appearance:R,onAppearanceChange:J,onSave:()=>{if(0===v.length)return;const t=v.slice(0,4);k(t),x(R),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(R)),U(!1)},children:/* @__PURE__ */i("div",{children:[
12
+ /* @__PURE__ */m(e,{open:C,onClose:()=>U(!1),title:"Currency Settings",appearance:B,onAppearanceChange:P,onSave:()=>{if(0===v.length)return;const t=v.slice(0,4);k(t),x(B),localStorage.setItem(p,JSON.stringify(t)),localStorage.setItem(h,JSON.stringify(B)),U(!1)},children:/* @__PURE__ */i("div",{children:[
13
13
  /* @__PURE__ */i("h3",{className:"text-sm font-semibold text-ink mb-2",children:["Currency Pairs ",
14
14
  /* @__PURE__ */i("span",{className:"text-2xs font-normal text-ink-faintest",children:["(",v.length,"/",4,")"]})]}),
15
15
  /* @__PURE__ */m("div",{className:"space-y-1 mb-2",children:v.map(([t,e],r)=>/* @__PURE__ */i("div",{className:"flex items-center justify-between py-1 px-2 bg-gray-50 rounded",children:[
16
- /* @__PURE__ */i("span",{className:"text-sm",children:[g[t]||""," ",t," → ",g[e]||""," ",e]}),
17
- /* @__PURE__ */m("button",{onClick:()=>P(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),v.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
18
- /* @__PURE__ */m("select",{value:A,onChange:t=>B(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
16
+ /* @__PURE__ */i("span",{className:"text-sm",children:[N[t]||""," ",t," → ",N[e]||""," ",e]}),
17
+ /* @__PURE__ */m("button",{onClick:()=>J(t=>t.filter((t,e)=>e!==r)),className:"text-red-400 hover:text-red-600",children:"×"})]},r))}),v.length<4?/* @__PURE__ */i("div",{className:"flex items-center gap-2",children:[
18
+ /* @__PURE__ */m("select",{value:O,onChange:t=>R(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
19
19
  /* @__PURE__ */m("span",{className:"text-gray-400",children:"→"}),
20
- /* @__PURE__ */m("select",{value:G,onChange:t=>H(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
21
- /* @__PURE__ */m("button",{onClick:()=>{A!==G&&v.length<4&&P(t=>[...t,[A,G]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */i("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};
20
+ /* @__PURE__ */m("select",{value:Z,onChange:t=>A(t.target.value),className:"bg-gray-50 border border-gray-200 rounded px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500",children:l.map(t=>/* @__PURE__ */m("option",{children:t},t))}),
21
+ /* @__PURE__ */m("button",{onClick:()=>{O!==Z&&v.length<4&&J(t=>[...t,[O,Z]])},className:"text-sm font-medium text-blue-600 hover:text-blue-800 px-2",children:"+ Add"})]}):/* @__PURE__ */i("p",{className:"text-2xs text-ink-faintest italic",children:["Max ",4," pairs — remove one to add another."]})]})})]})}export{f as default};