@rozenite/storage-plugin 1.13.0 → 2.1.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 (84) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +6 -1
  3. package/dist/devtools/assets/panel-BlDRXgVW.js +32 -0
  4. package/dist/devtools/assets/panel-DBweZnW5.css +1 -0
  5. package/dist/devtools/panel.html +2 -2
  6. package/dist/react-native/chunks/async-storage.require.cjs +1 -1
  7. package/dist/react-native/chunks/async-storage.require.js +8 -7
  8. package/dist/react-native/chunks/index.require.cjs +1 -1
  9. package/dist/react-native/chunks/index.require.js +70 -66
  10. package/dist/react-native/chunks/secure-storage.require.cjs +1 -1
  11. package/dist/react-native/chunks/secure-storage.require.js +17 -13
  12. package/dist/react-native/chunks/useRozeniteStoragePlugin.require.cjs +1 -1
  13. package/dist/react-native/chunks/useRozeniteStoragePlugin.require.js +863 -344
  14. package/dist/react-native/index.d.ts +166 -18
  15. package/dist/rozenite.json +1 -1
  16. package/dist/sdk/index.cjs +1 -1
  17. package/dist/sdk/index.d.ts +13 -5
  18. package/dist/sdk/index.js +21 -12
  19. package/package.json +35 -37
  20. package/react-native.ts +12 -22
  21. package/rozenite.config.ts +74 -0
  22. package/sdk.ts +1 -5
  23. package/src/react-native/__tests__/entry-preview-pagination.test.ts +234 -0
  24. package/src/react-native/__tests__/export-snapshot.test.ts +138 -0
  25. package/src/react-native/__tests__/full-entry-request.test.ts +143 -0
  26. package/src/react-native/__tests__/import.test.ts +174 -11
  27. package/src/react-native/__tests__/storage-discovery.test.ts +144 -0
  28. package/src/react-native/__tests__/storage-view.test.ts +172 -0
  29. package/src/react-native/__tests__/stress-verification.test.ts +140 -0
  30. package/src/react-native/__tests__/use-storage-agent-tools.test.ts +221 -0
  31. package/src/react-native/adapters/__tests__/mmkv.test.ts +20 -30
  32. package/src/react-native/adapters/async-storage.ts +8 -9
  33. package/src/react-native/adapters/index.ts +2 -8
  34. package/src/react-native/adapters/mmkv.ts +12 -24
  35. package/src/react-native/adapters/secure-storage.ts +4 -0
  36. package/src/react-native/entry-preview-pagination.ts +261 -0
  37. package/src/react-native/export-snapshot.ts +88 -0
  38. package/src/react-native/full-entry-request.ts +91 -0
  39. package/src/react-native/import.ts +179 -16
  40. package/src/react-native/storage-discovery.ts +92 -0
  41. package/src/react-native/storage-view.ts +47 -109
  42. package/src/react-native/useRozeniteStoragePlugin.ts +153 -129
  43. package/src/react-native/useStorageAgentTools.ts +196 -91
  44. package/src/shared/__tests__/entry-preview.test.ts +99 -0
  45. package/src/shared/__tests__/snapshot.test.ts +31 -32
  46. package/src/shared/agent-tools.ts +33 -38
  47. package/src/shared/entry-preview.ts +54 -0
  48. package/src/shared/messaging.ts +140 -21
  49. package/src/shared/snapshot.ts +12 -18
  50. package/src/shared/types.ts +21 -4
  51. package/src/ui/__tests__/binary-value-editor-state.test.ts +16 -13
  52. package/src/ui/__tests__/binary.test.ts +31 -33
  53. package/src/ui/__tests__/large-value-viewer-state.test.ts +21 -0
  54. package/src/ui/__tests__/large-value-viewer.test.tsx +54 -0
  55. package/src/ui/__tests__/panel.test.tsx +382 -0
  56. package/src/ui/__tests__/storage-groups.test.ts +88 -0
  57. package/src/ui/__tests__/type-conversion.test.ts +8 -24
  58. package/src/ui/__tests__/use-storage-entries.test.tsx +337 -0
  59. package/src/ui/add-entry-dialog.tsx +66 -117
  60. package/src/ui/binary-value-editor-state.ts +16 -25
  61. package/src/ui/binary-value-editor.tsx +59 -47
  62. package/src/ui/binary.ts +54 -15
  63. package/src/ui/edit-entry-dialog.tsx +68 -104
  64. package/src/ui/editor-switcher.tsx +9 -16
  65. package/src/ui/entry-detail-dialog.tsx +62 -181
  66. package/src/ui/format-value.tsx +25 -0
  67. package/src/ui/globals.css +1 -123
  68. package/src/ui/import-dialog.tsx +72 -109
  69. package/src/ui/large-value-viewer-state.ts +25 -0
  70. package/src/ui/large-value-viewer.tsx +65 -0
  71. package/src/ui/panel.tsx +649 -509
  72. package/src/ui/query-client.tsx +23 -0
  73. package/src/ui/storage-groups.ts +66 -0
  74. package/src/ui/type-conversion.ts +2 -5
  75. package/src/ui/typed-value-editor.tsx +15 -20
  76. package/src/ui/use-storage-entries.ts +192 -0
  77. package/src/ui/utils.ts +1 -4
  78. package/tsconfig.json +5 -1
  79. package/dist/devtools/assets/panel-Bm-SWF7d.js +0 -33
  80. package/dist/devtools/assets/panel-DIqI4WSp.css +0 -1
  81. package/postcss.config.js +0 -6
  82. package/src/ui/confirm-dialog.tsx +0 -100
  83. package/src/ui/editable-table.tsx +0 -300
  84. package/tailwind.config.ts +0 -94
@@ -0,0 +1 @@
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--font-weight-semibold:600;--leading-snug:1.375;--radius-lg:var(--radius);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:var(--radius-lg);background-clip:padding-box;border:2px solid #0000}::-webkit-scrollbar-thumb:hover{background-color:var(--muted-foreground)}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing) * 4)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-0\.5{left:calc(var(--spacing) * .5)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.z-10{z-index:10}.z-50{z-index:50}.row-0{grid-row:0}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-auto{margin-top:auto}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3\.5{margin-left:calc(var(--spacing) * 3.5)}.ml-auto{margin-left:auto}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[70vh\]{max-height:70vh}.max-h-\[300px\]{max-height:300px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-28{min-height:calc(var(--spacing) * 28)}.min-h-56{min-height:calc(var(--spacing) * 56)}.min-h-\[120px\]{min-height:120px}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-56{width:calc(var(--spacing) * 56)}.w-80{width:calc(var(--spacing) * 80)}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-\[--anchor-width\]{min-width:--anchor-width}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.origin-\(--transform-origin\){transform-origin:var(--transform-origin)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-y{resize:vertical}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[minmax\(7rem\,25\%\)_minmax\(3rem\,1fr\)\]{grid-template-columns:minmax(7rem,25%) minmax(3rem,1fr)}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) * .8)}.rounded-sm{border-radius:calc(var(--radius) * .6)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-border{border-color:var(--border)}.border-destructive\/40{border-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.border-destructive\/40{border-color:color-mix(in oklab,var(--destructive) 40%,transparent)}}.border-destructive\/50{border-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.border-destructive\/50{border-color:color-mix(in oklab,var(--destructive) 50%,transparent)}}.border-input{border-color:var(--input)}.border-ring{border-color:var(--ring)}.border-sidebar-border{border-color:var(--sidebar-border)}.bg-background,.bg-background\/70{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/70{background-color:color-mix(in oklab,var(--background) 70%,transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive,.bg-destructive\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.bg-destructive\/10{background-color:color-mix(in oklab,var(--destructive) 10%,transparent)}}.bg-foreground{background-color:var(--foreground)}.bg-muted{background-color:var(--muted)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-transparent{background-color:#0000}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-8{padding-left:calc(var(--spacing) * 8)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-anywhere{overflow-wrap:anywhere}.break-all{word-break:break-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--accent)}.text-accent-foreground{color:var(--accent-foreground)}.text-background{color:var(--background)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-muted{color:var(--muted)}.text-muted-foreground,.text-muted-foreground\/60{color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,var(--muted-foreground) 60%,transparent)}}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/60{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/60{color:color-mix(in oklab,var(--sidebar-foreground) 60%,transparent)}}.lowercase{text-transform:lowercase}.italic{font-style:italic}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[transform\,opacity\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[transform\,scale\,opacity\]{transition-property:transform,scale,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.running{animation-play-state:running}@media(hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:-translate-y-0\.5:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}}.group-aria-\[orientation\=horizontal\]\/split-handle\:h-3:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){height:calc(var(--spacing) * 3)}.group-aria-\[orientation\=horizontal\]\/split-handle\:w-4:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){width:calc(var(--spacing) * 4)}.group-aria-\[orientation\=horizontal\]\/split-handle\:rotate-90:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){rotate:90deg}.group-aria-\[orientation\=vertical\]\/split-handle\:h-4:is(:where(.group\/split-handle)[aria-orientation=vertical] *){height:calc(var(--spacing) * 4)}.group-aria-\[orientation\=vertical\]\/split-handle\:w-3:is(:where(.group\/split-handle)[aria-orientation=vertical] *){width:calc(var(--spacing) * 3)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media(hover:hover){.hover\:bg-accent:hover,.hover\:bg-accent\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}.hover\:bg-muted-foreground:hover{background-color:var(--muted-foreground)}.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-destructive:hover{color:var(--destructive)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-primary:hover{color:var(--primary)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color:var(--sidebar-ring)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:var(--background)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-\[orientation\=horizontal\]\:h-px[aria-orientation=horizontal]{height:1px}.aria-\[orientation\=horizontal\]\:cursor-row-resize[aria-orientation=horizontal]{cursor:row-resize}.aria-\[orientation\=vertical\]\:w-px[aria-orientation=vertical]{width:1px}.aria-\[orientation\=vertical\]\:cursor-col-resize[aria-orientation=vertical]{cursor:col-resize}.data-\[checked\]\:translate-x-4[data-checked]{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[checked\]\:border-primary[data-checked]{border-color:var(--primary)}.data-\[checked\]\:bg-primary[data-checked]{background-color:var(--primary)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[ending-style\]\:scale-90[data-ending-style]{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[ending-style\]\:scale-95[data-ending-style]{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[ending-style\]\:opacity-0[data-ending-style]{opacity:0}.data-\[highlighted\]\:bg-accent[data-highlighted]{background-color:var(--accent)}.data-\[highlighted\]\:text-accent-foreground[data-highlighted]{color:var(--accent-foreground)}.data-\[selected\]\:bg-background[data-selected]{background-color:var(--background)}.data-\[selected\]\:bg-sidebar-accent[data-selected]{background-color:var(--sidebar-accent)}.data-\[selected\]\:font-medium[data-selected]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[selected\]\:text-foreground[data-selected]{color:var(--foreground)}.data-\[selected\]\:text-sidebar-accent-foreground[data-selected]{color:var(--sidebar-accent-foreground)}.data-\[selected\]\:shadow-xs[data-selected]{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[starting-style\]\:scale-90[data-starting-style]{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[starting-style\]\:scale-95[data-starting-style]{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[starting-style\]\:opacity-0[data-starting-style]{opacity:0}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:h-3\.5 svg{height:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:w-3\.5 svg{width:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\:\:-webkit-search-cancel-button\]\:appearance-none::-webkit-search-cancel-button{appearance:none}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}:root{--radius:0;--background:#fff;--foreground:#201f24;--card:#fff;--card-foreground:#201f24;--popover:#fff;--popover-foreground:#201f24;--primary:#8232ff;--primary-foreground:#fff;--secondary:#f9f8fd;--secondary-foreground:#201f24;--muted:#f9f8fd;--muted-foreground:#838289;--accent:#8232ff29;--accent-foreground:#201f24;--destructive:#fa7171;--destructive-foreground:#201f24;--border:#cfced5;--input:#cfced5;--ring:#8232ff;--sidebar:#fff;--sidebar-foreground:#201f24;--sidebar-primary:#8232ff;--sidebar-primary-foreground:#fff;--sidebar-accent:#8232ff29;--sidebar-accent-foreground:#201f24;--sidebar-border:#cfced5;--sidebar-ring:#8232ff}.dark{--background:#201f24;--foreground:#fff;--card:#201f24;--card-foreground:#fff;--popover:#2b2a2f;--popover-foreground:#fff;--primary:#8232ff;--primary-foreground:#fff;--secondary:#2b2a2f;--secondary-foreground:#fff;--muted:#2b2a2f;--muted-foreground:#cfced5;--accent:#8232ff33;--accent-foreground:#fff;--destructive:#fa7171;--destructive-foreground:#201f24;--border:#424145;--input:#424145;--ring:#8232ff;--sidebar:#201f24;--sidebar-foreground:#fff;--sidebar-primary:#8232ff;--sidebar-primary-foreground:#fff;--sidebar-accent:#8232ff33;--sidebar-accent-foreground:#fff;--sidebar-border:#424145;--sidebar-ring:#8232ff}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}
@@ -22,8 +22,8 @@
22
22
  <script>
23
23
  var __ROZENITE_PANEL__ = true;
24
24
  </script>
25
- <script type="module" crossorigin src="../devtools/assets/panel-Bm-SWF7d.js"></script>
26
- <link rel="stylesheet" crossorigin href="../devtools/assets/panel-DIqI4WSp.css">
25
+ <script type="module" crossorigin src="../devtools/assets/panel-BlDRXgVW.js"></script>
26
+ <link rel="stylesheet" crossorigin href="../devtools/assets/panel-DBweZnW5.css">
27
27
  </head>
28
28
  <body>
29
29
  <div id="root"></div>
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=(e,r,s,o)=>{const n="storage"in r?r:{storage:r},{storage:a,name:d,blacklist:i}=n;return{id:e,name:d??s??e,blacklist:i??o,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>a.getAllKeys(),get:async t=>{const c=await a.getItem(t);if(c!==null)return{key:t,type:"string",value:c}},set:async t=>{if(t.type!=="string")throw new Error("AsyncStorage adapter supports only string values.");await a.setItem(t.key,t.value)},delete:t=>a.removeItem(t)}}},l=e=>{const{adapterId:r="async-storage",adapterName:s="AsyncStorage"}=e,o="storages"in e?Object.entries(e.storages).map(([n,a])=>g(n,a)):[g(e.storageId??"default",e.storage,e.storageName??"Default Storage",e.blacklist)];return{id:r,name:s,storages:o}},y=l;exports.createAsyncStorageAdapter=l;exports.createExpoAsyncStorageAdapter=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=(e,r,s,o)=>{const c="storage"in r?r:{storage:r},{storage:a,name:d,blacklist:i}=c;return{id:e,name:d??s??e,blacklist:i??o,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>a.getAllKeys(),get:async t=>{const n=await a.getItem(t);if(n!==null)return{key:t,type:"string",value:n}},set:async t=>{if(t.type!=="string")throw new Error("AsyncStorage adapter supports only string values.");await a.setItem(t.key,t.value)},delete:t=>a.removeItem(t),clear:()=>a.clear()}}},l=e=>{const{adapterId:r="async-storage",adapterName:s="AsyncStorage"}=e,o="storages"in e?Object.entries(e.storages).map(([c,a])=>g(c,a)):[g(e.storageId??"default",e.storage,e.storageName??"Default Storage",e.blacklist)];return{id:r,name:s,storages:o}},y=l;exports.createAsyncStorageAdapter=l;exports.createExpoAsyncStorageAdapter=y;
@@ -1,4 +1,4 @@
1
- const c = (e, r, s, n) => {
1
+ const g = (e, r, s, n) => {
2
2
  const o = "storage" in r ? r : {
3
3
  storage: r
4
4
  }, { storage: a, name: l, blacklist: d } = o;
@@ -13,12 +13,12 @@ const c = (e, r, s, n) => {
13
13
  kind: "async",
14
14
  getAllKeys: () => a.getAllKeys(),
15
15
  get: async (t) => {
16
- const g = await a.getItem(t);
17
- if (g !== null)
16
+ const c = await a.getItem(t);
17
+ if (c !== null)
18
18
  return {
19
19
  key: t,
20
20
  type: "string",
21
- value: g
21
+ value: c
22
22
  };
23
23
  },
24
24
  set: async (t) => {
@@ -26,14 +26,15 @@ const c = (e, r, s, n) => {
26
26
  throw new Error("AsyncStorage adapter supports only string values.");
27
27
  await a.setItem(t.key, t.value);
28
28
  },
29
- delete: (t) => a.removeItem(t)
29
+ delete: (t) => a.removeItem(t),
30
+ clear: () => a.clear()
30
31
  }
31
32
  };
32
33
  }, i = (e) => {
33
34
  const { adapterId: r = "async-storage", adapterName: s = "AsyncStorage" } = e, n = "storages" in e ? Object.entries(e.storages).map(
34
- ([o, a]) => c(o, a)
35
+ ([o, a]) => g(o, a)
35
36
  ) : [
36
- c(
37
+ g(
37
38
  e.storageId ?? "default",
38
39
  e.storage,
39
40
  e.storageName ?? "Default Storage",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./types.cjs"),g=require("./async-storage.require.cjs"),f=require("./secure-storage.require.cjs"),l=t=>"remove"in t,S=t=>{if(Array.isArray(t)){if(t.some(l))throw new Error("[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances.");return Object.fromEntries(t.map(r=>[r.id,r]))}return t},p=t=>l(t)?{set:(e,r)=>t.set(e,r),getBoolean:e=>t.getBoolean(e),getString:e=>t.getString(e),getNumber:e=>t.getNumber(e),getBuffer:e=>t.getBuffer(e),delete:e=>t.remove(e),getAllKeys:()=>t.getAllKeys(),addOnValueChangedListener:e=>t.addOnValueChangedListener(e)}:{set:(e,r)=>t.set(e,r),getBoolean:e=>t.getBoolean(e),getString:e=>t.getString(e),getNumber:e=>t.getNumber(e),getBuffer:e=>t.getBuffer(e),delete:e=>t.delete(e),getAllKeys:()=>t.getAllKeys(),addOnValueChangedListener:e=>t.addOnValueChangedListener(e)},A=(t,e)=>{const r=t.getString(e);if(r!==void 0&&r.length>0)return{key:e,type:"string",value:r};const a=t.getBuffer(e);if(a!==void 0&&a.byteLength>0)return{key:e,type:"buffer",value:Array.from(new Uint8Array(a))};const s=t.getNumber(e);if(s!==void 0)return{key:e,type:"number",value:s};const u=t.getBoolean(e);if(u!==void 0)return{key:e,type:"boolean",value:u};if(r!==void 0)return{key:e,type:"string",value:r}},y=(t,e)=>{e.type==="buffer"?t.set(e.key,new Uint8Array(e.value).buffer):t.set(e.key,e.value)},b=(t,e)=>{if(t)return t instanceof RegExp?t:t[e]},V=(t,e)=>{if(t instanceof RegExp)return r=>(t.lastIndex=0,t.test(`${e}:${r}`))},M=({adapterId:t="mmkv",adapterName:e="MMKV",storages:r,blacklist:a})=>{const s=S(r),u=Object.entries(s).map(([i,c])=>{const o=p(c);return{id:i,name:i,blacklist:b(a,i),shouldFilterKey:V(a,i),capabilities:{supportedTypes:d.DEFAULT_SUPPORTED_TYPES},storage:{kind:"sync",getAllKeys:()=>o.getAllKeys(),get:n=>A(o,n),set:n=>y(o,n),delete:n=>o.delete(n),subscribe:n=>o.addOnValueChangedListener(n)}}});return{id:t,name:e,storages:u}};exports.createAsyncStorageAdapter=g.createAsyncStorageAdapter;exports.createExpoAsyncStorageAdapter=g.createExpoAsyncStorageAdapter;exports.createExpoSecureStorageAdapter=f.createExpoSecureStorageAdapter;exports.createMMKVStorageAdapter=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./types.cjs"),l=require("./async-storage.require.cjs"),f=require("./secure-storage.require.cjs"),g=e=>"remove"in e,A=e=>{if(Array.isArray(e)){if(e.some(g))throw new Error("[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances.");return Object.fromEntries(e.map(t=>[t.id,t]))}return e},S=e=>{const r=()=>e.clearAll();return g(e)?{set:(t,n)=>e.set(t,n),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.remove(t),getAllKeys:()=>e.getAllKeys(),clear:r,addOnValueChangedListener:t=>e.addOnValueChangedListener(t)}:{set:(t,n)=>e.set(t,n),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.delete(t),getAllKeys:()=>e.getAllKeys(),clear:r,addOnValueChangedListener:t=>e.addOnValueChangedListener(t)}},p=(e,r)=>{const t=e.getString(r);if(t!==void 0&&t.length>0)return{key:r,type:"string",value:t};const n=e.getBuffer(r);if(n!==void 0&&n.byteLength>0)return{key:r,type:"buffer",value:Array.from(new Uint8Array(n))};const s=e.getNumber(r);if(s!==void 0)return{key:r,type:"number",value:s};const u=e.getBoolean(r);if(u!==void 0)return{key:r,type:"boolean",value:u};if(t!==void 0)return{key:r,type:"string",value:t}},y=(e,r)=>{r.type==="buffer"?e.set(r.key,new Uint8Array(r.value).buffer):e.set(r.key,r.value)},b=(e,r)=>{if(e)return e instanceof RegExp?e:e[r]},V=(e,r)=>{if(e instanceof RegExp)return t=>(e.lastIndex=0,e.test(`${r}:${t}`))},M=({adapterId:e="mmkv",adapterName:r="MMKV",storages:t,blacklist:n})=>{const s=A(t),u=Object.entries(s).map(([i,c])=>{const o=S(c);return{id:i,name:i,blacklist:b(n,i),shouldFilterKey:V(n,i),capabilities:{supportedTypes:d.DEFAULT_SUPPORTED_TYPES},storage:{kind:"sync",getAllKeys:()=>o.getAllKeys(),get:a=>p(o,a),set:a=>y(o,a),delete:a=>o.delete(a),clear:o.clear,subscribe:a=>o.addOnValueChangedListener(a)}}});return{id:e,name:r,storages:u}};exports.createAsyncStorageAdapter=l.createAsyncStorageAdapter;exports.createExpoAsyncStorageAdapter=l.createExpoAsyncStorageAdapter;exports.createExpoSecureStorageAdapter=f.createExpoSecureStorageAdapter;exports.createMMKVStorageAdapter=M;
@@ -1,94 +1,98 @@
1
1
  import { D as d } from "./types.js";
2
2
  import { createAsyncStorageAdapter as B, createExpoAsyncStorageAdapter as E } from "./async-storage.require.js";
3
3
  import { createExpoSecureStorageAdapter as x } from "./secure-storage.require.js";
4
- const l = (t) => "remove" in t, f = (t) => {
5
- if (Array.isArray(t)) {
6
- if (t.some(l))
4
+ const u = (e) => "remove" in e, c = (e) => {
5
+ if (Array.isArray(e)) {
6
+ if (e.some(u))
7
7
  throw new Error(
8
8
  "[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances."
9
9
  );
10
- return Object.fromEntries(
11
- t.map((r) => [r.id, r])
12
- );
10
+ return Object.fromEntries(e.map((t) => [t.id, t]));
13
11
  }
14
- return t;
15
- }, c = (t) => l(t) ? {
16
- set: (e, r) => t.set(e, r),
17
- getBoolean: (e) => t.getBoolean(e),
18
- getString: (e) => t.getString(e),
19
- getNumber: (e) => t.getNumber(e),
20
- getBuffer: (e) => t.getBuffer(e),
21
- delete: (e) => t.remove(e),
22
- getAllKeys: () => t.getAllKeys(),
23
- addOnValueChangedListener: (e) => t.addOnValueChangedListener(e)
24
- } : {
25
- set: (e, r) => t.set(e, r),
26
- getBoolean: (e) => t.getBoolean(e),
27
- getString: (e) => t.getString(e),
28
- getNumber: (e) => t.getNumber(e),
29
- getBuffer: (e) => t.getBuffer(e),
30
- delete: (e) => t.delete(e),
31
- getAllKeys: () => t.getAllKeys(),
32
- addOnValueChangedListener: (e) => t.addOnValueChangedListener(e)
33
- }, p = (t, e) => {
34
- const r = t.getString(e);
35
- if (r !== void 0 && r.length > 0)
36
- return { key: e, type: "string", value: r };
37
- const a = t.getBuffer(e);
38
- if (a !== void 0 && a.byteLength > 0)
12
+ return e;
13
+ }, f = (e) => {
14
+ const r = () => e.clearAll();
15
+ return u(e) ? {
16
+ set: (t, n) => e.set(t, n),
17
+ getBoolean: (t) => e.getBoolean(t),
18
+ getString: (t) => e.getString(t),
19
+ getNumber: (t) => e.getNumber(t),
20
+ getBuffer: (t) => e.getBuffer(t),
21
+ delete: (t) => e.remove(t),
22
+ getAllKeys: () => e.getAllKeys(),
23
+ clear: r,
24
+ addOnValueChangedListener: (t) => e.addOnValueChangedListener(t)
25
+ } : {
26
+ set: (t, n) => e.set(t, n),
27
+ getBoolean: (t) => e.getBoolean(t),
28
+ getString: (t) => e.getString(t),
29
+ getNumber: (t) => e.getNumber(t),
30
+ getBuffer: (t) => e.getBuffer(t),
31
+ delete: (t) => e.delete(t),
32
+ getAllKeys: () => e.getAllKeys(),
33
+ clear: r,
34
+ addOnValueChangedListener: (t) => e.addOnValueChangedListener(t)
35
+ };
36
+ }, p = (e, r) => {
37
+ const t = e.getString(r);
38
+ if (t !== void 0 && t.length > 0)
39
+ return { key: r, type: "string", value: t };
40
+ const n = e.getBuffer(r);
41
+ if (n !== void 0 && n.byteLength > 0)
39
42
  return {
40
- key: e,
43
+ key: r,
41
44
  type: "buffer",
42
- value: Array.from(new Uint8Array(a))
45
+ value: Array.from(new Uint8Array(n))
43
46
  };
44
- const s = t.getNumber(e);
47
+ const s = e.getNumber(r);
45
48
  if (s !== void 0)
46
- return { key: e, type: "number", value: s };
47
- const i = t.getBoolean(e);
48
- if (i !== void 0)
49
- return { key: e, type: "boolean", value: i };
50
- if (r !== void 0)
51
- return { key: e, type: "string", value: r };
52
- }, A = (t, e) => {
53
- e.type === "buffer" ? t.set(e.key, new Uint8Array(e.value).buffer) : t.set(e.key, e.value);
54
- }, b = (t, e) => {
55
- if (t)
56
- return t instanceof RegExp ? t : t[e];
57
- }, S = (t, e) => {
58
- if (t instanceof RegExp)
59
- return (r) => (t.lastIndex = 0, t.test(`${e}:${r}`));
49
+ return { key: r, type: "number", value: s };
50
+ const l = e.getBoolean(r);
51
+ if (l !== void 0)
52
+ return { key: r, type: "boolean", value: l };
53
+ if (t !== void 0)
54
+ return { key: r, type: "string", value: t };
55
+ }, A = (e, r) => {
56
+ r.type === "buffer" ? e.set(r.key, new Uint8Array(r.value).buffer) : e.set(r.key, r.value);
57
+ }, b = (e, r) => {
58
+ if (e)
59
+ return e instanceof RegExp ? e : e[r];
60
+ }, S = (e, r) => {
61
+ if (e instanceof RegExp)
62
+ return (t) => (e.lastIndex = 0, e.test(`${r}:${t}`));
60
63
  }, V = ({
61
- adapterId: t = "mmkv",
62
- adapterName: e = "MMKV",
63
- storages: r,
64
- blacklist: a
64
+ adapterId: e = "mmkv",
65
+ adapterName: r = "MMKV",
66
+ storages: t,
67
+ blacklist: n
65
68
  }) => {
66
- const s = f(r), i = Object.entries(s).map(
67
- ([u, g]) => {
68
- const o = c(g);
69
+ const s = c(t), l = Object.entries(s).map(
70
+ ([i, g]) => {
71
+ const o = f(g);
69
72
  return {
70
- id: u,
71
- name: u,
72
- blacklist: b(a, u),
73
- shouldFilterKey: S(a, u),
73
+ id: i,
74
+ name: i,
75
+ blacklist: b(n, i),
76
+ shouldFilterKey: S(n, i),
74
77
  capabilities: {
75
78
  supportedTypes: d
76
79
  },
77
80
  storage: {
78
81
  kind: "sync",
79
82
  getAllKeys: () => o.getAllKeys(),
80
- get: (n) => p(o, n),
81
- set: (n) => A(o, n),
82
- delete: (n) => o.delete(n),
83
- subscribe: (n) => o.addOnValueChangedListener(n)
83
+ get: (a) => p(o, a),
84
+ set: (a) => A(o, a),
85
+ delete: (a) => o.delete(a),
86
+ clear: o.clear,
87
+ subscribe: (a) => o.addOnValueChangedListener(a)
84
88
  }
85
89
  };
86
90
  }
87
91
  );
88
92
  return {
89
- id: t,
90
- name: e,
91
- storages: i
93
+ id: e,
94
+ name: r,
95
+ storages: l
92
96
  };
93
97
  };
94
98
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=async t=>Array.isArray(t)?t:t(),l=({storage:t,keys:a,adapterId:s="expo-secure-store",adapterName:o="Expo SecureStore",storageId:n="default",storageName:c="Default Secure Storage",blacklist:i})=>({id:s,name:o,storages:[{id:n,name:c,blacklist:i,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>u(a),get:async e=>{const r=await t.getItemAsync(e);if(r!==null)return{key:e,type:"string",value:r}},set:async e=>{if(e.type!=="string")throw new Error("Expo SecureStore adapter supports only string values.");await t.setItemAsync(e.key,e.value)},delete:e=>t.deleteItemAsync(e)}}]});exports.createExpoSecureStorageAdapter=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=async t=>Array.isArray(t)?t:t(),u=({storage:t,keys:a,adapterId:o="expo-secure-store",adapterName:n="Expo SecureStore",storageId:c="default",storageName:i="Default Secure Storage",blacklist:l})=>({id:o,name:n,storages:[{id:c,name:i,blacklist:l,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>s(a),get:async e=>{const r=await t.getItemAsync(e);if(r!==null)return{key:e,type:"string",value:r}},set:async e=>{if(e.type!=="string")throw new Error("Expo SecureStore adapter supports only string values.");await t.setItemAsync(e.key,e.value)},delete:e=>t.deleteItemAsync(e),clear:async()=>{const e=await s(a);await Promise.all(e.map(r=>t.deleteItemAsync(r)))}}}]});exports.createExpoSecureStorageAdapter=u;
@@ -1,24 +1,24 @@
1
- const u = async (t) => Array.isArray(t) ? t : t(), l = ({
1
+ const s = async (t) => Array.isArray(t) ? t : t(), u = ({
2
2
  storage: t,
3
- keys: s,
4
- adapterId: a = "expo-secure-store",
5
- adapterName: n = "Expo SecureStore",
6
- storageId: o = "default",
3
+ keys: a,
4
+ adapterId: n = "expo-secure-store",
5
+ adapterName: o = "Expo SecureStore",
6
+ storageId: c = "default",
7
7
  storageName: i = "Default Secure Storage",
8
- blacklist: c
8
+ blacklist: l
9
9
  }) => ({
10
- id: a,
11
- name: n,
10
+ id: n,
11
+ name: o,
12
12
  storages: [{
13
- id: o,
13
+ id: c,
14
14
  name: i,
15
- blacklist: c,
15
+ blacklist: l,
16
16
  capabilities: {
17
17
  supportedTypes: ["string"]
18
18
  },
19
19
  storage: {
20
20
  kind: "async",
21
- getAllKeys: () => u(s),
21
+ getAllKeys: () => s(a),
22
22
  get: async (e) => {
23
23
  const r = await t.getItemAsync(e);
24
24
  if (r !== null)
@@ -33,10 +33,14 @@ const u = async (t) => Array.isArray(t) ? t : t(), l = ({
33
33
  throw new Error("Expo SecureStore adapter supports only string values.");
34
34
  await t.setItemAsync(e.key, e.value);
35
35
  },
36
- delete: (e) => t.deleteItemAsync(e)
36
+ delete: (e) => t.deleteItemAsync(e),
37
+ clear: async () => {
38
+ const e = await s(a);
39
+ await Promise.all(e.map((r) => t.deleteItemAsync(r)));
40
+ }
37
41
  }
38
42
  }]
39
43
  });
40
44
  export {
41
- l as createExpoSecureStorageAdapter
45
+ u as createExpoSecureStorageAdapter
42
46
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@rozenite/plugin-bridge"),w=require("react"),P=require("./types.cjs"),g=require("@rozenite/agent-bridge"),p=require("@rozenite/agent-shared"),v=async(t,e,r)=>{const s=t.find(n=>n.target.adapterId===e.target.adapterId&&n.target.storageId===e.target.storageId);if(!s){r({type:"import-result",target:e.target,ok:!1,written:0,total:e.entries.length,error:"Target storage not found"});return}for(let n=0;n<e.entries.length;n++){const o=e.entries[n];try{await s.set(o)}catch(i){r({type:"import-result",target:e.target,ok:!1,written:n,total:e.entries.length,failedKey:o.key,error:i instanceof Error?i.message:String(i)});return}r({type:"set-entry",target:e.target,entry:o})}r({type:"import-result",target:e.target,ok:!0,written:e.entries.length,total:e.entries.length})},R=1500,I=t=>t.kind==="async",b=t=>t.type==="buffer"?`${t.type}:${t.value.join(",")}`:`${t.type}:${String(t.value)}`,z=t=>new Map(t.map(e=>[e.key,e])),m=(t,e)=>t.shouldFilterKey?.(e)?!0:t.blacklist?(t.blacklist.lastIndex=0,t.blacklist.test(e)):!1,M=(t,e,r)=>{if(!P.supportsType(t,e))throw new Error(`Type "${e}" is not supported by storage "${r.storageId}" in adapter "${r.adapterId}".`)},E=async t=>(I(t),t.getAllKeys()),S=async(t,e)=>(I(t),t.get(e)),x=async(t,e)=>{if(I(t)){await t.set(e);return}t.set(e)},N=async(t,e)=>{if(I(t)){await t.delete(e);return}t.delete(e)},$=async t=>{const e=await t();return z(e)},K=(t,e,r)=>{e.forEach((s,n)=>{const o=t.get(n);if(!o){r.onSet(s);return}b(o)!==b(s)&&r.onSet(s)}),t.forEach((s,n)=>{e.has(n)||r.onDelete(n)})},q=async(t,e)=>{let r=await $(t);const s=setInterval(async()=>{try{const n=await $(t);K(r,n,e),r=n}catch{}},R);return{remove:()=>{clearInterval(s)}}},j=(t,e)=>{const r=e.storage,s={adapterId:t.id,storageId:e.id},n=async i=>{if(!m(e,i))return S(r,i)},o=async()=>{const i=await E(r);return(await Promise.all(i.filter(d=>!m(e,d)).map(d=>S(r,d)))).filter(d=>!!d)};return{id:P.getStorageViewId(s),target:s,adapterName:t.name,storageName:e.name,capabilities:e.capabilities,blacklist:e.blacklist,get:n,set:async i=>{M(e.capabilities,i.type,s),await x(r,i)},delete:async i=>{await N(r,i)},getAllKeys:async()=>(await E(r)).filter(a=>!m(e,a)),getAllEntries:o,watch:async({onSet:i,onDelete:a})=>r.subscribe?r.subscribe(async d=>{try{const l=await n(d);if(!l){a(d);return}i(l)}catch{}}):q(o,{onSet:i,onDelete:a})}},C=t=>t.flatMap(e=>e.storages.map(r=>j(e,r))),f={adapterId:{type:"string",description:"Storage adapter ID. Required when multiple adapters are configured."},storageId:{type:"string",description:"Storage node ID within the adapter. Required when multiple storages are configured."}},u="@rozenite/storage-plugin",T=["string","number","boolean","buffer"],y={listStorages:p.defineAgentToolContract({name:"list-storages",description:"List all storage adapters and their storage nodes currently available on the device, including supported entry types and entry counts.",inputSchema:{type:"object",properties:{}}}),listEntries:p.defineAgentToolContract({name:"list-entries",description:"List keys in a storage. This call intentionally does not return entry values to keep responses token-efficient.",inputSchema:{type:"object",properties:{...f,offset:{type:"number",description:"Pagination offset. Defaults to 0."},limit:{type:"number",description:"Pagination size. Defaults to 100."}}}}),readEntry:p.defineAgentToolContract({name:"read-entry",description:"Read a single storage entry value by key.",inputSchema:{type:"object",properties:{...f,key:{type:"string",description:"Entry key."}},required:["key"]}}),createEntry:p.defineAgentToolContract({name:"create-entry",description:"Create a new storage entry. Fails if the key already exists.",inputSchema:{type:"object",properties:{...f,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...T],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),editEntry:p.defineAgentToolContract({name:"edit-entry",description:"Edit an existing storage entry. Fails if the key does not exist.",inputSchema:{type:"object",properties:{...f,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...T],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),removeEntry:p.defineAgentToolContract({name:"remove-entry",description:"Remove a storage entry by key.",inputSchema:{type:"object",properties:{...f,key:{type:"string",description:"Entry key."}},required:["key"]}})},A=(t,e)=>{if(t==="string"){if(typeof e!="string")throw new Error("Expected string value for type=string");return e}if(t==="number"){if(typeof e!="number"||Number.isNaN(e))throw new Error("Expected number value for type=number");return e}if(t==="boolean"){if(typeof e!="boolean")throw new Error("Expected boolean value for type=boolean");return e}if(!Array.isArray(e)||!e.every(r=>Number.isInteger(r)))throw new Error("Expected number[] value for type=buffer");return e},h=t=>`${t.target.adapterId}/${t.target.storageId}`,F=t=>{const e=w.useCallback((r,s)=>{if(t.length===0)throw new Error("No storages are registered.");if(r!==void 0||s!==void 0){const n=t.find(o=>(r===void 0||o.target.adapterId===r)&&(s===void 0||o.target.storageId===s));if(!n){const o=[r&&`adapterId="${r}"`,s&&`storageId="${s}"`].filter(Boolean).join(", ");throw new Error(`No storage matched ${o}. Available: ${t.map(h).join(", ")}`)}return n}if(t.length>1)throw new Error(`Multiple storages detected. Provide adapterId and/or storageId. Available: ${t.map(h).join(", ")}`);return t[0]},[t]);g.useRozenitePluginAgentTool({pluginId:u,tool:y.listStorages,handler:async()=>({storages:await Promise.all(t.map(async r=>({adapterId:r.target.adapterId,storageId:r.target.storageId,adapterName:r.adapterName,storageName:r.storageName,supportedTypes:r.capabilities.supportedTypes,entryCount:(await r.getAllKeys()).length})))})}),g.useRozenitePluginAgentTool({pluginId:u,tool:y.listEntries,handler:async({adapterId:r,storageId:s,offset:n=0,limit:o=100})=>{const i=e(r,s),a=await i.getAllKeys(),d=Math.max(0,Math.floor(n)),l=Math.max(1,Math.floor(o)),c=a.slice(d,d+l);return{adapterId:i.target.adapterId,storageId:i.target.storageId,total:a.length,offset:d,limit:l,keys:c}}}),g.useRozenitePluginAgentTool({pluginId:u,tool:y.readEntry,handler:async({adapterId:r,storageId:s,key:n})=>{const o=e(r,s),i=await o.get(n);if(!i)throw new Error(`Key "${n}" not found in storage "${h(o)}".`);return{adapterId:o.target.adapterId,storageId:o.target.storageId,entry:i}}}),g.useRozenitePluginAgentTool({pluginId:u,tool:y.createEntry,handler:async({adapterId:r,storageId:s,key:n,type:o,value:i})=>{const a=e(r,s);if(await a.get(n))throw new Error(`Key "${n}" already exists in storage "${h(a)}". Use edit-entry instead.`);const l=A(o,i);return await a.set({key:n,type:o,value:l}),{adapterId:a.target.adapterId,storageId:a.target.storageId,created:!0,key:n}}}),g.useRozenitePluginAgentTool({pluginId:u,tool:y.editEntry,handler:async({adapterId:r,storageId:s,key:n,type:o,value:i})=>{const a=e(r,s);if(!await a.get(n))throw new Error(`Key "${n}" not found in storage "${h(a)}". Use create-entry instead.`);const l=A(o,i);return await a.set({key:n,type:o,value:l}),{adapterId:a.target.adapterId,storageId:a.target.storageId,edited:!0,key:n}}}),g.useRozenitePluginAgentTool({pluginId:u,tool:y.removeEntry,handler:async({adapterId:r,storageId:s,key:n})=>{const o=e(r,s),i=!!await o.get(n);return await o.delete(n),{adapterId:o.target.adapterId,storageId:o.target.storageId,removed:i,key:n}}})},V=({storages:t})=>{const e=w.useMemo(()=>C(t),[t]);F(e);const r=k.useRozeniteDevToolsClient({pluginId:"@rozenite/storage-plugin"});return w.useEffect(()=>{if(!r)return;const s=async a=>{const d=a?e.filter(l=>l.id===a):e;for(const l of d)try{const c=await l.getAllEntries();r.send("snapshot",{type:"snapshot",target:l.target,adapterName:l.adapterName,storageName:l.storageName,capabilities:l.capabilities,blacklist:l.blacklist?{source:l.blacklist.source,flags:l.blacklist.flags}:void 0,entries:c})}catch(c){console.warn(`[Rozenite] Storage Plugin: Failed to snapshot ${l.target.adapterId}/${l.target.storageId}.`,c)}};s();const n=[];let o=!1;Promise.all(e.map(async a=>{try{const d=await a.watch({onSet:l=>{r.send("set-entry",{type:"set-entry",target:a.target,entry:l})},onDelete:l=>{r.send("delete-entry",{type:"delete-entry",target:a.target,key:l})}});if(o){d.remove();return}n.push(d)}catch(d){console.warn(`[Rozenite] Storage Plugin: Failed to attach watcher for ${a.target.adapterId}/${a.target.storageId}.`,d)}}));const i=[r.onMessage("set-entry",async({target:a,entry:d})=>{const l=e.find(c=>c.target.adapterId===a.adapterId&&c.target.storageId===a.storageId);if(!l){console.warn(`[Rozenite] Storage Plugin: Storage target not found for ${a.adapterId}/${a.storageId}`);return}try{await l.set(d)}catch(c){console.warn(`[Rozenite] Storage Plugin: Failed to set entry in ${a.adapterId}/${a.storageId}.`,c)}}),r.onMessage("delete-entry",async({target:a,key:d})=>{const l=e.find(c=>c.target.adapterId===a.adapterId&&c.target.storageId===a.storageId);if(!l){console.warn(`[Rozenite] Storage Plugin: Storage target not found for ${a.adapterId}/${a.storageId}`);return}try{await l.delete(d)}catch(c){console.warn(`[Rozenite] Storage Plugin: Failed to delete entry in ${a.adapterId}/${a.storageId}.`,c)}}),r.onMessage("get-snapshot",async({target:a})=>{if(a==="all"){await s();return}await s(`${a.adapterId}:${a.storageId}`)}),r.onMessage("import-entries",async a=>{await v(e,a,d=>{d.type==="set-entry"?r.send("set-entry",d):r.send("import-result",d)})})];return()=>{o=!0,n.forEach(a=>a.remove()),i.forEach(a=>a.remove())}},[r,e]),r};exports.useRozeniteStoragePlugin=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("@rozenite/plugin-bridge"),N=require("react"),E=require("./types.cjs"),h=require("@rozenite/agent-bridge"),f=require("@rozenite/agent-shared"),V="@rozenite/storage-plugin",R=1;class u extends Error{constructor(t,r){super(r),this.path=t}}const y=e=>e===null?"null":Array.isArray(e)?"array":typeof e,G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),T=(e,t)=>{if(!G(e))throw new u(t,`Expected object, got ${y(e)}`);return e},I=(e,t)=>{if(typeof e!="string")throw new u(t,`Expected string, got ${y(e)}`);return e},F=(e,t)=>{if(!Array.isArray(e))throw new u(t,`Expected array, got ${y(e)}`);return e},K=(e,t)=>{if(typeof e!="string"||!E.DEFAULT_SUPPORTED_TYPES.includes(e))throw new u(t,`Expected one of ${E.DEFAULT_SUPPORTED_TYPES.join(", ")}, got ${y(e)}`);return e},B=(e,t)=>{const r=T(e,t);return{supportedTypes:F(r.supportedTypes,`${t}.supportedTypes`).map((a,i)=>K(a,`${t}.supportedTypes[${i}]`))}},Y=e=>{const t=T(e,"storage");return{adapterId:I(t.adapterId,"storage.adapterId"),storageId:I(t.storageId,"storage.storageId"),adapterName:I(t.adapterName,"storage.adapterName"),storageName:I(t.storageName,"storage.storageName"),capabilities:B(t.capabilities,"storage.capabilities")}},Q=(e,t)=>{const r=T(e,t),o=I(r.key,`${t}.key`),n=K(r.type,`${t}.type`),a=`${t}.value`;switch(n){case"string":{const i=r.value;if(typeof i!="string")throw new u(a,`Expected string for type "string", got ${y(i)}`);return{key:o,type:"string",value:i}}case"number":{const i=r.value;if(typeof i!="number"||!Number.isFinite(i))throw new u(a,`Expected finite number for type "number", got ${y(i)}`);return{key:o,type:"number",value:i}}case"boolean":{const i=r.value;if(typeof i!="boolean")throw new u(a,`Expected boolean for type "boolean", got ${y(i)}`);return{key:o,type:"boolean",value:i}}case"buffer":{const i=r.value;if(!Array.isArray(i))throw new u(a,`Expected number[] for type "buffer", got ${y(i)}`);const s=i.map((c,g)=>{if(typeof c!="number"||!Number.isInteger(c)||c<0||c>255)throw new u(`${a}[${g}]`,`Expected uint8 (integer 0-255), got ${y(c)}`);return c});return{key:o,type:"buffer",value:s}}}},J=e=>{try{const t=T(e,"$"),r=t.version;if(r!==R)throw new u("version",`Unsupported snapshot version: ${y(r)} (this build supports version ${R})`);const o=I(t.plugin,"plugin"),n=I(t.createdAt,"createdAt"),a=Y(t.storage),s=F(t.entries,"entries").map((c,g)=>Q(c,`entries[${g}]`));return{ok:!0,snapshot:{version:R,plugin:o,createdAt:n,storage:a,entries:s}}}catch(t){if(t instanceof u)return{ok:!1,error:{path:t.path,message:t.message}};throw t}},W=e=>({version:1,plugin:V,createdAt:new Date().toISOString(),storage:{adapterId:e.target.adapterId,storageId:e.target.storageId,adapterName:e.adapterName,storageName:e.storageName,capabilities:e.capabilities},entries:e.entries}),X=(e,t)=>{const r=[],o=[],n=[],a=[],i=[];for(const[c,g]of e.entries.entries()){if(!E.supportsType(t.capabilities,g.type)){a.push({key:g.key,type:g.type});continue}if(t.isBlacklisted(g.key)){n.push({key:g.key,reason:"blacklist"});continue}t.entryKeys.has(g.key)?o.push(g.key):r.push(g.key),i.push(c),t.entryKeys.add(g.key)}const s=e.storage.adapterId!==t.target.adapterId||e.storage.storageId!==t.target.storageId;return{newKeys:r,overwriteKeys:o,skippedKeys:n,unsupportedTypes:a,acceptedEntryIndexes:i,metadataMismatch:s}},H=(e,t)=>e.adapterId===t.adapterId&&e.storageId===t.storageId,$=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.adapterId=="string"&&e.adapterId.trim().length>0&&typeof e.storageId=="string"&&e.storageId.trim().length>0,M=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.requestId=="string"?e.requestId:"",Z=e=>{if(typeof e!="object"||e==null||Array.isArray(e))return!1;const t=e;return typeof t.key!="string"?!1:t.type==="string"?typeof t.value=="string":t.type==="number"?typeof t.value=="number":t.type==="boolean"?typeof t.value=="boolean":t.type==="buffer"&&Array.isArray(t.value)&&t.value.every(r=>typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=255)},O=(e,t)=>e.blacklist?(e.blacklist.lastIndex=0,e.blacklist.test(t)):!1,U=(e,t)=>e.find(r=>H(r.target,t)),ee=async(e,t)=>{const r=M(t),o=t,n=J(o.snapshot);if(typeof o!="object"||o==null||o.type!=="preview-import"||typeof o.requestId!="string"||o.requestId.trim().length===0||!$(o.target)||!n.ok)return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Import preview requests require a valid target, request ID, and snapshot."};const a=U(e,o.target);if(!a)return{type:"storage-request-error",requestId:r,code:"TARGET_NOT_FOUND",message:"The requested storage target was not found."};try{const i=new Set(await a.getAllKeys());return{type:"import-preview",requestId:r,target:a.target,preview:X(n.snapshot,{target:a.target,capabilities:a.capabilities,entryKeys:i,isBlacklisted:s=>O(a,s)})}}catch{return{type:"storage-request-error",requestId:r,code:"READ_FAILED",message:"Failed to inspect the requested storage for import."}}},te=async(e,t,r)=>{const o=M(t),n=t;if(typeof n!="object"||n==null||n.type!=="import-entries"||typeof n.requestId!="string"||n.requestId.trim().length===0||!$(n.target)||!Array.isArray(n.entries)||!n.entries.every(Z)){r({type:"import-result",requestId:o,target:$(n.target)?n.target:{adapterId:"",storageId:""},ok:!1,written:0,total:0,error:"Import requests require a valid target, request ID, and entries."});return}const a=U(e,n.target);if(!a){r({type:"import-result",requestId:n.requestId,target:n.target,ok:!1,written:0,total:n.entries.length,error:"Target storage not found"});return}const i=n.entries.filter(s=>E.supportsType(a.capabilities,s.type)&&!O(a,s.key));for(let s=0;s<i.length;s++){const c=i[s];try{await a.set(c)}catch(g){if(s>0){const d=(await a.getAllKeys()).length;r({type:"storage-invalidated",target:n.target,operation:"import",entryCount:d})}r({type:"import-result",requestId:n.requestId,target:n.target,ok:!1,written:s,total:i.length,failedKey:c.key,error:g instanceof Error?g.message:String(g)});return}r({type:"import-progress",requestId:n.requestId,target:n.target,written:s+1,total:i.length})}if(i.length>0){const s=(await a.getAllKeys()).length;r({type:"storage-invalidated",target:n.target,operation:"import",entryCount:s})}r({type:"import-result",requestId:n.requestId,target:n.target,ok:!0,written:i.length,total:i.length})},re=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.requestId=="string"?e.requestId:"",se=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&e.type==="discover-storages"&&typeof e.requestId=="string"&&e.requestId.trim().length>0,ne=async e=>({target:e.target,adapterName:e.adapterName,storageName:e.storageName,entryCount:(await e.getAllKeys()).length,capabilities:e.capabilities,supportsSubscriptions:e.supportsSubscriptions}),oe=e=>{const t=new Set;return e.some(({target:r})=>{const o=`${r.adapterId}:${r.storageId}`;return t.has(o)?!0:(t.add(o),!1)})},ae=async(e,t)=>{const r=re(t);if(!se(t))return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Storage discovery requires a non-empty request ID."};try{if(oe(e))return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Configured storages must have unique targets."};const o=await Promise.all(e.map(ne));return{type:"storage-descriptors",requestId:r,storages:o}}catch{return{type:"storage-request-error",requestId:r,code:"READ_FAILED",message:"Failed to discover configured storages."}}},ie=256,k=16,ce=e=>e.toString(16).toUpperCase().padStart(2,"0"),ge=e=>{let t="",r=0;for(const o of e){if(r===ie)return{preview:t,isTruncated:!0};t+=o,r+=1}return{preview:t,isTruncated:!1}},de=e=>{if(e.type==="string")return{key:e.key,type:e.type,...ge(e.value),valueSize:e.value.length};if(e.type==="buffer"){const r=e.value.slice(0,k);return{key:e.key,type:e.type,preview:r.map(ce).join(" "),valueSize:e.value.length,isTruncated:e.value.length>k}}const t=String(e.value);return{key:e.key,type:e.type,preview:t,valueSize:t.length,isTruncated:!1}},ue=100,pe=4,ye=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.requestId=="string"?e.requestId:"",L=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.adapterId=="string"&&e.adapterId.trim().length>0&&typeof e.storageId=="string"&&e.storageId.trim().length>0,le=e=>(e??"").trim().toLowerCase(),fe=e=>{if(typeof e!="object"||e==null||Array.isArray(e)||e.type!=="list-entry-previews"||typeof e.requestId!="string"||e.requestId.trim().length===0||!L(e.target)||e.search!==void 0&&typeof e.search!="string"||e.cursor!==void 0&&typeof e.cursor!="string"||!Number.isFinite(e.limit)||!Number.isInteger(e.limit)||e.limit<1)return;const t=e.keySortDirection;if(t!==void 0&&t!=="ascending"&&t!=="descending")return;const r=e;return{...r,search:le(r.search),keySortDirection:t??"ascending",limit:Math.min(r.limit,ue)}},D=e=>btoa(encodeURIComponent(JSON.stringify(e))),Ie=e=>{try{const t=JSON.parse(decodeURIComponent(atob(e)));return typeof t!="object"||t==null||Array.isArray(t)||t.version!==1||!L(t.target)||typeof t.search!="string"||t.keySortDirection!=="ascending"&&t.keySortDirection!=="descending"||typeof t.boundaryKey!="string"||t.direction!=="next"&&t.direction!=="previous"?void 0:t}catch{return}},P=(e,t)=>e.adapterId===t.adapterId&&e.storageId===t.storageId,he=(e,t)=>e<t?-1:e>t?1:0,me=async(e,t)=>{const r=new Array(t.length);let o=0;const n=async()=>{for(;o<t.length;){const a=o;o+=1;const i=await e.get(t[a]);i&&(r[a]=de(i))}};return await Promise.all(Array.from({length:Math.min(pe,t.length)},n)),r.filter(a=>a!=null)},we=async(e,t)=>{const r=ye(t),o=fe(t);if(!o)return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Entry preview requests require a valid target, request ID, and positive integer limit."};const n=e.find(i=>P(i.target,o.target));if(!n)return{type:"storage-request-error",requestId:r,code:"TARGET_NOT_FOUND",message:"The requested storage target was not found."};let a;if(o.cursor!==void 0&&(a=Ie(o.cursor),!a||!P(a.target,o.target)||a.search!==o.search||a.keySortDirection!==o.keySortDirection))return{type:"storage-request-error",requestId:r,code:"INVALID_CURSOR",message:"The entry preview cursor is invalid or belongs to a different query.",resetPagination:!0};try{const i=(await n.getAllKeys()).filter(l=>l.toLowerCase().includes(o.search)).sort(he);o.keySortDirection==="descending"&&i.reverse();let s=0;if(a){const l=i.indexOf(a.boundaryKey);if(l===-1)return{type:"storage-request-error",requestId:r,code:"INVALID_CURSOR",message:"The entry preview cursor is stale after storage changes.",resetPagination:!0};s=a.direction==="next"?l+1:Math.max(0,l-o.limit)}const c=i.slice(s,s+o.limit),g=await me(n,c),d=s+c.length,p={version:1,target:o.target,search:o.search,keySortDirection:o.keySortDirection};return{type:"entry-previews",requestId:r,target:o.target,items:g,...d<i.length&&c.length>0?{nextCursor:D({...p,boundaryKey:c.at(-1),direction:"next"})}:{},...s>0&&c.length>0?{previousCursor:D({...p,boundaryKey:c[0],direction:"previous"})}:{}}}catch{return{type:"storage-request-error",requestId:r,code:"READ_FAILED",message:"Failed to read entry previews from the requested storage."}}},be=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.requestId=="string"?e.requestId:"",Ee=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.adapterId=="string"&&e.adapterId.trim().length>0&&typeof e.storageId=="string"&&e.storageId.trim().length>0,Ae=(e,t)=>e.adapterId===t.adapterId&&e.storageId===t.storageId,qe=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&e.type==="get-entry"&&typeof e.requestId=="string"&&e.requestId.trim().length>0&&Ee(e.target)&&typeof e.key=="string",Se=async(e,t)=>{const r=be(t);if(!qe(t))return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Full entry requests require a valid target, request ID, and string key."};const o=e.find(n=>Ae(n.target,t.target));if(!o)return{type:"storage-request-error",requestId:r,code:"TARGET_NOT_FOUND",message:"The requested storage target was not found."};try{const n=await o.get(t.key);return n?{type:"entry",requestId:r,target:o.target,entry:n}:{type:"storage-request-error",requestId:r,code:"ENTRY_NOT_FOUND",message:"The requested storage entry was not found."}}catch{return{type:"storage-request-error",requestId:r,code:"READ_FAILED",message:"Failed to read the requested storage entry."}}},Te=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.requestId=="string"?e.requestId:"",ve=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&typeof e.adapterId=="string"&&e.adapterId.trim().length>0&&typeof e.storageId=="string"&&e.storageId.trim().length>0,Re=(e,t)=>e.adapterId===t.adapterId&&e.storageId===t.storageId,$e=e=>typeof e=="object"&&e!=null&&!Array.isArray(e)&&e.type==="export-snapshot"&&typeof e.requestId=="string"&&e.requestId.trim().length>0&&ve(e.target),Ne=async(e,t)=>{const r=Te(t);if(!$e(t))return{type:"storage-request-error",requestId:r,code:"INVALID_REQUEST",message:"Export requests require a valid target and request ID."};const o=e.find(n=>Re(n.target,t.target));if(!o)return{type:"storage-request-error",requestId:r,code:"TARGET_NOT_FOUND",message:"The requested storage target was not found."};try{const n=await o.getAllEntries();return{type:"export-snapshot-result",requestId:r,target:o.target,snapshot:W({target:o.target,adapterName:o.adapterName,storageName:o.storageName,capabilities:o.capabilities,entries:n})}}catch{return{type:"storage-request-error",requestId:r,code:"READ_FAILED",message:"Failed to export the requested storage."}}},v=e=>e.kind==="async",S=(e,t)=>e.shouldFilterKey?.(t)?!0:e.blacklist?(e.blacklist.lastIndex=0,e.blacklist.test(t)):!1,ke=(e,t,r)=>{if(!E.supportsType(e,t))throw new Error(`Type "${t}" is not supported by storage "${r.storageId}" in adapter "${r.adapterId}".`)},_=async e=>(v(e),e.getAllKeys()),x=async(e,t)=>(v(e),e.get(t)),De=async(e,t)=>{if(v(e)){await e.set(t);return}e.set(t)},Pe=async(e,t)=>{if(v(e)){await e.delete(t);return}e.delete(t)},_e=async e=>{await e.clear()},xe=(e,t)=>{const r=t.storage,o=r.subscribe,n=new Set;let a=!1;const i={adapterId:e.id,storageId:t.id},s=async g=>{if(!S(t,g))return x(r,g)},c=async()=>{const g=await _(r);return(await Promise.all(g.filter(p=>!S(t,p)).map(p=>x(r,p)))).filter(p=>!!p)};return{id:E.getStorageViewId(i),target:i,adapterName:e.name,storageName:t.name,capabilities:t.capabilities,supportsSubscriptions:o!=null,blacklist:t.blacklist,get:s,set:async g=>{ke(t.capabilities,g.type,i),n.add(g.key);try{await De(r,g)}finally{n.delete(g.key)}},delete:async g=>{n.add(g);try{await Pe(r,g)}finally{n.delete(g)}},purge:async()=>{a=!0;try{await _e(r)}finally{a=!1}},getAllKeys:async()=>(await _(r)).filter(d=>!S(t,d)),getAllEntries:c,...o?{watch:async g=>o(d=>{!a&&!n.has(d)&&!S(t,d)&&g(d)})}:{}}},je=e=>e.flatMap(t=>t.storages.map(r=>xe(t,r))),A={adapterId:{type:"string",description:"Storage adapter ID. Required when multiple adapters are configured."},storageId:{type:"string",description:"Storage node ID within the adapter. Required when multiple storages are configured."}},m="@rozenite/storage-plugin",j=["string","number","boolean","buffer"],w={listStorages:f.defineAgentToolContract({name:"list-storages",description:"List all storage adapters and their storage nodes currently available on the device, including supported entry types. Entry counts are omitted to avoid enumerating every storage.",inputSchema:{type:"object",properties:{}}}),listEntries:f.definePaginatedAgentToolContract({name:"list-entries",description:"List keys in a storage. This call intentionally does not return entry values to keep responses token-efficient.",inputSchema:{type:"object",properties:{...A,limit:{type:"number",description:"Pagination size. Defaults to 20 and is capped at 100."},cursor:{type:"string",description:"Opaque pagination cursor from a previous list-entries call."},offset:{type:"number",description:"Deprecated initial pagination offset. Must be a non-negative integer and cannot be combined with cursor."}}},pagination:{kind:"cursor",fields:["key"],defaultFields:["key"]}}),readEntry:f.defineAgentToolContract({name:"read-entry",description:"Read a single storage entry value by key.",inputSchema:{type:"object",properties:{...A,key:{type:"string",description:"Entry key."}},required:["key"]}}),createEntry:f.defineAgentToolContract({name:"create-entry",description:"Create a new storage entry. Fails if the key already exists.",inputSchema:{type:"object",properties:{...A,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...j],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),editEntry:f.defineAgentToolContract({name:"edit-entry",description:"Edit an existing storage entry. Fails if the key does not exist.",inputSchema:{type:"object",properties:{...A,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...j],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),removeEntry:f.defineAgentToolContract({name:"remove-entry",description:"Remove a storage entry by key.",inputSchema:{type:"object",properties:{...A,key:{type:"string",description:"Entry key."}},required:["key"]}})},C=(e,t)=>{if(e==="string"){if(typeof t!="string")throw new Error("Expected string value for type=string");return t}if(e==="number"){if(typeof t!="number"||Number.isNaN(t))throw new Error("Expected number value for type=number");return t}if(e==="boolean"){if(typeof t!="boolean")throw new Error("Expected boolean value for type=boolean");return t}if(!Array.isArray(t)||!t.every(r=>Number.isInteger(r)))throw new Error("Expected number[] value for type=buffer");return t},b=e=>`${e.target.adapterId}/${e.target.storageId}`,Ce=(e,t)=>e.adapterId===t.adapterId&&e.storageId===t.storageId,Fe=e=>btoa(encodeURIComponent(JSON.stringify(e))),Ke=e=>{try{const t=JSON.parse(decodeURIComponent(atob(e)));if(typeof t!="object"||t==null||Array.isArray(t)||t.version!==1||typeof t.target?.adapterId!="string"||typeof t.target?.storageId!="string"||!Number.isSafeInteger(t.offset)||t.offset<0)throw new Error("Invalid cursor");return t}catch{throw new Error("Invalid cursor. Run list-entries again without a cursor to restart pagination.")}},Me=e=>typeof e!="number"||!Number.isFinite(e)||!Number.isInteger(e)||e<1?f.DEFAULT_PAGE_LIMIT:Math.min(e,f.MAX_PAGE_LIMIT),Oe=e=>typeof e!="number"||!Number.isFinite(e)||!Number.isSafeInteger(e)||e<0?0:e,q=(e,t,r)=>{if(e.length===0)throw new Error("No storages are registered.");if(t!==void 0||r!==void 0){const o=e.filter(a=>(t===void 0||a.target.adapterId===t)&&(r===void 0||a.target.storageId===r)),n=[t!==void 0&&`adapterId="${t}"`,r!==void 0&&`storageId="${r}"`].filter(Boolean).join(", ");if(o.length===0)throw new Error(`No storage matched ${n}. Available: ${e.map(b).join(", ")}`);if(o.length>1)throw new Error(`Multiple storages matched ${n}. Provide both adapterId and storageId. Available: ${o.map(b).join(", ")}`);return o[0]}if(e.length>1)throw new Error(`Multiple storages detected. Provide adapterId and/or storageId. Available: ${e.map(b).join(", ")}`);return e[0]},Ue=async(e,t)=>{const r=Me(t.limit);if(t.cursor!==void 0&&t.offset!==void 0)throw new Error("Provide either cursor or offset, not both.");const o=t.cursor===void 0?void 0:Ke(t.cursor);if(o&&!Ce(o.target,e.target))throw new Error("Cursor does not match the requested storage. Run list-entries again without a cursor to restart pagination.");const n=await e.getAllKeys(),a=o?.offset??Oe(t.offset),i=Math.min(a+r,n.length);return{adapterId:e.target.adapterId,storageId:e.target.storageId,total:n.length,items:n.slice(a,i).map(s=>({key:s})),page:{limit:r,hasMore:i<n.length,...i<n.length?{nextCursor:Fe({version:1,target:e.target,offset:i})}:{}}}},Le=e=>({listStorages:async()=>({storages:e.map(t=>({adapterId:t.target.adapterId,storageId:t.target.storageId,adapterName:t.adapterName,storageName:t.storageName,supportedTypes:t.capabilities.supportedTypes}))}),listEntries:async t=>{const r=q(e,t.adapterId,t.storageId);return Ue(r,t)},readEntry:async({adapterId:t,storageId:r,key:o})=>{const n=q(e,t,r),a=await n.get(o);if(!a)throw new Error(`Key "${o}" not found in storage "${b(n)}".`);return{adapterId:n.target.adapterId,storageId:n.target.storageId,entry:a}}}),ze=e=>{const t=Le(e);h.useRozenitePluginAgentTool({pluginId:m,tool:w.listStorages,handler:t.listStorages}),h.useRozenitePluginAgentTool({pluginId:m,tool:w.listEntries,handler:t.listEntries}),h.useRozenitePluginAgentTool({pluginId:m,tool:w.readEntry,handler:t.readEntry}),h.useRozenitePluginAgentTool({pluginId:m,tool:w.createEntry,handler:async({adapterId:r,storageId:o,key:n,type:a,value:i})=>{const s=q(e,r,o);if(await s.get(n))throw new Error(`Key "${n}" already exists in storage "${b(s)}". Use edit-entry instead.`);const g=C(a,i);return await s.set({key:n,type:a,value:g}),{adapterId:s.target.adapterId,storageId:s.target.storageId,created:!0,key:n}}}),h.useRozenitePluginAgentTool({pluginId:m,tool:w.editEntry,handler:async({adapterId:r,storageId:o,key:n,type:a,value:i})=>{const s=q(e,r,o);if(!await s.get(n))throw new Error(`Key "${n}" not found in storage "${b(s)}". Use create-entry instead.`);const g=C(a,i);return await s.set({key:n,type:a,value:g}),{adapterId:s.target.adapterId,storageId:s.target.storageId,edited:!0,key:n}}}),h.useRozenitePluginAgentTool({pluginId:m,tool:w.removeEntry,handler:async({adapterId:r,storageId:o,key:n})=>{const a=q(e,r,o),i=!!await a.get(n);return await a.delete(n),{adapterId:a.target.adapterId,storageId:a.target.storageId,removed:i,key:n}}})},Ve=({storages:e})=>{const t=N.useMemo(()=>je(e),[e]);ze(t);const r=z.useRozeniteDevToolsClient({pluginId:"@rozenite/storage-plugin"});return N.useEffect(()=>{if(!r)return;const o=[];let n=!1;const a=async(s,c,g)=>{const d=t.find(l=>l.target.adapterId===s.adapterId&&l.target.storageId===s.storageId),p=d?(await d.getAllKeys()).length:0;r.send("storage-invalidated",{type:"storage-invalidated",target:s,key:c,operation:g,entryCount:p})};Promise.all(t.filter(s=>s.supportsSubscriptions&&s.watch).map(async s=>{try{const c=s.watch;if(!c)return;const g=await c(d=>{a(s.target,d)});if(n){g.remove();return}o.push(g)}catch(c){console.warn(`[Rozenite] Storage Plugin: Failed to attach watcher for ${s.target.adapterId}/${s.target.storageId}.`,c)}}));const i=[r.onMessage("set-entry",async({target:s,entry:c})=>{const g=t.find(d=>d.target.adapterId===s.adapterId&&d.target.storageId===s.storageId);if(!g){console.warn(`[Rozenite] Storage Plugin: Storage target not found for ${s.adapterId}/${s.storageId}`);return}try{await g.set(c),await a(g.target,c.key,"set")}catch(d){console.warn(`[Rozenite] Storage Plugin: Failed to set entry in ${s.adapterId}/${s.storageId}.`,d)}}),r.onMessage("delete-entry",async({target:s,key:c})=>{const g=t.find(d=>d.target.adapterId===s.adapterId&&d.target.storageId===s.storageId);if(!g){console.warn(`[Rozenite] Storage Plugin: Storage target not found for ${s.adapterId}/${s.storageId}`);return}try{await g.delete(c),await a(g.target,c,"delete")}catch(d){console.warn(`[Rozenite] Storage Plugin: Failed to delete entry in ${s.adapterId}/${s.storageId}.`,d)}}),r.onMessage("purge-storage",async({target:s})=>{const c=t.find(g=>g.target.adapterId===s.adapterId&&g.target.storageId===s.storageId);if(!c){console.warn(`[Rozenite] Storage Plugin: Storage target not found for ${s.adapterId}/${s.storageId}`);return}try{await c.purge(),await a(c.target,void 0,"purge")}catch(g){console.warn(`[Rozenite] Storage Plugin: Failed to purge storage in ${s.adapterId}/${s.storageId}.`,g)}}),r.onMessage("discover-storages",async s=>{const c=await ae(t,s);r.send(c.type,c)}),r.onMessage("list-entry-previews",async s=>{const c=await we(t,s);r.send(c.type,c)}),r.onMessage("get-entry",async s=>{const c=await Se(t,s);r.send(c.type,c)}),r.onMessage("export-snapshot",async s=>{const c=await Ne(t,s);r.send(c.type,c)}),r.onMessage("preview-import",async s=>{const c=await ee(t,s);r.send(c.type,c)}),r.onMessage("import-entries",async s=>{await te(t,s,c=>{r.send(c.type,c)})})];return r.send("device-ready",{type:"device-ready"}),()=>{n=!0,o.forEach(s=>s.remove()),i.forEach(s=>s.remove())}},[r,t]),r};exports.useRozeniteStoragePlugin=Ve;