@1interface/widgets 0.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 (119) hide show
  1. package/dist/Chart.web-DQzthytj.js +1 -0
  2. package/dist/GoogleMapsComponent-CtYLbyvO.js +1 -0
  3. package/dist/Markdown.web-vx2MyFJ8.js +1 -0
  4. package/dist/OpenStreetMapComponent-BWRPzQtp.js +1 -0
  5. package/dist/constants-D8-vgQM1.js +1 -0
  6. package/dist/index-DvAx4AnX.js +1 -0
  7. package/dist/index.d.ts +2556 -0
  8. package/dist/index.mjs +1 -0
  9. package/dist/widgets.css +1 -0
  10. package/native/WidgetErrorBoundary.js +1 -0
  11. package/native/WidgetRenderer.js +36 -0
  12. package/native/WidgetRenderer.native.js +1 -0
  13. package/native/assets/image-placeholder.png +0 -0
  14. package/native/compat/FormContext.js +1 -0
  15. package/native/compat/WidgetStateContext.js +1 -0
  16. package/native/compat/WidgetThemeContext.js +1 -0
  17. package/native/components/BackgroundFill.js +1 -0
  18. package/native/components/Badge.js +1 -0
  19. package/native/components/BasicRoot.js +1 -0
  20. package/native/components/Box.js +1 -0
  21. package/native/components/Button.js +1 -0
  22. package/native/components/Card.js +1 -0
  23. package/native/components/Chart.js +1 -0
  24. package/native/components/ChartWidget.js +1 -0
  25. package/native/components/Checkbox.js +1 -0
  26. package/native/components/DatePicker.js +1 -0
  27. package/native/components/DatePicker.native.js +1 -0
  28. package/native/components/Divider.js +1 -0
  29. package/native/components/FileUploadRequest.js +1 -0
  30. package/native/components/Form.js +1 -0
  31. package/native/components/GlassSurface.js +1 -0
  32. package/native/components/Icon.js +1 -0
  33. package/native/components/Image.js +1 -0
  34. package/native/components/Input.js +1 -0
  35. package/native/components/ListView.js +1 -0
  36. package/native/components/Map/index.js +1 -0
  37. package/native/components/Map/index.native.js +1 -0
  38. package/native/components/Map/native/CalloutContent.js +1 -0
  39. package/native/components/Map/native/MapWebView.js +132 -0
  40. package/native/components/Map/native/NativeMapDisplay.js +1 -0
  41. package/native/components/Map/native/NativeMapInput.js +3 -0
  42. package/native/components/Map/native/NativeSearchOverlay.js +1 -0
  43. package/native/components/Map/shared/getLng.js +1 -0
  44. package/native/components/Map/shared/nominatim.js +1 -0
  45. package/native/components/Map/shared/partitionOverlays.js +1 -0
  46. package/native/components/Map/shared/types.js +0 -0
  47. package/native/components/Map/web/UserLocationContext.js +1 -0
  48. package/native/components/Map/web/adapters/GoogleMapsComponent.js +1 -0
  49. package/native/components/Map/web/adapters/OpenStreetMapComponent.js +1 -0
  50. package/native/components/Map/web/adapters/google.js +1 -0
  51. package/native/components/Map/web/adapters/index.js +1 -0
  52. package/native/components/Map/web/adapters/openstreetmap.js +1 -0
  53. package/native/components/Map/web/components/AdvancedMapMarker.js +1 -0
  54. package/native/components/Map/web/components/DataMarkerPopupContent.js +1 -0
  55. package/native/components/Map/web/components/GoogleInfoWindowTheme.js +15 -0
  56. package/native/components/Map/web/components/LeafletPopupTheme.js +8 -0
  57. package/native/components/Map/web/components/MapInputShell.js +1 -0
  58. package/native/components/Map/web/components/MapSearchOverlay.js +1 -0
  59. package/native/components/Map/web/components/MapSelectionIndicator.js +1 -0
  60. package/native/components/Map/web/components/MapShell.js +1 -0
  61. package/native/components/Map/web/components/MapSkeleton.js +1 -0
  62. package/native/components/Map/web/components/PopupContent.js +1 -0
  63. package/native/components/Map/web/components/SafeMapContainer.js +1 -0
  64. package/native/components/Map/web/components/SearchMarkerPopupContent.js +1 -0
  65. package/native/components/Map/web/constants.js +1 -0
  66. package/native/components/Map/web/hooks/useDirectionsUrl.js +1 -0
  67. package/native/components/Map/web/hooks/useMapFeatures.js +1 -0
  68. package/native/components/Map/web/hooks/useMapInput.js +3 -0
  69. package/native/components/Map/web/mapConfig.js +1 -0
  70. package/native/components/Map/web/mapRenderer.js +1 -0
  71. package/native/components/Map/web/services/google/googlePlaces.js +1 -0
  72. package/native/components/Map/web/services/index.js +1 -0
  73. package/native/components/Map/web/services/nominatim.js +1 -0
  74. package/native/components/Map/web/types.js +1 -0
  75. package/native/components/Map/web/utils/partitionOverlays.js +1 -0
  76. package/native/components/Map/web/utils.js +1 -0
  77. package/native/components/MapWidget.js +1 -0
  78. package/native/components/MapWidget.native.js +1 -0
  79. package/native/components/Markdown.js +3 -0
  80. package/native/components/MarkdownWidget.js +1 -0
  81. package/native/components/MediaDownloadButton.native.js +1 -0
  82. package/native/components/Placeholder.js +1 -0
  83. package/native/components/RadioGroup.js +1 -0
  84. package/native/components/Select.js +1 -0
  85. package/native/components/Spacer.js +1 -0
  86. package/native/components/Text.js +1 -0
  87. package/native/components/Textarea.js +1 -0
  88. package/native/components/Transition.js +1 -0
  89. package/native/components/Video.js +1 -0
  90. package/native/components/index.js +1 -0
  91. package/native/config.js +1 -0
  92. package/native/constants/validation.js +1 -0
  93. package/native/icons/icon-map.js +1 -0
  94. package/native/index.js +1 -0
  95. package/native/lib/utils.js +1 -0
  96. package/native/runtime/index.js +1 -0
  97. package/native/runtime/layoutContext.js +1 -0
  98. package/native/runtime/render.js +1 -0
  99. package/native/schema/action-types.js +1 -0
  100. package/native/schema/branding-types.js +0 -0
  101. package/native/schema/index.js +1 -0
  102. package/native/schema/widget-types.js +1 -0
  103. package/native/state/context.js +1 -0
  104. package/native/state/index.js +1 -0
  105. package/native/state/reducer.js +1 -0
  106. package/native/theme/ThemeContext.js +1 -0
  107. package/native/theme/defaults.js +1 -0
  108. package/native/theme/index.js +1 -0
  109. package/native/theme/resolveBranding.js +1 -0
  110. package/native/theme/style.js +1 -0
  111. package/native/theme/stylePipeline.js +1 -0
  112. package/native/theme/tokens.js +1 -0
  113. package/native/theme/variants.js +1 -0
  114. package/native/utils/formValidation.js +1 -0
  115. package/native/utils/formValidation.native.js +1 -0
  116. package/native/utils/formValidationCore.js +1 -0
  117. package/native/utils/safeRender.js +1 -0
  118. package/native/utils/widgetUtils.js +1 -0
  119. package/package.json +110 -0
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{A as a,m as e,B as s,n as t,o as r,p as i,C as o,q as d,t as n,v as u,w as l,x as m,D as g,y as C,z as T,F as c,E as p,G as S,I,H as x,J as A,L as F,K as R,N as W,O as E,R as N,P as O,Q as f,S as h,T as v,U as D,V as L,W as _,X as k,Y as B,Z as M,_ as U,$ as w,a0 as P,a1 as V,a2 as b,a3 as H,e as j,a4 as q,a5 as y,a6 as G,a7 as Y,a8 as z,a9 as J,e as K,e as Q,aa as X,ab as Z,f as $,ac as aa,a as ea,u as sa,ad as ta,ae as ra,af as ia,ag as oa,ah as da,ai as na}from"./index-DvAx4AnX.js";import"react/jsx-runtime";import"react";export{a as ACTION_TYPES,e as ActionHandlerContext,s as Badge,t as BasicRoot,r as Box,i as Button,o as CONSUMER_ACTIONS,d as Caption,n as Card,u as Chart,l as Checkbox,m as Col,g as DEFAULT_CONFIG,C as DatePicker,T as Divider,c as FileUploadRequest,p as Form,S as FormContext,I as Icon,x as Image,A as Input,F as Label,R as ListView,W as ListViewItem,E as Markdown,N as REDUCER_ACTIONS,O as RadioGroup,f as Row,h as SELF_CONTAINED_ACTIONS,v as Select,D as Spacer,L as Text,_ as Textarea,k as Title,B as Transition,M as Video,U as WidgetErrorBoundary,w as WidgetRenderer,P as WidgetStateManager,V as WidgetStateProvider,b as WidgetThemeProvider,H as configureMap,j as defaultActionHandler,q as formatOrderItems,y as markRequiredLabels,G as mergeConfig,Y as renderWidget,z as resolveTemplate,J as safeRenderWidget,K as useAction,Q as useActionHandler,X as useFileUploadState,Z as useFormContext,$ as useMessageId,aa as useSelectedCategory,ea as useTheme,sa as useTokens,ta as useVariants,ra as useWidgetDispatch,ia as useWidgetState,oa as useWidgetTheme,da as validateFields,na as validateForm};
@@ -0,0 +1 @@
1
+ .leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as l}from"react/jsx-runtime";import{Component as i}from"react";import{StyleSheet as s,Text as t,View as n}from"react-native";class h extends i{constructor(){super(...arguments);this.state={error:null}}static getDerivedStateFromError(r){return{error:r}}componentDidCatch(r,a){this.props.onError?.(r,a)}render(){return this.state.error?this.props.fallback!==void 0?this.props.fallback:l(n,{style:e.wrap,accessibilityRole:"alert",children:[o(t,{style:e.title,children:"Widget failed to render"}),o(t,{style:e.message,children:this.state.error.message})]}):this.props.children}}const e=s.create({wrap:{padding:12,backgroundColor:"#FFF5F5",borderColor:"#FED7D7",borderWidth:1,borderRadius:8,gap:4},title:{fontSize:13,fontWeight:"600",color:"#C53030"},message:{fontSize:12,color:"#742A2A"}});export{h as WidgetErrorBoundary};
@@ -0,0 +1,36 @@
1
+ import{jsx as l}from"react/jsx-runtime";import{useRef as C,useState as w,useEffect as D,useCallback as x}from"react";import{ThemeProvider as L,useTheme as N}from"./theme";import{WidgetStateManager as P}from"./state";import{WidgetErrorBoundary as A}from"./WidgetErrorBoundary";import{renderWidget as F}from"./runtime";import{mergeConfig as O}from"./config";import{UserLocationProvider as j}from"./components/Map";const h=390,_=24;function $(e){const t=e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i)??e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(!t)return e;const d=e.startsWith("#"),i=d?parseInt(t[1],16):Number(t[1]),g=d?parseInt(t[2],16):Number(t[2]),u=d?parseInt(t[3],16):Number(t[3]),n=.08,f=Math.round(i*(1-n)+80*n),m=Math.round(g*(1-n)+120*n),s=Math.round(u*(1-n)+200*n);return`rgb(${f}, ${m}, ${s})`}const z=`
2
+ [data-widget-renderer][data-widget-renderer] *,
3
+ [data-widget-renderer][data-widget-renderer] *::before,
4
+ [data-widget-renderer][data-widget-renderer] *::after {
5
+ box-sizing: border-box;
6
+ border: 0 solid;
7
+ margin: 0;
8
+ padding: 0;
9
+ }
10
+ /* Strip browser-native checkbox styling so our custom Checkbox surface
11
+ shows through. Web-only by necessity \u2014 native RN has no browser checkbox. */
12
+ [data-widget-renderer] [role="checkbox"]:only-child {
13
+ -webkit-appearance: none !important;
14
+ appearance: none !important;
15
+ background: transparent !important;
16
+ border: none !important;
17
+ }
18
+ /* justify-content: safe center \u2014 RNW's ViewStyle rejects the safe
19
+ keyword, so Box.tsx marks tile rows with data-tile-row and we apply
20
+ the value via CSS here. The keyword tells CSS to center when content
21
+ fits, then fall back to flex-start when it overflows \u2014 without it,
22
+ the leftmost cells get clipped by the card's overflow:hidden because
23
+ content is centered with equal overflow on both sides. */
24
+ [data-widget-renderer] [data-tile-row] {
25
+ justify-content: safe center !important;
26
+ }
27
+ /* Tile-row styling (3px inter-cell gap + centering) is implemented via
28
+ React Context in the component layer (TileCheckboxRegistry). Works
29
+ cross-platform on web and native Yoga \u2014 see runtime/layoutContext.ts. */
30
+ [data-widget-renderer] input:-webkit-autofill,
31
+ [data-widget-renderer] input:-webkit-autofill:hover,
32
+ [data-widget-renderer] input:-webkit-autofill:focus {
33
+ -webkit-box-shadow: 0 0 0 9999px var(--widget-input-bg) inset !important;
34
+ -webkit-text-fill-color: var(--widget-input-fg) !important;
35
+ }
36
+ `;let y=!1;function G(){if(y||typeof document>"u")return;if(document.getElementById("widget-renderer-style")){y=!0;return}const e=document.createElement("style");e.id="widget-renderer-style",e.textContent=z,document.head.appendChild(e),y=!0}function re({widget:e,branding:t,brandingStyles:d,theme:i="light",messageId:g,onConsumerAction:u,config:n,errorFallback:f,userLocation:m}){const s=C(null),p=C(null),[b,k]=w(1),[T,M]=w(!1),[E,I]=w(void 0),v=x(()=>{const a=s.current;if(!a)return;const r=a.clientWidth;M(c=>c?r<h+_:r<h);const o=Math.min(r<h?r/h:1,1);k(c=>Math.abs(c-o)<.005?c:o)},[]),R=x(()=>{const a=p.current;if(!a)return;const r=a.scrollHeight;I(o=>o!==void 0&&Math.abs(o-r)<1?o:r)},[]);if(D(()=>{G();const a=s.current,r=p.current;if(!a||!r)return;let o=0;const c=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{v(),R()})},S=new ResizeObserver(c);S.observe(a);const W=new ResizeObserver(c);return W.observe(r),()=>{cancelAnimationFrame(o),S.disconnect(),W.disconnect()}},[v,R]),!e)return null;const B=t??d,H=O(n);return l(L,{branding:B,mode:i,config:H,children:l(P,{messageId:g,onConsumerAction:u,children:l(j,{location:m??null,children:l(q,{outerRef:s,innerRef:p,theme:i,needsScaling:T,innerHeight:E,scale:b,errorFallback:f,widget:e})})})})}function q({outerRef:e,innerRef:t,theme:d,needsScaling:i,innerHeight:g,scale:u,errorFallback:n,widget:f}){const{tokens:m,variants:s}=N(),p=s.input.soft.bg,b=$(p);return l("div",{ref:e,style:{width:"100%",overflow:"hidden",height:i&&g?g*u:void 0},children:l("div",{ref:t,"data-widget-renderer":"","data-theme":d,style:{width:i?`${h}px`:"100%",transformOrigin:"top left",transform:i?`scale(${u})`:void 0,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale","--widget-input-fg":m.color.text,"--widget-input-bg":b},children:l(A,{fallback:n,children:F(f)})})})}export{re as WidgetRenderer};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{View as l}from"react-native";import{ThemeProvider as c}from"./theme";import{WidgetStateManager as f}from"./state";import{WidgetErrorBoundary as W}from"./WidgetErrorBoundary";import{renderWidget as C}from"./runtime";import{mergeConfig as u}from"./config";import{UserLocationProvider as y}from"./components/Map";function M({widget:o,branding:r,brandingStyles:n,theme:t="light",messageId:i,onConsumerAction:d,config:a,errorFallback:g,userLocation:m}){if(!o)return null;const s=r??n,p=u(a);return e(c,{branding:s,mode:t,config:p,children:e(f,{messageId:i,onConsumerAction:d,children:e(y,{location:m??null,children:e(l,{style:{width:"100%"},children:e(W,{fallback:g,children:C(o)})})})})})}export{M as WidgetRenderer};
@@ -0,0 +1 @@
1
+ import{useFormContext as r}from"../components/Form";function o(){const e=r();return e?{submit:e.submit,registerRequired:e.registerRequired,isRequired:e.isRequired}:null}import{FormContext as u}from"../components/Form";export{u as FormContext,o as useFormContext};
@@ -0,0 +1 @@
1
+ import{WidgetStateManager as e,useWidgetState as t,useWidgetDispatch as a,useMessageId as r,useSelectedCategory as o,useFileUploadState as i}from"../state";const p=e;export{e as WidgetStateManager,p as WidgetStateProvider,i as useFileUploadState,r as useMessageId,o as useSelectedCategory,a as useWidgetDispatch,t as useWidgetState};
@@ -0,0 +1 @@
1
+ import{ThemeProvider as e,useTheme as t}from"../theme";const o=e,i=()=>t().mode;export{o as WidgetThemeProvider,i as useWidgetTheme};
@@ -0,0 +1 @@
1
+ import{jsx as u,jsxs as S}from"react/jsx-runtime";import{ImageBackground as k,Platform as b,processColor as M,StyleSheet as v,View as m}from"react-native";import{useState as V,useCallback as F}from"react";import{isGradient as L,resolveColor as P}from"../theme/style";function E(o){const t=/url\(\s*(['"]?)([^'")]+)\1\s*\)/.exec(o);return t?t[2]:null}function A({background:o,tokens:t,mode:n="light",radius:e,style:i,children:r}){const l=P(o,t,n);if(typeof l=="string"){const a=E(l);if(a)return u(k,{source:{uri:a},resizeMode:"cover",style:[e!==void 0?[t.layout.backgroundFill.imageWrap,{borderRadius:e}]:null,i],imageStyle:e!==void 0?{borderRadius:e}:void 0,children:r})}return l&&L(l)?u(I,{css:l,radius:e,style:i,fallbackColor:t.color.text,children:r}):u(m,{style:[{...l?{backgroundColor:l}:null,...e!==void 0?{borderRadius:e}:null},i],children:r})}function w(o,t){const n=o.toLowerCase().indexOf(`${t}(`);if(n===-1)return null;const e=n+t.length+1;let i=1;for(let r=e;r<o.length;r++){const l=o[r];if(l==="(")i++;else if(l===")"&&(i--,i===0))return o.slice(e,r)}return null}function R(o){const t=[];let n=0,e="";for(const r of o)if(r==="("?n++:r===")"&&(n=Math.max(0,n-1)),r===","&&n===0){const l=e.trim();l&&t.push(l),e=""}else e+=r;const i=e.trim();return i&&t.push(i),t}function C(o,t){const n=[],e=[];return o.forEach((i,r)=>{const l=i.trim(),a=t[r];l.length===0||M(l)==null||!Number.isFinite(a)||(n.push(l),e.push(Math.max(0,Math.min(1,a))))}),{colors:n,locations:e}}function N(o){const t=w(o,"linear-gradient");if(!t)return null;const n=R(t);let e=180;const i=n[0],r=/^(-?\d+(?:\.\d+)?)deg$/.exec(i);r&&(e=parseFloat(r[1]),n.shift());const l=[],a=[];n.forEach((f,d)=>{const s=/^(.+?)(?:\s+(\d+(?:\.\d+)?)%)?$/.exec(f);s&&(l.push(s[1].trim()),a.push(s[2]!==void 0?parseFloat(s[2])/100:d/Math.max(1,n.length-1)))});const c=C(l,a);return c.colors.length<2?null:{angle:e,colors:c.colors,locations:c.locations}}function z(o){const t=(o-90)*Math.PI/180,n=Math.cos(t),e=Math.sin(t);return{start:{x:.5-n/2,y:.5-e/2},end:{x:.5+n/2,y:.5+e/2}}}function B(o){const t=w(o,"radial-gradient");if(!t)return null;const n=R(t);let e="50%",i="50%",r=0;const l=/at\s+(\d+)%\s+(\d+)%/.exec(n[0]);l?(e=l[1]+"%",i=l[2]+"%",r=1):/circle|ellipse/.test(n[0])&&(r=1);const a=[],c=[];for(let d=r;d<n.length;d++){const s=/^(.+?)(?:\s+(\d+(?:\.\d+)?)%)?$/.exec(n[d]);s&&(a.push(s[1].trim()),c.push(s[2]!==void 0?parseFloat(s[2])/100:(d-r)/Math.max(1,n.length-r-1)))}const f=C(a,c);return f.colors.length<2?null:{cx:e,cy:i,colors:f.colors,locations:f.locations}}let h=null;if(b.OS!=="web")try{h=require("react-native-svg")}catch{h=null}function T({parsed:o,radius:t,style:n,children:e}){const[i,r]=V({w:0,h:0}),l=F(p=>{const{width:g,height:G}=p.nativeEvent.layout;r(y=>y.w===g&&y.h===G?y:{w:g,h:G})},[]),{Svg:a,Defs:c,RadialGradient:f,Stop:d,Rect:s}=h;return S(m,{onLayout:l,style:[t!==void 0?{borderRadius:t,overflow:"hidden"}:null,n],children:[i.w>0&&S(a,{width:i.w,height:i.h,style:v.absoluteFill,children:[u(c,{children:u(f,{id:"rg",cx:o.cx,cy:o.cy,r:"100%",fx:o.cx,fy:o.cy,children:o.colors.map((p,g)=>u(d,{offset:o.locations[g],stopColor:p},g))})}),u(s,{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#rg)"})]}),e]})}let x=null;if(b.OS!=="web")try{x=require("expo-linear-gradient")}catch{x=null}function I({css:o,radius:t,style:n,children:e,fallbackColor:i}){if(b.OS==="web")return u(m,{style:[{background:o,borderRadius:t},n],children:e});const r=N(o),l=x?.LinearGradient;if(r&&l){const{start:d,end:s}=z(r.angle);return u(l,{colors:r.colors,locations:r.locations,start:d,end:s,style:[t!==void 0?{borderRadius:t}:null,n],children:e})}const a=B(o);if(a&&h)return u(T,{parsed:a,radius:t,style:n,children:e});const c=[...o.matchAll(/(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))/gi)],f=r?.colors[0]??c[c.length-1]?.[1]??i;return u(m,{style:[{backgroundColor:f},t!==void 0?{borderRadius:t}:null,n],children:e})}export{A as BackgroundFill,N as parseLinearGradient,B as parseRadialGradient};
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import{useContext as d}from"react";import{View as g,Text as f}from"react-native";import{PRIMITIVE_KINDS as m,resolveStyle as p,useTheme as y}from"../theme";import{badgeRadius as u}from"../theme/style";import{ParentCrossAlignContext as b}from"../runtime/layoutContext";function B(t){const{tokens:e,variants:i}=y(),o=e.badge.size[t.size],r=i.badge[t.variant][t.color],n=d(b),l={...e.layout.badge.pill,backgroundColor:r.bg,borderColor:r.border,borderWidth:r.borderWidth,paddingVertical:e.space[0],paddingHorizontal:o.padH,borderRadius:u(t.size,e,t.pill),fontSize:o.font,gap:e.badge.gap,...n==="stretch"?{alignSelf:"flex-start"}:{}},s=p(l,m.BOX,{hasBackground:!0});return a(g,{style:s,children:a(f,{style:{color:r.fg,fontSize:o.font,lineHeight:o.lineHeight,fontFamily:e.font.family,fontWeight:e.badge.fontWeight},children:t.label})})}export{B as Badge};
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import{BoxRender as o}from"./Box";function a(e){return i(o,{direction:e.direction,gap:e.gap,padding:e.padding,align:e.align,justify:e.justify,children:e.children})}export{a as BasicRoot};
@@ -0,0 +1 @@
1
+ import{Fragment as pe,jsx as r}from"react/jsx-runtime";import{useContext as f,useMemo as he,useState as ge}from"react";import{Platform as c,Pressable as xe,ScrollView as me,View as Y,useWindowDimensions as we}from"react-native";import{PRIMITIVE_KINDS as Se,resolveStyle as be,useTheme as ye}from"../theme";import{alignToFlex as q,borderToStyle as Ce,hexToRgba as ve,isGradient as Pe,justifyToFlex as Re,radiusToNumber as He,resolveColor as We,sizeToRN as w,spacingToStyle as Q,spacingValue as Z}from"../theme/style";import{useActionHandler as ke,useSelectedCategory as Be}from"../state";import{BackgroundFill as Te}from"./BackgroundFill";import{applyPostDividerSpacing as Ve}from"./Divider";import{GlassSurfaceNative as Ie}from"./GlassSurface";import{CarouselItemRootContext as $,FillHeightContext as ee,GridRowContext as ie,PageWidthContext as Ge,GridRowHeightContext as te,InsideTileRowContext as ne,ParentCrossAlignContext as Ne,ParentDirectionContext as oe,ScrollableContext as re,ScrollableListContext as Oe,SizedParentContext as de,TabIdContext as Fe,TileCheckboxRegistry as le,hasConcreteHeight as ze,isPercentString as O}from"../runtime/layoutContext";const Ee=50,Ae=56;function _e(i,t,l,S,y,B,T,V){const I=("direction"in i?i.direction:void 0)==="row"?"row":"column",G=I==="row"&&!y?"wrap":void 0,d={flexDirection:I,...i.flex===void 0?{flexShrink:y?0:1}:{flexShrink:1},...i.flex!==void 0?{flex:Number(i.flex),...i.minWidth===void 0?{minWidth:0}:{}}:{},...i.gap!==void 0?{gap:Z(i.gap,t)}:{},...i.wrap?{flexWrap:i.wrap}:G?{flexWrap:G}:{},...Q(i.padding,"padding",t),...Q(i.margin,"margin",t),...Ce(i.border,t)},C=q(i.align);C&&(d.alignItems=C);const b=Re(i.justify);b&&(d.justifyContent=b);const v=He(i.radius,t);v!==void 0&&(d.borderRadius=v,d.overflow="hidden");const P=i.height??i.size,R=O(P);let m;if(R&&c.OS!=="web"&&l&&B>0){const h=parseFloat(P)/100;d.flexGrow=h,d.flexShrink=1,d.flexBasis=Math.round(B*h),m=void 0}else m=(c.OS==="web"?R&&!S&&!l:R&&(l||!S))?void 0:w(P);const a=i.width??i.size,g=typeof a=="string"&&O(a)&&parseFloat(a)>=100,p=g&&y;let x;if(!g&&O(a)&&T&&c.OS!=="web"){const h=parseFloat(a)/100;x=Number.isFinite(h)?(V-Ee)*h:void 0}else x=p?void 0:w(a);m!==void 0&&(d.height=m),x!==void 0&&(d.width=x);const H=i.alignSelf?q(i.alignSelf):void 0;H?d.alignSelf=H:g&&!i.align&&(d.alignSelf="stretch");const N=w(i.minHeight??i.minSize);let s=w(i.minWidth??i.minSize);typeof s=="number"&&T&&c.OS!=="web"&&(s=Math.min(s,V-Ae)),N!==void 0&&(d.minHeight=N),s!==void 0?d.minWidth=s:typeof x=="number"&&(d.minWidth=x);const e=16;typeof a=="string"&&O(a)&&!g&&typeof s=="number"&&(d.paddingHorizontal=e);const z=w(i.maxHeight??i.maxSize),u=w(i.maxWidth??i.maxSize);return z!==void 0&&(d.maxHeight=z),u!==void 0&&(d.maxWidth=u),i.aspectRatio!==void 0&&(d.aspectRatio=Number(i.aspectRatio)||1),d}const je=new Set(["between","around","evenly","end","center"]);function j({children:i,...t}){const{tokens:l,mode:S,config:y}=ye(),B=ke(),T=Be(),V=f(ie),F=f(de),I=f(re),G=f(ne),d=f(te),C=f(ee),b=f($),v=f(Ge),P=f(oe),{width:R}=we(),m=!!t.isGridRow,a=ze(t),g=w(t.minHeight??t.minSize),x=m&&typeof g=="number"&&g>0?g:0,H=T??t.activeId,N=!!(t.tabId&&H&&H!==t.tabId),s=t.tint==="clear",e=be(_e({...t,type:"Box"},l,V,F,I,d,b,R),Se.BOX,{hasBackground:t.background!==void 0,clearTintFilter:s?l.glass.webFilter:void 0}),u=t.direction==="row",h=t.flex!==void 0&&t.flex!==null;C&&!u&&!h&&(e.flexGrow=1,e.minHeight===void 0&&(e.minHeight=0)),!u&&!h&&P==="column"&&e.flexGrow===void 0&&typeof t.justify=="string"&&je.has(t.justify)&&(e.flexGrow=1),v>0&&b&&(e.width=v,delete e.minWidth,delete e.maxWidth);const D=f(le),[E,M]=ge(0),ae=he(()=>({register:()=>{M(_=>_+1);const n=D?.register();return()=>{M(_=>_-1),n?.()}}}),[D]);E>0&&(e.gap===void 0&&(e.gap=3),u&&!e.justifyContent&&(e.justifyContent="flex-start")),G&&(e.flexShrink=0);const W=t.background!==void 0?We(t.background,l,S):void 0,A=typeof W=="string"&&(Pe(W)||/^url\(/.test(W));typeof W=="string"&&!A&&(e.backgroundColor=W),s&&Object.assign(e,{backgroundColor:l.glass.fallbackBg,borderColor:l.glass.fallbackBorder,borderWidth:l.glass.fallbackBorderWidth});const L=t.gap!==void 0?Z(t.gap,l):void 0;let o=Ve(i,l,typeof L=="number"?L:void 0);a!==F&&(o=r(de.Provider,{value:a,children:o})),o=r(le.Provider,{value:ae,children:o});const K=e.alignItems??"stretch";K!=="stretch"&&(o=r(Ne.Provider,{value:K,children:o})),o=r(oe.Provider,{value:u?"row":"column",children:o}),u&&E>0&&(o=r(ne.Provider,{value:!0,children:o})),m&&(o=r(ie.Provider,{value:!0,children:r(te.Provider,{value:x,children:o})})),t.tabId&&(o=r(Fe.Provider,{value:t.tabId,children:o})),o=r(Oe.Provider,{value:!1,children:o}),b&&(o=r($.Provider,{value:!1,children:o})),C&&(o=r(ee.Provider,{value:!1,children:o})),N&&(c.OS==="web"?e.display="none":(e.height=0,e.overflow="hidden"));const se=u&&(t.justify==="center"||E>0),fe=c.OS==="web"&&se?{dataSet:{tileRow:""}}:{},J=A?(()=>{const n={...e};return delete n.width,delete n.height,delete n.minWidth,delete n.minHeight,delete n.maxWidth,delete n.maxHeight,delete n.flexGrow,delete n.flexShrink,n.flex=1,n.alignSelf="stretch",c.OS!=="web"&&(delete n.aspectRatio,e.height!==void 0&&(n.flexGrow=1)),n})():e,U=s&&c.OS!=="web"?r(Ie,{tokens:l,mode:S,radius:e.borderRadius,style:J,children:o}):r(Y,{...fe,style:J,children:o});let k=U;const ce=t.scrollable&&y.scroll.allowOrthogonalAxis&&c.OS!=="web",ue=e.maxHeight!==void 0,X=ce?t.direction!=="row"&&ue?"vertical":"horizontal":null;if(X?k=r(re.Provider,{value:!0,children:r(me,{horizontal:X==="horizontal",showsHorizontalScrollIndicator:!1,showsVerticalScrollIndicator:!1,children:U})}):t.scrollable&&c.OS==="web"&&(e.overflow="auto"),A){const n={};e.width!==void 0&&(n.width=e.width),e.height!==void 0&&(n.height=e.height),e.minWidth!==void 0&&(n.minWidth=e.minWidth),e.minHeight!==void 0&&(n.minHeight=e.minHeight),e.maxWidth!==void 0&&(n.maxWidth=e.maxWidth),e.maxHeight!==void 0&&(n.maxHeight=e.maxHeight),e.flex!==void 0&&(n.flex=e.flex),e.flexShrink!==void 0&&(n.flexShrink=e.flexShrink),e.flexGrow!==void 0&&(n.flexGrow=e.flexGrow),e.alignSelf!==void 0&&(n.alignSelf=e.alignSelf),e.borderRadius!==void 0&&(n.borderRadius=e.borderRadius),k=r(Y,{style:n,children:r(Te,{background:t.background,tokens:l,mode:S,radius:e.borderRadius,style:e.height!==void 0||e.flexGrow!==void 0?{flex:1}:void 0,children:k})})}return t.onClickAction?r(xe,{onPress:()=>B(t.onClickAction),style:({pressed:n})=>n?{opacity:l.ui.pressedOpacity,backgroundColor:ve(l.color.text,l.ui.pressedOverlayAlpha)??void 0,borderRadius:e.borderRadius}:null,children:k}):r(pe,{children:k})}function Ze(i){return r(j,{...i})}function $e(i){return r(j,{...i,direction:"row"})}function ei(i){return r(j,{...i,direction:"col"})}export{Ze as Box,j as BoxRender,ei as Col,$e as Row};
@@ -0,0 +1 @@
1
+ import{Fragment as $,jsx as r,jsxs as j}from"react/jsx-runtime";import{useContext as d,useState as W}from"react";import{ActivityIndicator as N,Platform as C,Pressable as F,Text as D}from"react-native";import{PRIMITIVE_KINDS as E,resolveStyle as H,useTheme as L}from"../theme";import{controlRadius as w,hexToRgba as M,radiusToNumber as X,sizeToRN as _}from"../theme/style";import{useActionHandler as p,useMessageId as q,useSelectedCategory as G}from"../state";import{ParentCrossAlignContext as J,ParentDirectionContext as Q,ScrollableContext as U}from"../runtime/layoutContext";import{Icon as k}from"./Icon";import{useFormContext as Y}from"./Form";function Z(t){return t==="caution"?"warning":t}function at(t){const{tokens:o,variants:c}=L(),l=q(),v=G(),u=p(),n=Y(),[f,b]=W(!1),x=d(J),A=d(Q),z=d(U),i=o.control.size[t.size],m=t.variant,y=Z(t.color),I=!!t.tabId||m==="tabs",g=v??t.activeId,S=!!(t.tabId&&g&&g===t.tabId),e=S&&I?c.button.solid[y]:c.button[m][y],h=t.pill||o.button.alwaysPill,R=t.width,s=_(R),a=!!t.block||s!==void 0,T=!a&&x!=="stretch"?{alignSelf:"auto"}:null,B={height:i.h,paddingHorizontal:i.padH,backgroundColor:e.bg,borderColor:e.border,borderWidth:e.borderWidth,borderRadius:t.radius!==void 0?X(t.radius,o)??w(t.size,o,h):w(t.size,o,h),opacity:t.disabled?o.ui.disabledOpacity:1,gap:i.gap,...a?o.layout.button.block:{},...a&&A==="row"&&C.OS!=="web"&&s===void 0?{flexBasis:0,minWidth:0}:{},...a&&z&&C.OS!=="web"?{flex:void 0}:{},...T??{},...s!==void 0?{width:s}:{},...t.uniform?{minWidth:i.h}:{}},P=H(B,E.BOX,{hasBackground:e.bg!==void 0}),V={color:e.fg,fontSize:i.font,fontWeight:o.font.weight.medium,fontFamily:o.font.family};async function K(){if(!t.disabled){if(t.submit&&n){if(n.submit&&t.onClickAction===void 0){n.submit();return}if(!n.validate()||!t.onClickAction)return;u({...t.onClickAction,payload:{...t.onClickAction.payload??{},...n.formFields,...l?{messageId:l}:{}}});return}if(t.onClickAction){t.loader&&b(!0);try{u({...t.onClickAction,payload:{...t.onClickAction.payload??{},...l?{messageId:l}:{}}})}finally{t.loader&&b(!1)}}}}return r(F,{disabled:t.disabled||f,onPress:K,accessibilityRole:"button",accessibilityState:{disabled:!!t.disabled,selected:S},style:({pressed:O})=>[o.layout.button.base,P,O?{opacity:o.ui.pressedOpacity,backgroundColor:M(e.fg,o.ui.pressedOverlayAlpha)??e.bg}:null],children:f?r(N,{size:"small",color:e.fg}):j($,{children:[t.iconStart?r(k,{name:t.iconStart,size:t.iconSize??"button",color:e.fg}):null,t.label?r(D,{style:V,children:t.label}):null,t.iconEnd?r(k,{name:t.iconEnd,size:t.iconSize??"button",color:e.fg}):null]})})}export{at as Button};
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useContext as S}from"react";import{Platform as v,View as t}from"react-native";import{GlassSurfaceNative as A}from"./GlassSurface";import{PRIMITIVE_KINDS as I,resolveStyle as O,useTheme as k}from"../theme";import{borderToStyle as D,cardRadius as E,radiusToNumber as K,resolveColor as M,spacingToStyle as U}from"../theme/style";import{Button as V}from"./Button";import{Icon as X}from"./Icon";import{Text as _}from"./Text";import{Form as q}from"./Form";import{BackgroundFill as J}from"./BackgroundFill";import{applyPostDividerSpacing as L}from"./Divider";import{ThemeProvider as Q}from"../theme";import{CardPaddingContext as Y,FillHeightContext as Z,ScrollableContext as $}from"../runtime/layoutContext";function pe(r){const{tokens:e,variants:C,mode:n}=k(),B=S($),f=S(Z)?{flexGrow:1,minHeight:0}:{},u=r.theme,g=K(r.borderRadius,e)??E(e),p=e.card.size[r.size],i=C.card.default,x=r.border===void 0?{borderWidth:i.borderWidth,borderColor:i.border}:{},m=(()=>{const a=r.background??i.bg;if(!a)return;const c=M(a,e,n);if(c&&!c.includes("gradient")&&!c.includes("url("))return c})(),l=r.tint==="clear",y=B&&v.OS!=="web",P={...y?{overflow:e.layout.card.wrapper.overflow}:e.layout.card.wrapper,maxWidth:p,borderRadius:g,...x,...D(r.border,e),...m?{backgroundColor:m}:{},...l?{backgroundColor:e.glass.fallbackBg,borderColor:e.glass.fallbackBorder,borderWidth:e.glass.fallbackBorderWidth}:{}},T=O(P,I.BOX,{hasBackground:m!==void 0||l,clearTintFilter:l?e.glass.webFilter:void 0}),R=r.padding===void 0?{padding:e.card.defaultPadPx}:U(r.padding,"padding",e),z=typeof r.padding=="number"?r.padding*e.spacingUnit:e.card.defaultPadPx,d={width:"100%",minWidth:0,...f},b=s(t,{style:d,children:[r.status?o(j,{status:r.status}):null,r.collapsed?null:o(Y.Provider,{value:z,children:o(t,{style:[d,R,{gap:e.card.contentGap}],children:L(r.children,e,e.card.contentGap)})})]}),F=l&&v.OS!=="web"?o(A,{tokens:e,mode:n,radius:g,style:d,children:b}):o(J,{background:r.background??i.bg,tokens:e,mode:n,style:d,children:b}),N=o(t,{style:[T,f],children:F}),W=r.confirm||r.cancel?s(t,{style:[e.layout.card.actionRow,{maxWidth:p,gap:e.card.actionRowGap}],children:[r.confirm?o(V,{type:"Button",label:r.confirm.label,onClickAction:r.confirm.action,variant:"solid",color:"primary",size:e.card.actionButtonSize,pill:!0,submit:r.asForm}):null,r.cancel?o(V,{type:"Button",label:r.cancel.label,onClickAction:r.cancel.action,variant:"ghost",color:"secondary",size:e.card.actionButtonSize,pill:!0}):null]}):null,G=y?{flexShrink:0}:e.layout.card.shell,w=s(t,{style:[G,{gap:e.card.shellGap}],children:[N,W]}),H=u&&u!==n;function h(a){return H?o(Q,{mode:u,children:a}):a}return r.asForm?h(o(q,{type:"Form",onSubmitAction:r.confirm?.action,direction:"col",children:w})):h(w)}function j({status:r}){const{tokens:e}=k();return s(t,{style:[e.layout.card.banner,{backgroundColor:e.color.surfaceAlt,paddingVertical:e.banner.padV,paddingHorizontal:e.banner.padH,gap:e.banner.gap}],children:[r.icon?o(X,{name:r.icon,size:"sm",color:"secondary"}):null,o(_,{type:"Text",value:r.text,size:r.textSize??e.banner.defaultTextSize,color:"secondary",weight:"normal"})]})}export{pe as Card,j as StatusBanner};
@@ -0,0 +1 @@
1
+ import{jsx as c,jsxs as D}from"react/jsx-runtime";import{View as p,Text as B}from"react-native";import{BarChart as te,LineChart as ne}from"react-native-gifted-charts";import{PRIMITIVE_KINDS as ae,resolveStyle as re,useTokens as oe,useTheme as ie}from"../theme";import{sizeToRN as d,resolveColor as se,hexToRgba as le}from"../theme/style";const C=["#3b82f6","#a855f7","#f97316","#22c55e","#ef4444","#eab308","#ec4899"];function pe(M){const{id:S,data:h,series:a,xAxis:l,showYAxis:N=!1,showLegend:j=!0,barGap:_,barCategoryGap:E,flex:P,height:z=240,width:Y,size:T,minSize:k,maxSize:K,maxHeight:U,maxWidth:X,minHeight:q,minWidth:J,aspectRatio:V}=M,r=oe(),{mode:Q}=ie(),v=typeof l=="string"?l:l.dataKey,Z=typeof l=="object"&&l.hide,O=typeof l=="object"?l.labels:void 0,o=(e,n)=>e&&se(e,r,Q)||C[n%C.length],A=e=>O&&e in O?O[e]:String(e),$={flex:typeof P=="number"?P:void 0,height:d(T||z)??240,width:d(T||Y),minHeight:d(k||q),minWidth:d(k||J),maxHeight:d(K||U),maxWidth:d(K||X),aspectRatio:V!==void 0?Number(V)||1:void 0},w=re($,ae.BOX,{}),x=a.filter(e=>e.type==="bar"),f=a.filter(e=>e.type==="line"),u=a.filter(e=>e.type==="area"),ee=le(r.color.text,.1)??"rgba(0,0,0,0.1)",b=r.color.textMuted,F=(d(T||z)??240)-60,R={height:F>0?F:180,yAxisColor:N?b:"transparent",xAxisColor:Z?"transparent":b,yAxisTextStyle:{color:b,fontSize:r.font.size.text.xs,fontFamily:r.font.family},xAxisLabelTextStyle:{color:b,fontSize:r.font.size.text.xs,fontFamily:r.font.family},hideRules:!1,rulesColor:ee,rulesType:"dashed",hideYAxisText:!N,noOfSections:4,backgroundColor:"transparent"},G=j?a.map((e,n)=>({label:e.label||e.dataKey,color:o(e.color,n)})):[],H=G.length>0?c(p,{style:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",gap:12,marginTop:8},children:G.map((e,n)=>D(p,{style:{flexDirection:"row",alignItems:"center",gap:4},children:[c(p,{style:{width:10,height:10,borderRadius:2,backgroundColor:e.color}}),c(B,{style:{color:r.color.text,fontSize:r.font.size.text.sm,fontFamily:r.font.family},children:e.label})]},n))}):null;if(x.length>0){const e=x.length>1,n=E??20,i=_??2;let m;if(e)m=h.flatMap((t,L)=>x.map((s,W)=>({value:Number(t[s.dataKey])||0,label:W===0?A(t[v]):void 0,frontColor:o(s.color,a.indexOf(s)),spacing:W<x.length-1?i:n})));else{const t=x[0],L=o(t.color,a.indexOf(t));m=h.map(s=>({value:Number(s[t.dataKey])||0,label:A(s[v]),frontColor:L,spacing:n}))}const g=f.length>0||u.length>0?h.map(t=>({value:Number(t[(f[0]||u[0]).dataKey])||0})):void 0,y=f.length>0?o(f[0].color,a.indexOf(f[0])):u.length>0?o(u[0].color,a.indexOf(u[0])):void 0;return D(p,{nativeID:S,style:w,children:[c(te,{data:m,...R,barWidth:e?12:24,barBorderRadius:3,isAnimated:!0,showLine:!!g,lineData:g,lineConfig:y?{color:y,thickness:2,curved:!0,dataPointsColor:y,dataPointsRadius:3}:void 0,xAxisLabelTextStyle:{...R.xAxisLabelTextStyle,width:e?60:void 0,textAlign:"center"}}),H]})}const I=[...f,...u];if(I.length>0){const e=I[0],n=o(e.color,a.indexOf(e)),i=e.type==="area",m=e.curveType!=="linear"&&e.curveType!=="step",g=h.map(t=>({value:Number(t[e.dataKey])||0,label:A(t[v])})),y=I.slice(1,5).map((t,L)=>({data:h.map(s=>({value:Number(s[t.dataKey])||0})),color:o(t.color,a.indexOf(t)),thickness:2,curved:m,dataPointsColor:o(t.color,a.indexOf(t)),dataPointsRadius:3,...t.type==="area"?{areaChart:!0,startFillColor:o(t.color,a.indexOf(t)),startOpacity:.3,endOpacity:.05}:{}}));return D(p,{nativeID:S,style:w,children:[c(ne,{data:g,...R,color:n,thickness:2,curved:m,areaChart:i,startFillColor:i?n:void 0,startOpacity:i?.3:void 0,endOpacity:i?.05:void 0,dataPointsColor:n,dataPointsRadius:3,isAnimated:!0,...y.length>0?{dataSet:[{data:g,color:n,thickness:2,dataPointsColor:n,dataPointsRadius:3,...i?{areaChart:!0,startFillColor:n,startOpacity:.3,endOpacity:.05}:{}},...y]}:{}}),H]})}return c(p,{nativeID:S,style:[w,{alignItems:"center",justifyContent:"center"}],children:c(B,{style:{color:r.color.textMuted,fontFamily:r.font.family},children:"No chart data"})})}export{pe as Chart};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{Chart as t}from"./Chart";function C(r){return o(t,{...r})}export{C as ChartWidget};
@@ -0,0 +1 @@
1
+ import{jsx as s,jsxs as V}from"react/jsx-runtime";import{useContext as w,useEffect as h,useState as A}from"react";import{Pressable as b,Text as p,View as u}from"react-native";import{ACTION_TYPES as R}from"../schema";import{TileCheckboxRegistry as T}from"../runtime/layoutContext";import{PRIMITIVE_KINDS as l,resolveStyle as a,useTheme as I}from"../theme";import{useActionHandler as E,useMessageId as O,useWidgetDispatch as z,REDUCER_ACTIONS as B}from"../state";import{useRegisterRequired as P}from"./Form";function y({color:e,size:o}){const i=o==="lg"?{w:8,h:14,border:3}:{w:5,h:9,border:2};return s(u,{style:{width:i.w,height:i.h,borderBottomWidth:i.border,borderRightWidth:i.border,borderColor:e,transform:[{rotate:"45deg"}],marginTop:-i.border}})}function q(e){const{tokens:o}=I(),i=E(),m=z(),n=O();P(e.name,e.required);const[r,f]=A(!!e.defaultChecked);h(()=>{const t=e.onChangeAction?.payload?.data;e.defaultChecked&&e.onChangeAction?.type===R.DATA_CHECKBOX&&typeof t=="string"&&t&&m({type:B.SET_CHECKBOX_DATA,payload:{data:t,checked:!0}})},[]);function d(){if(e.disabled)return;const t=!r;f(t),e.onChangeAction&&i({...e.onChangeAction,payload:{...e.onChangeAction.payload??{},checked:t,...n?{messageId:n}:{}}})}const c=w(T);if(h(()=>{if(!e.label&&c)return c.register()},[e.label,c]),!e.label){const t={flex:1,alignSelf:"stretch",width:"100%",height:"100%",alignItems:"center",justifyContent:"center",backgroundColor:r?o.color.text:"transparent"},S=a(t,l.BOX,{});return s(b,{onPress:d,disabled:e.disabled,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:!!e.disabled},style:S,children:r?s(y,{color:o.color.surface,size:"lg"}):null})}const g={...o.layout.checkbox.box,width:o.checkbox.size,height:o.checkbox.size,borderRadius:o.checkbox.radius,borderWidth:o.checkbox.borderWidth,borderColor:r?o.color.primary.solid:o.color.textFaint,backgroundColor:r?o.color.primary.solid:o.color.transparent},x=a(g,l.BOX,{hasBackground:r}),C={...o.layout.checkbox.row,gap:o.checkbox.rowGap},k=a(C,l.BOX,{});return V(b,{onPress:d,disabled:e.disabled,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:!!e.disabled},style:({pressed:t})=>[k,t?{opacity:o.ui.pressedOpacity}:null],children:[s(u,{style:x,children:r?s(y,{color:o.color.primary.text,size:"sm"}):null}),s(p,{style:{color:o.color.text,fontFamily:o.font.family,fontSize:o.font.baseSize},children:e.label})]})}export{q as Checkbox};
@@ -0,0 +1 @@
1
+ import{jsx as i,jsxs as N}from"react/jsx-runtime";import{createElement as R,useEffect as D,useState as I}from"react";import{Platform as T,Text as V,TextInput as x,View as l}from"react-native";import{PRIMITIVE_KINDS as E,resolveStyle as w,useTheme as k}from"../theme";import{controlRadius as z}from"../theme/style";import{useActionHandler as F,useMessageId as Y,useWidgetDispatch as A,useWidgetState as M}from"../state";import{REDUCER_ACTIONS as P}from"../state";import{useRegisterRequired as q,useFieldError as H}from"./Form";function X(e){const{tokens:o,variants:g,mode:h}=k(),y=A(),s=M(),d=Y(),p=F(),n=o.control.size[e.size],b=e.variant==="outline"||e.variant==="ghost"?e.variant:"soft",t=g.input[b];q(e.name,e.required);const c=H(e.name),S=s.formFields[e.name],[r,v]=I(S??e.defaultValue??"");D(()=>{r!==(s.formFields[e.name]??"")&&y({type:P.SET_FORM_FIELD,payload:{name:e.name,value:r}})},[r]);function m(a){v(a),e.onChangeAction&&p({...e.onChangeAction,payload:{...e.onChangeAction.payload??{},[e.name]:a,...d?{messageId:d}:{}}})}const C={...o.layout.input.wrap,paddingHorizontal:n.padH,borderRadius:z(e.size,o,e.pill),backgroundColor:t.bg,borderWidth:t.borderWidth,borderColor:t.border},u=w(C,E.BOX,{controlHeightPx:n.h,hasBackground:t.bg!==void 0}),f=!!c&&!r;return T.OS==="web"?N(l,{children:[i(l,{style:[u,f?{borderColor:o.color.danger.solid}:null],children:R("input",{type:"date",value:r,min:e.min,max:e.max,disabled:e.disabled,required:e.required,placeholder:e.placeholder??"YYYY-MM-DD",onChange:a=>m(a.target.value),style:{flex:1,border:"none",outline:"none",background:"transparent",color:t.fg,fontFamily:o.font.family,fontSize:n.font,height:"100%",width:"100%",padding:0,colorScheme:h}})}),f?i(V,{style:{color:o.color.danger.solid,fontSize:12,marginTop:4,fontFamily:o.font.family},children:c}):null]}):i(l,{style:u,children:i(x,{value:r,onChangeText:m,placeholder:e.placeholder??"YYYY-MM-DD",placeholderTextColor:o.color.placeholder,editable:!e.disabled,style:[o.layout.datePicker.input,{color:t.fg,fontFamily:o.font.family,fontSize:n.font}]})})}export{X as DatePicker};
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as L}from"react/jsx-runtime";import{useEffect as x,useState as u,useCallback as E}from"react";import{Text as g,Pressable as z,View as F}from"react-native";import I from"@react-native-community/datetimepicker";import{useTheme as A}from"../theme";import{controlRadius as N}from"../theme/style";import{useActionHandler as H,useMessageId as W,useWidgetDispatch as _,useWidgetState as O}from"../state";import{REDUCER_ACTIONS as q}from"../state";import{useRegisterRequired as K,useFieldError as M}from"./Form";function Z(e){const{tokens:t,variants:h,mode:y}=A(),D=_(),l=O(),d=W(),T=H(),s=t.control.size[e.size],p=e.variant==="outline"||e.variant==="ghost"?e.variant:"soft",i=h.input[p];K(e.name,e.required);const m=M(e.name),C=l.formFields[e.name],[n,b]=u(C??e.defaultValue??""),[w,c]=u(!1);x(()=>{n!==(l.formFields[e.name]??"")&&D({type:q.SET_FORM_FIELD,payload:{name:e.name,value:n}})},[n]);function R(o){b(o),e.onChangeAction&&T({...e.onChangeAction,payload:{...e.onChangeAction.payload??{},[e.name]:o,...d?{messageId:d}:{}}})}const S=E((o,a)=>{if(a){const V=a.toISOString().split("T")[0];R(V),c(!1)}},[]),k=o=>{if(!o)return new Date;const a=new Date(o+"T00:00:00");return isNaN(a.getTime())?new Date:a},v={...t.layout.input.wrap,minHeight:s.h,paddingHorizontal:s.padH,borderRadius:N(e.size,t,e.pill),backgroundColor:i.bg,borderWidth:i.borderWidth,borderColor:i.border,justifyContent:"center"},f=!!m&&!n,P=n||e.placeholder||"Select date";return L(F,{children:[r(z,{onPress:()=>!e.disabled&&c(o=>!o),style:[v,f?{borderColor:t.color.danger.solid}:null],children:r(g,{style:{color:n?i.fg:t.color.placeholder,fontFamily:t.font.family,fontSize:s.font},children:P})}),f?r(g,{style:{color:t.color.danger.solid,fontSize:12,marginTop:4,fontFamily:t.font.family},children:m}):null,w&&r(I,{value:k(n),mode:"date",display:"inline",onChange:S,minimumDate:e.min?new Date(e.min+"T00:00:00"):void 0,maximumDate:e.max?new Date(e.max+"T00:00:00"):void 0,themeVariant:y==="dark"?"dark":"light"})]})}export{Z as DatePicker};
@@ -0,0 +1 @@
1
+ import{jsx as v}from"react/jsx-runtime";import{Children as R,Fragment as b,isValidElement as p}from"react";import{View as y}from"react-native";import{PRIMITIVE_KINDS as S,resolveStyle as N,useTheme as T}from"../theme";import{hexToRgba as V,resolveColor as D,sizeToRN as P,spacingValue as h}from"../theme/style";function x(r,e,o){const s=R.toArray(r);if(s.length<2)return r;let a=!1;const l=s.map((t,n)=>{if(n===0)return t;const i=d(s[n-1]);if(!i||i.type!==w)return t;const u=i.props,m=!!u.flush&&!(o&&o>0);if(u.flush&&!m)return t;const f=d(t);if(!f)return t;const g=f.props,c=m?e.spacingUnit*4:g.gap!==void 0?h(g.gap,e):o??e.spacingUnit*4;return typeof c!="number"||c===0?t:(a=!0,v(y,{style:{marginTop:c},children:t},`post-divider-${n}`))});return a?l:r}function d(r){if(!p(r))return null;if(r.type!==b)return r;const e=r.props.children;return Array.isArray(e)?e.length===1&&p(e[0])?e[0]:null:p(e)?e:null}function w(r){const{tokens:e,mode:o}=T(),s=D(r.color,e,o)??V(e.color.text,e.ui.hairlineAlpha)??e.color.border,a=P(r.size)??.5,l=r.spacing!==void 0?h(r.spacing,e):0,t=e.card.defaultPadPx,n=r.flush?-t:0,i={...e.layout.divider.base,backgroundColor:s,height:a,marginTop:r.flush?e.space[0]:l,marginBottom:r.flush?e.space[0]:l,marginLeft:n,marginRight:n},u=N(i,S.BOX,{});return v(y,{style:u})}export{w as Divider,x as applyPostDividerSpacing};
@@ -0,0 +1 @@
1
+ import{jsx as p,jsxs as U}from"react/jsx-runtime";import{Text as b,View as x,Pressable as z}from"react-native";import{ACTION_TYPES as r}from"../schema";import{PRIMITIVE_KINDS as T,resolveStyle as q,useTheme as M}from"../theme";import{useActionHandler as O,useFileUploadState as F,useMessageId as E}from"../state";import{Icon as w}from"./Icon";let m=null,c=null;try{m=require("expo-document-picker")}catch{m=null}try{c=require("expo-image-picker")}catch{c=null}function v(t){const{tokens:e,config:y}=M(),n=O(),i=E(),f=F(t.fileRequestId),s=f?.uploaded??t.uploaded,g=f?.fileName??t.fileName,u=f?.error??t.error,R=t.maxFileSize??y.fileUpload.maxSizeBytes,I=t.allowedFileExtensions??y.fileUpload.allowedExtensions;function S(l){if(l.size&&l.size>R)return`File too large (max ${Math.round(R/1024/1024)} MB)`;if(I.length>0&&l.name){const a=l.name.toLowerCase().split(".").pop()??"";if(!I.map(o=>o.replace(/^\./,"").toLowerCase()).includes(a))return`Unsupported extension .${a}`}return null}async function h(){try{let l=null;if(m?.getDocumentAsync){const o=await m.getDocumentAsync({type:"*/*"});!o.canceled&&o.assets&&o.assets[0]&&(l=o.assets[0])}else if(c?.launchImageLibraryAsync){const o=await c.launchImageLibraryAsync({mediaTypes:c.MediaTypeOptions?.Images,allowsMultipleSelection:!1});if(!o.canceled&&o.assets&&o.assets[0]){const d=o.assets[0];l={uri:d.uri,name:d.fileName??"photo.jpg",size:d.fileSize,mimeType:d.mimeType}}}else{n({type:r.UPLOAD_ERROR,payload:{fileRequestId:t.fileRequestId,error:"File picker unavailable \u2014 install expo-document-picker or expo-image-picker",...i?{messageId:i}:{}}});return}if(!l)return;const a=S(l);if(a){n({type:r.UPLOAD_ERROR,payload:{fileRequestId:t.fileRequestId,error:a,...i?{messageId:i}:{}}});return}n({type:r.UPLOAD_SELECT,payload:{fileRequestId:t.fileRequestId,file:l,...i?{messageId:i}:{}}})}catch(l){const a=l instanceof Error?l.message:"File selection failed";n({type:r.UPLOAD_ERROR,payload:{fileRequestId:t.fileRequestId,error:a,...i?{messageId:i}:{}}})}}function k(){n({type:r.UPLOAD_REMOVE,payload:{fileRequestId:t.fileRequestId,...i?{messageId:i}:{}}})}const P={...e.layout.fileUpload.row,backgroundColor:e.color.surfaceAlt,borderRadius:e.radius.lg,gap:e.fileUpload.rowGap,paddingVertical:e.fileUpload.padV,paddingHorizontal:e.fileUpload.padH},A=q(P,T.BOX,{hasBackground:!0});return U(z,{onPress:s?k:h,style:({pressed:l})=>[A,{opacity:l?e.ui.pressedOpacity:1}],accessibilityRole:"button",accessibilityLabel:s?`Remove ${g??"file"}`:t.label,children:[p(w,{name:u?"alert-triangle":s?"check":t.icon??"upload",size:"md",color:u?"danger":s?"success":"primary"}),U(x,{style:[e.layout.fileUpload.col,{gap:e.fileUpload.colGap}],children:[p(b,{style:{color:e.color.text,fontFamily:e.font.family,fontSize:e.fileUpload.label.fontSize,fontWeight:e.fileUpload.label.weight},numberOfLines:1,children:u??g??t.label}),!s&&!u?p(b,{style:{color:e.color.textFaint,fontFamily:e.font.family,fontSize:e.fileUpload.hint.fontSize},children:"Tap to select"}):null]}),s?p(w,{name:"x",size:"sm",color:"secondary"}):null]})}export{v as FileUploadRequest};
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as T}from"react/jsx-runtime";import{createContext as k,useCallback as C,useContext as g,useEffect as E,useMemo as W,useState as v}from"react";import{Modal as w,Platform as N,Pressable as F,Text as f,View as P}from"react-native";import{useActionHandler as V,useMessageId as z,useSelectedCategory as H,useWidgetState as j}from"../state";import{useTheme as O}from"../theme";import{validateFields as L}from"../utils/formValidationCore";import{TabIdContext as K}from"../runtime/layoutContext";import{BoxRender as _}from"./Box";const m=k(null);function D(){return g(m)?.submit}function ee(){return g(m)}function te(t,n,e,r){const i=g(m)?.registerRequired,x=g(K);E(()=>{i&&t&&i(t,!!n,x,e,r)},[i,t,n,x,e,r])}function re(t){return g(m)?.isRequired(t)??!1}function oe(t){return g(m)?.validationErrors[t]}function G({visible:t,onDismiss:n}){const{tokens:e}=O();return N.OS==="web"?t?o(P,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",justifyContent:"center",alignItems:"center",zIndex:99999},children:T(P,{style:{backgroundColor:e.color.surface,borderRadius:14,padding:24,paddingTop:20,minWidth:260,maxWidth:320,alignItems:"center"},children:[o(f,{style:{color:e.color.text,fontFamily:e.font.family,fontSize:16,fontWeight:"700",marginBottom:8,textAlign:"center"},children:"Required Fields"}),o(f,{style:{color:e.color.textMuted,fontFamily:e.font.family,fontSize:14,textAlign:"center",marginBottom:16,lineHeight:20},children:"Please fill in all required fields before submitting."}),o(F,{onPress:n,style:({pressed:r})=>({width:"calc(100% + 48px)",marginHorizontal:-24,marginBottom:-16,paddingVertical:10,borderTopWidth:1,borderTopColor:e.color.border,borderBottomLeftRadius:14,borderBottomRightRadius:14,alignItems:"center",backgroundColor:r?"rgba(255,255,255,0.04)":"transparent"}),onMouseEnter:r=>{r.currentTarget.style.backgroundColor="rgba(255,255,255,0.04)"},onMouseLeave:r=>{r.currentTarget.style.backgroundColor="transparent"},children:o(f,{style:{color:e.color.primary.solid,fontFamily:e.font.family,fontSize:15,fontWeight:"600"},children:"OK"})})]})}):null:o(w,{visible:t,transparent:!0,animationType:"fade",onRequestClose:n,children:o(F,{style:{flex:1,backgroundColor:"rgba(0,0,0,0.5)",justifyContent:"center",alignItems:"center"},onPress:n,children:T(F,{style:{backgroundColor:e.color.surface,borderRadius:14,padding:24,paddingTop:20,minWidth:260,maxWidth:320,alignItems:"center"},onPress:r=>r.stopPropagation(),children:[o(f,{style:{color:e.color.text,fontFamily:e.font.family,fontSize:16,fontWeight:"700",marginBottom:8,textAlign:"center"},children:"Required Fields"}),o(f,{style:{color:e.color.textMuted,fontFamily:e.font.family,fontSize:14,textAlign:"center",marginBottom:16,lineHeight:20},children:"Please fill in all required fields before submitting."}),o(F,{onPress:n,style:({pressed:r})=>({width:"100%",marginBottom:-16,paddingVertical:10,borderTopWidth:1,borderTopColor:e.color.border,borderBottomLeftRadius:14,borderBottomRightRadius:14,alignItems:"center",backgroundColor:r?"rgba(255,255,255,0.04)":"transparent"}),children:o(f,{style:{color:e.color.primary.solid,fontFamily:e.font.family,fontSize:15,fontWeight:"600"},children:"OK"})})]})})})}function ne(t){const n=V(),e=z(),r=j(),p=H(),[i,x]=v({}),[q,h]=v({}),[A,I]=v(!1),y=C(()=>{const u=Object.entries(i).map(([c,l])=>({name:c,value:r.formFields[c]??"",type:l.type,required:l.required,pattern:l.pattern})),b=L(u);if(!b.valid){const c={};for(const a of b.errors)c[a.name]=a.message;h(c);const l=[...new Set(Object.values(i).map(a=>a.tabId).filter(Boolean))],R=p??l[0];return R&&l.length>1&&b.errors.some(s=>{const d=i[s.name]?.tabId;return d&&d!==R})&&I(!0),!1}return h({}),!0},[i,r.formFields,p]),M=C(()=>{t.onSubmitAction&&y()&&n({...t.onSubmitAction,payload:{...t.onSubmitAction.payload??{},...r.formFields,...e?{messageId:e}:{}}})},[n,e,t.onSubmitAction,r.formFields,y]),S=C((u,b,c,l,R)=>{x(a=>{const s=a[u],d={required:b,type:l??s?.type??"text",pattern:R??s?.pattern,tabId:c??s?.tabId};return s&&s.required===d.required&&s.type===d.type&&s.pattern===d.pattern&&s.tabId===d.tabId?a:{...a,[u]:d}})},[]),B=W(()=>({submit:M,validate:y,formFields:r.formFields,registerRequired:S,isRequired:u=>!!i[u]?.required,validationErrors:q,setValidationErrors:h}),[M,y,r.formFields,S,i,q]);return T(m.Provider,{value:B,children:[o(_,{direction:t.direction,gap:t.gap,padding:t.padding,align:t.align,justify:t.justify,flex:t.flex,children:t.children},p??"_default"),o(G,{visible:A,onDismiss:()=>I(!1)})]})}export{ne as Form,m as FormContext,oe as useFieldError,ee as useFormContext,D as useFormSubmit,re as useIsRequired,te as useRegisterRequired};
@@ -0,0 +1 @@
1
+ import{jsx as o}from"react/jsx-runtime";import{Platform as c,View as y}from"react-native";let i=null,l=null;if(c.OS!=="web"){try{l=require("expo-glass-effect")}catch{l=null}try{i=require("expo-blur")}catch{i=null}}function g({tokens:e,mode:f,radius:t,style:r,children:s}){const{backgroundColor:w,...a}=r??{},n=l?.GlassView;if(n&&(l?.isLiquidGlassAvailable?.()??!1))return o(n,{glassEffectStyle:"clear",style:[{borderRadius:t,overflow:"hidden"},a],children:s});const d=i?.BlurView;if(!d)return o(y,{style:[{backgroundColor:e.glass.fallbackBg,borderRadius:t,overflow:"hidden"},r],children:s});const u=c.OS==="android",p=u?e.glass.androidTint:e.glass.nativeTint;return o(d,{intensity:e.glass.nativeIntensity??28,tint:f==="dark"?p.dark:p.light,experimentalBlurMethod:u?e.glass.androidBlurMethod:void 0,style:[{borderRadius:t,overflow:"hidden"},a],children:s})}export{g as GlassSurfaceNative};
@@ -0,0 +1 @@
1
+ import{jsx as p}from"react/jsx-runtime";import{View as u}from"react-native";import{SvgXml as I}from"react-native-svg";import{PRIMITIVE_KINDS as k,resolveStyle as x,useTheme as T}from"../theme";import{resolveColor as b,resolveTextColor as d}from"../theme/style";import{iconMap as V}from"../icons/icon-map";function v(t){return t.replace(/"/g,"&quot;")}const z="2.25";function M({name:t,size:a="md",color:m,backgroundColor:f,background:y}){const{tokens:e,mode:n}=T(),g=V[t];if(!g)return null;const r=e.icon.size[a],h=v(m?d(m,e,n):e.color.text),o=f??y,i=o?typeof o=="string"&&["primary","secondary","tertiary"].includes(o)?d(o,e,n):b(o,e,n):void 0,w=g.replace(/fill="currentColor"/g,`fill="${h}"`).replace(/stroke="currentColor"/g,`stroke="${h}"`).replace(/stroke-width="1\.5"/g,`stroke-width="${z}"`),c=p(u,{style:{width:r,height:r,flexShrink:0,alignItems:"center",justifyContent:"center"},children:p(I,{xml:w,width:r,height:r})});if(a==="button")return c;const s=!!(i&&i!==e.color.transparent);if(!s)return c;const l=r+e.icon.wrapperPad*2,C={...e.layout.icon.wrapper,width:l,height:l,borderRadius:Math.round(l*e.icon.wrapperRoundingPct),...s?{backgroundColor:i}:{}},S=x(C,k.BOX,{hasBackground:s});return p(u,{style:S,children:c})}export{M as Icon};
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import{useContext as k,useState as I}from"react";import{Image as T,Platform as c,View as h}from"react-native";import{SvgUri as L}from"react-native-svg";import{PRIMITIVE_KINDS as O,resolveStyle as A,useTheme as U}from"../theme";import{hexToRgba as G,radiusToNumber as $,sizeToRN as o,spacingToStyle as D}from"../theme/style";import{SizedParentContext as K,CardPaddingContext as _,isPercentString as q}from"../runtime/layoutContext";import{Icon as B}from"./Icon";import C from"../assets/image-placeholder.png";function J(e){if(!e)return!1;const n=e.split(/[?#]/)[0];return/\.svgz?$/i.test(n)}function Q(e){switch(e){case"cover":return"cover";case"contain":case"scale-down":return"contain";case"fill":return"stretch";case"none":return"center";default:return"cover"}}function ae(e){const{tokens:n}=U(),E=k(K),w=k(_),[R,d]=I(!1),[V,g]=I(!1),[M,p]=I(e.src);M!==e.src&&(p(e.src),d(!1),g(!1));const u=D(e.margin,"margin",n),i={...n.layout.image.base,...u},f=$(e.radius,n);f!==void 0&&(i.borderRadius=f);const F=e.width??e.size,x=e.height??e.size,S=o(F),H=q(x)&&!E,b=H?void 0:o(x);b!==void 0&&(i.height=b),e.flush?i.width="100%":S!==void 0&&(i.width=S);const m=o(e.maxHeight??e.maxSize),P=o(e.maxWidth??e.maxSize),W=o(e.minHeight??e.minSize),v=o(e.minWidth??e.minSize);m!==void 0&&(i.maxHeight=m),P!==void 0&&(i.maxWidth=P),W!==void 0&&(i.minHeight=W),v!==void 0&&(i.minWidth=v),H&&i.height===void 0&&m!==void 0&&(i.height=m),e.aspectRatio!==void 0&&(i.aspectRatio=Number(e.aspectRatio)||1),e.position&&(i.objectPosition=e.position);const t=A(i,O.IMAGE,{}),N=J(e.src)&&!R,j=c.OS!=="web"&&N;let s;if(V)s=a(h,{style:[t,n.layout.image.placeholder,{backgroundColor:n.color.surfaceAlt}],children:a(B,{name:"image-x",size:"md",color:"secondary"})});else if(R){const r=t.width??"100%",l=t.height??"100%";c.OS==="web"?s=a("img",{src:C,alt:e.alt??"",style:{display:"block",...u,width:r,height:l,maxWidth:t.maxWidth??"100%",maxHeight:t.maxHeight,objectFit:"cover",borderRadius:t.borderRadius,aspectRatio:t.aspectRatio},onError:()=>g(!0)}):s=a(T,{source:C,accessibilityLabel:e.alt,style:[t,{width:r,height:l}],resizeMode:"cover",onError:()=>g(!0)})}else if(c.OS==="web"){const r=e.flush?w:0,l={display:"block",...u,width:e.flush?`calc(100% + ${r*2}px)`:t.width??"100%",height:t.height,minWidth:t.minWidth,minHeight:t.minHeight,maxWidth:e.flush?"none":t.maxWidth??"100%",maxHeight:t.maxHeight,objectFit:e.fit??"cover",objectPosition:e.position,borderRadius:t.borderRadius,aspectRatio:t.aspectRatio,...e.flush?{marginLeft:-r,marginRight:-r,marginTop:-r,flexShrink:0}:{}};s=a("img",{src:e.src,alt:e.alt??"",style:l,onError:()=>d(!0)})}else j?s=a(h,{style:[t,{overflow:"hidden",alignItems:"center",justifyContent:"center"}],children:a(L,{uri:e.src??null,width:S??"100%",height:b??"100%",onError:()=>d(!0)})}):s=a(T,{source:{uri:e.src},accessibilityLabel:e.alt,style:t,resizeMode:Q(e.fit),onError:()=>d(!0)});const y=w,z=e.flush?{marginLeft:-y,marginRight:-y,marginTop:-y,flexShrink:0}:{};return e.frame?a(h,{style:[z,{borderWidth:1,borderColor:G(n.color.text,n.ui.hairlineAlpha)??n.color.border,padding:e.flush?0:4,borderRadius:f}],children:s}):e.flush?c.OS==="web"?s:a(h,{style:z,children:s}):s}export{ae as Image};
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as A}from"react/jsx-runtime";import{useEffect as H,useState as I}from"react";import{Platform as O,Pressable as R,TextInput as W,View as g,Text as p}from"react-native";import{PRIMITIVE_KINDS as N,resolveStyle as M,useTheme as v}from"../theme";import{controlRadius as S}from"../theme/style";import{useActionHandler as w,useMessageId as z,useWidgetDispatch as V,useWidgetState as E}from"../state";import{REDUCER_ACTIONS as F}from"../state";import{useRegisterRequired as B,useFieldError as K}from"./Form";function $(e){switch(e){case"email":return"email-address";case"number":case"card_number":case"cvc":return"number-pad";case"tel":return"phone-pad";case"url":return"url";default:return"default"}}function L(e){switch(e){case"email":return"email";case"password":return"password";case"tel":return"tel";case"card_number":return"cc-number";case"cvc":return"cc-csc";case"month_year":return"cc-exp";default:return}}function q(e){return e.replace(/\D/g,"").slice(0,19).replace(/(.{4})/g,"$1 ").trim()}function G(e){const t=e.replace(/\D/g,"").slice(0,4);return t.length<3?t:`${t.slice(0,2)}/${t.slice(2)}`}function U(e){return e.replace(/\D/g,"").slice(0,4)}function ne(e){const{tokens:t,variants:h}=v(),b=w(),y=V(),m=z(),s=E(),i=t.control.size[e.size],r=h.input[e.variant],T=e.gutterSize?t.control.size[e.gutterSize].padH:i.padH;B(e.name,e.required,e.inputType??"text",e.pattern);const c=K(e.name);if(e.inputType==="counter")return o(X,{...e});const f=s.formFields[e.name],[a,x]=I(f??e.defaultValue??""),[n,u]=I(!1),C=!!c;H(()=>{a!==(s.formFields[e.name]??"")&&y({type:F.SET_FORM_FIELD,payload:{name:e.name,value:a}})},[a]);const _={...t.layout.input.wrap,borderRadius:S(e.size,t,e.pill),backgroundColor:r.bg,borderColor:r.border,borderWidth:r.borderWidth},P=M(_,N.BOX,{controlHeightPx:i.h,hasBackground:r.bg!==void 0});function k(l){let d=l;switch(e.inputType){case"card_number":d=q(l);break;case"month_year":d=G(l);break;case"cvc":d=U(l);break}x(d),e.onChangeAction&&b({...e.onChangeAction,payload:{...e.onChangeAction.payload??{},[e.name]:d,...m?{messageId:m}:{}}})}function D(){if(e.pattern)try{const l=new RegExp(e.pattern);u(!l.test(a))}catch{}}return A(g,{children:[o(g,{style:[P,C?{borderColor:t.color.danger.solid}:null],children:o(W,{value:a,onChangeText:k,onBlur:D,placeholder:e.placeholder,placeholderTextColor:t.color.placeholder,editable:!e.disabled,autoFocus:e.autoFocus,selectTextOnFocus:!!e.autoSelect,secureTextEntry:e.inputType==="password",keyboardType:$(e.inputType),autoComplete:e.allowAutofillExtensions===!1?"off":L(e.inputType),style:[t.layout.input.field,{fontSize:i.font,color:r.fg,caretColor:r.fg,fontFamily:t.font.family,outlineStyle:"none",paddingHorizontal:T,...O.OS==="web"?{height:"100%"}:{flex:1,paddingVertical:Math.max(6,(i.h-i.font-4)/2)},borderRadius:S(e.size,t,e.pill)},n?{color:t.color.danger.solid}:null]})}),C?o(p,{style:{color:t.color.danger.solid,fontSize:12,marginTop:4,fontFamily:t.font.family},children:c}):null]})}function X(e){const{tokens:t}=v(),h=w(),b=V(),y=z(),m=E(),s=t.control.size[e.size],i=m.formFields[e.name]??e.defaultValue??"0",[r,T]=I(()=>parseInt(i,10)||0);function c(n){if(e.disabled)return;const u=Math.max(0,r+n);T(u),b({type:F.SET_FORM_FIELD,payload:{name:e.name,value:String(u)}}),e.onChangeAction&&h({...e.onChangeAction,payload:{...e.onChangeAction.payload??{},name:e.name,delta:n,value:u,...y?{messageId:y}:{}}})}const f=n=>({...t.layout.counter.btn,width:t.counter.btn,height:t.counter.btn,borderRadius:t.counter.btnRadius,opacity:n?t.ui.pressedOpacity:1}),a={color:t.color.text,fontSize:t.counter.glyph.fontSize,fontWeight:t.counter.glyph.weight,lineHeight:t.counter.glyph.lineHeight},x={height:s.h,minWidth:t.counter.valueMinWidth,paddingHorizontal:t.space[12],borderRadius:S(e.size,t,e.pill),borderColor:t.color.borderInput,borderWidth:t.ui.hairlineBorder,alignItems:"center",justifyContent:"center"};return A(g,{style:[t.layout.counter.row,{gap:t.counter.rowGap,height:s.h}],children:[o(R,{accessibilityLabel:`Decrease ${e.name}`,onPress:()=>c(-1),disabled:e.disabled,style:({pressed:n})=>f(n),children:o(p,{style:a,children:"\u2212"})}),o(g,{style:x,children:o(p,{style:[t.layout.counter.valueText,{color:t.color.text,fontSize:s.font,fontWeight:t.font.weight.normal}],children:r})}),o(R,{accessibilityLabel:`Increase ${e.name}`,onPress:()=>c(1),disabled:e.disabled,style:({pressed:n})=>f(n),children:o(p,{style:a,children:"+"})})]})}export{ne as Input};
@@ -0,0 +1 @@
1
+ import{jsx as n,jsxs as O}from"react/jsx-runtime";import{Children as C,Fragment as $,isValidElement as x,useContext as L,useState as W}from"react";import{Platform as pe,Pressable as q,ScrollView as J,Text as ve,View as p}from"react-native";import{PRIMITIVE_KINDS as Q,resolveStyle as Y,useTheme as Z}from"../theme";import{alignToFlex as Se,borderToStyle as j,hexToRgba as B,radiusToNumber as Ce,resolveColor as ee,sizeToRN as v,spacingToStyle as xe,spacingValue as I}from"../theme/style";import{useActionHandler as Ve,useSelectedCategory as Re}from"../state";import{CarouselItemRootContext as Pe,FillHeightContext as Ie,HorizontalCarouselContext as z,PageWidthContext as Te,ParentCrossAlignContext as ke,ScrollableContext as te,ScrollableListContext as M,TabIdContext as Ne}from"../runtime/layoutContext";import{Box as oe,BoxRender as ne,Col as ie,Row as re}from"./Box";import{StatusBanner as le}from"./Card";import{ThemeProvider as Ae}from"../theme";function He({count:e,active:t,tokens:o,mode:r}){if(e<=1)return null;const l=o.color.primary.solid,a=B(o.color.textMuted,.55)??o.color.border,d=B(o.color.text,r==="dark"?.1:.06)??o.color.surfaceAlt;return n(p,{style:{alignSelf:"center",marginTop:o.space[8],flexDirection:"row",alignItems:"center",gap:6,paddingVertical:18,paddingHorizontal:12,borderRadius:o.radius.pill,backgroundColor:d,borderWidth:o.ui.hairlineBorder,borderColor:B(o.color.text,r==="dark"?.12:.08)??o.color.border},children:Array.from({length:e}).map((i,c)=>n(p,{style:{width:c===t?16:6,height:6,borderRadius:3,backgroundColor:c===t?l:a}},c))})}function Ee(e){if(e.length!==1||!x(e[0]))return{items:e};let t=e[0];if(t.type===$){const o=C.toArray(t.props.children);if(o.length===1&&x(o[0]))t=o[0];else return{items:e}}return t.type===re||t.type===ie||t.type===oe||t.type===ne?{items:C.toArray(t.props.children),rowGap:t.props.gap}:{items:e}}function Ke(e){const{tokens:t,config:o,mode:r}=Z(),l=e.theme,d=Re()??e.activeId,i=!!(e.tabId&&d&&d!==e.tabId),c=e.direction==="row",m=!!e.scrollable&&c&&o.scroll.allowOrthogonalAxis,g=typeof e.limit=="number"?e.limit:void 0,S=C.toArray(e.children),u=S.length,f=g!==void 0&&u>g,[V,h]=W(g??u),[y,T]=W(0),[ae,de]=W(0),k=f?Math.min(V,u):u,R=f?S.slice(0,k):S,se=f?Math.max(0,u-k):0,D=f&&k>=u,ce=g??0,N=e.gap!==void 0?I(e.gap,t):t.listItem.gap,F=e.padding??2,ue=e.padding!==void 0?xe(e.padding,"padding",t):{paddingVertical:I(2,t)},A=e.background?ee(e.background,t,r):e.backgroundColor?ee(e.backgroundColor,t,r):void 0,H=e.borderRadius&&parseFloat(String(e.borderRadius))||void 0,he={...j(e.border,t),...ue,...A?{backgroundColor:A}:{},...e.maxWidth!==void 0?{maxWidth:v(e.maxWidth)}:{},...e.width!==void 0?{width:v(e.width)}:{},...H!==void 0?{borderRadius:H}:{},...i?{display:"none"}:{}},G=Y(he,Q.BOX,{hasBackground:A!==void 0&&H!==void 0}),X=f?n(q,{onPress:()=>{h(D?g??u:s=>s+ce)},accessibilityRole:"button",style:({pressed:s})=>[{alignSelf:"flex-start",paddingVertical:t.space[8],paddingHorizontal:t.space[16],borderRadius:t.radius.pill,borderWidth:t.ui.hairlineBorder,borderColor:t.color.border,backgroundColor:t.color.surfaceAlt,marginTop:t.space[8]},s?{opacity:t.ui.pressedOpacity}:null],children:n(ve,{style:{color:t.color.text,fontFamily:t.font.family,fontSize:t.font.size.text.sm,fontWeight:t.font.weight.medium},children:D?"Show less":`Show ${se} more`})}):null,ge=l&&l!==r;function E(s){let w=ge?n(Ae,{mode:l,children:s}):s;return e.tabId&&(w=n(Ne.Provider,{value:e.tabId,children:w})),w}if(m&&e.showScrollIndicator){const{items:s,rowGap:w}=Ee(R),_=w!==void 0?I(w,t):N,ye=typeof _=="number"?_:12,we=y>0?Math.max(y-ye,0):0,be=b=>{const P=b.nativeEvent.layoutMeasurement.width||y;if(P>0){const K=Math.round(b.nativeEvent.contentOffset.x/P);de(U=>U===K?U:K)}};return E(n(te.Provider,{value:!0,children:n(z.Provider,{value:!0,children:n(M.Provider,{value:!0,children:n(Te.Provider,{value:we,children:O(p,{children:[n(J,{horizontal:!0,pagingEnabled:!0,showsHorizontalScrollIndicator:!1,scrollEventThrottle:16,onScroll:be,onLayout:b=>T(b.nativeEvent.layout.width),contentContainerStyle:{flexDirection:"row"},children:s.map((b,P)=>n(p,{style:{width:y,alignItems:"center"},children:b},P))}),n(He,{count:s.length,active:ae,tokens:t,mode:r})]})})})})}))}if(m){const s=Le(R);return E(n(te.Provider,{value:!0,children:n(z.Provider,{value:!0,children:n(M.Provider,{value:!0,children:O(J,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:s?{minHeight:s}:void 0,contentContainerStyle:[G,{flexDirection:"row",alignItems:"center",gap:N,paddingTop:typeof F=="number"?F*t.spacingUnit:0}],children:[e.status?n(le,{status:e.status}):null,R,X]})})})}))}const fe=e.scrollable&&!c&&pe.OS==="web"?{overflow:"auto"}:{},me=O(p,{style:[G,{flexDirection:c?"row":"column",gap:N},fe],children:[e.status?n(le,{status:e.status}):null,R,X]});return E(me)}function Le(e){let t;for(const o of e){if(!x(o))continue;const r=o.props.children,l=We(r);if(!l)continue;const a=l.props.height;typeof a=="number"&&isFinite(a)&&(t=t===void 0?a:Math.max(t,a))}return t}function We(e){const t=C.toArray(e).filter(l=>l!=null);if(t.length!==1)return null;let o=t[0];if(!x(o))return null;if(o.type===$){const l=o.props.children,a=C.toArray(l).filter(d=>d!=null);if(a.length!==1||!x(a[0]))return null;o=a[0]}const r=o.type;return r===re||r===ie||r===oe||r===ne?o:null}function Ue(e){const{tokens:t}=Z(),o=Ve(),r=L(M),l=L(ke),a=L(z),d=a&&e.stretchTallest===!0,i=e,c=i.background!==void 0?i.background:i.backgroundColor!==void 0?i.backgroundColor:void 0,m=i.radius!==void 0?Ce(i.radius,t):void 0,g={alignSelf:d?"stretch":r||l!=="stretch"?void 0:"stretch",flexDirection:"row",flexShrink:0,paddingVertical:t.listItem.padV,gap:e.gap!==void 0?I(e.gap,t):t.listItem.gap,...i.width!==void 0?{width:v(i.width)}:{},...i.height!==void 0?{height:v(i.height)}:{},...i.minWidth!==void 0?{minWidth:v(i.minWidth)}:{},...i.minHeight!==void 0?{minHeight:v(i.minHeight)}:{},...i.overflow!==void 0?{overflow:i.overflow}:{},...c!==void 0?{backgroundColor:c}:{},...j(i.border,t),...m!==void 0?{borderRadius:m}:{}},S=Se(e.align);g.alignItems=S??(d?"stretch":"center");const u=Y(g,Q.BOX,{hasBackground:c!==void 0&&m!==void 0}),f=d&&e.onClickAction?[u,{flexGrow:1,minHeight:0}]:u,V=n(p,{style:f,children:e.children});let h;if(e.onClickAction){const y=d?"stretch":l!=="stretch"?void 0:"stretch";h=n(q,{onPress:()=>o(e.onClickAction),style:({pressed:T})=>[{borderRadius:t.radius.md,alignSelf:y},T?{opacity:t.ui.pressedOpacity}:null],children:V})}else h=V;return d&&(h=n(Ie.Provider,{value:!0,children:h})),a&&(h=n(Pe.Provider,{value:!0,children:h})),h}export{Ke as ListView,Ue as ListViewItem};
@@ -0,0 +1 @@
1
+ import{Fragment as n,jsx as t}from"react/jsx-runtime";import{NativeMapDisplay as i}from"./native/NativeMapDisplay";import{NativeMapInput as r}from"./native/NativeMapInput";function f(o){return o.mode==="input"?t(r,{...o}):t(i,{...o})}function g({location:o,children:e}){return t(n,{children:e})}function s(o){}export{g as UserLocationProvider,s as configureMap,f as renderMap};
@@ -0,0 +1 @@
1
+ import{Fragment as n,jsx as r}from"react/jsx-runtime";import{Placeholder as i}from"../Placeholder";let t=null;try{t=require("react-native-webview").default}catch{}function d(e){if(!t)return r(i,{label:"Map",note:"WebView not available"});const{MapWebView:o}=require("./native/MapWebView");return r(o,{props:e,WebViewComponent:t})}function l({location:e,children:o}){return r(n,{children:o})}function s(e){}export{l as UserLocationProvider,s as configureMap,d as renderMap};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{Text as e}from"react-native";import{useTheme as n}from"../../../theme";function a({label:o}){const{tokens:t}=n();return r(e,{style:{color:t.color.textMuted,fontFamily:t.font.family,fontSize:14},children:o})}export{a as CalloutContent};
@@ -0,0 +1,132 @@
1
+ import{jsx as C}from"react/jsx-runtime";import{useMemo as I,useCallback as T}from"react";import{View as R}from"react-native";import{useActionHandler as E,useMessageId as N,useWidgetDispatch as V,REDUCER_ACTIONS as z}from"../../../state";import{useTheme as W}from"../../../theme";import{getLng as c}from"../shared/getLng";import{partitionOverlays as A}from"../shared/partitionOverlays";const u="#3b82f6";function _(d){const{center:g,zoom:n,markers:s,polylines:x,circles:$,polygons:h,mode:a,showSearch:p,colors:o}=d;return`<!DOCTYPE html>
2
+ <html><head>
3
+ <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
4
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
5
+ <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
6
+ <style>
7
+ * { margin: 0; padding: 0; box-sizing: border-box; }
8
+ html, body { width: 100%; height: 100%; }
9
+ #map { width: 100%; height: 100%; }
10
+ .leaflet-popup-content-wrapper { background:${o.bg};color:${o.text};border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,0.3); }
11
+ .leaflet-popup-tip { background:${o.bg}; }
12
+ .leaflet-popup-content { margin:8px 12px;font:13px sans-serif; }
13
+ .popup-title { font-weight:700;margin-bottom:4px; }
14
+ .popup-coords { font-size:12px;color:${o.placeholder};margin-top:2px; }
15
+ .popup-directions, .popup-directions:visited, .popup-directions:active { display:block;margin-top:6px;color:${o.primary} !important;font-size:13px;text-decoration:none; }
16
+ .popup-action { margin-top:8px;width:100%;border:none;border-radius:6px;padding:6px 8px;font-size:13px;font-weight:500;background:${o.primary};color:${o.primaryText};cursor:pointer; }
17
+ .search-bar { padding:10px 12px;background:${o.bg};border-bottom:1px solid rgba(255,255,255,0.1); }
18
+ .search-bar input { width:100%;padding:0;border:none;font:14px sans-serif;background:transparent;color:${o.text};outline:none;box-sizing:border-box; }
19
+ .search-bar input::placeholder { color:${o.placeholder}; }
20
+ .search-results { background:${o.bg};border-radius:0 0 8px 8px;max-height:150px;overflow-y:auto;border:1px solid ${o.border};border-top:none;margin:0 8px; }
21
+ .search-results div { padding:8px 12px;font:13px sans-serif;color:${o.text};border-bottom:1px solid ${o.border};cursor:pointer; }
22
+ .search-results div:active { opacity:0.7; }
23
+ .sel-bar { background:${o.bg};color:${o.text};padding:8px 12px;font:13px sans-serif;border-top:1px solid ${o.border}; }
24
+ .map-container { display:flex;flex-direction:column;height:100%; }
25
+ #map { flex:1; }
26
+ </style>
27
+ </head><body>
28
+ <div class="map-container">
29
+ ${a==="input"||p?'<div class="search-bar"><input id="searchInput" type="text" placeholder="Search location..."/></div><div id="searchResults" class="search-results" style="display:none"></div>':""}
30
+ <div id="map"></div>
31
+ ${a==="input"?'<div id="sel" class="sel-bar" style="display:none"></div>':""}
32
+ </div>
33
+ <script>
34
+ var map = L.map('map',{zoomControl:true}).setView([${g[0]},${g[1]}],${n});
35
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
36
+ attribution:'\xA9 OSM',maxZoom:19
37
+ }).addTo(map);
38
+
39
+ ${s.map(e=>{const b=e.label||`${e.lat.toFixed(4)}, ${e.lng.toFixed(4)}`,y=e.label?`<div class="popup-coords">${e.lat.toFixed(4)}, ${e.lng.toFixed(4)}</div>`:"",m=`<a class="popup-directions" href="https://www.google.com/maps/dir/?api=1&destination=${e.lat},${e.lng}" target="_blank">Get Directions \u2192</a>`,i=e.actionLabel?`<button class="popup-action" data-idx="${e.idx}">${e.actionLabel.replace(/"/g,"&quot;")}</button>`:"",f=`<div><div class="popup-title">${b.replace(/"/g,"&quot;")}</div>${y}${m}${i}</div>`;return`
40
+ (function(){
41
+ var m = L.marker([${e.lat},${e.lng}]).addTo(map);
42
+ m.bindPopup(${JSON.stringify(f)});
43
+ m.getPopup().on('add',function(){
44
+ var btn=document.querySelector('.popup-action[data-idx="${e.idx}"]');
45
+ if(btn)btn.onclick=function(e){e.stopPropagation();window.ReactNativeWebView.postMessage(JSON.stringify({type:'markerClick',idx:${e.idx}}));};
46
+ });
47
+ })();
48
+ `}).join("")}
49
+
50
+ ${s.length>1?`
51
+ map.fitBounds([${s.map(e=>`[${e.lat},${e.lng}]`).join(",")}], {padding:[30,30]});
52
+ `:""}
53
+
54
+ ${x.map(e=>`
55
+ L.polyline(${JSON.stringify(e.coords)},{color:'${e.color}',weight:${e.weight}${e.dashed?",dashArray:'10 10'":""}}).addTo(map);
56
+ `).join("")}
57
+
58
+ ${$.map(e=>`
59
+ L.circle([${e.lat},${e.lng}],{radius:${e.radius},color:'${e.color}',weight:${e.weight},fillColor:'${e.fillColor}',fillOpacity:${e.fillOpacity}}).addTo(map);
60
+ `).join("")}
61
+
62
+ ${h.map(e=>`
63
+ L.polygon(${JSON.stringify(e.coords)},{color:'${e.color}',weight:${e.weight},fillColor:'${e.fillColor}',fillOpacity:${e.fillOpacity}}).addTo(map);
64
+ `).join("")}
65
+
66
+ ${a==="input"||p?`
67
+ var searchTimer = null;
68
+ var searchInput = document.getElementById('searchInput');
69
+ var searchResults = document.getElementById('searchResults');
70
+ if (searchInput) {
71
+ searchInput.addEventListener('input', function() {
72
+ clearTimeout(searchTimer);
73
+ var q = this.value.trim();
74
+ if (q.length < 3) { searchResults.style.display='none'; return; }
75
+ searchTimer = setTimeout(function() {
76
+ fetch('https://nominatim.openstreetmap.org/search?format=json&q='+encodeURIComponent(q)+'&limit=5')
77
+ .then(function(r){return r.json()})
78
+ .then(function(results) {
79
+ searchResults.innerHTML = '';
80
+ if (results.length === 0) { searchResults.style.display='none'; return; }
81
+ results.forEach(function(r) {
82
+ var div = document.createElement('div');
83
+ div.textContent = r.display_name;
84
+ div.onclick = function() {
85
+ var lat = parseFloat(r.lat), lng = parseFloat(r.lon);
86
+ map.setView([lat, lng], 15);
87
+ searchResults.style.display='none';
88
+ searchInput.value = r.display_name.split(',')[0];
89
+ window.ReactNativeWebView.postMessage(JSON.stringify({type:'locationSelected',lat:lat,lng:lng,name:r.display_name.split(',')[0],address:r.display_name}));
90
+ };
91
+ searchResults.appendChild(div);
92
+ });
93
+ searchResults.style.display='block';
94
+ }).catch(function(){});
95
+ }, 400);
96
+ });
97
+ }
98
+ `:""}
99
+
100
+ ${a==="input"?`
101
+ var selMarker = null;
102
+ var selIcon = L.divIcon({
103
+ className:'',
104
+ html:'<svg width="25" height="41" viewBox="0 0 25 41"><path d="M12.5 0C5.6 0 0 5.6 0 12.5C0 21.9 12.5 41 12.5 41S25 21.9 25 12.5C25 5.6 19.4 0 12.5 0z" fill="${o.primary}" stroke="#fff" stroke-width="1.5"/><circle cx="12.5" cy="12.5" r="5" fill="#fff"/></svg>',
105
+ iconSize:[25,41],
106
+ iconAnchor:[12,41]
107
+ });
108
+ map.on('click', function(e) {
109
+ var lat = e.latlng.lat, lng = e.latlng.lng;
110
+ if (selMarker) map.removeLayer(selMarker);
111
+ selMarker = L.marker([lat,lng],{icon:selIcon}).addTo(map);
112
+ var label = lat.toFixed(6)+', '+lng.toFixed(6);
113
+ document.getElementById('sel').style.display='block';
114
+ document.getElementById('sel').textContent='\u{1F4CD} '+label;
115
+ window.ReactNativeWebView.postMessage(JSON.stringify({type:'locationSelected',lat:lat,lng:lng,name:label}));
116
+ if (map.getZoom() >= 14) {
117
+ fetch('https://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng)
118
+ .then(function(r){return r.json()})
119
+ .then(function(d){
120
+ if(d.display_name){
121
+ var n=d.display_name.split(',')[0];
122
+ document.getElementById('sel').textContent='\u{1F4CD} '+n;
123
+ window.ReactNativeWebView.postMessage(JSON.stringify({type:'locationSelected',lat:lat,lng:lng,name:n,address:d.display_name}));
124
+ }
125
+ }).catch(function(){});
126
+ }
127
+ });
128
+ `:""}
129
+ </script>
130
+ </body></html>`}function D({props:d,WebViewComponent:g}){const{center:n,zoom:s=13,children:x=[],height:$="300px",width:h="100%",mode:a="display",name:p}=d,o=d.mode==="input"||d.allowSearch===!0,{tokens:e}=W(),b=E(),y=N(),m=V(),{markers:i,polylines:f,circles:v,polygons:k}=A(x),S=I(()=>{const w=n?[n.lat,c(n)]:i.length>0?[i[0].position.lat,c(i[0].position)]:[20,0],r=!n&&i.length===1?15:s;return _({center:w,zoom:r,markers:i.map((t,l)=>({lat:t.position.lat,lng:c(t.position),label:t.label,color:t.color,idx:l,actionLabel:t.onClickAction?.type==="reply"?t.onClickAction.payload?.text||"Select":void 0})),polylines:f.map(t=>({coords:t.path.map(l=>[l.lat,c(l)]),color:t.color||u,weight:t.weight??4,dashed:!!t.dashed})),circles:v.map(t=>({lat:t.center.lat,lng:c(t.center),radius:t.radius,color:t.color||u,fillColor:t.fillColor||t.color||u,fillOpacity:t.fillOpacity??.3,weight:t.weight??2})),polygons:k.map(t=>({coords:t.path.map(l=>[l.lat,c(l)]),color:t.color||u,fillColor:t.fillColor||t.color||u,fillOpacity:t.fillOpacity??.3,weight:t.weight??2})),mode:a,showSearch:o,colors:{bg:e.color.surface,text:e.color.text,placeholder:e.color.placeholder,border:e.color.surfaceAlt,primary:e.color.primary.solid,primaryText:e.color.primary.text}})},[n,s,i,f,v,k,a,o,e]),M=T(w=>{try{const r=JSON.parse(w.nativeEvent.data);if(r.type==="markerClick"&&i[r.idx]?.onClickAction&&b({...i[r.idx].onClickAction,payload:{...i[r.idx].onClickAction.payload,messageId:y}}),r.type==="locationSelected"&&p&&m){const t=[];r.name&&t.push(`- **Name:** ${r.name}`),r.address&&t.push(`- **Address:** ${r.address}`),t.push(`- **Latitude:** ${r.lat}`),t.push(`- **Longitude:** ${r.lng}`),m({type:z.SET_FORM_FIELD,payload:{name:p,value:`
131
+ `+t.join(`
132
+ `)}})}}catch{}},[i,b,y,p,m]),O=parseInt(String($),10)||300,L={width:h==="100%"?"100%":parseInt(String(h),10)||void 0,height:O,borderRadius:8,overflow:"hidden",borderWidth:1,borderColor:"rgba(255,255,255,0.15)"};return C(R,{style:L,children:C(g,{source:{html:S},style:{flex:1},scrollEnabled:!0,nestedScrollEnabled:!0,onMessage:M,javaScriptEnabled:!0,originWhitelist:["*"]})})}export{D as MapWebView};
@@ -0,0 +1 @@
1
+ import{jsx as r,jsxs as y}from"react/jsx-runtime";import{useState as b,useCallback as M,useRef as T}from"react";import{View as c}from"react-native";import{Map as U,Camera as Y,Marker as O,GeoJSONSource as m,Layer as s}from"@maplibre/maplibre-react-native";import{useActionHandler as K,useMessageId as j}from"../../../state";import{getLng as n}from"../shared/getLng";import{partitionOverlays as q}from"../shared/partitionOverlays";import{searchNominatim as B}from"../shared/nominatim";import{NativeSearchOverlay as Q}from"./NativeSearchOverlay";import{CalloutContent as X}from"./CalloutContent";const Z="https://tiles.openfreemap.org/styles/liberty",l="#3b82f6",x="#A142F4";function ye(w){const{center:p,zoom:R=13,children:$=[],height:L="300px",width:f="100%",allowSearch:N=!1}=w,A=K(),I=j(),u=T(null),{markers:a,polylines:v,circles:W,polygons:V}=q($),[d,E]=b(null),[F,g]=b(!1),P=M(async e=>{g(!0);try{return await B(e)}finally{g(!1)}},[]),_=M(e=>{E(e),u.current?.setCamera?.({centerCoordinate:[e.lng,e.lat],zoomLevel:15,animationDuration:500})},[]),G=parseInt(String(L),10)||300,S={width:f==="100%"?"100%":parseInt(String(f),10)||void 0,height:G,borderRadius:8,overflow:"hidden"};if(!p)return r(c,{style:[S,{backgroundColor:"#f4f4f5",alignItems:"center",justifyContent:"center"}],children:r(X,{label:"Map: No coordinates"})});const H=a.length===1?[n(a[0].position),a[0].position.lat]:[n(p),p.lat],J=a.length===1?15:R;return y(c,{style:S,children:[N&&r(Q,{onSearch:P,onSelect:_,isSearching:F}),y(U,{style:{flex:1},styleURL:Z,children:[r(Y,{ref:u,defaultSettings:{centerCoordinate:H,zoomLevel:J}}),a.map((e,t)=>r(O,{id:`marker-${t}`,coordinate:[n(e.position),e.position.lat],onPress:e.onClickAction?()=>A({...e.onClickAction,payload:{...e.onClickAction.payload,messageId:I}}):void 0,children:r(c,{style:{width:24,height:24,borderRadius:12,backgroundColor:l,borderWidth:2,borderColor:"#fff"}})},e.id??e.key??`marker-${t}`)),d&&r(O,{id:"search-marker",coordinate:[d.lng,d.lat],children:r(c,{style:{width:24,height:24,borderRadius:12,backgroundColor:x,borderWidth:2,borderColor:"#fff"}})},"search-marker"),v.map((e,t)=>{const o=e.path.map(i=>[n(i),i.lat]);return r(m,{id:`polyline-src-${t}`,shape:{type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{}},children:r(s,{id:`polyline-layer-${t}`,type:"line",style:{lineColor:e.color||l,lineWidth:e.weight??4,lineOpacity:e.opacity??1}})},e.id??e.key??`polyline-${t}`)}),W.map((e,t)=>{const o=[n(e.center),e.center.lat],i=64,C=[];for(let h=0;h<=i;h++){const k=h/i*2*Math.PI,z=e.radius/111320*Math.cos(k)/Math.cos(e.center.lat*(Math.PI/180)),D=e.radius/110540*Math.sin(k);C.push([o[0]+z,o[1]+D])}return y(m,{id:`circle-src-${t}`,shape:{type:"Feature",geometry:{type:"Polygon",coordinates:[C]},properties:{}},children:[r(s,{id:`circle-fill-${t}`,type:"fill",style:{fillColor:e.fillColor||e.color||l,fillOpacity:e.fillOpacity??.3}}),r(s,{id:`circle-stroke-${t}`,type:"line",style:{lineColor:e.color||l,lineWidth:e.weight??2}})]},e.id??e.key??`circle-${t}`)}),V.map((e,t)=>{const o=e.path.map(i=>[n(i),i.lat]);return o.length>0&&(o[0][0]!==o[o.length-1][0]||o[0][1]!==o[o.length-1][1])&&o.push(o[0]),y(m,{id:`polygon-src-${t}`,shape:{type:"Feature",geometry:{type:"Polygon",coordinates:[o]},properties:{}},children:[r(s,{id:`polygon-fill-${t}`,type:"fill",style:{fillColor:e.fillColor||e.color||l,fillOpacity:e.fillOpacity??.3}}),r(s,{id:`polygon-stroke-${t}`,type:"line",style:{lineColor:e.color||l,lineWidth:e.weight??2}})]},e.id??e.key??`polygon-${t}`)})]})]})}export{ye as NativeMapDisplay};
@@ -0,0 +1,3 @@
1
+ import{jsx as s,jsxs as R}from"react/jsx-runtime";import{useState as w,useCallback as f,useRef as E}from"react";import{View as y,Text as N}from"react-native";import{Map as F,Camera as V,Marker as $}from"@maplibre/maplibre-react-native";import{useMessageId as D,useWidgetDispatch as W,REDUCER_ACTIONS as A}from"../../../state";import{useTheme as Z}from"../../../theme";import{getLng as H}from"../shared/getLng";import{searchNominatim as G,reverseGeocodeNominatim as P}from"../shared/nominatim";import{NativeSearchOverlay as U}from"./NativeSearchOverlay";const K="https://tiles.openfreemap.org/styles/liberty",Y="#A142F4",j=14;function b(p,r,c,m){const t=[];return c&&t.push(`- **Name:** ${c}`),m&&t.push(`- **Address:** ${m}`),t.push(`- **Latitude:** ${p}`),t.push(`- **Longitude:** ${r}`),`
2
+ `+t.join(`
3
+ `)}function ie(p){const{center:r,zoom:c=13,height:m="300px",width:t="100%",name:g}=p,{tokens:h}=Z(),q=D(),u=W(),C=E(null),L=E(c),[o,S]=w(null),[O,M]=w(!1),l=f(e=>{g&&u&&u({type:A.SET_FORM_FIELD,payload:{name:g,value:e}})},[g,u]),x=f(e=>{const n=e.geometry?.coordinates;if(!n)return;const[a,i]=n,z=`${i.toFixed(6)}, ${a.toFixed(6)}`;S({name:z,lat:i,lng:a}),l(b(i,a)),L.current>=j&&P(i,a).then(d=>{d&&(S({name:d.name,lat:i,lng:a}),l(b(i,a,d.name,d.address)))}).catch(()=>{})},[l]),I=f(async e=>{M(!0);try{return await G(e)}finally{M(!1)}},[]),T=f(e=>{const n={name:e.name,lat:e.lat,lng:e.lng};S(n),l(b(e.lat,e.lng,e.name,e.description)),C.current?.setCamera?.({centerCoordinate:[e.lng,e.lat],zoomLevel:16,animationDuration:500})},[l]),_=parseInt(String(m),10)||300,v={width:t==="100%"?"100%":parseInt(String(t),10)||void 0,height:_,borderRadius:8,overflow:"hidden",borderWidth:1,borderColor:"rgba(0,0,0,0.1)"},k=r?[H(r),r.lat]:[0,20];return R(y,{style:v,children:[s(U,{onSearch:I,onSelect:T,isSearching:O,clearOnSelect:!0}),R(F,{style:{flex:1},styleURL:K,onPress:x,onRegionDidChange:e=>{const n=e?.properties;n?.zoomLevel!=null&&(L.current=n.zoomLevel)},children:[s(V,{ref:C,defaultSettings:{centerCoordinate:k,zoomLevel:r?c:2}}),o&&s($,{id:"selected-location",coordinate:[o.lng,o.lat],children:s(y,{style:{width:24,height:24,borderRadius:12,backgroundColor:Y,borderWidth:2,borderColor:"#fff"}})},`selected-${o.lat}-${o.lng}`)]}),o&&R(y,{style:{backgroundColor:h.color.surface,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderTopColor:"rgba(0,0,0,0.1)",flexDirection:"row",alignItems:"center",gap:6},children:[s(N,{style:{fontSize:14},children:"\u{1F4CD}"}),s(N,{numberOfLines:1,style:{flex:1,fontSize:13,color:h.color.text,fontFamily:h.font.family},children:o.name})]})]})}export{ie as NativeMapInput};
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as m}from"react/jsx-runtime";import{useState as u,useRef as v,useCallback as l}from"react";import{View as s,TextInput as z,Text as h,Pressable as R,FlatList as P}from"react-native";import{useTheme as V}from"../../../theme";const k=300;function W({onSearch:f,onSelect:g,isSearching:y,clearOnSelect:b}){const{tokens:t}=V(),[p,c]=u(""),[a,n]=u([]),[x,r]=u(!1),d=v(void 0),S=l(async e=>{if(e.trim().length<2){n([]),r(!1);return}const i=await f(e);n(i),r(i.length>0)},[f]),C=l(e=>{c(e),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>S(e),k)},[S]),w=l(e=>{c(b?"":e.name),n([]),r(!1),g(e)},[g,b]),T=l(()=>{c(""),n([]),r(!1)},[]),N={backgroundColor:t.color.surface,paddingHorizontal:10,paddingVertical:8,borderBottomWidth:1,borderBottomColor:"rgba(0,0,0,0.1)"};return m(s,{style:{zIndex:1e3},children:[o(s,{style:N,children:m(s,{style:{flexDirection:"row",alignItems:"center"},children:[o(z,{value:p,onChangeText:C,onFocus:()=>a.length>0&&r(!0),placeholder:"Search location...",placeholderTextColor:t.color.textMuted,style:{flex:1,height:32,paddingHorizontal:12,backgroundColor:t.color.surfaceAlt,borderRadius:6,fontSize:14,fontFamily:t.font.family,color:t.color.text,borderWidth:1,borderColor:"rgba(0,0,0,0.1)"}}),(p.length>0||y)&&o(R,{onPress:T,style:{width:28,height:28,alignItems:"center",justifyContent:"center",marginLeft:4},children:o(h,{style:{fontSize:16,color:t.color.textMuted},children:y?"...":"\xD7"})})]})}),x&&a.length>0&&o(s,{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:1001,backgroundColor:t.color.surface,borderWidth:1,borderColor:"rgba(0,0,0,0.1)",borderBottomLeftRadius:8,borderBottomRightRadius:8,maxHeight:240,elevation:4,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.1,shadowRadius:12},children:o(P,{data:a,keyExtractor:e=>e.id,keyboardShouldPersistTaps:"handled",renderItem:({item:e,index:i})=>m(R,{onPress:()=>w(e),style:({pressed:O})=>({paddingHorizontal:12,paddingVertical:8,borderBottomWidth:i<a.length-1?1:0,borderBottomColor:"rgba(0,0,0,0.06)",backgroundColor:O?"rgba(59,79,254,0.06)":"transparent"}),children:[o(h,{numberOfLines:1,style:{fontSize:13,fontWeight:"500",color:t.color.text,fontFamily:t.font.family},children:e.name}),o(h,{numberOfLines:1,style:{fontSize:11,color:t.color.textMuted,fontFamily:t.font.family,marginTop:2},children:e.description})]})})})]})}export{W as NativeSearchOverlay};
@@ -0,0 +1 @@
1
+ function e(n){return n.long??n.lng??0}export{e as getLng};
@@ -0,0 +1 @@
1
+ const s="https://nominatim.openstreetmap.org";async function d(r,o=5){const t=`${s}/search?format=json&q=${encodeURIComponent(r)}&limit=${o}&addressdetails=1`,e=await fetch(t,{headers:{"Accept-Language":"en"}});return e.ok?(await e.json()).map(n=>({id:n.place_id?.toString()??n.osm_id?.toString(),name:n.display_name?.split(",")[0]??n.name??"Unknown",description:n.display_name??"",lat:parseFloat(n.lat),lng:parseFloat(n.lon),boundingBox:n.boundingbox?[parseFloat(n.boundingbox[0]),parseFloat(n.boundingbox[1]),parseFloat(n.boundingbox[2]),parseFloat(n.boundingbox[3])]:void 0})):[]}async function u(r,o){const t=`${s}/reverse?format=json&lat=${r}&lon=${o}&zoom=18&addressdetails=1`,e=await fetch(t,{headers:{"Accept-Language":"en"}});if(!e.ok)return null;const a=await e.json();if(a.error)return null;const n=a.name||a.display_name?.split(",")[0];if(!n)return null;const i=a.display_name??void 0;return{name:n,address:i}}export{u as reverseGeocodeNominatim,d as searchNominatim};
@@ -0,0 +1 @@
1
+ function s(l){const e=[],r=[],p=[],o=[];for(const a of l)switch(a.type){case"MapMarker":e.push(a);break;case"MapPolyline":r.push(a);break;case"MapCircle":p.push(a);break;case"MapPolygon":o.push(a);break}return{markers:e,polylines:r,circles:p,polygons:o}}export{s as partitionOverlays};
File without changes
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import{createContext as r,useContext as n}from"react";const o=r(null);function c({location:t,children:e}){return i(o.Provider,{value:t,children:e})}function s(){return n(o)}export{c as UserLocationProvider,s as useLocationCoordinates};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as H}from"react/jsx-runtime";import{useState as u,useCallback as W,useRef as q}from"react";import{GoogleMap as x,useJsApiLoader as E,PolylineF as Q,CircleF as X,PolygonF as oo}from"@react-google-maps/api";import{useActionHandler as eo,useMessageId as to}from"../../../../state";import{getLng as y}from"../utils";import{getMapAdapter as G}from"../mapRenderer";import{getGoogleMapsApiKey as z,getGoogleMapsMapId as $}from"../mapConfig";import{MapShell as no}from"../components/MapShell";import{useMapInputState as ao}from"../components/MapInputShell";import{DataMarkerPopupContent as lo}from"../components/DataMarkerPopupContent";import{SearchMarkerPopupContent as io}from"../components/SearchMarkerPopupContent";import{PopupContent as ro}from"../components/PopupContent";import{GoogleInfoWindowTheme as _}from"../components/GoogleInfoWindowTheme";import{AdvancedMapMarker as b,AdvancedMarkerInfoWindow as S}from"../components/AdvancedMapMarker";import{useMapFeatures as so}from"../hooks/useMapFeatures";import{partitionOverlays as po}from"../utils/partitionOverlays";import{MARKER_COLORS as A}from"../constants";const D=["places","marker"],k="#3b82f6",co={background:A.primary.hex,borderColor:A.primary.border,glyphColor:"#fff"},L={background:A.search.hex,borderColor:A.search.border,glyphColor:"#fff"};function N(l){return l.map(t=>({lat:t.lat,lng:y(t)}))}function Oo(l){const{center:t,zoom:d}=l,{isLoaded:h,loadError:g}=E({googleMapsApiKey:z(),libraries:D});return g?e("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14},children:e("span",{style:{color:"#E02E2A"},children:"Failed to load Google Maps"})}):h?e(go,{center:t,zoom:d}):e("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e("span",{style:{color:"#6b7280",fontSize:14},children:"Loading map..."})})}function go({center:l,zoom:t}){const{selectedLocation:d,handleMapClick:h,selectNamedLocation:g}=ao(),M=G(),[n,p]=u(null),[I]=u(()=>l?{lat:l.lat,lng:y(l)}:{lat:20,lng:0}),[f]=u(()=>l?t??13:2);return H(x,{mapContainerStyle:{height:"100%",width:"100%",borderRadius:8},center:I,zoom:f,options:{mapId:$(),mapTypeControl:!1},onLoad:a=>M.onMapReady(a),onClick:a=>{const r=a;if(r.placeId&&r.latLng){r.stop();const c=r.latLng.lat(),s=r.latLng.lng();new google.maps.places.Place({id:r.placeId}).fetchFields({fields:["displayName","formattedAddress"]}).then(({place:C})=>{p({lat:c,lng:s,name:C.displayName??`${c.toFixed(4)}, ${s.toFixed(4)}`,address:C.formattedAddress??void 0})}).catch(()=>{p({lat:c,lng:s,name:`${c.toFixed(4)}, ${s.toFixed(4)}`})});return}p(null),a.latLng&&h(a.latLng.lat(),a.latLng.lng())},children:[e(_,{}),d&&e(b,{position:{lat:d.lat,lng:d.lng},pin:L}),n&&e(b,{position:{lat:n.lat,lng:n.lng},pin:L,onClick:()=>p(a=>a?{...a}:null),children:e(S,{open:!0,onClose:()=>p(null),children:e(ro,{title:n.name,subtitle:n.address,actions:[{label:"Select this location",onClick:()=>{g(n.name,n.lat,n.lng,n.address),p(null)}}]})})})]})}function Wo(l){const{center:t,zoom:d=13,children:h=[],height:g="300px",width:M="100%",allowSearch:n=!1}=l,p=eo(),I=to(),f=G(),a=q(null),[r,c]=u(null),{markers:s,polylines:v,circles:C,polygons:K}=po(h),[T]=u(()=>t?{lat:t.lat,lng:y(t)}:{lat:0,lng:0}),[j]=u(d),{isLoaded:B,loadError:R}=E({googleMapsApiKey:z(),libraries:D}),{isSearching:Y,searchMarker:m,handleSearch:Z,handleSearchSelect:J}=so({adapter:f}),U=W(o=>{f.onMapReady(o),s.length>0&&f.fitBounds(s.map(i=>({lat:i.position.lat,lng:y(i.position)})))},[f,s]),w=W(()=>c(null),[]);return e(no,{width:M,height:g,hasCenter:!!t,allowSearch:n,isSearching:Y,onSearch:Z,onSelect:J,outerRef:a,errorFallback:R?e("div",{style:{width:M,height:g,background:"rgba(224,46,42,0.06)",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,fontSize:14},children:e("span",{style:{color:"#E02E2A"},children:"Failed to load Google Maps"})}):void 0,loadingFallback:!B&&!R?e("div",{style:{width:M,height:g,background:"#f4f4f5",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8},children:e("span",{style:{color:"#6b7280",fontSize:14},children:"Loading map..."})}):void 0,children:t&&H(x,{mapContainerStyle:{height:"100%",width:"100%",borderRadius:8},center:T,zoom:j,options:{mapId:$(),clickableIcons:!1},onLoad:U,children:[e(_,{}),s.map((o,i)=>{const F=y(o.position),P=o.id??o.key??i,O=`data-${P}`,V=o.onClickAction?.type==="reply"?{buttonLabel:o.onClickAction.payload?.text||"Select",onReply:()=>p({...o.onClickAction,payload:{...o.onClickAction.payload,messageId:I}})}:void 0;return e(b,{position:{lat:o.position.lat,lng:F},onClick:()=>c(O),pin:co,children:e(S,{open:r===O,onClose:w,children:e(lo,{label:o.label,lat:o.position.lat,lng:F,replyAction:V})})},P)}),m&&m.lat!==0&&e(b,{position:{lat:m.lat,lng:m.lng},onClick:()=>c("search"),pin:L,children:e(S,{open:r==="search",onClose:w,children:e(io,{name:m.name,description:m.description})})}),v.map((o,i)=>e(Q,{path:N(o.path),options:{strokeColor:o.color||k,strokeWeight:o.weight??4,strokeOpacity:o.opacity??.8,...o.dashed&&{icons:[{icon:{path:"M 0,-1 0,1",strokeOpacity:1,scale:3},offset:"0",repeat:"15px"}],strokeOpacity:0}}},o.id??o.key??`polyline-${i}`)),C.map((o,i)=>e(X,{center:{lat:o.center.lat,lng:y(o.center)},radius:o.radius,options:{strokeColor:o.color||k,strokeWeight:o.weight??2,fillColor:o.fillColor||o.color||k,fillOpacity:o.fillOpacity??.15}},o.id??o.key??`circle-${i}`)),K.map((o,i)=>e(oo,{paths:N(o.path),options:{strokeColor:o.color||k,strokeWeight:o.weight??2,fillColor:o.fillColor||o.color||k,fillOpacity:o.fillOpacity??.2}},o.id??o.key??`polygon-${i}`))]})})}export{Wo as GoogleDisplayMode,Oo as GoogleInputSurface};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as D}from"react/jsx-runtime";import{useState as C,useEffect as G,useCallback as O}from"react";import{TileLayer as k,Marker as A,Popup as I,Polyline as V,Circle as Y,Polygon as q,useMap as J,useMapEvents as Q}from"react-leaflet";import g from"leaflet";import{useActionHandler as X,useMessageId as j}from"../../../../state";import{getLng as r}from"../utils";import"leaflet/dist/leaflet.css";import{getThunderforestApiKey as oo}from"../mapConfig";function E(){const t=oo();return{url:t?`https://{s}.tile.thunderforest.com/atlas/{z}/{x}/{y}.png?apikey=${t}`:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:t?'&copy; <a href="https://www.thunderforest.com/">Thunderforest</a>, &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors':'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}}import{getMapAdapter as P}from"../mapRenderer";import{SafeMapContainer as _}from"../components/SafeMapContainer";import{MapShell as eo}from"../components/MapShell";import{useMapInputState as to}from"../components/MapInputShell";import{DataMarkerPopupContent as no}from"../components/DataMarkerPopupContent";import{SearchMarkerPopupContent as io}from"../components/SearchMarkerPopupContent";import{LeafletPopupTheme as z}from"../components/LeafletPopupTheme";import{useMapFeatures as ao}from"../hooks/useMapFeatures";import{partitionOverlays as ro}from"../utils/partitionOverlays";import{LEAFLET_ICONS as l,MARKER_COLORS as U}from"../constants";import{reverseGeocodeNominatim as lo}from"../services/nominatim";delete g.Icon.Default.prototype._getIconUrl,g.Icon.Default.mergeOptions({iconRetinaUrl:l.defaultIcon2x,iconUrl:l.defaultIcon,shadowUrl:l.shadow});const m="#3b82f6",po=new g.Icon({iconUrl:l.colored(U.primary.name),shadowUrl:l.shadow,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]}),T=new g.Icon({iconUrl:l.colored(U.search.name),shadowUrl:l.shadow,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});function x(t){return t.map(n=>[n.lat,r(n)])}function v({onReady:t}){const n=J();return G(()=>{t(n)},[n,t]),null}function so({onPinAdded:t}){return Q({click(n){t(n.latlng.lat,n.latlng.lng)}}),null}const co=14;function Po({center:t,zoom:n}){const{selectedLocation:p,handleMapClick:h,selectNamedLocation:f}=to(),s=P(),M=O(i=>s.onMapReady(i),[]),b=O((i,c)=>{h(i,c);const y=s.getZoom();y!==void 0&&y>=co&&lo(i,c).then(d=>{d&&f(d.name,i,c,d.address)}).catch(()=>{})},[h,f,s]),w=t?[t.lat,r(t)]:[20,0];return D(_,{center:w,zoom:t?n??13:2,style:{height:"100%",width:"100%",borderRadius:8},children:[e(k,{...E(),subdomains:["a","b","c"]}),e(v,{onReady:M}),e(so,{onPinAdded:b}),e(z,{}),p&&e(A,{position:[p.lat,p.lng],icon:T})]})}function _o(t){const{center:n,zoom:p=13,children:h=[],height:f="300px",width:s="100%",allowSearch:M=!1}=t,b=X(),w=j(),S=P(),{markers:i,polylines:c,circles:y,polygons:d}=ro(h),N=O(o=>{S.onMapReady(o)},[]),[R]=C(()=>{if(!(i.length<2))return i.map(o=>[o.position.lat,r(o.position)])}),[Z]=C(()=>i.length===1?[i[0].position.lat,r(i[0].position)]:n?[n.lat,r(n)]:[0,0]),[H]=C(()=>i.length===1?15:p),{isSearching:$,searchMarker:u,handleSearch:F,handleSearchSelect:K}=ao({adapter:S});return e(eo,{width:s,height:f,hasCenter:!!n,allowSearch:M,isSearching:$,onSearch:F,onSelect:K,children:D(_,{...R?{bounds:R,boundsOptions:{padding:[50,50]}}:{center:Z,zoom:H},style:{height:"100%",width:"100%",borderRadius:8},children:[e(k,{...E(),subdomains:["a","b","c"]}),e(v,{onReady:N}),e(z,{}),i.map((o,a)=>{const L=r(o.position),W=po,B=o.onClickAction?.type==="reply"?{buttonLabel:o.onClickAction.payload?.text||"Select",onReply:()=>b({...o.onClickAction,payload:{...o.onClickAction.payload,messageId:w}})}:void 0;return e(A,{position:[o.position.lat,L],icon:W,children:e(I,{children:e(no,{label:o.label,lat:o.position.lat,lng:L,replyAction:B})})},o.id??o.key??a)}),u&&e(A,{position:[u.lat,u.lng],icon:T,children:e(I,{children:e(io,{name:u.name,description:u.description})})}),c.map((o,a)=>e(V,{positions:x(o.path),pathOptions:{color:o.color||m,weight:o.weight??4,opacity:o.opacity??.8,dashArray:o.dashed?"10, 10":void 0}},o.id??o.key??`polyline-${a}`)),y.map((o,a)=>e(Y,{center:[o.center.lat,r(o.center)],radius:o.radius,pathOptions:{color:o.color||m,weight:o.weight??2,fillColor:o.fillColor||o.color||m,fillOpacity:o.fillOpacity??.15}},o.id??o.key??`circle-${a}`)),d.map((o,a)=>e(q,{positions:x(o.path),pathOptions:{color:o.color||m,weight:o.weight??2,fillColor:o.fillColor||o.color||m,fillOpacity:o.fillOpacity??.2}},o.id??o.key??`polygon-${a}`))]})})}export{_o as OSMDisplayMode,Po as OSMInputSurface};
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{lazy as s}from"react";import{MAP_PROVIDERS as i}from"../types";import{searchGooglePlaces as p,getPlaceDetails as c}from"../services/google/googlePlaces";const u=s(()=>import("./GoogleMapsComponent").then(n=>({default:n.GoogleInputSurface}))),m=s(()=>import("./GoogleMapsComponent").then(n=>({default:n.GoogleDisplayMode})));class f{constructor(){this.type=i.GOOGLE;this.mapInstance=null;this.sessionToken=null}onMapReady(e){this.mapInstance=e}async search(e){try{return typeof google>"u"?[]:(this.sessionToken||(this.sessionToken=new google.maps.places.AutocompleteSessionToken),await p(e,this.sessionToken))}catch{return[]}}async resolveSearchResult(e){try{const o=await c(e.id);return o?(this.sessionToken=null,{...e,...o}):null}catch{return null}}getZoom(){return this.mapInstance?.getZoom()}flyTo(e,o,t){this.mapInstance&&(this.mapInstance.panTo({lat:e,lng:o}),t!==void 0&&this.mapInstance.getZoom()!==t&&setTimeout(()=>this.mapInstance?.setZoom(t),400))}fitBounds(e,o=50){if(!this.mapInstance||e.length===0)return;if(e.length===1){this.flyTo(e[0].lat,e[0].lng);return}const t=new google.maps.LatLngBounds;e.forEach(a=>t.extend({lat:a.lat,lng:a.lng})),this.mapInstance.fitBounds(t,o)}getDirectionsUrl(e,o,t){const a=o?encodeURIComponent(o):`${e.lat},${e.lng}`,l=t?`&origin=${t.lat},${t.lng}`:"";return`https://www.google.com/maps/dir/?api=1&destination=${a}${l}&travelmode=driving`}renderInputSurface(e){return r(u,{...e})}renderDisplay(e){return r(m,{...e})}}export{f as GoogleMapsAdapter};
@@ -0,0 +1 @@
1
+ import{MAP_PROVIDERS as e}from"../types";import{OpenStreetMapAdapter as r}from"./openstreetmap";import{GoogleMapsAdapter as t}from"./google";import{OpenStreetMapAdapter as A}from"./openstreetmap";import{GoogleMapsAdapter as i}from"./google";function d(p){switch(p){case e.OPENSTREETMAP:return new r;case e.GOOGLE:return new t;default:return new r}}export{i as GoogleMapsAdapter,A as OpenStreetMapAdapter,d as createMapAdapter};
@@ -0,0 +1 @@
1
+ import{jsx as s}from"react/jsx-runtime";import{lazy as o}from"react";import{MAP_PROVIDERS as i}from"../types";import{searchNominatim as p}from"../services/nominatim";const l=o(()=>import("./OpenStreetMapComponent").then(a=>({default:a.OSMInputSurface}))),m=o(()=>import("./OpenStreetMapComponent").then(a=>({default:a.OSMDisplayMode})));class h{constructor(){this.type=i.OPENSTREETMAP;this.mapInstance=null}onMapReady(t){this.mapInstance=t}async search(t){try{return await p(t)}catch{return[]}}async resolveSearchResult(t){try{return t}catch{return null}}getZoom(){return this.mapInstance?.getZoom()}flyTo(t,r,e){this.mapInstance?.flyTo([t,r],e??this.mapInstance.getZoom(),{duration:1})}fitBounds(t,r=50){if(!this.mapInstance||t.length===0)return;if(t.length===1){this.flyTo(t[0].lat,t[0].lng);return}const e=t.map(n=>[n.lat,n.lng]);this.mapInstance.fitBounds(e,{padding:[r,r]})}getDirectionsUrl(t,r,e){return`https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route=${e?`${e.lat},${e.lng}`:""};${t.lat},${t.lng}`}renderInputSurface(t){return s(l,{...t})}renderDisplay(t){return s(m,{...t})}}export{h as OpenStreetMapAdapter};
@@ -0,0 +1 @@
1
+ import{jsx as p,jsxs as h}from"react/jsx-runtime";import{createContext as b,useContext as C,useEffect as s,useRef as i,useState as m}from"react";import{createPortal as M}from"react-dom";import{useGoogleMap as R}from"@react-google-maps/api";const f=b({current:null});function P({position:o,pin:e,title:d,onClick:l,children:c}){const t=R(),n=i(null),[r,a]=m(!1),g=i(l);return g.current=l,s(()=>{if(!t)return;const k=new google.maps.marker.PinElement({background:e.background,borderColor:e.borderColor,glyphColor:e.glyphColor,scale:e.scale}),u=new google.maps.marker.AdvancedMarkerElement({map:t,position:o,content:k,title:d,gmpClickable:!0});n.current=u,a(!0);const v=u.addListener("gmp-click",()=>{g.current?.()});return()=>{v.remove(),u.map=null,n.current=null,a(!1)}},[t,e.background,e.borderColor,e.glyphColor,e.scale,d]),s(()=>{n.current&&(n.current.position=o)},[o.lat,o.lng]),p(f.Provider,{value:n,children:r&&c})}function x({open:o,onClose:e,children:d}){const l=C(f),c=i(null),t=i(e);t.current=e;const[n]=m(()=>document.createElement("div"));return s(()=>{const r=new google.maps.InfoWindow({maxWidth:320});c.current=r;const a=r.addListener("closeclick",()=>{t.current()});return()=>{a.remove(),r.close(),c.current=null}},[]),s(()=>{const r=c.current,a=l.current;r&&(o&&a?(r.setContent(n),r.open({anchor:a})):r.close())},[o,l,n]),M(h("div",{style:{position:"relative"},children:[p("button",{onClick:()=>t.current(),"aria-label":"Close",style:{position:"absolute",top:6,right:6,zIndex:1,width:20,height:20,border:"none",background:"none",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:16,lineHeight:1,opacity:.7},children:"\u2715"}),d]}),n)}export{P as AdvancedMapMarker,x as AdvancedMarkerInfoWindow};
@@ -0,0 +1 @@
1
+ import{jsx as d}from"react/jsx-runtime";import{useDirectionsUrl as p}from"../hooks/useDirectionsUrl";import{PopupContent as u}from"./PopupContent";function c({label:t,lat:o,lng:n,replyAction:e}){const i=p(o,n,t),r=e?[{label:e.buttonLabel,onClick:e.onReply}]:void 0;return d(u,{title:t||`${o.toFixed(4)}, ${n.toFixed(4)}`,subtitle:t?`${o.toFixed(4)}, ${n.toFixed(4)}`:void 0,directionsUrl:i,actions:r})}export{c as DataMarkerPopupContent};
@@ -0,0 +1,15 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{useTheme as e}from"../../../../theme";function l(){const{tokens:o}=e(),t=`
2
+ .gm-style .gm-style-iw-c {
3
+ background: ${o.color.surface};
4
+ color: ${o.color.text};
5
+ padding: 0 !important;
6
+ }
7
+ .gm-style .gm-style-iw-d {
8
+ overflow: auto !important;
9
+ padding: 0 !important;
10
+ }
11
+ .gm-style .gm-style-iw-tc::after {
12
+ background: ${o.color.surface};
13
+ }
14
+ .gm-style .gm-style-iw-chr { display: none !important; }
15
+ `;return r("style",{children:t})}export{l as GoogleInfoWindowTheme};