@protobase/ui 0.113.1 → 0.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/messages.d.ts +2 -2
- package/dist/app/app.d.ts +4 -1
- package/dist/app/app.js +9 -7
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/comments/messages.d.ts +2 -2
- package/dist/app/confirm-sign-in-messages.d.ts +2 -2
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/displays/virtual-cards.js +1 -0
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/first-frame.d.ts +13 -0
- package/dist/app/first-frame.js +23 -0
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/gallery/gallery-layout.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/index.html +0 -17
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/main.js +19 -7
- package/dist/app/messages.d.ts +2 -2
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-mode/shown-layout.d.ts +1 -1
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/record-row/record-row.js +1 -0
- package/dist/app/refresh-mark.d.ts +2 -1
- package/dist/app/refresh-mark.js +3 -1
- package/dist/app/reveal-when-loaded.d.ts +8 -2
- package/dist/app/reveal-when-loaded.js +12 -5
- package/dist/app/runtime/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/splash-hold.d.ts +0 -1
- package/dist/app/splash-hold.js +1 -1
- package/dist/app/start-screen.d.ts +0 -9
- package/dist/app/start-screen.js +1 -10
- package/dist/app/ui-ready.d.ts +11 -0
- package/dist/app/ui-ready.js +12 -0
- package/dist/app-shell/app-shell.js +3 -1
- package/dist/app-shell/close-sidebar.d.ts +10 -0
- package/dist/app-shell/close-sidebar.js +17 -0
- package/dist/app-shell/drawer.d.ts +7 -1
- package/dist/app-shell/drawer.js +26 -7
- package/dist/app-shell/index.d.ts +2 -1
- package/dist/app-shell/index.js +2 -1
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/app-shell/top-bar.js +4 -4
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/chat/messages.d.ts +2 -2
- package/dist/data/query-keys.d.ts +6 -0
- package/dist/data/query-keys.js +10 -0
- package/dist/data/start-cache/cached-plugins.d.ts +6 -0
- package/dist/data/start-cache/cached-plugins.js +10 -0
- package/dist/data-grid/data-grid.js +1 -0
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/data-grid/row-source.d.ts +5 -0
- package/dist/data-grid/use-paged-rows.d.ts +5 -3
- package/dist/data-grid/use-paged-rows.js +21 -6
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/live/grid-loader.d.ts +1 -0
- package/dist/live/grid-loader.js +3 -1
- package/dist/live/use-live-rows.js +1 -0
- package/dist/mocks/orders.d.ts +1 -1
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/members-page.js +13 -7
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/organizations/use-organizations.d.ts +4 -1
- package/dist/organizations/use-organizations.js +25 -19
- package/dist/package.js +1 -1
- package/dist/plugins/plugin-source.d.ts +24 -4
- package/dist/plugins/plugin-source.js +48 -14
- package/dist/plugins/use-plugin-loads.d.ts +3 -1
- package/dist/plugins/use-plugin-loads.js +24 -7
- package/dist/primitives/skeleton.js +1 -0
- package/dist/roles/use-active-role.d.ts +4 -1
- package/dist/roles/use-active-role.js +18 -13
- package/dist/shell/assets/api-provider-BJJrOoO4.js +2 -0
- package/dist/shell/assets/app-VoTi41IN.js +16 -0
- package/dist/shell/assets/badge-OU9hb6yQ.js +2 -0
- package/dist/shell/assets/checkbox-DFfK432Y.js +2 -0
- package/dist/shell/assets/createLucideIcon-DGm8SdFI.js +2 -0
- package/dist/shell/assets/display-value-CIH2qfgQ.js +2 -0
- package/dist/shell/assets/{field-badge-3QmjR1r3.js → field-badge-DX2Mc_fH.js} +2 -2
- package/dist/shell/assets/{graph-view-CIk96BRv.js → graph-view-CY9LPr0B.js} +2 -2
- package/dist/shell/assets/{html-viewer-ATz2AVBi.js → html-viewer-BPGMH_GA.js} +2 -2
- package/dist/shell/assets/{in-place-form-frfvnKaj.js → in-place-form-RWSQGEg4.js} +2 -2
- package/dist/shell/assets/index-Bzb-O7ER.js +2 -0
- package/dist/shell/assets/index-HnFovy2Q.css +2 -0
- package/dist/shell/assets/{intl-cache-bXVNV0Yq.js → intl-cache-D4doUjK1.js} +2 -2
- package/dist/shell/assets/{lib-d3-interpolate-Cl0dHO4f.js → lib-d3-interpolate-D3u38iyJ.js} +2 -2
- package/dist/shell/assets/{lib-d3-transition-DUHAGQ8z.js → lib-d3-transition-BUpPvFvt.js} +2 -2
- package/dist/shell/assets/{lib-d3-zoom-gQh2osrj.js → lib-d3-zoom-BF7SPKNh.js} +2 -2
- package/dist/shell/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js → lib-vis.gl-react-maplibre-C7-0xNFC.js} +2 -2
- package/dist/shell/assets/{lib-xyflow-react-DGg_5r7u.js → lib-xyflow-react-CKyW7szC.js} +2 -2
- package/dist/shell/assets/maplibre-9ViQO48S.js +2 -0
- package/dist/shell/assets/{markdown-content-mNJHzGOa.js → markdown-content-DTB9RQDs.js} +2 -2
- package/dist/shell/assets/{record-map-BsXXSshB.js → record-map-CVqCWtfe.js} +2 -2
- package/dist/shell/assets/{records-map-D8EBzOu8.js → records-map-ClYSxrVR.js} +2 -2
- package/dist/shell/assets/{run-trace-view-Tf6Jwd46.js → run-trace-view-CN16MiXg.js} +2 -2
- package/dist/shell/assets/search-picker-BGpvJQRD.js +2 -0
- package/dist/shell/assets/shared-protobase-ui-BC8LqGQB.js +2 -0
- package/dist/shell/assets/step-catalog-CZY0ZpCC.js +2 -0
- package/dist/shell/assets/step-panel-DhD80lsJ.js +2 -0
- package/dist/shell/assets/use-app-address-B4Uk3nWy.js +2 -0
- package/dist/shell/assets/{use-meta-BqEqOLNe.js → use-meta-D5kYywHm.js} +2 -2
- package/dist/shell/assets/{use-sibling-page-Dm7aUfaa.js → use-sibling-page-BJ81HcOP.js} +3 -3
- package/dist/shell/assets/value-badge-Dpd8dRqq.js +2 -0
- package/dist/shell/assets/{vendor-WWp_xlp2.js → vendor-3etemhgS.js} +4 -4
- package/dist/shell/assets/{workflow-canvas-B8ciy9xI.js → workflow-canvas-C1nGpi5w.js} +2 -2
- package/dist/shell/assets/{workflow-graph-editor-QT-3e-M9.js → workflow-graph-editor-DAJa4lq6.js} +2 -2
- package/dist/shell/assets/workflow-workbench-HramVZEJ.js +4 -0
- package/dist/shell/assets/{workflows-Bku4o2su.js → workflows-DlvOln9v.js} +2 -2
- package/dist/shell/assets/{workflows-start-kl7rSSay.js → workflows-start-QUKfwFqf.js} +2 -2
- package/dist/shell/index.html +16 -19
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/api-provider-BJJrOoO4.js.map +1 -0
- package/dist/shell-source-maps/assets/app-VoTi41IN.js.map +1 -0
- package/dist/shell-source-maps/assets/{badge-ChHXC28D.js.map → badge-OU9hb6yQ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{checkbox-COOOlJPG.js.map → checkbox-DFfK432Y.js.map} +1 -1
- package/dist/shell-source-maps/assets/createLucideIcon-DGm8SdFI.js.map +1 -0
- package/dist/shell-source-maps/assets/display-value-CIH2qfgQ.js.map +1 -0
- package/dist/shell-source-maps/assets/{field-badge-3QmjR1r3.js.map → field-badge-DX2Mc_fH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-CIk96BRv.js.map → graph-view-CY9LPr0B.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-ATz2AVBi.js.map → html-viewer-BPGMH_GA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{in-place-form-frfvnKaj.js.map → in-place-form-RWSQGEg4.js.map} +1 -1
- package/dist/shell-source-maps/assets/index-Bzb-O7ER.js.map +1 -0
- package/dist/shell-source-maps/assets/{intl-cache-bXVNV0Yq.js.map → intl-cache-D4doUjK1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-interpolate-Cl0dHO4f.js.map → lib-d3-interpolate-D3u38iyJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-transition-DUHAGQ8z.js.map → lib-d3-transition-BUpPvFvt.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-d3-zoom-gQh2osrj.js.map → lib-d3-zoom-BF7SPKNh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-vis.gl-react-maplibre-CU7gWYjg.js.map → lib-vis.gl-react-maplibre-C7-0xNFC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{lib-xyflow-react-DGg_5r7u.js.map → lib-xyflow-react-CKyW7szC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-BufRSV4y.js.map → maplibre-9ViQO48S.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-mNJHzGOa.js.map → markdown-content-DTB9RQDs.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-BsXXSshB.js.map → record-map-CVqCWtfe.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-D8EBzOu8.js.map → records-map-ClYSxrVR.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-Tf6Jwd46.js.map → run-trace-view-CN16MiXg.js.map} +1 -1
- package/dist/shell-source-maps/assets/{search-picker-BHmYOFF8.js.map → search-picker-BGpvJQRD.js.map} +1 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-BC8LqGQB.js.map +1 -0
- package/dist/shell-source-maps/assets/{step-catalog-DZNovnPL.js.map → step-catalog-CZY0ZpCC.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-3aRZ2Dlj.js.map → step-panel-DhD80lsJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-app-address-B6k3dkV0.js.map → use-app-address-B4Uk3nWy.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-meta-BqEqOLNe.js.map → use-meta-D5kYywHm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-sibling-page-Dm7aUfaa.js.map → use-sibling-page-BJ81HcOP.js.map} +1 -1
- package/dist/shell-source-maps/assets/{value-badge-BKLV4otJ.js.map → value-badge-Dpd8dRqq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{vendor-WWp_xlp2.js.map → vendor-3etemhgS.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-B8ciy9xI.js.map → workflow-canvas-C1nGpi5w.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-QT-3e-M9.js.map → workflow-graph-editor-DAJa4lq6.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-C5eHhxQh.js.map → workflow-workbench-HramVZEJ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflows-Bku4o2su.js.map → workflows-DlvOln9v.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflows-start-kl7rSSay.js.map → workflows-start-QUKfwFqf.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/styles.css +14 -0
- package/package.json +5 -5
- package/dist/app/hold-start-for-first-loads.d.ts +0 -12
- package/dist/app/hold-start-for-first-loads.js +0 -43
- package/dist/shell/assets/api-provider-CcDtTh0D.js +0 -2
- package/dist/shell/assets/app-C1xWr51x.js +0 -16
- package/dist/shell/assets/badge-ChHXC28D.js +0 -2
- package/dist/shell/assets/checkbox-COOOlJPG.js +0 -2
- package/dist/shell/assets/display-value-fDiKbfJO.js +0 -2
- package/dist/shell/assets/index-BkCaPeOq.css +0 -2
- package/dist/shell/assets/index-C4cMQVG2.js +0 -2
- package/dist/shell/assets/maplibre-BufRSV4y.js +0 -2
- package/dist/shell/assets/messages-ClKBpZlk.js +0 -2
- package/dist/shell/assets/search-picker-BHmYOFF8.js +0 -2
- package/dist/shell/assets/shared-protobase-ui-C1jBhoci.js +0 -2
- package/dist/shell/assets/step-catalog-DZNovnPL.js +0 -2
- package/dist/shell/assets/step-panel-3aRZ2Dlj.js +0 -2
- package/dist/shell/assets/use-app-address-B6k3dkV0.js +0 -2
- package/dist/shell/assets/value-badge-BKLV4otJ.js +0 -2
- package/dist/shell/assets/workflow-workbench-C5eHhxQh.js +0 -4
- package/dist/shell-source-maps/assets/api-provider-CcDtTh0D.js.map +0 -1
- package/dist/shell-source-maps/assets/app-C1xWr51x.js.map +0 -1
- package/dist/shell-source-maps/assets/display-value-fDiKbfJO.js.map +0 -1
- package/dist/shell-source-maps/assets/index-C4cMQVG2.js.map +0 -1
- package/dist/shell-source-maps/assets/messages-ClKBpZlk.js.map +0 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-C1jBhoci.js.map +0 -1
|
@@ -11,9 +11,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
11
11
|
`,t);for(;t<e.length;){let i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;if(C(e,t,i),x())return``;t=i+1,e.charCodeAt(t-1)===Ju&&e.charCodeAt(t)===qu&&t++,n!==-1&&n<t&&(n=e.indexOf(`\r`,t)),r!==-1&&r<t&&(r=e.indexOf(`
|
|
12
12
|
`,t))}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(Qu(e,t,i)){let n=e.charCodeAt(t+5)===Yu?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if($u(e,t,i)){p=e.slice(e.charCodeAt(t+6)===Yu?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===Yu?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===Yu?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===Yu?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new Ku(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new Ku(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=``,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function Qu(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function $u(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function ed(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}function td(e,t){let n=t&&t.cache?t.cache:dd,r=t&&t.serializer?t.serializer:ld;return(t&&t.strategy?t.strategy:od)(e,{cache:n,serializer:r})}function nd(e){return e==null||typeof e==`number`||typeof e==`boolean`}function rd(e,t,n,r){let i=nd(r)?r:n(r),a=t.get(i);return a===void 0&&(a=e.call(this,r),t.set(i,a)),a}function id(e,t,n){let r=Array.prototype.slice.call(arguments,3),i=n(r),a=t.get(i);return a===void 0&&(a=e.apply(this,r),t.set(i,a)),a}function ad(e,t,n,r,i){return n.bind(t,e,r,i)}function od(e,t){let n=e.length===1?rd:id;return ad(e,this,n,t.cache.create(),t.serializer)}function sd(e,t){return ad(e,this,id,t.cache.create(),t.serializer)}function cd(e,t){return ad(e,this,rd,t.cache.create(),t.serializer)}var ld=function(){return JSON.stringify(arguments)},ud=class{constructor(){this.cache=Object.create(null)}get(e){return this.cache[e]}set(e,t){this.cache[e]=t}},dd={create:function(){return new ud}},fd={variadic:sd,monadic:cd},pd=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function md(e){let t={};return e.replace(pd,e=>{let n=e.length;switch(e[0]){case`G`:t.era=n===4?`long`:n===5?`narrow`:`short`;break;case`y`:t.year=n===2?`2-digit`:`numeric`;break;case`Y`:case`u`:case`U`:case`r`:throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case`q`:case`Q`:throw RangeError("`q/Q` (quarter) patterns are not supported");case`M`:case`L`:t.month=[`numeric`,`2-digit`,`short`,`long`,`narrow`][n-1];break;case`w`:case`W`:throw RangeError("`w/W` (week) patterns are not supported");case`d`:t.day=[`numeric`,`2-digit`][n-1];break;case`D`:case`F`:case`g`:throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case`E`:t.weekday=n===4?`long`:n===5?`narrow`:`short`;break;case`e`:if(n<4)throw RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`c`:if(n<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`a`:t.hour12=!0;break;case`b`:case`B`:throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case`h`:t.hourCycle=`h12`,t.hour=[`numeric`,`2-digit`][n-1];break;case`H`:t.hourCycle=`h23`,t.hour=[`numeric`,`2-digit`][n-1];break;case`K`:t.hourCycle=`h11`,t.hour=[`numeric`,`2-digit`][n-1];break;case`k`:t.hourCycle=`h24`,t.hour=[`numeric`,`2-digit`][n-1];break;case`j`:case`J`:case`C`:throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case`m`:t.minute=[`numeric`,`2-digit`][n-1];break;case`s`:t.second=[`numeric`,`2-digit`][n-1];break;case`S`:case`A`:throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case`z`:t.timeZoneName=n<4?`short`:`long`;break;case`Z`:case`O`:case`v`:case`V`:case`X`:case`x`:throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return``}),t}var hd=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function gd(e){if(e.length===0)throw Error(`Number skeleton cannot be empty`);let t=e.split(hd).filter(e=>e.length>0),n=[];for(let e of t){let t=e.split(`/`);if(t.length===0)throw Error(`Invalid number skeleton`);let[r,...i]=t;for(let e of i)if(e.length===0)throw Error(`Invalid number skeleton`);n.push({stem:r,options:i})}return n}function _d(e){return e.replace(/^(.*?)-/,``)}var vd=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,yd=/^(@+)?(\+|#+)?[rs]?$/g,bd=/(\*)(0+)|(#+)(0+)|(0+)/g,xd=/^(0+)$/;function Sd(e){let t={};return e[e.length-1]===`r`?t.roundingPriority=`morePrecision`:e[e.length-1]===`s`&&(t.roundingPriority=`lessPrecision`),e.replace(yd,function(e,n,r){return typeof r==`string`?r===`+`?t.minimumSignificantDigits=n.length:n[0]===`#`?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+(typeof r==`string`?r.length:0)):(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length),``}),t}function Cd(e){switch(e){case`sign-auto`:return{signDisplay:`auto`};case`sign-accounting`:case`()`:return{currencySign:`accounting`};case`sign-always`:case`+!`:return{signDisplay:`always`};case`sign-accounting-always`:case`()!`:return{signDisplay:`always`,currencySign:`accounting`};case`sign-except-zero`:case`+?`:return{signDisplay:`exceptZero`};case`sign-accounting-except-zero`:case`()?`:return{signDisplay:`exceptZero`,currencySign:`accounting`};case`sign-never`:case`+_`:return{signDisplay:`never`}}}function wd(e){let t;if(e[0]===`E`&&e[1]===`E`?(t={notation:`engineering`},e=e.slice(2)):e[0]===`E`&&(t={notation:`scientific`},e=e.slice(1)),t){let n=e.slice(0,2);if(n===`+!`?(t.signDisplay=`always`,e=e.slice(2)):n===`+?`&&(t.signDisplay=`exceptZero`,e=e.slice(2)),!xd.test(e))throw Error(`Malformed concise eng/scientific notation`);t.minimumIntegerDigits=e.length}return t}function Td(e){return Cd(e)||{}}function Ed(e){let t={};for(let n of e){switch(n.stem){case`percent`:case`%`:t.style=`percent`;continue;case`%x100`:t.style=`percent`,t.scale=100;continue;case`currency`:t.style=`currency`,t.currency=n.options[0];continue;case`group-off`:case`,_`:t.useGrouping=!1;continue;case`precision-integer`:case`.`:t.maximumFractionDigits=0;continue;case`measure-unit`:case`unit`:t.style=`unit`,t.unit=_d(n.options[0]);continue;case`compact-short`:case`K`:t.notation=`compact`,t.compactDisplay=`short`;continue;case`compact-long`:case`KK`:t.notation=`compact`,t.compactDisplay=`long`;continue;case`scientific`:t={...t,notation:`scientific`,...n.options.reduce((e,t)=>({...e,...Td(t)}),{})};continue;case`engineering`:t={...t,notation:`engineering`,...n.options.reduce((e,t)=>({...e,...Td(t)}),{})};continue;case`notation-simple`:t.notation=`standard`;continue;case`unit-width-narrow`:t.currencyDisplay=`narrowSymbol`,t.unitDisplay=`narrow`;continue;case`unit-width-short`:t.currencyDisplay=`code`,t.unitDisplay=`short`;continue;case`unit-width-full-name`:t.currencyDisplay=`name`,t.unitDisplay=`long`;continue;case`unit-width-iso-code`:t.currencyDisplay=`symbol`;continue;case`scale`:t.scale=parseFloat(n.options[0]);continue;case`rounding-mode-floor`:t.roundingMode=`floor`;continue;case`rounding-mode-ceiling`:t.roundingMode=`ceil`;continue;case`rounding-mode-down`:t.roundingMode=`trunc`;continue;case`rounding-mode-up`:t.roundingMode=`expand`;continue;case`rounding-mode-half-even`:t.roundingMode=`halfEven`;continue;case`rounding-mode-half-down`:t.roundingMode=`halfTrunc`;continue;case`rounding-mode-half-up`:t.roundingMode=`halfExpand`;continue;case`integer-width`:if(n.options.length>1)throw RangeError(`integer-width stems only accept a single optional option`);n.options[0].replace(bd,function(e,n,r,i,a,o){if(n)t.minimumIntegerDigits=r.length;else if(i&&a)throw Error(`We currently do not support maximum integer digits`);else if(o)throw Error(`We currently do not support exact integer digits`);return``});continue}if(xd.test(n.stem)){t.minimumIntegerDigits=n.stem.length;continue}if(vd.test(n.stem)){if(n.options.length>1)throw RangeError(`Fraction-precision stems only accept a single optional option`);n.stem.replace(vd,function(e,n,r,i,a,o){return r===`*`?t.minimumFractionDigits=n.length:i&&i[0]===`#`?t.maximumFractionDigits=i.length:a&&o?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+o.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),``});let e=n.options[0];e===`w`?t={...t,trailingZeroDisplay:`stripIfInteger`}:e&&(t={...t,...Sd(e)});continue}if(yd.test(n.stem)){t={...t,...Sd(n.stem)};continue}let e=Cd(n.stem);e&&(t={...t,...e});let r=wd(n.stem);r&&(t={...t,...r})}return t}var Dd=function(e){return e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]=`EXPECT_ARGUMENT_CLOSING_BRACE`,e[e.EMPTY_ARGUMENT=2]=`EMPTY_ARGUMENT`,e[e.MALFORMED_ARGUMENT=3]=`MALFORMED_ARGUMENT`,e[e.EXPECT_ARGUMENT_TYPE=4]=`EXPECT_ARGUMENT_TYPE`,e[e.INVALID_ARGUMENT_TYPE=5]=`INVALID_ARGUMENT_TYPE`,e[e.EXPECT_ARGUMENT_STYLE=6]=`EXPECT_ARGUMENT_STYLE`,e[e.INVALID_NUMBER_SKELETON=7]=`INVALID_NUMBER_SKELETON`,e[e.INVALID_DATE_TIME_SKELETON=8]=`INVALID_DATE_TIME_SKELETON`,e[e.EXPECT_NUMBER_SKELETON=9]=`EXPECT_NUMBER_SKELETON`,e[e.EXPECT_DATE_TIME_SKELETON=10]=`EXPECT_DATE_TIME_SKELETON`,e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]=`UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`,e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]=`EXPECT_SELECT_ARGUMENT_OPTIONS`,e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]=`EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]=`INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]=`EXPECT_SELECT_ARGUMENT_SELECTOR`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]=`EXPECT_PLURAL_ARGUMENT_SELECTOR`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]=`EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]=`EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`,e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]=`INVALID_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]=`DUPLICATE_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]=`DUPLICATE_SELECT_ARGUMENT_SELECTOR`,e[e.MISSING_OTHER_CLAUSE=22]=`MISSING_OTHER_CLAUSE`,e[e.INVALID_TAG=23]=`INVALID_TAG`,e[e.INVALID_TAG_NAME=25]=`INVALID_TAG_NAME`,e[e.UNMATCHED_CLOSING_TAG=26]=`UNMATCHED_CLOSING_TAG`,e[e.UNCLOSED_TAG=27]=`UNCLOSED_TAG`,e}({});function Od(e){return e.type===0}function kd(e){return e.type===1}function Ad(e){return e.type===2}function jd(e){return e.type===3}function Md(e){return e.type===4}function Nd(e){return e.type===5}function Pd(e){return e.type===6}function Fd(e){return e.type===7}function Id(e){return e.type===8}function Ld(e){return!!(e&&typeof e==`object`&&e.type===0)}function Rd(e){return!!(e&&typeof e==`object`&&e.type===1)}var zd=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Bd=/([^\t-\r -\/:-@\[-\^`\{-~\x85\xA0-\xA7\xA9\xAB\xAC\xAE\xB0\xB1\xB6\xBB\xBF\xD7\xF7\u1680\u2000-\u200A\u2010-\u2029\u202F-\u203E\u2041-\u2053\u2055-\u205F\u2190-\u245F\u2500-\u2775\u2794-\u2BFF\u2E00-\u2E7F\u3000-\u3003\u3008-\u3020\u3030\uFD3E\uFD3F\uFE45\uFE46]*)/g,Vd={"001":[`H`,`h`],419:[`h`,`H`,`hB`,`hb`],AC:[`H`,`h`,`hb`,`hB`],AD:[`H`,`hB`],AE:[`h`,`hB`,`hb`,`H`],AF:[`H`,`hb`,`hB`,`h`],AG:[`h`,`hb`,`H`,`hB`],AI:[`H`,`h`,`hb`,`hB`],AL:[`h`,`H`,`hB`],AM:[`H`,`hB`],AO:[`H`,`hB`],AR:[`h`,`H`,`hB`,`hb`],AS:[`h`,`H`],AT:[`H`,`hB`],AU:[`h`,`hb`,`H`,`hB`],AW:[`H`,`hB`],AX:[`H`],AZ:[`H`,`hB`,`h`],BA:[`H`,`hB`,`h`],BB:[`h`,`hb`,`H`,`hB`],BD:[`h`,`hB`,`H`],BE:[`H`,`hB`],BF:[`H`,`hB`],BG:[`H`,`hB`,`h`],BH:[`h`,`hB`,`hb`,`H`],BI:[`H`,`h`],BJ:[`H`,`hB`],BL:[`H`,`hB`],BM:[`h`,`hb`,`H`,`hB`],BN:[`hb`,`hB`,`h`,`H`],BO:[`h`,`H`,`hB`,`hb`],BQ:[`H`],BR:[`H`,`hB`],BS:[`h`,`hb`,`H`,`hB`],BT:[`h`,`H`],BW:[`H`,`h`,`hb`,`hB`],BY:[`H`,`h`],BZ:[`H`,`h`,`hb`,`hB`],CA:[`h`,`hb`,`H`,`hB`],CC:[`H`,`h`,`hb`,`hB`],CD:[`hB`,`H`],CF:[`H`,`h`,`hB`],CG:[`H`,`hB`],CH:[`H`,`hB`,`h`],CI:[`H`,`hB`],CK:[`H`,`h`,`hb`,`hB`],CL:[`h`,`H`,`hB`,`hb`],CM:[`H`,`h`,`hB`],CN:[`H`,`hB`,`hb`,`h`],CO:[`h`,`H`,`hB`,`hb`],CP:[`H`],CR:[`h`,`H`,`hB`,`hb`],CU:[`h`,`H`,`hB`,`hb`],CV:[`H`,`hB`],CW:[`H`,`hB`],CX:[`H`,`h`,`hb`,`hB`],CY:[`h`,`H`,`hb`,`hB`],CZ:[`H`],DE:[`H`,`hB`],DG:[`H`,`h`,`hb`,`hB`],DJ:[`h`,`H`],DK:[`H`],DM:[`h`,`hb`,`H`,`hB`],DO:[`h`,`H`,`hB`,`hb`],DZ:[`h`,`hB`,`hb`,`H`],EA:[`H`,`h`,`hB`,`hb`],EC:[`h`,`H`,`hB`,`hb`],EE:[`H`,`hB`],EG:[`h`,`hB`,`hb`,`H`],EH:[`h`,`hB`,`hb`,`H`],ER:[`h`,`H`],ES:[`H`,`hB`,`h`,`hb`],ET:[`hB`,`hb`,`h`,`H`],FI:[`H`],FJ:[`h`,`hb`,`H`,`hB`],FK:[`H`,`h`,`hb`,`hB`],FM:[`h`,`hb`,`H`,`hB`],FO:[`H`,`h`],FR:[`H`,`hB`],GA:[`H`,`hB`],GB:[`H`,`h`,`hb`,`hB`],GD:[`h`,`hb`,`H`,`hB`],GE:[`H`,`hB`,`h`],GF:[`H`,`hB`],GG:[`H`,`h`,`hb`,`hB`],GH:[`h`,`H`],GI:[`H`,`h`,`hb`,`hB`],GL:[`H`,`h`],GM:[`h`,`hb`,`H`,`hB`],GN:[`H`,`hB`],GP:[`H`,`hB`],GQ:[`H`,`hB`,`h`,`hb`],GR:[`h`,`H`,`hb`,`hB`],GS:[`H`,`h`,`hb`,`hB`],GT:[`h`,`H`,`hB`,`hb`],GU:[`h`,`hb`,`H`,`hB`],GW:[`H`,`hB`],GY:[`h`,`hb`,`H`,`hB`],HK:[`h`,`hB`,`hb`,`H`],HN:[`h`,`H`,`hB`,`hb`],HR:[`H`,`hB`],HU:[`H`,`h`],IC:[`H`,`h`,`hB`,`hb`],ID:[`H`],IE:[`H`,`h`,`hb`,`hB`],IL:[`H`,`hB`],IM:[`H`,`h`,`hb`,`hB`],IN:[`h`,`H`],IO:[`H`,`h`,`hb`,`hB`],IQ:[`h`,`hB`,`hb`,`H`],IR:[`hB`,`H`],IS:[`H`],IT:[`H`,`hB`],JE:[`H`,`h`,`hb`,`hB`],JM:[`h`,`hb`,`H`,`hB`],JO:[`h`,`hB`,`hb`,`H`],JP:[`H`,`K`,`h`],KE:[`hB`,`hb`,`H`,`h`],KG:[`H`,`h`,`hB`,`hb`],KH:[`hB`,`h`,`H`,`hb`],KI:[`h`,`hb`,`H`,`hB`],KM:[`H`,`h`,`hB`,`hb`],KN:[`h`,`hb`,`H`,`hB`],KP:[`h`,`H`,`hB`,`hb`],KR:[`h`,`H`,`hB`,`hb`],KW:[`h`,`hB`,`hb`,`H`],KY:[`h`,`hb`,`H`,`hB`],KZ:[`H`,`hB`],LA:[`H`,`hb`,`hB`,`h`],LB:[`h`,`hB`,`hb`,`H`],LC:[`h`,`hb`,`H`,`hB`],LI:[`H`,`hB`,`h`],LK:[`H`,`h`,`hB`,`hb`],LR:[`h`,`hb`,`H`,`hB`],LS:[`h`,`H`],LT:[`H`,`h`,`hb`,`hB`],LU:[`H`,`h`,`hB`],LV:[`H`,`hB`,`hb`,`h`],LY:[`h`,`hB`,`hb`,`H`],MA:[`H`,`h`,`hB`,`hb`],MC:[`H`,`hB`],MD:[`H`,`hB`],ME:[`H`,`hB`,`h`],MF:[`H`,`hB`],MG:[`H`,`h`],MH:[`h`,`hb`,`H`,`hB`],MK:[`H`,`h`,`hb`,`hB`],ML:[`H`],MM:[`hB`,`hb`,`H`,`h`],MN:[`H`,`h`,`hb`,`hB`],MO:[`h`,`hB`,`hb`,`H`],MP:[`h`,`hb`,`H`,`hB`],MQ:[`H`,`hB`],MR:[`h`,`hB`,`hb`,`H`],MS:[`H`,`h`,`hb`,`hB`],MT:[`H`,`h`],MU:[`H`,`h`],MV:[`H`,`h`],MW:[`h`,`hb`,`H`,`hB`],MX:[`h`,`H`,`hB`,`hb`],MY:[`hb`,`hB`,`h`,`H`],MZ:[`H`,`hB`],NA:[`h`,`H`,`hB`,`hb`],NC:[`H`,`hB`],NE:[`H`],NF:[`H`,`h`,`hb`,`hB`],NG:[`H`,`h`,`hb`,`hB`],NI:[`h`,`H`,`hB`,`hb`],NL:[`H`,`hB`],NO:[`H`,`h`],NP:[`H`,`h`,`hB`],NR:[`H`,`h`,`hb`,`hB`],NU:[`H`,`h`,`hb`,`hB`],NZ:[`h`,`hb`,`H`,`hB`],OM:[`h`,`hB`,`hb`,`H`],PA:[`h`,`H`,`hB`,`hb`],PE:[`h`,`H`,`hB`,`hb`],PF:[`H`,`h`,`hB`],PG:[`h`,`H`],PH:[`h`,`hB`,`hb`,`H`],PK:[`h`,`hB`,`H`],PL:[`H`,`h`],PM:[`H`,`hB`],PN:[`H`,`h`,`hb`,`hB`],PR:[`h`,`H`,`hB`,`hb`],PS:[`h`,`hB`,`hb`,`H`],PT:[`H`,`hB`],PW:[`h`,`H`],PY:[`h`,`H`,`hB`,`hb`],QA:[`h`,`hB`,`hb`,`H`],RE:[`H`,`hB`],RO:[`H`,`hB`],RS:[`H`,`hB`,`h`],RU:[`H`],RW:[`H`,`h`],SA:[`h`,`hB`,`hb`,`H`],SB:[`h`,`hb`,`H`,`hB`],SC:[`H`,`h`,`hB`],SD:[`h`,`hB`,`hb`,`H`],SE:[`H`],SG:[`h`,`hb`,`H`,`hB`],SH:[`H`,`h`,`hb`,`hB`],SI:[`H`,`hB`],SJ:[`H`],SK:[`H`],SL:[`h`,`hb`,`H`,`hB`],SM:[`H`,`h`,`hB`],SN:[`H`,`h`,`hB`],SO:[`h`,`H`],SR:[`H`,`hB`],SS:[`h`,`hb`,`H`,`hB`],ST:[`H`,`hB`],SV:[`h`,`H`,`hB`,`hb`],SX:[`H`,`h`,`hb`,`hB`],SY:[`h`,`hB`,`hb`,`H`],SZ:[`h`,`hb`,`H`,`hB`],TA:[`H`,`h`,`hb`,`hB`],TC:[`h`,`hb`,`H`,`hB`],TD:[`h`,`H`,`hB`],TF:[`H`,`h`,`hB`],TG:[`H`,`hB`],TH:[`H`,`h`],TJ:[`H`,`h`],TL:[`H`,`hB`,`hb`,`h`],TM:[`H`,`h`],TN:[`h`,`hB`,`hb`,`H`],TO:[`h`,`H`],TR:[`H`,`hB`],TT:[`h`,`hb`,`H`,`hB`],TW:[`hB`,`hb`,`h`,`H`],TZ:[`hB`,`hb`,`H`,`h`],UA:[`H`,`hB`,`h`],UG:[`hB`,`hb`,`H`,`h`],UM:[`h`,`hb`,`H`,`hB`],US:[`h`,`hb`,`H`,`hB`],UY:[`h`,`H`,`hB`,`hb`],UZ:[`H`,`hB`,`h`],VA:[`H`,`h`,`hB`],VC:[`h`,`hb`,`H`,`hB`],VE:[`h`,`H`,`hB`,`hb`],VG:[`h`,`hb`,`H`,`hB`],VI:[`h`,`hb`,`H`,`hB`],VN:[`H`,`h`],VU:[`h`,`H`],WF:[`H`,`hB`],WS:[`h`,`H`],XK:[`H`,`hB`,`h`],YE:[`h`,`hB`,`hb`,`H`],YT:[`H`,`hB`],ZA:[`H`,`h`,`hb`,`hB`],ZM:[`h`,`hb`,`H`,`hB`],ZW:[`H`,`h`],"af-ZA":[`H`,`h`,`hB`,`hb`],"ar-001":[`h`,`hB`,`hb`,`H`],"ca-ES":[`H`,`h`,`hB`],"en-001":[`h`,`hb`,`H`,`hB`],"en-HK":[`h`,`hb`,`H`,`hB`],"en-IL":[`H`,`h`,`hb`,`hB`],"en-MY":[`h`,`hb`,`H`,`hB`],"es-BR":[`H`,`h`,`hB`,`hb`],"es-ES":[`H`,`h`,`hB`,`hb`],"es-GQ":[`H`,`h`,`hB`,`hb`],"fr-CA":[`H`,`h`,`hB`],"gl-ES":[`H`,`h`,`hB`],"gu-IN":[`hB`,`hb`,`h`,`H`],"hi-IN":[`hB`,`h`,`H`],"it-CH":[`H`,`h`,`hB`],"it-IT":[`H`,`h`,`hB`],"kn-IN":[`hB`,`h`,`H`],"ku-SY":[`H`,`hB`],"ml-IN":[`hB`,`h`,`H`],"mr-IN":[`hB`,`hb`,`h`,`H`],"pa-IN":[`hB`,`hb`,`h`,`H`],"ta-IN":[`hB`,`h`,`hb`,`H`],"te-IN":[`hB`,`h`,`H`],"zu-ZA":[`H`,`hB`,`hb`,`h`]};function Hd(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(i===`j`){let a=0;for(;r+1<e.length&&e.charAt(r+1)===i;)a++,r++;let o=1+(a&1),s=a<2?1:3+(a>>1),c=Ud(t);for((c==`H`||c==`k`)&&(s=0);s-->0;)n+=`a`;for(;o-->0;)n=c+n}else n+=i===`J`?`H`:i}return n}function Ud(e){let t=e.hourCycle;if(t===void 0){let n=e;t=n.getHourCycles?.()[0]??n.hourCycles?.[0]}if(t)switch(t){case`h24`:return`k`;case`h23`:return`H`;case`h12`:return`h`;case`h11`:return`K`;default:throw Error(`Invalid hourCycle`)}let n=e.language,r;return n!==`root`&&(r=e.maximize().region),(Vd[`${n}-${r}`]||Vd[r||``]||Vd[n||``]||Vd[`${n}-001`]||Vd[`001`])[0].charAt(0)}var Wd=RegExp(`^${zd.source}*`),Gd=RegExp(`${zd.source}*$`);function V(e,t){return{start:e,end:t}}var Kd=!!Object.fromEntries,qd=!!String.prototype.trimStart,Jd=!!String.prototype.trimEnd,Yd=Kd?Object.fromEntries:function(e){let t={};for(let[n,r]of e)t[n]=r;return t},Xd=qd?function(e){return e.trimStart()}:function(e){return e.replace(Wd,``)},Zd=Jd?function(e){return e.trimEnd()}:function(e){return e.replace(Gd,``)},Qd=$d();function $d(){try{let e=RegExp(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`,`yu`);if(e.exec(`a `)?.[1]===`a`)return e}catch{}return Bd}function ef(e,t){return Qd.lastIndex=t,Qd.exec(e)[1]??``}function tf(e){if(e.length===0)return null;let t=1,n=1;for(let r=0;r<e.length;){let i=e.charCodeAt(r);switch(i){case 35:case 39:case 60:case 123:case 125:return null}if(i===10)t++,n=1,r++;else if(n++,i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);r+=t>=56320&&t<=57343?2:1}else r++}return{offset:e.length,line:t,column:n}}var nf=class{constructor(e,t={}){this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}parse(){if(this.offset()!==0)throw Error(`parser can only be used once`);if(this.message.length>0){let e=this.message.charCodeAt(0);if(e!==35&&e!==39&&e!==60&&e!==123&&e!==125){let e=tf(this.message);if(e){let t=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:V(t,this.clonePosition())}],err:null}}}}return this.parseMessage(0,``,!1)}parseMessage(e,t,n){let r=[];for(;!this.isEOF();){let i=this.char();if(i===123){let t=this.parseArgument(e,n);if(t.err)return t;r.push(t.val)}else if(i===125&&e>0)break;else if(i===35&&(t===`plural`||t===`selectordinal`)){let e=this.clonePosition();this.bump(),r.push({type:7,location:V(e,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,V(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&rf(this.peek()||0)){let n=this.parseTag(e,t);if(n.err)return n;r.push(n.val)}else{let n=this.parseLiteral(e,t);if(n.err)return n;r.push(n.val)}}return{val:r,err:null}}parseTag(e,t){let n=this.clonePosition();this.bump();let r=this.parseTagName();if(this.bumpSpace(),this.bumpIf(`/>`))return{val:{type:0,value:`<${r}/>`,location:V(n,this.clonePosition())},err:null};if(this.bumpIf(`>`)){let i=this.parseMessage(e+1,t,!0);if(i.err)return i;let a=i.val,o=this.clonePosition();if(this.bumpIf(`</`)){if(this.isEOF()||!rf(this.char()))return this.error(23,V(o,this.clonePosition()));let e=this.clonePosition();return r===this.parseTagName()?(this.bumpSpace(),this.bumpIf(`>`)?{val:{type:8,value:r,children:a,location:V(n,this.clonePosition())},err:null}:this.error(23,V(o,this.clonePosition()))):this.error(26,V(e,this.clonePosition()))}return this.error(27,V(n,this.clonePosition()))}return this.error(23,V(n,this.clonePosition()))}parseTagName(){let e=this.offset();for(this.bump();!this.isEOF()&&of(this.char());)this.bump();return this.message.slice(e,this.offset())}parseLiteral(e,t){let n=this.clonePosition(),r=``;for(;;){let n=this.tryParseQuote(t);if(n){r+=n;continue}let i=this.tryParseUnquoted(e,t);if(i){r+=i;continue}let a=this.tryParseLeftAngleBracket();if(a){r+=a;continue}break}let i=V(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!af(this.peek()||0))?(this.bump(),`<`):null}tryParseQuote(e){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),`'`;case 123:case 60:case 62:case 125:break;case 35:if(e===`plural`||e===`selectordinal`)break;return null;default:return null}this.bump();let t=[this.char()];for(this.bump();!this.isEOF();){let e=this.char();if(e===39){if(this.peek()===39)t.push(39),this.bump();else{this.bump();break}}else t.push(e);this.bump()}return String.fromCodePoint(...t)}tryParseUnquoted(e,t){if(this.isEOF())return null;let n=this.char();return n===60||n===123||n===35&&(t===`plural`||t===`selectordinal`)||n===125&&e>0?null:(this.bump(),String.fromCodePoint(n))}parseArgument(e,t){let n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(1,V(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,V(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,V(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,V(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:V(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,V(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(3,V(n,this.clonePosition()))}}parseIdentifierIfPossible(){let e=this.clonePosition(),t=this.offset(),n=ef(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:V(e,this.clonePosition())}}parseArgumentOptions(e,t,n,r){let i=this.clonePosition(),a=this.parseIdentifierIfPossible().value,o=this.clonePosition();switch(a){case``:return this.error(4,V(i,o));case`number`:case`date`:case`time`:{this.bumpSpace();let e=null;if(this.bumpIf(`,`)){this.bumpSpace();let t=this.clonePosition(),n=this.parseSimpleArgStyleIfPossible();if(n.err)return n;let r=Zd(n.val);if(r.length===0)return this.error(6,V(this.clonePosition(),this.clonePosition()));e={style:r,styleLocation:V(t,this.clonePosition())}}let t=this.tryParseArgumentClose(r);if(t.err)return t;let i=V(r,this.clonePosition());if(e&&e.style.startsWith(`::`)){let t=Xd(e.style.slice(2));if(a===`number`){let r=this.parseNumberSkeletonFromString(t,e.styleLocation);return r.err?r:{val:{type:2,value:n,location:i,style:r.val},err:null}}{if(t.length===0)return this.error(10,i);let r=t;this.locale&&(r=Hd(t,this.locale));let o={type:1,pattern:r,location:e.styleLocation,parsedOptions:this.shouldParseSkeletons?md(r):{}};return{val:{type:a===`date`?3:4,value:n,location:i,style:o},err:null}}}return{val:{type:a===`number`?2:a===`date`?3:4,value:n,location:i,style:e?.style??null},err:null}}case`plural`:case`selectordinal`:case`select`:{let i=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(`,`))return this.error(12,V(i,{...i}));this.bumpSpace();let o=this.parseIdentifierIfPossible(),s=0;if(a!==`select`&&o.value===`offset`){if(!this.bumpIf(`:`))return this.error(13,V(this.clonePosition(),this.clonePosition()));this.bumpSpace();let e=this.tryParseDecimalInteger(13,14);if(e.err)return e;this.bumpSpace(),o=this.parseIdentifierIfPossible(),s=e.val}let c=this.tryParsePluralOrSelectOptions(e,a,t,o);if(c.err)return c;let l=this.tryParseArgumentClose(r);if(l.err)return l;let u=V(r,this.clonePosition());return a===`select`?{val:{type:5,value:n,options:Yd(c.val),location:u},err:null}:{val:{type:6,value:n,options:Yd(c.val),offset:s,pluralType:a===`plural`?`cardinal`:`ordinal`,location:u},err:null}}default:return this.error(5,V(i,o))}}tryParseArgumentClose(e){return this.isEOF()||this.char()!==125?this.error(1,V(e,this.clonePosition())):(this.bump(),{val:!0,err:null})}parseSimpleArgStyleIfPossible(){let e=0,t=this.clonePosition();for(;!this.isEOF();)switch(this.char()){case 39:{this.bump();let e=this.clonePosition();if(!this.bumpUntil(`'`))return this.error(11,V(e,this.clonePosition()));this.bump();break}case 123:e+=1,this.bump();break;case 125:if(e>0)--e;else return{val:this.message.slice(t.offset,this.offset()),err:null};break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}}parseNumberSkeletonFromString(e,t){let n=[];try{n=gd(e)}catch{return this.error(7,t)}return{val:{type:0,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?Ed(n):{}},err:null}}tryParsePluralOrSelectOptions(e,t,n,r){let i=!1,a=[],o=new Set,{value:s,location:c}=r;for(;;){if(s.length===0){let e=this.clonePosition();if(t!==`select`&&this.bumpIf(`=`)){let t=this.tryParseDecimalInteger(16,19);if(t.err)return t;c=V(e,this.clonePosition()),s=this.message.slice(e.offset,this.offset())}else break}if(o.has(s))return this.error(t===`select`?21:20,c);s===`other`&&(i=!0),this.bumpSpace();let r=this.clonePosition();if(!this.bumpIf(`{`))return this.error(t===`select`?17:18,V(this.clonePosition(),this.clonePosition()));let l=this.parseMessage(e+1,t,n);if(l.err)return l;let u=this.tryParseArgumentClose(r);if(u.err)return u;a.push([s,{value:l.val,location:V(r,this.clonePosition())}]),o.add(s),this.bumpSpace(),{value:s,location:c}=this.parseIdentifierIfPossible()}return a.length===0?this.error(t===`select`?15:16,V(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,V(this.clonePosition(),this.clonePosition())):{val:a,err:null}}tryParseDecimalInteger(e,t){let n=1,r=this.clonePosition();this.bumpIf(`+`)||this.bumpIf(`-`)&&(n=-1);let i=!1,a=0;for(;!this.isEOF();){let e=this.char();if(e>=48&&e<=57)i=!0,a=a*10+(e-48),this.bump();else break}let o=V(r,this.clonePosition());return i?(a*=n,Number.isSafeInteger(a)?{val:a,err:null}:this.error(t,o)):this.error(e,o)}offset(){return this.position.offset}isEOF(){return this.offset()===this.message.length}clonePosition(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}}char(){let e=this.position.offset;if(e>=this.message.length)throw Error(`out of bound`);let t=this.message.codePointAt(e);if(t===void 0)throw Error(`Offset ${e} is at invalid UTF-16 code unit boundary`);return t}error(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}}bump(){if(this.isEOF())return;let e=this.char();e===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}bumpIf(e){let t=this.offset();if(this.message.slice(t,t+e.length)===e){for(let t=0;t<e.length;t++)this.bump();return!0}return!1}bumpUntil(e){let t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)}bumpTo(e){if(this.offset()>e)throw Error(`targetOffset ${e} must be greater than or equal to the current offset ${this.offset()}`);for(e=Math.min(e,this.message.length);;){let t=this.offset();if(t===e)break;if(t>e)throw Error(`targetOffset ${e} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}}bumpSpace(){for(;!this.isEOF()&&sf(this.char());)this.bump()}peek(){if(this.isEOF())return null;let e=this.char(),t=this.offset();return this.message.charCodeAt(t+(e>=65536?2:1))??null}};function rf(e){return e>=97&&e<=122||e>=65&&e<=90}function af(e){return rf(e)||e===47}function of(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function sf(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function cf(e){e.forEach(e=>{if(delete e.location,Nd(e)||Pd(e))for(let t in e.options)delete e.options[t].location,cf(e.options[t].value);else Ad(e)&&Ld(e.style)||(jd(e)||Md(e))&&Rd(e.style)?delete e.style.location:Id(e)&&cf(e.children)})}function lf(e,t={}){t={shouldParseSkeletons:!0,requiresOtherClause:!0,...t};let n=new nf(e,t).parse();if(n.err){let e=SyntaxError(Dd[n.err.kind]);throw e.location=n.err.location,e.originalMessage=n.err.message,e}return t?.captureLocation||cf(n.val),n.val}var uf=class extends Error{constructor(e,t,n){super(e),this.code=t,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},df=class extends uf{constructor(e,t,n,r){super(`Invalid values for "${e}": "${t}". Options are "${Object.keys(n).join(`", "`)}"`,`INVALID_VALUE`,r)}},ff=class extends uf{constructor(e,t,n){super(`Value for "${e}" must be of type ${t}`,`INVALID_VALUE`,n)}},pf=class extends uf{constructor(e,t){super(`The intl string context variable "${e}" was not provided to the string "${t}"`,`MISSING_VALUE`,t)}};function mf(e){return e.length<2?e:e.reduce((e,t)=>{let n=e[e.length-1];return!n||n.type!==0||t.type!==0?e.push(t):n.value+=t.value,e},[])}function hf(e){return typeof e==`function`}function gf(e,t,n,r,i,a,o){if(e.length===1&&Od(e[0]))return[{type:0,value:e[0].value}];let s=[];for(let c of e){if(Od(c)){s.push({type:0,value:c.value});continue}if(Fd(c)){typeof a==`number`&&s.push({type:0,value:n.getNumberFormat(t).format(a)});continue}let{value:e}=c;if(!(i&&e in i))throw new pf(e,o);let l=i[e];if(kd(c)){(!l||typeof l==`string`||typeof l==`number`||typeof l==`bigint`)&&(l=typeof l==`string`||typeof l==`number`||typeof l==`bigint`?String(l):``),s.push({type:typeof l==`string`?0:1,value:l});continue}if(jd(c)){let e=typeof c.style==`string`?r.date[c.style]:Rd(c.style)?c.style.parsedOptions:void 0;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)});continue}if(Md(c)){let e=typeof c.style==`string`?r.time[c.style]:Rd(c.style)?c.style.parsedOptions:r.time.medium;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)});continue}if(Ad(c)){let e=typeof c.style==`string`?r.number[c.style]:Ld(c.style)?c.style.parsedOptions:void 0;if(e&&e.scale){let t=e.scale||1;if(typeof l==`bigint`){if(!Number.isInteger(t))throw TypeError(`Cannot apply fractional scale ${t} to bigint value. Scale must be an integer when formatting bigint.`);l*=BigInt(t)}else l*=t}s.push({type:0,value:n.getNumberFormat(t,e).format(l)});continue}if(Id(c)){let{children:e,value:l}=c,u=i[l];if(!hf(u))throw new ff(l,`function`,o);let d=u(gf(e,t,n,r,i,a).map(e=>e.value));Array.isArray(d)||(d=[d]),s.push(...d.map(e=>({type:typeof e==`string`?0:1,value:e})))}if(Nd(c)){let e=l,a=(Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0)||c.options.other;if(!a)throw new df(c.value,l,Object.keys(c.options),o);s.push(...gf(a.value,t,n,r,i));continue}if(Pd(c)){let e=`=${l}`,a=Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0;if(!a){if(!Intl.PluralRules)throw new uf(`Intl.PluralRules is not available in this environment.
|
|
13
13
|
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
14
|
-
`,`MISSING_INTL_API`,o);let e=typeof l==`bigint`?Number(l):l,r=n.getPluralRules(t,{type:c.pluralType}).select(e-(c.offset||0));a=(Object.prototype.hasOwnProperty.call(c.options,r)?c.options[r]:void 0)||c.options.other}if(!a)throw new df(c.value,l,Object.keys(c.options),o);let u=typeof l==`bigint`?Number(l):l;s.push(...gf(a.value,t,n,r,i,u-(c.offset||0)));continue}}return mf(s)}function _f(e,t){return t?{...e,...t,...Object.keys(e).reduce((n,r)=>(n[r]={...e[r],...t[r]},n),{})}:e}function vf(e,t){return t?Object.keys(e).reduce((n,r)=>(n[r]=_f(e[r],t[r]),n),{...e}):e}function yf(e){return{create(){return{get(t){return e[t]},set(t,n){e[t]=n}}}}}function bf(e={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:td((...e)=>new Intl.NumberFormat(...e),{cache:yf(e.number),strategy:fd.variadic}),getDateTimeFormat:td((...e)=>new Intl.DateTimeFormat(...e),{cache:yf(e.dateTime),strategy:fd.variadic}),getPluralRules:td((...e)=>new Intl.PluralRules(...e),{cache:yf(e.pluralRules),strategy:fd.variadic})}}var xf=class e{constructor(t,n=e.defaultLocale,r,i){if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=(e=>{let t=this.formatToParts(e);if(t.length===1)return t[0].value;let n=t.reduce((e,t)=>(!e.length||t.type!==0||typeof e[e.length-1]!=`string`?e.push(t.value):e[e.length-1]+=t.value,e),[]);return n.length<=1?n[0]||``:n}),this.formatToParts=(e=>gf(this.ast,this.locales,this.formatters,this.formats,e,void 0,this.message)),this.resolvedOptions=()=>({locale:this.resolvedLocale?.toString()||Intl.NumberFormat.supportedLocalesOf(this.locales)[0]}),this.getAst=()=>this.ast,this.locales=n,this.resolvedLocale=e.resolveLocale(n),typeof t==`string`){if(this.message=t,!e.__parse)throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");let{...n}=i||{};this.ast=e.__parse(t,{...n,locale:this.resolvedLocale})}else this.ast=t;if(!Array.isArray(this.ast))throw TypeError(`A message must be provided as a String or AST.`);this.formats=vf(e.formats,r),this.formatters=i&&i.formatters||bf(this.formatterCache)}static{this.memoizedDefaultLocale=null}static get defaultLocale(){return e.memoizedDefaultLocale||=new Intl.NumberFormat().resolvedOptions().locale,e.memoizedDefaultLocale}static{this.resolveLocale=e=>{if(Intl.Locale===void 0)return;let t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale(typeof e==`string`?e:e[0])}}static{this.__parse=lf}static{this.formats={number:{integer:{maximumFractionDigits:0},currency:{style:`currency`},percent:{style:`percent`}},date:{short:{month:`numeric`,day:`numeric`,year:`2-digit`},medium:{month:`short`,day:`numeric`,year:`numeric`},long:{month:`long`,day:`numeric`,year:`numeric`},full:{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}},time:{short:{hour:`numeric`,minute:`numeric`},medium:{hour:`numeric`,minute:`numeric`,second:`numeric`},long:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`},full:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`}}}}};function Sf(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}var Cf=Sf({CHALLENGE_NOT_FOUND:`Challenge not found`,YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:`You are not allowed to register this passkey`,FAILED_TO_VERIFY_REGISTRATION:`Failed to verify registration`,PASSKEY_NOT_FOUND:`Passkey not found`,AUTHENTICATION_FAILED:`Authentication failed`,UNABLE_TO_CREATE_SESSION:`Unable to create session`,USER_NOT_FOUND:`User not found`,FAILED_TO_UPDATE_PASSKEY:`Failed to update passkey`,PREVIOUSLY_REGISTERED:`Previously registered`,REGISTRATION_CANCELLED:`Registration cancelled`,AUTH_CANCELLED:`Auth cancelled`,UNKNOWN_ERROR:`Unknown error`,SESSION_REQUIRED:`Passkey registration requires an authenticated session`,RESOLVE_USER_REQUIRED:`Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false`,RESOLVED_USER_INVALID:`Resolved user is invalid`}),wf=`1.7.12`;function Tf(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ef(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function Df(){return Of.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var Of={stubThis:e=>e};function kf(e){let{id:t}=e;return{...e,id:Ef(t),transports:e.transports}}function Af(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var jf=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function Mf({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new jf({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new jf({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new jf({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new jf({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new jf({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new jf({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new jf({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new jf({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Af(t))return new jf({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new jf({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new jf({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new jf({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var Nf=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},Pf=[`cross-platform`,`platform`];function Ff(e){if(e&&!(Pf.indexOf(e)<0))return e}async function If(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!Df())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Ef(t.challenge),user:{...t.user,id:Ef(t.user.id)},excludeCredentials:t.excludeCredentials?.map(kf)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Nf.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Mf({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){Lf(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Tf(e))}catch(e){Lf(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Tf(c.getAuthenticatorData())}catch(e){Lf(`getAuthenticatorData()`,e)}return{id:o,rawId:Tf(s),response:{attestationObject:Tf(c.attestationObject),clientDataJSON:Tf(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Ff(a.authenticatorAttachment)}}function Lf(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function Rf(){if(!Df())return zf.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?zf.stubThis(new Promise(e=>e(!1))):zf.stubThis(e.isConditionalMediationAvailable())}var zf={stubThis:e=>e};function Bf({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new jf({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new jf({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Af(t))return new jf({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new jf({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new jf({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Vf(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!Df())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(kf));let a={...t,challenge:Ef(t.challenge),allowCredentials:i},o={};if(n){if(!await Rf())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=Nf.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Bf({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Tf(u.userHandle)),{id:c,rawId:Tf(l),response:{authenticatorData:Tf(u.authenticatorData),clientDataJSON:Tf(u.clientDataJSON),signature:Tf(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Ff(s.authenticatorAttachment)}}var Hf=`1.7.12`,Uf=Symbol.for(`better-auth:broadcast-channel`),Wf=()=>Math.floor(Date.now()/1e3),Gf=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(typeof window<`u`)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Wf()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event===`session`&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function Kf(e=`better-auth.message`){return globalThis[Uf]||(globalThis[Uf]=new Gf(e)),globalThis[Uf]}var qf=[],Jf=0,Yf=null,Xf=4,Zf=globalThis.nanostoresGlobal||={epoch:0},Qf=()=>{let e,t;for(;Jf<qf.length;){t=Jf,Jf+=Xf;let n=Yf?.get(qf[t]);if(n){if(!n.has(qf[t+1]))continue;n.clear()}try{qf[t](qf[t+1].value,qf[t+2],qf[t+3])}catch(t){e=t}}if(qf.length=Jf=0,e)throw e},$f=e=>{let t=[],n={eq:Object.is,get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{Yf?.get(e)?.delete(n);for(let t=Jf;t<qf.length;)qf[t]===e&&qf[t+1]===n?qf.splice(t,Xf):t+=Xf;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){Zf.epoch++;let i=!qf.length&&!0;for(let i of t)qf.push(i,n,e,r);i&&Qf()},off(){},set(e){let t=n.value;n.eq(t,e)||(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},ep=2,tp=5,np=6,rp=10,ip=(e,t,n,r)=>(e.events=e.events||{},e.events[n+rp]||(e.events[n+rp]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);~i&&(r.splice(i,1),r.length||(e.events[n+rp](),delete e.events[n+rp]))}),ap=(e,t)=>ip(e,t,ep,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),op=1e3,sp=(e,t)=>ip(e,n=>{let r=t(n);r&&e.events[np].push(r)},tp,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[np]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[np])t();e.events[np]=[]}},op)},()=>{e.listen=n,e.off=r}});function cp(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function lp(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!lp(e[n],t[n]))return!1;return!0}if(cp(e)&&cp(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!lp(e[r],t[r]))return!1;return!0}return!1}function up(e,t){return ap(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var dp=Symbol.for(`better-auth:focus-manager`),fp=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function pp(){return globalThis[dp]||(globalThis[dp]=new fp),globalThis[dp]}var mp=Symbol.for(`better-auth:online-manager`),hp=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function gp(){return globalThis[mp]||(globalThis[mp]=new hp),globalThis[mp]}var _p={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},vp=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,yp={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},bp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function xp(e){return e instanceof Date&&!isNaN(e.getTime())}function Sp(e){let t=bp.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return xp(f)?f:null}function Cp(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in yp)return yp[s];if(!vp.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(_p).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Sp(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function wp(e,t={strict:!0}){return Cp(e,t)}var Tp=Symbol.for(`better-auth:auth-query`);function Ep(e){let t=$f(e);return Object.defineProperty(t,Tp,{value:!0}),t}var Dp=()=>typeof window>`u`;function Op(e,t){return lp(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var kp=(e,t,n,r)=>{let i=Ep({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>o(e)});sp(i,()=>up(i,Op));let a=0,o=async e=>{let o=++a;return new Promise(s=>{let c=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...c,query:{...c?.query,...e?.query},async onSuccess(e){if(o===a){let t=i.get(),n=t.data!=null&&e.data!=null&&lp(t.data,e.data)?t.data:e.data;i.set({data:n,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}await c?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(!(n&&r<n)){if(o===a){let t=e.error.status===401;i.set({error:e.error,data:t?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}await c?.onError?.(e)}},async onRequest(e){if(o===a){let e=i.get();i.set({isPending:e.data===null,data:e.data,error:null,isRefetching:!0,refetch:i.value.refetch})}await c?.onRequest?.(e)}}).catch(e=>{o===a&&i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{s(void 0)})})};e=Array.isArray(e)?e:[e];let s=!1,c=!1,l=!1,u=()=>{if(s){l=!0;return}s=!0,o().finally(()=>{s=!1;let e=l&&c;l=!1,e&&u()})};return sp(i,()=>{if(Dp())return;c=!0;let t=!1,n,r=e.map(e=>e.listen(()=>{t?o():(t=!0,clearTimeout(n),u())}));return n=setTimeout(()=>{t=!0,u()},0),()=>{c=!1;for(let e of r)e();clearTimeout(n)}}),i},Ap=()=>Math.floor(Date.now()/1e3),jp=5;function Mp(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||gp().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=Ap(),t();return}if(e?.event===`visibilitychange`){if(Ap()-c.lastSessionRequest<jp)return;c.lastSessionRequest=Ap(),t();return}t()}},d=e=>{Kf().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=Kf().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=pp().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=gp().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=Kf().setup(),c.cleanupFocusSetup=pp().setup(),c.cleanupOnlineSetup=gp().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Np=Object.create(null),Pp=e=>({}),Fp=new Proxy(Np,{get(e,t){return Pp()[t]??Np[t]},has(e,t){return t in Pp()||t in Np},set(e,t,n){let r=Pp(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=Pp(!0);return delete n[t],!0},ownKeys(){let e=Pp(!0);return Object.keys(e)}});Fp.NODE_ENV;function Ip(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return Ip(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return Ip(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return Ip(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return Ip(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return Ip(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return Ip(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return Ip(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function Lp(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Rp(e){let t=e.split(`
|
|
14
|
+
`,`MISSING_INTL_API`,o);let e=typeof l==`bigint`?Number(l):l,r=n.getPluralRules(t,{type:c.pluralType}).select(e-(c.offset||0));a=(Object.prototype.hasOwnProperty.call(c.options,r)?c.options[r]:void 0)||c.options.other}if(!a)throw new df(c.value,l,Object.keys(c.options),o);let u=typeof l==`bigint`?Number(l):l;s.push(...gf(a.value,t,n,r,i,u-(c.offset||0)));continue}}return mf(s)}function _f(e,t){return t?{...e,...t,...Object.keys(e).reduce((n,r)=>(n[r]={...e[r],...t[r]},n),{})}:e}function vf(e,t){return t?Object.keys(e).reduce((n,r)=>(n[r]=_f(e[r],t[r]),n),{...e}):e}function yf(e){return{create(){return{get(t){return e[t]},set(t,n){e[t]=n}}}}}function bf(e={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:td((...e)=>new Intl.NumberFormat(...e),{cache:yf(e.number),strategy:fd.variadic}),getDateTimeFormat:td((...e)=>new Intl.DateTimeFormat(...e),{cache:yf(e.dateTime),strategy:fd.variadic}),getPluralRules:td((...e)=>new Intl.PluralRules(...e),{cache:yf(e.pluralRules),strategy:fd.variadic})}}var xf=class e{constructor(t,n=e.defaultLocale,r,i){if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=(e=>{let t=this.formatToParts(e);if(t.length===1)return t[0].value;let n=t.reduce((e,t)=>(!e.length||t.type!==0||typeof e[e.length-1]!=`string`?e.push(t.value):e[e.length-1]+=t.value,e),[]);return n.length<=1?n[0]||``:n}),this.formatToParts=(e=>gf(this.ast,this.locales,this.formatters,this.formats,e,void 0,this.message)),this.resolvedOptions=()=>({locale:this.resolvedLocale?.toString()||Intl.NumberFormat.supportedLocalesOf(this.locales)[0]}),this.getAst=()=>this.ast,this.locales=n,this.resolvedLocale=e.resolveLocale(n),typeof t==`string`){if(this.message=t,!e.__parse)throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");let{...n}=i||{};this.ast=e.__parse(t,{...n,locale:this.resolvedLocale})}else this.ast=t;if(!Array.isArray(this.ast))throw TypeError(`A message must be provided as a String or AST.`);this.formats=vf(e.formats,r),this.formatters=i&&i.formatters||bf(this.formatterCache)}static{this.memoizedDefaultLocale=null}static get defaultLocale(){return e.memoizedDefaultLocale||=new Intl.NumberFormat().resolvedOptions().locale,e.memoizedDefaultLocale}static{this.resolveLocale=e=>{if(Intl.Locale===void 0)return;let t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale(typeof e==`string`?e:e[0])}}static{this.__parse=lf}static{this.formats={number:{integer:{maximumFractionDigits:0},currency:{style:`currency`},percent:{style:`percent`}},date:{short:{month:`numeric`,day:`numeric`,year:`2-digit`},medium:{month:`short`,day:`numeric`,year:`numeric`},long:{month:`long`,day:`numeric`,year:`numeric`},full:{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}},time:{short:{hour:`numeric`,minute:`numeric`},medium:{hour:`numeric`,minute:`numeric`,second:`numeric`},long:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`},full:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`}}}}},Sf=`modulepreload`,Cf=function(e){return`/`+e},wf={},Tf=function(e){return e.pathname.endsWith(`.css`)},Ef=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Cf(t,n);let r=s(t);if(r.href in wf)return;wf[r.href]=!0;let i=Tf(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:Sf,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Df(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}var Of=Df({CHALLENGE_NOT_FOUND:`Challenge not found`,YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:`You are not allowed to register this passkey`,FAILED_TO_VERIFY_REGISTRATION:`Failed to verify registration`,PASSKEY_NOT_FOUND:`Passkey not found`,AUTHENTICATION_FAILED:`Authentication failed`,UNABLE_TO_CREATE_SESSION:`Unable to create session`,USER_NOT_FOUND:`User not found`,FAILED_TO_UPDATE_PASSKEY:`Failed to update passkey`,PREVIOUSLY_REGISTERED:`Previously registered`,REGISTRATION_CANCELLED:`Registration cancelled`,AUTH_CANCELLED:`Auth cancelled`,UNKNOWN_ERROR:`Unknown error`,SESSION_REQUIRED:`Passkey registration requires an authenticated session`,RESOLVE_USER_REQUIRED:`Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false`,RESOLVED_USER_INVALID:`Resolved user is invalid`}),kf=`1.7.12`;function Af(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function jf(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function Mf(){return Nf.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var Nf={stubThis:e=>e};function Pf(e){let{id:t}=e;return{...e,id:jf(t),transports:e.transports}}function Ff(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var If=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function Lf({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new If({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new If({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new If({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new If({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new If({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new If({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new If({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new If({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Ff(t))return new If({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new If({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new If({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new If({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var Rf=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},zf=[`cross-platform`,`platform`];function Bf(e){if(e&&!(zf.indexOf(e)<0))return e}async function Vf(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!Mf())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:jf(t.challenge),user:{...t.user,id:jf(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Pf)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Rf.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Lf({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){Hf(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Af(e))}catch(e){Hf(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Af(c.getAuthenticatorData())}catch(e){Hf(`getAuthenticatorData()`,e)}return{id:o,rawId:Af(s),response:{attestationObject:Af(c.attestationObject),clientDataJSON:Af(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Bf(a.authenticatorAttachment)}}function Hf(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function Uf(){if(!Mf())return Wf.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Wf.stubThis(new Promise(e=>e(!1))):Wf.stubThis(e.isConditionalMediationAvailable())}var Wf={stubThis:e=>e};function Gf({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new If({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new If({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Ff(t))return new If({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new If({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new If({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Kf(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!Mf())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(Pf));let a={...t,challenge:jf(t.challenge),allowCredentials:i},o={};if(n){if(!await Uf())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=Rf.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Gf({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Af(u.userHandle)),{id:c,rawId:Af(l),response:{authenticatorData:Af(u.authenticatorData),clientDataJSON:Af(u.clientDataJSON),signature:Af(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Bf(s.authenticatorAttachment)}}var qf=`1.7.12`,Jf=Symbol.for(`better-auth:broadcast-channel`),Yf=()=>Math.floor(Date.now()/1e3),Xf=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(typeof window<`u`)try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Yf()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event===`session`&&t?.data&&this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function Zf(e=`better-auth.message`){return globalThis[Jf]||(globalThis[Jf]=new Xf(e)),globalThis[Jf]}var Qf=[],$f=0,ep=null,tp=4,np=globalThis.nanostoresGlobal||={epoch:0},rp=()=>{let e,t;for(;$f<Qf.length;){t=$f,$f+=tp;let n=ep?.get(Qf[t]);if(n){if(!n.has(Qf[t+1]))continue;n.clear()}try{Qf[t](Qf[t+1].value,Qf[t+2],Qf[t+3])}catch(t){e=t}}if(Qf.length=$f=0,e)throw e},ip=e=>{let t=[],n={eq:Object.is,get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{ep?.get(e)?.delete(n);for(let t=$f;t<Qf.length;)Qf[t]===e&&Qf[t+1]===n?Qf.splice(t,tp):t+=tp;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){np.epoch++;let i=!Qf.length&&!0;for(let i of t)Qf.push(i,n,e,r);i&&rp()},off(){},set(e){let t=n.value;n.eq(t,e)||(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},ap=2,op=5,sp=6,cp=10,lp=(e,t,n,r)=>(e.events=e.events||{},e.events[n+cp]||(e.events[n+cp]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);~i&&(r.splice(i,1),r.length||(e.events[n+cp](),delete e.events[n+cp]))}),up=(e,t)=>lp(e,t,ap,t=>{let n=e.set,r=e.setKey;return e.setKey&&=(n,i)=>{let a;if(t({abort:()=>{a=!0},changed:n,newValue:{...e.value,[n]:i}}),!a)return r(n,i)},e.set=e=>{let r;if(t({abort:()=>{r=!0},newValue:e}),!r)return n(e)},()=>{e.set=n,e.setKey=r}}),dp=1e3,fp=(e,t)=>lp(e,n=>{let r=t(n);r&&e.events[sp].push(r)},op,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[sp]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[sp])t();e.events[sp]=[]}},dp)},()=>{e.listen=n,e.off=r}});function pp(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function mp(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!mp(e[n],t[n]))return!1;return!0}if(pp(e)&&pp(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!(r in t)||!mp(e[r],t[r]))return!1;return!0}return!1}function hp(e,t){return up(e,({newValue:n,abort:r})=>{t(e.value,n)&&r()})}var gp=Symbol.for(`better-auth:focus-manager`),_p=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function vp(){return globalThis[gp]||(globalThis[gp]=new _p),globalThis[gp]}var yp=Symbol.for(`better-auth:online-manager`),bp=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function xp(){return globalThis[yp]||(globalThis[yp]=new bp),globalThis[yp]}var Sp={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Cp=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,wp={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},Tp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Ep(e){return e instanceof Date&&!isNaN(e.getTime())}function Dp(e){let t=Tp.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return Ep(f)?f:null}function Op(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim(),s=o.toLowerCase();if(s.length<=9&&s in wp)return wp[s];if(!Cp.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(Sp).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=Dp(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function kp(e,t={strict:!0}){return Op(e,t)}var Ap=Symbol.for(`better-auth:auth-query`);function jp(e){let t=ip(e);return Object.defineProperty(t,Ap,{value:!0}),t}var Mp=()=>typeof window>`u`;function Np(e,t){return mp(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var Pp=(e,t,n,r)=>{let i=jp({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>o(e)});fp(i,()=>hp(i,Np));let a=0,o=async e=>{let o=++a;return new Promise(s=>{let c=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...c,query:{...c?.query,...e?.query},async onSuccess(e){if(o===a){let t=i.get(),n=t.data!=null&&e.data!=null&&mp(t.data,e.data)?t.data:e.data;i.set({data:n,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}await c?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(!(n&&r<n)){if(o===a){let t=e.error.status===401;i.set({error:e.error,data:t?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}await c?.onError?.(e)}},async onRequest(e){if(o===a){let e=i.get();i.set({isPending:e.data===null,data:e.data,error:null,isRefetching:!0,refetch:i.value.refetch})}await c?.onRequest?.(e)}}).catch(e=>{o===a&&i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{s(void 0)})})};e=Array.isArray(e)?e:[e];let s=!1,c=!1,l=!1,u=()=>{if(s){l=!0;return}s=!0,o().finally(()=>{s=!1;let e=l&&c;l=!1,e&&u()})};return fp(i,()=>{if(Mp())return;c=!0;let t=!1,n,r=e.map(e=>e.listen(()=>{t?o():(t=!0,clearTimeout(n),u())}));return n=setTimeout(()=>{t=!0,u()},0),()=>{c=!1;for(let e of r)e();clearTimeout(n)}}),i},Fp=()=>Math.floor(Date.now()/1e3),Ip=5;function Lp(e){let{fetchSession:t,shouldPollSession:n=()=>!0,sessionSignal:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={isInitialized:!1,lastSessionRequest:0},l=()=>s||xp().isOnline,u=e=>{if(l()){if(e?.event===`storage`){t();return}if(e?.event===`poll`){c.lastSessionRequest=Fp(),t();return}if(e?.event===`visibilitychange`){if(Fp()-c.lastSessionRequest<Ip)return;c.lastSessionRequest=Fp(),t();return}t()}},d=e=>{Zf().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{n()&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=Zf().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=vp().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=xp().subscribe(e=>{e&&u({event:`visibilitychange`})})},g=()=>{c.unsubscribeSignal=r.listen(()=>{t()})};return{init:()=>{c.isInitialized||(c.isInitialized=!0,f(),p(),m(),h(),g(),c.cleanupBroadcastSetup=Zf().setup(),c.cleanupFocusSetup=vp().setup(),c.cleanupOnlineSetup=xp().setup())},cleanup:()=>{c.isInitialized&&(c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.unsubscribeSignal&&=(c.unsubscribeSignal(),void 0),c.cleanupBroadcastSetup&&=(c.cleanupBroadcastSetup(),void 0),c.cleanupFocusSetup&&=(c.cleanupFocusSetup(),void 0),c.cleanupOnlineSetup&&=(c.cleanupOnlineSetup(),void 0),c.isInitialized=!1,c.lastSessionRequest=0)},triggerRefetch:u,broadcastSessionUpdate:d}}var Rp=Object.create(null),zp=e=>({}),Bp=new Proxy(Rp,{get(e,t){return zp()[t]??Rp[t]},has(e,t){return t in zp()||t in Rp},set(e,t,n){let r=zp(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=zp(!0);return delete n[t],!0},ownKeys(){let e=zp(!0);return Object.keys(e)}});Bp.NODE_ENV;function Vp(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return Vp(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return Vp(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return Vp(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return Vp(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return Vp(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return Vp(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return Vp(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});function Hp(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function Up(e){let t=e.split(`
|
|
15
15
|
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
16
|
-
at `))}function zp(e,t){class n extends e{#e;constructor(...e){if(Lp()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Rp(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Bp={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};zp(class extends Error{status;body;headers;statusCode;constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Bp[e]){if(super(t?.message,t&&`cause`in t?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,t&&`cause`in t){let{cause:e,...n}=t;this.body=Object.defineProperty(n,"cause",{value:e,writable:!0,configurable:!0});return}this.body=t}},Error);var Vp=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},Hp=47;function Up(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Hp;)t--;return t===e.length?e:e.slice(0,t)}function Wp(e){try{return(Up(new URL(e).pathname)||`/`)!==`/`}catch{throw new Vp(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Gp(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Vp(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof Vp?t:new Vp(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Kp(e,t=`/api/auth`){if(Gp(e),Wp(e))return e;let n=Up(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function qp(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Jp(e,t,n,r,i){if(e)return Kp(e,t);if(r!==!1){let e=Fp.BETTER_AUTH_URL||Fp.NEXT_PUBLIC_BETTER_AUTH_URL||Fp.PUBLIC_BETTER_AUTH_URL||Fp.NUXT_PUBLIC_BETTER_AUTH_URL||Fp.NUXT_PUBLIC_AUTH_URL||(Fp.BASE_URL===`/`?void 0:Fp.BASE_URL);if(e)return Kp(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&qp(o,`proto`)&&qp(a,`host`))try{return Kp(`${o}://${a}`,t)}catch{}if(n){let e=Yp(n.url);if(!e)throw new Vp(`Could not get origin from request. Please provide a valid base URL.`);return Kp(e,t)}if(typeof window<`u`&&window.location)return Kp(window.location.origin,t)}function Yp(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Xp=[`javascript:`,`data:`,`vbscript:`];function Zp(e){let t;try{t=new URL(e)}catch{return!0}return!Xp.includes(t.protocol)}var Qp={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Zp(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},$p=()=>typeof window>`u`,em=op;function tm(e,t){if(typeof window>`u`)return;let n=e.get();n.data===null&&t!==null&&e.set({...n,data:t,error:null,isPending:!1})}function nm(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function rm(e){return!e||e.session===null&&e.user===null?null:e}function im(e,t){return lp(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function am(e,t){let n=$f(!1),r,i=0,a=0;n.listen(()=>{a++,i=0});let o=e=>u(e),s=Ep({data:null,error:null,isPending:!0,isRefetching:!1,refetch:o});up(s,im);let c=async(t,n)=>{let r=s.value;if(s.set({...r,isPending:r.data===null,isRefetching:!0,error:null,refetch:o}),t.aborted)return`aborted`;try{let r=await e(`/get-session`,{method:`GET`,query:n?.query,signal:t});if(t.aborted)return`aborted`;let{data:i,error:a}=nm(r),c=`fresh`;if(i?.needsRefresh)try{let n=await e(`/get-session`,{method:`POST`,signal:t});if(t.aborted)return`aborted`;({data:i,error:a}=nm(n))}catch{if(t.aborted)return`aborted`;c=`stale`}if(a){let e=s.value,t=a?.status===401;return s.set({data:t?null:e.data,error:a,isPending:!1,isRefetching:!1,refetch:o}),`failed`}let l=rm(i),u=s.value,d=u.data!=null&&l!=null&&lp(u.data,l)?u.data:l;return s.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:o}),c}catch(e){if(t.aborted)return`aborted`;let n=s.value;return s.set({data:n.data,error:e,isPending:!1,isRefetching:!1,refetch:o}),`failed`}},l=()=>{let e=s.value.data?.session?.expiresAt,t=e instanceof Date?e.getTime():1/0;return Math.min(Date.now()+em,t)},u=e=>{i=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?`aborted`:c(t.signal,e)),revision:a};r=n;let o=e=>{r===n&&(r=void 0,e===`fresh`&&n.revision===a&&(i=l()))};return n.promise.then(o,()=>o(`failed`)),n.promise.then(()=>void 0)},d=()=>r?.revision===a?r.promise.then(()=>void 0):Date.now()<i?Promise.resolve():u(),f=()=>{};return sp(s,()=>{let e;$p()||(e=setTimeout(()=>{d()},0));let r=Mp({fetchSession:u,shouldPollSession:()=>s.value.data!=null,sessionSignal:n,options:t});return r.init(),f=r.broadcastSessionUpdate,()=>{e&&clearTimeout(e),r.cleanup()}}),{session:s,$sessionSignal:n,broadcastSessionUpdate:e=>f(e)}}function om(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function sm(e,t,n=`.`,r){if(!om(t))return sm(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:om(a)&&om(i[t])?sm(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function cm(e){return(...t)=>t.reduce((t,n)=>sm(t,n,``,e),{})}var lm=cm(),um=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},dm=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let t=await i.init?.call(i,e.toString(),n);n=t.options||n,e=t.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},fm=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},pm=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function mm(e){if(typeof e==`number`)return new fm({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new fm(e);case`exponential`:return new pm(e);default:throw Error(`Invalid retry strategy`)}}var hm=[`get`,`post`,`put`,`patch`,`delete`];function gm(e){if(!e.startsWith(`@`))return{method:void 0,path:e};let t=e.indexOf(`/`),n=e.slice(1,t===-1?void 0:t);return hm.includes(n)?{method:n,path:t===-1?e:e.slice(t+1)}:{method:void 0,path:e}}var _m=e=>e===`.`||e===`..`,vm=e=>e.split(`:`).map(e=>encodeURIComponent(e)).join(`:`);function ym(e,t){let n=t.get(e);if(n===void 0)return vm(e);if(_m(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function bm(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``,{path:o}=gm(e);o!==e&&(e=`/${o}`),a.endsWith(`/`)||(a+=`/`);let[s,c]=e.replace(a,``).split(`?`),l=new URLSearchParams(c);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)l.append(e,n);continue}else n=JSON.stringify(t);l.set(e,n)}let u=new Map;if(r){if(Array.isArray(r)){let e=s.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];u.set(n,String(e))}}else for(let[e,t]of Object.entries(r))u.set(`:${e}`,String(t))}s=s.split(`/`).map(e=>ym(e,u)).join(`/`),s=s.replace(/^\/+/,``);let d=l.toString();return d=d.length>0?`?${d}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${s}${d}`,a):`${a}${s}${d}`}var xm=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Sm=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Cm(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Sm.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function wm(e){try{return JSON.parse(e),!0}catch{return!1}}function Tm(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function Em(e){try{return JSON.parse(e)}catch{return e}}function Dm(e){return typeof e==`function`}function Om(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Dm(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Dm(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function km(...e){let t={};for(let n of e)if(n){if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}}return t}async function Am(e){let t=new Headers(km(e?.headers,await xm(e)));if(!t.has(`content-type`)){let n=jm(e?.body);n&&t.set(`content-type`,n)}return t}function jm(e){return Tm(e)?`application/json`:null}function Mm(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function Nm(e,t){let{body:n}=e;return n?!Tm(n)||typeof n==`string`?n:Mm(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function Pm(e,t){if(t?.method)return t.method.toUpperCase();let{method:n}=gm(e);return n?n.toUpperCase():t?.body?`POST`:`GET`}function Fm(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Im=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Lm(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new Im(n.issues);return n.value}function Rm(e){"@babel/helpers - typeof";return Rm=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Rm(e)}function zm(e,t){if(Rm(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Rm(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Bm(e){var t=zm(e,`string`);return Rm(t)==`symbol`?t:t+``}function Vm(e,t,n){return(t=Bm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Hm(Object(n),!0).forEach(function(t){Vm(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Um=async(e,t)=>{var n;let{hooks:r,url:i,options:a}=await dm(e,t),o=Om(a),s=new AbortController,c=a.signal??s.signal,l=bm(i,a),u=await Am(a),d=Nm(a,u),f=Pm(i,a),p=H(H({},a),{},{url:l,headers:u,body:d,method:f,signal:c});for(let e of r.onRequest)if(e){let t=await e(p);typeof t==`object`&&t&&Object.assign(p,t)}(`pipeTo`in p&&typeof p.pipeTo==`function`||typeof(t==null||(n=t.body)==null?void 0:n.pipe)==`function`)&&(`duplex`in p||(p.duplex=`half`));let{clearTimeout:m}=Fm(a,s),h=await o(p.url,p);m();let g={response:h,request:p};for(let e of r.onResponse)if(e){var _;let n=await e(H(H({},g),{},{response:t!=null&&(_=t.hookOptions)!=null&&_.cloneResponse?h.clone():h}));n instanceof Response?h=n:typeof n==`object`&&n&&(h=n.response)}if(h.ok){if(p.method===`HEAD`)return{data:``,error:null};let e=Cm(h),n={data:null,response:h,request:p};if(e===`json`||e===`text`){let e=await h.text();n.data=await(p.jsonParser??Em)(e)}else n.data=await h[e]();p?.output&&p.output&&!p.disableValidation&&(n.data=await Lm(p.output,n.data));for(let e of r.onSuccess)if(e){var v;await e(H(H({},n),{},{response:t!=null&&(v=t.hookOptions)!=null&&v.cloneResponse?h.clone():h}))}return t?.throw?n.data:{data:n.data,error:null}}let y=t?.jsonParser??Em,b=await h.text(),x=wm(b),S=x?await y(b):null,C={response:h,responseText:b,request:p,error:H(H({},S),{},{status:h.status,statusText:h.statusText})};for(let e of r.onError)if(e){var w;await e(H(H({},C),{},{response:t!=null&&(w=t.hookOptions)!=null&&w.cloneResponse?h.clone():h}))}if(t?.retry){let n=mm(t.retry),i=t.retryAttempt??0;if(await n.shouldAttemptRetry(i,h)){for(let e of r.onRetry)e&&await e(g);let a=n.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Um(e,H(H({},t),{},{retryAttempt:i+1}))}}if(t?.throw)throw new um(h.status,h.statusText,x?S:b);return{data:null,error:H(H({},S),{},{status:h.status,statusText:h.statusText})}},Wm=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){var r;let i=H(H({},n),e.query!==void 0&&{query:H(H({},e.query),n?.query)}),a=((r=e.plugins)==null||(r=r.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1))==null?void 0:r.schema)||e.schema;if(a){let r=t;a.config?.prefix&&r.startsWith(a.config.prefix)&&(r=r.replace(a.config.prefix,``),a.config.baseURL&&(t=t.replace(a.config.prefix,a.config.baseURL))),a.config?.baseURL&&r.startsWith(a.config.baseURL)&&(r=r.replace(a.config.baseURL,``)),r.startsWith(`/`)&&r.charAt(1)===`@`&&(r=r.substring(1));let o=a.schema[r];if(o){let{method:a,path:s}=gm(r);a&&(t=t.slice(0,t.length-r.length)+s);let c=n?.headers;if(o.headers&&!n?.disableValidation){let e={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((t,n)=>{e[n.toLowerCase()]=t});else if(typeof n.headers==`object`)for(let[t,r]of Object.entries(n.headers))r!=null&&(e[t.toLowerCase()]=r)}let t=await Lm(o.headers,e),r={};for(let[e,n]of Object.entries(t))r[e.toLowerCase()]=n;c=r}let l=o.method??a;if(i=H(H(H(H({},i),l!==void 0&&{method:l}),o.output!==void 0&&{output:o.output}),c!==void 0&&{headers:c}),!n?.disableValidation){if(o.query&&(i.query=await Lm(o.query,n?.query),i.query!==null&&typeof i.query==`object`)){let t=H({},e.query);for(let e of Object.keys(t))n?.query&&Object.prototype.hasOwnProperty.call(n.query,e)&&(t[e]=n.query[e]);i.query=H(H({},t),i.query)}i=H(H({},i),{},{body:o.input?await Lm(o.input,n?.body):n?.body,params:o.params?await Lm(o.params,n?.params):n?.params})}return{url:t,options:i}}}return H({url:t},(n!==void 0||e.query!==void 0)&&{options:i})}}),Gm=e=>{async function t(t,n){let r=H(H(H({},e),n),{},{headers:km(e?.headers,n?.headers),plugins:[...e?.plugins||[],Wm(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Um(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await Um(t,r)}return t},Km=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},qm=e=>e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`,Jm=(e,t)=>{let n=`credentials`in Request.prototype,r=Jp(e?.baseURL,e?.basePath,void 0,t)??Km(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=Gm({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?wp(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Qp],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=am(d,e),h=!1,g=e=>{h||e===null||(h=!0,tm(p,e))},_=e?.plugins||[],v={},y={$sessionSignal:f,session:p},b={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},x=[{signal:`$sessionSignal`,matcher:qm,callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of _)e.getAtoms&&Object.assign(y,e.getAtoms?.(d)),e.pathMethods&&Object.assign(b,e.pathMethods),e.atomListeners&&x.push(...e.atomListeners);let S={notify:e=>{y[e].set(!y[e].get())},listen:(e,t)=>{y[e].subscribe(t)},atoms:y};for(let t of _)t.getActions&&(v=lm(t.getActions?.(d,S,e)??{},v));return{get baseURL(){return r},pluginsActions:v,pluginsAtoms:y,pluginPathMethods:b,atomListeners:x,hydrateSession:g,$sessionSignal:f,$fetch:d,$store:S}};function Ym(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function Xm(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Zm=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,Qm=/['\u2019]/g;function $m(e){return e.replace(Qm,``).match(Zm)??[]}function eh(e){return $m(e).map(e=>e.toLowerCase()).join(`-`)}function th(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function nh(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||Ym(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(eh).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=th(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function rh(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,hydrateSession:i,$fetch:a,atomListeners:o,$store:s}=Jm(e),c={};for(let[e,t]of Object.entries(r))c[`use${Xm(e)}`]=t;return nh({...n,...c,hydrateSession:i,$fetch:a,$store:s},a,t,r,o)}var ih=(e,{$listPasskeys:t,$store:n})=>({signIn:{passkey:async(r,i)=>{let a=await e(`/passkey/generate-authenticate-options`,{method:`GET`,throw:!1});if(!a.data)return a;let o=a.data.extensions||r?.extensions?{...a.data.extensions||{},...r?.extensions||{}}:void 0,s;try{s=await Vf({optionsJSON:{...a.data,extensions:o},useBrowserAutofill:r?.autoFill})}catch(e){return{data:null,error:{code:e instanceof jf?e.code:`AUTH_CANCELLED`,message:Cf.AUTH_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}}try{let{clientExtensionResults:a,...o}=s,c=await e(`/passkey/verify-authentication`,{body:{response:o},...r?.fetchOptions,...i,method:`POST`,throw:!1});return t.set(Math.random()),n.notify(`$sessionSignal`),r?.returnWebAuthnResponse?{...c,webauthn:{response:s,clientExtensionResults:a}}:c}catch(e){return console.error(`[Better Auth] Error verifying passkey`,e),{data:null,error:{code:`AUTH_CANCELLED`,message:Cf.AUTH_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}}}},passkey:{addPasskey:async(r,i)=>{let a=await e(`/passkey/generate-register-options`,{method:`GET`,query:{...r?.authenticatorAttachment&&{authenticatorAttachment:r.authenticatorAttachment},...r?.name&&{name:r.name},...r?.context&&{context:r.context}},throw:!1});if(!a.data)return a;try{let o=a.data.extensions||r?.extensions?{...a.data.extensions||{},...r?.extensions||{}}:void 0,s=await If({optionsJSON:{...a.data,extensions:o},useAutoRegister:r?.useAutoRegister}),{clientExtensionResults:c,...l}=s,u=await e(`/passkey/verify-registration`,{...r?.fetchOptions,...i,body:{response:l,name:r?.name,...r?.createSession&&{createSession:!0}},method:`POST`,throw:!1});return u.data?(t.set(Math.random()),u.data.session&&n.notify(`$sessionSignal`),r?.returnWebAuthnResponse?{...u,webauthn:{response:s,clientExtensionResults:c}}:u):u}catch(e){return e instanceof jf?e.code===`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`?{data:null,error:{code:e.code,message:Cf.PREVIOUSLY_REGISTERED.message,status:400,statusText:`BAD_REQUEST`}}:e.code===`ERROR_CEREMONY_ABORTED`?{data:null,error:{code:e.code,message:Cf.REGISTRATION_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}:{data:null,error:{code:e.code,message:e.message,status:400,statusText:`BAD_REQUEST`}}:{data:null,error:{code:`UNKNOWN_ERROR`,message:e instanceof Error?e.message:Cf.UNKNOWN_ERROR.message,status:500,statusText:`INTERNAL_SERVER_ERROR`}}}}},$Infer:{}}),ah=()=>{let e=$f();return{id:`passkey`,version:wf,$InferServerPlugin:{},getActions:(t,n)=>ih(t,{$listPasskeys:e,$store:n}),getAtoms(t){return{listPasskeys:kp(e,`/passkey/list-user-passkeys`,t,{method:`GET`}),$listPasskeys:e}},pathMethods:{"/passkey/register":`POST`,"/passkey/authenticate":`POST`},atomListeners:[{matcher(e){return e===`/passkey/verify-registration`||e===`/passkey/delete-passkey`||e===`/passkey/update-passkey`||e===`/sign-out`},signal:`$listPasskeys`},{matcher:e=>e===`/passkey/verify-authentication`,signal:`$sessionSignal`}],$ERROR_CODES:Cf}},oh=Sf({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),sh=()=>({id:`email-otp`,version:Hf,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/email-otp/verify-email`||e===`/sign-in/email-otp`||e===`/email-otp/request-email-change`,signal:`$sessionSignal`}],$ERROR_CODES:oh}),ch=e=>{let t=e?.jwks?.jwksPath??`/jwks`;return{id:`better-auth-client`,version:Hf,$InferServerPlugin:{},pathMethods:{[t]:`GET`},getActions:(e,n,r)=>({jwks:async n=>await e(t,{method:`GET`,...n})})}},lh=Sf({OTP_NOT_ENABLED:`OTP not enabled`,OTP_NOT_CONFIGURED:`OTP is not available`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TOTP_ALREADY_ENABLED:`TOTP is already enabled`,TOTP_NOT_CONFIGURED:`TOTP is not available`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,ACCOUNT_TEMPORARILY_LOCKED:`Too many failed verification attempts. Your account is temporarily locked. Please try again later.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),uh=e=>({id:`two-factor`,version:Hf,$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith(`/two-factor/`),signal:`$sessionSignal`}],pathMethods:{"/two-factor/disable":`POST`,"/two-factor/enable":`POST`,"/two-factor/send-otp":`POST`,"/two-factor/generate-backup-codes":`POST`,"/two-factor/get-totp-uri":`POST`,"/two-factor/verify-totp":`POST`,"/two-factor/verify-otp":`POST`,"/two-factor/verify-backup-code":`POST`},fetchPlugins:[{id:`two-factor`,name:`two-factor`,hooks:{async onSuccess(t){if(t.data?.twoFactorRedirect){if(e?.onTwoFactorRedirect){await e.onTwoFactorRedirect({twoFactorMethods:t.data.twoFactorMethods});return}e?.twoFactorPage&&typeof window<`u`&&Zp(e.twoFactorPage)&&(window.location.href=e.twoFactorPage)}}}}],$ERROR_CODES:lh}),dh=`modulepreload`,fh=function(e){return`/`+e},ph={},mh=function(e){return e.pathname.endsWith(`.css`)},hh=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=fh(t,n);let r=s(t);if(r.href in ph)return;ph[r.href]=!0;let i=mh(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:dh,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},U=t(i(),1),gh=t(o(),1),_h=U.createContext(void 0),vh=e=>{let t=U.useContext(_h);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yh=({client:e,children:t})=>(U.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,gh.jsx)(_h.Provider,{value:e,children:t})),bh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xh=new class{#e=bh;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Sh(e){setTimeout(e,0)}var Ch=typeof window>`u`||`Deno`in globalThis;function wh(){}function Th(e,t){return typeof e==`function`?e(t):e}function Eh(e){return typeof e==`number`&&e>=0&&e!==1/0}function Dh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Oh(e,t){return typeof e==`function`?e(t):e}function kh(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==jh(o,t.options))return!1}else if(!Nh(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ah(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Mh(t.options.mutationKey)!==Mh(a))return!1}else if(!Nh(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function jh(e,t){return(t?.queryKeyHashFn||Mh)(e)}function Mh(e){return JSON.stringify(e,(e,t)=>Rh(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Nh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!Nh(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Nh(e[r],t[r]))return!1;return!0}return!1}var Ph=Object.prototype.hasOwnProperty;function Fh(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Lh(e)&&Lh(t);if(!r&&!(Rh(e)&&Rh(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ph.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Fh(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ih(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Lh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Rh(e){if(!zh(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!zh(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function zh(e){return Object.prototype.toString.call(e)===`[object Object]`}function Bh(e){return new Promise(t=>{xh.setTimeout(t,e)})}function Vh(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Fh(e,t)}function Hh(e){return e}function Uh(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Wh(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Gh=Symbol();function Kh(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Gh?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qh(e,t){return typeof e==`function`?e(...t):!!e}function Jh(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Yh=()=>Ch,Xh=()=>Yh(),Zh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qh=new class extends Zh{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function $h(e){let t;if(e.then(e=>(t=e,e),wh)?.catch?.(wh),t!==void 0)return{data:t}}function eg(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function tg(e,t,n){let r=e.promise?.then(t).catch(e=>n?.(e)===!1?Promise.reject(e):Promise.reject(Error(`redacted`)));return r?.catch(wh),r}function ng(e,t,n){return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t?t(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:tg(e,t,n)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function rg(e){return e.state.isPaused}function ig(e){return e.state.status===`success`}function ag(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??rg,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[eg(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??ig,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[ng(e,o,a)]:[])}}function og(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?$h(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l,...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l}});c&&!d&&!h&&!g&&l>m.state.dataUpdatedAt&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(wh)})}var sg=Sh;function cg(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sg,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var lg=cg(),ug=new class extends Zh{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dg(e){return Math.min(1e3*2**e,3e4)}function fg(e){return(e??`online`)!==`online`||ug.isOnline()}var pg=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mg(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(wh);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new pg(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Qh.isFocused()&&(e.networkMode===`always`||ug.isOnline())&&e.canRun(),p=()=>fg(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Xh()?0:3),a=e.retryDelay??dg,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Bh(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var hg=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Eh(this.gcTime)&&(this.#e=xh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xh()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(xh.clearTimeout(this.#e),this.#e=void 0)}};function gg(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Jh(e,()=>t.signal,()=>n=!0)},u=Kh(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Wh:Uh;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vg:_g,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_g(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function _g(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vg(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function yg(e,t){return t?_g(e,t)!=null:!1}function bg(e,t){return!t||!e.getPreviousPageParam?!1:vg(e,t)!=null}var xg=class extends hg{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=wg(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=wg(this.options);e.data!==void 0&&(this.setState(Cg(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Vh(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(wh).catch(wh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Oh(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Oh(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Dh(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Kh(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gg(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=mg({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pg&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pg){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Sg(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Cg(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),lg.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Sg(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fg(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Cg(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function wg(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Tg=class extends Zh{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Dg(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Og(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Og(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 Oh(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&&!Ih(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&kg(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Oh(this.options.enabled,this.#t)!==Oh(t.enabled,this.#t)||Oh(this.options.staleTime,this.#t)!==Oh(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Oh(this.options.enabled,this.#t)!==Oh(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ih(this.getCurrentResult(),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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(wh)),t}#h(e){return!Xh()&&Oh(this.options.enabled,this.#t)!==!1&&Eh(e)}#g(){this.#b();let e=Oh(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Dh(this.#r.dataUpdatedAt,e)+1;this.#u=xh.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Oh(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=xh.setInterval(()=>{(this.options.refetchIntervalInBackground||Qh.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(xh.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(xh.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Dg(e,t),o=i&&kg(e,n,t,r);(a||o)&&(l={...l,...Sg(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Vh(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Vh(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ag(e,t),refetch:this.refetch,isEnabled:Oh(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Ih(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);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)})})();lg.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#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()}};function Eg(e,t){return Oh(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Oh(t.retryOnMount,e)!==!1)}function Dg(e,t){return Eg(e,t)||e.state.data!==void 0&&Og(e,t,t.refetchOnMount)}function Og(e,t,n){if(Oh(t.enabled,e)!==!1&&Oh(t.staleTime,e)!==`static`){let r=Oh(n,e);return r===`always`||r!==!1&&Ag(e,t)}return!1}function kg(e,t,n,r){return(e!==t||Oh(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ag(e,n)}function Ag(e,t){return Oh(t.enabled,e)!==!1&&e.isStaleByTime(Oh(t.staleTime,e))}var jg=class extends Tg{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yg(t,n.data),hasPreviousPage:bg(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Mg=class extends hg{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ng(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=mg({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),lg.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ng(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pg=class extends Zh{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Mg({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Fg(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lg.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ah(t,e))}findAll(e={}){return this.getAll().filter(t=>Ah(e,t))}notify(e){lg.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lg.batch(()=>Promise.all(e.map(e=>e.continue().catch(wh))))}};function Fg(e){return e.options.scope?.id}var Ig=class extends Zh{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ih(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Mh(t.mutationKey)!==Mh(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ng();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){lg.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Lg(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Rg=class extends Zh{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,lg.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ih(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Lg(e,n).forEach(e=>{e.destroy()}),Lg(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Fh(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Tg(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&lg.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},zg=class extends Zh{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??jh(r,t),a=this.get(i);return a||(a=new xg({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){lg.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kh(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>kh(e,t)):t}notify(e){lg.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lg.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lg.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Bg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new zg,this.#t=e.mutationCache||new Pg,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Qh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ug.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Oh(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Th(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lg.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;lg.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lg.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=lg.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(wh).catch(wh)}invalidateQueries(e,t={}){return lg.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=lg.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(wh)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(wh)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Oh(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Oh(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(wh).catch(wh)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(wh).catch(wh)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ug.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Mh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Nh(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Mh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Nh(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=jh(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Gh&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Vg=U.createContext(!1),Hg=()=>U.useContext(Vg);Vg.Provider;function Ug(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wg=U.createContext(Ug()),Gg=()=>U.useContext(Wg),Kg=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?qh(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},qg=e=>{U.useEffect(()=>{e.clearReset()},[e])},Jg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||qh(n,[e.error,r])),Yg=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))}},Xg=(e,t)=>e?.suspense&&t.isPending,Zg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Qg({queries:e,...t},n){let r=vh(n),i=Hg(),a=Gg(),o=t.subscribed!==!1,s=U.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Yg(e);let t=r.getQueryCache().get(e.queryHash);Kg(e,a,t)}),qg(a);let[c]=U.useState(()=>new Rg(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;U.useSyncExternalStore(U.useCallback(e=>f?c.subscribe(lg.batchCalls(e)):wh,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>Xg(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Xg(n,e)?Zg(n,new Tg(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Jg({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function $g(e,t,n){let r=Hg(),i=Gg(),a=vh(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Yg(o),Kg(o,i,s),qg(i);let[l]=U.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(U.useSyncExternalStore(U.useCallback(e=>{let t=d?l.subscribe(lg.batchCalls(e)):wh;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),U.useEffect(()=>{l.setOptions(o)},[o,l]),Xg(o,u))throw Zg(o,l,i);if(Jg({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function e_(e,t){return $g(e,Tg,t)}function t_(e,t){let n=vh(t),r=n.getQueryCache();return U.useSyncExternalStore(U.useCallback(e=>r.subscribe(lg.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function n_(e,t){let n=vh(t),[r]=U.useState(()=>new Ig(n,e));U.useEffect(()=>{r.setOptions(e)},[r,e]);let i=U.useSyncExternalStore(U.useCallback(e=>r.subscribe(lg.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=U.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(wh)},[r]);if(i.error&&qh(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function r_(e,t){return $g(e,jg,t)}function i_(e){let{PI:t,min:n,max:r,cos:i,round:a}=Math,o=e[0]|e[1]<<8|e[2]<<16,s=e[3]|e[4]<<8,c=(o&63)/63,l=(o>>6&63)/31.5-1,u=(o>>12&63)/31.5-1,d=(o>>18&31)/31,f=o>>23,p=(s>>3&63)/63,m=(s>>9&63)/63,h=s>>15,g=r(3,h?f?5:7:s&7),_=r(3,h?s&7:f?5:7),v=f?(e[5]&15)/15:1,y=(e[5]>>4)/15,b=f?6:5,x=0,S=(t,n,r)=>{let i=[];for(let a=0;a<n;a++)for(let o=+!a;o*n<t*(n-a);o++)i.push(((e[b+(x>>1)]>>((x++&1)<<2)&15)/7.5-1)*r);return i},C=S(g,_,d),w=S(3,3,p*1.25),T=S(3,3,m*1.25),E=f&&S(5,5,y),D=a_(e),O=a(D>1?32:32*D),k=a(D>1?32/D:32),A=new Uint8Array(O*k*4),j=[],M=[];for(let e=0,a=0;e<k;e++)for(let o=0;o<O;o++,a+=4){let s=c,d=l,p=u,m=v;for(let e=0,n=r(g,f?5:3);e<n;e++)j[e]=i(t/O*(o+.5)*e);for(let n=0,a=r(_,f?5:3);n<a;n++)M[n]=i(t/k*(e+.5)*n);for(let e=0,t=0;e<_;e++)for(let n=+!e,r=M[e]*2;n*_<g*(_-e);n++,t++)s+=C[t]*j[n]*r;for(let e=0,t=0;e<3;e++)for(let n=+!e,r=M[e]*2;n<3-e;n++,t++){let e=j[n]*r;d+=w[t]*e,p+=T[t]*e}if(f)for(let e=0,t=0;e<5;e++)for(let n=+!e,r=M[e]*2;n<5-e;n++,t++)m+=E[t]*j[n]*r;let h=s-2/3*d,y=(3*s-h+p)/2,b=y-p;A[a]=r(0,255*n(1,y)),A[a+1]=r(0,255*n(1,b)),A[a+2]=r(0,255*n(1,h)),A[a+3]=r(0,255*n(1,m))}return{w:O,h:k,rgba:A}}function a_(e){let t=e[3],n=e[2]&128,r=e[4]&128;return(r?n?5:7:t&7)/(r?t&7:n?5:7)}function o_(e,t,n){let r=e*4+1,i=6+t*(5+r),a=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,e>>8,e&255,0,0,t>>8,t&255,8,6,0,0,0,0,0,0,0,i>>>24,i>>16&255,i>>8&255,i&255,73,68,65,84,120,1],o=[0,498536548,997073096,651767980,1994146192,1802195444,1303535960,1342533948,-306674912,-267414716,-690576408,-882789492,-1687895376,-2032938284,-1609899400,-1111625188],s=1,c=0;for(let e=0,i=0,o=r-1;e<t;e++,o+=r-1)for(a.push(e+1<t?0:1,r&255,r>>8,~r&255,r>>8^255,0),c=(c+s)%65521;i<o;i++){let e=n[i]&255;a.push(e),s=(s+e)%65521,c=(c+s)%65521}a.push(c>>8,c&255,s>>8,s&255,0,0,0,0,0,0,0,0,73,69,78,68,174,66,96,130);for(let[e,t]of[[12,29],[37,41+i]]){let n=-1;for(let r=e;r<t;r++)n^=a[r],n=n>>>4^o[n&15],n=n>>>4^o[n&15];n=~n,a[t++]=n>>>24,a[t++]=n>>16&255,a[t++]=n>>8&255,a[t++]=n&255}return`data:image/png;base64,`+btoa(String.fromCharCode(...a))}function s_(e){let t=i_(e);return o_(t.w,t.h,t.rgba)}var c_=r(((t,n)=>{(function(e){if(typeof t==`object`&&n!==void 0)n.exports=e();else if(typeof define==`function`&&define.amd)define([],e);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.jsonata=e()}})(function(){return(function(){function t(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof e==`function`&&e;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,t,n,r,i)}return r[s].exports}for(var o=typeof e==`function`&&e,s=0;s<i.length;s++)a(i[s]);return a}return t})()({1:[function(e,t,n){let r=e("./utils");t.exports=(function(){let e=r.stringToArray,t=[`Zero`,`One`,`Two`,`Three`,`Four`,`Five`,`Six`,`Seven`,`Eight`,`Nine`,`Ten`,`Eleven`,`Twelve`,`Thirteen`,`Fourteen`,`Fifteen`,`Sixteen`,`Seventeen`,`Eighteen`,`Nineteen`],n=[`Zeroth`,`First`,`Second`,`Third`,`Fourth`,`Fifth`,`Sixth`,`Seventh`,`Eighth`,`Ninth`,`Tenth`,`Eleventh`,`Twelfth`,`Thirteenth`,`Fourteenth`,`Fifteenth`,`Sixteenth`,`Seventeenth`,`Eighteenth`,`Nineteenth`],i=[`Twenty`,`Thirty`,`Forty`,`Fifty`,`Sixty`,`Seventy`,`Eighty`,`Ninety`,`Hundred`],a=[`Thousand`,`Million`,`Billion`,`Trillion`];function o(e,r){var o=function(e,r,s){var c=``;if(e<=19)c=(r?` and `:``)+(s?n[e]:t[e]);else if(e<100){let t=Math.floor(e/10),n=e%10;c=(r?` and `:``)+i[t-2],n>0?c+=`-`+o(n,!1,s):s&&(c=c.substring(0,c.length-1)+`ieth`)}else if(e<1e3){let n=Math.floor(e/100),i=e%100;c=(r?`, `:``)+t[n]+` Hundred`,i>0?c+=o(i,!0,s):s&&(c+=`th`)}else{var l=Math.floor(Math.log10(e)/3);l>a.length&&(l=a.length);let t=10**(l*3),n=Math.floor(e/t),i=e-n*t;c=(r?`, `:``)+o(n,!1,!1)+` `+a[l-1],i>0?c+=o(i,!0,s):s&&(c+=`th`)}return c};return o(e,!1,r)}let s=Object.create(null);t.forEach(function(e,t){s[e.toLowerCase()]=t}),n.forEach(function(e,t){s[e.toLowerCase()]=t}),i.forEach(function(e,t){let n=e.toLowerCase();s[n]=(t+2)*10,s[n.substring(0,e.length-1)+`ieth`]=s[n]}),s.hundredth=100,a.forEach(function(e,t){let n=e.toLowerCase(),r=10**((t+1)*3);s[n]=r,s[n+`th`]=r});function c(e){let t=e.split(/,\s|\sand\s|[\s\\-]/).map(e=>s[e]),n=[0];return t.forEach(e=>{if(e<100){let t=n.pop();t>=1e3&&(n.push(t),t=0),n.push(t+e)}else n.push(n.pop()*e)}),n.reduce((e,t)=>e+t,0)}let l=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],u={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function d(e){for(var t=0;t<l.length;t++){let n=l[t];if(e>=n[0])return n[1]+d(e-n[0])}return``}function f(e){for(var t=0,n=1,r=e.length-1;r>=0;r--){let i=e[r],a=u[i];a<n?t-=a:(n=a,t+=a)}return t}function p(e,t){for(var n=[],r=t.charCodeAt(0);e>0;)n.unshift(String.fromCharCode((e-1)%26+r)),e=Math.floor((e-1)/26);return n.join(``)}function m(e,t){for(var n=t.charCodeAt(0),r=0,i=0;i<e.length;i++)r+=(e.charCodeAt(e.length-i-1)-n+1)*26**i;return r}function h(e,t){if(e===void 0)return;e=Math.floor(e);let n=b(t);return v(e,n)}let g={DECIMAL:`decimal`,LETTERS:`letters`,ROMAN:`roman`,WORDS:`words`,SEQUENCE:`sequence`},_={UPPER:`upper`,LOWER:`lower`,TITLE:`title`};function v(t,n){let r,i=t<0;switch(t=Math.abs(t),n.primary){case g.LETTERS:r=p(t,n.case===_.UPPER?`A`:`a`);break;case g.ROMAN:r=d(t),n.case===_.UPPER&&(r=r.toUpperCase());break;case g.WORDS:r=o(t,n.ordinal),n.case===_.UPPER?r=r.toUpperCase():n.case===_.LOWER&&(r=r.toLowerCase());break;case g.DECIMAL:r=``+t;var a=n.mandatoryDigits-r.length;if(a>0&&(r=Array(a+1).join(`0`)+r),n.zeroCode!==48&&(r=e(r).map(e=>String.fromCodePoint(e.codePointAt(0)+n.zeroCode-48)).join(``)),n.regular){let e=Math.floor((r.length-1)/n.groupingSeparators.position);for(let t=e;t>0;t--){let e=r.length-t*n.groupingSeparators.position;r=r.substr(0,e)+n.groupingSeparators.character+r.substr(e)}}else n.groupingSeparators.reverse().forEach(e=>{let t=r.length-e.position;r=r.substr(0,t)+e.character+r.substr(t)});if(n.ordinal){var s={1:`st`,2:`nd`,3:`rd`}[r[r.length-1]];(!s||r.length>1&&r[r.length-2]===`1`)&&(s=`th`),r+=s}break;case g.SEQUENCE:throw{code:`D3130`,value:n.token}}return i&&(r=`-`+r),r}let y=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function b(t){let n={type:`integer`,primary:g.DECIMAL,case:_.LOWER,ordinal:!1},r,i,a=t.lastIndexOf(`;`);switch(a===-1?r=t:(r=t.substring(0,a),i=t.substring(a+1),i[0]===`o`&&(n.ordinal=!0)),r){case`A`:n.case=_.UPPER;case`a`:n.primary=g.LETTERS;break;case`I`:n.case=_.UPPER;case`i`:n.primary=g.ROMAN;break;case`W`:n.case=_.UPPER,n.primary=g.WORDS;break;case`Ww`:n.case=_.TITLE,n.primary=g.WORDS;break;case`w`:n.primary=g.WORDS;break;default:{let t=null,i=0,a=0,o=[],s=0;if(e(r).map(e=>e.codePointAt(0)).reverse().forEach(e=>{let n=!1;for(let r=0;r<y.length;r++){let a=y[r];if(e>=a&&e<=a+9){if(n=!0,i++,s++,t===null)t=a;else if(a!==t)throw{code:`D3131`};break}}n||(e===35?(s++,a++):o.push({position:s,character:String.fromCodePoint(e)}))}),i>0){n.primary=g.DECIMAL,n.zeroCode=t,n.mandatoryDigits=i,n.optionalDigits=a;let e=function(e){if(e.length===0)return 0;let t=e[0].character;for(let n=1;n<e.length;n++)if(e[n].character!==t)return 0;let n=e.map(e=>e.position),r=function(e,t){return t===0?e:r(t,e%t)},i=n.reduce(r);for(let e=1;e<=n.length;e++)if(n.indexOf(e*i)===-1)return 0;return i}(o);e>0?(n.regular=!0,n.groupingSeparators={position:e,character:o[0].character}):(n.regular=!1,n.groupingSeparators=o)}else n.primary=g.SEQUENCE,n.token=r}}return n}let x={Y:`1`,M:`1`,D:`1`,d:`1`,F:`n`,W:`1`,w:`1`,X:`1`,x:`1`,H:`1`,h:`1`,P:`n`,m:`01`,s:`01`,f:`1`,Z:`01:01`,z:`01:01`,C:`n`,E:`n`};function S(e){var t=[];let n={type:`datetime`,parts:t},r=function(n,r){if(r>n){let i=e.substring(n,r);i=i.split(`]]`).join(`]`),t.push({type:`literal`,value:i})}};for(var i=0,a=0;a<e.length;){if(e.charAt(a)===`[`){if(e.charAt(a+1)===`[`){r(i,a),t.push({type:`literal`,value:`[`}),a+=2,i=a;continue}if(r(i,a),i=a,a=e.indexOf(`]`,i),a===-1)throw{code:`D3135`};let n=e.substring(i+1,a);n=n.split(/\s+/).join(``);var o={type:`marker`,component:n.charAt(0)},s=n.lastIndexOf(`,`),c;if(s!==-1){let e=n.substring(s+1),t=e.indexOf(`-`),r,i,a=function(e){if(e!==void 0&&e!==`*`)return parseInt(e)};t===-1?r=e:(r=e.substring(0,t),i=e.substring(t+1)),o.width={min:a(r),max:a(i)},c=n.substring(1,s)}else c=n.substring(1);if(c.length===1)o.presentation1=c;else if(c.length>1){var l=c.charAt(c.length-1);`atco`.indexOf(l)===-1?o.presentation1=c:(o.presentation2=l,l===`o`&&(o.ordinal=!0),o.presentation1=c.substring(0,c.length-1))}else o.presentation1=x[o.component];if(o.presentation1===void 0)throw{code:`D3132`,value:o.component};if(o.presentation1[0]===`n`)o.names=_.LOWER;else if(o.presentation1[0]===`N`)o.names=o.presentation1[1]===`n`?_.TITLE:_.UPPER;else if(`YMDdFWwXxHhmsf`.indexOf(o.component)!==-1){var u=o.presentation1;if(o.presentation2&&(u+=`;`+o.presentation2),o.integerFormat=b(u),o.width&&o.width.min!==void 0&&o.integerFormat.mandatoryDigits<o.width.min&&(o.integerFormat.mandatoryDigits=o.width.min),o.component===`Y`){if(o.n=-1,o.width&&o.width.max!==void 0)o.n=o.width.max,o.integerFormat.mandatoryDigits=o.n;else{var d=o.integerFormat.mandatoryDigits+o.integerFormat.optionalDigits;d>=2&&(o.n=d)}}let e=t[t.length-1];e&&e.integerFormat&&(e.integerFormat.parseWidth=e.integerFormat.mandatoryDigits)}(o.component===`Z`||o.component===`z`)&&(o.integerFormat=b(o.presentation1)),t.push(o),i=a+1}a++}return r(i,a),n}let C=[``,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],w=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],T=864e5,E=function(e){let t=Date.UTC(e.year,e.month);var n=new Date(t).getUTCDay();return n===0&&(n=7),n>4?t+(8-n)*T:t-(n-1)*T},D=function(e,t){return{year:e,month:t,nextMonth:function(){return t===11?D(e+1,0):D(e,t+1)},previousMonth:function(){return t===0?D(e-1,11):D(e,t-1)},nextYear:function(){return D(e+1,t)},previousYear:function(){return D(e-1,t)}}},O=function(e,t){return(t-e)/(T*7)+1},k=(e,t)=>{let n;switch(t){case`Y`:n=e.getUTCFullYear();break;case`M`:n=e.getUTCMonth()+1;break;case`D`:n=e.getUTCDate();break;case`d`:n=(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(e.getUTCFullYear(),0))/T+1;break;case`F`:n=e.getUTCDay(),n===0&&(n=7);break;case`W`:{let t=D(e.getUTCFullYear(),0),r=E(t),i=Date.UTC(t.year,e.getUTCMonth(),e.getUTCDate()),a=O(r,i);if(a>52)i>=E(t.nextYear())&&(a=1);else if(a<1){let e=E(t.previousYear());a=O(e,i)}n=Math.floor(a);break}case`w`:{let t=D(e.getUTCFullYear(),e.getUTCMonth()),r=E(t),i=Date.UTC(t.year,t.month,e.getUTCDate()),a=O(r,i);if(a>4)i>=E(t.nextMonth())&&(a=1);else if(a<1){let e=E(t.previousMonth());a=O(e,i)}n=Math.floor(a);break}case`X`:{let t=D(e.getUTCFullYear(),0),r=E(t),i=E(t.nextYear()),a=e.getTime();n=a<r?t.year-1:a>=i?t.year+1:t.year;break}case`x`:{let t=D(e.getUTCFullYear(),e.getUTCMonth()),r=E(t),i=t.nextMonth(),a=E(i),o=e.getTime();n=o<r?t.previousMonth().month+1:o>=a?i.month+1:t.month+1;break}case`H`:n=e.getUTCHours();break;case`h`:n=e.getUTCHours(),n%=12,n===0&&(n=12);break;case`P`:n=e.getUTCHours()>=12?`pm`:`am`;break;case`m`:n=e.getUTCMinutes();break;case`s`:n=e.getUTCSeconds();break;case`f`:n=e.getUTCMilliseconds();break;case`Z`:case`z`:break;case`C`:n=`ISO`;break;case`E`:n=`ISO`}return n},A=null;function j(e,t,n){var r=0,i=0;if(n!==void 0){let e=parseInt(n);r=Math.floor(e/100),i=e%100}var a=function(e,t){var n=k(e,t.component);if(`YMDdFWwXxHhms`.indexOf(t.component)!==-1){if(t.component===`Y`&&t.n!==-1&&(n%=10**t.n),t.names){if(t.component===`M`||t.component===`x`)n=w[n-1];else if(t.component===`F`)n=C[n];else throw{code:`D3133`,value:t.component};t.names===_.UPPER?n=n.toUpperCase():t.names===_.LOWER&&(n=n.toLowerCase()),t.width&&n.length>t.width.max&&(n=n.substring(0,t.width.max))}else n=v(n,t.integerFormat)}else if(t.component===`f`)n=v(n,t.integerFormat);else if(t.component===`Z`||t.component===`z`){let e=r*100+i;if(t.integerFormat.regular)n=v(e,t.integerFormat);else{let a=t.integerFormat.mandatoryDigits;if(a===1||a===2)n=v(r,t.integerFormat),i!==0&&(n+=`:`+h(i,`00`));else if(a===3||a===4)n=v(e,t.integerFormat);else throw{code:`D3134`,value:a}}e>=0&&(n=`+`+n),t.component===`z`&&(n=`GMT`+n),e===0&&t.presentation2===`t`&&(n=`Z`)}else t.component===`P`&&t.names===_.UPPER&&(n=n.toUpperCase());return n};let o;t===void 0?(A===null&&(A=S(`[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]`)),o=A):o=S(t);let s=(60*r+i)*60*1e3,c=new Date(e+s),l=``;return o.parts.forEach(function(e){e.type===`literal`?l+=e.value:l+=a(c,e)}),l}function M(e){var t=Object.create(null);if(e.type===`datetime`)t.type=`datetime`,t.parts=e.parts.map(function(e){var t=Object.create(null);if(e.type===`literal`)t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);else if(e.component===`Z`||e.component===`z`){let n;Array.isArray(e.integerFormat.groupingSeparators)||(n=e.integerFormat.groupingSeparators),t.regex=``,e.component===`z`&&(t.regex=`GMT`),t.regex+=`[-+][0-9]+`,n&&(t.regex+=n.character+`[0-9]+`),t.parse=function(t){e.component===`z`&&(t=t.substring(3));let r=0,i=0;return n?(r=Number.parseInt(t.substring(0,t.indexOf(n.character))),i=Number.parseInt(t.substring(t.indexOf(n.character)+1))):t.length-1<=2?r=Number.parseInt(t):(r=Number.parseInt(t.substring(0,3)),i=Number.parseInt(t.substring(3))),r*60+i}}else if(e.component===`f`)t.regex=`[0-9]+`,t.parse=function(e){return parseFloat(`0.`+e.substring(0,3))*1e3};else if(e.integerFormat)t=M(e.integerFormat);else{t.regex=`[a-zA-Z]+`;var n=Object.create(null);if(e.component===`M`||e.component===`x`)w.forEach(function(t,r){e.width&&e.width.max?n[t.substring(0,e.width.max)]=r+1:n[t]=r+1});else if(e.component===`F`)C.forEach(function(t,r){r>0&&(e.width&&e.width.max?n[t.substring(0,e.width.max)]=r:n[t]=r)});else if(e.component===`P`)n={am:0,AM:0,pm:1,PM:1};else throw{code:`D3133`,value:e.component};t.parse=function(e){return n[e]}}return t.component=e.component,t});else{t.type=`integer`;let n=e.case===_.UPPER;switch(e.primary){case g.LETTERS:t.regex=n?`[A-Z]+`:`[a-z]+`,t.parse=function(e){return m(e,n?`A`:`a`)};break;case g.ROMAN:t.regex=n?`[MDCLXVI]+`:`[mdclxvi]+`,t.parse=function(e){return f(n?e:e.toUpperCase())};break;case g.WORDS:t.regex=`(?:`+r.keys(s).concat(`and`,`[\\-, ]`).join(`|`)+`)+`,t.parse=function(e){return c(e.toLowerCase())};break;case g.DECIMAL:t.regex=`[0-9]`,e.parseWidth?t.regex+=`{${e.parseWidth}}`:t.regex+=`+`,e.ordinal&&(t.regex+=`(?:th|st|nd|rd)`),t.parse=function(t){let n=t;return e.ordinal&&(n=t.substring(0,t.length-2)),e.regular?n=n.split(`,`).join(``):e.groupingSeparators.forEach(e=>{n=n.split(e.character).join(``)}),e.zeroCode!==48&&(n=n.split(``).map(t=>String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48)).join(``)),parseInt(n)};break;case g.SEQUENCE:throw{code:`D3130`,value:e.token}}}return t}function N(e,t){if(e!==void 0)return M(b(t)).parse(e)}function ee(e,t){let n=M(S(t)),r=`^`+n.parts.map(e=>`(`+e.regex+`)`).join(``)+`$`;var i=new RegExp(r,`i`).exec(e);if(i!==null){let e=Object.create(null);for(let t=1;t<i.length;t++){let r=n.parts[t-1];r.parse&&(e[r.component]=r.parse(i[t]))}if(Object.getOwnPropertyNames(e).length===0)return;let t=0,r=e=>{t<<=1,t+=+!!e},o=e=>!(~e&t)&&!!(e&t);`YXMxWwdD`.split(``).forEach(t=>r(e[t]));let s=!o(161)&&o(130),c=o(84),l=!c&&o(72);t=0,`PHhmsf`.split(``).forEach(t=>r(e[t]));let u=!o(23)&&o(47),d=(s?`YD`:c?`XxwF`:l?`XWF`:`YMD`)+(u?`Phmsf`:`Hmsf`),f=this.environment.timestamp,p=!1,m=!1;if(d.split(``).forEach(t=>{if(e[t]===void 0)p?(e[t]=`MDd`.indexOf(t)===-1?0:1,m=!0):e[t]=k(f,t);else if(p=!0,m)throw{code:`D3136`}}),e.M>0?--e.M:e.M=0,s){let t=Date.UTC(e.Y,0),n=(e.d-1)*1e3*60*60*24,r=new Date(t+n);e.M=r.getUTCMonth(),e.D=r.getUTCDate()}if(c||l)throw{code:`D3136`};u&&(e.H=e.h===12?0:e.h,e.P===1&&(e.H+=12));var a=Date.UTC(e.Y,e.M,e.D,e.H,e.m,e.s,e.f);return(e.Z||e.z)&&(a-=(e.Z||e.z)*60*1e3),a}}var P=RegExp(`^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$`);function F(e,t){if(e!==void 0){if(t===void 0){if(!P.test(e))throw{stack:Error().stack,code:`D3110`,value:e};return Date.parse(e)}return ee.call(this,e,t)}}function te(e,t,n){if(e!==void 0)return j.call(this,e,t,n)}return{formatInteger:h,parseInteger:N,fromMillis:te,toMillis:F}})()},{"./utils":6}],2:[function(e,t,n){(function(n){(function(){var r=e("./utils");t.exports=(()=>{var e=r.isNumeric,t=r.isArrayOfStrings,i=r.isArrayOfNumbers,a=r.isSequence,o=r.isFunction,s=r.isLambda,c=r.isPromise,l=r.getFunctionArity,u=r.isDeepEqual,d=r.stringToArray;function f(e){if(e!==void 0){var t=0;return e.forEach(function(e){t+=e}),t}}function p(e){return e===void 0?0:e.length}function m(e){if(e!==void 0&&e.length!==0)return Math.max.apply(Math,e)}function h(e){if(e!==void 0&&e.length!==0)return Math.min.apply(Math,e)}function g(e){if(e!==void 0&&e.length!==0){var t=0;return e.forEach(function(e){t+=e}),t/e.length}}function _(t,n=!1){if(t!==void 0){var r;if(typeof t==`string`)r=t;else if(o(t))r=``;else if(typeof t==`number`&&!isFinite(t))throw{code:`D3001`,value:t,stack:Error().stack};else{var i=n?2:0;Array.isArray(t)&&t.outerWrapper&&(t=t[0]),r=JSON.stringify(t,function(t,n){return n!=null&&e(n)?n.toPrecision&&!Number.isInteger(n)?Number(n.toPrecision(15)):n:n&&o(n)?``:n},i)}return r}}function v(e,t,n){if(e!==void 0){var r=d(e),i=r.length;if(i+t<0&&(t=0),n!==void 0){if(n<=0)return``;var a=t>=0?t+n:i+t+n;return r.slice(t,a).join(``)}return r.slice(t).join(``)}}function y(e,t){if(e!==void 0){var n=e.indexOf(t);return n>-1?e.substr(0,n):e}}function b(e,t){if(e!==void 0){var n=e.indexOf(t);return n>-1?e.substr(n+t.length):e}}function x(e){if(e!==void 0)return e.toLowerCase()}function S(e){if(e!==void 0)return e.toUpperCase()}function C(e){if(e!==void 0)return d(e).length}function w(e){if(e!==void 0){var t=e.replace(/[ \t\n\r]+/gm,` `);return t.charAt(0)===` `&&(t=t.substring(1)),t.charAt(t.length-1)===` `&&(t=t.substring(0,t.length-1)),t}}function T(e,t,n){if(e!==void 0){(n===void 0||n.length===0)&&(n=` `);var r;t=Math.trunc(t);var i=Math.abs(t)-C(e);if(i>0){var a=Array(i+1).join(n);n.length>1&&(a=v(a,0,i)),r=t>0?e+a:a+e}else r=e;return r}}async function E(e,t){var n=e.apply(this,[t]);if(c(n)&&(n=await n),n&&!(typeof n.start==`number`||n.end===`number`||Array.isArray(n.groups)||o(n.next)))throw{code:`T1010`,stack:Error().stack};return n}async function D(e,t){if(e!==void 0&&t!==void 0)return typeof t==`string`?e.indexOf(t)!==-1:await E(t,e)!==void 0}async function O(e,t,n){if(e!==void 0){if(n<0)throw{stack:Error().stack,value:n,code:`D3040`,index:3};var r=this.createSequence();if(n===void 0||n>0){var i=0,a=await E(t,e);if(a!==void 0)for(;a!==void 0&&(n===void 0||i<n);)r.push({match:a.match,index:a.start,groups:a.groups}),a=await E(a.next),i++}return r}}async function k(e,t,n,r){if(e!==void 0){var i=this;if(t===``)throw{code:`D3010`,stack:Error().stack,value:t,index:2};if(r<0)throw{code:`D3011`,stack:Error().stack,value:r,index:4};var a=typeof n==`string`?function(e){for(var t=``,r=0,i=n.indexOf(`$`,r);i!==-1&&r<n.length;){t+=n.substring(r,i),r=i+1;var a=n.charAt(r);if(a===`$`)t+=`$`,r++;else if(a===`0`)t+=e.match,r++;else{var o=e.groups.length===0?1:Math.floor(Math.log(e.groups.length)*Math.LOG10E)+1;if(i=parseInt(n.substring(r,r+o),10),o>1&&i>e.groups.length&&(i=parseInt(n.substring(r,r+o-1),10)),isNaN(i))t+=`$`;else{if(e.groups.length>0){var s=e.groups[i-1];s!==void 0&&(t+=s)}r+=i.toString().length}}i=n.indexOf(`$`,r)}return t+=n.substring(r),t}:n,o=``,s=0;if(r===void 0||r>0){var l=0;if(typeof t==`string`){for(var u=e.indexOf(t,s);u!==-1&&(r===void 0||l<r);)o+=e.substring(s,u),o+=n,s=u+t.length,l++,u=e.indexOf(t,s);o+=e.substring(s)}else{var d=await E(t,e);if(d!==void 0){for(;d!==void 0&&(r===void 0||l<r);){o+=e.substring(s,d.start);var f=a.apply(i,[d]);if(c(f)&&(f=await f),typeof f==`string`)o+=f;else throw{code:`D3012`,stack:Error().stack,value:f};s=d.start+d.match.length,l++,d=await E(d.next)}o+=e.substring(s)}else o=e}}else o=e;return o}}function A(e){if(e!==void 0)return(typeof window<`u`?window.btoa:function(e){return new n.Buffer.from(e,`binary`).toString(`base64`)})(e)}function j(e){if(e!==void 0)return(typeof window<`u`?window.atob:function(e){return new n.Buffer.from(e,`base64`).toString(`binary`)})(e)}function M(e){if(e!==void 0){var t;try{t=encodeURIComponent(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`encodeUrlComponent`}}return t}}function N(e){if(e!==void 0){var t;try{t=encodeURI(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`encodeUrl`}}return t}}function ee(e){if(e!==void 0){var t;try{t=decodeURIComponent(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`decodeUrlComponent`}}return t}}function P(e){if(e!==void 0){var t;try{t=decodeURI(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`decodeUrl`}}return t}}async function F(e,t,n){if(e!==void 0){if(n<0)throw{code:`D3020`,stack:Error().stack,value:n,index:3};var r=[];if(n===void 0||n>0){if(typeof t==`string`)r=e.split(t,n);else{var i=0,a=await E(t,e);if(a!==void 0){for(var o=0;a!==void 0&&(n===void 0||i<n);)r.push(e.substring(o,a.start)),o=a.end,a=await E(a.next),i++;(n===void 0||i<n)&&r.push(e.substring(o))}else r.push(e)}}return r}}function te(e,t){if(e!==void 0)return t===void 0&&(t=``),e.join(t)}function ne(e,t,n){if(e!==void 0){var i={"decimal-separator":`.`,"grouping-separator":`,`,"exponent-separator":`e`,infinity:`Infinity`,"minus-sign":`-`,NaN:`NaN`,percent:`%`,"per-mille":`‰`,"zero-digit":`0`,digit:`#`,"pattern-separator":`;`};n!==void 0&&r.keys(n).forEach(function(e){i[e]=n[e]});for(var a=[],o=i[`zero-digit`].charCodeAt(0),s=o;s<o+10;s++)a.push(String.fromCharCode(s));var c=a.concat([i[`decimal-separator`],i[`exponent-separator`],i[`grouping-separator`],i.digit,i[`pattern-separator`]]),l=t.split(i[`pattern-separator`]);if(l.length>2)throw{code:`D3080`,stack:Error().stack};var u=function(e){var t=(function(){for(var t,n=0;n<e.length;n++)if(t=e.charAt(n),c.indexOf(t)!==-1&&t!==i[`exponent-separator`])return e.substring(0,n);return``})(),n=(function(){for(var t,n=e.length-1;n>=0;n--)if(t=e.charAt(n),c.indexOf(t)!==-1&&t!==i[`exponent-separator`])return e.substring(n+1);return``})(),r=e.substring(t.length,e.length-n.length),a,o,s,l,u=e.indexOf(i[`exponent-separator`],t.length);u===-1||u>e.length-n.length?(a=r,o=void 0):(a=r.substring(0,u),o=r.substring(u+1));var d=a.indexOf(i[`decimal-separator`]);return d===-1?(s=a,l=n):(s=a.substring(0,d),l=a.substring(d+1)),{prefix:t,suffix:n,activePart:r,mantissaPart:a,exponentPart:o,integerPart:s,fractionalPart:l,subpicture:e}},d=function(e){var t,n,r=e.subpicture,o=r.indexOf(i[`decimal-separator`]);o!==r.lastIndexOf(i[`decimal-separator`])&&(t=`D3081`),r.indexOf(i.percent)!==r.lastIndexOf(i.percent)&&(t=`D3082`),r.indexOf(i[`per-mille`])!==r.lastIndexOf(i[`per-mille`])&&(t=`D3083`),r.indexOf(i.percent)!==-1&&r.indexOf(i[`per-mille`])!==-1&&(t=`D3084`);var s=!1;for(n=0;n<e.mantissaPart.length;n++){var l=e.mantissaPart.charAt(n);if(a.indexOf(l)!==-1||l===i.digit){s=!0;break}}s||(t=`D3085`),e.activePart.split(``).map(function(e){return c.indexOf(e)===-1?`p`:`a`}).join(``).indexOf(`p`)!==-1&&(t=`D3086`),o===-1?e.integerPart.charAt(e.integerPart.length-1)===i[`grouping-separator`]&&(t=`D3088`):(r.charAt(o-1)===i[`grouping-separator`]||r.charAt(o+1)===i[`grouping-separator`])&&(t=`D3087`),r.indexOf(i[`grouping-separator`]+i[`grouping-separator`])!==-1&&(t=`D3089`);var u=e.integerPart.indexOf(i.digit);u!==-1&&e.integerPart.substring(0,u).split(``).filter(function(e){return a.indexOf(e)>-1}).length>0&&(t=`D3090`),u=e.fractionalPart.lastIndexOf(i.digit),u!==-1&&e.fractionalPart.substring(u).split(``).filter(function(e){return a.indexOf(e)>-1}).length>0&&(t=`D3091`);var d=typeof e.exponentPart==`string`;if(d&&e.exponentPart.length>0&&(r.indexOf(i.percent)!==-1||r.indexOf(i[`per-mille`])!==-1)&&(t=`D3092`),d&&(e.exponentPart.length===0||e.exponentPart.split(``).filter(function(e){return a.indexOf(e)===-1}).length>0)&&(t=`D3093`),t)throw{code:t,stack:Error().stack}},f=function(e){var t=function(t,n){for(var r=[],o=t.indexOf(i[`grouping-separator`]);o!==-1;){var s=(n?t.substring(0,o):t.substring(o)).split(``).filter(function(e){return a.indexOf(e)!==-1||e===i.digit}).length;r.push(s),o=e.integerPart.indexOf(i[`grouping-separator`],o+1)}return r},n=t(e.integerPart),r=function(e){if(e.length===0)return 0;for(var t=function(e,n){return n===0?e:t(n,e%n)},n=e.reduce(t),r=1;r<=e.length;r++)if(e.indexOf(r*n)===-1)return 0;return n}(n),o=t(e.fractionalPart,!0),s=e.integerPart.split(``).filter(function(e){return a.indexOf(e)!==-1}).length,c=s,l=e.fractionalPart.split(``),u=l.filter(function(e){return a.indexOf(e)!==-1}).length,d=l.filter(function(e){return a.indexOf(e)!==-1||e===i.digit}).length,f=typeof e.exponentPart==`string`;s===0&&d===0&&(f?(u=1,d=1):s=1),f&&s===0&&e.integerPart.indexOf(i.digit)!==-1&&(s=1),s===0&&u===0&&(u=1);var p=0;return f&&(p=e.exponentPart.split(``).filter(function(e){return a.indexOf(e)!==-1}).length),{integerPartGroupingPositions:n,regularGrouping:r,minimumIntegerPartSize:s,scalingFactor:c,prefix:e.prefix,fractionalPartGroupingPositions:o,minimumFactionalPartSize:u,maximumFactionalPartSize:d,minimumExponentSize:p,suffix:e.suffix,picture:e.subpicture}},p=l.map(u);p.forEach(d);var m=p.map(f),h=i[`minus-sign`],g=i[`zero-digit`],_=i[`decimal-separator`],v=i[`grouping-separator`];m.length===1&&(m.push(JSON.parse(JSON.stringify(m[0]))),m[1].prefix=h+m[1].prefix);var y=e>=0?m[0]:m[1],b=y.picture.indexOf(i.percent)===-1?y.picture.indexOf(i[`per-mille`])===-1?e:e*1e3:e*100,x,S;if(y.minimumExponentSize===0)x=b;else{var C=10**y.scalingFactor,w=10**(y.scalingFactor-1);if(x=b,S=0,x!==0){for(;Math.abs(x)<w;)x*=10,--S;for(;Math.abs(x)>C;)x/=10,S+=1}}var T=I(x,y.maximumFactionalPartSize),E=function(e,t){var n=Math.abs(e).toFixed(t);return g!==`0`&&(n=n.split(``).map(function(e){return e>=`0`&&e<=`9`?a[e.charCodeAt(0)-48]:e}).join(``)),n},D=E(T,y.maximumFactionalPartSize),O=D.indexOf(`.`);for(O===-1?D+=_:D=D.replace(`.`,_);D.charAt(0)===g;)D=D.substring(1);for(;D.charAt(D.length-1)===g;)D=D.substring(0,D.length-1);O=D.indexOf(_);var k=y.minimumIntegerPartSize-O,A=y.minimumFactionalPartSize-(D.length-O-1);if(D=(k>0?Array(k+1).join(g):``)+D,D+=A>0?Array(A+1).join(g):``,O=D.indexOf(_),y.regularGrouping>0)for(var j=Math.floor((O-1)/y.regularGrouping),M=1;M<=j;M++)D=[D.slice(0,O-M*y.regularGrouping),v,D.slice(O-M*y.regularGrouping)].join(``);else y.integerPartGroupingPositions.forEach(function(e){D=[D.slice(0,O-e),v,D.slice(O-e)].join(``),O++});if(O=D.indexOf(_),y.fractionalPartGroupingPositions.forEach(function(e){D=[D.slice(0,e+O+1),v,D.slice(e+O+1)].join(``)}),O=D.indexOf(_),(y.picture.indexOf(_)===-1||O===D.length-1)&&(D=D.substring(0,D.length-1)),S!==void 0){var N=E(S,0);k=y.minimumExponentSize-N.length,k>0&&(N=Array(k+1).join(g)+N),D=D+i[`exponent-separator`]+(S<0?h:``)+N}return D=y.prefix+D+y.suffix,D}}function re(e,t){if(e!==void 0){if(e=I(e),t=t===void 0?10:I(t),t<2||t>36)throw{code:`D3100`,stack:Error().stack,value:t};return e.toString(t)}}function ie(e){var t;if(e!==void 0){if(typeof e==`number`)t=e;else if(typeof e==`string`&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e))t=parseFloat(e);else if(typeof e==`string`&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(e))t=Number(e);else if(e===!0)t=1;else if(e===!1)t=0;else throw{code:`D3030`,value:e,stack:Error().stack,index:1};return t}}function ae(e){var t;if(e!==void 0)return t=Math.abs(e),t}function oe(e){var t;if(e!==void 0)return t=Math.floor(e),t}function se(e){var t;if(e!==void 0)return t=Math.ceil(e),t}function I(e,t){var n;if(e!==void 0){if(t){var r=e.toString().split(`e`);e=+(r[0]+`e`+(r[1]?+r[1]+t:t))}n=Math.round(e);var i=n-e;return Math.abs(i)===.5&&Math.abs(n%2)===1&&--n,t&&(r=n.toString().split(`e`),n=+(r[0]+`e`+(r[1]?+r[1]-t:-t))),Object.is(n,-0)&&(n=0),n}}function ce(e){var t;if(e!==void 0){if(e<0)throw{stack:Error().stack,code:`D3060`,index:1,value:e};return t=Math.sqrt(e),t}}function le(e,t){var n;if(e!==void 0){if(n=e**+t,!isFinite(n))throw{stack:Error().stack,code:`D3061`,index:1,value:e,exp:t};return n}}function ue(){return Math.random()}function de(t){if(t!==void 0){var n=!1;return Array.isArray(t)?t.length===1?n=de(t[0]):t.length>1&&(n=t.filter(function(e){return de(e)}).length>0):typeof t==`string`?t.length>0&&(n=!0):e(t)?t!==0&&(n=!0):typeof t==`object`&&t&&!o(t)?r.keys(t).length>0&&(n=!0):typeof t==`boolean`&&t===!0&&(n=!0),n}}function fe(e){if(e!==void 0)return!de(e)}function pe(e,t,n,r){var i=[t],a=l(e);return a>=2&&i.push(n),a>=3&&i.push(r),i}async function me(e,t){if(e!==void 0){for(var n=this.createSequence(),r=0;r<e.length;r++){var i=pe(t,e[r],r,e),a=await t.apply(this,i);a!==void 0&&n.push(a)}return n}}async function he(e,t){if(e!==void 0){for(var n=this.createSequence(),r=0;r<e.length;r++){var i=e[r],a=pe(t,i,r,e);de(await t.apply(this,a))&&n.push(i)}return n}}async function ge(e,t){if(e!==void 0){for(var n=!1,r,i=0;i<e.length;i++){var a=e[i],o=!0;if(t!==void 0){var s=pe(t,a,i,e);o=de(await t.apply(this,s))}if(o){if(!n)r=a,n=!0;else throw{stack:Error().stack,code:`D3138`,index:i}}}if(!n)throw{stack:Error().stack,code:`D3139`};return r}}function _e(){for(var e=[],t=Array.prototype.slice.call(arguments),n=Math.min.apply(Math,t.map(function(e){return Array.isArray(e)?e.length:0})),r=0;r<n;r++){var i=t.map(e=>e[r]);e.push(i)}return e}async function ve(e,t,n){if(e!==void 0){var r,i=l(t);if(i<2)throw{stack:Error().stack,code:`D3050`,index:1};var a;for(n===void 0&&e.length>0?(r=e[0],a=1):(r=n,a=0);a<e.length;){var o=[r,e[a]];i>=3&&o.push(a),i>=4&&o.push(e),r=await t.apply(this,o),a++}return r}}function ye(e){var t=this.createSequence();if(Array.isArray(e)){for(var n=Object.create(null),i=0;i<e.length;i++)ye.call(this,e[i]).forEach(function(e){n[e]=!0});t=ye.call(this,n)}else typeof e==`object`&&e&&!o(e)&&r.keys(e).forEach(e=>t.push(e));return t}function be(e,t){var n;if(Array.isArray(e)){n=this.createSequence();for(var r=0;r<e.length;r++){var i=be.call(this,e[r],t);i!==void 0&&(Array.isArray(i)?i.forEach(e=>n.push(e)):n.push(i))}}else typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,t)&&!o(e)&&(n=e[t]);return n}function xe(e,t){if(e===void 0)return t;if(t===void 0)return e;Array.isArray(e)||(e=this.createSequence(e)),Array.isArray(t)||(t=[t]);let n=e.length+t.length;if(this.options&&n>this.options.sequence)throw{code:`D2015`,stack:Error().stack,value:n};return e.concat(t)}function Se(e){return e!==void 0}function Ce(e){var t=this.createSequence();if(Array.isArray(e))for(var n=0;n<e.length;n++)t=xe.call(this,t,Ce.call(this,e[n]));else if(typeof e==`object`&&e&&!s(e))for(let n of r.keys(e)){var i=Object.create(null);i[n]=e[n],t.push(i)}else t=e;return t}function L(e){if(e!==void 0){var t=Object.create(null);return e.forEach(function(e){for(let n of r.keys(e))t[n]=e[n]}),t}}function we(e){if(e!==void 0){if(e.length<=1)return e;for(var t=e.length,n=Array(t),r=0;r<t;r++)n[t-r-1]=e[r];return n}}async function Te(e,t){var n=this.createSequence();for(let o of r.keys(e)){var i=pe(t,e[o],o,e),a=await t.apply(this,i);a!==void 0&&n.push(a)}return n}function Ee(e){throw{code:`D3137`,stack:Error().stack,message:e||`$error() function evaluated`}}function De(e,t){if(!e)throw{code:`D3141`,stack:Error().stack,message:t||`$assert() statement failed`}}function Oe(t){if(t!==void 0)return t===null?`null`:e(t)?`number`:typeof t==`string`?`string`:typeof t==`boolean`?`boolean`:Array.isArray(t)?`array`:o(t)?`function`:`object`}async function ke(e,n){if(e!==void 0){if(e.length<=1)return e;var r;if(n===void 0){if(!i(e)&&!t(e))throw{stack:Error().stack,code:`D3070`,index:1};r=async function(e,t){return e>t}}else r=n;var a=async function(e,t){var n=async function(e,t,i){t.length===0?Array.prototype.push.apply(e,i):i.length===0?Array.prototype.push.apply(e,t):await r(t[0],i[0])?(e.push(i[0]),await n(e,t,i.slice(1))):(e.push(t[0]),await n(e,t.slice(1),i))},i=[];return await n(i,e,t),i},o=async function(e){if(!Array.isArray(e)||e.length<=1)return e;var t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t);return n=await o(n),r=await o(r),await a(n,r)};return await o(e)}}function Ae(e){if(e!==void 0){if(e.length<=1)return e;for(var t=Array(e.length),n=0;n<e.length;n++){var r=Math.floor(Math.random()*(n+1));n!==r&&(t[n]=t[r]),t[r]=e[n]}return t}}function je(e){if(e!==void 0){if(!Array.isArray(e)||e.length<=1)return e;for(var t=a(e)?this.createSequence():[],n=0;n<e.length;n++){for(var r=e[n],i=!1,o=0;o<t.length;o++)if(u(r,t[o])){i=!0;break}i||t.push(r)}return t}}async function Me(e,t){var n=Object.create(null);for(let o of r.keys(e)){var i=e[o],a=pe(t,i,o,e);de(await t.apply(this,a))&&(n[o]=i)}return r.keys(n).length===0&&(n=void 0),n}return{sum:f,count:p,max:m,min:h,average:g,string:_,substring:v,substringBefore:y,substringAfter:b,lowercase:x,uppercase:S,length:C,trim:w,pad:T,match:O,contains:D,replace:k,split:F,join:te,formatNumber:ne,formatBase:re,number:ie,floor:oe,ceil:se,round:I,abs:ae,sqrt:ce,power:le,random:ue,boolean:de,not:fe,map:me,zip:_e,filter:he,single:ge,foldLeft:ve,sift:Me,keys:ye,lookup:be,append:xe,exists:Se,spread:Ce,merge:L,reverse:we,each:Te,error:Ee,assert:De,type:Oe,sort:ke,shuffle:Ae,distinct:je,base64encode:A,base64decode:j,encodeUrlComponent:M,encodeUrl:N,decodeUrlComponent:ee,decodeUrl:P}})()}).call(this)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{"./utils":6}],3:[function(e,t,n){var r=e("./datetime"),i=e("./functions"),a=e("./utils"),o=e("./parser"),s=e("./signature");t.exports=(function(){var e=a.isNumeric,t=a.isArrayOfStrings,n=a.isArrayOfNumbers,c=a.isSequence,l=a.isFunction,u=a.isLambda,d=a.isIterable,f=a.isPromise,p=a.getFunctionArity,m=a.isDeepEqual,h=Ee(null);async function g(e,t,n){var r;n.base.depth++,n.base.guardrails();var i=n.lookup(Symbol.for(`jsonata.__evaluate_entry`));switch(i&&await i(e,t,n),e.type){case`path`:r=await _(e,t,n);break;case`binary`:r=await C(e,t,n);break;case`unary`:r=await w(e,t,n);break;case`name`:r=T(e,t,n);break;case`string`:case`number`:case`value`:r=E(e,t,n);break;case`wildcard`:r=D(e,t,n);break;case`descendant`:r=k(e,t,n);break;case`parent`:r=n.lookup(e.slot.label);break;case`condition`:r=await oe(e,t,n);break;case`block`:r=await se(e,t,n);break;case`bind`:r=await ae(e,t,n);break;case`regex`:r=I(e,t,n);break;case`function`:r=await pe(e,t,n);break;case`variable`:r=ce(e,t,n);break;case`lambda`:r=ge(e,t,n);break;case`partial`:r=await _e(e,t,n);break;case`apply`:r=await fe(e,t,n);break;case`transform`:r=ue(e,t,n)}if(Object.prototype.hasOwnProperty.call(e,`predicate`))for(var a=0;a<e.predicate.length;a++)r=await S(e.predicate[a].expr,r,n);e.type!==`path`&&Object.prototype.hasOwnProperty.call(e,`group`)&&(r=await ne(e.group,r,n));var o=n.lookup(Symbol.for(`jsonata.__evaluate_exit`));return o&&await o(e,t,n,r),r&&c(r)&&!r.tupleStream&&(e.keepArray&&(r.keepSingleton=!0),r.length===0?r=void 0:r.length===1&&(r=r.keepSingleton?r:r[0])),n.base.depth--,r}async function _(e,t,n){for(var r=Array.isArray(t)&&e.steps[0].type!==`variable`?t:n.base.createSequence(t),i,a=!1,o=void 0,s=0;s<e.steps.length;s++){var c=e.steps[s];if(c.tuple&&(a=!0),s===0&&c.consarray?i=await g(c,r,n):a?o=await x(c,r,o,n):i=await y(c,r,n,s===e.steps.length-1),!a&&(i===void 0||i.length===0))break;c.focus===void 0&&(r=i)}if(a){if(e.tuple)i=o;else for(i=n.base.createSequence(),s=0;s<o.length;s++)i.push(o[s][`@`])}return e.keepSingletonArray&&(Array.isArray(i)&&i.cons&&!i.sequence&&(i=n.base.createSequence(i)),i.keepSingleton=!0),Object.prototype.hasOwnProperty.call(e,`group`)&&(i=await ne(e.group,a?o:i,n)),i}function v(e,t){var n=Ee(e);for(let e of a.keys(t))n.bind(e,t[e]);return n}async function y(e,t,n,r){var i;if(e.type===`sort`)return i=await le(e,t,n),e.stages&&(i=await b(e.stages,i,n)),i;i=n.base.createSequence();for(var a=0;a<t.length;a++){var o=await g(e,t[a],n);if(e.stages)for(var s=0;s<e.stages.length;s++)o=await S(e.stages[s].expr,o,n);o!==void 0&&i.push(o)}var l=n.base.createSequence();return r&&i.length===1&&Array.isArray(i[0])&&!c(i[0])?l=i[0]:Array.prototype.forEach.call(i,function(e){!Array.isArray(e)||e.cons?l.push(e):Array.prototype.forEach.call(e,e=>l.push(e))}),l}async function b(e,t,n){for(var r=t,i=0;i<e.length;i++){var a=e[i];switch(a.type){case`filter`:r=await S(a.expr,r,n);break;case`index`:for(var o=0;o<r.length;o++){var s=r[o];s[a.value]=o}}}return r}async function x(e,t,n,r){var i;if(e.type===`sort`){if(n)i=await le(e,n,r);else{var a=await le(e,t,r);i=r.base.createSequence(),i.tupleStream=!0;for(var o=0;o<a.length;o++){var s={"@":a[o]};s[e.index]=o,i.push(s)}}return e.stages&&(i=await b(e.stages,i,r)),i}i=r.base.createSequence(),i.tupleStream=!0;var c=r;n===void 0&&(n=t.map(e=>({"@":e})));for(var l=0;l<n.length;l++){c=v(r,n[l]);var u=await g(e,n[l][`@`],c);if(u!==void 0){Array.isArray(u)||(u=[u]);for(var d=0;d<u.length;d++)s=Object.create(null),Object.assign(s,n[l]),u.tupleStream?Object.assign(s,u[d]):(e.focus?(s[e.focus]=u[d],s[`@`]=n[l][`@`]):s[`@`]=u[d],e.index&&(s[e.index]=d),e.ancestor&&(s[e.ancestor.label]=n[l][`@`])),i.push(s)}}return e.stages&&(i=await b(e.stages,i,r)),i}async function S(t,r,a){var o=a.base.createSequence();if(r&&r.tupleStream&&(o.tupleStream=!0),Array.isArray(r)||(r=a.base.createSequence(r)),t.type===`number`){var s=Math.floor(t.value);s<0&&(s=r.length+s);var c=await r[s];c!==void 0&&(Array.isArray(c)?o=c:o.push(c))}else for(s=0;s<r.length;s++){var c=r[s],l=c,u=a;r.tupleStream&&(l=c[`@`],u=v(a,c));var d=await g(t,l,u);e(d)&&(d=[d]),n(d)?Array.prototype.forEach.call(d,function(e){var t=Math.floor(e);t<0&&(t=r.length+t),t===s&&o.push(c)}):i.boolean(d)&&o.push(c)}return o}async function C(e,t,n){var r,i=await g(e.lhs,t,n),a=e.value,o=async()=>await g(e.rhs,t,n);if(a===`and`||a===`or`)try{return await P(i,o,a)}catch(t){throw t.position=e.position,t.token=a,t}var s=await o();try{switch(a){case`+`:case`-`:case`*`:case`/`:case`%`:r=j(i,s,a);break;case`=`:case`!=`:r=M(i,s,a);break;case`<`:case`<=`:case`>`:case`>=`:r=N(i,s,a);break;case`&`:r=te(i,s);break;case`..`:r=ie(i,s,n);break;case`in`:r=ee(i,s)}}catch(t){throw t.position=e.position,t.token=a,t}return r}async function w(t,n,r){var a,o={options:r.base.options,createSequence:r.base.createSequence};switch(t.value){case`-`:if(a=await g(t.expression,n,r),a===void 0)a=void 0;else if(e(a))a=-a;else throw{code:`D1002`,stack:Error().stack,position:t.position,token:t.value,value:a};break;case`[`:a=[];let l=await Promise.all(t.expressions.map(async(e,t)=>(r.isParallelCall=t>0,[e,await g(e,n,r)])));for(let e of l){var[s,c]=e;c!==void 0&&(s.value===`[`?a.push(c):a=i.append.call(o,a,c))}t.consarray&&Object.defineProperty(a,"cons",{enumerable:!1,configurable:!1,value:!0});break;case`{`:a=await ne(t,n,r)}return a}function T(e,t,n){var r={createSequence:n.base.createSequence};return i.lookup.call(r,t,e.value)}function E(e){return e.value}function D(e,t,n){var r={options:n.base.options,createSequence:n.base.createSequence},o=r.createSequence();return Array.isArray(t)&&t.outerWrapper&&t.length>0&&(t=t[0]),typeof t==`object`&&t&&!l(t)&&a.keys(t).forEach(function(e){var n=t[e];Array.isArray(n)?(n=O(n),o=i.append.call(r,o,n)):o.push(n)}),o}function O(e,t){return t===void 0&&(t=[]),Array.isArray(e)?Array.prototype.forEach.call(e,function(e){O(e,t)}):t.push(e),t}function k(e,t,n){var r,i=n.base.createSequence();return t!==void 0&&(A(t,i),r=i.length===1?i[0]:i),r}function A(e,t){Array.isArray(e)||t.push(e),Array.isArray(e)?Array.prototype.forEach.call(e,function(e){A(e,t)}):typeof e==`object`&&e&&!l(e)&&a.keys(e).forEach(function(n){A(e[n],t)})}function j(t,n,r){var i;if(t!==void 0&&!e(t))throw{code:`T2001`,stack:Error().stack,value:t};if(n!==void 0&&!e(n))throw{code:`T2002`,stack:Error().stack,value:n};if(t===void 0||n===void 0)return i;switch(r){case`+`:i=t+n;break;case`-`:i=t-n;break;case`*`:i=t*n;break;case`/`:i=t/n;break;case`%`:i=t%n}return i}function M(e,t,n){var r;if(e===void 0||t===void 0)return!1;switch(n){case`=`:r=m(e,t);break;case`!=`:r=!m(e,t)}return r}function N(e,t,n){var r,i=typeof e,a=typeof t;if(i!==`undefined`&&i!==`string`&&i!==`number`||a!==`undefined`&&a!==`string`&&a!==`number`)throw{code:`T2010`,stack:Error().stack,value:i!==`string`&&i!==`number`?e:t};if(i!==`undefined`&&a!==`undefined`){if(i!==a)throw{code:`T2009`,stack:Error().stack,value:e,value2:t};switch(n){case`<`:r=e<t;break;case`<=`:r=e<=t;break;case`>`:r=e>t;break;case`>=`:r=e>=t}return r}}function ee(e,t){var n=!1;if(e===void 0||t===void 0)return!1;Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++)if(t[r]===e){n=!0;break}return n}async function P(e,t,n){var r,i=F(e);switch(n){case`and`:r=i&&F(await t());break;case`or`:r=i||F(await t())}return r}function F(e){var t=i.boolean(e);return t!==void 0&&t}function te(e,t){var n,r=``,a=``;return e!==void 0&&(r=i.string(e)),t!==void 0&&(a=i.string(t)),n=r.concat(a),n}async function ne(e,t,n){var r=Object.create(null),o=Object.create(null),s=!!(t&&t.tupleStream),c={options:n.base.options,createSequence:n.base.createSequence};if(!Array.isArray(t))options:n.base.options,t=c.createSequence(t);t.length===0&&!s&&t.push(void 0);for(var l=0;l<t.length;l++)for(var u=t[l],d=s?v(n,u):n,f=0;f<e.lhs.length;f++){var p=e.lhs[f],m=await g(p[0],s?u[`@`]:u,d);if(typeof m!=`string`&&m!==void 0)throw{code:`T1003`,stack:Error().stack,position:e.position,value:m};if(m!==void 0){if(m===`_jsonata_lambda`||m===`_jsonata_function`)throw{code:`D1013`,stack:Error().stack,position:e.position,value:m};var h={data:u,exprIndex:f};if(Object.prototype.hasOwnProperty.call(o,m)){if(o[m].exprIndex!==f)throw{code:`D1009`,stack:Error().stack,position:e.position,value:m};o[m].data=i.append.call(c,o[m].data,u)}else o[m]=h}}let _=await Promise.all(a.keys(o).map(async(t,r)=>{let i=o[t];var a=i.data,c=n;if(s){var l=re(i.data,n);a=l[`@`],delete l[`@`],c=v(n,l)}return n.isParallelCall=r>0,[t,await g(e.lhs[i.exprIndex][1],a,c)]}));for(let e of _){var[m,y]=await e;y!==void 0&&(r[m]=y)}return r}function re(e,t){if(!Array.isArray(e))return e;var n=Object.create(null),r={options:t.base.options,createSequence:t.base.createSequence};Object.assign(n,e[0]);for(var o=1;o<e.length;o++)for(let t of a.keys(e[o]))n[t]=i.append.call(r,n[t],e[o][t]);return n}function ie(e,t,n){var r;if(e!==void 0&&!Number.isInteger(e))throw{code:`T2003`,stack:Error().stack,value:e};if(t!==void 0&&!Number.isInteger(t))throw{code:`T2004`,stack:Error().stack,value:t};if(e===void 0||t===void 0||e>t)return r;var i=t-e+1;if(i>1e7)throw{code:`D2014`,stack:Error().stack,value:i};if(n.base.options&&i>n.base.options.sequence)throw{code:`D2015`,stack:Error().stack,value:i};r=Array(i);for(var a=e,o=0;a<=t;a++,o++)r[o]=a;return r.sequence=!0,r}async function ae(e,t,n){var r=await g(e.rhs,t,n);return n.bind(e.lhs.value,r),r}async function oe(e,t,n){var r,a=await g(e.condition,t,n);return i.boolean(a)?r=await g(e.then,t,n):e.else!==void 0&&(r=await g(e.else,t,n)),r}async function se(e,t,n){for(var r,i=Ee(n),a=0;a<e.expressions.length;a++)r=await g(e.expressions[a],t,i);return r}function I(e,t,n){var r=new n.base.RegexEngine(e.value),i=function(t,n){var a;r.lastIndex=n||0;var o=r.exec(t);if(o!==null){if(a={match:o[0],start:o.index,end:o.index+o[0].length,groups:[]},o.length>1)for(var s=1;s<o.length;s++)a.groups.push(o[s]);a.next=function(){if(!(r.lastIndex>=t.length)){var n=i(t,r.lastIndex);if(n&&n.match===``)throw{code:`D1004`,stack:Error().stack,position:e.position,value:e.value.source};return n}}}return a};return i}function ce(e,t,n){return e.value===``?t&&t.outerWrapper?t[0]:t:n.lookup(e.value)}async function le(e,t,n){var r,a=t,o=!!t.tupleStream,s=async function(t,r){for(var i=0,a=0;i===0&&a<e.terms.length;a++){var s=e.terms[a],c=t,l=n;o&&(c=t[`@`],l=v(n,t));var u=await g(s.expression,c,l);c=r,l=n,o&&(c=r[`@`],l=v(n,r));var d=await g(s.expression,c,l),f=typeof u,p=typeof d;if(f===`undefined`){i=p===`undefined`?0:1;continue}if(p===`undefined`){i=-1;continue}if(f!==`string`&&f!==`number`||p!==`string`&&p!==`number`)throw{code:`T2008`,stack:Error().stack,position:e.position,value:f!==`string`&&f!==`number`?u:d};if(f!==p)throw{code:`T2007`,stack:Error().stack,position:e.position,value:u,value2:d};u!==d&&(i=u<d?-1:1,s.descending===!0&&(i=-i))}return i===1},c={environment:n,input:t};return r=await i.sort.apply(c,[a,s]),r}function ue(e,n,r){return L(async function(n){if(n!==void 0){var i=r.lookup(`clone`);if(!l(i))throw{code:`T2013`,stack:Error().stack,position:e.position};var o=await me(i,[n],null,r),s=await g(e.pattern,o,r);if(s!==void 0){Array.isArray(s)||(s=[s]);for(var c=0;c<s.length;c++){var u=s[c],d=await g(e.update,u,r),f=typeof d;if(f!==`undefined`){if(f!==`object`||d===null||Array.isArray(d))throw{code:`T2011`,stack:Error().stack,position:e.update.position,value:d};for(let e of a.keys(d))u[e]=d[e]}if(e.delete!==void 0){var p=await g(e.delete,u,r);if(p!==void 0){var m=p;if(Array.isArray(p)||(p=[p]),!t(p))throw{code:`T2012`,stack:Error().stack,position:e.delete.position,value:m};for(var h=0;h<p.length;h++)typeof u==`object`&&u&&delete u[p[h]]}}}}return o}},`<(oa):o>`)}var de=o(`function($f, $g) { function($x){ $g($f($x)) } }`);async function fe(e,t,n){var r,i=await g(e.lhs,t,n);if(e.rhs.type===`function`)r=await pe(e.rhs,t,n,{context:i});else{var a=await g(e.rhs,t,n);if(!l(a))throw{code:`T2006`,stack:Error().stack,position:e.position,value:a};r=l(i)?await me(await g(de,null,n),[i,a],null,n):await me(a,[i],null,n)}return r}async function pe(e,t,n,r){var i,a=await g(e.procedure,t,n);if(a===void 0&&e.procedure.type===`path`&&n.lookup(e.procedure.steps[0].value))throw{code:`T1005`,stack:Error().stack,position:e.position,token:e.procedure.steps[0].value};var o=[];r!==void 0&&o.push(r.context);for(var s=0;s<e.arguments.length;s++){let r=await g(e.arguments[s],t,n);if(l(r)){let e=async function(...e){return await me(r,e,null,n)};e.arity=p(r),o.push(e)}else o.push(r)}var c=e.procedure.type===`path`?e.procedure.steps[0].value:e.procedure.value;try{typeof a==`object`&&(a.token=c,a.position=e.position),i=await me(a,o,t,n)}catch(t){throw t.position||=e.position,t.token||=c,t}return i}async function me(e,t,n,r){for(var i=await he(e,t,n,r);u(i)&&i.thunk===!0;){var a=await g(i.body.procedure,i.input,i.environment);i.body.procedure.type===`variable`&&(a.token=i.body.procedure.value),a.position=i.body.procedure.position;for(var o=[],s=0;s<i.body.arguments.length;s++)o.push(await g(i.body.arguments[s],i.input,i.environment));i=await he(a,o,n,r)}return i}async function he(e,t,n,r){var i;try{var a=t;if(e&&(a=ve(e.signature,t,n)),u(e))i=await ye(e,a);else if(e&&e._jsonata_function===!0){var o={environment:r,input:n,options:r.base.options,createSequence:r.base.createSequence};i=e.implementation.apply(o,a),d(i)&&(i=i.next().value),f(i)&&(i=await i)}else if(typeof e==`function`)i=e.apply(n,a),f(i)&&(i=await i);else throw{code:`T1006`,stack:Error().stack}}catch(t){throw e&&(t.token===void 0&&e.token!==void 0&&(t.token=e.token),t.position=e.position||t.position),t}return i}function ge(e,t,n){var r={_jsonata_lambda:!0,input:t,environment:n,arguments:e.arguments,signature:e.signature,body:e.body};return e.thunk===!0&&(r.thunk=!0),r.apply=async function(e,i){return await me(r,i,t,e?e.environment:n)},r}async function _e(e,t,n){for(var r,i=[],a=0;a<e.arguments.length;a++){var o=e.arguments[a];o.type===`operator`&&o.value===`?`?i.push(o):i.push(await g(o,t,n))}var s=await g(e.procedure,t,n);if(s===void 0&&e.procedure.type===`path`&&n.lookup(e.procedure.steps[0].value))throw{code:`T1007`,stack:Error().stack,position:e.position,token:e.procedure.steps[0].value};if(u(s))r=be(s,i,n);else if(s&&s._jsonata_function===!0)r=xe(s.implementation,i,n);else if(typeof s==`function`)r=xe(s,i,n);else throw{code:`T1008`,stack:Error().stack,position:e.position,token:e.procedure.type===`path`?e.procedure.steps[0].value:e.procedure.value};return r}function ve(e,t,n){return e===void 0?t:e.validate(t,n)}async function ye(e,t){var n,r=Ee(e.environment);return Array.prototype.forEach.call(e.arguments,function(e,n){r.bind(e.value,t[n])}),n=typeof e.body==`function`?await Se(e.body,r):await g(e.body,e.input,r),n}function be(e,t,n){var r=Ee(e.environment||n),i=[];return Array.prototype.forEach.call(e.arguments,function(e,n){var a=t[n];a&&a.type===`operator`&&a.value===`?`?i.push(e):r.bind(e.value,a)}),{_jsonata_lambda:!0,input:e.input,environment:r,arguments:i,body:e.body}}function xe(e,t,n){var r=Ce(e);r=r.map(function(e){return`$`+e.trim()});var i=o(`function(`+r.join(`, `)+`){ _ }`);return i.body=e,be(i,t,n)}async function Se(e,t){var n=Ce(e).map(function(e){return t.lookup(e.trim())}),r={environment:t,createSequence:t.base.createSequence},i=e.apply(r,n);return f(i)&&(i=await i),i}function Ce(e){var t=e.toString();return/\(([^)]*)\)/.exec(t)[1].split(`,`)}function L(e,t){var n={_jsonata_function:!0,implementation:e};return t!==void 0&&(n.signature=s(t)),n}async function we(e,t){if(e!==void 0){var n=this.input;t!==void 0&&(n=t,Array.isArray(n)&&!c(n)&&(n=this.createSequence(n),n.outerWrapper=!0));try{var r=o(e,!1)}catch(e){throw Oe(e),{stack:Error().stack,code:`D3120`,value:e.message,error:e}}try{var i=await g(r,n,this.environment)}catch(e){throw Oe(e),{stack:Error().stack,code:`D3121`,value:e.message,error:e}}return i}}function Te(e){if(e!==void 0)return JSON.parse(i.string(e))}function Ee(e){var t=Object.create(null);let n={bind:function(e,n){t[e]=n},lookup:function(n){var r;return Object.prototype.hasOwnProperty.call(t,n)?r=t[n]:e&&(r=e.lookup(n)),r},timestamp:e?e.timestamp:null,async:e?e.async:!1,isParallelCall:e?e.isParallelCall:!1,global:e?e.global:{ancestry:[null]}};if(e){var r=e.lookup(Symbol.for(`jsonata.__createFrame_push`));r&&r(e,n),n.base=e.base}return n}h.bind(`sum`,L(i.sum,`<a<n>:n>`)),h.bind(`count`,L(i.count,`<a:n>`)),h.bind(`max`,L(i.max,`<a<n>:n>`)),h.bind(`min`,L(i.min,`<a<n>:n>`)),h.bind(`average`,L(i.average,`<a<n>:n>`)),h.bind(`string`,L(i.string,`<x-b?:s>`)),h.bind(`substring`,L(i.substring,`<s-nn?:s>`)),h.bind(`substringBefore`,L(i.substringBefore,`<s-s:s>`)),h.bind(`substringAfter`,L(i.substringAfter,`<s-s:s>`)),h.bind(`lowercase`,L(i.lowercase,`<s-:s>`)),h.bind(`uppercase`,L(i.uppercase,`<s-:s>`)),h.bind(`length`,L(i.length,`<s-:n>`)),h.bind(`trim`,L(i.trim,`<s-:s>`)),h.bind(`pad`,L(i.pad,`<s-ns?:s>`)),h.bind(`match`,L(i.match,`<s-f<s:o>n?:a<o>>`)),h.bind(`contains`,L(i.contains,`<s-(sf):b>`)),h.bind(`replace`,L(i.replace,`<s-(sf)(sf)n?:s>`)),h.bind(`split`,L(i.split,`<s-(sf)n?:a<s>>`)),h.bind(`join`,L(i.join,`<a<s>s?:s>`)),h.bind(`formatNumber`,L(i.formatNumber,`<n-so?:s>`)),h.bind(`formatBase`,L(i.formatBase,`<n-n?:s>`)),h.bind(`formatInteger`,L(r.formatInteger,`<n-s:s>`)),h.bind(`parseInteger`,L(r.parseInteger,`<s-s:n>`)),h.bind(`number`,L(i.number,`<(nsb)-:n>`)),h.bind(`floor`,L(i.floor,`<n-:n>`)),h.bind(`ceil`,L(i.ceil,`<n-:n>`)),h.bind(`round`,L(i.round,`<n-n?:n>`)),h.bind(`abs`,L(i.abs,`<n-:n>`)),h.bind(`sqrt`,L(i.sqrt,`<n-:n>`)),h.bind(`power`,L(i.power,`<n-n:n>`)),h.bind(`random`,L(i.random,`<:n>`)),h.bind(`boolean`,L(i.boolean,`<x-:b>`)),h.bind(`not`,L(i.not,`<x-:b>`)),h.bind(`map`,L(i.map,`<af>`)),h.bind(`zip`,L(i.zip,`<a+>`)),h.bind(`filter`,L(i.filter,`<af>`)),h.bind(`single`,L(i.single,`<af?>`)),h.bind(`reduce`,L(i.foldLeft,`<afj?:j>`)),h.bind(`sift`,L(i.sift,`<o-f?:o>`)),h.bind(`keys`,L(i.keys,`<x-:a<s>>`)),h.bind(`lookup`,L(i.lookup,`<x-s:x>`)),h.bind(`append`,L(i.append,`<xx:a>`)),h.bind(`exists`,L(i.exists,`<x:b>`)),h.bind(`spread`,L(i.spread,`<x-:a<o>>`)),h.bind(`merge`,L(i.merge,`<a<o>:o>`)),h.bind(`reverse`,L(i.reverse,`<a:a>`)),h.bind(`each`,L(i.each,`<o-f:a>`)),h.bind(`error`,L(i.error,`<s?:x>`)),h.bind(`assert`,L(i.assert,`<bs?:x>`)),h.bind(`type`,L(i.type,`<x:s>`)),h.bind(`sort`,L(i.sort,`<af?:a>`)),h.bind(`shuffle`,L(i.shuffle,`<a:a>`)),h.bind(`distinct`,L(i.distinct,`<x:x>`)),h.bind(`base64encode`,L(i.base64encode,`<s-:s>`)),h.bind(`base64decode`,L(i.base64decode,`<s-:s>`)),h.bind(`encodeUrlComponent`,L(i.encodeUrlComponent,`<s-:s>`)),h.bind(`encodeUrl`,L(i.encodeUrl,`<s-:s>`)),h.bind(`decodeUrlComponent`,L(i.decodeUrlComponent,`<s-:s>`)),h.bind(`decodeUrl`,L(i.decodeUrl,`<s-:s>`)),h.bind(`eval`,L(we,`<sx?:x>`)),h.bind(`toMillis`,L(r.toMillis,`<s-s?:n>`)),h.bind(`fromMillis`,L(r.fromMillis,`<n-s?s?:s>`)),h.bind(`clone`,L(Te,`<(oa)-:o>`));var De={S0101:`String literal must be terminated by a matching quote`,S0102:`Number out of range: {{token}}`,S0103:`Unsupported escape sequence: \\{{token}}`,S0104:`The escape sequence \\u must be followed by 4 hex digits`,S0105:"Quoted property name must be terminated with a backquote (`)",S0106:`Comment has no closing tag`,S0201:`Syntax error: {{token}}`,S0202:`Expected {{value}}, got {{token}}`,S0203:`Expected {{value}} before end of expression`,S0204:`Unknown operator: {{token}}`,S0205:`Unexpected token: {{token}}`,S0206:`Unknown expression type: {{token}}`,S0207:`Unexpected end of expression`,S0208:`Parameter {{value}} of function definition must be a variable name (start with $)`,S0209:`A predicate cannot follow a grouping expression in a step`,S0210:`Each step can only have one grouping expression`,S0211:`The symbol {{token}} cannot be used as a unary operator`,S0212:`The left side of := must be a variable name (start with $)`,S0213:`The literal value {{value}} cannot be used as a step within a path expression`,S0214:`The right side of {{token}} must be a variable name (start with $)`,S0215:`A context variable binding must precede any predicates on a step`,S0216:`A context variable binding must precede the 'order-by' clause on a step`,S0217:`The object representing the 'parent' cannot be derived from this expression`,S0301:`Empty regular expressions are not allowed`,S0302:`No terminating / in regular expression`,S0402:`Choice groups containing parameterized types are not supported`,S0401:`Type parameters can only be applied to functions and arrays`,S0500:`Attempted to evaluate an expression containing syntax error(s)`,T0410:`Argument {{index}} of function {{token}} does not match function signature`,T0411:`Context value is not a compatible type with argument {{index}} of function {{token}}`,T0412:`Argument {{index}} of function {{token}} must be an array of {{type}}`,D1001:`Number out of range: {{value}}`,D1002:`Cannot negate a non-numeric value: {{value}}`,T1003:`Key in object structure must evaluate to a string; got: {{value}}`,D1004:`Regular expression matches zero length string`,T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:`Attempted to invoke a non-function`,T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:`Attempted to partially apply a non-function`,D1009:`Multiple key definitions evaluate to same key: {{value}}`,T1010:`The matcher function argument passed to function {{token}} does not return the correct object structure`,D1011:`Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive`,D1012:`Evaluation timeout after {{value}} milliseconds. Check for infinite loop`,D1013:`Object property names starting with _jsonata_ are reserved for internal use: {{value}}`,T2001:`The left side of the {{token}} operator must evaluate to a number`,T2002:`The right side of the {{token}} operator must evaluate to a number`,T2003:`The left side of the range operator (..) must evaluate to an integer`,T2004:`The right side of the range operator (..) must evaluate to an integer`,D2005:`The left side of := must be a variable name (start with $)`,T2006:`The right side of the function application operator ~> must be a function`,T2007:`Type mismatch when comparing values {{value}} and {{value2}} in order-by clause`,T2008:`The expressions within an order-by clause must evaluate to numeric or string values`,T2009:`The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type`,T2010:`The expressions either side of operator {{token}} must evaluate to numeric or string values`,T2011:`The insert/update clause of the transform expression must evaluate to an object: {{value}}`,T2012:`The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}`,T2013:`The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.`,D2014:`The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.`,D2015:`The maximum sequence length of {{value}} was exceeded.`,D3001:`Attempting to invoke string function on Infinity or NaN`,D3010:`Second argument of replace function cannot be an empty string`,D3011:`Fourth argument of replace function must evaluate to a positive number`,D3012:`Attempted to replace a matched string with a non-string value`,D3020:`Third argument of split function must evaluate to a positive number`,D3030:`Unable to cast value to a number: {{value}}`,D3040:`Third argument of match function must evaluate to a positive number`,D3050:`The second argument of reduce function must be a function with at least two arguments`,D3060:`The sqrt function cannot be applied to a negative number: {{value}}`,D3061:`The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}`,D3070:`The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function`,D3080:`The picture string must only contain a maximum of two sub-pictures`,D3081:`The sub-picture must not contain more than one instance of the 'decimal-separator' character`,D3082:`The sub-picture must not contain more than one instance of the 'percent' character`,D3083:`The sub-picture must not contain more than one instance of the 'per-mille' character`,D3084:`The sub-picture must not contain both a 'percent' and a 'per-mille' character`,D3085:`The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'`,D3086:`The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character`,D3087:`The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character`,D3088:`The sub-picture must not contain a 'grouping-separator' at the end of the integer part`,D3089:`The sub-picture must not contain two adjacent instances of the 'grouping-separator' character`,D3090:`The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'`,D3091:`The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'`,D3092:`A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'`,D3093:`The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'`,D3100:`The radix of the formatBase function must be between 2 and 36. It was given {{value}}`,D3110:`The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}`,D3120:`Syntax error in expression passed to function eval: {{value}}`,D3121:`Dynamic error evaluating the expression passed to function eval: {{value}}`,D3130:`Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation`,D3131:`In a decimal digit pattern, all digits must be from the same decimal group`,D3132:`Unknown component specifier {{value}} in date/time picture string`,D3133:`The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}`,D3134:`The timezone integer format specifier cannot have more than four digits`,D3135:`No matching closing bracket ']' in date/time picture string`,D3136:`The date/time picture string is missing specifiers required to parse the timestamp`,D3137:`{{{message}}}`,D3138:`The $single() function expected exactly 1 matching result. Instead it matched more.`,D3139:`The $single() function expected exactly 1 matching result. Instead it matched 0.`,D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:`{{{message}}}`};function Oe(e){var t=De[e.code];if(t!==void 0){var n=t.replace(/\{\{\{([^}]+)}}}/g,function(){return e[arguments[1]]});n=n.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(e[arguments[1]])}),e.message=n}}function ke(e,t){var n,i;try{n=o(e,t&&t.recover),i=n.errors,delete n.errors}catch(e){throw Oe(e),e}var s=Ee(h),l=new Date;return s.bind(`now`,L(function(e,t){return r.fromMillis(l.getTime(),e,t)},`<s?s?:s>`)),s.bind(`millis`,L(function(){return l.getTime()},`<:n>`)),{evaluate:async function(e,r,o){if(i!==void 0){var u={code:`S0500`,position:0};throw Oe(u),u}let d=Ee(s);for(let e of a.keys(r))d.bind(e,r[e]);if(d.bind(`$`,e),l=new Date,d.timestamp=l,d.options=t,d.createSequence=function(){var e=[];return t&&t.sequence&&(e.push=function(...n){if(e.length+n.length>t.sequence)throw{code:`D2015`,stack:Error().stack,value:t.sequence};return Array.prototype.push.apply(e,n)}),e.sequence=!0,arguments.length===1&&e.push(arguments[0]),e},Array.isArray(e)&&!c(e)&&(e=d.createSequence(e),e.outerWrapper=!0),t&&(t.timeout||t.stack)){let e=Date.now();d.guardrails=function(){if(t.stack>0&&d.depth>t.stack)throw{code:`D1011`,value:t.stack,stack:Error().stack};if(t.timeout>0&&Date.now()-e>t.timeout)throw{code:`D1012`,value:t.timeout,stack:Error().stack}}}else d.guardrails=function(){};d.base=d,d.depth=0,d.RegexEngine=t&&t.RegexEngine?t.RegexEngine:RegExp;var f;try{return f=await g(n,e,d),typeof o==`function`&&o(null,f),f}catch(e){throw Oe(e),e}},assign:function(e,t){s.bind(e,t)},registerFunction:function(e,t,n){var r=L(t,n);s.bind(e,r)},ast:function(){return n},errors:function(){return i}}}return ke.parser=o,ke})()},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,n){var r=e("./signature");t.exports=(()=>{var e={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},t={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
16
|
+
at `))}function Wp(e,t){class n extends e{#e;constructor(...e){if(Hp()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=Up(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),n}var Gp={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};Wp(class extends Error{status;body;headers;statusCode;constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:Gp[e]){if(super(t?.message,t&&`cause`in t?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,t&&`cause`in t){let{cause:e,...n}=t;this.body=Object.defineProperty(n,"cause",{value:e,writable:!0,configurable:!0});return}this.body=t}},Error);var Kp=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}},qp=47;function Jp(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===qp;)t--;return t===e.length?e:e.slice(0,t)}function Yp(e){try{return(Jp(new URL(e).pathname)||`/`)!==`/`}catch{throw new Kp(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Xp(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new Kp(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof Kp?t:new Kp(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Zp(e,t=`/api/auth`){if(Xp(e),Yp(e))return e;let n=Jp(e);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function Qp(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function $p(e,t,n,r,i){if(e)return Zp(e,t);if(r!==!1){let e=Bp.BETTER_AUTH_URL||Bp.NEXT_PUBLIC_BETTER_AUTH_URL||Bp.PUBLIC_BETTER_AUTH_URL||Bp.NUXT_PUBLIC_BETTER_AUTH_URL||Bp.NUXT_PUBLIC_AUTH_URL||(Bp.BASE_URL===`/`?void 0:Bp.BASE_URL);if(e)return Zp(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&Qp(o,`proto`)&&Qp(a,`host`))try{return Zp(`${o}://${a}`,t)}catch{}if(n){let e=em(n.url);if(!e)throw new Kp(`Could not get origin from request. Please provide a valid base URL.`);return Zp(e,t)}if(typeof window<`u`&&window.location)return Zp(window.location.origin,t)}function em(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var tm=[`javascript:`,`data:`,`vbscript:`];function nm(e){let t;try{t=new URL(e)}catch{return!0}return!tm.includes(t.protocol)}var rm={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&nm(e.data.url)&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},im=()=>typeof window>`u`,am=dp;function om(e,t){if(typeof window>`u`)return;let n=e.get();n.data===null&&t!==null&&e.set({...n,data:t,error:null,isPending:!1})}function sm(e){return typeof e==`object`&&e&&`data`in e&&`error`in e?e:{data:e,error:null}}function cm(e){return!e||e.session===null&&e.user===null?null:e}function lm(e,t){return mp(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function um(e,t){let n=ip(!1),r,i=0,a=0;n.listen(()=>{a++,i=0});let o=e=>u(e),s=jp({data:null,error:null,isPending:!0,isRefetching:!1,refetch:o});hp(s,lm);let c=async(t,n)=>{let r=s.value;if(s.set({...r,isPending:r.data===null,isRefetching:!0,error:null,refetch:o}),t.aborted)return`aborted`;try{let r=await e(`/get-session`,{method:`GET`,query:n?.query,signal:t});if(t.aborted)return`aborted`;let{data:i,error:a}=sm(r),c=`fresh`;if(i?.needsRefresh)try{let n=await e(`/get-session`,{method:`POST`,signal:t});if(t.aborted)return`aborted`;({data:i,error:a}=sm(n))}catch{if(t.aborted)return`aborted`;c=`stale`}if(a){let e=s.value,t=a?.status===401;return s.set({data:t?null:e.data,error:a,isPending:!1,isRefetching:!1,refetch:o}),`failed`}let l=cm(i),u=s.value,d=u.data!=null&&l!=null&&mp(u.data,l)?u.data:l;return s.set({data:d,error:null,isPending:!1,isRefetching:!1,refetch:o}),c}catch(e){if(t.aborted)return`aborted`;let n=s.value;return s.set({data:n.data,error:e,isPending:!1,isRefetching:!1,refetch:o}),`failed`}},l=()=>{let e=s.value.data?.session?.expiresAt,t=e instanceof Date?e.getTime():1/0;return Math.min(Date.now()+am,t)},u=e=>{i=0,r?.cancel();let t=new AbortController,n={cancel:()=>t.abort(),promise:Promise.resolve().then(()=>t.signal.aborted?`aborted`:c(t.signal,e)),revision:a};r=n;let o=e=>{r===n&&(r=void 0,e===`fresh`&&n.revision===a&&(i=l()))};return n.promise.then(o,()=>o(`failed`)),n.promise.then(()=>void 0)},d=()=>r?.revision===a?r.promise.then(()=>void 0):Date.now()<i?Promise.resolve():u(),f=()=>{};return fp(s,()=>{let e;im()||(e=setTimeout(()=>{d()},0));let r=Lp({fetchSession:u,shouldPollSession:()=>s.value.data!=null,sessionSignal:n,options:t});return r.init(),f=r.broadcastSessionUpdate,()=>{e&&clearTimeout(e),r.cleanup()}}),{session:s,$sessionSignal:n,broadcastSessionUpdate:e=>f(e)}}function dm(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function fm(e,t,n=`.`,r){if(!dm(t))return fm(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(i[t]=Array.isArray(a)&&Array.isArray(i[t])?[...a,...i[t]]:dm(a)&&dm(i[t])?fm(a,i[t],(n?`${n}.`:``)+t.toString(),r):a))}return i}function pm(e){return(...t)=>t.reduce((t,n)=>fm(t,n,``,e),{})}var mm=pm(),hm=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},gm=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let t=await i.init?.call(i,e.toString(),n);n=t.options||n,e=t.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},_m=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},vm=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function ym(e){if(typeof e==`number`)return new _m({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new _m(e);case`exponential`:return new vm(e);default:throw Error(`Invalid retry strategy`)}}var bm=[`get`,`post`,`put`,`patch`,`delete`];function xm(e){if(!e.startsWith(`@`))return{method:void 0,path:e};let t=e.indexOf(`/`),n=e.slice(1,t===-1?void 0:t);return bm.includes(n)?{method:n,path:t===-1?e:e.slice(t+1)}:{method:void 0,path:e}}var Sm=e=>e===`.`||e===`..`,Cm=e=>e.split(`:`).map(e=>encodeURIComponent(e)).join(`:`);function wm(e,t){let n=t.get(e);if(n===void 0)return Cm(e);if(Sm(n))throw TypeError(`Path parameters cannot be reserved path segments`);return encodeURIComponent(n)}function Tm(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``,{path:o}=xm(e);o!==e&&(e=`/${o}`),a.endsWith(`/`)||(a+=`/`);let[s,c]=e.replace(a,``).split(`?`),l=new URLSearchParams(c);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)l.append(e,n);continue}else n=JSON.stringify(t);l.set(e,n)}let u=new Map;if(r){if(Array.isArray(r)){let e=s.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];u.set(n,String(e))}}else for(let[e,t]of Object.entries(r))u.set(`:${e}`,String(t))}s=s.split(`/`).map(e=>wm(e,u)).join(`/`),s=s.replace(/^\/+/,``);let d=l.toString();return d=d.length>0?`?${d}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${s}${d}`,a):`${a}${s}${d}`}var Em=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Dm=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Om(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Dm.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function km(e){try{return JSON.parse(e),!0}catch{return!1}}function Am(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function jm(e){try{return JSON.parse(e)}catch{return e}}function Mm(e){return typeof e==`function`}function Nm(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&Mm(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&Mm(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}function Pm(...e){let t={};for(let n of e)if(n){if(n instanceof Headers)n.forEach((e,n)=>{t[n]=e});else{let e=Array.isArray(n)?n:Object.entries(n);for(let[n,r]of e)r!=null&&(t[n]=r)}}return t}async function Fm(e){let t=new Headers(Pm(e?.headers,await Em(e)));if(!t.has(`content-type`)){let n=Im(e?.body);n&&t.set(`content-type`,n)}return t}function Im(e){return Am(e)?`application/json`:null}function Lm(e){let t=e.get(`content-type`);return t?t.split(`;`)[0].trim().toLowerCase():null}function Rm(e,t){let{body:n}=e;return n?!Am(n)||typeof n==`string`?n:Lm(t)===`application/x-www-form-urlencoded`?new URLSearchParams(n).toString():JSON.stringify(n):null}function zm(e,t){if(t?.method)return t.method.toUpperCase();let{method:n}=xm(e);return n?n.toUpperCase():t?.body?`POST`:`GET`}function Bm(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var Vm=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Hm(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new Vm(n.issues);return n.value}function Um(e){"@babel/helpers - typeof";return Um=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Um(e)}function Wm(e,t){if(Um(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Um(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Gm(e){var t=Wm(e,`string`);return Um(t)==`symbol`?t:t+``}function Km(e,t,n){return(t=Gm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qm(Object(n),!0).forEach(function(t){Km(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Jm=async(e,t)=>{var n;let{hooks:r,url:i,options:a}=await gm(e,t),o=Nm(a),s=new AbortController,c=a.signal??s.signal,l=Tm(i,a),u=await Fm(a),d=Rm(a,u),f=zm(i,a),p=H(H({},a),{},{url:l,headers:u,body:d,method:f,signal:c});for(let e of r.onRequest)if(e){let t=await e(p);typeof t==`object`&&t&&Object.assign(p,t)}(`pipeTo`in p&&typeof p.pipeTo==`function`||typeof(t==null||(n=t.body)==null?void 0:n.pipe)==`function`)&&(`duplex`in p||(p.duplex=`half`));let{clearTimeout:m}=Bm(a,s),h=await o(p.url,p);m();let g={response:h,request:p};for(let e of r.onResponse)if(e){var _;let n=await e(H(H({},g),{},{response:t!=null&&(_=t.hookOptions)!=null&&_.cloneResponse?h.clone():h}));n instanceof Response?h=n:typeof n==`object`&&n&&(h=n.response)}if(h.ok){if(p.method===`HEAD`)return{data:``,error:null};let e=Om(h),n={data:null,response:h,request:p};if(e===`json`||e===`text`){let e=await h.text();n.data=await(p.jsonParser??jm)(e)}else n.data=await h[e]();p?.output&&p.output&&!p.disableValidation&&(n.data=await Hm(p.output,n.data));for(let e of r.onSuccess)if(e){var v;await e(H(H({},n),{},{response:t!=null&&(v=t.hookOptions)!=null&&v.cloneResponse?h.clone():h}))}return t?.throw?n.data:{data:n.data,error:null}}let y=t?.jsonParser??jm,b=await h.text(),x=km(b),S=x?await y(b):null,C={response:h,responseText:b,request:p,error:H(H({},S),{},{status:h.status,statusText:h.statusText})};for(let e of r.onError)if(e){var w;await e(H(H({},C),{},{response:t!=null&&(w=t.hookOptions)!=null&&w.cloneResponse?h.clone():h}))}if(t?.retry){let n=ym(t.retry),i=t.retryAttempt??0;if(await n.shouldAttemptRetry(i,h)){for(let e of r.onRetry)e&&await e(g);let a=n.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await Jm(e,H(H({},t),{},{retryAttempt:i+1}))}}if(t?.throw)throw new hm(h.status,h.statusText,x?S:b);return{data:null,error:H(H({},S),{},{status:h.status,statusText:h.statusText})}},Ym=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){var r;let i=H(H({},n),e.query!==void 0&&{query:H(H({},e.query),n?.query)}),a=((r=e.plugins)==null||(r=r.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1))==null?void 0:r.schema)||e.schema;if(a){let r=t;a.config?.prefix&&r.startsWith(a.config.prefix)&&(r=r.replace(a.config.prefix,``),a.config.baseURL&&(t=t.replace(a.config.prefix,a.config.baseURL))),a.config?.baseURL&&r.startsWith(a.config.baseURL)&&(r=r.replace(a.config.baseURL,``)),r.startsWith(`/`)&&r.charAt(1)===`@`&&(r=r.substring(1));let o=a.schema[r];if(o){let{method:a,path:s}=xm(r);a&&(t=t.slice(0,t.length-r.length)+s);let c=n?.headers;if(o.headers&&!n?.disableValidation){let e={};if(n?.headers){if(n.headers instanceof Headers)n.headers.forEach((t,n)=>{e[n.toLowerCase()]=t});else if(typeof n.headers==`object`)for(let[t,r]of Object.entries(n.headers))r!=null&&(e[t.toLowerCase()]=r)}let t=await Hm(o.headers,e),r={};for(let[e,n]of Object.entries(t))r[e.toLowerCase()]=n;c=r}let l=o.method??a;if(i=H(H(H(H({},i),l!==void 0&&{method:l}),o.output!==void 0&&{output:o.output}),c!==void 0&&{headers:c}),!n?.disableValidation){if(o.query&&(i.query=await Hm(o.query,n?.query),i.query!==null&&typeof i.query==`object`)){let t=H({},e.query);for(let e of Object.keys(t))n?.query&&Object.prototype.hasOwnProperty.call(n.query,e)&&(t[e]=n.query[e]);i.query=H(H({},t),i.query)}i=H(H({},i),{},{body:o.input?await Hm(o.input,n?.body):n?.body,params:o.params?await Hm(o.params,n?.params):n?.params})}return{url:t,options:i}}}return H({url:t},(n!==void 0||e.query!==void 0)&&{options:i})}}),Xm=e=>{async function t(t,n){let r=H(H(H({},e),n),{},{headers:Pm(e?.headers,n?.headers),plugins:[...e?.plugins||[],Ym(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Jm(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await Jm(t,r)}return t},Zm=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},Qm=e=>e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/revoke-other-sessions`||e===`/change-email`||e===`/change-password`,$m=(e,t)=>{let n=`credentials`in Request.prototype,r=$p(e?.baseURL,e?.basePath,void 0,t)??Zm(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=Xm({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?kp(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[rm],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=um(d,e),h=!1,g=e=>{h||e===null||(h=!0,om(p,e))},_=e?.plugins||[],v={},y={$sessionSignal:f,session:p},b={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},x=[{signal:`$sessionSignal`,matcher:Qm,callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of _)e.getAtoms&&Object.assign(y,e.getAtoms?.(d)),e.pathMethods&&Object.assign(b,e.pathMethods),e.atomListeners&&x.push(...e.atomListeners);let S={notify:e=>{y[e].set(!y[e].get())},listen:(e,t)=>{y[e].subscribe(t)},atoms:y};for(let t of _)t.getActions&&(v=mm(t.getActions?.(d,S,e)??{},v));return{get baseURL(){return r},pluginsActions:v,pluginsAtoms:y,pluginPathMethods:b,atomListeners:x,hydrateSession:g,$sessionSignal:f,$fetch:d,$store:S}};function eh(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function th(e){return e.charAt(0).toUpperCase()+e.slice(1)}var nh=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,rh=/['\u2019]/g;function ih(e){return e.replace(rh,``).match(nh)??[]}function ah(e){return ih(e).map(e=>e.toLowerCase()).join(`-`)}function oh(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function sh(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||eh(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(ah).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=oh(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function ch(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,hydrateSession:i,$fetch:a,atomListeners:o,$store:s}=$m(e),c={};for(let[e,t]of Object.entries(r))c[`use${th(e)}`]=t;return sh({...n,...c,hydrateSession:i,$fetch:a,$store:s},a,t,r,o)}var lh=(e,{$listPasskeys:t,$store:n})=>({signIn:{passkey:async(r,i)=>{let a=await e(`/passkey/generate-authenticate-options`,{method:`GET`,throw:!1});if(!a.data)return a;let o=a.data.extensions||r?.extensions?{...a.data.extensions||{},...r?.extensions||{}}:void 0,s;try{s=await Kf({optionsJSON:{...a.data,extensions:o},useBrowserAutofill:r?.autoFill})}catch(e){return{data:null,error:{code:e instanceof If?e.code:`AUTH_CANCELLED`,message:Of.AUTH_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}}try{let{clientExtensionResults:a,...o}=s,c=await e(`/passkey/verify-authentication`,{body:{response:o},...r?.fetchOptions,...i,method:`POST`,throw:!1});return t.set(Math.random()),n.notify(`$sessionSignal`),r?.returnWebAuthnResponse?{...c,webauthn:{response:s,clientExtensionResults:a}}:c}catch(e){return console.error(`[Better Auth] Error verifying passkey`,e),{data:null,error:{code:`AUTH_CANCELLED`,message:Of.AUTH_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}}}},passkey:{addPasskey:async(r,i)=>{let a=await e(`/passkey/generate-register-options`,{method:`GET`,query:{...r?.authenticatorAttachment&&{authenticatorAttachment:r.authenticatorAttachment},...r?.name&&{name:r.name},...r?.context&&{context:r.context}},throw:!1});if(!a.data)return a;try{let o=a.data.extensions||r?.extensions?{...a.data.extensions||{},...r?.extensions||{}}:void 0,s=await Vf({optionsJSON:{...a.data,extensions:o},useAutoRegister:r?.useAutoRegister}),{clientExtensionResults:c,...l}=s,u=await e(`/passkey/verify-registration`,{...r?.fetchOptions,...i,body:{response:l,name:r?.name,...r?.createSession&&{createSession:!0}},method:`POST`,throw:!1});return u.data?(t.set(Math.random()),u.data.session&&n.notify(`$sessionSignal`),r?.returnWebAuthnResponse?{...u,webauthn:{response:s,clientExtensionResults:c}}:u):u}catch(e){return e instanceof If?e.code===`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`?{data:null,error:{code:e.code,message:Of.PREVIOUSLY_REGISTERED.message,status:400,statusText:`BAD_REQUEST`}}:e.code===`ERROR_CEREMONY_ABORTED`?{data:null,error:{code:e.code,message:Of.REGISTRATION_CANCELLED.message,status:400,statusText:`BAD_REQUEST`}}:{data:null,error:{code:e.code,message:e.message,status:400,statusText:`BAD_REQUEST`}}:{data:null,error:{code:`UNKNOWN_ERROR`,message:e instanceof Error?e.message:Of.UNKNOWN_ERROR.message,status:500,statusText:`INTERNAL_SERVER_ERROR`}}}}},$Infer:{}}),uh=()=>{let e=ip();return{id:`passkey`,version:kf,$InferServerPlugin:{},getActions:(t,n)=>lh(t,{$listPasskeys:e,$store:n}),getAtoms(t){return{listPasskeys:Pp(e,`/passkey/list-user-passkeys`,t,{method:`GET`}),$listPasskeys:e}},pathMethods:{"/passkey/register":`POST`,"/passkey/authenticate":`POST`},atomListeners:[{matcher(e){return e===`/passkey/verify-registration`||e===`/passkey/delete-passkey`||e===`/passkey/update-passkey`||e===`/sign-out`},signal:`$listPasskeys`},{matcher:e=>e===`/passkey/verify-authentication`,signal:`$sessionSignal`}],$ERROR_CODES:Of}},dh=Df({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),fh=()=>({id:`email-otp`,version:qf,$InferServerPlugin:{},atomListeners:[{matcher:e=>e===`/email-otp/verify-email`||e===`/sign-in/email-otp`||e===`/email-otp/request-email-change`,signal:`$sessionSignal`}],$ERROR_CODES:dh}),ph=e=>{let t=e?.jwks?.jwksPath??`/jwks`;return{id:`better-auth-client`,version:qf,$InferServerPlugin:{},pathMethods:{[t]:`GET`},getActions:(e,n,r)=>({jwks:async n=>await e(t,{method:`GET`,...n})})}},mh=Df({OTP_NOT_ENABLED:`OTP not enabled`,OTP_NOT_CONFIGURED:`OTP is not available`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TOTP_ALREADY_ENABLED:`TOTP is already enabled`,TOTP_NOT_CONFIGURED:`TOTP is not available`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,ACCOUNT_TEMPORARILY_LOCKED:`Too many failed verification attempts. Your account is temporarily locked. Please try again later.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),hh=e=>({id:`two-factor`,version:qf,$InferServerPlugin:{},atomListeners:[{matcher:e=>e.startsWith(`/two-factor/`),signal:`$sessionSignal`}],pathMethods:{"/two-factor/disable":`POST`,"/two-factor/enable":`POST`,"/two-factor/send-otp":`POST`,"/two-factor/generate-backup-codes":`POST`,"/two-factor/get-totp-uri":`POST`,"/two-factor/verify-totp":`POST`,"/two-factor/verify-otp":`POST`,"/two-factor/verify-backup-code":`POST`},fetchPlugins:[{id:`two-factor`,name:`two-factor`,hooks:{async onSuccess(t){if(t.data?.twoFactorRedirect){if(e?.onTwoFactorRedirect){await e.onTwoFactorRedirect({twoFactorMethods:t.data.twoFactorMethods});return}e?.twoFactorPage&&typeof window<`u`&&nm(e.twoFactorPage)&&(window.location.href=e.twoFactorPage)}}}}],$ERROR_CODES:mh}),U=t(i(),1),gh=t(o(),1),_h=U.createContext(void 0),vh=e=>{let t=U.useContext(_h);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},yh=({client:e,children:t})=>(U.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,gh.jsx)(_h.Provider,{value:e,children:t})),bh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xh=new class{#e=bh;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Sh(e){setTimeout(e,0)}var Ch=typeof window>`u`||`Deno`in globalThis;function wh(){}function Th(e,t){return typeof e==`function`?e(t):e}function Eh(e){return typeof e==`number`&&e>=0&&e!==1/0}function Dh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Oh(e,t){return typeof e==`function`?e(t):e}function kh(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==jh(o,t.options))return!1}else if(!Nh(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ah(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Mh(t.options.mutationKey)!==Mh(a))return!1}else if(!Nh(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function jh(e,t){return(t?.queryKeyHashFn||Mh)(e)}function Mh(e){return JSON.stringify(e,(e,t)=>Rh(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Nh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!Nh(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Nh(e[r],t[r]))return!1;return!0}return!1}var Ph=Object.prototype.hasOwnProperty;function Fh(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Lh(e)&&Lh(t);if(!r&&!(Rh(e)&&Rh(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Ph.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Fh(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ih(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Lh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Rh(e){if(!zh(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!zh(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function zh(e){return Object.prototype.toString.call(e)===`[object Object]`}function Bh(e){return new Promise(t=>{xh.setTimeout(t,e)})}function Vh(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Fh(e,t)}function Hh(e){return e}function Uh(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Wh(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Gh=Symbol();function Kh(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Gh?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function qh(e,t){return typeof e==`function`?e(...t):!!e}function Jh(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Yh=()=>Ch,Xh=()=>Yh(),Zh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qh=new class extends Zh{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}};function $h(e){let t;if(e.then(e=>(t=e,e),wh)?.catch?.(wh),t!==void 0)return{data:t}}function eg(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function tg(e,t,n){let r=e.promise?.then(t).catch(e=>n?.(e)===!1?Promise.reject(e):Promise.reject(Error(`redacted`)));return r?.catch(wh),r}function ng(e,t,n){return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t?t(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:tg(e,t,n)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function rg(e){return e.state.isPaused}function ig(e){return e.state.status===`success`}function ag(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??rg,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[eg(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??ig,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[ng(e,o,a)]:[])}}function og(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?$h(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l,...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l}});c&&!d&&!h&&!g&&l>m.state.dataUpdatedAt&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(wh)})}var sg=Sh;function cg(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sg,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var lg=cg(),ug=new class extends Zh{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dg(e){return Math.min(1e3*2**e,3e4)}function fg(e){return(e??`online`)!==`online`||ug.isOnline()}var pg=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mg(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(wh);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new pg(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Qh.isFocused()&&(e.networkMode===`always`||ug.isOnline())&&e.canRun(),p=()=>fg(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Xh()?0:3),a=e.retryDelay??dg,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Bh(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var hg=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Eh(this.gcTime)&&(this.#e=xh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xh()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(xh.clearTimeout(this.#e),this.#e=void 0)}};function gg(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Jh(e,()=>t.signal,()=>n=!0)},u=Kh(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Wh:Uh;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vg:_g,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_g(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function _g(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vg(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function yg(e,t){return t?_g(e,t)!=null:!1}function bg(e,t){return!t||!e.getPreviousPageParam?!1:vg(e,t)!=null}var xg=class extends hg{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=wg(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=wg(this.options);e.data!==void 0&&(this.setState(Cg(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Vh(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(wh).catch(wh):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Oh(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Oh(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Dh(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Kh(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gg(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=mg({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pg&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pg){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Sg(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Cg(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),lg.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Sg(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fg(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Cg(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function wg(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Tg=class extends Zh{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Dg(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Og(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Og(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 Oh(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&&!Ih(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&kg(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Oh(this.options.enabled,this.#t)!==Oh(t.enabled,this.#t)||Oh(this.options.staleTime,this.#t)!==Oh(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Oh(this.options.enabled,this.#t)!==Oh(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ih(this.getCurrentResult(),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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(wh)),t}#h(e){return!Xh()&&Oh(this.options.enabled,this.#t)!==!1&&Eh(e)}#g(){this.#b();let e=Oh(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Dh(this.#r.dataUpdatedAt,e)+1;this.#u=xh.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Oh(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=xh.setInterval(()=>{(this.options.refetchIntervalInBackground||Qh.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(xh.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(xh.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Dg(e,t),o=i&&kg(e,n,t,r);(a||o)&&(l={...l,...Sg(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Vh(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Vh(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Ag(e,t),refetch:this.refetch,isEnabled:Oh(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),Ih(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);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)})})();lg.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#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()}};function Eg(e,t){return Oh(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Oh(t.retryOnMount,e)!==!1)}function Dg(e,t){return Eg(e,t)||e.state.data!==void 0&&Og(e,t,t.refetchOnMount)}function Og(e,t,n){if(Oh(t.enabled,e)!==!1&&Oh(t.staleTime,e)!==`static`){let r=Oh(n,e);return r===`always`||r!==!1&&Ag(e,t)}return!1}function kg(e,t,n,r){return(e!==t||Oh(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Ag(e,n)}function Ag(e,t){return Oh(t.enabled,e)!==!1&&e.isStaleByTime(Oh(t.staleTime,e))}var jg=class extends Tg{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:yg(t,n.data),hasPreviousPage:bg(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Mg=class extends hg{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ng(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=mg({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),lg.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ng(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Pg=class extends Zh{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Mg({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Fg(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Fg(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){lg.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ah(t,e))}findAll(e={}){return this.getAll().filter(t=>Ah(e,t))}notify(e){lg.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return lg.batch(()=>Promise.all(e.map(e=>e.continue().catch(wh))))}};function Fg(e){return e.options.scope?.id}var Ig=class extends Zh{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ih(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Mh(t.mutationKey)!==Mh(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ng();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){lg.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Lg(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Rg=class extends Zh{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,lg.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!Ih(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Lg(e,n).forEach(e=>{e.destroy()}),Lg(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Fh(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Tg(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&lg.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},zg=class extends Zh{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??jh(r,t),a=this.get(i);return a||(a=new xg({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){lg.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kh(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>kh(e,t)):t}notify(e){lg.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){lg.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){lg.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Bg=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new zg,this.#t=e.mutationCache||new Pg,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Qh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ug.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Oh(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Th(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return lg.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;lg.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return lg.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=lg.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(wh).catch(wh)}invalidateQueries(e,t={}){return lg.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=lg.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(wh)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(wh)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Oh(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Oh(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(wh).catch(wh)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(wh).catch(wh)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ug.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Mh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Nh(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Mh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Nh(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=jh(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Gh&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Vg=U.createContext(!1),Hg=()=>U.useContext(Vg);Vg.Provider;function Ug(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Wg=U.createContext(Ug()),Gg=()=>U.useContext(Wg),Kg=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?qh(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},qg=e=>{U.useEffect(()=>{e.clearReset()},[e])},Jg=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||qh(n,[e.error,r])),Yg=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))}},Xg=(e,t)=>e?.suspense&&t.isPending,Zg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Qg({queries:e,...t},n){let r=vh(n),i=Hg(),a=Gg(),o=t.subscribed!==!1,s=U.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Yg(e);let t=r.getQueryCache().get(e.queryHash);Kg(e,a,t)}),qg(a);let[c]=U.useState(()=>new Rg(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;U.useSyncExternalStore(U.useCallback(e=>f?c.subscribe(lg.batchCalls(e)):wh,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),U.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>Xg(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&Xg(n,e)?Zg(n,new Tg(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Jg({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function $g(e,t,n){let r=Hg(),i=Gg(),a=vh(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Yg(o),Kg(o,i,s),qg(i);let[l]=U.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(U.useSyncExternalStore(U.useCallback(e=>{let t=d?l.subscribe(lg.batchCalls(e)):wh;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),U.useEffect(()=>{l.setOptions(o)},[o,l]),Xg(o,u))throw Zg(o,l,i);if(Jg({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function e_(e,t){return $g(e,Tg,t)}function t_(e,t){let n=vh(t),r=n.getQueryCache();return U.useSyncExternalStore(U.useCallback(e=>r.subscribe(lg.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function n_(e,t){let n=vh(t),[r]=U.useState(()=>new Ig(n,e));U.useEffect(()=>{r.setOptions(e)},[r,e]);let i=U.useSyncExternalStore(U.useCallback(e=>r.subscribe(lg.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=U.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(wh)},[r]);if(i.error&&qh(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function r_(e,t){return $g(e,jg,t)}function i_(e){let{PI:t,min:n,max:r,cos:i,round:a}=Math,o=e[0]|e[1]<<8|e[2]<<16,s=e[3]|e[4]<<8,c=(o&63)/63,l=(o>>6&63)/31.5-1,u=(o>>12&63)/31.5-1,d=(o>>18&31)/31,f=o>>23,p=(s>>3&63)/63,m=(s>>9&63)/63,h=s>>15,g=r(3,h?f?5:7:s&7),_=r(3,h?s&7:f?5:7),v=f?(e[5]&15)/15:1,y=(e[5]>>4)/15,b=f?6:5,x=0,S=(t,n,r)=>{let i=[];for(let a=0;a<n;a++)for(let o=+!a;o*n<t*(n-a);o++)i.push(((e[b+(x>>1)]>>((x++&1)<<2)&15)/7.5-1)*r);return i},C=S(g,_,d),w=S(3,3,p*1.25),T=S(3,3,m*1.25),E=f&&S(5,5,y),D=a_(e),O=a(D>1?32:32*D),k=a(D>1?32/D:32),A=new Uint8Array(O*k*4),j=[],M=[];for(let e=0,a=0;e<k;e++)for(let o=0;o<O;o++,a+=4){let s=c,d=l,p=u,m=v;for(let e=0,n=r(g,f?5:3);e<n;e++)j[e]=i(t/O*(o+.5)*e);for(let n=0,a=r(_,f?5:3);n<a;n++)M[n]=i(t/k*(e+.5)*n);for(let e=0,t=0;e<_;e++)for(let n=+!e,r=M[e]*2;n*_<g*(_-e);n++,t++)s+=C[t]*j[n]*r;for(let e=0,t=0;e<3;e++)for(let n=+!e,r=M[e]*2;n<3-e;n++,t++){let e=j[n]*r;d+=w[t]*e,p+=T[t]*e}if(f)for(let e=0,t=0;e<5;e++)for(let n=+!e,r=M[e]*2;n<5-e;n++,t++)m+=E[t]*j[n]*r;let h=s-2/3*d,y=(3*s-h+p)/2,b=y-p;A[a]=r(0,255*n(1,y)),A[a+1]=r(0,255*n(1,b)),A[a+2]=r(0,255*n(1,h)),A[a+3]=r(0,255*n(1,m))}return{w:O,h:k,rgba:A}}function a_(e){let t=e[3],n=e[2]&128,r=e[4]&128;return(r?n?5:7:t&7)/(r?t&7:n?5:7)}function o_(e,t,n){let r=e*4+1,i=6+t*(5+r),a=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,e>>8,e&255,0,0,t>>8,t&255,8,6,0,0,0,0,0,0,0,i>>>24,i>>16&255,i>>8&255,i&255,73,68,65,84,120,1],o=[0,498536548,997073096,651767980,1994146192,1802195444,1303535960,1342533948,-306674912,-267414716,-690576408,-882789492,-1687895376,-2032938284,-1609899400,-1111625188],s=1,c=0;for(let e=0,i=0,o=r-1;e<t;e++,o+=r-1)for(a.push(e+1<t?0:1,r&255,r>>8,~r&255,r>>8^255,0),c=(c+s)%65521;i<o;i++){let e=n[i]&255;a.push(e),s=(s+e)%65521,c=(c+s)%65521}a.push(c>>8,c&255,s>>8,s&255,0,0,0,0,0,0,0,0,73,69,78,68,174,66,96,130);for(let[e,t]of[[12,29],[37,41+i]]){let n=-1;for(let r=e;r<t;r++)n^=a[r],n=n>>>4^o[n&15],n=n>>>4^o[n&15];n=~n,a[t++]=n>>>24,a[t++]=n>>16&255,a[t++]=n>>8&255,a[t++]=n&255}return`data:image/png;base64,`+btoa(String.fromCharCode(...a))}function s_(e){let t=i_(e);return o_(t.w,t.h,t.rgba)}var c_=r(((t,n)=>{(function(e){if(typeof t==`object`&&n!==void 0)n.exports=e();else if(typeof define==`function`&&define.amd)define([],e);else{var r=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this;r.jsonata=e()}})(function(){return(function(){function t(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof e==`function`&&e;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return a(t||e)},d,d.exports,t,n,r,i)}return r[s].exports}for(var o=typeof e==`function`&&e,s=0;s<i.length;s++)a(i[s]);return a}return t})()({1:[function(e,t,n){let r=e("./utils");t.exports=(function(){let e=r.stringToArray,t=[`Zero`,`One`,`Two`,`Three`,`Four`,`Five`,`Six`,`Seven`,`Eight`,`Nine`,`Ten`,`Eleven`,`Twelve`,`Thirteen`,`Fourteen`,`Fifteen`,`Sixteen`,`Seventeen`,`Eighteen`,`Nineteen`],n=[`Zeroth`,`First`,`Second`,`Third`,`Fourth`,`Fifth`,`Sixth`,`Seventh`,`Eighth`,`Ninth`,`Tenth`,`Eleventh`,`Twelfth`,`Thirteenth`,`Fourteenth`,`Fifteenth`,`Sixteenth`,`Seventeenth`,`Eighteenth`,`Nineteenth`],i=[`Twenty`,`Thirty`,`Forty`,`Fifty`,`Sixty`,`Seventy`,`Eighty`,`Ninety`,`Hundred`],a=[`Thousand`,`Million`,`Billion`,`Trillion`];function o(e,r){var o=function(e,r,s){var c=``;if(e<=19)c=(r?` and `:``)+(s?n[e]:t[e]);else if(e<100){let t=Math.floor(e/10),n=e%10;c=(r?` and `:``)+i[t-2],n>0?c+=`-`+o(n,!1,s):s&&(c=c.substring(0,c.length-1)+`ieth`)}else if(e<1e3){let n=Math.floor(e/100),i=e%100;c=(r?`, `:``)+t[n]+` Hundred`,i>0?c+=o(i,!0,s):s&&(c+=`th`)}else{var l=Math.floor(Math.log10(e)/3);l>a.length&&(l=a.length);let t=10**(l*3),n=Math.floor(e/t),i=e-n*t;c=(r?`, `:``)+o(n,!1,!1)+` `+a[l-1],i>0?c+=o(i,!0,s):s&&(c+=`th`)}return c};return o(e,!1,r)}let s=Object.create(null);t.forEach(function(e,t){s[e.toLowerCase()]=t}),n.forEach(function(e,t){s[e.toLowerCase()]=t}),i.forEach(function(e,t){let n=e.toLowerCase();s[n]=(t+2)*10,s[n.substring(0,e.length-1)+`ieth`]=s[n]}),s.hundredth=100,a.forEach(function(e,t){let n=e.toLowerCase(),r=10**((t+1)*3);s[n]=r,s[n+`th`]=r});function c(e){let t=e.split(/,\s|\sand\s|[\s\\-]/).map(e=>s[e]),n=[0];return t.forEach(e=>{if(e<100){let t=n.pop();t>=1e3&&(n.push(t),t=0),n.push(t+e)}else n.push(n.pop()*e)}),n.reduce((e,t)=>e+t,0)}let l=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],u={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function d(e){for(var t=0;t<l.length;t++){let n=l[t];if(e>=n[0])return n[1]+d(e-n[0])}return``}function f(e){for(var t=0,n=1,r=e.length-1;r>=0;r--){let i=e[r],a=u[i];a<n?t-=a:(n=a,t+=a)}return t}function p(e,t){for(var n=[],r=t.charCodeAt(0);e>0;)n.unshift(String.fromCharCode((e-1)%26+r)),e=Math.floor((e-1)/26);return n.join(``)}function m(e,t){for(var n=t.charCodeAt(0),r=0,i=0;i<e.length;i++)r+=(e.charCodeAt(e.length-i-1)-n+1)*26**i;return r}function h(e,t){if(e===void 0)return;e=Math.floor(e);let n=b(t);return v(e,n)}let g={DECIMAL:`decimal`,LETTERS:`letters`,ROMAN:`roman`,WORDS:`words`,SEQUENCE:`sequence`},_={UPPER:`upper`,LOWER:`lower`,TITLE:`title`};function v(t,n){let r,i=t<0;switch(t=Math.abs(t),n.primary){case g.LETTERS:r=p(t,n.case===_.UPPER?`A`:`a`);break;case g.ROMAN:r=d(t),n.case===_.UPPER&&(r=r.toUpperCase());break;case g.WORDS:r=o(t,n.ordinal),n.case===_.UPPER?r=r.toUpperCase():n.case===_.LOWER&&(r=r.toLowerCase());break;case g.DECIMAL:r=``+t;var a=n.mandatoryDigits-r.length;if(a>0&&(r=Array(a+1).join(`0`)+r),n.zeroCode!==48&&(r=e(r).map(e=>String.fromCodePoint(e.codePointAt(0)+n.zeroCode-48)).join(``)),n.regular){let e=Math.floor((r.length-1)/n.groupingSeparators.position);for(let t=e;t>0;t--){let e=r.length-t*n.groupingSeparators.position;r=r.substr(0,e)+n.groupingSeparators.character+r.substr(e)}}else n.groupingSeparators.reverse().forEach(e=>{let t=r.length-e.position;r=r.substr(0,t)+e.character+r.substr(t)});if(n.ordinal){var s={1:`st`,2:`nd`,3:`rd`}[r[r.length-1]];(!s||r.length>1&&r[r.length-2]===`1`)&&(s=`th`),r+=s}break;case g.SEQUENCE:throw{code:`D3130`,value:n.token}}return i&&(r=`-`+r),r}let y=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function b(t){let n={type:`integer`,primary:g.DECIMAL,case:_.LOWER,ordinal:!1},r,i,a=t.lastIndexOf(`;`);switch(a===-1?r=t:(r=t.substring(0,a),i=t.substring(a+1),i[0]===`o`&&(n.ordinal=!0)),r){case`A`:n.case=_.UPPER;case`a`:n.primary=g.LETTERS;break;case`I`:n.case=_.UPPER;case`i`:n.primary=g.ROMAN;break;case`W`:n.case=_.UPPER,n.primary=g.WORDS;break;case`Ww`:n.case=_.TITLE,n.primary=g.WORDS;break;case`w`:n.primary=g.WORDS;break;default:{let t=null,i=0,a=0,o=[],s=0;if(e(r).map(e=>e.codePointAt(0)).reverse().forEach(e=>{let n=!1;for(let r=0;r<y.length;r++){let a=y[r];if(e>=a&&e<=a+9){if(n=!0,i++,s++,t===null)t=a;else if(a!==t)throw{code:`D3131`};break}}n||(e===35?(s++,a++):o.push({position:s,character:String.fromCodePoint(e)}))}),i>0){n.primary=g.DECIMAL,n.zeroCode=t,n.mandatoryDigits=i,n.optionalDigits=a;let e=function(e){if(e.length===0)return 0;let t=e[0].character;for(let n=1;n<e.length;n++)if(e[n].character!==t)return 0;let n=e.map(e=>e.position),r=function(e,t){return t===0?e:r(t,e%t)},i=n.reduce(r);for(let e=1;e<=n.length;e++)if(n.indexOf(e*i)===-1)return 0;return i}(o);e>0?(n.regular=!0,n.groupingSeparators={position:e,character:o[0].character}):(n.regular=!1,n.groupingSeparators=o)}else n.primary=g.SEQUENCE,n.token=r}}return n}let x={Y:`1`,M:`1`,D:`1`,d:`1`,F:`n`,W:`1`,w:`1`,X:`1`,x:`1`,H:`1`,h:`1`,P:`n`,m:`01`,s:`01`,f:`1`,Z:`01:01`,z:`01:01`,C:`n`,E:`n`};function S(e){var t=[];let n={type:`datetime`,parts:t},r=function(n,r){if(r>n){let i=e.substring(n,r);i=i.split(`]]`).join(`]`),t.push({type:`literal`,value:i})}};for(var i=0,a=0;a<e.length;){if(e.charAt(a)===`[`){if(e.charAt(a+1)===`[`){r(i,a),t.push({type:`literal`,value:`[`}),a+=2,i=a;continue}if(r(i,a),i=a,a=e.indexOf(`]`,i),a===-1)throw{code:`D3135`};let n=e.substring(i+1,a);n=n.split(/\s+/).join(``);var o={type:`marker`,component:n.charAt(0)},s=n.lastIndexOf(`,`),c;if(s!==-1){let e=n.substring(s+1),t=e.indexOf(`-`),r,i,a=function(e){if(e!==void 0&&e!==`*`)return parseInt(e)};t===-1?r=e:(r=e.substring(0,t),i=e.substring(t+1)),o.width={min:a(r),max:a(i)},c=n.substring(1,s)}else c=n.substring(1);if(c.length===1)o.presentation1=c;else if(c.length>1){var l=c.charAt(c.length-1);`atco`.indexOf(l)===-1?o.presentation1=c:(o.presentation2=l,l===`o`&&(o.ordinal=!0),o.presentation1=c.substring(0,c.length-1))}else o.presentation1=x[o.component];if(o.presentation1===void 0)throw{code:`D3132`,value:o.component};if(o.presentation1[0]===`n`)o.names=_.LOWER;else if(o.presentation1[0]===`N`)o.names=o.presentation1[1]===`n`?_.TITLE:_.UPPER;else if(`YMDdFWwXxHhmsf`.indexOf(o.component)!==-1){var u=o.presentation1;if(o.presentation2&&(u+=`;`+o.presentation2),o.integerFormat=b(u),o.width&&o.width.min!==void 0&&o.integerFormat.mandatoryDigits<o.width.min&&(o.integerFormat.mandatoryDigits=o.width.min),o.component===`Y`){if(o.n=-1,o.width&&o.width.max!==void 0)o.n=o.width.max,o.integerFormat.mandatoryDigits=o.n;else{var d=o.integerFormat.mandatoryDigits+o.integerFormat.optionalDigits;d>=2&&(o.n=d)}}let e=t[t.length-1];e&&e.integerFormat&&(e.integerFormat.parseWidth=e.integerFormat.mandatoryDigits)}(o.component===`Z`||o.component===`z`)&&(o.integerFormat=b(o.presentation1)),t.push(o),i=a+1}a++}return r(i,a),n}let C=[``,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],w=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],T=864e5,E=function(e){let t=Date.UTC(e.year,e.month);var n=new Date(t).getUTCDay();return n===0&&(n=7),n>4?t+(8-n)*T:t-(n-1)*T},D=function(e,t){return{year:e,month:t,nextMonth:function(){return t===11?D(e+1,0):D(e,t+1)},previousMonth:function(){return t===0?D(e-1,11):D(e,t-1)},nextYear:function(){return D(e+1,t)},previousYear:function(){return D(e-1,t)}}},O=function(e,t){return(t-e)/(T*7)+1},k=(e,t)=>{let n;switch(t){case`Y`:n=e.getUTCFullYear();break;case`M`:n=e.getUTCMonth()+1;break;case`D`:n=e.getUTCDate();break;case`d`:n=(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(e.getUTCFullYear(),0))/T+1;break;case`F`:n=e.getUTCDay(),n===0&&(n=7);break;case`W`:{let t=D(e.getUTCFullYear(),0),r=E(t),i=Date.UTC(t.year,e.getUTCMonth(),e.getUTCDate()),a=O(r,i);if(a>52)i>=E(t.nextYear())&&(a=1);else if(a<1){let e=E(t.previousYear());a=O(e,i)}n=Math.floor(a);break}case`w`:{let t=D(e.getUTCFullYear(),e.getUTCMonth()),r=E(t),i=Date.UTC(t.year,t.month,e.getUTCDate()),a=O(r,i);if(a>4)i>=E(t.nextMonth())&&(a=1);else if(a<1){let e=E(t.previousMonth());a=O(e,i)}n=Math.floor(a);break}case`X`:{let t=D(e.getUTCFullYear(),0),r=E(t),i=E(t.nextYear()),a=e.getTime();n=a<r?t.year-1:a>=i?t.year+1:t.year;break}case`x`:{let t=D(e.getUTCFullYear(),e.getUTCMonth()),r=E(t),i=t.nextMonth(),a=E(i),o=e.getTime();n=o<r?t.previousMonth().month+1:o>=a?i.month+1:t.month+1;break}case`H`:n=e.getUTCHours();break;case`h`:n=e.getUTCHours(),n%=12,n===0&&(n=12);break;case`P`:n=e.getUTCHours()>=12?`pm`:`am`;break;case`m`:n=e.getUTCMinutes();break;case`s`:n=e.getUTCSeconds();break;case`f`:n=e.getUTCMilliseconds();break;case`Z`:case`z`:break;case`C`:n=`ISO`;break;case`E`:n=`ISO`}return n},A=null;function j(e,t,n){var r=0,i=0;if(n!==void 0){let e=parseInt(n);r=Math.floor(e/100),i=e%100}var a=function(e,t){var n=k(e,t.component);if(`YMDdFWwXxHhms`.indexOf(t.component)!==-1){if(t.component===`Y`&&t.n!==-1&&(n%=10**t.n),t.names){if(t.component===`M`||t.component===`x`)n=w[n-1];else if(t.component===`F`)n=C[n];else throw{code:`D3133`,value:t.component};t.names===_.UPPER?n=n.toUpperCase():t.names===_.LOWER&&(n=n.toLowerCase()),t.width&&n.length>t.width.max&&(n=n.substring(0,t.width.max))}else n=v(n,t.integerFormat)}else if(t.component===`f`)n=v(n,t.integerFormat);else if(t.component===`Z`||t.component===`z`){let e=r*100+i;if(t.integerFormat.regular)n=v(e,t.integerFormat);else{let a=t.integerFormat.mandatoryDigits;if(a===1||a===2)n=v(r,t.integerFormat),i!==0&&(n+=`:`+h(i,`00`));else if(a===3||a===4)n=v(e,t.integerFormat);else throw{code:`D3134`,value:a}}e>=0&&(n=`+`+n),t.component===`z`&&(n=`GMT`+n),e===0&&t.presentation2===`t`&&(n=`Z`)}else t.component===`P`&&t.names===_.UPPER&&(n=n.toUpperCase());return n};let o;t===void 0?(A===null&&(A=S(`[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]`)),o=A):o=S(t);let s=(60*r+i)*60*1e3,c=new Date(e+s),l=``;return o.parts.forEach(function(e){e.type===`literal`?l+=e.value:l+=a(c,e)}),l}function M(e){var t=Object.create(null);if(e.type===`datetime`)t.type=`datetime`,t.parts=e.parts.map(function(e){var t=Object.create(null);if(e.type===`literal`)t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);else if(e.component===`Z`||e.component===`z`){let n;Array.isArray(e.integerFormat.groupingSeparators)||(n=e.integerFormat.groupingSeparators),t.regex=``,e.component===`z`&&(t.regex=`GMT`),t.regex+=`[-+][0-9]+`,n&&(t.regex+=n.character+`[0-9]+`),t.parse=function(t){e.component===`z`&&(t=t.substring(3));let r=0,i=0;return n?(r=Number.parseInt(t.substring(0,t.indexOf(n.character))),i=Number.parseInt(t.substring(t.indexOf(n.character)+1))):t.length-1<=2?r=Number.parseInt(t):(r=Number.parseInt(t.substring(0,3)),i=Number.parseInt(t.substring(3))),r*60+i}}else if(e.component===`f`)t.regex=`[0-9]+`,t.parse=function(e){return parseFloat(`0.`+e.substring(0,3))*1e3};else if(e.integerFormat)t=M(e.integerFormat);else{t.regex=`[a-zA-Z]+`;var n=Object.create(null);if(e.component===`M`||e.component===`x`)w.forEach(function(t,r){e.width&&e.width.max?n[t.substring(0,e.width.max)]=r+1:n[t]=r+1});else if(e.component===`F`)C.forEach(function(t,r){r>0&&(e.width&&e.width.max?n[t.substring(0,e.width.max)]=r:n[t]=r)});else if(e.component===`P`)n={am:0,AM:0,pm:1,PM:1};else throw{code:`D3133`,value:e.component};t.parse=function(e){return n[e]}}return t.component=e.component,t});else{t.type=`integer`;let n=e.case===_.UPPER;switch(e.primary){case g.LETTERS:t.regex=n?`[A-Z]+`:`[a-z]+`,t.parse=function(e){return m(e,n?`A`:`a`)};break;case g.ROMAN:t.regex=n?`[MDCLXVI]+`:`[mdclxvi]+`,t.parse=function(e){return f(n?e:e.toUpperCase())};break;case g.WORDS:t.regex=`(?:`+r.keys(s).concat(`and`,`[\\-, ]`).join(`|`)+`)+`,t.parse=function(e){return c(e.toLowerCase())};break;case g.DECIMAL:t.regex=`[0-9]`,e.parseWidth?t.regex+=`{${e.parseWidth}}`:t.regex+=`+`,e.ordinal&&(t.regex+=`(?:th|st|nd|rd)`),t.parse=function(t){let n=t;return e.ordinal&&(n=t.substring(0,t.length-2)),e.regular?n=n.split(`,`).join(``):e.groupingSeparators.forEach(e=>{n=n.split(e.character).join(``)}),e.zeroCode!==48&&(n=n.split(``).map(t=>String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48)).join(``)),parseInt(n)};break;case g.SEQUENCE:throw{code:`D3130`,value:e.token}}}return t}function N(e,t){if(e!==void 0)return M(b(t)).parse(e)}function ee(e,t){let n=M(S(t)),r=`^`+n.parts.map(e=>`(`+e.regex+`)`).join(``)+`$`;var i=new RegExp(r,`i`).exec(e);if(i!==null){let e=Object.create(null);for(let t=1;t<i.length;t++){let r=n.parts[t-1];r.parse&&(e[r.component]=r.parse(i[t]))}if(Object.getOwnPropertyNames(e).length===0)return;let t=0,r=e=>{t<<=1,t+=+!!e},o=e=>!(~e&t)&&!!(e&t);`YXMxWwdD`.split(``).forEach(t=>r(e[t]));let s=!o(161)&&o(130),c=o(84),l=!c&&o(72);t=0,`PHhmsf`.split(``).forEach(t=>r(e[t]));let u=!o(23)&&o(47),d=(s?`YD`:c?`XxwF`:l?`XWF`:`YMD`)+(u?`Phmsf`:`Hmsf`),f=this.environment.timestamp,p=!1,m=!1;if(d.split(``).forEach(t=>{if(e[t]===void 0)p?(e[t]=`MDd`.indexOf(t)===-1?0:1,m=!0):e[t]=k(f,t);else if(p=!0,m)throw{code:`D3136`}}),e.M>0?--e.M:e.M=0,s){let t=Date.UTC(e.Y,0),n=(e.d-1)*1e3*60*60*24,r=new Date(t+n);e.M=r.getUTCMonth(),e.D=r.getUTCDate()}if(c||l)throw{code:`D3136`};u&&(e.H=e.h===12?0:e.h,e.P===1&&(e.H+=12));var a=Date.UTC(e.Y,e.M,e.D,e.H,e.m,e.s,e.f);return(e.Z||e.z)&&(a-=(e.Z||e.z)*60*1e3),a}}var P=RegExp(`^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$`);function F(e,t){if(e!==void 0){if(t===void 0){if(!P.test(e))throw{stack:Error().stack,code:`D3110`,value:e};return Date.parse(e)}return ee.call(this,e,t)}}function te(e,t,n){if(e!==void 0)return j.call(this,e,t,n)}return{formatInteger:h,parseInteger:N,fromMillis:te,toMillis:F}})()},{"./utils":6}],2:[function(e,t,n){(function(n){(function(){var r=e("./utils");t.exports=(()=>{var e=r.isNumeric,t=r.isArrayOfStrings,i=r.isArrayOfNumbers,a=r.isSequence,o=r.isFunction,s=r.isLambda,c=r.isPromise,l=r.getFunctionArity,u=r.isDeepEqual,d=r.stringToArray;function f(e){if(e!==void 0){var t=0;return e.forEach(function(e){t+=e}),t}}function p(e){return e===void 0?0:e.length}function m(e){if(e!==void 0&&e.length!==0)return Math.max.apply(Math,e)}function h(e){if(e!==void 0&&e.length!==0)return Math.min.apply(Math,e)}function g(e){if(e!==void 0&&e.length!==0){var t=0;return e.forEach(function(e){t+=e}),t/e.length}}function _(t,n=!1){if(t!==void 0){var r;if(typeof t==`string`)r=t;else if(o(t))r=``;else if(typeof t==`number`&&!isFinite(t))throw{code:`D3001`,value:t,stack:Error().stack};else{var i=n?2:0;Array.isArray(t)&&t.outerWrapper&&(t=t[0]),r=JSON.stringify(t,function(t,n){return n!=null&&e(n)?n.toPrecision&&!Number.isInteger(n)?Number(n.toPrecision(15)):n:n&&o(n)?``:n},i)}return r}}function v(e,t,n){if(e!==void 0){var r=d(e),i=r.length;if(i+t<0&&(t=0),n!==void 0){if(n<=0)return``;var a=t>=0?t+n:i+t+n;return r.slice(t,a).join(``)}return r.slice(t).join(``)}}function y(e,t){if(e!==void 0){var n=e.indexOf(t);return n>-1?e.substr(0,n):e}}function b(e,t){if(e!==void 0){var n=e.indexOf(t);return n>-1?e.substr(n+t.length):e}}function x(e){if(e!==void 0)return e.toLowerCase()}function S(e){if(e!==void 0)return e.toUpperCase()}function C(e){if(e!==void 0)return d(e).length}function w(e){if(e!==void 0){var t=e.replace(/[ \t\n\r]+/gm,` `);return t.charAt(0)===` `&&(t=t.substring(1)),t.charAt(t.length-1)===` `&&(t=t.substring(0,t.length-1)),t}}function T(e,t,n){if(e!==void 0){(n===void 0||n.length===0)&&(n=` `);var r;t=Math.trunc(t);var i=Math.abs(t)-C(e);if(i>0){var a=Array(i+1).join(n);n.length>1&&(a=v(a,0,i)),r=t>0?e+a:a+e}else r=e;return r}}async function E(e,t){var n=e.apply(this,[t]);if(c(n)&&(n=await n),n&&!(typeof n.start==`number`||n.end===`number`||Array.isArray(n.groups)||o(n.next)))throw{code:`T1010`,stack:Error().stack};return n}async function D(e,t){if(e!==void 0&&t!==void 0)return typeof t==`string`?e.indexOf(t)!==-1:await E(t,e)!==void 0}async function O(e,t,n){if(e!==void 0){if(n<0)throw{stack:Error().stack,value:n,code:`D3040`,index:3};var r=this.createSequence();if(n===void 0||n>0){var i=0,a=await E(t,e);if(a!==void 0)for(;a!==void 0&&(n===void 0||i<n);)r.push({match:a.match,index:a.start,groups:a.groups}),a=await E(a.next),i++}return r}}async function k(e,t,n,r){if(e!==void 0){var i=this;if(t===``)throw{code:`D3010`,stack:Error().stack,value:t,index:2};if(r<0)throw{code:`D3011`,stack:Error().stack,value:r,index:4};var a=typeof n==`string`?function(e){for(var t=``,r=0,i=n.indexOf(`$`,r);i!==-1&&r<n.length;){t+=n.substring(r,i),r=i+1;var a=n.charAt(r);if(a===`$`)t+=`$`,r++;else if(a===`0`)t+=e.match,r++;else{var o=e.groups.length===0?1:Math.floor(Math.log(e.groups.length)*Math.LOG10E)+1;if(i=parseInt(n.substring(r,r+o),10),o>1&&i>e.groups.length&&(i=parseInt(n.substring(r,r+o-1),10)),isNaN(i))t+=`$`;else{if(e.groups.length>0){var s=e.groups[i-1];s!==void 0&&(t+=s)}r+=i.toString().length}}i=n.indexOf(`$`,r)}return t+=n.substring(r),t}:n,o=``,s=0;if(r===void 0||r>0){var l=0;if(typeof t==`string`){for(var u=e.indexOf(t,s);u!==-1&&(r===void 0||l<r);)o+=e.substring(s,u),o+=n,s=u+t.length,l++,u=e.indexOf(t,s);o+=e.substring(s)}else{var d=await E(t,e);if(d!==void 0){for(;d!==void 0&&(r===void 0||l<r);){o+=e.substring(s,d.start);var f=a.apply(i,[d]);if(c(f)&&(f=await f),typeof f==`string`)o+=f;else throw{code:`D3012`,stack:Error().stack,value:f};s=d.start+d.match.length,l++,d=await E(d.next)}o+=e.substring(s)}else o=e}}else o=e;return o}}function A(e){if(e!==void 0)return(typeof window<`u`?window.btoa:function(e){return new n.Buffer.from(e,`binary`).toString(`base64`)})(e)}function j(e){if(e!==void 0)return(typeof window<`u`?window.atob:function(e){return new n.Buffer.from(e,`base64`).toString(`binary`)})(e)}function M(e){if(e!==void 0){var t;try{t=encodeURIComponent(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`encodeUrlComponent`}}return t}}function N(e){if(e!==void 0){var t;try{t=encodeURI(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`encodeUrl`}}return t}}function ee(e){if(e!==void 0){var t;try{t=decodeURIComponent(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`decodeUrlComponent`}}return t}}function P(e){if(e!==void 0){var t;try{t=decodeURI(e)}catch{throw{code:`D3140`,stack:Error().stack,value:e,functionName:`decodeUrl`}}return t}}async function F(e,t,n){if(e!==void 0){if(n<0)throw{code:`D3020`,stack:Error().stack,value:n,index:3};var r=[];if(n===void 0||n>0){if(typeof t==`string`)r=e.split(t,n);else{var i=0,a=await E(t,e);if(a!==void 0){for(var o=0;a!==void 0&&(n===void 0||i<n);)r.push(e.substring(o,a.start)),o=a.end,a=await E(a.next),i++;(n===void 0||i<n)&&r.push(e.substring(o))}else r.push(e)}}return r}}function te(e,t){if(e!==void 0)return t===void 0&&(t=``),e.join(t)}function ne(e,t,n){if(e!==void 0){var i={"decimal-separator":`.`,"grouping-separator":`,`,"exponent-separator":`e`,infinity:`Infinity`,"minus-sign":`-`,NaN:`NaN`,percent:`%`,"per-mille":`‰`,"zero-digit":`0`,digit:`#`,"pattern-separator":`;`};n!==void 0&&r.keys(n).forEach(function(e){i[e]=n[e]});for(var a=[],o=i[`zero-digit`].charCodeAt(0),s=o;s<o+10;s++)a.push(String.fromCharCode(s));var c=a.concat([i[`decimal-separator`],i[`exponent-separator`],i[`grouping-separator`],i.digit,i[`pattern-separator`]]),l=t.split(i[`pattern-separator`]);if(l.length>2)throw{code:`D3080`,stack:Error().stack};var u=function(e){var t=(function(){for(var t,n=0;n<e.length;n++)if(t=e.charAt(n),c.indexOf(t)!==-1&&t!==i[`exponent-separator`])return e.substring(0,n);return``})(),n=(function(){for(var t,n=e.length-1;n>=0;n--)if(t=e.charAt(n),c.indexOf(t)!==-1&&t!==i[`exponent-separator`])return e.substring(n+1);return``})(),r=e.substring(t.length,e.length-n.length),a,o,s,l,u=e.indexOf(i[`exponent-separator`],t.length);u===-1||u>e.length-n.length?(a=r,o=void 0):(a=r.substring(0,u),o=r.substring(u+1));var d=a.indexOf(i[`decimal-separator`]);return d===-1?(s=a,l=n):(s=a.substring(0,d),l=a.substring(d+1)),{prefix:t,suffix:n,activePart:r,mantissaPart:a,exponentPart:o,integerPart:s,fractionalPart:l,subpicture:e}},d=function(e){var t,n,r=e.subpicture,o=r.indexOf(i[`decimal-separator`]);o!==r.lastIndexOf(i[`decimal-separator`])&&(t=`D3081`),r.indexOf(i.percent)!==r.lastIndexOf(i.percent)&&(t=`D3082`),r.indexOf(i[`per-mille`])!==r.lastIndexOf(i[`per-mille`])&&(t=`D3083`),r.indexOf(i.percent)!==-1&&r.indexOf(i[`per-mille`])!==-1&&(t=`D3084`);var s=!1;for(n=0;n<e.mantissaPart.length;n++){var l=e.mantissaPart.charAt(n);if(a.indexOf(l)!==-1||l===i.digit){s=!0;break}}s||(t=`D3085`),e.activePart.split(``).map(function(e){return c.indexOf(e)===-1?`p`:`a`}).join(``).indexOf(`p`)!==-1&&(t=`D3086`),o===-1?e.integerPart.charAt(e.integerPart.length-1)===i[`grouping-separator`]&&(t=`D3088`):(r.charAt(o-1)===i[`grouping-separator`]||r.charAt(o+1)===i[`grouping-separator`])&&(t=`D3087`),r.indexOf(i[`grouping-separator`]+i[`grouping-separator`])!==-1&&(t=`D3089`);var u=e.integerPart.indexOf(i.digit);u!==-1&&e.integerPart.substring(0,u).split(``).filter(function(e){return a.indexOf(e)>-1}).length>0&&(t=`D3090`),u=e.fractionalPart.lastIndexOf(i.digit),u!==-1&&e.fractionalPart.substring(u).split(``).filter(function(e){return a.indexOf(e)>-1}).length>0&&(t=`D3091`);var d=typeof e.exponentPart==`string`;if(d&&e.exponentPart.length>0&&(r.indexOf(i.percent)!==-1||r.indexOf(i[`per-mille`])!==-1)&&(t=`D3092`),d&&(e.exponentPart.length===0||e.exponentPart.split(``).filter(function(e){return a.indexOf(e)===-1}).length>0)&&(t=`D3093`),t)throw{code:t,stack:Error().stack}},f=function(e){var t=function(t,n){for(var r=[],o=t.indexOf(i[`grouping-separator`]);o!==-1;){var s=(n?t.substring(0,o):t.substring(o)).split(``).filter(function(e){return a.indexOf(e)!==-1||e===i.digit}).length;r.push(s),o=e.integerPart.indexOf(i[`grouping-separator`],o+1)}return r},n=t(e.integerPart),r=function(e){if(e.length===0)return 0;for(var t=function(e,n){return n===0?e:t(n,e%n)},n=e.reduce(t),r=1;r<=e.length;r++)if(e.indexOf(r*n)===-1)return 0;return n}(n),o=t(e.fractionalPart,!0),s=e.integerPart.split(``).filter(function(e){return a.indexOf(e)!==-1}).length,c=s,l=e.fractionalPart.split(``),u=l.filter(function(e){return a.indexOf(e)!==-1}).length,d=l.filter(function(e){return a.indexOf(e)!==-1||e===i.digit}).length,f=typeof e.exponentPart==`string`;s===0&&d===0&&(f?(u=1,d=1):s=1),f&&s===0&&e.integerPart.indexOf(i.digit)!==-1&&(s=1),s===0&&u===0&&(u=1);var p=0;return f&&(p=e.exponentPart.split(``).filter(function(e){return a.indexOf(e)!==-1}).length),{integerPartGroupingPositions:n,regularGrouping:r,minimumIntegerPartSize:s,scalingFactor:c,prefix:e.prefix,fractionalPartGroupingPositions:o,minimumFactionalPartSize:u,maximumFactionalPartSize:d,minimumExponentSize:p,suffix:e.suffix,picture:e.subpicture}},p=l.map(u);p.forEach(d);var m=p.map(f),h=i[`minus-sign`],g=i[`zero-digit`],_=i[`decimal-separator`],v=i[`grouping-separator`];m.length===1&&(m.push(JSON.parse(JSON.stringify(m[0]))),m[1].prefix=h+m[1].prefix);var y=e>=0?m[0]:m[1],b=y.picture.indexOf(i.percent)===-1?y.picture.indexOf(i[`per-mille`])===-1?e:e*1e3:e*100,x,S;if(y.minimumExponentSize===0)x=b;else{var C=10**y.scalingFactor,w=10**(y.scalingFactor-1);if(x=b,S=0,x!==0){for(;Math.abs(x)<w;)x*=10,--S;for(;Math.abs(x)>C;)x/=10,S+=1}}var T=I(x,y.maximumFactionalPartSize),E=function(e,t){var n=Math.abs(e).toFixed(t);return g!==`0`&&(n=n.split(``).map(function(e){return e>=`0`&&e<=`9`?a[e.charCodeAt(0)-48]:e}).join(``)),n},D=E(T,y.maximumFactionalPartSize),O=D.indexOf(`.`);for(O===-1?D+=_:D=D.replace(`.`,_);D.charAt(0)===g;)D=D.substring(1);for(;D.charAt(D.length-1)===g;)D=D.substring(0,D.length-1);O=D.indexOf(_);var k=y.minimumIntegerPartSize-O,A=y.minimumFactionalPartSize-(D.length-O-1);if(D=(k>0?Array(k+1).join(g):``)+D,D+=A>0?Array(A+1).join(g):``,O=D.indexOf(_),y.regularGrouping>0)for(var j=Math.floor((O-1)/y.regularGrouping),M=1;M<=j;M++)D=[D.slice(0,O-M*y.regularGrouping),v,D.slice(O-M*y.regularGrouping)].join(``);else y.integerPartGroupingPositions.forEach(function(e){D=[D.slice(0,O-e),v,D.slice(O-e)].join(``),O++});if(O=D.indexOf(_),y.fractionalPartGroupingPositions.forEach(function(e){D=[D.slice(0,e+O+1),v,D.slice(e+O+1)].join(``)}),O=D.indexOf(_),(y.picture.indexOf(_)===-1||O===D.length-1)&&(D=D.substring(0,D.length-1)),S!==void 0){var N=E(S,0);k=y.minimumExponentSize-N.length,k>0&&(N=Array(k+1).join(g)+N),D=D+i[`exponent-separator`]+(S<0?h:``)+N}return D=y.prefix+D+y.suffix,D}}function re(e,t){if(e!==void 0){if(e=I(e),t=t===void 0?10:I(t),t<2||t>36)throw{code:`D3100`,stack:Error().stack,value:t};return e.toString(t)}}function ie(e){var t;if(e!==void 0){if(typeof e==`number`)t=e;else if(typeof e==`string`&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e))t=parseFloat(e);else if(typeof e==`string`&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(e))t=Number(e);else if(e===!0)t=1;else if(e===!1)t=0;else throw{code:`D3030`,value:e,stack:Error().stack,index:1};return t}}function ae(e){var t;if(e!==void 0)return t=Math.abs(e),t}function oe(e){var t;if(e!==void 0)return t=Math.floor(e),t}function se(e){var t;if(e!==void 0)return t=Math.ceil(e),t}function I(e,t){var n;if(e!==void 0){if(t){var r=e.toString().split(`e`);e=+(r[0]+`e`+(r[1]?+r[1]+t:t))}n=Math.round(e);var i=n-e;return Math.abs(i)===.5&&Math.abs(n%2)===1&&--n,t&&(r=n.toString().split(`e`),n=+(r[0]+`e`+(r[1]?+r[1]-t:-t))),Object.is(n,-0)&&(n=0),n}}function ce(e){var t;if(e!==void 0){if(e<0)throw{stack:Error().stack,code:`D3060`,index:1,value:e};return t=Math.sqrt(e),t}}function le(e,t){var n;if(e!==void 0){if(n=e**+t,!isFinite(n))throw{stack:Error().stack,code:`D3061`,index:1,value:e,exp:t};return n}}function ue(){return Math.random()}function de(t){if(t!==void 0){var n=!1;return Array.isArray(t)?t.length===1?n=de(t[0]):t.length>1&&(n=t.filter(function(e){return de(e)}).length>0):typeof t==`string`?t.length>0&&(n=!0):e(t)?t!==0&&(n=!0):typeof t==`object`&&t&&!o(t)?r.keys(t).length>0&&(n=!0):typeof t==`boolean`&&t===!0&&(n=!0),n}}function fe(e){if(e!==void 0)return!de(e)}function pe(e,t,n,r){var i=[t],a=l(e);return a>=2&&i.push(n),a>=3&&i.push(r),i}async function me(e,t){if(e!==void 0){for(var n=this.createSequence(),r=0;r<e.length;r++){var i=pe(t,e[r],r,e),a=await t.apply(this,i);a!==void 0&&n.push(a)}return n}}async function he(e,t){if(e!==void 0){for(var n=this.createSequence(),r=0;r<e.length;r++){var i=e[r],a=pe(t,i,r,e);de(await t.apply(this,a))&&n.push(i)}return n}}async function ge(e,t){if(e!==void 0){for(var n=!1,r,i=0;i<e.length;i++){var a=e[i],o=!0;if(t!==void 0){var s=pe(t,a,i,e);o=de(await t.apply(this,s))}if(o){if(!n)r=a,n=!0;else throw{stack:Error().stack,code:`D3138`,index:i}}}if(!n)throw{stack:Error().stack,code:`D3139`};return r}}function _e(){for(var e=[],t=Array.prototype.slice.call(arguments),n=Math.min.apply(Math,t.map(function(e){return Array.isArray(e)?e.length:0})),r=0;r<n;r++){var i=t.map(e=>e[r]);e.push(i)}return e}async function ve(e,t,n){if(e!==void 0){var r,i=l(t);if(i<2)throw{stack:Error().stack,code:`D3050`,index:1};var a;for(n===void 0&&e.length>0?(r=e[0],a=1):(r=n,a=0);a<e.length;){var o=[r,e[a]];i>=3&&o.push(a),i>=4&&o.push(e),r=await t.apply(this,o),a++}return r}}function ye(e){var t=this.createSequence();if(Array.isArray(e)){for(var n=Object.create(null),i=0;i<e.length;i++)ye.call(this,e[i]).forEach(function(e){n[e]=!0});t=ye.call(this,n)}else typeof e==`object`&&e&&!o(e)&&r.keys(e).forEach(e=>t.push(e));return t}function be(e,t){var n;if(Array.isArray(e)){n=this.createSequence();for(var r=0;r<e.length;r++){var i=be.call(this,e[r],t);i!==void 0&&(Array.isArray(i)?i.forEach(e=>n.push(e)):n.push(i))}}else typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,t)&&!o(e)&&(n=e[t]);return n}function xe(e,t){if(e===void 0)return t;if(t===void 0)return e;Array.isArray(e)||(e=this.createSequence(e)),Array.isArray(t)||(t=[t]);let n=e.length+t.length;if(this.options&&n>this.options.sequence)throw{code:`D2015`,stack:Error().stack,value:n};return e.concat(t)}function Se(e){return e!==void 0}function Ce(e){var t=this.createSequence();if(Array.isArray(e))for(var n=0;n<e.length;n++)t=xe.call(this,t,Ce.call(this,e[n]));else if(typeof e==`object`&&e&&!s(e))for(let n of r.keys(e)){var i=Object.create(null);i[n]=e[n],t.push(i)}else t=e;return t}function L(e){if(e!==void 0){var t=Object.create(null);return e.forEach(function(e){for(let n of r.keys(e))t[n]=e[n]}),t}}function we(e){if(e!==void 0){if(e.length<=1)return e;for(var t=e.length,n=Array(t),r=0;r<t;r++)n[t-r-1]=e[r];return n}}async function Te(e,t){var n=this.createSequence();for(let o of r.keys(e)){var i=pe(t,e[o],o,e),a=await t.apply(this,i);a!==void 0&&n.push(a)}return n}function Ee(e){throw{code:`D3137`,stack:Error().stack,message:e||`$error() function evaluated`}}function De(e,t){if(!e)throw{code:`D3141`,stack:Error().stack,message:t||`$assert() statement failed`}}function Oe(t){if(t!==void 0)return t===null?`null`:e(t)?`number`:typeof t==`string`?`string`:typeof t==`boolean`?`boolean`:Array.isArray(t)?`array`:o(t)?`function`:`object`}async function ke(e,n){if(e!==void 0){if(e.length<=1)return e;var r;if(n===void 0){if(!i(e)&&!t(e))throw{stack:Error().stack,code:`D3070`,index:1};r=async function(e,t){return e>t}}else r=n;var a=async function(e,t){var n=async function(e,t,i){t.length===0?Array.prototype.push.apply(e,i):i.length===0?Array.prototype.push.apply(e,t):await r(t[0],i[0])?(e.push(i[0]),await n(e,t,i.slice(1))):(e.push(t[0]),await n(e,t.slice(1),i))},i=[];return await n(i,e,t),i},o=async function(e){if(!Array.isArray(e)||e.length<=1)return e;var t=Math.floor(e.length/2),n=e.slice(0,t),r=e.slice(t);return n=await o(n),r=await o(r),await a(n,r)};return await o(e)}}function Ae(e){if(e!==void 0){if(e.length<=1)return e;for(var t=Array(e.length),n=0;n<e.length;n++){var r=Math.floor(Math.random()*(n+1));n!==r&&(t[n]=t[r]),t[r]=e[n]}return t}}function je(e){if(e!==void 0){if(!Array.isArray(e)||e.length<=1)return e;for(var t=a(e)?this.createSequence():[],n=0;n<e.length;n++){for(var r=e[n],i=!1,o=0;o<t.length;o++)if(u(r,t[o])){i=!0;break}i||t.push(r)}return t}}async function Me(e,t){var n=Object.create(null);for(let o of r.keys(e)){var i=e[o],a=pe(t,i,o,e);de(await t.apply(this,a))&&(n[o]=i)}return r.keys(n).length===0&&(n=void 0),n}return{sum:f,count:p,max:m,min:h,average:g,string:_,substring:v,substringBefore:y,substringAfter:b,lowercase:x,uppercase:S,length:C,trim:w,pad:T,match:O,contains:D,replace:k,split:F,join:te,formatNumber:ne,formatBase:re,number:ie,floor:oe,ceil:se,round:I,abs:ae,sqrt:ce,power:le,random:ue,boolean:de,not:fe,map:me,zip:_e,filter:he,single:ge,foldLeft:ve,sift:Me,keys:ye,lookup:be,append:xe,exists:Se,spread:Ce,merge:L,reverse:we,each:Te,error:Ee,assert:De,type:Oe,sort:ke,shuffle:Ae,distinct:je,base64encode:A,base64decode:j,encodeUrlComponent:M,encodeUrl:N,decodeUrlComponent:ee,decodeUrl:P}})()}).call(this)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{"./utils":6}],3:[function(e,t,n){var r=e("./datetime"),i=e("./functions"),a=e("./utils"),o=e("./parser"),s=e("./signature");t.exports=(function(){var e=a.isNumeric,t=a.isArrayOfStrings,n=a.isArrayOfNumbers,c=a.isSequence,l=a.isFunction,u=a.isLambda,d=a.isIterable,f=a.isPromise,p=a.getFunctionArity,m=a.isDeepEqual,h=Ee(null);async function g(e,t,n){var r;n.base.depth++,n.base.guardrails();var i=n.lookup(Symbol.for(`jsonata.__evaluate_entry`));switch(i&&await i(e,t,n),e.type){case`path`:r=await _(e,t,n);break;case`binary`:r=await C(e,t,n);break;case`unary`:r=await w(e,t,n);break;case`name`:r=T(e,t,n);break;case`string`:case`number`:case`value`:r=E(e,t,n);break;case`wildcard`:r=D(e,t,n);break;case`descendant`:r=k(e,t,n);break;case`parent`:r=n.lookup(e.slot.label);break;case`condition`:r=await oe(e,t,n);break;case`block`:r=await se(e,t,n);break;case`bind`:r=await ae(e,t,n);break;case`regex`:r=I(e,t,n);break;case`function`:r=await pe(e,t,n);break;case`variable`:r=ce(e,t,n);break;case`lambda`:r=ge(e,t,n);break;case`partial`:r=await _e(e,t,n);break;case`apply`:r=await fe(e,t,n);break;case`transform`:r=ue(e,t,n)}if(Object.prototype.hasOwnProperty.call(e,`predicate`))for(var a=0;a<e.predicate.length;a++)r=await S(e.predicate[a].expr,r,n);e.type!==`path`&&Object.prototype.hasOwnProperty.call(e,`group`)&&(r=await ne(e.group,r,n));var o=n.lookup(Symbol.for(`jsonata.__evaluate_exit`));return o&&await o(e,t,n,r),r&&c(r)&&!r.tupleStream&&(e.keepArray&&(r.keepSingleton=!0),r.length===0?r=void 0:r.length===1&&(r=r.keepSingleton?r:r[0])),n.base.depth--,r}async function _(e,t,n){for(var r=Array.isArray(t)&&e.steps[0].type!==`variable`?t:n.base.createSequence(t),i,a=!1,o=void 0,s=0;s<e.steps.length;s++){var c=e.steps[s];if(c.tuple&&(a=!0),s===0&&c.consarray?i=await g(c,r,n):a?o=await x(c,r,o,n):i=await y(c,r,n,s===e.steps.length-1),!a&&(i===void 0||i.length===0))break;c.focus===void 0&&(r=i)}if(a){if(e.tuple)i=o;else for(i=n.base.createSequence(),s=0;s<o.length;s++)i.push(o[s][`@`])}return e.keepSingletonArray&&(Array.isArray(i)&&i.cons&&!i.sequence&&(i=n.base.createSequence(i)),i.keepSingleton=!0),Object.prototype.hasOwnProperty.call(e,`group`)&&(i=await ne(e.group,a?o:i,n)),i}function v(e,t){var n=Ee(e);for(let e of a.keys(t))n.bind(e,t[e]);return n}async function y(e,t,n,r){var i;if(e.type===`sort`)return i=await le(e,t,n),e.stages&&(i=await b(e.stages,i,n)),i;i=n.base.createSequence();for(var a=0;a<t.length;a++){var o=await g(e,t[a],n);if(e.stages)for(var s=0;s<e.stages.length;s++)o=await S(e.stages[s].expr,o,n);o!==void 0&&i.push(o)}var l=n.base.createSequence();return r&&i.length===1&&Array.isArray(i[0])&&!c(i[0])?l=i[0]:Array.prototype.forEach.call(i,function(e){!Array.isArray(e)||e.cons?l.push(e):Array.prototype.forEach.call(e,e=>l.push(e))}),l}async function b(e,t,n){for(var r=t,i=0;i<e.length;i++){var a=e[i];switch(a.type){case`filter`:r=await S(a.expr,r,n);break;case`index`:for(var o=0;o<r.length;o++){var s=r[o];s[a.value]=o}}}return r}async function x(e,t,n,r){var i;if(e.type===`sort`){if(n)i=await le(e,n,r);else{var a=await le(e,t,r);i=r.base.createSequence(),i.tupleStream=!0;for(var o=0;o<a.length;o++){var s={"@":a[o]};s[e.index]=o,i.push(s)}}return e.stages&&(i=await b(e.stages,i,r)),i}i=r.base.createSequence(),i.tupleStream=!0;var c=r;n===void 0&&(n=t.map(e=>({"@":e})));for(var l=0;l<n.length;l++){c=v(r,n[l]);var u=await g(e,n[l][`@`],c);if(u!==void 0){Array.isArray(u)||(u=[u]);for(var d=0;d<u.length;d++)s=Object.create(null),Object.assign(s,n[l]),u.tupleStream?Object.assign(s,u[d]):(e.focus?(s[e.focus]=u[d],s[`@`]=n[l][`@`]):s[`@`]=u[d],e.index&&(s[e.index]=d),e.ancestor&&(s[e.ancestor.label]=n[l][`@`])),i.push(s)}}return e.stages&&(i=await b(e.stages,i,r)),i}async function S(t,r,a){var o=a.base.createSequence();if(r&&r.tupleStream&&(o.tupleStream=!0),Array.isArray(r)||(r=a.base.createSequence(r)),t.type===`number`){var s=Math.floor(t.value);s<0&&(s=r.length+s);var c=await r[s];c!==void 0&&(Array.isArray(c)?o=c:o.push(c))}else for(s=0;s<r.length;s++){var c=r[s],l=c,u=a;r.tupleStream&&(l=c[`@`],u=v(a,c));var d=await g(t,l,u);e(d)&&(d=[d]),n(d)?Array.prototype.forEach.call(d,function(e){var t=Math.floor(e);t<0&&(t=r.length+t),t===s&&o.push(c)}):i.boolean(d)&&o.push(c)}return o}async function C(e,t,n){var r,i=await g(e.lhs,t,n),a=e.value,o=async()=>await g(e.rhs,t,n);if(a===`and`||a===`or`)try{return await P(i,o,a)}catch(t){throw t.position=e.position,t.token=a,t}var s=await o();try{switch(a){case`+`:case`-`:case`*`:case`/`:case`%`:r=j(i,s,a);break;case`=`:case`!=`:r=M(i,s,a);break;case`<`:case`<=`:case`>`:case`>=`:r=N(i,s,a);break;case`&`:r=te(i,s);break;case`..`:r=ie(i,s,n);break;case`in`:r=ee(i,s)}}catch(t){throw t.position=e.position,t.token=a,t}return r}async function w(t,n,r){var a,o={options:r.base.options,createSequence:r.base.createSequence};switch(t.value){case`-`:if(a=await g(t.expression,n,r),a===void 0)a=void 0;else if(e(a))a=-a;else throw{code:`D1002`,stack:Error().stack,position:t.position,token:t.value,value:a};break;case`[`:a=[];let l=await Promise.all(t.expressions.map(async(e,t)=>(r.isParallelCall=t>0,[e,await g(e,n,r)])));for(let e of l){var[s,c]=e;c!==void 0&&(s.value===`[`?a.push(c):a=i.append.call(o,a,c))}t.consarray&&Object.defineProperty(a,"cons",{enumerable:!1,configurable:!1,value:!0});break;case`{`:a=await ne(t,n,r)}return a}function T(e,t,n){var r={createSequence:n.base.createSequence};return i.lookup.call(r,t,e.value)}function E(e){return e.value}function D(e,t,n){var r={options:n.base.options,createSequence:n.base.createSequence},o=r.createSequence();return Array.isArray(t)&&t.outerWrapper&&t.length>0&&(t=t[0]),typeof t==`object`&&t&&!l(t)&&a.keys(t).forEach(function(e){var n=t[e];Array.isArray(n)?(n=O(n),o=i.append.call(r,o,n)):o.push(n)}),o}function O(e,t){return t===void 0&&(t=[]),Array.isArray(e)?Array.prototype.forEach.call(e,function(e){O(e,t)}):t.push(e),t}function k(e,t,n){var r,i=n.base.createSequence();return t!==void 0&&(A(t,i),r=i.length===1?i[0]:i),r}function A(e,t){Array.isArray(e)||t.push(e),Array.isArray(e)?Array.prototype.forEach.call(e,function(e){A(e,t)}):typeof e==`object`&&e&&!l(e)&&a.keys(e).forEach(function(n){A(e[n],t)})}function j(t,n,r){var i;if(t!==void 0&&!e(t))throw{code:`T2001`,stack:Error().stack,value:t};if(n!==void 0&&!e(n))throw{code:`T2002`,stack:Error().stack,value:n};if(t===void 0||n===void 0)return i;switch(r){case`+`:i=t+n;break;case`-`:i=t-n;break;case`*`:i=t*n;break;case`/`:i=t/n;break;case`%`:i=t%n}return i}function M(e,t,n){var r;if(e===void 0||t===void 0)return!1;switch(n){case`=`:r=m(e,t);break;case`!=`:r=!m(e,t)}return r}function N(e,t,n){var r,i=typeof e,a=typeof t;if(i!==`undefined`&&i!==`string`&&i!==`number`||a!==`undefined`&&a!==`string`&&a!==`number`)throw{code:`T2010`,stack:Error().stack,value:i!==`string`&&i!==`number`?e:t};if(i!==`undefined`&&a!==`undefined`){if(i!==a)throw{code:`T2009`,stack:Error().stack,value:e,value2:t};switch(n){case`<`:r=e<t;break;case`<=`:r=e<=t;break;case`>`:r=e>t;break;case`>=`:r=e>=t}return r}}function ee(e,t){var n=!1;if(e===void 0||t===void 0)return!1;Array.isArray(t)||(t=[t]);for(var r=0;r<t.length;r++)if(t[r]===e){n=!0;break}return n}async function P(e,t,n){var r,i=F(e);switch(n){case`and`:r=i&&F(await t());break;case`or`:r=i||F(await t())}return r}function F(e){var t=i.boolean(e);return t!==void 0&&t}function te(e,t){var n,r=``,a=``;return e!==void 0&&(r=i.string(e)),t!==void 0&&(a=i.string(t)),n=r.concat(a),n}async function ne(e,t,n){var r=Object.create(null),o=Object.create(null),s=!!(t&&t.tupleStream),c={options:n.base.options,createSequence:n.base.createSequence};if(!Array.isArray(t))options:n.base.options,t=c.createSequence(t);t.length===0&&!s&&t.push(void 0);for(var l=0;l<t.length;l++)for(var u=t[l],d=s?v(n,u):n,f=0;f<e.lhs.length;f++){var p=e.lhs[f],m=await g(p[0],s?u[`@`]:u,d);if(typeof m!=`string`&&m!==void 0)throw{code:`T1003`,stack:Error().stack,position:e.position,value:m};if(m!==void 0){if(m===`_jsonata_lambda`||m===`_jsonata_function`)throw{code:`D1013`,stack:Error().stack,position:e.position,value:m};var h={data:u,exprIndex:f};if(Object.prototype.hasOwnProperty.call(o,m)){if(o[m].exprIndex!==f)throw{code:`D1009`,stack:Error().stack,position:e.position,value:m};o[m].data=i.append.call(c,o[m].data,u)}else o[m]=h}}let _=await Promise.all(a.keys(o).map(async(t,r)=>{let i=o[t];var a=i.data,c=n;if(s){var l=re(i.data,n);a=l[`@`],delete l[`@`],c=v(n,l)}return n.isParallelCall=r>0,[t,await g(e.lhs[i.exprIndex][1],a,c)]}));for(let e of _){var[m,y]=await e;y!==void 0&&(r[m]=y)}return r}function re(e,t){if(!Array.isArray(e))return e;var n=Object.create(null),r={options:t.base.options,createSequence:t.base.createSequence};Object.assign(n,e[0]);for(var o=1;o<e.length;o++)for(let t of a.keys(e[o]))n[t]=i.append.call(r,n[t],e[o][t]);return n}function ie(e,t,n){var r;if(e!==void 0&&!Number.isInteger(e))throw{code:`T2003`,stack:Error().stack,value:e};if(t!==void 0&&!Number.isInteger(t))throw{code:`T2004`,stack:Error().stack,value:t};if(e===void 0||t===void 0||e>t)return r;var i=t-e+1;if(i>1e7)throw{code:`D2014`,stack:Error().stack,value:i};if(n.base.options&&i>n.base.options.sequence)throw{code:`D2015`,stack:Error().stack,value:i};r=Array(i);for(var a=e,o=0;a<=t;a++,o++)r[o]=a;return r.sequence=!0,r}async function ae(e,t,n){var r=await g(e.rhs,t,n);return n.bind(e.lhs.value,r),r}async function oe(e,t,n){var r,a=await g(e.condition,t,n);return i.boolean(a)?r=await g(e.then,t,n):e.else!==void 0&&(r=await g(e.else,t,n)),r}async function se(e,t,n){for(var r,i=Ee(n),a=0;a<e.expressions.length;a++)r=await g(e.expressions[a],t,i);return r}function I(e,t,n){var r=new n.base.RegexEngine(e.value),i=function(t,n){var a;r.lastIndex=n||0;var o=r.exec(t);if(o!==null){if(a={match:o[0],start:o.index,end:o.index+o[0].length,groups:[]},o.length>1)for(var s=1;s<o.length;s++)a.groups.push(o[s]);a.next=function(){if(!(r.lastIndex>=t.length)){var n=i(t,r.lastIndex);if(n&&n.match===``)throw{code:`D1004`,stack:Error().stack,position:e.position,value:e.value.source};return n}}}return a};return i}function ce(e,t,n){return e.value===``?t&&t.outerWrapper?t[0]:t:n.lookup(e.value)}async function le(e,t,n){var r,a=t,o=!!t.tupleStream,s=async function(t,r){for(var i=0,a=0;i===0&&a<e.terms.length;a++){var s=e.terms[a],c=t,l=n;o&&(c=t[`@`],l=v(n,t));var u=await g(s.expression,c,l);c=r,l=n,o&&(c=r[`@`],l=v(n,r));var d=await g(s.expression,c,l),f=typeof u,p=typeof d;if(f===`undefined`){i=p===`undefined`?0:1;continue}if(p===`undefined`){i=-1;continue}if(f!==`string`&&f!==`number`||p!==`string`&&p!==`number`)throw{code:`T2008`,stack:Error().stack,position:e.position,value:f!==`string`&&f!==`number`?u:d};if(f!==p)throw{code:`T2007`,stack:Error().stack,position:e.position,value:u,value2:d};u!==d&&(i=u<d?-1:1,s.descending===!0&&(i=-i))}return i===1},c={environment:n,input:t};return r=await i.sort.apply(c,[a,s]),r}function ue(e,n,r){return L(async function(n){if(n!==void 0){var i=r.lookup(`clone`);if(!l(i))throw{code:`T2013`,stack:Error().stack,position:e.position};var o=await me(i,[n],null,r),s=await g(e.pattern,o,r);if(s!==void 0){Array.isArray(s)||(s=[s]);for(var c=0;c<s.length;c++){var u=s[c],d=await g(e.update,u,r),f=typeof d;if(f!==`undefined`){if(f!==`object`||d===null||Array.isArray(d))throw{code:`T2011`,stack:Error().stack,position:e.update.position,value:d};for(let e of a.keys(d))u[e]=d[e]}if(e.delete!==void 0){var p=await g(e.delete,u,r);if(p!==void 0){var m=p;if(Array.isArray(p)||(p=[p]),!t(p))throw{code:`T2012`,stack:Error().stack,position:e.delete.position,value:m};for(var h=0;h<p.length;h++)typeof u==`object`&&u&&delete u[p[h]]}}}}return o}},`<(oa):o>`)}var de=o(`function($f, $g) { function($x){ $g($f($x)) } }`);async function fe(e,t,n){var r,i=await g(e.lhs,t,n);if(e.rhs.type===`function`)r=await pe(e.rhs,t,n,{context:i});else{var a=await g(e.rhs,t,n);if(!l(a))throw{code:`T2006`,stack:Error().stack,position:e.position,value:a};r=l(i)?await me(await g(de,null,n),[i,a],null,n):await me(a,[i],null,n)}return r}async function pe(e,t,n,r){var i,a=await g(e.procedure,t,n);if(a===void 0&&e.procedure.type===`path`&&n.lookup(e.procedure.steps[0].value))throw{code:`T1005`,stack:Error().stack,position:e.position,token:e.procedure.steps[0].value};var o=[];r!==void 0&&o.push(r.context);for(var s=0;s<e.arguments.length;s++){let r=await g(e.arguments[s],t,n);if(l(r)){let e=async function(...e){return await me(r,e,null,n)};e.arity=p(r),o.push(e)}else o.push(r)}var c=e.procedure.type===`path`?e.procedure.steps[0].value:e.procedure.value;try{typeof a==`object`&&(a.token=c,a.position=e.position),i=await me(a,o,t,n)}catch(t){throw t.position||=e.position,t.token||=c,t}return i}async function me(e,t,n,r){for(var i=await he(e,t,n,r);u(i)&&i.thunk===!0;){var a=await g(i.body.procedure,i.input,i.environment);i.body.procedure.type===`variable`&&(a.token=i.body.procedure.value),a.position=i.body.procedure.position;for(var o=[],s=0;s<i.body.arguments.length;s++)o.push(await g(i.body.arguments[s],i.input,i.environment));i=await he(a,o,n,r)}return i}async function he(e,t,n,r){var i;try{var a=t;if(e&&(a=ve(e.signature,t,n)),u(e))i=await ye(e,a);else if(e&&e._jsonata_function===!0){var o={environment:r,input:n,options:r.base.options,createSequence:r.base.createSequence};i=e.implementation.apply(o,a),d(i)&&(i=i.next().value),f(i)&&(i=await i)}else if(typeof e==`function`)i=e.apply(n,a),f(i)&&(i=await i);else throw{code:`T1006`,stack:Error().stack}}catch(t){throw e&&(t.token===void 0&&e.token!==void 0&&(t.token=e.token),t.position=e.position||t.position),t}return i}function ge(e,t,n){var r={_jsonata_lambda:!0,input:t,environment:n,arguments:e.arguments,signature:e.signature,body:e.body};return e.thunk===!0&&(r.thunk=!0),r.apply=async function(e,i){return await me(r,i,t,e?e.environment:n)},r}async function _e(e,t,n){for(var r,i=[],a=0;a<e.arguments.length;a++){var o=e.arguments[a];o.type===`operator`&&o.value===`?`?i.push(o):i.push(await g(o,t,n))}var s=await g(e.procedure,t,n);if(s===void 0&&e.procedure.type===`path`&&n.lookup(e.procedure.steps[0].value))throw{code:`T1007`,stack:Error().stack,position:e.position,token:e.procedure.steps[0].value};if(u(s))r=be(s,i,n);else if(s&&s._jsonata_function===!0)r=xe(s.implementation,i,n);else if(typeof s==`function`)r=xe(s,i,n);else throw{code:`T1008`,stack:Error().stack,position:e.position,token:e.procedure.type===`path`?e.procedure.steps[0].value:e.procedure.value};return r}function ve(e,t,n){return e===void 0?t:e.validate(t,n)}async function ye(e,t){var n,r=Ee(e.environment);return Array.prototype.forEach.call(e.arguments,function(e,n){r.bind(e.value,t[n])}),n=typeof e.body==`function`?await Se(e.body,r):await g(e.body,e.input,r),n}function be(e,t,n){var r=Ee(e.environment||n),i=[];return Array.prototype.forEach.call(e.arguments,function(e,n){var a=t[n];a&&a.type===`operator`&&a.value===`?`?i.push(e):r.bind(e.value,a)}),{_jsonata_lambda:!0,input:e.input,environment:r,arguments:i,body:e.body}}function xe(e,t,n){var r=Ce(e);r=r.map(function(e){return`$`+e.trim()});var i=o(`function(`+r.join(`, `)+`){ _ }`);return i.body=e,be(i,t,n)}async function Se(e,t){var n=Ce(e).map(function(e){return t.lookup(e.trim())}),r={environment:t,createSequence:t.base.createSequence},i=e.apply(r,n);return f(i)&&(i=await i),i}function Ce(e){var t=e.toString();return/\(([^)]*)\)/.exec(t)[1].split(`,`)}function L(e,t){var n={_jsonata_function:!0,implementation:e};return t!==void 0&&(n.signature=s(t)),n}async function we(e,t){if(e!==void 0){var n=this.input;t!==void 0&&(n=t,Array.isArray(n)&&!c(n)&&(n=this.createSequence(n),n.outerWrapper=!0));try{var r=o(e,!1)}catch(e){throw Oe(e),{stack:Error().stack,code:`D3120`,value:e.message,error:e}}try{var i=await g(r,n,this.environment)}catch(e){throw Oe(e),{stack:Error().stack,code:`D3121`,value:e.message,error:e}}return i}}function Te(e){if(e!==void 0)return JSON.parse(i.string(e))}function Ee(e){var t=Object.create(null);let n={bind:function(e,n){t[e]=n},lookup:function(n){var r;return Object.prototype.hasOwnProperty.call(t,n)?r=t[n]:e&&(r=e.lookup(n)),r},timestamp:e?e.timestamp:null,async:e?e.async:!1,isParallelCall:e?e.isParallelCall:!1,global:e?e.global:{ancestry:[null]}};if(e){var r=e.lookup(Symbol.for(`jsonata.__createFrame_push`));r&&r(e,n),n.base=e.base}return n}h.bind(`sum`,L(i.sum,`<a<n>:n>`)),h.bind(`count`,L(i.count,`<a:n>`)),h.bind(`max`,L(i.max,`<a<n>:n>`)),h.bind(`min`,L(i.min,`<a<n>:n>`)),h.bind(`average`,L(i.average,`<a<n>:n>`)),h.bind(`string`,L(i.string,`<x-b?:s>`)),h.bind(`substring`,L(i.substring,`<s-nn?:s>`)),h.bind(`substringBefore`,L(i.substringBefore,`<s-s:s>`)),h.bind(`substringAfter`,L(i.substringAfter,`<s-s:s>`)),h.bind(`lowercase`,L(i.lowercase,`<s-:s>`)),h.bind(`uppercase`,L(i.uppercase,`<s-:s>`)),h.bind(`length`,L(i.length,`<s-:n>`)),h.bind(`trim`,L(i.trim,`<s-:s>`)),h.bind(`pad`,L(i.pad,`<s-ns?:s>`)),h.bind(`match`,L(i.match,`<s-f<s:o>n?:a<o>>`)),h.bind(`contains`,L(i.contains,`<s-(sf):b>`)),h.bind(`replace`,L(i.replace,`<s-(sf)(sf)n?:s>`)),h.bind(`split`,L(i.split,`<s-(sf)n?:a<s>>`)),h.bind(`join`,L(i.join,`<a<s>s?:s>`)),h.bind(`formatNumber`,L(i.formatNumber,`<n-so?:s>`)),h.bind(`formatBase`,L(i.formatBase,`<n-n?:s>`)),h.bind(`formatInteger`,L(r.formatInteger,`<n-s:s>`)),h.bind(`parseInteger`,L(r.parseInteger,`<s-s:n>`)),h.bind(`number`,L(i.number,`<(nsb)-:n>`)),h.bind(`floor`,L(i.floor,`<n-:n>`)),h.bind(`ceil`,L(i.ceil,`<n-:n>`)),h.bind(`round`,L(i.round,`<n-n?:n>`)),h.bind(`abs`,L(i.abs,`<n-:n>`)),h.bind(`sqrt`,L(i.sqrt,`<n-:n>`)),h.bind(`power`,L(i.power,`<n-n:n>`)),h.bind(`random`,L(i.random,`<:n>`)),h.bind(`boolean`,L(i.boolean,`<x-:b>`)),h.bind(`not`,L(i.not,`<x-:b>`)),h.bind(`map`,L(i.map,`<af>`)),h.bind(`zip`,L(i.zip,`<a+>`)),h.bind(`filter`,L(i.filter,`<af>`)),h.bind(`single`,L(i.single,`<af?>`)),h.bind(`reduce`,L(i.foldLeft,`<afj?:j>`)),h.bind(`sift`,L(i.sift,`<o-f?:o>`)),h.bind(`keys`,L(i.keys,`<x-:a<s>>`)),h.bind(`lookup`,L(i.lookup,`<x-s:x>`)),h.bind(`append`,L(i.append,`<xx:a>`)),h.bind(`exists`,L(i.exists,`<x:b>`)),h.bind(`spread`,L(i.spread,`<x-:a<o>>`)),h.bind(`merge`,L(i.merge,`<a<o>:o>`)),h.bind(`reverse`,L(i.reverse,`<a:a>`)),h.bind(`each`,L(i.each,`<o-f:a>`)),h.bind(`error`,L(i.error,`<s?:x>`)),h.bind(`assert`,L(i.assert,`<bs?:x>`)),h.bind(`type`,L(i.type,`<x:s>`)),h.bind(`sort`,L(i.sort,`<af?:a>`)),h.bind(`shuffle`,L(i.shuffle,`<a:a>`)),h.bind(`distinct`,L(i.distinct,`<x:x>`)),h.bind(`base64encode`,L(i.base64encode,`<s-:s>`)),h.bind(`base64decode`,L(i.base64decode,`<s-:s>`)),h.bind(`encodeUrlComponent`,L(i.encodeUrlComponent,`<s-:s>`)),h.bind(`encodeUrl`,L(i.encodeUrl,`<s-:s>`)),h.bind(`decodeUrlComponent`,L(i.decodeUrlComponent,`<s-:s>`)),h.bind(`decodeUrl`,L(i.decodeUrl,`<s-:s>`)),h.bind(`eval`,L(we,`<sx?:x>`)),h.bind(`toMillis`,L(r.toMillis,`<s-s?:n>`)),h.bind(`fromMillis`,L(r.fromMillis,`<n-s?s?:s>`)),h.bind(`clone`,L(Te,`<(oa)-:o>`));var De={S0101:`String literal must be terminated by a matching quote`,S0102:`Number out of range: {{token}}`,S0103:`Unsupported escape sequence: \\{{token}}`,S0104:`The escape sequence \\u must be followed by 4 hex digits`,S0105:"Quoted property name must be terminated with a backquote (`)",S0106:`Comment has no closing tag`,S0201:`Syntax error: {{token}}`,S0202:`Expected {{value}}, got {{token}}`,S0203:`Expected {{value}} before end of expression`,S0204:`Unknown operator: {{token}}`,S0205:`Unexpected token: {{token}}`,S0206:`Unknown expression type: {{token}}`,S0207:`Unexpected end of expression`,S0208:`Parameter {{value}} of function definition must be a variable name (start with $)`,S0209:`A predicate cannot follow a grouping expression in a step`,S0210:`Each step can only have one grouping expression`,S0211:`The symbol {{token}} cannot be used as a unary operator`,S0212:`The left side of := must be a variable name (start with $)`,S0213:`The literal value {{value}} cannot be used as a step within a path expression`,S0214:`The right side of {{token}} must be a variable name (start with $)`,S0215:`A context variable binding must precede any predicates on a step`,S0216:`A context variable binding must precede the 'order-by' clause on a step`,S0217:`The object representing the 'parent' cannot be derived from this expression`,S0301:`Empty regular expressions are not allowed`,S0302:`No terminating / in regular expression`,S0402:`Choice groups containing parameterized types are not supported`,S0401:`Type parameters can only be applied to functions and arrays`,S0500:`Attempted to evaluate an expression containing syntax error(s)`,T0410:`Argument {{index}} of function {{token}} does not match function signature`,T0411:`Context value is not a compatible type with argument {{index}} of function {{token}}`,T0412:`Argument {{index}} of function {{token}} must be an array of {{type}}`,D1001:`Number out of range: {{value}}`,D1002:`Cannot negate a non-numeric value: {{value}}`,T1003:`Key in object structure must evaluate to a string; got: {{value}}`,D1004:`Regular expression matches zero length string`,T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:`Attempted to invoke a non-function`,T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:`Attempted to partially apply a non-function`,D1009:`Multiple key definitions evaluate to same key: {{value}}`,T1010:`The matcher function argument passed to function {{token}} does not return the correct object structure`,D1011:`Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive`,D1012:`Evaluation timeout after {{value}} milliseconds. Check for infinite loop`,D1013:`Object property names starting with _jsonata_ are reserved for internal use: {{value}}`,T2001:`The left side of the {{token}} operator must evaluate to a number`,T2002:`The right side of the {{token}} operator must evaluate to a number`,T2003:`The left side of the range operator (..) must evaluate to an integer`,T2004:`The right side of the range operator (..) must evaluate to an integer`,D2005:`The left side of := must be a variable name (start with $)`,T2006:`The right side of the function application operator ~> must be a function`,T2007:`Type mismatch when comparing values {{value}} and {{value2}} in order-by clause`,T2008:`The expressions within an order-by clause must evaluate to numeric or string values`,T2009:`The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type`,T2010:`The expressions either side of operator {{token}} must evaluate to numeric or string values`,T2011:`The insert/update clause of the transform expression must evaluate to an object: {{value}}`,T2012:`The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}`,T2013:`The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.`,D2014:`The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.`,D2015:`The maximum sequence length of {{value}} was exceeded.`,D3001:`Attempting to invoke string function on Infinity or NaN`,D3010:`Second argument of replace function cannot be an empty string`,D3011:`Fourth argument of replace function must evaluate to a positive number`,D3012:`Attempted to replace a matched string with a non-string value`,D3020:`Third argument of split function must evaluate to a positive number`,D3030:`Unable to cast value to a number: {{value}}`,D3040:`Third argument of match function must evaluate to a positive number`,D3050:`The second argument of reduce function must be a function with at least two arguments`,D3060:`The sqrt function cannot be applied to a negative number: {{value}}`,D3061:`The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}`,D3070:`The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function`,D3080:`The picture string must only contain a maximum of two sub-pictures`,D3081:`The sub-picture must not contain more than one instance of the 'decimal-separator' character`,D3082:`The sub-picture must not contain more than one instance of the 'percent' character`,D3083:`The sub-picture must not contain more than one instance of the 'per-mille' character`,D3084:`The sub-picture must not contain both a 'percent' and a 'per-mille' character`,D3085:`The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'`,D3086:`The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character`,D3087:`The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character`,D3088:`The sub-picture must not contain a 'grouping-separator' at the end of the integer part`,D3089:`The sub-picture must not contain two adjacent instances of the 'grouping-separator' character`,D3090:`The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'`,D3091:`The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'`,D3092:`A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'`,D3093:`The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'`,D3100:`The radix of the formatBase function must be between 2 and 36. It was given {{value}}`,D3110:`The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}`,D3120:`Syntax error in expression passed to function eval: {{value}}`,D3121:`Dynamic error evaluating the expression passed to function eval: {{value}}`,D3130:`Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation`,D3131:`In a decimal digit pattern, all digits must be from the same decimal group`,D3132:`Unknown component specifier {{value}} in date/time picture string`,D3133:`The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}`,D3134:`The timezone integer format specifier cannot have more than four digits`,D3135:`No matching closing bracket ']' in date/time picture string`,D3136:`The date/time picture string is missing specifiers required to parse the timestamp`,D3137:`{{{message}}}`,D3138:`The $single() function expected exactly 1 matching result. Instead it matched more.`,D3139:`The $single() function expected exactly 1 matching result. Instead it matched 0.`,D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:`{{{message}}}`};function Oe(e){var t=De[e.code];if(t!==void 0){var n=t.replace(/\{\{\{([^}]+)}}}/g,function(){return e[arguments[1]]});n=n.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(e[arguments[1]])}),e.message=n}}function ke(e,t){var n,i;try{n=o(e,t&&t.recover),i=n.errors,delete n.errors}catch(e){throw Oe(e),e}var s=Ee(h),l=new Date;return s.bind(`now`,L(function(e,t){return r.fromMillis(l.getTime(),e,t)},`<s?s?:s>`)),s.bind(`millis`,L(function(){return l.getTime()},`<:n>`)),{evaluate:async function(e,r,o){if(i!==void 0){var u={code:`S0500`,position:0};throw Oe(u),u}let d=Ee(s);for(let e of a.keys(r))d.bind(e,r[e]);if(d.bind(`$`,e),l=new Date,d.timestamp=l,d.options=t,d.createSequence=function(){var e=[];return t&&t.sequence&&(e.push=function(...n){if(e.length+n.length>t.sequence)throw{code:`D2015`,stack:Error().stack,value:t.sequence};return Array.prototype.push.apply(e,n)}),e.sequence=!0,arguments.length===1&&e.push(arguments[0]),e},Array.isArray(e)&&!c(e)&&(e=d.createSequence(e),e.outerWrapper=!0),t&&(t.timeout||t.stack)){let e=Date.now();d.guardrails=function(){if(t.stack>0&&d.depth>t.stack)throw{code:`D1011`,value:t.stack,stack:Error().stack};if(t.timeout>0&&Date.now()-e>t.timeout)throw{code:`D1012`,value:t.timeout,stack:Error().stack}}}else d.guardrails=function(){};d.base=d,d.depth=0,d.RegexEngine=t&&t.RegexEngine?t.RegexEngine:RegExp;var f;try{return f=await g(n,e,d),typeof o==`function`&&o(null,f),f}catch(e){throw Oe(e),e}},assign:function(e,t){s.bind(e,t)},registerFunction:function(e,t,n){var r=L(t,n);s.bind(e,r)},ast:function(){return n},errors:function(){return i}}}return ke.parser=o,ke})()},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,n){var r=e("./signature");t.exports=(()=>{var e={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},t={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
17
17
|
`,r:`\r`,t:` `},n=function(n){var r=0,i=n.length,a=function(e,t){return{type:e,value:t,position:r}},o=function(){for(var e=r,t=0,a,o,s=function(e){if(n.charAt(e)===`/`&&t===0){for(var r=0;n.charAt(e-(r+1))===`\\`;)r++;if(r%2==0)return!0}return!1};r<i;){var c=n.charAt(r);if(s(r)){if(a=n.substring(e,r),a===``)throw{code:`S0301`,stack:Error().stack,position:r};for(r++,c=n.charAt(r),e=r;c===`i`||c===`m`;)r++,c=n.charAt(r);return o=n.substring(e,r)+`g`,new RegExp(a,o)}(c===`(`||c===`[`||c===`{`)&&n.charAt(r-1)!==`\\`&&t++,(c===`)`||c===`]`||c===`}`)&&n.charAt(r-1)!==`\\`&&t--,r++}throw{code:`S0302`,stack:Error().stack,position:r}},s=function(c){if(r>=i)return null;for(var l=n.charAt(r);r<i&&`
|
|
18
18
|
\r\v`.indexOf(l)>-1;)r++,l=n.charAt(r);if(l===`/`&&n.charAt(r+1)===`*`){var u=r;for(r+=2,l=n.charAt(r);l!==`*`||n.charAt(r+1)!==`/`;)if(l=n.charAt(++r),r>=i)throw{code:`S0106`,stack:Error().stack,position:u};return r+=2,l=n.charAt(r),s(c)}if(c!==!0&&l===`/`)return r++,a(`regex`,o());if(l===`.`&&n.charAt(r+1)===`.`)return r+=2,a(`operator`,`..`);if(l===`:`&&n.charAt(r+1)===`=`)return r+=2,a(`operator`,`:=`);if(l===`!`&&n.charAt(r+1)===`=`)return r+=2,a(`operator`,`!=`);if(l===`>`&&n.charAt(r+1)===`=`)return r+=2,a(`operator`,`>=`);if(l===`<`&&n.charAt(r+1)===`=`)return r+=2,a(`operator`,`<=`);if(l===`*`&&n.charAt(r+1)===`*`)return r+=2,a(`operator`,`**`);if(l===`~`&&n.charAt(r+1)===`>`)return r+=2,a(`operator`,`~>`);if(l===`?`&&n.charAt(r+1)===`:`)return r+=2,a(`operator`,`?:`);if(l===`?`&&n.charAt(r+1)===`?`)return r+=2,a(`operator`,`??`);if(Object.prototype.hasOwnProperty.call(e,l))return r++,a(`operator`,l);if(l===`"`||l===`'`){var d=l;r++;for(var f=``;r<i;){if(l=n.charAt(r),l===`\\`){if(r++,l=n.charAt(r),Object.prototype.hasOwnProperty.call(t,l))f+=t[l];else if(l===`u`){var p=n.substr(r+1,4);if(/^[0-9a-fA-F]+$/.test(p)){var m=parseInt(p,16);f+=String.fromCharCode(m),r+=4}else throw{code:`S0104`,stack:Error().stack,position:r}}else throw{code:`S0103`,stack:Error().stack,position:r,token:l}}else if(l===d)return r++,a(`string`,f);else f+=l;r++}throw{code:`S0101`,stack:Error().stack,position:r}}var h=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/.exec(n.substring(r));if(h!==null){var g=parseFloat(h[0]);if(!isNaN(g)&&isFinite(g))return r+=h[0].length,a(`number`,g);throw{code:`S0102`,stack:Error().stack,position:r,token:h[0]}}var _;if(l==="`"){r++;var v=n.indexOf("`",r);if(v!==-1)return _=n.substring(r,v),r=v+1,a(`name`,_);throw r=i,{code:`S0105`,stack:Error().stack,position:r}}for(var y=r,b;;)if(b=n.charAt(y),y===i||`
|
|
19
19
|
\r\v`.indexOf(b)>-1||Object.prototype.hasOwnProperty.call(e,b)){if(n.charAt(r)===`$`)return _=n.substring(r+1,y),r=y,a(`variable`,_);switch(_=n.substring(r,y),r=y,_){case`or`:case`in`:case`and`:return a(`operator`,_);case`true`:return a(`value`,!0);case`false`:return a(`value`,!1);case`null`:return a(`value`,null);default:return r===i&&_===``?null:a(`name`,_)}}else y++};return s};return function(t,i){var a,o,s=Object.create(null),c=[],l=function(){var e=[];a.id!==`(end)`&&e.push({type:a.type,value:a.value,position:a.position});for(var t=o();t!==null;)e.push(t),t=o();return e},u={nud:function(){var e={code:`S0211`,token:this.value,position:this.position};if(i)return e.remaining=l(),e.type=`error`,c.push(e),e;throw e.stack=Error().stack,e}},d=function(e,t){var n=s[e];return t||=0,n?t>=n.lbp&&(n.lbp=t):(n=Object.create(u),n.id=n.value=e,n.lbp=t,s[e]=n),n},f=function(e){if(i){e.remaining=l(),c.push(e);var t=s[`(error)`];return a=Object.create(t),a.error=e,a.type=`(error)`,a}throw e.stack=Error().stack,e},p=function(e,n){if(e&&a.id!==e)return f({code:a.id===`(end)`?`S0203`:`S0202`,position:a.position,token:a.value,value:e});var r=o(n);if(r===null)return a=s[`(end)`],a.position=t.length,a;var i=r.value,c=r.type,l;switch(c){case`name`:case`variable`:l=s[`(name)`];break;case`operator`:if(l=s[i],!l)return f({code:`S0204`,stack:Error().stack,position:r.position,token:i});break;case`string`:case`number`:case`value`:l=s[`(literal)`];break;case`regex`:c=`regex`,l=s[`(regex)`];break;default:return f({code:`S0205`,stack:Error().stack,position:r.position,token:i})}return a=Object.create(l),a.value=i,a.type=c,a.position=r.position,a},m=function(e){var t,n=a;for(p(null,!0),t=n.nud();e<a.lbp;)n=a,p(),t=n.led(t);return t},h=function(e){var t=d(e,0);t.nud=function(){return this}},g=function(t,n,r){var i=n||e[t],a=d(t,i);return a.led=r||function(e){return this.lhs=e,this.rhs=m(i),this.type=`binary`,this},a},_=function(e,t,n){var r=d(e,t);return r.led=n,r},v=function(e,t){var n=d(e);return n.nud=t||function(){return this.expression=m(70),this.type=`unary`,this},n};h(`(end)`),h(`(name)`),h(`(literal)`),h(`(regex)`),d(`:`),d(`;`),d(`,`),d(`)`),d(`]`),d(`}`),d(`..`),g(`.`),g(`+`),g(`-`),g(`*`),g(`/`),g(`%`),g(`=`),g(`<`),g(`>`),g(`!=`),g(`<=`),g(`>=`),g(`&`),g(`and`),g(`or`),g(`in`),h(`and`),h(`or`),h(`in`),v(`-`),g(`~>`),g(`??`,e[`??`],function(e){return this.type=`condition`,this.condition={type:`function`,value:`(`,procedure:{type:`variable`,value:`exists`},arguments:[JSON.parse(JSON.stringify(e))]},this.then=e,this.else=m(0),this}),_(`(error)`,10,function(e){return this.lhs=e,this.error=a.error,this.remaining=l(),this.type=`error`,this}),v(`*`,function(){return this.type=`wildcard`,this}),v(`**`,function(){return this.type=`descendant`,this}),v(`%`,function(){return this.type=`parent`,this}),g(`(`,e[`(`],function(e){if(this.procedure=e,this.type=`function`,this.arguments=[],a.id!==`)`)for(;a.type===`operator`&&a.id===`?`?(this.type=`partial`,this.arguments.push(a),p(`?`)):this.arguments.push(m(0)),a.id===`,`;)p(`,`);if(p(`)`,!0),e.type===`name`&&(e.value===`function`||e.value===`λ`)){if(this.arguments.forEach(function(e,t){if(e.type!==`variable`)return f({code:`S0208`,stack:Error().stack,position:e.position,token:e.value,value:t+1})}),this.type=`lambda`,a.id===`<`){for(var t=a.position,n=1,i=`<`;n>0&&a.id!==`{`&&a.id!==`(end)`;){var o=p();o.id===`>`?n--:o.id===`<`&&n++,i+=o.value}p(`>`);try{this.signature=r(i)}catch(e){return e.position=t+e.offset,f(e)}}p(`{`),this.body=m(0),p(`}`)}return this}),v(`(`,function(){for(var e=[];a.id!==`)`&&(e.push(m(0)),a.id===`;`);)p(`;`);return p(`)`,!0),this.type=`block`,this.expressions=e,this}),v(`[`,function(){var e=[];if(a.id!==`]`)for(;;){var t=m(0);if(a.id===`..`){var n={type:`binary`,value:`..`,position:a.position,lhs:t};p(`..`),n.rhs=m(0),t=n}if(e.push(t),a.id!==`,`)break;p(`,`)}return p(`]`,!0),this.expressions=e,this.type=`unary`,this}),g(`[`,e[`[`],function(t){if(a.id===`]`){for(var n=t;n&&n.type===`binary`&&n.value===`[`;)n=n.lhs;return n.keepArray=!0,p(`]`),t}return this.lhs=t,this.rhs=m(e[`]`]),this.type=`binary`,p(`]`,!0),this}),g(`^`,e[`^`],function(e){p(`(`);for(var t=[];;){var n={descending:!1};if(a.id===`<`?p(`<`):a.id===`>`&&(n.descending=!0,p(`>`)),n.expression=m(0),t.push(n),a.id!==`,`)break;p(`,`)}return p(`)`),this.lhs=e,this.rhs=t,this.type=`binary`,this});var y=function(e){var t=[];if(a.id!==`}`)for(;;){var n=m(0);p(`:`);var r=m(0);if(t.push([n,r]),a.id!==`,`)break;p(`,`)}return p(`}`,!0),e===void 0?(this.lhs=t,this.type=`unary`):(this.lhs=e,this.rhs=t,this.type=`binary`),this};v(`{`,y),g(`{`,e[`{`],y),_(`:=`,e[`:=`],function(t){return t.type===`variable`?(this.lhs=t,this.rhs=m(e[`:=`]-1),this.type=`binary`,this):f({code:`S0212`,stack:Error().stack,position:t.position,token:t.value})}),g(`@`,e[`@`],function(t){return this.lhs=t,this.rhs=m(e[`@`]),this.rhs.type===`variable`?(this.type=`binary`,this):f({code:`S0214`,stack:Error().stack,position:this.rhs.position,token:`@`})}),g(`#`,e[`#`],function(t){return this.lhs=t,this.rhs=m(e[`#`]),this.rhs.type===`variable`?(this.type=`binary`,this):f({code:`S0214`,stack:Error().stack,position:this.rhs.position,token:`#`})}),g(`?`,e[`?`],function(e){return this.type=`condition`,this.condition=e,this.then=m(0),a.id===`:`&&(p(`:`),this.else=m(0)),this}),g(`?:`,e[`?:`],function(e){return this.type=`condition`,this.condition=JSON.parse(JSON.stringify(e)),this.then=e,this.else=m(0),this}),v(`|`,function(){return this.type=`transform`,this.pattern=m(0),p(`|`),this.update=m(0),a.id===`,`&&(p(`,`),this.delete=m(0)),p(`|`),this});var b=function(e){var t;if(e.type===`function`&&!e.predicate){var n={type:`lambda`,thunk:!0,arguments:[],position:e.position};n.body=e,t=n}else if(e.type===`condition`)e.then=b(e.then),e.else!==void 0&&(e.else=b(e.else)),t=e;else if(e.type===`block`){var r=e.expressions.length;r>0&&(e.expressions[r-1]=b(e.expressions[r-1])),t=e}else t=e;return t},x=0,S=0,C=[],w=function(e,t){switch(e.type){case`name`:case`wildcard`:t.level--,t.level===0&&(e.ancestor===void 0||(C[t.index].slot.label=e.ancestor.label),e.ancestor=t,e.tuple=!0);break;case`parent`:t.level++;break;case`block`:e.expressions.length>0&&(e.tuple=!0,t=w(e.expressions[e.expressions.length-1],t));break;case`path`:e.tuple=!0;var n=e.steps.length-1;for(t=w(e.steps[n--],t);t.level>0&&n>=0;)t=w(e.steps[n--],t);break;default:throw{code:`S0217`,token:e.type,position:e.position}}return t},T=function(e,t){if(t.seekingParent!==void 0||t.type===`parent`){var n=t.seekingParent===void 0?[]:t.seekingParent;t.type===`parent`&&n.push(t.slot),e.seekingParent===void 0?e.seekingParent=n:Array.prototype.push.apply(e.seekingParent,n)}},E=function(e){var t=e.steps.length-1,n=e.steps[t],r=n.seekingParent===void 0?[]:n.seekingParent;n.type===`parent`&&r.push(n.slot);for(var i=0;i<r.length;i++){var a=r[i];for(t=e.steps.length-2;a.level>0;){if(t<0){e.seekingParent===void 0?e.seekingParent=[a]:e.seekingParent.push(a);break}for(var o=e.steps[t--];t>=0&&o.focus&&e.steps[t].focus;)o=e.steps[t--];a=w(o,a)}}},D=function(e){var t;switch(e.type){case`binary`:switch(e.value){case`.`:var n=D(e.lhs);t=n.type===`path`?n:{type:`path`,steps:[n]},n.type===`parent`&&(t.seekingParent=[n.slot]);var r=D(e.rhs);r.type===`path`?Array.prototype.push.apply(t.steps,r.steps):(r.predicate!==void 0&&(r.stages=r.predicate,delete r.predicate),t.steps.push(r)),t.steps.filter(function(e){if(e.type===`number`||e.type===`value`)throw{code:`S0213`,stack:Error().stack,position:e.position,value:e.value};return e.type===`string`}).forEach(function(e){e.type=`name`}),t.steps.filter(function(e){return e.keepArray===!0}).length>0&&(t.keepSingletonArray=!0);var a=t.steps[0];a.type===`unary`&&a.value===`[`&&(a.consarray=!0);var o=t.steps[t.steps.length-1];o.type===`unary`&&o.value===`[`&&(o.consarray=!0),E(t);break;case`[`:t=D(e.lhs);var s=t,l=`predicate`;if(t.type===`path`&&(s=t.steps[t.steps.length-1],l=`stages`),s.group!==void 0)throw{code:`S0209`,stack:Error().stack,position:e.position};s[l]===void 0&&(s[l]=[]);var u=D(e.rhs);u.seekingParent!==void 0&&(u.seekingParent.forEach(e=>{e.level===1?w(s,e):e.level--}),T(s,u)),s[l].push({type:`filter`,expr:u,position:e.position});break;case`{`:if(t=D(e.lhs),t.group!==void 0)throw{code:`S0210`,stack:Error().stack,position:e.position};t.group={lhs:e.rhs.map(function(e){return[D(e[0]),D(e[1])]}),position:e.position};break;case`^`:t=D(e.lhs),t.type!==`path`&&(t={type:`path`,steps:[t]});var d={type:`sort`,position:e.position};d.terms=e.rhs.map(function(e){var t=D(e.expression);return T(d,t),{descending:e.descending,expression:t}}),t.steps.push(d),E(t);break;case`:=`:t={type:`bind`,value:e.value,position:e.position},t.lhs=D(e.lhs),t.rhs=D(e.rhs),T(t,t.rhs);break;case`@`:if(t=D(e.lhs),s=t,t.type===`path`&&(s=t.steps[t.steps.length-1]),s.stages!==void 0||s.predicate!==void 0)throw{code:`S0215`,stack:Error().stack,position:e.position};if(s.type===`sort`)throw{code:`S0216`,stack:Error().stack,position:e.position};e.keepArray&&(s.keepArray=!0),s.focus=e.rhs.value,s.tuple=!0;break;case`#`:t=D(e.lhs),s=t,t.type===`path`?s=t.steps[t.steps.length-1]:(t={type:`path`,steps:[t]},s.predicate!==void 0&&(s.stages=s.predicate,delete s.predicate)),s.stages===void 0?s.index=e.rhs.value:s.stages.push({type:`index`,value:e.rhs.value,position:e.position}),s.tuple=!0;break;case`~>`:t={type:`apply`,value:e.value,position:e.position},t.lhs=D(e.lhs),t.rhs=D(e.rhs),t.keepArray=t.lhs.keepArray||t.rhs.keepArray;break;default:t={type:e.type,value:e.value,position:e.position},t.lhs=D(e.lhs),t.rhs=D(e.rhs),T(t,t.lhs),T(t,t.rhs)}break;case`unary`:t={type:e.type,value:e.value,position:e.position},e.value===`[`?t.expressions=e.expressions.map(function(e){var n=D(e);return T(t,n),n}):e.value===`{`?t.lhs=e.lhs.map(function(e){var n=D(e[0]);T(t,n);var r=D(e[1]);return T(t,r),[n,r]}):(t.expression=D(e.expression),e.value===`-`&&t.expression.type===`number`?(t=t.expression,t.value=-t.value):T(t,t.expression));break;case`function`:case`partial`:t={type:e.type,name:e.name,value:e.value,position:e.position},t.arguments=e.arguments.map(function(e){var n=D(e);return T(t,n),n}),t.procedure=D(e.procedure);break;case`lambda`:t={type:e.type,arguments:e.arguments,signature:e.signature,position:e.position};var f=D(e.body);t.body=b(f);break;case`condition`:t={type:e.type,position:e.position},t.condition=D(e.condition),T(t,t.condition),t.then=D(e.then),T(t,t.then),e.else!==void 0&&(t.else=D(e.else),T(t,t.else));break;case`transform`:t={type:e.type,position:e.position},t.pattern=D(e.pattern),t.update=D(e.update),e.delete!==void 0&&(t.delete=D(e.delete));break;case`block`:t={type:e.type,position:e.position},t.expressions=e.expressions.map(function(e){var n=D(e);return T(t,n),(n.consarray||n.type===`path`&&n.steps[0].consarray)&&(t.consarray=!0),n});break;case`name`:t={type:`path`,steps:[e]},e.keepArray&&(t.keepSingletonArray=!0);break;case`parent`:t={type:`parent`,slot:{label:`!`+x++,level:1,index:S++}},C.push(t);break;case`string`:case`number`:case`value`:case`wildcard`:case`descendant`:case`variable`:case`regex`:t=e;break;case`operator`:if(e.value===`and`||e.value===`or`||e.value===`in`)e.type=`name`,t=D(e);else if(e.value===`?`)t=e;else throw{code:`S0201`,stack:Error().stack,position:e.position,token:e.value};break;case`error`:t=e,e.lhs&&(t=D(e.lhs));break;default:var p=`S0206`;e.id===`(end)`&&(p=`S0207`);var m={code:p,position:e.position,token:e.value};if(i)return c.push(m),{type:`error`,error:m};throw m.stack=Error().stack,m}return e.keepArray&&(t.keepArray=!0),t};o=n(t),p();var O=m(0);if(a.id!==`(end)`&&f({code:`S0201`,position:a.position,token:a.value}),O=D(O),O.type===`parent`||O.seekingParent!==void 0)throw{code:`S0217`,token:O.type,position:O.position};return c.length>0&&(O.errors=c),O}})()},{"./signature":5}],5:[function(e,t,n){var r=e("./utils");t.exports=(()=>{var e={a:`arrays`,b:`booleans`,f:`functions`,n:`numbers`,o:`objects`,s:`strings`};function t(t){for(var n=1,i=[],a=Object.create(null),o=a;n<t.length;){var s=t.charAt(n);if(s===`:`)break;var c=function(){i.push(a),o=a,a=Object.create(null)},l=function(e,t,n,r){for(var i=1,a=t;a<e.length;)if(a++,s=e.charAt(a),s===r){if(i--,i===0)break}else s===n&&i++;return a};switch(s){case`s`:case`n`:case`b`:case`l`:case`o`:a.regex=`[`+s+`m]`,a.type=s,c();break;case`a`:a.regex=`[asnblfom]`,a.type=s,a.array=!0,c();break;case`f`:a.regex=`f`,a.type=s,c();break;case`j`:a.regex=`[asnblom]`,a.type=s,c();break;case`x`:a.regex=`[asnblfom]`,a.type=s,c();break;case`-`:o.context=!0,o.contextRegex=new RegExp(o.regex),o.regex+=`?`;break;case`?`:case`+`:o.regex+=s;break;case`(`:var u=l(t,n,`(`,`)`),d=t.substring(n+1,u);if(d.indexOf(`<`)===-1)a.regex=`[`+d+`m]`;else throw{code:`S0402`,stack:Error().stack,value:d,offset:n};a.type=`(`+d+`)`,n=u,c();break;case`<`:if(o.type===`a`||o.type===`f`){var f=l(t,n,`<`,`>`);o.subtype=t.substring(n+1,f),n=f}else throw{code:`S0401`,stack:Error().stack,value:o.type,offset:n}}n++}var p=`^`+i.map(function(e){return`(`+e.regex+`)`}).join(``)+`$`,m=new RegExp(p),h=function(e){var t;if(r.isFunction(e))t=`f`;else switch(typeof e){case`string`:t=`s`;break;case`number`:t=`n`;break;case`boolean`:t=`b`;break;case`object`:t=e===null?`l`:Array.isArray(e)?`a`:`o`;break;default:t=`m`}return t},g=function(e,t){for(var n=`^`,r=0,a=0;a<i.length;a++){n+=i[a].regex;var o=t.match(n);if(o===null)throw{code:`T0410`,stack:Error().stack,value:e[r],index:r+1};r=o[0].length}throw{code:`T0410`,stack:Error().stack,value:e[r],index:r+1}};return{definition:t,validate:function(t,n){var r=``;t.forEach(function(e){r+=h(e)});var a=m.exec(r);if(a){var o=[],s=0;return i.forEach(function(r,i){var c=t[s],l=a[i+1];if(l===``){if(r.context&&r.contextRegex){var u=h(n);if(r.contextRegex.test(u))o.push(n);else throw{code:`T0411`,stack:Error().stack,value:n,index:s+1}}else o.push(c),s++}else l.split(``).forEach(function(n){if(c=t[s],r.type===`a`){if(n===`m`)c=void 0;else{var i=!0;if(r.subtype!==void 0){if(n!==`a`&&l!==r.subtype)i=!1;else if(n===`a`&&c.length>0){var a=h(c[0]);i=a===r.subtype.charAt(0)&&c.filter(function(e){return h(e)!==a}).length===0}}if(!i)throw{code:`T0412`,stack:Error().stack,value:c,index:s+1,type:e[r.subtype]};n!==`a`&&(c=[c])}o.push(c),s++}else o.push(c),s++})}),o}g(t,r)}}}return t})()},{"./utils":6}],6:[function(e,t,n){t.exports=(()=>{function e(e){var t=!1;if(typeof e==`number`&&(t=!isNaN(e),t&&!isFinite(e)))throw{code:`D1001`,value:e,stack:Error().stack};return t}function t(e){var t=!1;return Array.isArray(e)&&(t=e.filter(function(e){return typeof e!=`string`}).length===0),t}function n(t){var n=!1;return Array.isArray(t)&&(n=t.filter(function(t){return!e(t)}).length===0),n}function r(e){return e.sequence===!0&&Array.isArray(e)}function i(e){return e&&(e._jsonata_function===!0||e._jsonata_lambda===!0)||typeof e==`function`}function a(e){return typeof e.arity==`number`?e.arity:typeof e.implementation==`function`?e.implementation.length:typeof e.length==`number`?e.length:e.arguments.length}function o(e){return e&&e._jsonata_lambda===!0}var s=(typeof Symbol==`function`?Symbol:{}).iterator||`@@iterator`;function c(e){return typeof e==`object`&&!!e&&s in e&&`next`in e&&typeof e.next==`function`}function l(e,t){if(e===t)return!0;if(typeof e==`object`&&typeof t==`object`&&e!==null&&t!==null){if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!l(e[n],t[n]))return!1;return!0}var r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(r.length!==i.length)return!1;for(r=r.sort(),i=i.sort(),n=0;n<r.length;n++)if(r[n]!==i[n])return!1;for(n=0;n<r.length;n++){var a=r[n];if(!l(e[a],t[a]))return!1}return!0}return!1}function u(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function d(e){var t=[];for(let n of e)t.push(n);return t}function f(e){return typeof e==`object`&&e?Object.keys(e):[]}return{isNumeric:e,isArrayOfStrings:t,isArrayOfNumbers:n,isSequence:r,isFunction:i,isLambda:o,isIterable:c,getFunctionArity:a,isDeepEqual:l,stringToArray:d,isPromise:u,keys:f}})()},{}]},{},[3])(3)})})),l_=t(a());function u_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function d_(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u_(e))&&(r&&(r+=` `),r+=t);return r}var f_=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function p_(e){return typeof e==`string`&&f_.includes(e)}var m_=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function h_(e){return typeof e==`string`&&m_.has(e)}function g_(e){return typeof e==`string`&&e.startsWith(`data-`)}function __(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(h_(n)||g_(n))&&(t[n]=e[n]);return t}function v_(e){if(e==null)return null;if((0,U.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return __(t)}return typeof e==`object`&&!Array.isArray(e)?__(e):null}function y_(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(h_(n)||g_(n)||p_(n))&&(t[n]=e[n]);return t}function b_(e){return e==null?null:(0,U.isValidElement)(e)?y_(e.props):typeof e==`object`&&!Array.isArray(e)?y_(e):null}var x_=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function S_(){return S_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},S_.apply(null,arguments)}function C_(e,t){if(e==null)return{};var n,r,i=w_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function w_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var T_=(0,U.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=C_(e,x_),d=a||{width:r,height:i,x:0,y:0},f=d_(`recharts-surface`,o);return U.createElement(`svg`,S_({},y_(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),U.createElement(`title`,null,c),U.createElement(`desc`,null,l),n)}),E_=[`children`,`className`];function D_(){return D_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},D_.apply(null,arguments)}function O_(e,t){if(e==null)return{};var n,r,i=k_(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function k_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var A_=U.forwardRef((e,t)=>{var n=e.children,r=e.className,i=O_(e,E_),a=d_(`recharts-layer`,r);return U.createElement(`g`,D_({className:a},y_(i),{ref:t}),n)});function j_(e){return e===`__proto__`}var M_=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function N_(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:M_.test(e);default:return!1}}function P_(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function F_(e){return typeof e==`symbol`||e instanceof Symbol}function I_(e){return e==null?``:L_(e)}function L_(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(L_).join(`,`);if(F_(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function R_(e){if(Array.isArray(e))return e.map(P_);if(typeof e==`symbol`)return[e];e=I_(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function z_(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(j_(t))return n;let r=e[t];return r===void 0?N_(t)&&!Object.hasOwn(e,t)?z_(e,R_(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=P_(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return B_(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),j_(t))return n;let r=e[t];return r===void 0?n:r}}}function B_(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||j_(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var V_=4;function H_(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:V_),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function U_(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+H_(i)+n},``)}var W_=e=>e===0?0:e>0?1:-1,G_=e=>typeof e==`number`&&e!=+e,K_=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,W=e=>(typeof e==`number`||e instanceof Number)&&!G_(e),q_=e=>W(e)||typeof e==`string`,J_=0,Y_=e=>{var t=++J_;return`${e||``}${t}`},X_=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!W(e)&&typeof e!=`string`)return n;var i;if(K_(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return G_(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Z_=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function Q_(e,t,n){return W(e)&&W(t)?H_(e+n*(t-e)):t}function $_(e,t,n){if(e&&e.length)return e.find(e=>e&&(typeof t==`function`?t(e):z_(e,t))===n)}var ev=e=>e==null,tv=e=>ev(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function nv(e){return e!=null}function rv(){}function iv(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function av(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ov(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?av(Object(n),!0).forEach(function(t){sv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):av(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sv(e,t,n){return(t=cv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cv(e){var t=lv(e,`string`);return typeof t==`symbol`?t:t+``}function lv(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var uv=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=iv(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?ov({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?ov({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?ov({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?ov({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?ov({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?ov({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?ov({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?ov({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(W(n.x)||K_(n.x))&&(W(n.y)||K_(n.y))?ov({x:c+X_(n.x,g),y:l+X_(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):ov({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},dv=[`top`,`left`,`right`,`bottom`];function fv(e){return e==null?!1:typeof e==`object`||dv.includes(e)}var pv=(0,U.createContext)(null);function mv(e){return function(){return e}}var hv=Math.PI,gv=2*hv,_v=1e-6,vv=gv-_v;function yv(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function bv(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return yv;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var xv=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?yv:bv(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>_v){if(!(Math.abs(u*s-c*l)>_v)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((hv-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>_v&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>_v||Math.abs(this._y1-l)>_v)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%gv+gv),d>vv?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>_v&&this._append`A${n},${n},0,${+(d>=hv)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};xv.prototype;function Sv(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new xv(t)}Array.prototype.slice;function Cv(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function wv(e){this._context=e}wv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Tv(e){return new wv(e)}function Ev(e){return e[0]}function Dv(e){return e[1]}function Ov(e,t){var n=mv(!0),r=null,i=Tv,a=null,o=Sv(s);e=typeof e==`function`?e:e===void 0?Ev:mv(e),t=typeof t==`function`?t:t===void 0?Dv:mv(t);function s(s){var c,l=(s=Cv(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:mv(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:mv(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:mv(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function kv(e,t,n){var r=null,i=mv(!0),a=null,o=Tv,s=null,c=Sv(l);e=typeof e==`function`?e:e===void 0?Ev:mv(+e),t=typeof t==`function`?t:mv(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?Dv:mv(+n);function l(l){var u,d,f,p=(l=Cv(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Ov().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:mv(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:mv(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:mv(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:mv(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:mv(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:mv(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:mv(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Av=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function jv(e){return new Av(e,!0)}function Mv(e){return new Av(e,!1)}function Nv(){}function Pv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Fv(e){this._context=e}Fv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pv(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pv(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Iv(e){return new Fv(e)}function Lv(e){this._context=e}Lv.prototype={areaStart:Nv,areaEnd:Nv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Pv(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Rv(e){return new Lv(e)}function zv(e){this._context=e}zv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Pv(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Bv(e){return new zv(e)}function Vv(e){this._context=e}Vv.prototype={areaStart:Nv,areaEnd:Nv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Hv(e){return new Vv(e)}function Uv(e){return e<0?-1:1}function Wv(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Uv(a)+Uv(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Gv(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Kv(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function qv(e){this._context=e}qv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Kv(this,this._t0,Gv(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Kv(this,Gv(this,n=Wv(this,e,t)),n);break;default:Kv(this,this._t0,n=Wv(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Jv(e){this._context=new Yv(e)}(Jv.prototype=Object.create(qv.prototype)).point=function(e,t){qv.prototype.point.call(this,t,e)};function Yv(e){this._context=e}Yv.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Xv(e){return new qv(e)}function Zv(e){return new Jv(e)}function Qv(e){this._context=e}Qv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=$v(e),i=$v(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function $v(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ey(e){return new Qv(e)}function ty(e,t){this._context=e,this._t=t}ty.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function ny(e){return new ty(e,.5)}function ry(e){return new ty(e,0)}function iy(e){return new ty(e,1)}function ay(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function oy(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function sy(e,t){return e[t]}function cy(e){let t=[];return t.key=e,t}function ly(){var e=mv([]),t=oy,n=ay,r=sy;function i(i){var a=Array.from(e.apply(this,arguments),cy),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Cv(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:mv(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:mv(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?oy:typeof e==`function`?e:mv(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??ay,i):n},i}function uy(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}ay(e,t)}}function dy(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}ay(e,t)}}function fy(e,t){if((o=e.length)>0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,ay(e,t)}}var py=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,my=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,U.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{p_(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},hy=(e,t,n)=>r=>(e(t,n,r),null),gy=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];p_(i)&&typeof a==`function`&&(r||={},r[i]=hy(a,t,n))}),r};function _y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_y(Object(n),!0).forEach(function(t){yy(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yy(e,t,n){return(t=by(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function by(e){var t=xy(e,`string`);return typeof t==`symbol`?t:t+``}function xy(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Sy(e,t){var n=vy({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function Cy(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function wy(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function Ty(e){return e}function Ey(e){return Number.isSafeInteger(e)&&e>=0}function Dy(e){return e!=null&&typeof e!=`function`&&Ey(e.length)}function Oy(e){return function(t){return z_(t,e)}}function ky(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Ay(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jy(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function My(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ny=`[object RegExp]`,Py=`[object String]`,Fy=`[object Number]`,Iy=`[object Boolean]`,Ly=`[object Arguments]`,Ry=`[object Symbol]`,zy=`[object Date]`,By=`[object Map]`,Vy=`[object Set]`,Hy=`[object Array]`,Uy=`[object Function]`,Wy=`[object ArrayBuffer]`,Gy=`[object Object]`,Ky=`[object Error]`,qy=`[object DataView]`,Jy=`[object Uint8Array]`,Yy=`[object Uint8ClampedArray]`,Xy=`[object Uint16Array]`,Zy=`[object Uint32Array]`,Qy=`[object BigUint64Array]`,$y=`[object Int8Array]`,eb=`[object Int16Array]`,tb=`[object Int32Array]`,nb=`[object BigInt64Array]`,rb=`[object Float32Array]`,ib=`[object Float64Array]`,ab=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function ob(e){return ab.Buffer!==void 0&&ab.Buffer.isBuffer(e)}function sb(e,t){return cb(e,void 0,e,new Map,t)}function cb(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(ky(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=cb(e[a],a,n,r,i);return Object.hasOwn(e,`index`)&&(t.index=e.index),Object.hasOwn(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,cb(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(cb(a,void 0,n,r,i));return t}if(ob(e))return e.subarray();if(Ay(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=cb(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),lb(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),lb(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),lb(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,lb(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),lb(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),lb(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),lb(t,e,n,r,i),t}if(typeof e==`object`&&ub(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),lb(t,e,n,r,i),t}return e}function lb(e,t,n=e,r,i){let a=[...Object.keys(t),...jy(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=cb(t[s],s,n,r,i))}}function ub(e){switch(My(e)){case Ly:case Hy:case Wy:case qy:case Iy:case zy:case rb:case ib:case $y:case eb:case tb:case By:case Fy:case Gy:case Ny:case Vy:case Py:case Ry:case Jy:case Yy:case Xy:case Zy:return!0;default:return!1}}function db(e){return cb(e,void 0,e,new Map,void 0)}function fb(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function pb(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function mb(e,t,n){return typeof n==`function`?hb(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?hb(t,r,e,s,!1):!!c},new Map,!0):mb(e,t,()=>void 0)}function hb(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return gb(e,t,n,r,i);case`function`:return Object.keys(t).length>0?hb(e,{...t},n,r,i):fb(e,t);default:return pb(e)&&i?typeof t!=`string`||t===``:fb(e,t)}}function gb(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return vb(e,t,n,r);if(t instanceof Map)return _b(e,t,n,r);if(t instanceof Set)return yb(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ky(e)&&(e=Object(e));else{let t=My(e);if(t!==`[object Object]`&&t!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function _b(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function vb(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function yb(e,t,n,r){return t.size===0||e instanceof Set&&vb([...e],[...t],n,r)}function bb(e,t){return mb(e,t,()=>void 0)}function xb(e){return e=db(e),t=>bb(t,e)}function Sb(e,t){return sb(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(My(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),lb(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case Fy:case Py:case Iy:{let t=new e.constructor(e?.valueOf());return lb(t,e),t}case Ly:{let t={};return lb(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Cb(e){return Sb(e)}var wb=/^(?:0|[1-9]\d*)$/;function Tb(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return wb.test(e)}}function Eb(e){return typeof e==`object`&&!!e&&My(e)===`[object Arguments]`}function Db(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&N_(t)&&!(t in Object(e))?R_(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=P_(n[e]);if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||Eb(r))&&Tb(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function Ob(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=P_(e)}return t=Cb(t),function(n){let r=z_(n,e);return r===void 0?Db(n,e):t===void 0?r===void 0:bb(r,t)}}function kb(e){if(e==null)return Ty;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?Ob(e[0],e[1]):xb(e);default:return Oy(e)}}function Ab(e){return e===0?0:e}function jb(e,t=Ty){return Dy(e)?Cy(Array.from(e),wy(kb(t),1)).map(Ab):[]}function Mb(e,t,n){return t===!0?jb(e,n):typeof t==`function`?jb(e,t):e}var Nb=r((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Pb=r(((e,t)=>{t.exports=Nb()})),Fb=r((e=>{var t=i(),n=Pb();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),Ib=r(((e,t)=>{t.exports=Fb()})),Lb=t(Ib()),Rb=(0,U.createContext)(null),zb=e=>e,Bb=()=>{var e=(0,U.useContext)(Rb);return e?e.store.dispatch:zb},Vb=()=>{},Hb=()=>Vb,Ub=(e,t)=>e===t;function G(e){var t=(0,U.useContext)(Rb),n=(0,U.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:Vb,[t,e]);return(0,Lb.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Hb,t?t.store.getState:Vb,t?t.store.getState:Vb,n,Ub)}function Wb(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Gb(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Kb=e=>Array.isArray(e)?e:[e];function qb(e){let t=Array.isArray(e[0])?e[0]:e;return Gb(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Jb(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Yb=class{constructor(e){this.value=e}deref(){return this.value}},Xb=typeof WeakRef>`u`?Yb:WeakRef,Zb=0,Qb=1;function $b(){return{s:Zb,v:void 0,o:null,p:null}}function ex(e){return e instanceof Xb?e.deref():e}function tx(e,t={}){let n=$b(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=$b(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=$b(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Qb)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=ex(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Xb(c):c}return s.s=Qb,s.v=c,c}return o.clearCache=()=>{n=$b(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function nx(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),Wb(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=tx,argsMemoizeOptions:u=[]}={...n,...a},d=Kb(c),f=Kb(u),p=qb(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Jb(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var K=nx(tx);function rx(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function ix(e,t,n){return pb(n)&&(typeof t==`number`&&Dy(n)&&Tb(t)&&t<n.length||typeof t==`string`&&t in n)?fb(n[t],e):!1}function ax(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var ox=(e,t,n)=>{if(e!==t){let r=ax(e),i=ax(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},sx=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cx=/^\w*$/;function lx(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||F_(e)?!0:typeof e==`string`&&(cx.test(e)||!sx.test(e))||t!=null&&Object.hasOwn(t,e)}function ux(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Dy(e)?Array.from(e):Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||lx(e)?e:{key:e,path:R_(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=ox(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function dx(e,...t){let n=t.length;return n>1&&ix(e,t[0],t[1])?t=[]:n>2&&ix(t[0],t[1],t[2])&&(t=[t[0]]),ux(e,rx(t),[`asc`])}var fx=e=>e.legend.settings,px=e=>e.legend.size;K([e=>e.legend.payload,fx],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?dx(r,n):r});function mx(e,t){return yx(e)||vx(e,t)||gx(e,t)||hx()}function hx(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -74,5 +74,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
74
74
|
To pick up a draggable item, press the space bar.
|
|
75
75
|
While dragging, use the arrow keys to move the item.
|
|
76
76
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
77
|
-
`},B6={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function V6(e){let{announcements:t=B6,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=z6}=e,{announce:a,announcement:o}=F6(),s=x6(`DndLiveRegion`),[c,l]=(0,U.useState)(!1);if((0,U.useEffect)(()=>{l(!0)},[]),L6((0,U.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=U.createElement(U.Fragment,null,U.createElement(N6,{id:r,value:i.draggable}),U.createElement(P6,{id:s,announcement:o}));return n?(0,l_.createPortal)(u,n):u}var H6;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(H6||={});function U6(){}function W6(e,t){return(0,U.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function G6(){var e=[...arguments];return(0,U.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var K6=Object.freeze({x:0,y:0});function q6(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function J6(e,t){let n=O6(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Y6(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function X6(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Z6(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Q6(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function $6(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var e8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=$6(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=q6($6(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Y6)},t8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Z6(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Z6(r),o=i.reduce((e,t,r)=>e+q6(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Y6)};function n8(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var r8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=n8(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(X6)};function i8(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var a8=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&i8(r,a)){let n=Z6(a).reduce((e,t)=>e+q6(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(Y6)};function o8(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function s8(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:K6}function c8(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var l8=c8(1);function u8(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function d8(e,t,n){let r=u8(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var f8={ignoreTransform:!1};function p8(e,t){t===void 0&&(t=f8);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=c6(e).getComputedStyle(e);t&&(n=d8(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function m8(e){return p8(e,{ignoreTransform:!0})}function h8(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function g8(e,t){return t===void 0&&(t=c6(e).getComputedStyle(e)),t.position===`fixed`}function _8(e,t){t===void 0&&(t=c6(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function v8(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(l6(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!u6(i)||d6(i)||n.includes(i))return n;let a=c6(e).getComputedStyle(i);return i!==e&&_8(i,a)&&n.push(i),g8(i,a)?n:r(i.parentNode)}return e?r(e):n}function y8(e){let[t]=v8(e,1);return t??null}function b8(e){return!a6||!e?null:o6(e)?e:s6(e)?l6(e)||e===f6(e).scrollingElement?window:u6(e)?e:null:null}function x8(e){return o6(e)?e.scrollX:e.scrollLeft}function S8(e){return o6(e)?e.scrollY:e.scrollTop}function C8(e){return{x:x8(e),y:S8(e)}}var w8;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(w8||={});function T8(e){return!a6||!e?!1:e===document.scrollingElement}function E8(e){let t={x:0,y:0},n=T8(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var D8={x:.2,y:.2};function O8(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=D8);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=E8(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=w8.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=w8.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=w8.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=w8.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function k8(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function A8(e){return e.reduce((e,t)=>C6(e,C8(t)),K6)}function j8(e){return e.reduce((e,t)=>e+x8(t),0)}function M8(e){return e.reduce((e,t)=>e+S8(t),0)}function N8(e,t){if(t===void 0&&(t=p8),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);y8(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var P8=[[`x`,[`left`,`right`],j8],[`y`,[`top`,`bottom`],M8]],F8=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=v8(t),r=A8(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of P8)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},I8=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function L8(e){let{EventTarget:t}=c6(e);return e instanceof t?e:f6(e)}function R8(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var z8;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(z8||={});function B8(e){e.preventDefault()}function V8(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var H8={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},U8=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},W8=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new I8(f6(t)),this.windowListeners=new I8(c6(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(z8.Resize,this.handleCancel),this.windowListeners.add(z8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(z8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&N8(n),t(K6)}handleKeyDown(e){if(E6(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=H8,coordinateGetter:a=U8,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:K6;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=w6(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=E8(n),p=k8(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,C6(w6(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};W8.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=H8,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function G8(e){return!!(e&&`distance`in e)}function K8(e){return!!(e&&`delay`in e)}var q8=class{constructor(e,t,n){n===void 0&&(n=L8(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=f6(i),this.documentListeners=new I8(this.document),this.listeners=new I8(n),this.windowListeners=new I8(c6(i)),this.initialCoordinates=O6(r)??K6,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(z8.Resize,this.handleCancel),this.windowListeners.add(z8.DragStart,B8),this.windowListeners.add(z8.VisibilityChange,this.handleCancel),this.windowListeners.add(z8.ContextMenu,B8),this.documentListeners.add(z8.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(K8(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(G8(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(z8.Click,V8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(z8.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=O6(e)??K6,s=w6(n,o);if(!t&&a){if(G8(a)){if(a.tolerance!=null&&R8(s,a.tolerance))return this.handleCancel();if(R8(s,a.distance))return this.handleStart()}if(K8(a)&&R8(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},J8={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Y8=class extends q8{constructor(e){let{event:t}=e,n=f6(t.target);super(e,J8,n)}};Y8.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var X8={move:{name:`mousemove`},end:{name:`mouseup`}},Z8;(function(e){e[e.RightClick=2]=`RightClick`})(Z8||={});var Q8=class extends q8{constructor(e){super(e,X8,f6(e.event.target))}};Q8.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Z8.RightClick&&(r?.({event:n}),!0)}}];var $8={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},e5=class extends q8{constructor(e){super(e,$8)}static setup(){return window.addEventListener($8.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($8.move.name,e)};function e(){}}};e5.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var t5;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(t5||={});var n5;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(n5||={});function r5(e){let{acceleration:t,activator:n=t5.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=n5.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=a5({delta:d,disabled:!a}),[m,h]=h6(),g=(0,U.useRef)({x:0,y:0}),_=(0,U.useRef)({x:0,y:0}),v=(0,U.useMemo)(()=>{switch(n){case t5.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case t5.DraggableRect:return i}},[n,i,c]),y=(0,U.useRef)(null),b=(0,U.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,U.useMemo)(()=>s===n5.TreeOrder?[...l].reverse():l,[s,l]);(0,U.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=O8(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var i5={x:{[w8.Backward]:!1,[w8.Forward]:!1},y:{[w8.Backward]:!1,[w8.Forward]:!1}};function a5(e){let{delta:t,disabled:n}=e,r=y6(t);return _6(e=>{if(n||!r||!e)return i5;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[w8.Backward]:e.x[w8.Backward]||i.x===-1,[w8.Forward]:e.x[w8.Forward]||i.x===1},y:{[w8.Backward]:e.y[w8.Backward]||i.y===-1,[w8.Forward]:e.y[w8.Forward]||i.y===1}}},[n,t,r])}function o5(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return _6(e=>t==null?null:r??e??null,[r,t])}function s5(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var c5;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(c5||={});var l5;(function(e){e.Optimized=`optimized`})(l5||={});var u5=new Map;function d5(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,U.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,U.useRef)(e),d=g(),f=g6(d),p=(0,U.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,U.useRef)(null),h=_6(t=>{if(d&&!n)return u5;if(!t||t===u5||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new F8(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,U.useEffect)(()=>{u.current=e},[e]),(0,U.useEffect)(()=>{d||p()},[n,d]),(0,U.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,U.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case c5.Always:return!1;case c5.BeforeDragging:return n;default:return!n}}}function f5(e,t){return _6(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function p5(e,t){return f5(e,t)}function m5(e){let{callback:t,disabled:n}=e,r=m6(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function h5(e){let{callback:t,disabled:n}=e,r=m6(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function g5(e){return new F8(p8(e),e)}function _5(e,t,n){t===void 0&&(t=g5);let[r,i]=(0,U.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=m5({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=h5({callback:a});return p6(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function v5(e){return s8(e,f5(e))}var y5=[];function b5(e){let t=(0,U.useRef)(e),n=_6(n=>e?n&&n!==y5&&e&&t.current&&e.parentNode===t.current.parentNode?n:v8(e):y5,[e]);return(0,U.useEffect)(()=>{t.current=e},[e]),n}function x5(e){let[t,n]=(0,U.useState)(null),r=(0,U.useRef)(e),i=(0,U.useCallback)(e=>{let t=b8(e.target);t&&n(e=>e?(e.set(t,C8(t)),new Map(e)):null)},[]);return(0,U.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=b8(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,C8(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{b8(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,U.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>C6(e,t),K6):A8(e):K6,[e,t])}function S5(e,t){t===void 0&&(t=[]);let n=(0,U.useRef)(null);return(0,U.useEffect)(()=>{n.current=null},t),(0,U.useEffect)(()=>{let t=e!==K6;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?w6(e,n.current):K6}function C5(e){(0,U.useEffect)(()=>{if(!a6)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function w5(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function T5(e){return(0,U.useMemo)(()=>e?h8(e):null,[e])}var E5=[];function D5(e,t){t===void 0&&(t=p8);let[n]=e,r=T5(n?c6(n):null),[i,a]=(0,U.useState)(E5);function o(){a(()=>e.length?e.map(e=>T8(e)?r:new F8(t(e),e)):E5)}let s=h5({callback:o});return p6(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function O5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return u6(t)?t:e}function k5(e){let{measure:t}=e,[n,r]=(0,U.useState)(null),i=h5({callback:(0,U.useCallback)(e=>{for(let{target:n}of e)if(u6(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=v6((0,U.useCallback)(e=>{let n=O5(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,U.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var A5=[{sensor:Y8,options:{}},{sensor:W8,options:{}}],j5={current:{}},M5={draggable:{measure:m8},droppable:{measure:m8,strategy:c5.WhileDragging,frequency:l5.Optimized},dragOverlay:{measure:p8}},N5=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},P5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new N5,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:U6},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:M5,measureDroppableContainers:U6,windowRect:null,measuringScheduled:!1},F5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:U6,draggableNodes:new Map,over:null,measureDroppableContainers:U6},I5=(0,U.createContext)(F5),L5=(0,U.createContext)(P5);function R5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new N5}}}function z5(e,t){switch(t.type){case H6.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case H6.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case H6.DragEnd:case H6.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case H6.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new N5(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case H6.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new N5(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case H6.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new N5(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function B5(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,U.useContext)(I5),a=y6(r),o=y6(n?.id);return(0,U.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!E6(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=j6(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function V5(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function H5(e){return(0,U.useMemo)(()=>({draggable:{...M5.draggable,...e?.draggable},droppable:{...M5.droppable,...e?.droppable},dragOverlay:{...M5.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function U5(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,U.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;p6(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=s8(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=y8(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var W5=(0,U.createContext)({...K6,scaleX:1,scaleY:1}),G5;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(G5||={});var K5=(0,U.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=A5,collisionDetection:o=r8,measuring:s,modifiers:c,...l}=e,[u,d]=(0,U.useReducer)(z5,void 0,R5),[f,p]=R6(),[m,h]=(0,U.useState)(G5.Uninitialized),g=m===G5.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,U.useRef)({initial:null,translated:null}),C=(0,U.useMemo)(()=>_==null?null:{id:_,data:x?.data??j5,rect:S},[_,x]),w=(0,U.useRef)(null),[T,E]=(0,U.useState)(null),[D,O]=(0,U.useState)(null),k=g6(l,Object.values(l)),A=x6(`DndDescribedBy`,t),j=(0,U.useMemo)(()=>b.getEnabled(),[b]),M=H5(s),{droppableRects:N,measureDroppableContainers:ee,measuringScheduled:P}=d5(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),F=o5(v,_),te=(0,U.useMemo)(()=>D?O6(D):null,[D]),ne=je(),re=p5(F,M.draggable.measure);U5({activeNode:_==null?null:v.get(_),config:ne.layoutShiftCompensation,initialRect:re,measure:M.draggable.measure});let ie=_5(F,M.draggable.measure,re),ae=_5(F?F.parentElement:null),oe=(0,U.useRef)({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=b.getNodeFor(oe.current.over?.id),I=k5({measure:M.dragOverlay.measure}),ce=I.nodeRef.current??F,le=g?I.rect??ie:null,ue=!!(I.nodeRef.current&&I.rect),de=v5(ue?null:ie),fe=T5(ce?c6(ce):null),pe=b5(g?se??F:null),me=D5(pe),he=V5(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ie,containerNodeRect:ae,draggingNodeRect:le,over:oe.current.over,overlayNodeRect:I.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:fe}),ge=te?C6(te,y):null,_e=x5(pe),ve=S5(_e),ye=S5(_e,[ie]),be=C6(he,ve),xe=le?l8(le,he):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:N,droppableContainers:j,pointerCoordinates:ge}):null,Ce=Q6(Se,`id`),[L,we]=(0,U.useState)(null),Te=o8(ue?he:C6(he,ye),L?.rect??null,ie),Ee=(0,U.useRef)(null),De=(0,U.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:oe,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,l_.unstable_batchedUpdates)(()=>{r?.(i),h(G5.Initializing),d({type:H6.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ee.current),O(a)})},onMove(e){d({type:H6.DragMove,coordinates:e})},onEnd:s(H6.DragEnd),onCancel:s(H6.DragCancel)});Ee.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===H6.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=H6.DragCancel)}w.current=null,(0,l_.unstable_batchedUpdates)(()=>{d({type:e}),h(G5.Uninitialized),we(null),E(null),O(null),Ee.current=null;let t=e===H6.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=s5(a,(0,U.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,De(n,t))},[v,De]));C5(a),p6(()=>{ie&&m===G5.Initializing&&h(G5.Initialized)},[ie,m]),(0,U.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,l_.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,U.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Ce),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,l_.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),p6(()=>{oe.current={activatorEvent:D,active:C,activeNode:F,collisionRect:xe,collisions:Se,droppableRects:N,draggableNodes:v,draggingNode:ce,draggingNodeRect:le,droppableContainers:b,over:L,scrollableAncestors:pe,scrollAdjustedTranslate:be},S.current={initial:le,translated:xe}},[C,F,Se,xe,v,ce,le,N,b,L,pe,be]),r5({...ne,delta:y,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let ke=(0,U.useMemo)(()=>({active:C,activeNode:F,activeNodeRect:ie,activatorEvent:D,collisions:Se,containerNodeRect:ae,dragOverlay:I,draggableNodes:v,droppableContainers:b,droppableRects:N,over:L,measureDroppableContainers:ee,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:M,measuringScheduled:P,windowRect:fe}),[C,F,ie,D,Se,ae,I,v,b,N,L,ee,pe,me,M,P,fe]),Ae=(0,U.useMemo)(()=>({activatorEvent:D,activators:Oe,active:C,activeNodeRect:ie,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:L,measureDroppableContainers:ee}),[D,Oe,C,ie,d,A,v,L,ee]);return U.createElement(I6.Provider,{value:p},U.createElement(I5.Provider,{value:Ae},U.createElement(L5.Provider,{value:ke},U.createElement(W5.Provider,{value:Te},i)),U.createElement(B5,{disabled:n?.restoreFocus===!1})),U.createElement(V6,{...n,hiddenTextDescribedById:A}));function je(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),q5=(0,U.createContext)(null),J5=`button`,Y5=`Draggable`;function X5(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=x6(Y5),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,U.useContext)(I5),{role:p=J5,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,U.useContext)(g?W5:q5),[v,y]=v6(),[b,x]=v6(),S=w5(o,t),C=g6(n);return p6(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,U.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===J5?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Z5(){return(0,U.useContext)(L5)}var Q5=`Droppable`,$5={timeout:25};function e7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=x6(Q5),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,U.useContext)(I5),u=(0,U.useRef)({disabled:n}),d=(0,U.useRef)(!1),f=(0,U.useRef)(null),p=(0,U.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...$5,...i},_=g6(h??r),v=h5({callback:(0,U.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=v6((0,U.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=g6(t);return(0,U.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,U.useEffect)(()=>(s({type:H6.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:H6.UnregisterDroppable,key:a,id:r})),[r]),(0,U.useEffect)(()=>{n!==u.current.disabled&&(s({type:H6.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function t7(e){let{animation:t,children:n}=e,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=y6(n);return!n&&!r&&s&&i(s),p6(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),U.createElement(U.Fragment,null,n,r?(0,U.cloneElement)(r,{ref:o}):null)}var n7={x:0,y:0,scaleX:1,scaleY:1};function r7(e){let{children:t}=e;return U.createElement(I5.Provider,{value:F5},U.createElement(W5.Provider,{value:n7},t))}var i7={position:`fixed`,touchAction:`none`},a7=e=>E6(e)?`transform 250ms ease`:void 0,o7=(0,U.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=a7}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...i7,width:s.width,height:s.height,top:s.top,left:s.left,transform:k6.Transform.toString(d),transformOrigin:i&&r?J6(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return U.createElement(n,{className:o,style:f,ref:t},a)}),s7={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:k6.Transform.toString(t)},{transform:k6.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function c7(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return m6((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=O5(a);if(!c)return;let{transform:l}=c6(a).getComputedStyle(a),u=u8(l);if(!u)return;let d=typeof t==`function`?t:l7(t);return N8(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function l7(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...s7,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var u7=0;function d7(e){return(0,U.useMemo)(()=>{if(e!=null)return u7++,u7},[e])}var f7=U.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Z5(),S=(0,U.useContext)(W5),C=d7(d?.id),w=V5(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=f5(f),E=c7({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return U.createElement(r7,null,U.createElement(t7,{animation:E},d&&C?U.createElement(o7,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function p7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function m7(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function h7(e){return e!==null&&e>=0}function g7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function _7(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var v7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=p7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},y7={scaleX:1,scaleY:1},b7=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...y7}:null}let s=x7(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...y7}:r<t&&r>=a?{x:0,y:o.height+s,...y7}:{x:0,y:0,...y7}};function x7(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var S7=`Sortable`,C7=U.createContext({activeIndex:-1,containerId:S7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:v7,disabled:{draggable:!1,droppable:!1}});function w7(e){let{children:t,id:n,items:r,strategy:i=v7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Z5(),d=x6(S7,n),f=s.rect!==null,p=(0,U.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,U.useRef)(p),v=!g7(p,_.current),y=g!==-1&&h===-1||v,b=_7(a);p6(()=>{v&&m&&u(p)},[v,p,m,u]),(0,U.useEffect)(()=>{_.current=p},[p]);let x=(0,U.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:m7(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return U.createElement(C7.Provider,{value:x},t)}var T7=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return p7(n,r,i).indexOf(t)},E7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},D7={duration:200,easing:`ease`},O7=`transform`,k7=k6.Transition.toString({property:O7,duration:0,easing:`linear`}),A7={roleDescription:`sortable`};function j7(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,U.useState)(null),s=(0,U.useRef)(n);return p6(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=p8(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,U.useEffect)(()=>{a&&o(null)},[a]),a}function M7(e){let{animateLayoutChanges:t=E7,attributes:n,disabled:r,data:i,getNewIndex:a=T7,id:o,strategy:s,resizeObserverConfig:c,transition:l=D7}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,U.useContext)(C7),y=N7(r,p),b=u.indexOf(o),x=(0,U.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,U.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=e7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:ee,setActivatorNodeRef:P,transform:F}=X5({id:o,data:x,attributes:{...A7,...n},disabled:y.draggable}),te=i6(E,j),ne=!!D,re=ne&&!m&&h7(f)&&h7(g),ie=!_&&N,ae=re?(ie&&re?F:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,oe=h7(f)&&h7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,se=D?.id,I=(0,U.useRef)({activeId:se,items:u,newIndex:oe,containerId:d}),ce=u!==I.current.items,le=t({active:D,containerId:d,isDragging:N,isSorting:ne,id:o,index:b,items:u,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:l,wasDragging:I.current.activeId!=null}),ue=j7({disabled:!le,index:b,node:w,rect:C});return(0,U.useEffect)(()=>{ne&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),u!==I.current.items&&(I.current.items=u)},[ne,oe,d,u]),(0,U.useEffect)(()=>{if(se===I.current.activeId)return;if(se!=null&&I.current.activeId==null){I.current.activeId=se;return}let e=setTimeout(()=>{I.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:oe,items:u,isOver:T,isSorting:ne,isDragging:N,listeners:M,node:w,overIndex:g,over:ee,setNodeRef:te,setActivatorNodeRef:P,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ue??ae,transition:de()};function de(){if(ue||ce&&I.current.newIndex===b)return k7;if(!(ie&&!E6(O)||!l)&&(ne||le))return k6.Transition.toString({...l,property:O7})}}function N7(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function P7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var F7=[$.Down,$.Right,$.Up,$.Left],I7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(F7.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n)}});let c=t8({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Q6(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=v8(c).some((e,t)=>s[t]!==e),i=L7(e,t),a=R7(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:w6(u,l)}}}};function L7(e,t){return!P7(e)||!P7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function R7(e,t){return!P7(e)||!P7(t)||!L7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var z7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(z7||{}),B7=[0,1],V7=[1,0],H7=[2,3],U7=[3,2],W7={L:B7,M:V7,Q:H7,H:U7},G7=/^\d*$/,K7=/^[A-Z0-9 $%*+./:-]*$/,q7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,J7=1,Y7=40,X7=3,Z7=3,Q7=40,$7=10,e9=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t9=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n9=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<J7||e>Y7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,z7.Timing),this.setFunctionModule(e,6,e%2==0,z7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,i9(r,e));this.setFunctionModule(8,7,i9(r,6)),this.setFunctionModule(8,8,i9(r,7)),this.setFunctionModule(7,8,i9(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,i9(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,i9(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,i9(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=i9(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,z7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,z7.Alignment)}setFunctionModule(e,t,n,r=z7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==y9(t,n))throw RangeError(`Invalid argument`);let r=t9[n[0]][t],i=e9[n[0]][t],a=Math.floor(v9(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=b9(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=x9(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(v9(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=i9(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=X7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*Q7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*Q7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=X7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*Q7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*Q7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Z7)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*$7,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function r9(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function i9(e,t){return!!(e>>>t&1)}var a9=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},o9=[1,10,12,14],s9=[2,9,11,13],c9=[4,8,16,16];function l9(e,t){return e[Math.floor((t+7)/17)+1]}function u9(e){let t=[];for(let n of e)r9(n,8,t);return new a9(c9,e.length,t)}function d9(e){if(!m9(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);r9(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new a9(o9,e.length,t)}function f9(e){if(!h9(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=q7.indexOf(e.charAt(n))*45;r+=q7.indexOf(e.charAt(n+1)),r9(r,11,t)}return n<e.length&&r9(q7.indexOf(e.charAt(n)),6,t),new a9(s9,e.length,t)}function p9(e){return e===``?[]:m9(e)?[d9(e)]:h9(e)?[f9(e)]:[u9(_9(e))]}function m9(e){return G7.test(e)}function h9(e){return K7.test(e)}function g9(e,t){let n=0;for(let r of e){let e=l9(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function _9(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function v9(e){if(e<J7||e>Y7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function y9(e,t){return Math.floor(v9(e)/8)-e9[t[0]][e]*t9[t[0]][e]}function b9(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=S9(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=S9(n,2)}return t}function x9(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=S9(t,e))}return n}function S9(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function C9(e,t,n=1,r=40,i=-1,a=!0){if(!(J7<=n&&n<=r&&r<=Y7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=y9(o,t)*8,i=g9(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[V7,H7,U7])a&&s<=y9(o,e)*8&&(t=e);let c=[];for(let t of e){r9(t.mode[0],4,c),r9(t.numChars,l9(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=y9(o,t)*8;r9(0,Math.min(4,l-c.length),c),r9(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)r9(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new n9(o,t,u,i)}function w9(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?p9(e):Array.isArray(e)?[u9(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=C9(c,W7[n],i,a,o,r),u=T9({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function T9(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=z7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function E9(e,t){if(!t.includes(e))throw Error(`Unsupported algorithm: ${String(e)}. Expected one of: ${t.join(`, `)}.`)}function D9(e,t){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function O9(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function k9(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function A9(e){if(e.length%2!=0)throw Error(`Hex string must have an even length. Got: ${e}`);if(!/^[0-9a-fA-F]*$/.test(e))throw Error(`Hex string contains non-hex characters.`);let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(n*2,n*2+2),16);return t}async function j9(e){await new Promise(t=>setTimeout(t,e))}function M9(e){return Math.floor((performance.now()-e)*10)/10}var N9;(function(e){e.SHA_256=`SHA-256`,e.SHA_384=`SHA-384`,e.SHA_512=`SHA-512`})(N9||={});var P9;(function(e){e.CODE=`code`,e.ERROR=`error`,e.VERIFIED=`verified`,e.VERIFYING=`verifying`,e.UNVERIFIED=`unverified`,e.EXPIRED=`expired`})(P9||={}),Object.values(N9);var F9={string:2**53-1,uint32:4294967295};function I9(e,t){return Number.isInteger(e)&&e>=0&&e<=F9[t]}var L9=class{nonce;mode;COUNTER_BYTES=4;buffer;dataView;encoder=new TextEncoder;constructor(e,t=`uint32`){this.nonce=e,this.mode=t,this.buffer=new Uint8Array(this.nonce.length+this.COUNTER_BYTES),this.buffer.set(this.nonce,0),this.dataView=new DataView(this.buffer.buffer)}setCounter(e){if(!I9(e,this.mode))throw RangeError(`counter must be an integer from 0 to ${F9[this.mode]}. Got: ${e}`);return this.mode===`string`?k9(this.nonce,this.encoder.encode(e.toString())):(this.dataView.setUint32(this.nonce.length,e,!1),this.buffer)}};function R9(e,t){if(typeof e!=`string`||!/^[0-9a-fA-F]+$/.test(e))throw Error(`keyPrefix must be a non-empty hex string.`);if(e.length>t*2)throw Error(`keyPrefix (${e.length} hex characters) must not be longer than the key (keyLength: ${t} bytes).`)}async function z9(e){let{challenge:t,controller:n,counterMode:r=`uint32`,counterStart:i=0,counterStep:a=1,deriveKey:o,timeout:s=9e4}=e,{nonce:c,keyLength:l=32,keyPrefix:u,salt:d}=t.parameters;R9(u,l);let f=A9(c),p=A9(d),m=u.toLowerCase(),h=u.length%2==0?A9(u):null,g=new L9(f,r),_=performance.now(),v=i,y=0,b=``,x=_;for(;;){if(n?.signal.aborted||s&&y%10==0&&performance.now()-_>s)return null;let{derivedKey:e}=await o(t.parameters,p,g.setCounter(v));if(y%10==0&&performance.now()-x>200&&(await j9(0),x=performance.now()),h?D9(e,h):O9(e).startsWith(m)){b=O9(e);break}v+=a,y+=1}return{counter:v,derivedKey:b,time:M9(_)}}[...Object.values(N9)];async function B9(e,t,n){let{algorithm:r,keyLength:i=32}=e;E9(r,[`SHA-256`,`SHA-384`,`SHA-512`]);let a=Math.max(1,e.cost),o=k9(t,n);for(let e=0;e<a;e++)o=new Uint8Array(await crypto.subtle.digest(r,o));return{parameters:{},derivedKey:o.slice(0,i)}}export{og as $,NQ as A,Ee as At,VM as B,e6 as C,_l as Ct,H1 as D,Vt as Dt,c0 as E,Ut as Et,KH as F,s_ as G,tE as H,GH as I,t_ as J,r_ as K,$M as L,tZ as M,ZY as N,B1 as O,Je as Ot,lq as P,ag as Q,QM as R,t6 as S,Pc as St,v3 as T,oo as Tt,Ib as U,_M as V,c_ as W,Qg as X,e_ as Y,Bg as Z,X5 as _,Cl as _t,p7 as a,uh as at,G6 as b,Xl as bt,b7 as c,ah as ct,W8 as d,jf as dt,Qh as et,Q8 as f,xf as ft,r8 as g,Ql as gt,a8 as h,$l as ht,w7 as i,hh as it,fQ as j,at as jt,JQ as k,zt as kt,K5 as l,rh as lt,e8 as m,Gu as mt,z9 as n,yh as nt,I7 as o,ch as ot,e5 as p,Zu as pt,n_ as q,w9 as r,vh as rt,M7 as s,sh as st,B9 as t,Hh as tt,f7 as u,Vf as ut,e7 as v,dl as vt,y3 as w,Uc as wt,r6 as x,Zl as xt,W6 as y,ll as yt,KM as z};
|
|
78
|
-
//# debugId=
|
|
77
|
+
`},B6={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function V6(e){let{announcements:t=B6,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=z6}=e,{announce:a,announcement:o}=F6(),s=x6(`DndLiveRegion`),[c,l]=(0,U.useState)(!1);if((0,U.useEffect)(()=>{l(!0)},[]),L6((0,U.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=U.createElement(U.Fragment,null,U.createElement(N6,{id:r,value:i.draggable}),U.createElement(P6,{id:s,announcement:o}));return n?(0,l_.createPortal)(u,n):u}var H6;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(H6||={});function U6(){}function W6(e,t){return(0,U.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function G6(){var e=[...arguments];return(0,U.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var K6=Object.freeze({x:0,y:0});function q6(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function J6(e,t){let n=O6(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function Y6(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function X6(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Z6(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function Q6(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function $6(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var e8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=$6(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=q6($6(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Y6)},t8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Z6(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Z6(r),o=i.reduce((e,t,r)=>e+q6(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Y6)};function n8(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var r8=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=n8(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(X6)};function i8(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var a8=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&i8(r,a)){let n=Z6(a).reduce((e,t)=>e+q6(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(Y6)};function o8(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function s8(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:K6}function c8(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var l8=c8(1);function u8(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function d8(e,t,n){let r=u8(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var f8={ignoreTransform:!1};function p8(e,t){t===void 0&&(t=f8);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=c6(e).getComputedStyle(e);t&&(n=d8(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function m8(e){return p8(e,{ignoreTransform:!0})}function h8(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function g8(e,t){return t===void 0&&(t=c6(e).getComputedStyle(e)),t.position===`fixed`}function _8(e,t){t===void 0&&(t=c6(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function v8(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(l6(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!u6(i)||d6(i)||n.includes(i))return n;let a=c6(e).getComputedStyle(i);return i!==e&&_8(i,a)&&n.push(i),g8(i,a)?n:r(i.parentNode)}return e?r(e):n}function y8(e){let[t]=v8(e,1);return t??null}function b8(e){return!a6||!e?null:o6(e)?e:s6(e)?l6(e)||e===f6(e).scrollingElement?window:u6(e)?e:null:null}function x8(e){return o6(e)?e.scrollX:e.scrollLeft}function S8(e){return o6(e)?e.scrollY:e.scrollTop}function C8(e){return{x:x8(e),y:S8(e)}}var w8;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(w8||={});function T8(e){return!a6||!e?!1:e===document.scrollingElement}function E8(e){let t={x:0,y:0},n=T8(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var D8={x:.2,y:.2};function O8(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=D8);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=E8(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=w8.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=w8.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=w8.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=w8.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function k8(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function A8(e){return e.reduce((e,t)=>C6(e,C8(t)),K6)}function j8(e){return e.reduce((e,t)=>e+x8(t),0)}function M8(e){return e.reduce((e,t)=>e+S8(t),0)}function N8(e,t){if(t===void 0&&(t=p8),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);y8(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var P8=[[`x`,[`left`,`right`],j8],[`y`,[`top`,`bottom`],M8]],F8=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=v8(t),r=A8(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of P8)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},I8=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function L8(e){let{EventTarget:t}=c6(e);return e instanceof t?e:f6(e)}function R8(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var z8;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(z8||={});function B8(e){e.preventDefault()}function V8(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var H8={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},U8=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},W8=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new I8(f6(t)),this.windowListeners=new I8(c6(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(z8.Resize,this.handleCancel),this.windowListeners.add(z8.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(z8.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&N8(n),t(K6)}handleKeyDown(e){if(E6(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=H8,coordinateGetter:a=U8,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:K6;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=w6(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=E8(n),p=k8(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,C6(w6(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};W8.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=H8,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function G8(e){return!!(e&&`distance`in e)}function K8(e){return!!(e&&`delay`in e)}var q8=class{constructor(e,t,n){n===void 0&&(n=L8(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=f6(i),this.documentListeners=new I8(this.document),this.listeners=new I8(n),this.windowListeners=new I8(c6(i)),this.initialCoordinates=O6(r)??K6,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(z8.Resize,this.handleCancel),this.windowListeners.add(z8.DragStart,B8),this.windowListeners.add(z8.VisibilityChange,this.handleCancel),this.windowListeners.add(z8.ContextMenu,B8),this.documentListeners.add(z8.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(K8(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(G8(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(z8.Click,V8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(z8.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=O6(e)??K6,s=w6(n,o);if(!t&&a){if(G8(a)){if(a.tolerance!=null&&R8(s,a.tolerance))return this.handleCancel();if(R8(s,a.distance))return this.handleStart()}if(K8(a)&&R8(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},J8={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Y8=class extends q8{constructor(e){let{event:t}=e,n=f6(t.target);super(e,J8,n)}};Y8.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var X8={move:{name:`mousemove`},end:{name:`mouseup`}},Z8;(function(e){e[e.RightClick=2]=`RightClick`})(Z8||={});var Q8=class extends q8{constructor(e){super(e,X8,f6(e.event.target))}};Q8.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Z8.RightClick&&(r?.({event:n}),!0)}}];var $8={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},e5=class extends q8{constructor(e){super(e,$8)}static setup(){return window.addEventListener($8.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($8.move.name,e)};function e(){}}};e5.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var t5;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(t5||={});var n5;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(n5||={});function r5(e){let{acceleration:t,activator:n=t5.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=n5.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=a5({delta:d,disabled:!a}),[m,h]=h6(),g=(0,U.useRef)({x:0,y:0}),_=(0,U.useRef)({x:0,y:0}),v=(0,U.useMemo)(()=>{switch(n){case t5.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case t5.DraggableRect:return i}},[n,i,c]),y=(0,U.useRef)(null),b=(0,U.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,U.useMemo)(()=>s===n5.TreeOrder?[...l].reverse():l,[s,l]);(0,U.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=O8(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var i5={x:{[w8.Backward]:!1,[w8.Forward]:!1},y:{[w8.Backward]:!1,[w8.Forward]:!1}};function a5(e){let{delta:t,disabled:n}=e,r=y6(t);return _6(e=>{if(n||!r||!e)return i5;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[w8.Backward]:e.x[w8.Backward]||i.x===-1,[w8.Forward]:e.x[w8.Forward]||i.x===1},y:{[w8.Backward]:e.y[w8.Backward]||i.y===-1,[w8.Forward]:e.y[w8.Forward]||i.y===1}}},[n,t,r])}function o5(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return _6(e=>t==null?null:r??e??null,[r,t])}function s5(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var c5;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(c5||={});var l5;(function(e){e.Optimized=`optimized`})(l5||={});var u5=new Map;function d5(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,U.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,U.useRef)(e),d=g(),f=g6(d),p=(0,U.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,U.useRef)(null),h=_6(t=>{if(d&&!n)return u5;if(!t||t===u5||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new F8(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,U.useEffect)(()=>{u.current=e},[e]),(0,U.useEffect)(()=>{d||p()},[n,d]),(0,U.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,U.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case c5.Always:return!1;case c5.BeforeDragging:return n;default:return!n}}}function f5(e,t){return _6(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function p5(e,t){return f5(e,t)}function m5(e){let{callback:t,disabled:n}=e,r=m6(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function h5(e){let{callback:t,disabled:n}=e,r=m6(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function g5(e){return new F8(p8(e),e)}function _5(e,t,n){t===void 0&&(t=g5);let[r,i]=(0,U.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=m5({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=h5({callback:a});return p6(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function v5(e){return s8(e,f5(e))}var y5=[];function b5(e){let t=(0,U.useRef)(e),n=_6(n=>e?n&&n!==y5&&e&&t.current&&e.parentNode===t.current.parentNode?n:v8(e):y5,[e]);return(0,U.useEffect)(()=>{t.current=e},[e]),n}function x5(e){let[t,n]=(0,U.useState)(null),r=(0,U.useRef)(e),i=(0,U.useCallback)(e=>{let t=b8(e.target);t&&n(e=>e?(e.set(t,C8(t)),new Map(e)):null)},[]);return(0,U.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=b8(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,C8(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{b8(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,U.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>C6(e,t),K6):A8(e):K6,[e,t])}function S5(e,t){t===void 0&&(t=[]);let n=(0,U.useRef)(null);return(0,U.useEffect)(()=>{n.current=null},t),(0,U.useEffect)(()=>{let t=e!==K6;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?w6(e,n.current):K6}function C5(e){(0,U.useEffect)(()=>{if(!a6)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function w5(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function T5(e){return(0,U.useMemo)(()=>e?h8(e):null,[e])}var E5=[];function D5(e,t){t===void 0&&(t=p8);let[n]=e,r=T5(n?c6(n):null),[i,a]=(0,U.useState)(E5);function o(){a(()=>e.length?e.map(e=>T8(e)?r:new F8(t(e),e)):E5)}let s=h5({callback:o});return p6(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function O5(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return u6(t)?t:e}function k5(e){let{measure:t}=e,[n,r]=(0,U.useState)(null),i=h5({callback:(0,U.useCallback)(e=>{for(let{target:n}of e)if(u6(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=v6((0,U.useCallback)(e=>{let n=O5(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,U.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var A5=[{sensor:Y8,options:{}},{sensor:W8,options:{}}],j5={current:{}},M5={draggable:{measure:m8},droppable:{measure:m8,strategy:c5.WhileDragging,frequency:l5.Optimized},dragOverlay:{measure:p8}},N5=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},P5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new N5,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:U6},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:M5,measureDroppableContainers:U6,windowRect:null,measuringScheduled:!1},F5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:U6,draggableNodes:new Map,over:null,measureDroppableContainers:U6},I5=(0,U.createContext)(F5),L5=(0,U.createContext)(P5);function R5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new N5}}}function z5(e,t){switch(t.type){case H6.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case H6.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case H6.DragEnd:case H6.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case H6.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new N5(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case H6.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new N5(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case H6.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new N5(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function B5(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,U.useContext)(I5),a=y6(r),o=y6(n?.id);return(0,U.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!E6(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=j6(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function V5(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function H5(e){return(0,U.useMemo)(()=>({draggable:{...M5.draggable,...e?.draggable},droppable:{...M5.droppable,...e?.droppable},dragOverlay:{...M5.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function U5(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,U.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;p6(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=s8(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=y8(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var W5=(0,U.createContext)({...K6,scaleX:1,scaleY:1}),G5;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(G5||={});var K5=(0,U.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=A5,collisionDetection:o=r8,measuring:s,modifiers:c,...l}=e,[u,d]=(0,U.useReducer)(z5,void 0,R5),[f,p]=R6(),[m,h]=(0,U.useState)(G5.Uninitialized),g=m===G5.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,U.useRef)({initial:null,translated:null}),C=(0,U.useMemo)(()=>_==null?null:{id:_,data:x?.data??j5,rect:S},[_,x]),w=(0,U.useRef)(null),[T,E]=(0,U.useState)(null),[D,O]=(0,U.useState)(null),k=g6(l,Object.values(l)),A=x6(`DndDescribedBy`,t),j=(0,U.useMemo)(()=>b.getEnabled(),[b]),M=H5(s),{droppableRects:N,measureDroppableContainers:ee,measuringScheduled:P}=d5(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),F=o5(v,_),te=(0,U.useMemo)(()=>D?O6(D):null,[D]),ne=je(),re=p5(F,M.draggable.measure);U5({activeNode:_==null?null:v.get(_),config:ne.layoutShiftCompensation,initialRect:re,measure:M.draggable.measure});let ie=_5(F,M.draggable.measure,re),ae=_5(F?F.parentElement:null),oe=(0,U.useRef)({activatorEvent:null,active:null,activeNode:F,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=b.getNodeFor(oe.current.over?.id),I=k5({measure:M.dragOverlay.measure}),ce=I.nodeRef.current??F,le=g?I.rect??ie:null,ue=!!(I.nodeRef.current&&I.rect),de=v5(ue?null:ie),fe=T5(ce?c6(ce):null),pe=b5(g?se??F:null),me=D5(pe),he=V5(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ie,containerNodeRect:ae,draggingNodeRect:le,over:oe.current.over,overlayNodeRect:I.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:fe}),ge=te?C6(te,y):null,_e=x5(pe),ve=S5(_e),ye=S5(_e,[ie]),be=C6(he,ve),xe=le?l8(le,he):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:N,droppableContainers:j,pointerCoordinates:ge}):null,Ce=Q6(Se,`id`),[L,we]=(0,U.useState)(null),Te=o8(ue?he:C6(he,ye),L?.rect??null,ie),Ee=(0,U.useRef)(null),De=(0,U.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:oe,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,l_.unstable_batchedUpdates)(()=>{r?.(i),h(G5.Initializing),d({type:H6.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ee.current),O(a)})},onMove(e){d({type:H6.DragMove,coordinates:e})},onEnd:s(H6.DragEnd),onCancel:s(H6.DragCancel)});Ee.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===H6.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=H6.DragCancel)}w.current=null,(0,l_.unstable_batchedUpdates)(()=>{d({type:e}),h(G5.Uninitialized),we(null),E(null),O(null),Ee.current=null;let t=e===H6.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Oe=s5(a,(0,U.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,De(n,t))},[v,De]));C5(a),p6(()=>{ie&&m===G5.Initializing&&h(G5.Initialized)},[ie,m]),(0,U.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,l_.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,U.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Ce),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,l_.unstable_batchedUpdates)(()=>{we(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),p6(()=>{oe.current={activatorEvent:D,active:C,activeNode:F,collisionRect:xe,collisions:Se,droppableRects:N,draggableNodes:v,draggingNode:ce,draggingNodeRect:le,droppableContainers:b,over:L,scrollableAncestors:pe,scrollAdjustedTranslate:be},S.current={initial:le,translated:xe}},[C,F,Se,xe,v,ce,le,N,b,L,pe,be]),r5({...ne,delta:y,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let ke=(0,U.useMemo)(()=>({active:C,activeNode:F,activeNodeRect:ie,activatorEvent:D,collisions:Se,containerNodeRect:ae,dragOverlay:I,draggableNodes:v,droppableContainers:b,droppableRects:N,over:L,measureDroppableContainers:ee,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:M,measuringScheduled:P,windowRect:fe}),[C,F,ie,D,Se,ae,I,v,b,N,L,ee,pe,me,M,P,fe]),Ae=(0,U.useMemo)(()=>({activatorEvent:D,activators:Oe,active:C,activeNodeRect:ie,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:L,measureDroppableContainers:ee}),[D,Oe,C,ie,d,A,v,L,ee]);return U.createElement(I6.Provider,{value:p},U.createElement(I5.Provider,{value:Ae},U.createElement(L5.Provider,{value:ke},U.createElement(W5.Provider,{value:Te},i)),U.createElement(B5,{disabled:n?.restoreFocus===!1})),U.createElement(V6,{...n,hiddenTextDescribedById:A}));function je(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),q5=(0,U.createContext)(null),J5=`button`,Y5=`Draggable`;function X5(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=x6(Y5),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,U.useContext)(I5),{role:p=J5,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,U.useContext)(g?W5:q5),[v,y]=v6(),[b,x]=v6(),S=w5(o,t),C=g6(n);return p6(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,U.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===J5?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Z5(){return(0,U.useContext)(L5)}var Q5=`Droppable`,$5={timeout:25};function e7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=x6(Q5),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,U.useContext)(I5),u=(0,U.useRef)({disabled:n}),d=(0,U.useRef)(!1),f=(0,U.useRef)(null),p=(0,U.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...$5,...i},_=g6(h??r),v=h5({callback:(0,U.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=v6((0,U.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=g6(t);return(0,U.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,U.useEffect)(()=>(s({type:H6.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:H6.UnregisterDroppable,key:a,id:r})),[r]),(0,U.useEffect)(()=>{n!==u.current.disabled&&(s({type:H6.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function t7(e){let{animation:t,children:n}=e,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=y6(n);return!n&&!r&&s&&i(s),p6(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),U.createElement(U.Fragment,null,n,r?(0,U.cloneElement)(r,{ref:o}):null)}var n7={x:0,y:0,scaleX:1,scaleY:1};function r7(e){let{children:t}=e;return U.createElement(I5.Provider,{value:F5},U.createElement(W5.Provider,{value:n7},t))}var i7={position:`fixed`,touchAction:`none`},a7=e=>E6(e)?`transform 250ms ease`:void 0,o7=(0,U.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=a7}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...i7,width:s.width,height:s.height,top:s.top,left:s.left,transform:k6.Transform.toString(d),transformOrigin:i&&r?J6(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return U.createElement(n,{className:o,style:f,ref:t},a)}),s7={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:k6.Transform.toString(t)},{transform:k6.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function c7(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return m6((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=O5(a);if(!c)return;let{transform:l}=c6(a).getComputedStyle(a),u=u8(l);if(!u)return;let d=typeof t==`function`?t:l7(t);return N8(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function l7(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...s7,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var u7=0;function d7(e){return(0,U.useMemo)(()=>{if(e!=null)return u7++,u7},[e])}var f7=U.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Z5(),S=(0,U.useContext)(W5),C=d7(d?.id),w=V5(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=f5(f),E=c7({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return U.createElement(r7,null,U.createElement(t7,{animation:E},d&&C?U.createElement(o7,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function p7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function m7(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function h7(e){return e!==null&&e>=0}function g7(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function _7(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var v7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=p7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},y7={scaleX:1,scaleY:1},b7=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...y7}:null}let s=x7(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...y7}:r<t&&r>=a?{x:0,y:o.height+s,...y7}:{x:0,y:0,...y7}};function x7(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var S7=`Sortable`,C7=U.createContext({activeIndex:-1,containerId:S7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:v7,disabled:{draggable:!1,droppable:!1}});function w7(e){let{children:t,id:n,items:r,strategy:i=v7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Z5(),d=x6(S7,n),f=s.rect!==null,p=(0,U.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,U.useRef)(p),v=!g7(p,_.current),y=g!==-1&&h===-1||v,b=_7(a);p6(()=>{v&&m&&u(p)},[v,p,m,u]),(0,U.useEffect)(()=>{_.current=p},[p]);let x=(0,U.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:m7(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return U.createElement(C7.Provider,{value:x},t)}var T7=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return p7(n,r,i).indexOf(t)},E7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},D7={duration:200,easing:`ease`},O7=`transform`,k7=k6.Transition.toString({property:O7,duration:0,easing:`linear`}),A7={roleDescription:`sortable`};function j7(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,U.useState)(null),s=(0,U.useRef)(n);return p6(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=p8(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,U.useEffect)(()=>{a&&o(null)},[a]),a}function M7(e){let{animateLayoutChanges:t=E7,attributes:n,disabled:r,data:i,getNewIndex:a=T7,id:o,strategy:s,resizeObserverConfig:c,transition:l=D7}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,U.useContext)(C7),y=N7(r,p),b=u.indexOf(o),x=(0,U.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,U.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=e7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:ee,setActivatorNodeRef:P,transform:F}=X5({id:o,data:x,attributes:{...A7,...n},disabled:y.draggable}),te=i6(E,j),ne=!!D,re=ne&&!m&&h7(f)&&h7(g),ie=!_&&N,ae=re?(ie&&re?F:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,oe=h7(f)&&h7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,se=D?.id,I=(0,U.useRef)({activeId:se,items:u,newIndex:oe,containerId:d}),ce=u!==I.current.items,le=t({active:D,containerId:d,isDragging:N,isSorting:ne,id:o,index:b,items:u,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:l,wasDragging:I.current.activeId!=null}),ue=j7({disabled:!le,index:b,node:w,rect:C});return(0,U.useEffect)(()=>{ne&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),u!==I.current.items&&(I.current.items=u)},[ne,oe,d,u]),(0,U.useEffect)(()=>{if(se===I.current.activeId)return;if(se!=null&&I.current.activeId==null){I.current.activeId=se;return}let e=setTimeout(()=>{I.current.activeId=se},50);return()=>clearTimeout(e)},[se]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:oe,items:u,isOver:T,isSorting:ne,isDragging:N,listeners:M,node:w,overIndex:g,over:ee,setNodeRef:te,setActivatorNodeRef:P,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ue??ae,transition:de()};function de(){if(ue||ce&&I.current.newIndex===b)return k7;if(!(ie&&!E6(O)||!l)&&(ne||le))return k6.Transition.toString({...l,property:O7})}}function N7(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function P7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var F7=[$.Down,$.Right,$.Up,$.Left],I7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(F7.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n)}});let c=t8({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=Q6(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=v8(c).some((e,t)=>s[t]!==e),i=L7(e,t),a=R7(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:w6(u,l)}}}};function L7(e,t){return!P7(e)||!P7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function R7(e,t){return!P7(e)||!P7(t)||!L7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var z7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(z7||{}),B7=[0,1],V7=[1,0],H7=[2,3],U7=[3,2],W7={L:B7,M:V7,Q:H7,H:U7},G7=/^\d*$/,K7=/^[A-Z0-9 $%*+./:-]*$/,q7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,J7=1,Y7=40,X7=3,Z7=3,Q7=40,$7=10,e9=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t9=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],n9=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<J7||e>Y7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,z7.Timing),this.setFunctionModule(e,6,e%2==0,z7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,i9(r,e));this.setFunctionModule(8,7,i9(r,6)),this.setFunctionModule(8,8,i9(r,7)),this.setFunctionModule(7,8,i9(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,i9(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,i9(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,i9(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=i9(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,z7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,z7.Alignment)}setFunctionModule(e,t,n,r=z7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==y9(t,n))throw RangeError(`Invalid argument`);let r=t9[n[0]][t],i=e9[n[0]][t],a=Math.floor(v9(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=b9(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=x9(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(v9(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=i9(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=X7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*Q7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*Q7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=X7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*Q7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*Q7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Z7)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*$7,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function r9(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function i9(e,t){return!!(e>>>t&1)}var a9=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},o9=[1,10,12,14],s9=[2,9,11,13],c9=[4,8,16,16];function l9(e,t){return e[Math.floor((t+7)/17)+1]}function u9(e){let t=[];for(let n of e)r9(n,8,t);return new a9(c9,e.length,t)}function d9(e){if(!m9(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);r9(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new a9(o9,e.length,t)}function f9(e){if(!h9(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=q7.indexOf(e.charAt(n))*45;r+=q7.indexOf(e.charAt(n+1)),r9(r,11,t)}return n<e.length&&r9(q7.indexOf(e.charAt(n)),6,t),new a9(s9,e.length,t)}function p9(e){return e===``?[]:m9(e)?[d9(e)]:h9(e)?[f9(e)]:[u9(_9(e))]}function m9(e){return G7.test(e)}function h9(e){return K7.test(e)}function g9(e,t){let n=0;for(let r of e){let e=l9(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function _9(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function v9(e){if(e<J7||e>Y7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function y9(e,t){return Math.floor(v9(e)/8)-e9[t[0]][e]*t9[t[0]][e]}function b9(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=S9(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=S9(n,2)}return t}function x9(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=S9(t,e))}return n}function S9(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function C9(e,t,n=1,r=40,i=-1,a=!0){if(!(J7<=n&&n<=r&&r<=Y7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=y9(o,t)*8,i=g9(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[V7,H7,U7])a&&s<=y9(o,e)*8&&(t=e);let c=[];for(let t of e){r9(t.mode[0],4,c),r9(t.numChars,l9(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=y9(o,t)*8;r9(0,Math.min(4,l-c.length),c),r9(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)r9(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new n9(o,t,u,i)}function w9(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?p9(e):Array.isArray(e)?[u9(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=C9(c,W7[n],i,a,o,r),u=T9({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function T9(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=z7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function E9(e,t){if(!t.includes(e))throw Error(`Unsupported algorithm: ${String(e)}. Expected one of: ${t.join(`, `)}.`)}function D9(e,t){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function O9(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function k9(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function A9(e){if(e.length%2!=0)throw Error(`Hex string must have an even length. Got: ${e}`);if(!/^[0-9a-fA-F]*$/.test(e))throw Error(`Hex string contains non-hex characters.`);let t=new Uint8Array(e.length/2);for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(n*2,n*2+2),16);return t}async function j9(e){await new Promise(t=>setTimeout(t,e))}function M9(e){return Math.floor((performance.now()-e)*10)/10}var N9;(function(e){e.SHA_256=`SHA-256`,e.SHA_384=`SHA-384`,e.SHA_512=`SHA-512`})(N9||={});var P9;(function(e){e.CODE=`code`,e.ERROR=`error`,e.VERIFIED=`verified`,e.VERIFYING=`verifying`,e.UNVERIFIED=`unverified`,e.EXPIRED=`expired`})(P9||={}),Object.values(N9);var F9={string:2**53-1,uint32:4294967295};function I9(e,t){return Number.isInteger(e)&&e>=0&&e<=F9[t]}var L9=class{nonce;mode;COUNTER_BYTES=4;buffer;dataView;encoder=new TextEncoder;constructor(e,t=`uint32`){this.nonce=e,this.mode=t,this.buffer=new Uint8Array(this.nonce.length+this.COUNTER_BYTES),this.buffer.set(this.nonce,0),this.dataView=new DataView(this.buffer.buffer)}setCounter(e){if(!I9(e,this.mode))throw RangeError(`counter must be an integer from 0 to ${F9[this.mode]}. Got: ${e}`);return this.mode===`string`?k9(this.nonce,this.encoder.encode(e.toString())):(this.dataView.setUint32(this.nonce.length,e,!1),this.buffer)}};function R9(e,t){if(typeof e!=`string`||!/^[0-9a-fA-F]+$/.test(e))throw Error(`keyPrefix must be a non-empty hex string.`);if(e.length>t*2)throw Error(`keyPrefix (${e.length} hex characters) must not be longer than the key (keyLength: ${t} bytes).`)}async function z9(e){let{challenge:t,controller:n,counterMode:r=`uint32`,counterStart:i=0,counterStep:a=1,deriveKey:o,timeout:s=9e4}=e,{nonce:c,keyLength:l=32,keyPrefix:u,salt:d}=t.parameters;R9(u,l);let f=A9(c),p=A9(d),m=u.toLowerCase(),h=u.length%2==0?A9(u):null,g=new L9(f,r),_=performance.now(),v=i,y=0,b=``,x=_;for(;;){if(n?.signal.aborted||s&&y%10==0&&performance.now()-_>s)return null;let{derivedKey:e}=await o(t.parameters,p,g.setCounter(v));if(y%10==0&&performance.now()-x>200&&(await j9(0),x=performance.now()),h?D9(e,h):O9(e).startsWith(m)){b=O9(e);break}v+=a,y+=1}return{counter:v,derivedKey:b,time:M9(_)}}[...Object.values(N9)];async function B9(e,t,n){let{algorithm:r,keyLength:i=32}=e;E9(r,[`SHA-256`,`SHA-384`,`SHA-512`]);let a=Math.max(1,e.cost),o=k9(t,n);for(let e=0;e<a;e++)o=new Uint8Array(await crypto.subtle.digest(r,o));return{parameters:{},derivedKey:o.slice(0,i)}}export{og as $,NQ as A,Ee as At,VM as B,e6 as C,_l as Ct,H1 as D,Vt as Dt,c0 as E,Ut as Et,KH as F,s_ as G,tE as H,GH as I,t_ as J,r_ as K,$M as L,tZ as M,ZY as N,B1 as O,Je as Ot,lq as P,ag as Q,QM as R,t6 as S,Pc as St,v3 as T,oo as Tt,Ib as U,_M as V,c_ as W,Qg as X,e_ as Y,Bg as Z,X5 as _,Cl as _t,p7 as a,ph as at,G6 as b,Xl as bt,b7 as c,ch as ct,W8 as d,Ef as dt,Qh as et,Q8 as f,xf as ft,r8 as g,Ql as gt,a8 as h,$l as ht,w7 as i,hh as it,fQ as j,at as jt,JQ as k,zt as kt,K5 as l,Kf as lt,e8 as m,Gu as mt,z9 as n,yh as nt,I7 as o,fh as ot,e5 as p,Zu as pt,n_ as q,w9 as r,vh as rt,M7 as s,uh as st,B9 as t,Hh as tt,f7 as u,If as ut,e7 as v,dl as vt,y3 as w,Uc as wt,r6 as x,Zl as xt,W6 as y,ll as yt,KM as z};
|
|
78
|
+
//# debugId=377ad7a6-8604-47c8-9424-12158e31defa
|