@onequery/cli 0.1.8 → 0.1.9-darwin-arm64

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 (138) hide show
  1. package/README.md +2 -15
  2. package/package.json +15 -22
  3. package/vendor/aarch64-apple-darwin/onequery/onequery +0 -0
  4. package/{runtime/web/assets/DialogTitle-C7PXSwnD.js → vendor/aarch64-apple-darwin/runtime/web/assets/DialogTitle-DTJOl3oJ.js} +1 -1
  5. package/{runtime/web/assets/_authenticated-C7eiQrV5.js → vendor/aarch64-apple-darwin/runtime/web/assets/_authenticated-zME7-RcX.js} +1 -1
  6. package/{runtime/web/assets/_org_slug-DT6zshaD.js → vendor/aarch64-apple-darwin/runtime/web/assets/_org_slug-f0BSTvX3.js} +1 -1
  7. package/{runtime/web/assets/audit-CSF_7w58.js → vendor/aarch64-apple-darwin/runtime/web/assets/audit-rBNVPM_g.js} +1 -1
  8. package/{runtime/web/assets/auth-bootstrap-query-BhAn1APx.js → vendor/aarch64-apple-darwin/runtime/web/assets/auth-bootstrap-query-CCHARugg.js} +1 -1
  9. package/{runtime/web/assets/budget-dN8FWe8O.js → vendor/aarch64-apple-darwin/runtime/web/assets/budget-BHtM7puh.js} +1 -1
  10. package/{runtime/web/assets/callback-eWb0yPe8.js → vendor/aarch64-apple-darwin/runtime/web/assets/callback-sH9W4lM3.js} +1 -1
  11. package/{runtime/web/assets/connect-database-DVVQZbr3.js → vendor/aarch64-apple-darwin/runtime/web/assets/connect-database-CKVqo8hp.js} +1 -1
  12. package/vendor/aarch64-apple-darwin/runtime/web/assets/create-org-BOdESlwa.js +1 -0
  13. package/vendor/aarch64-apple-darwin/runtime/web/assets/data-source-connection-form-Cl2Nfr_6.js +173 -0
  14. package/{runtime/web/assets/device-EXs4sIzB.js → vendor/aarch64-apple-darwin/runtime/web/assets/device-DWePU4g7.js} +1 -1
  15. package/{runtime/web/assets/dropdown-menu-DhqM2Avc.js → vendor/aarch64-apple-darwin/runtime/web/assets/dropdown-menu-Bu_d15-f.js} +1 -1
  16. package/{runtime/web/assets/home-CAuh5Wfd.js → vendor/aarch64-apple-darwin/runtime/web/assets/home-zbIbP7lZ.js} +1 -1
  17. package/vendor/aarch64-apple-darwin/runtime/web/assets/index-N87voRaJ.js +10 -0
  18. package/{runtime/web/assets/integrations-DlDL0Jcf.js → vendor/aarch64-apple-darwin/runtime/web/assets/integrations-CrH5Zwrx.js} +1 -1
  19. package/{runtime/web/assets/invite._invitationId-cHFSskYH.js → vendor/aarch64-apple-darwin/runtime/web/assets/invite._invitationId-BNVlt_r5.js} +1 -1
  20. package/vendor/aarch64-apple-darwin/runtime/web/assets/organization-query-keys-Nzs4DYGL.js +1 -0
  21. package/{runtime/web/assets/routes-dmjAKWFd.js → vendor/aarch64-apple-darwin/runtime/web/assets/routes-L_FQFmb8.js} +1 -1
  22. package/{runtime/web/assets/schemas-BdEYnr23.js → vendor/aarch64-apple-darwin/runtime/web/assets/schemas-B9l2tHsR.js} +1 -1
  23. package/vendor/aarch64-apple-darwin/runtime/web/assets/signin-BQk9Tep_.js +1 -0
  24. package/vendor/aarch64-apple-darwin/runtime/web/assets/team-BZihiu0p.js +1 -0
  25. package/{runtime/web/assets/theme-toggle-BFpWdKle.js → vendor/aarch64-apple-darwin/runtime/web/assets/theme-toggle-Dbkaf9rd.js} +1 -1
  26. package/{runtime/web/assets/use-optimistic-mutation-CAKmieqi.js → vendor/aarch64-apple-darwin/runtime/web/assets/use-optimistic-mutation-uprQGmuH.js} +1 -1
  27. package/{runtime/web/assets/useBaseQuery-C2vAU945.js → vendor/aarch64-apple-darwin/runtime/web/assets/useBaseQuery-Db103_yu.js} +1 -1
  28. package/vendor/aarch64-apple-darwin/runtime/web/assets/useQuery-Bt98u4eJ.js +1 -0
  29. package/vendor/aarch64-apple-darwin/runtime/web/assets/useSuspenseQuery-CiRy35gQ.js +1 -0
  30. package/{runtime/web/assets/zod-D2loGbpH.js → vendor/aarch64-apple-darwin/runtime/web/assets/zod-D1Kv9xc5.js} +1 -1
  31. package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/index.html +3 -3
  32. package/vendor/aarch64-apple-darwin/server/onequery-server +0 -0
  33. package/bin/onequery.js +0 -215
  34. package/bin/package-constants.d.ts +0 -81
  35. package/bin/package-constants.js +0 -222
  36. package/runtime/web/assets/create-org-E2jCJQ7c.js +0 -1
  37. package/runtime/web/assets/data-source-connection-form-OTZ5EOdh.js +0 -173
  38. package/runtime/web/assets/index-pgFcI0zh.js +0 -10
  39. package/runtime/web/assets/organization-query-keys-uOvv8Ob1.js +0 -1
  40. package/runtime/web/assets/signin-nept9z5Z.js +0 -1
  41. package/runtime/web/assets/team-CVJIax_Z.js +0 -1
  42. package/runtime/web/assets/useQuery-B0_ATM04.js +0 -1
  43. package/runtime/web/assets/useSuspenseQuery-5enBOgd7.js +0 -1
  44. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/migrations/20260327065242_curious_nightmare.sql +0 -0
  45. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/migrations/meta/20260327065242_snapshot.json +0 -0
  46. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/migrations/meta/_journal.json +0 -0
  47. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/pglite/initdb.wasm +0 -0
  48. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/pglite/pglite.data +0 -0
  49. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/pglite/pglite.wasm +0 -0
  50. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/CompositeItem-BV7KhPQk.js +0 -0
  51. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/CompositeList-CX7HHxYw.js +0 -0
  52. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  53. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconCheck-Gc24xPT2.js +0 -0
  54. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  55. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  56. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconHistory-BqAd-xl2.js +0 -0
  57. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  58. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconPlus-C3-kRhGX.js +0 -0
  59. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/IconX-BQkA009b.js +0 -0
  60. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/Separator-vw4jPN_6.js +0 -0
  61. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/api-base-url-DIb6qukm.js +0 -0
  62. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/api-client-w1GRwBWy.js +0 -0
  63. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/api-error-KjK7uFAE.js +0 -0
  64. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/api-paths-ClEWWGwS.js +0 -0
  65. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/app-routes-DdRvA1bK.js +0 -0
  66. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/auth-client-BlMeXgb4.js +0 -0
  67. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/avatar-DzUYMSvr.js +0 -0
  68. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/badge-DHOXVqXh.js +0 -0
  69. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/card-Bsy6azfK.js +0 -0
  70. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/checkbox-L6MjK5Df.js +0 -0
  71. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  72. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  73. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/empty-COnWCwda.js +0 -0
  74. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/getDisabledMountTransitionStyles-BYKRz4ha.js +0 -0
  75. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/getPseudoElementBounds-InhM-dWf.js +0 -0
  76. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/index-FAyK3-UK.css +0 -0
  77. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/input-DZ9QHu2b.js +0 -0
  78. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  79. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  80. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  81. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  82. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  83. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  84. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  85. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  86. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/label-CWOhoN_L.js +0 -0
  87. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/link-Cgvqhh5w.js +0 -0
  88. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/matchContext-CDajBC0L.js +0 -0
  89. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  90. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/query-timing-LGzitMXx.js +0 -0
  91. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/queryOptions-BHw87wTZ.js +0 -0
  92. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/removable-BfDesq3B.js +0 -0
  93. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/select-CxmfKkmB.js +0 -0
  94. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/separator-BQc-hryc.js +0 -0
  95. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/settings-5_Ep5M2N.js +0 -0
  96. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/src-DCIPwIx0.js +0 -0
  97. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/table-DCvfJyLS.js +0 -0
  98. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/textarea-DiU04l_U.js +0 -0
  99. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  100. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useCompositeItem-DkdkBgiU.js +0 -0
  101. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useControlled-C1S7R-1A.js +0 -0
  102. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useRender-DFMo54_d.js +0 -0
  103. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useRouterState-DpT8luFk.js +0 -0
  104. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/useValueChanged-CqxkrqWn.js +0 -0
  105. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/utils-C8DGLIgm.js +0 -0
  106. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/assets/xstate-react.esm-BlF76DuP.js +0 -0
  107. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/amplitude/step1_settings_sidebar.png +0 -0
  108. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/amplitude/step2_projects.png +0 -0
  109. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/amplitude/step3_project_keys.png +0 -0
  110. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/amplitude/step4_api_keys.png +0 -0
  111. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/bigquery/step1_service_accounts.png +0 -0
  112. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/bigquery/step2_bigquery_roles.png +0 -0
  113. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/bigquery/step3_add_key_menu.png +0 -0
  114. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/bigquery/step4_create_json_key.png +0 -0
  115. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/ga4/step1_service_accounts.png +0 -0
  116. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/ga4/step2_create_json_key.png +0 -0
  117. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/ga4/step3_add_user_viewer.png +0 -0
  118. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/ga4/step4_property_details.png +0 -0
  119. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/github-token-guide/step1_signin.png +0 -0
  120. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  121. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  122. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  123. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/mixpanel/step1_service_accounts.png +0 -0
  124. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/mixpanel/step2_create_service_account.png +0 -0
  125. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/mixpanel/step3_credentials.png +0 -0
  126. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/mixpanel/step4_project_settings.png +0 -0
  127. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/postgresql/step1_create_user.png +0 -0
  128. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/postgresql/step2_connection.png +0 -0
  129. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/rds/step1_connect.png +0 -0
  130. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/rds/step2_create_user.png +0 -0
  131. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/rds/step3_grant.png +0 -0
  132. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/rds/step4_info.png +0 -0
  133. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/sentry/step1_personal_tokens.png +0 -0
  134. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/sentry/step2_create_token_permissions.png +0 -0
  135. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/sentry/step3_organization_slug.png +0 -0
  136. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/images/sentry/step4_project_slug.png +0 -0
  137. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/linear.svg +0 -0
  138. /package/{runtime → vendor/aarch64-apple-darwin/runtime}/web/onequery.svg +0 -0
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{H as _,W as v}from"./index-pgFcI0zh.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,...v(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:_}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&_===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(_=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),_=`error`);let b=d.fetchStatus===`fetching`,S=_===`pending`,T=_===`error`,E=S&&b,D=p!==void 0,O={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=_(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{H as _,W as v}from"./index-N87voRaJ.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,...v(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:_}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&_===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(_=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),_=`error`);let b=d.fetchStatus===`fetching`,S=_===`pending`,T=_===`error`,E=S&&b,D=p!==void 0,O={status:_,fetchStatus:d.fetchStatus,isPending:S,isSuccess:_===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=_(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./useBaseQuery-Db103_yu.js";function n(n,r){return t(n,e,r)}export{n as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./useBaseQuery-Db103_yu.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};
@@ -1 +1 @@
1
- import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{_ as n,g as r,h as i}from"./schemas-BdEYnr23.js";var a=e(t(),1),o=e=>e.type===`checkbox`,s=e=>e instanceof Date,c=e=>e==null,l=e=>typeof e==`object`,u=e=>!c(e)&&!Array.isArray(e)&&l(e)&&!s(e),d=e=>u(e)&&e.target?o(e.target)?e.target.checked:e.target.value:e,f=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,p=(e,t)=>e.has(f(t)),m=e=>{let t=e.constructor&&e.constructor.prototype;return u(t)&&t.hasOwnProperty(`isPrototypeOf`)},h=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function g(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(h&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(u(e)&&m(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=g(e[t]));return r}var _=e=>/^\w*$/.test(e),v=e=>e===void 0,y=e=>Array.isArray(e)?e.filter(Boolean):[],b=e=>y(e.replace(/["|']|\]/g,``).split(/\.|\[/)),x=(e,t,n)=>{if(!t||!u(e))return n;let r=(_(t)?[t]:b(t)).reduce((e,t)=>c(e)?e:e[t],e);return v(r)||r===e?v(e[t])?n:e[t]:r},S=e=>typeof e==`boolean`,C=e=>typeof e==`function`,w=(e,t,n)=>{let r=-1,i=_(t)?[t]:b(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=u(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},T={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},E={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},D={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},O=a.createContext(null);O.displayName=`HookFormControlContext`;var k=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==E.all&&(t._proxyFormState[i]=!r||E.all),n&&(n[i]=!0),e[i]}});return i},A=typeof window<`u`?a.useLayoutEffect:a.useEffect,j=e=>typeof e==`string`,ee=(e,t,n,r,i)=>j(e)?(r&&t.watch.add(e),x(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),x(n,e))):(r&&(t.watchAll=!0),n),M=e=>c(e)||!l(e);function N(e,t,n=new WeakSet){if(M(e)||M(t))return Object.is(e,t);if(s(e)&&s(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let a of r){let r=e[a];if(!i.includes(a))return!1;if(a!==`ref`){let e=t[a];if(s(r)&&s(e)||u(r)&&u(e)||Array.isArray(r)&&Array.isArray(e)?!N(r,e,n):!Object.is(r,e))return!1}}return!0}var P=a.createContext(null);P.displayName=`HookFormContext`;var F=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},I=e=>Array.isArray(e)?e:[e],te=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function ne(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&u(i)&&a){let e=ne(i,a);u(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var L=e=>u(e)&&!Object.keys(e).length,re=e=>e.type===`file`,R=e=>{if(!h)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ie=e=>e.type===`select-multiple`,ae=e=>e.type===`radio`,oe=e=>ae(e)||o(e),se=e=>R(e)&&e.isConnected;function ce(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=v(e)?r++:e[t[r++]];return e}function le(e){for(let t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}function z(e,t){let n=Array.isArray(t)?t:_(t)?[t]:b(t),r=n.length===1?e:ce(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(u(r)&&L(r)||Array.isArray(r)&&le(r))&&z(e,n.slice(0,-1)),e}var ue=e=>{for(let t in e)if(C(e[t]))return!0;return!1};function B(e){return Array.isArray(e)||u(e)&&!ue(e)}function V(e,t={}){for(let n in e){let r=e[n];B(r)?(t[n]=Array.isArray(r)?[]:{},V(r,t[n])):v(r)||(t[n]=!0)}return t}function H(e,t,n){n||=V(t);for(let r in e){let i=e[r];if(B(i))v(t)||M(n[r])?n[r]=V(i,Array.isArray(i)?[]:{}):H(i,c(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!N(i,e)}}return n}var U={value:!1,isValid:!1},de={value:!0,isValid:!0},W=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||e[0].value===``?de:{value:e[0].value,isValid:!0}:de:U}return U},fe=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>v(e)?e:t?e===``?NaN:e&&+e:n&&j(e)?new Date(e):r?r(e):e,pe={isValid:!1,value:null},G=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,pe):pe;function me(e){let t=e.ref;return re(t)?t.files:ae(t)?G(e.refs).value:ie(t)?[...t.selectedOptions].map(({value:e})=>e):o(t)?W(e.refs).value:fe(v(t.value)?e.ref.value:t.value,e)}var he=(e,t,n,r)=>{let i={};for(let n of e){let e=x(t,n);e&&w(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},K=e=>e instanceof RegExp,q=e=>v(e)?e:K(e)?e.source:u(e)?K(e.value)?e.value.source:e.value:e,ge=e=>({isOnSubmit:!e||e===E.onSubmit,isOnBlur:e===E.onBlur,isOnChange:e===E.onChange,isOnAll:e===E.all,isOnTouch:e===E.onTouched}),_e=`AsyncFunction`,ve=e=>!!e&&!!e.validate&&!!(C(e.validate)&&e.validate.constructor.name===_e||u(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===_e)),ye=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),be=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),J=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=x(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(J(a,t))break}else if(u(a)&&J(a,t))break}}};function xe(e,t,n){let r=x(e,n);if(r||_(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=x(t,r),o=x(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Se=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return L(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||E.all))},Ce=(e,t,n)=>!e||!t||e===t||I(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),we=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,Te=(e,t)=>!y(x(e,t)).length&&z(e,t),Ee=(e,t,n)=>{let r=I(x(e,n));return w(r,`root`,t[n]),w(e,n,r),e};function Y(e,t,n=`validate`){if(j(e)||Array.isArray(e)&&e.every(j)||S(e)&&!e)return{type:n,message:j(e)?e:``,ref:t}}var X=e=>u(e)&&!K(e)?e:{value:e,message:``},De=async(e,t,n,r,i,a)=>{let{ref:s,refs:l,required:d,maxLength:f,minLength:p,min:m,max:h,pattern:g,validate:_,name:y,valueAsNumber:b,mount:w}=e._f,T=x(n,y);if(!w||t.has(y))return{};let E=l?l[0]:s,O=e=>{i&&E.reportValidity&&(E.setCustomValidity(S(e)?``:e||``),E.reportValidity())},k={},A=ae(s),ee=o(s),M=A||ee,N=(b||re(s))&&v(s.value)&&v(T)||R(s)&&s.value===``||T===``||Array.isArray(T)&&!T.length,P=F.bind(null,y,r,k),I=(e,t,n,r=D.maxLength,i=D.minLength)=>{let a=e?t:n;k[y]={type:e?r:i,message:a,ref:s,...P(e?r:i,a)}};if(a?!Array.isArray(T)||!T.length:d&&(!M&&(N||c(T))||S(T)&&!T||ee&&!W(l).isValid||A&&!G(l).isValid)){let{value:e,message:t}=j(d)?{value:!!d,message:d}:X(d);if(e&&(k[y]={type:D.required,message:t,ref:E,...P(D.required,t)},!r))return O(t),k}if(!N&&(!c(m)||!c(h))){let e,t,n=X(h),i=X(m);if(!c(T)&&!isNaN(T)){let r=s.valueAsNumber||T&&+T;c(n.value)||(e=r>n.value),c(i.value)||(t=r<i.value)}else{let r=s.valueAsDate||new Date(T),a=e=>new Date(new Date().toDateString()+` `+e),o=s.type==`time`,c=s.type==`week`;j(n.value)&&T&&(e=o?a(T)>a(n.value):c?T>n.value:r>new Date(n.value)),j(i.value)&&T&&(t=o?a(T)<a(i.value):c?T<i.value:r<new Date(i.value))}if((e||t)&&(I(!!e,n.message,i.message,D.max,D.min),!r))return O(k[y].message),k}if((f||p)&&!N&&(j(T)||a&&Array.isArray(T))){let e=X(f),t=X(p),n=!c(e.value)&&T.length>+e.value,i=!c(t.value)&&T.length<+t.value;if((n||i)&&(I(n,e.message,t.message),!r))return O(k[y].message),k}if(g&&!N&&j(T)){let{value:e,message:t}=X(g);if(K(e)&&!T.match(e)&&(k[y]={type:D.pattern,message:t,ref:s,...P(D.pattern,t)},!r))return O(t),k}if(_){if(C(_)){let e=Y(await _(T,n),E);if(e&&(k[y]={...e,...P(D.validate,e.message)},!r))return O(e.message),k}else if(u(_)){let e={};for(let t in _){if(!L(e)&&!r)break;let i=Y(await _[t](T,n),E,t);i&&(e={...i,...P(t,i.message)},O(i.message),r&&(k[y]=e))}if(!L(e)&&(k[y]={ref:E,...e},!r))return k}}return O(!0),k},Oe={mode:E.onSubmit,reValidateMode:E.onChange,shouldFocusError:!0};function Z(e={}){let t={...Oe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:C(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(u(t.defaultValues)||u(t.values))&&g(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:g(i),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},f={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},m,_=0,b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},D={...b},O={...D},k={array:te(),state:te()},A=t.criteriaMode===E.all,M=e=>t=>{clearTimeout(_),_=setTimeout(e,t)},P=async e=>{if(!l.keepIsValid&&!t.disabled&&(D.isValid||O.isValid||e)){let e;t.resolver?(e=L((await U()).errors),F()):e=await W(r,!0),e!==n.isValid&&k.state.next({isValid:e})}},F=(e,r)=>{!t.disabled&&(D.isValidating||D.validatingFields||O.isValidating||O.validatingFields)&&((e||Array.from(f.mount)).forEach(e=>{e&&(r?w(n.validatingFields,e,r):z(n.validatingFields,e))}),k.state.next({validatingFields:n.validatingFields,isValidating:!L(n.validatingFields)}))},ae=(e,o=[],s,c,u=!0,d=!0)=>{if(c&&s&&!t.disabled){if(l.action=!0,d&&Array.isArray(x(r,e))){let t=s(x(r,e),c.argA,c.argB);u&&w(r,e,t)}if(d&&Array.isArray(x(n.errors,e))){let t=s(x(n.errors,e),c.argA,c.argB);u&&w(n.errors,e,t),Te(n.errors,e)}if((D.touchedFields||O.touchedFields)&&d&&Array.isArray(x(n.touchedFields,e))){let t=s(x(n.touchedFields,e),c.argA,c.argB);u&&w(n.touchedFields,e,t)}(D.dirtyFields||O.dirtyFields)&&(n.dirtyFields=H(i,a)),k.state.next({name:e,isDirty:G(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else w(a,e,o)},ce=(e,t)=>{w(n.errors,e,t),k.state.next({errors:n.errors})},le=e=>{n.errors=e,k.state.next({errors:n.errors,isValid:!1})},ue=(e,t,n,o)=>{let s=x(r,e);if(s){let r=x(a,e,v(n)?x(i,e):n);v(r)||o&&o.defaultChecked||t?w(a,e,t?r:me(s._f)):Y(e,r),l.mount&&!l.action&&P()}},B=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(D.isDirty||O.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=G(),c=l!==u.isDirty);let t=N(x(i,e),r);l=!!x(n.dirtyFields,e),t?z(n.dirtyFields,e):w(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(D.dirtyFields||O.dirtyFields)&&l!==!t}if(a){let t=x(n.touchedFields,e);t||(w(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(D.touchedFields||O.touchedFields)&&t!==a)}c&&s&&k.state.next(u)}return c?u:{}},V=(e,r,i,a)=>{let o=x(n.errors,e),s=(D.isValid||O.isValid)&&S(r)&&n.isValid!==r;if(t.delayError&&i?(m=M(()=>ce(e,i)),m(t.delayError)):(clearTimeout(_),m=null,i?w(n.errors,e,i):z(n.errors,e)),(i?!N(o,i):o)||!L(a)||s){let t={...a,...s&&S(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},k.state.next(t)}},U=async e=>(F(e,!0),await t.resolver(a,t.context,he(e||f.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),de=async e=>{let{errors:t}=await U(e);if(F(e),e)for(let r of e){let e=x(t,r);e?w(n.errors,r,e):z(n.errors,r)}else n.errors=t;return t},W=async(r,i,o={valid:!0})=>{for(let s in r){let c=r[s];if(c){let{_f:r,...s}=c;if(r){let s=f.array.has(r.name),l=c._f&&ve(c._f);l&&D.validatingFields&&F([r.name],!0);let u=await De(c,f.disabled,a,A,t.shouldUseNativeValidation&&!i,s);if(l&&D.validatingFields&&F([r.name]),u[r.name]&&(o.valid=!1,i||e.shouldUseNativeValidation))break;!i&&(x(u,r.name)?s?Ee(n.errors,u,r.name):w(n.errors,r.name,u[r.name]):z(n.errors,r.name))}!L(s)&&await W(s,i,o)}}return o.valid},pe=()=>{for(let e of f.unMount){let t=x(r,e);t&&(t._f.refs?t._f.refs.every(e=>!se(e)):!se(t._f.ref))&&Le(e)}f.unMount=new Set},G=(e,n)=>!t.disabled&&(e&&n&&w(a,e,n),!N(Ae(),i)),K=(e,t,n)=>ee(e,f,{...l.mount?a:v(t)?i:j(e)?{[e]:t}:t},n,t),_e=e=>y(x(l.mount?a:i,e,t.shouldUnregister?x(i,e,[]):[])),Y=(e,t,n={})=>{let i=x(r,e),s=t;if(i){let n=i._f;n&&(!n.disabled&&w(a,e,fe(t,n)),s=R(n.ref)&&c(t)?``:t,ie(n.ref)?[...n.ref.options].forEach(e=>e.selected=s.includes(e.value)):n.refs?o(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):n.refs.forEach(e=>e.checked=e.value===s):re(n.ref)?n.ref.value=``:(n.ref.value=s,n.ref.type||k.state.next({name:e,values:g(a)})))}(n.shouldDirty||n.shouldTouch)&&B(e,s,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&$(e)},X=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=x(r,o);(f.array.has(e)||u(a)||c&&!c._f)&&!s(a)?X(o,a,n):Y(o,a,n)}},Z=(e,t,o={})=>{let s=x(r,e),u=f.array.has(e),d=g(t);w(a,e,d),u?(k.array.next({name:e,values:g(a)}),(D.isDirty||D.dirtyFields||O.isDirty||O.dirtyFields)&&o.shouldDirty&&k.state.next({name:e,dirtyFields:H(i,a),isDirty:G(e,d)})):s&&!s._f&&!c(d)?X(e,d,o):Y(e,d,o),be(e,f)?k.state.next({...n,name:e,values:g(a)}):k.state.next({name:l.mount?e:void 0,values:g(a)})},ke=async e=>{l.mount=!0;let i=e.target,o=i.name,c=!0,u=x(r,o),p=e=>{c=Number.isNaN(e)||s(e)&&isNaN(e.getTime())||N(e,x(a,o,e))},h=ge(t.mode),_=ge(t.reValidateMode);if(u){let s,l,v=i.type?me(u._f):d(e),y=e.type===T.BLUR||e.type===T.FOCUS_OUT,b=!ye(u._f)&&!t.resolver&&!x(n.errors,o)&&!u._f.deps||we(y,x(n.touchedFields,o),n.isSubmitted,_,h),S=be(o,f,y);w(a,o,v),y?(!i||!i.readOnly)&&(u._f.onBlur&&u._f.onBlur(e),m&&m(0)):u._f.onChange&&u._f.onChange(e);let C=B(o,v,y),E=!L(C)||S;if(!y&&k.state.next({name:o,type:e.type,values:g(a)}),b)return(D.isValid||O.isValid)&&(t.mode===`onBlur`?y&&P():y||P()),E&&k.state.next({name:o,...S?{}:C});if(!y&&S&&k.state.next({...n}),t.resolver){let{errors:e}=await U([o]);if(F([o]),p(v),c){let t=xe(n.errors,r,o),i=xe(e,r,t.name||o);s=i.error,o=i.name,l=L(e)}}else F([o],!0),s=(await De(u,f.disabled,a,A,t.shouldUseNativeValidation))[o],F([o]),p(v),c&&(s?l=!1:(D.isValid||O.isValid)&&(l=await W(r,!0)));c&&(u._f.deps&&(!Array.isArray(u._f.deps)||u._f.deps.length>0)&&$(u._f.deps),V(o,l,s,C))}},Q=(e,t)=>{if(x(n.errors,t)&&e.focus)return e.focus(),1},$=async(e,i={})=>{let a,o,s=I(e);if(t.resolver){let t=await de(v(e)?e:s);a=L(t),o=e?!s.some(e=>x(t,e)):a}else e?(o=(await Promise.all(s.map(async e=>{let t=x(r,e);return await W(t&&t._f?{[e]:t}:t)}))).every(Boolean),!(!o&&!n.isValid)&&P()):o=a=await W(r);return k.state.next({...!j(e)||(D.isValid||O.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&J(r,Q,e?s:f.mount),o},Ae=(e,t)=>{let r={...l.mount?a:i};return t&&(r=ne(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),v(e)?r:j(e)?x(r,e):e.map(e=>x(r,e))},je=(e,t)=>({invalid:!!x((t||n).errors,e),isDirty:!!x((t||n).dirtyFields,e),error:x((t||n).errors,e),isValidating:!!x(n.validatingFields,e),isTouched:!!x((t||n).touchedFields,e)}),Me=e=>{e&&I(e).forEach(e=>z(n.errors,e)),k.state.next({errors:e?n.errors:{}})},Ne=(e,t,i)=>{let a=(x(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=x(n.errors,e)||{};w(n.errors,e,{...l,...t,ref:a}),k.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},Pe=(e,t)=>C(e)?k.state.subscribe({next:n=>`values`in n&&e(K(void 0,t),n)}):K(e,t,!0),Fe=e=>k.state.subscribe({next:t=>{Ce(e.name,t.name,e.exact)&&Se(t,e.formState||D,qe,e.reRenderRoot)&&e.callback({values:{...a},...n,...t,defaultValues:i})}}).unsubscribe,Ie=e=>(l.mount=!0,O={...O,...e.formState},Fe({...e,formState:{...b,...e.formState}})),Le=(e,o={})=>{for(let s of e?I(e):f.mount)f.mount.delete(s),f.array.delete(s),o.keepValue||(z(r,s),z(a,s)),!o.keepError&&z(n.errors,s),!o.keepDirty&&z(n.dirtyFields,s),!o.keepTouched&&z(n.touchedFields,s),!o.keepIsValidating&&z(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&z(i,s);k.state.next({values:g(a)}),k.state.next({...n,...o.keepDirty?{isDirty:G()}:{}}),!o.keepIsValid&&P()},Re=({disabled:e,name:t})=>{if(S(e)&&l.mount||e||f.disabled.has(t)){let n=f.disabled.has(t)!==!!e;e?f.disabled.add(t):f.disabled.delete(t),n&&l.mount&&!l.action&&P()}},ze=(e,n={})=>{let a=x(r,e),o=S(n.disabled)||S(t.disabled);return w(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),f.mount.add(e),a?Re({disabled:S(n.disabled)?n.disabled:t.disabled,name:e}):ue(e,!0,n.value),{...o?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:q(n.min),max:q(n.max),minLength:q(n.minLength),maxLength:q(n.maxLength),pattern:q(n.pattern)}:{},name:e,onChange:ke,onBlur:ke,ref:o=>{if(o){ze(e,n),a=x(r,e);let t=v(o.value)&&o.querySelectorAll&&o.querySelectorAll(`input,select,textarea`)[0]||o,s=oe(t),c=a._f.refs||[];if(s?c.find(e=>e===t):t===a._f.ref)return;w(r,e,{_f:{...a._f,...s?{refs:[...c.filter(se),t,...Array.isArray(x(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),ue(e,!1,void 0,t)}else a=x(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(p(f.array,e)&&l.action)&&f.unMount.add(e)}}},Be=()=>t.shouldFocusError&&J(r,Q,f.mount),Ve=e=>{S(e)&&(k.state.next({disabled:e}),J(r,(t,n)=>{let i=x(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},He=(e,i)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=g(a);if(k.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await U();F(),n.errors=e,c=g(t)}else await W(r);if(f.disabled.size)for(let e of f.disabled)z(c,e);if(z(n.errors,`root`),L(n.errors)){k.state.next({errors:{}});try{await e(c,o)}catch(e){s=e}}else i&&await i({...n.errors},o),Be(),setTimeout(Be);if(k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:L(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},Ue=(e,t={})=>{x(r,e)&&(v(t.defaultValue)?Z(e,g(x(i,e))):(Z(e,t.defaultValue),w(i,e,g(t.defaultValue))),t.keepTouched||z(n.touchedFields,e),t.keepDirty||(z(n.dirtyFields,e),n.isDirty=t.defaultValue?G(e,g(x(i,e))):G()),t.keepError||(z(n.errors,e),D.isValid&&P()),k.state.next({...n}))},We=(e,o={})=>{let s=e?g(e):i,c=g(s),u=L(e),d=u?i:c;if(o.keepDefaultValues||(i=s),!o.keepValues){if(o.keepDirtyValues){let e=new Set([...f.mount,...Object.keys(H(i,a))]);for(let t of Array.from(e)){let e=x(n.dirtyFields,t),r=x(a,t),i=x(d,t);e&&!v(r)?w(d,t,r):!e&&!v(i)&&Z(t,i)}}else{if(h&&v(e))for(let e of f.mount){let t=x(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(R(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(o.keepFieldsRef)for(let e of f.mount)Z(e,x(d,e));else r={}}a=t.shouldUnregister?o.keepDefaultValues?g(i):{}:g(d),k.array.next({values:{...d}}),k.state.next({values:{...d}})}f={mount:o.keepDirtyValues?f.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},l.mount=!D.isValid||!!o.keepIsValid||!!o.keepDirtyValues||!t.shouldUnregister&&!L(d),l.watch=!!t.shouldUnregister,l.keepIsValid=!!o.keepIsValid,l.action=!1,o.keepErrors||(n.errors={}),k.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:u?!1:o.keepDirty?n.isDirty:!!(o.keepDefaultValues&&!N(e,i)),isSubmitted:o.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:u?{}:o.keepDirtyValues?o.keepDefaultValues&&a?H(i,a):n.dirtyFields:o.keepDefaultValues&&e?H(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:o.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ge=(e,n)=>We(C(e)?e(a):e,{...t.resetOptions,...n}),Ke=(e,t={})=>{let n=x(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&C(e.select)&&e.select()})}},qe=e=>{n={...n,...e}},Je={control:{register:ze,unregister:Le,getFieldState:je,handleSubmit:He,setError:Ne,_subscribe:Fe,_runSchema:U,_updateIsValidating:F,_focusError:Be,_getWatch:K,_getDirty:G,_setValid:P,_setFieldArray:ae,_setDisabledField:Re,_setErrors:le,_getFieldArray:_e,_reset:We,_resetDefaultValues:()=>C(t.defaultValues)&&t.defaultValues().then(e=>{Ge(e,t.resetOptions),k.state.next({isLoading:!1})}),_removeUnmounted:pe,_disableForm:Ve,_subjects:k,_proxyFormState:D,get _fields(){return r},get _formValues(){return a},get _state(){return l},set _state(e){l=e},get _defaultValues(){return i},get _names(){return f},set _names(e){f=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:Ie,trigger:$,register:ze,handleSubmit:He,watch:Pe,setValue:Z,getValues:Ae,reset:Ge,resetField:Ue,clearErrors:Me,unregister:Le,setError:Ne,setFocus:Ke,getFieldState:je};return{...Je,formControl:Je}}function ke(e={}){let t=a.useRef(void 0),n=a.useRef(void 0),[r,i]=a.useState({isDirty:!1,isValidating:!1,isLoading:C(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:C(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!C(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=Z(e);t.current={...i,formState:r}}let o=t.current.control;return o._options=e,A(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),a.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),a.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),a.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),a.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}},[o,r.isDirty]),a.useEffect(()=>{e.values&&!N(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,i(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),a.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=a.useMemo(()=>k(r,o),[o,r]),t.current}var Q=(e,t,n)=>{if(e&&`reportValidity`in e){let r=x(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},$=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?Q(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>Q(t,n,e))}},Ae=(e,t)=>{t.shouldUseNativeValidation&&$(e,t);let n={};for(let r in e){let i=x(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(je(t.names||Object.keys(e),r)){let e=Object.assign({},x(n,r));w(e,`root`,a),w(n,r,e)}else w(n,r,a)}return n},je=(e,t)=>{let n=Me(t);return e.some(e=>Me(e).match(`^${n}\\.\\d+`))};function Me(e){return e.replace(/\]|\[/g,``)}function Ne(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function Pe(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=F(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function Fe(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=F(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function Ie(e,t,a){if(a===void 0&&(a={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(n,r,i){try{return Promise.resolve(Ne(function(){return Promise.resolve(e[a.mode===`sync`?`parse`:`parseAsync`](n,t)).then(function(e){return i.shouldUseNativeValidation&&$({},i),{errors:{},values:a.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:Ae(Pe(e.errors,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(o,s,c){try{return Promise.resolve(Ne(function(){return Promise.resolve((a.mode===`sync`?i:r)(e,o,t)).then(function(e){return c.shouldUseNativeValidation&&$({},c),{errors:{},values:a.raw?Object.assign({},o):e}})},function(e){if(function(e){return e instanceof n}(e))return{values:{},errors:Ae(Fe(e.issues,!c.shouldUseNativeValidation&&c.criteriaMode===`all`),c)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}export{ke as n,Ie as t};
1
+ import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{_ as n,v as r,y as i}from"./schemas-B9l2tHsR.js";var a=e(t(),1),o=e=>e.type===`checkbox`,s=e=>e instanceof Date,c=e=>e==null,l=e=>typeof e==`object`,u=e=>!c(e)&&!Array.isArray(e)&&l(e)&&!s(e),d=e=>u(e)&&e.target?o(e.target)?e.target.checked:e.target.value:e,f=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,p=(e,t)=>e.has(f(t)),m=e=>{let t=e.constructor&&e.constructor.prototype;return u(t)&&t.hasOwnProperty(`isPrototypeOf`)},h=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function g(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(h&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(u(e)&&m(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=g(e[t]));return r}var _=e=>/^\w*$/.test(e),v=e=>e===void 0,y=e=>Array.isArray(e)?e.filter(Boolean):[],b=e=>y(e.replace(/["|']|\]/g,``).split(/\.|\[/)),x=(e,t,n)=>{if(!t||!u(e))return n;let r=(_(t)?[t]:b(t)).reduce((e,t)=>c(e)?e:e[t],e);return v(r)||r===e?v(e[t])?n:e[t]:r},S=e=>typeof e==`boolean`,C=e=>typeof e==`function`,w=(e,t,n)=>{let r=-1,i=_(t)?[t]:b(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=u(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},T={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},E={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},D={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},O=a.createContext(null);O.displayName=`HookFormControlContext`;var k=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==E.all&&(t._proxyFormState[i]=!r||E.all),n&&(n[i]=!0),e[i]}});return i},A=typeof window<`u`?a.useLayoutEffect:a.useEffect,j=e=>typeof e==`string`,ee=(e,t,n,r,i)=>j(e)?(r&&t.watch.add(e),x(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),x(n,e))):(r&&(t.watchAll=!0),n),M=e=>c(e)||!l(e);function N(e,t,n=new WeakSet){if(M(e)||M(t))return Object.is(e,t);if(s(e)&&s(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let a of r){let r=e[a];if(!i.includes(a))return!1;if(a!==`ref`){let e=t[a];if(s(r)&&s(e)||u(r)&&u(e)||Array.isArray(r)&&Array.isArray(e)?!N(r,e,n):!Object.is(r,e))return!1}}return!0}var P=a.createContext(null);P.displayName=`HookFormContext`;var F=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},I=e=>Array.isArray(e)?e:[e],te=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function ne(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&u(i)&&a){let e=ne(i,a);u(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var L=e=>u(e)&&!Object.keys(e).length,re=e=>e.type===`file`,R=e=>{if(!h)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ie=e=>e.type===`select-multiple`,ae=e=>e.type===`radio`,oe=e=>ae(e)||o(e),se=e=>R(e)&&e.isConnected;function ce(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=v(e)?r++:e[t[r++]];return e}function le(e){for(let t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}function z(e,t){let n=Array.isArray(t)?t:_(t)?[t]:b(t),r=n.length===1?e:ce(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(u(r)&&L(r)||Array.isArray(r)&&le(r))&&z(e,n.slice(0,-1)),e}var ue=e=>{for(let t in e)if(C(e[t]))return!0;return!1};function B(e){return Array.isArray(e)||u(e)&&!ue(e)}function V(e,t={}){for(let n in e){let r=e[n];B(r)?(t[n]=Array.isArray(r)?[]:{},V(r,t[n])):v(r)||(t[n]=!0)}return t}function H(e,t,n){n||=V(t);for(let r in e){let i=e[r];if(B(i))v(t)||M(n[r])?n[r]=V(i,Array.isArray(i)?[]:{}):H(i,c(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!N(i,e)}}return n}var U={value:!1,isValid:!1},de={value:!0,isValid:!0},W=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||e[0].value===``?de:{value:e[0].value,isValid:!0}:de:U}return U},fe=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>v(e)?e:t?e===``?NaN:e&&+e:n&&j(e)?new Date(e):r?r(e):e,pe={isValid:!1,value:null},G=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,pe):pe;function me(e){let t=e.ref;return re(t)?t.files:ae(t)?G(e.refs).value:ie(t)?[...t.selectedOptions].map(({value:e})=>e):o(t)?W(e.refs).value:fe(v(t.value)?e.ref.value:t.value,e)}var he=(e,t,n,r)=>{let i={};for(let n of e){let e=x(t,n);e&&w(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},K=e=>e instanceof RegExp,q=e=>v(e)?e:K(e)?e.source:u(e)?K(e.value)?e.value.source:e.value:e,ge=e=>({isOnSubmit:!e||e===E.onSubmit,isOnBlur:e===E.onBlur,isOnChange:e===E.onChange,isOnAll:e===E.all,isOnTouch:e===E.onTouched}),_e=`AsyncFunction`,ve=e=>!!e&&!!e.validate&&!!(C(e.validate)&&e.validate.constructor.name===_e||u(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===_e)),ye=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),be=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),J=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=x(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(J(a,t))break}else if(u(a)&&J(a,t))break}}};function xe(e,t,n){let r=x(e,n);if(r||_(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=x(t,r),o=x(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Se=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return L(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||E.all))},Ce=(e,t,n)=>!e||!t||e===t||I(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),we=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,Te=(e,t)=>!y(x(e,t)).length&&z(e,t),Ee=(e,t,n)=>{let r=I(x(e,n));return w(r,`root`,t[n]),w(e,n,r),e};function Y(e,t,n=`validate`){if(j(e)||Array.isArray(e)&&e.every(j)||S(e)&&!e)return{type:n,message:j(e)?e:``,ref:t}}var X=e=>u(e)&&!K(e)?e:{value:e,message:``},De=async(e,t,n,r,i,a)=>{let{ref:s,refs:l,required:d,maxLength:f,minLength:p,min:m,max:h,pattern:g,validate:_,name:y,valueAsNumber:b,mount:w}=e._f,T=x(n,y);if(!w||t.has(y))return{};let E=l?l[0]:s,O=e=>{i&&E.reportValidity&&(E.setCustomValidity(S(e)?``:e||``),E.reportValidity())},k={},A=ae(s),ee=o(s),M=A||ee,N=(b||re(s))&&v(s.value)&&v(T)||R(s)&&s.value===``||T===``||Array.isArray(T)&&!T.length,P=F.bind(null,y,r,k),I=(e,t,n,r=D.maxLength,i=D.minLength)=>{let a=e?t:n;k[y]={type:e?r:i,message:a,ref:s,...P(e?r:i,a)}};if(a?!Array.isArray(T)||!T.length:d&&(!M&&(N||c(T))||S(T)&&!T||ee&&!W(l).isValid||A&&!G(l).isValid)){let{value:e,message:t}=j(d)?{value:!!d,message:d}:X(d);if(e&&(k[y]={type:D.required,message:t,ref:E,...P(D.required,t)},!r))return O(t),k}if(!N&&(!c(m)||!c(h))){let e,t,n=X(h),i=X(m);if(!c(T)&&!isNaN(T)){let r=s.valueAsNumber||T&&+T;c(n.value)||(e=r>n.value),c(i.value)||(t=r<i.value)}else{let r=s.valueAsDate||new Date(T),a=e=>new Date(new Date().toDateString()+` `+e),o=s.type==`time`,c=s.type==`week`;j(n.value)&&T&&(e=o?a(T)>a(n.value):c?T>n.value:r>new Date(n.value)),j(i.value)&&T&&(t=o?a(T)<a(i.value):c?T<i.value:r<new Date(i.value))}if((e||t)&&(I(!!e,n.message,i.message,D.max,D.min),!r))return O(k[y].message),k}if((f||p)&&!N&&(j(T)||a&&Array.isArray(T))){let e=X(f),t=X(p),n=!c(e.value)&&T.length>+e.value,i=!c(t.value)&&T.length<+t.value;if((n||i)&&(I(n,e.message,t.message),!r))return O(k[y].message),k}if(g&&!N&&j(T)){let{value:e,message:t}=X(g);if(K(e)&&!T.match(e)&&(k[y]={type:D.pattern,message:t,ref:s,...P(D.pattern,t)},!r))return O(t),k}if(_){if(C(_)){let e=Y(await _(T,n),E);if(e&&(k[y]={...e,...P(D.validate,e.message)},!r))return O(e.message),k}else if(u(_)){let e={};for(let t in _){if(!L(e)&&!r)break;let i=Y(await _[t](T,n),E,t);i&&(e={...i,...P(t,i.message)},O(i.message),r&&(k[y]=e))}if(!L(e)&&(k[y]={ref:E,...e},!r))return k}}return O(!0),k},Oe={mode:E.onSubmit,reValidateMode:E.onChange,shouldFocusError:!0};function Z(e={}){let t={...Oe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:C(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(u(t.defaultValues)||u(t.values))&&g(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:g(i),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},f={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},m,_=0,b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},D={...b},O={...D},k={array:te(),state:te()},A=t.criteriaMode===E.all,M=e=>t=>{clearTimeout(_),_=setTimeout(e,t)},P=async e=>{if(!l.keepIsValid&&!t.disabled&&(D.isValid||O.isValid||e)){let e;t.resolver?(e=L((await U()).errors),F()):e=await W(r,!0),e!==n.isValid&&k.state.next({isValid:e})}},F=(e,r)=>{!t.disabled&&(D.isValidating||D.validatingFields||O.isValidating||O.validatingFields)&&((e||Array.from(f.mount)).forEach(e=>{e&&(r?w(n.validatingFields,e,r):z(n.validatingFields,e))}),k.state.next({validatingFields:n.validatingFields,isValidating:!L(n.validatingFields)}))},ae=(e,o=[],s,c,u=!0,d=!0)=>{if(c&&s&&!t.disabled){if(l.action=!0,d&&Array.isArray(x(r,e))){let t=s(x(r,e),c.argA,c.argB);u&&w(r,e,t)}if(d&&Array.isArray(x(n.errors,e))){let t=s(x(n.errors,e),c.argA,c.argB);u&&w(n.errors,e,t),Te(n.errors,e)}if((D.touchedFields||O.touchedFields)&&d&&Array.isArray(x(n.touchedFields,e))){let t=s(x(n.touchedFields,e),c.argA,c.argB);u&&w(n.touchedFields,e,t)}(D.dirtyFields||O.dirtyFields)&&(n.dirtyFields=H(i,a)),k.state.next({name:e,isDirty:G(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else w(a,e,o)},ce=(e,t)=>{w(n.errors,e,t),k.state.next({errors:n.errors})},le=e=>{n.errors=e,k.state.next({errors:n.errors,isValid:!1})},ue=(e,t,n,o)=>{let s=x(r,e);if(s){let r=x(a,e,v(n)?x(i,e):n);v(r)||o&&o.defaultChecked||t?w(a,e,t?r:me(s._f)):Y(e,r),l.mount&&!l.action&&P()}},B=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(D.isDirty||O.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=G(),c=l!==u.isDirty);let t=N(x(i,e),r);l=!!x(n.dirtyFields,e),t?z(n.dirtyFields,e):w(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(D.dirtyFields||O.dirtyFields)&&l!==!t}if(a){let t=x(n.touchedFields,e);t||(w(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(D.touchedFields||O.touchedFields)&&t!==a)}c&&s&&k.state.next(u)}return c?u:{}},V=(e,r,i,a)=>{let o=x(n.errors,e),s=(D.isValid||O.isValid)&&S(r)&&n.isValid!==r;if(t.delayError&&i?(m=M(()=>ce(e,i)),m(t.delayError)):(clearTimeout(_),m=null,i?w(n.errors,e,i):z(n.errors,e)),(i?!N(o,i):o)||!L(a)||s){let t={...a,...s&&S(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},k.state.next(t)}},U=async e=>(F(e,!0),await t.resolver(a,t.context,he(e||f.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),de=async e=>{let{errors:t}=await U(e);if(F(e),e)for(let r of e){let e=x(t,r);e?w(n.errors,r,e):z(n.errors,r)}else n.errors=t;return t},W=async(r,i,o={valid:!0})=>{for(let s in r){let c=r[s];if(c){let{_f:r,...s}=c;if(r){let s=f.array.has(r.name),l=c._f&&ve(c._f);l&&D.validatingFields&&F([r.name],!0);let u=await De(c,f.disabled,a,A,t.shouldUseNativeValidation&&!i,s);if(l&&D.validatingFields&&F([r.name]),u[r.name]&&(o.valid=!1,i||e.shouldUseNativeValidation))break;!i&&(x(u,r.name)?s?Ee(n.errors,u,r.name):w(n.errors,r.name,u[r.name]):z(n.errors,r.name))}!L(s)&&await W(s,i,o)}}return o.valid},pe=()=>{for(let e of f.unMount){let t=x(r,e);t&&(t._f.refs?t._f.refs.every(e=>!se(e)):!se(t._f.ref))&&Le(e)}f.unMount=new Set},G=(e,n)=>!t.disabled&&(e&&n&&w(a,e,n),!N(Ae(),i)),K=(e,t,n)=>ee(e,f,{...l.mount?a:v(t)?i:j(e)?{[e]:t}:t},n,t),_e=e=>y(x(l.mount?a:i,e,t.shouldUnregister?x(i,e,[]):[])),Y=(e,t,n={})=>{let i=x(r,e),s=t;if(i){let n=i._f;n&&(!n.disabled&&w(a,e,fe(t,n)),s=R(n.ref)&&c(t)?``:t,ie(n.ref)?[...n.ref.options].forEach(e=>e.selected=s.includes(e.value)):n.refs?o(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):n.refs.forEach(e=>e.checked=e.value===s):re(n.ref)?n.ref.value=``:(n.ref.value=s,n.ref.type||k.state.next({name:e,values:g(a)})))}(n.shouldDirty||n.shouldTouch)&&B(e,s,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&$(e)},X=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=x(r,o);(f.array.has(e)||u(a)||c&&!c._f)&&!s(a)?X(o,a,n):Y(o,a,n)}},Z=(e,t,o={})=>{let s=x(r,e),u=f.array.has(e),d=g(t);w(a,e,d),u?(k.array.next({name:e,values:g(a)}),(D.isDirty||D.dirtyFields||O.isDirty||O.dirtyFields)&&o.shouldDirty&&k.state.next({name:e,dirtyFields:H(i,a),isDirty:G(e,d)})):s&&!s._f&&!c(d)?X(e,d,o):Y(e,d,o),be(e,f)?k.state.next({...n,name:e,values:g(a)}):k.state.next({name:l.mount?e:void 0,values:g(a)})},ke=async e=>{l.mount=!0;let i=e.target,o=i.name,c=!0,u=x(r,o),p=e=>{c=Number.isNaN(e)||s(e)&&isNaN(e.getTime())||N(e,x(a,o,e))},h=ge(t.mode),_=ge(t.reValidateMode);if(u){let s,l,v=i.type?me(u._f):d(e),y=e.type===T.BLUR||e.type===T.FOCUS_OUT,b=!ye(u._f)&&!t.resolver&&!x(n.errors,o)&&!u._f.deps||we(y,x(n.touchedFields,o),n.isSubmitted,_,h),S=be(o,f,y);w(a,o,v),y?(!i||!i.readOnly)&&(u._f.onBlur&&u._f.onBlur(e),m&&m(0)):u._f.onChange&&u._f.onChange(e);let C=B(o,v,y),E=!L(C)||S;if(!y&&k.state.next({name:o,type:e.type,values:g(a)}),b)return(D.isValid||O.isValid)&&(t.mode===`onBlur`?y&&P():y||P()),E&&k.state.next({name:o,...S?{}:C});if(!y&&S&&k.state.next({...n}),t.resolver){let{errors:e}=await U([o]);if(F([o]),p(v),c){let t=xe(n.errors,r,o),i=xe(e,r,t.name||o);s=i.error,o=i.name,l=L(e)}}else F([o],!0),s=(await De(u,f.disabled,a,A,t.shouldUseNativeValidation))[o],F([o]),p(v),c&&(s?l=!1:(D.isValid||O.isValid)&&(l=await W(r,!0)));c&&(u._f.deps&&(!Array.isArray(u._f.deps)||u._f.deps.length>0)&&$(u._f.deps),V(o,l,s,C))}},Q=(e,t)=>{if(x(n.errors,t)&&e.focus)return e.focus(),1},$=async(e,i={})=>{let a,o,s=I(e);if(t.resolver){let t=await de(v(e)?e:s);a=L(t),o=e?!s.some(e=>x(t,e)):a}else e?(o=(await Promise.all(s.map(async e=>{let t=x(r,e);return await W(t&&t._f?{[e]:t}:t)}))).every(Boolean),!(!o&&!n.isValid)&&P()):o=a=await W(r);return k.state.next({...!j(e)||(D.isValid||O.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&J(r,Q,e?s:f.mount),o},Ae=(e,t)=>{let r={...l.mount?a:i};return t&&(r=ne(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),v(e)?r:j(e)?x(r,e):e.map(e=>x(r,e))},je=(e,t)=>({invalid:!!x((t||n).errors,e),isDirty:!!x((t||n).dirtyFields,e),error:x((t||n).errors,e),isValidating:!!x(n.validatingFields,e),isTouched:!!x((t||n).touchedFields,e)}),Me=e=>{e&&I(e).forEach(e=>z(n.errors,e)),k.state.next({errors:e?n.errors:{}})},Ne=(e,t,i)=>{let a=(x(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=x(n.errors,e)||{};w(n.errors,e,{...l,...t,ref:a}),k.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},Pe=(e,t)=>C(e)?k.state.subscribe({next:n=>`values`in n&&e(K(void 0,t),n)}):K(e,t,!0),Fe=e=>k.state.subscribe({next:t=>{Ce(e.name,t.name,e.exact)&&Se(t,e.formState||D,qe,e.reRenderRoot)&&e.callback({values:{...a},...n,...t,defaultValues:i})}}).unsubscribe,Ie=e=>(l.mount=!0,O={...O,...e.formState},Fe({...e,formState:{...b,...e.formState}})),Le=(e,o={})=>{for(let s of e?I(e):f.mount)f.mount.delete(s),f.array.delete(s),o.keepValue||(z(r,s),z(a,s)),!o.keepError&&z(n.errors,s),!o.keepDirty&&z(n.dirtyFields,s),!o.keepTouched&&z(n.touchedFields,s),!o.keepIsValidating&&z(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&z(i,s);k.state.next({values:g(a)}),k.state.next({...n,...o.keepDirty?{isDirty:G()}:{}}),!o.keepIsValid&&P()},Re=({disabled:e,name:t})=>{if(S(e)&&l.mount||e||f.disabled.has(t)){let n=f.disabled.has(t)!==!!e;e?f.disabled.add(t):f.disabled.delete(t),n&&l.mount&&!l.action&&P()}},ze=(e,n={})=>{let a=x(r,e),o=S(n.disabled)||S(t.disabled);return w(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),f.mount.add(e),a?Re({disabled:S(n.disabled)?n.disabled:t.disabled,name:e}):ue(e,!0,n.value),{...o?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:q(n.min),max:q(n.max),minLength:q(n.minLength),maxLength:q(n.maxLength),pattern:q(n.pattern)}:{},name:e,onChange:ke,onBlur:ke,ref:o=>{if(o){ze(e,n),a=x(r,e);let t=v(o.value)&&o.querySelectorAll&&o.querySelectorAll(`input,select,textarea`)[0]||o,s=oe(t),c=a._f.refs||[];if(s?c.find(e=>e===t):t===a._f.ref)return;w(r,e,{_f:{...a._f,...s?{refs:[...c.filter(se),t,...Array.isArray(x(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),ue(e,!1,void 0,t)}else a=x(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(p(f.array,e)&&l.action)&&f.unMount.add(e)}}},Be=()=>t.shouldFocusError&&J(r,Q,f.mount),Ve=e=>{S(e)&&(k.state.next({disabled:e}),J(r,(t,n)=>{let i=x(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},He=(e,i)=>async o=>{let s;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let c=g(a);if(k.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await U();F(),n.errors=e,c=g(t)}else await W(r);if(f.disabled.size)for(let e of f.disabled)z(c,e);if(z(n.errors,`root`),L(n.errors)){k.state.next({errors:{}});try{await e(c,o)}catch(e){s=e}}else i&&await i({...n.errors},o),Be(),setTimeout(Be);if(k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:L(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},Ue=(e,t={})=>{x(r,e)&&(v(t.defaultValue)?Z(e,g(x(i,e))):(Z(e,t.defaultValue),w(i,e,g(t.defaultValue))),t.keepTouched||z(n.touchedFields,e),t.keepDirty||(z(n.dirtyFields,e),n.isDirty=t.defaultValue?G(e,g(x(i,e))):G()),t.keepError||(z(n.errors,e),D.isValid&&P()),k.state.next({...n}))},We=(e,o={})=>{let s=e?g(e):i,c=g(s),u=L(e),d=u?i:c;if(o.keepDefaultValues||(i=s),!o.keepValues){if(o.keepDirtyValues){let e=new Set([...f.mount,...Object.keys(H(i,a))]);for(let t of Array.from(e)){let e=x(n.dirtyFields,t),r=x(a,t),i=x(d,t);e&&!v(r)?w(d,t,r):!e&&!v(i)&&Z(t,i)}}else{if(h&&v(e))for(let e of f.mount){let t=x(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(R(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(o.keepFieldsRef)for(let e of f.mount)Z(e,x(d,e));else r={}}a=t.shouldUnregister?o.keepDefaultValues?g(i):{}:g(d),k.array.next({values:{...d}}),k.state.next({values:{...d}})}f={mount:o.keepDirtyValues?f.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},l.mount=!D.isValid||!!o.keepIsValid||!!o.keepDirtyValues||!t.shouldUnregister&&!L(d),l.watch=!!t.shouldUnregister,l.keepIsValid=!!o.keepIsValid,l.action=!1,o.keepErrors||(n.errors={}),k.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:u?!1:o.keepDirty?n.isDirty:!!(o.keepDefaultValues&&!N(e,i)),isSubmitted:o.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:u?{}:o.keepDirtyValues?o.keepDefaultValues&&a?H(i,a):n.dirtyFields:o.keepDefaultValues&&e?H(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:o.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ge=(e,n)=>We(C(e)?e(a):e,{...t.resetOptions,...n}),Ke=(e,t={})=>{let n=x(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&C(e.select)&&e.select()})}},qe=e=>{n={...n,...e}},Je={control:{register:ze,unregister:Le,getFieldState:je,handleSubmit:He,setError:Ne,_subscribe:Fe,_runSchema:U,_updateIsValidating:F,_focusError:Be,_getWatch:K,_getDirty:G,_setValid:P,_setFieldArray:ae,_setDisabledField:Re,_setErrors:le,_getFieldArray:_e,_reset:We,_resetDefaultValues:()=>C(t.defaultValues)&&t.defaultValues().then(e=>{Ge(e,t.resetOptions),k.state.next({isLoading:!1})}),_removeUnmounted:pe,_disableForm:Ve,_subjects:k,_proxyFormState:D,get _fields(){return r},get _formValues(){return a},get _state(){return l},set _state(e){l=e},get _defaultValues(){return i},get _names(){return f},set _names(e){f=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:Ie,trigger:$,register:ze,handleSubmit:He,watch:Pe,setValue:Z,getValues:Ae,reset:Ge,resetField:Ue,clearErrors:Me,unregister:Le,setError:Ne,setFocus:Ke,getFieldState:je};return{...Je,formControl:Je}}function ke(e={}){let t=a.useRef(void 0),n=a.useRef(void 0),[r,i]=a.useState({isDirty:!1,isValidating:!1,isLoading:C(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:C(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!C(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=Z(e);t.current={...i,formState:r}}let o=t.current.control;return o._options=e,A(()=>{let e=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),o._formState.isReady=!0,e},[o]),a.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),a.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),a.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),a.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),a.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==r.isDirty&&o._subjects.state.next({isDirty:e})}},[o,r.isDirty]),a.useEffect(()=>{e.values&&!N(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,i(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),a.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=a.useMemo(()=>k(r,o),[o,r]),t.current}var Q=(e,t,n)=>{if(e&&`reportValidity`in e){let r=x(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},$=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?Q(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>Q(t,n,e))}},Ae=(e,t)=>{t.shouldUseNativeValidation&&$(e,t);let n={};for(let r in e){let i=x(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(je(t.names||Object.keys(e),r)){let e=Object.assign({},x(n,r));w(e,`root`,a),w(n,r,e)}else w(n,r,a)}return n},je=(e,t)=>{let n=Me(t);return e.some(e=>Me(e).match(`^${n}\\.\\d+`))};function Me(e){return e.replace(/\]|\[/g,``)}function Ne(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function Pe(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=F(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function Fe(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=F(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function Ie(e,t,a){if(a===void 0&&(a={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(n,r,i){try{return Promise.resolve(Ne(function(){return Promise.resolve(e[a.mode===`sync`?`parse`:`parseAsync`](n,t)).then(function(e){return i.shouldUseNativeValidation&&$({},i),{errors:{},values:a.raw?Object.assign({},n):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:Ae(Pe(e.errors,!i.shouldUseNativeValidation&&i.criteriaMode===`all`),i)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(o,s,c){try{return Promise.resolve(Ne(function(){return Promise.resolve((a.mode===`sync`?n:r)(e,o,t)).then(function(e){return c.shouldUseNativeValidation&&$({},c),{errors:{},values:a.raw?Object.assign({},o):e}})},function(e){if(function(e){return e instanceof i}(e))return{values:{},errors:Ae(Fe(e.issues,!c.shouldUseNativeValidation&&c.criteriaMode===`all`),c)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}export{ke as n,Ie as t};
@@ -17,7 +17,7 @@
17
17
  }
18
18
  })();
19
19
  </script>
20
- <script type="module" crossorigin src="/assets/index-pgFcI0zh.js"></script>
20
+ <script type="module" crossorigin src="/assets/index-N87voRaJ.js"></script>
21
21
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-DG_AJzB_.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/useRouterState-DpT8luFk.js">
23
23
  <link rel="modulepreload" crossorigin href="/assets/link-Cgvqhh5w.js">
@@ -29,8 +29,8 @@
29
29
  <link rel="modulepreload" crossorigin href="/assets/query-timing-LGzitMXx.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/src-DCIPwIx0.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/api-error-KjK7uFAE.js">
32
- <link rel="modulepreload" crossorigin href="/assets/schemas-BdEYnr23.js">
33
- <link rel="modulepreload" crossorigin href="/assets/organization-query-keys-uOvv8Ob1.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/schemas-B9l2tHsR.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/organization-query-keys-Nzs4DYGL.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/utils-C8DGLIgm.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/compiler-runtime-DCc3R3Xn.js">
36
36
  <link rel="modulepreload" crossorigin href="/assets/createReactComponent-_L2mp4Ui.js">
package/bin/onequery.js DELETED
@@ -1,215 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawn } from "node:child_process";
4
- import { chmodSync, existsSync, readdirSync, statSync } from "node:fs";
5
- import { createRequire } from "node:module";
6
- import path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
-
9
- import {
10
- CLI_BINARY_NAME,
11
- CLI_PACKAGE_NAME,
12
- PLATFORM_PACKAGE_BY_TARGET,
13
- binaryNameForPlatform,
14
- resolveTargetTriple,
15
- resolveTargetTripleCandidates,
16
- } from "./package-constants.js";
17
-
18
- const __filename = fileURLToPath(import.meta.url);
19
- const __dirname = path.dirname(__filename);
20
- const require = createRequire(import.meta.url);
21
-
22
- const { platform, arch } = process;
23
- const targetTriple = resolveTargetTriple(platform, arch);
24
- const targetTripleCandidates = resolveTargetTripleCandidates(platform, arch);
25
- const binaryName = binaryNameForPlatform(platform, CLI_BINARY_NAME);
26
-
27
- // CONTEXT: platform packages are installed through npm alias names so the
28
- // launcher resolves the alias folder, not the underlying published package id.
29
- const localVendorRoot = path.join(__dirname, "..", "vendor");
30
- const packageRoot = path.resolve(__dirname, "..");
31
-
32
- const resolvedVendor = resolveVendorPayload({
33
- binaryName,
34
- localVendorRoot,
35
- targetTripleCandidates,
36
- });
37
-
38
- if (!resolvedVendor) {
39
- const preferredPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
40
- const packageManager = detectPackageManager();
41
- const reinstallCommand =
42
- packageManager === "bun"
43
- ? `bun install -g ${CLI_PACKAGE_NAME}@latest`
44
- : `npm install -g ${CLI_PACKAGE_NAME}@latest`;
45
-
46
- if (preferredPackage) {
47
- throw new Error(
48
- `Missing optional dependency ${preferredPackage}. Reinstall OneQuery CLI: ${reinstallCommand}`
49
- );
50
- }
51
-
52
- throw new Error(`Unsupported target triple: ${targetTriple}`);
53
- }
54
-
55
- const { resolvedTargetTriple, vendorRoot } = resolvedVendor;
56
-
57
- const binaryPath = path.join(
58
- vendorRoot,
59
- resolvedTargetTriple,
60
- "onequery",
61
- binaryName
62
- );
63
- const serverBinaryDir = path.join(vendorRoot, resolvedTargetTriple, "server");
64
-
65
- if (platform !== "win32") {
66
- ensureExecutable(binaryPath);
67
- ensureExecutablesInDir(serverBinaryDir);
68
- }
69
-
70
- const child = spawn(binaryPath, process.argv.slice(2), {
71
- env: {
72
- ...process.env,
73
- ONEQUERY_NPM_ROOT: process.env.ONEQUERY_NPM_ROOT ?? packageRoot,
74
- ONEQUERY_PGLITE_ASSET_DIR:
75
- process.env.ONEQUERY_PGLITE_ASSET_DIR ??
76
- path.join(packageRoot, "runtime", "pglite"),
77
- ONEQUERY_RUNTIME_ROOT: process.env.ONEQUERY_RUNTIME_ROOT ?? packageRoot,
78
- },
79
- stdio: "inherit",
80
- });
81
-
82
- child.on("error", (error) => {
83
- console.error(error);
84
- process.exit(1);
85
- });
86
-
87
- const forwardSignal = (signal) => {
88
- if (child.killed) {
89
- return;
90
- }
91
-
92
- try {
93
- child.kill(signal);
94
- } catch {
95
- // Ignore forwarding failures if the child already exited.
96
- }
97
- };
98
-
99
- ["SIGINT", "SIGTERM", "SIGHUP"].forEach((signal) => {
100
- process.on(signal, () => forwardSignal(signal));
101
- });
102
-
103
- const childResult = await new Promise((resolve) => {
104
- child.on("exit", (code, signal) => {
105
- if (signal) {
106
- resolve({ signal, type: "signal" });
107
- return;
108
- }
109
-
110
- resolve({ exitCode: code ?? 1, type: "code" });
111
- });
112
- });
113
-
114
- if (childResult.type === "signal") {
115
- process.kill(process.pid, childResult.signal);
116
- } else {
117
- process.exit(childResult.exitCode);
118
- }
119
-
120
- function detectPackageManager() {
121
- const userAgent = process.env.npm_config_user_agent ?? "";
122
- if (/\bbun\//.test(userAgent)) {
123
- return "bun";
124
- }
125
-
126
- const execPath = process.env.npm_execpath ?? "";
127
- if (execPath.includes("bun")) {
128
- return "bun";
129
- }
130
-
131
- if (
132
- __dirname.includes(".bun/install/global") ||
133
- __dirname.includes(".bun\\install\\global")
134
- ) {
135
- return "bun";
136
- }
137
-
138
- return userAgent ? "npm" : null;
139
- }
140
-
141
- function resolveVendorPayload({
142
- binaryName,
143
- localVendorRoot,
144
- targetTripleCandidates,
145
- }) {
146
- for (const candidateTargetTriple of targetTripleCandidates) {
147
- const localBinaryPath = path.join(
148
- localVendorRoot,
149
- candidateTargetTriple,
150
- "onequery",
151
- binaryName
152
- );
153
-
154
- const platformPackage = PLATFORM_PACKAGE_BY_TARGET[candidateTargetTriple];
155
- if (platformPackage) {
156
- try {
157
- const packageJsonPath = require.resolve(
158
- `${platformPackage}/package.json`
159
- );
160
- const resolvedVendorRoot = path.join(
161
- path.dirname(packageJsonPath),
162
- "vendor"
163
- );
164
- const packagedBinaryPath = path.join(
165
- resolvedVendorRoot,
166
- candidateTargetTriple,
167
- "onequery",
168
- binaryName
169
- );
170
- if (existsSync(packagedBinaryPath)) {
171
- return {
172
- resolvedTargetTriple: candidateTargetTriple,
173
- vendorRoot: resolvedVendorRoot,
174
- };
175
- }
176
- } catch {
177
- // Keep checking fallback targets and local vendor payloads.
178
- }
179
- }
180
-
181
- if (existsSync(localBinaryPath)) {
182
- return {
183
- resolvedTargetTriple: candidateTargetTriple,
184
- vendorRoot: localVendorRoot,
185
- };
186
- }
187
- }
188
-
189
- return null;
190
- }
191
-
192
- function ensureExecutable(filePath) {
193
- const currentMode = statSync(filePath).mode & 0o777;
194
- if ((currentMode & 0o111) !== 0) {
195
- return;
196
- }
197
-
198
- // CONTEXT: npm tarballs store vendored native binaries without execute bits,
199
- // so restore the expected mode before spawning the packaged CLI binary.
200
- chmodSync(filePath, currentMode | 0o755);
201
- }
202
-
203
- function ensureExecutablesInDir(dirPath) {
204
- if (!existsSync(dirPath)) {
205
- return;
206
- }
207
-
208
- for (const entry of readdirSync(dirPath, { withFileTypes: true })) {
209
- if (!entry.isFile()) {
210
- continue;
211
- }
212
-
213
- ensureExecutable(path.join(dirPath, entry.name));
214
- }
215
- }
@@ -1,81 +0,0 @@
1
- export type TargetTriple =
2
- | "x86_64-unknown-linux-musl"
3
- | "aarch64-unknown-linux-musl"
4
- | "x86_64-apple-darwin"
5
- | "aarch64-apple-darwin"
6
- | "x86_64-pc-windows-msvc"
7
- | "aarch64-pc-windows-msvc"
8
- | "x86_64-unknown-linux-gnu"
9
- | "aarch64-unknown-linux-gnu";
10
-
11
- export type NpmTargetTriple = Exclude<
12
- TargetTriple,
13
- "x86_64-unknown-linux-gnu" | "aarch64-unknown-linux-gnu"
14
- >;
15
-
16
- export type RuntimePlatform = "linux" | "android" | "darwin" | "win32";
17
- export type RuntimeArch = "x64" | "arm64";
18
-
19
- export type PlatformPackage = {
20
- optionalDependencyName: string;
21
- npmTag: string;
22
- targetTriple: NpmTargetTriple;
23
- os: "linux" | "darwin" | "win32";
24
- cpu: RuntimeArch;
25
- };
26
-
27
- export type ReleasePlatformPackage = {
28
- optionalDependencyName: string | null;
29
- npmTag: string;
30
- targetTriple: TargetTriple;
31
- os: "linux" | "darwin" | "win32";
32
- cpu: RuntimeArch;
33
- };
34
-
35
- export type ServerBuildPlan = {
36
- compileTarget: string;
37
- filename: string;
38
- };
39
-
40
- export const CLI_PACKAGE_NAME: "@onequery/cli";
41
- export const CLI_BINARY_NAME: "onequery";
42
- export const CLI_SERVER_BINARY_NAME: "onequery-server";
43
- export const CLI_SERVER_MUSL_BINARY_NAME: "onequery-server-musl";
44
- export const CLI_NPM_TARBALL_PREFIX: "onequery-npm";
45
- export const CLI_NPM_STAGE_DIR_PREFIX: `${typeof CLI_NPM_TARBALL_PREFIX}-stage-`;
46
- export const CLI_NPM_PACK_DIR_PREFIX: `${typeof CLI_NPM_TARBALL_PREFIX}-pack-`;
47
- export const CLI_STAGE_PACKAGE_DIR_PREFIX: "onequery-cli-";
48
-
49
- export const PLATFORM_PACKAGES: Record<string, PlatformPackage>;
50
- export const EXTRA_RELEASE_PLATFORM_PACKAGES: Record<
51
- string,
52
- ReleasePlatformPackage
53
- >;
54
- export const RELEASE_PLATFORM_PACKAGES: Record<string, ReleasePlatformPackage>;
55
- export const PLATFORM_PACKAGE_BY_TARGET: Record<NpmTargetTriple, string>;
56
-
57
- export function serverBuildsForTargetTriple(
58
- targetTriple: TargetTriple
59
- ): ServerBuildPlan[];
60
-
61
- export function packageStagingDirPrefix(packageName: string): string;
62
-
63
- export function binaryNameForPlatform(
64
- platform: RuntimePlatform | string,
65
- baseName: string
66
- ): string;
67
-
68
- export function binaryNameForTargetTriple(
69
- targetTriple: TargetTriple | string,
70
- baseName: string
71
- ): string;
72
-
73
- export function resolveTargetTripleCandidates(
74
- platform: RuntimePlatform | string,
75
- arch: RuntimeArch | string
76
- ): TargetTriple[];
77
-
78
- export function resolveTargetTriple(
79
- platform: RuntimePlatform | string,
80
- arch: RuntimeArch | string
81
- ): TargetTriple;