@juki-team/base-ui 1.5.16 → 1.5.19
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/esm/ArrowForwardIcon-B_e3QWhU.js +1 -0
- package/dist/esm/BarChart-BvTDut5Q.js +1 -0
- package/dist/esm/{CartesianChart-cNl_tqN9.js → CartesianChart-DXJUzdHO.js} +6 -6
- package/dist/esm/ChangePasswordModal-CWpZcVtX.js +1 -0
- package/dist/esm/CodeEditor-Y_Y_KGwk.js +1 -0
- package/dist/esm/CodeViewer-0wZyL6Bq.js +1 -0
- package/dist/esm/Collapse-B1DPGlnv.js +1 -0
- package/dist/esm/{DataGrid-Bu-7Atkf.js → DataGrid-D3ZzYM2h.js} +1 -1
- package/dist/esm/DataViewer-BfSurhEG.js +1 -0
- package/dist/esm/DrawerView-DSBtwsMA.js +1 -0
- package/dist/esm/ExcalidrawButton-yv6E00bG.js +1 -0
- package/dist/esm/GraphvizViewer-DakATts5.js +1 -0
- package/dist/esm/ImageLoaderCropper-C8OKbFOn.js +1 -0
- package/dist/esm/InputCellPhoneNumber-BEXEJTBK.js +1 -0
- package/dist/esm/InputColor-CbPh2iDK.js +14 -0
- package/dist/esm/LineChart-COzz604R.js +1 -0
- package/dist/esm/LoaderLayer-CWElgcGs.js +1 -0
- package/dist/esm/MdMath-DtFnLyF6.js +1 -0
- package/dist/esm/MdMathEditor-MfrmiBkf.js +28 -0
- package/dist/esm/{Popover-C0pozkRR.js → Popover-rAcowqkt.js} +1 -1
- package/dist/esm/ReplyIcon-D3OGXdpv.js +1 -0
- package/dist/esm/SettingsIcon-W2HrGsHn.js +1 -0
- package/dist/esm/SlideDeck-BNzpTHHg.js +1 -0
- package/dist/esm/TableEyeIcon-cEB6wzrG.js +1 -0
- package/dist/esm/TableOfContents-BReKKYKJ.js +1 -0
- package/dist/esm/Tooltip-RM4-Vd-G.js +1 -0
- package/dist/esm/UserCodeEditor-BCEc8t_t.js +61 -0
- package/dist/esm/VirtualizedRowsFixed-CJ-W5Lx9.js +1 -0
- package/dist/esm/WorksheetAsSlides-B11okTdK.js +1 -0
- package/dist/esm/WorksheetBodies-d_OdcX-s.js +1 -0
- package/dist/esm/WorksheetContents-BTVure1H.js +1 -0
- package/dist/esm/WorksheetEditor-EvB90uEy.js +1 -0
- package/dist/esm/WorksheetNode-Bi_SPWLG.js +1 -0
- package/dist/esm/WorksheetViewer-bf0RET7d.js +1 -0
- package/dist/esm/abnfDiagram-WEYOIA3C-DUulIW8V.js +1 -0
- package/dist/esm/{arc-CVDK40Ip.js → arc-DFzzPj4i.js} +1 -1
- package/dist/esm/architectureDiagram-ZHVYKT53-CgOYCH5f.js +1 -0
- package/dist/esm/blockDiagram-RJAE7QA3-Dx--ga4x.js +1 -0
- package/dist/esm/c4Diagram-XDPPPE54-COXzepKB.js +1 -0
- package/dist/esm/channel-_i3jSBTX.js +1 -0
- package/dist/esm/{chunk-2E7WHVMD-CDFgC3vV.js → chunk-2E7WHVMD-DVZL7NAY.js} +1 -1
- package/dist/esm/{chunk-2Q5K7J3B-kc9wbXRi.js → chunk-2Q5K7J3B-eykHmSYq.js} +1 -1
- package/dist/esm/{chunk-4EMNKR2T-BOCYiV20.js → chunk-4EMNKR2T-BiH2YqCm.js} +1 -1
- package/dist/esm/{chunk-55XCU76K-B9fq0Aas.js → chunk-55XCU76K-DkZ5SylO.js} +1 -1
- package/dist/esm/{chunk-5VM5RSS4-BiSpRiw9.js → chunk-5VM5RSS4-od-ppdXO.js} +1 -1
- package/dist/esm/{chunk-JWPE2WC7-fUi3mFpq.js → chunk-JWPE2WC7-Ban7escN.js} +1 -1
- package/dist/esm/{chunk-NQOKRVIF-9yhnn9l0.js → chunk-NQOKRVIF-DFUjH0uz.js} +1 -1
- package/dist/esm/{chunk-VQ5W62QI-k74sEYFL.js → chunk-VQ5W62QI-8RFxNRa_.js} +1 -1
- package/dist/esm/{chunk-XXDRQBXY-DJJHL2aw.js → chunk-XXDRQBXY-BLNKkmc0.js} +1 -1
- package/dist/esm/{chunk-ZCHMQSOR-DZxET8Hs.js → chunk-ZCHMQSOR-BhhsuCkN.js} +1 -1
- package/dist/esm/classDiagram-v2-4MYWR3UA-CeKl1zzm.js +1 -0
- package/dist/esm/commons-C-9EFvh4.js +1 -0
- package/dist/esm/constants.js +1 -1
- package/dist/esm/cose-bilkent-JH36ORCC-DM7-KVzj.js +1 -0
- package/dist/esm/cynefinDiagram-WF24UDRP-Cbf70uGf.js +1 -0
- package/dist/esm/dagre-NK4GIZVX-WvANG2YF.js +1 -0
- package/dist/esm/diagram-CBK3MWTC-czBpYiMW.js +1 -0
- package/dist/esm/diagram-I5XIIV2D-D0K29cS6.js +1 -0
- package/dist/esm/diagram-ODIL2UCW-DJOtGvRy.js +1 -0
- package/dist/esm/diagram-PFBEJUXE-Bb7d4gy5.js +1 -0
- package/dist/esm/diagram-RJA3I4VV-766WDxVQ.js +1 -0
- package/dist/esm/diagram-TYUNFSNR-jxQ7Yf7F.js +1 -0
- package/dist/esm/ebnfDiagram-V4P3TTPT-CmQb2zv4.js +1 -0
- package/dist/esm/elk-QONTBCTQ-ed5QeBRk.js +1 -0
- package/dist/esm/enums.js +1 -1
- package/dist/esm/erDiagram-KYQIGQAA-DeToaAJo.js +1 -0
- package/dist/esm/{floating-ui.dom-DGDCR4EF.js → floating-ui.dom-DpXpy_9C.js} +1 -1
- package/dist/esm/flowDiagram-IUGLLWBU-XbuBBhyN.js +1 -0
- package/dist/esm/ganttDiagram-R7GPNTJY-DFWpMgXx.js +1 -0
- package/dist/esm/gitGraphDiagram-PDYL7XHY-CoobcIfr.js +1 -0
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/index-B--41Rgp.js +1 -0
- package/dist/esm/{index-mLZqgXD7.js → index-BBCZJE-R.js} +1 -1
- package/dist/esm/index-BlaxEeMl.js +1 -0
- package/dist/esm/{index-CffiBbeH.js → index-CB1wz24Q.js} +1 -1
- package/dist/esm/{index-DWLuqDsD.js → index-CJ0mP3Zm.js} +1 -1
- package/dist/esm/{index-CmWQEzQl.js → index-CWCIYdOV.js} +1 -1
- package/dist/esm/{index-DBWowQHL.js → index-C_OMDe9Q.js} +1 -1
- package/dist/esm/{index-nNMK7HvL.js → index-CqbF_7wB.js} +1 -1
- package/dist/esm/index-D1LsGPMS.js +1 -0
- package/dist/esm/{index-CHgqN-d9.js → index-D2XW0y_s.js} +1 -1
- package/dist/esm/{index-BDQ8194g.js → index-D5f1dQka.js} +1 -1
- package/dist/esm/{index-CJtYjUlf.js → index-DBdTqY1b.js} +1 -1
- package/dist/esm/{index-CHVYA2P8.js → index-Dn0pnDCC.js} +1 -1
- package/dist/esm/index-DpobNvg5.js +1 -0
- package/dist/esm/index-Zvckkvpn.js +1 -0
- package/dist/esm/{index-BS7YTgMe.js → index-kHWDzZEv.js} +1 -1
- package/dist/esm/infoDiagram-MVDRKAX5-BrsWRbGW.js +1 -0
- package/dist/esm/ishikawaDiagram-HPEHV2GE-BAmx-YEw.js +1 -0
- package/dist/esm/journeyDiagram-BOSHW7O7-CnBSpLoa.js +1 -0
- package/dist/esm/kanban-definition-FNSA4HC5-4yCo11oy.js +1 -0
- package/dist/esm/{linear-CIPQsvV7.js → linear-BCwRtKK9.js} +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/mermaid.core-Dj1WAzSy.js +5 -0
- package/dist/esm/mindmap-definition-6OY57UG3-Bd4Y4GbF.js +1 -0
- package/dist/esm/pegDiagram-ECIUJNBX-CK56FMnc.js +1 -0
- package/dist/esm/pieDiagram-GNMPY74T-BJ1Np7Iw.js +1 -0
- package/dist/esm/quadrantDiagram-D57K4MC3-tOVWqHZx.js +1 -0
- package/dist/esm/railroadDiagram-Y72NRBL7-BvwPAju5.js +1 -0
- package/dist/esm/requirementDiagram-EQYSW5RA-D7P8RO2c.js +1 -0
- package/dist/esm/sankeyDiagram-SY24JHO5-Hasf32Sf.js +1 -0
- package/dist/esm/sequenceDiagram-BLEHNHQU-CVjBG1oF.js +1 -0
- package/dist/esm/server.js +1 -1
- package/dist/esm/settings-DzQM72QE.js +1 -0
- package/dist/esm/settings.js +1 -1
- package/dist/esm/sizeCapture-INFHLROL-CiSMSiOI.js +1 -0
- package/dist/esm/stateDiagram-v2-A6IESKWZ-z0hJGPOR.js +1 -0
- package/dist/esm/swimlanes-B3ENRKFQ-CBNFNgNt.js +1 -0
- package/dist/esm/swimlanesDiagram-AYQRV4AK-Bf9aZNHn.js +1 -0
- package/dist/esm/{throttle-tEKq3i9o.js → throttle-DvoLRXRs.js} +1 -1
- package/dist/esm/{time-DP3lbwAd.js → time-2Ms6XNBq.js} +1 -1
- package/dist/esm/timeline-definition-JXYKGLGB-Cug_uWko.js +1 -0
- package/dist/esm/{types-C6dLWyzP.js → types-DIz4kTf7.js} +1 -1
- package/dist/esm/usecaseDiagram-WPOLBNNX-DvMBgn3t.js +1 -0
- package/dist/esm/vennDiagram-Q3Y3IDCW-BkU3qp5r.js +1 -0
- package/dist/esm/wardleyDiagram-IVAIDKWA-BgQww2R8.js +1 -0
- package/dist/esm/websocket-Cz_aqdkJ.js +1 -0
- package/dist/esm/worksheet-CKlbZOJI.js +1 -0
- package/dist/esm/worksheet-Tio8jHyw.js +1 -0
- package/dist/esm/xychartDiagram-4URNHDU4-Dk_dIDtn.js +1 -0
- package/dist/module-types/src/components/molecules/_lazy_/CodeEditor/codemirror/types.d.ts +7 -1
- package/dist/module-types/src/components/types/index.d.ts +5 -0
- package/dist/module-types/src/enums/index.d.ts +1 -1
- package/dist/module-types/src/stores/websocket/topicChannels.d.ts +1 -1
- package/package.json +2 -2
- package/src/styles/components/atoms/_menu.scss +25 -13
- package/dist/esm/ArrowForwardIcon-BIC54sbk.js +0 -1
- package/dist/esm/BarChart-54h6GU3p.js +0 -1
- package/dist/esm/ChangePasswordModal-DGIG264-.js +0 -1
- package/dist/esm/CodeEditor-C5-1AgZR.js +0 -1
- package/dist/esm/CodeViewer-CQrzGpJT.js +0 -1
- package/dist/esm/Collapse-Cx9QTKZD.js +0 -1
- package/dist/esm/DataViewer-Cv0iOPJ_.js +0 -1
- package/dist/esm/DrawerView-Cbw3l2O7.js +0 -1
- package/dist/esm/ExcalidrawButton-zJFah1nC.js +0 -1
- package/dist/esm/GraphvizViewer-DsTGulG0.js +0 -1
- package/dist/esm/ImageLoaderCropper-Bk1LxSbD.js +0 -1
- package/dist/esm/InputCellPhoneNumber-BaFBGcAe.js +0 -1
- package/dist/esm/InputColor-DhUlWGSD.js +0 -14
- package/dist/esm/LineChart-BQ1UY4l8.js +0 -1
- package/dist/esm/LoaderLayer-aKmuHFys.js +0 -1
- package/dist/esm/MdMath-DvH_O_A3.js +0 -1
- package/dist/esm/MdMathEditor-4-bjr11C.js +0 -29
- package/dist/esm/ReplyIcon-DFPc1kie.js +0 -1
- package/dist/esm/SettingsIcon-P_1rE3U0.js +0 -1
- package/dist/esm/SlideDeck-0cxhxG3b.js +0 -1
- package/dist/esm/TableEyeIcon-5qDbI7lU.js +0 -1
- package/dist/esm/TableOfContents-DG7lfEl8.js +0 -1
- package/dist/esm/Tooltip-OI-qyixa.js +0 -1
- package/dist/esm/UserCodeEditor-XI5CMxYI.js +0 -61
- package/dist/esm/VirtualizedRowsFixed-DH6WrMq1.js +0 -1
- package/dist/esm/WorksheetAsSlides-vK1Nqrlr.js +0 -1
- package/dist/esm/WorksheetBodies-AupmhX--.js +0 -1
- package/dist/esm/WorksheetContents-RcU2Wigz.js +0 -1
- package/dist/esm/WorksheetEditor-BExsBWi8.js +0 -1
- package/dist/esm/WorksheetNode-BTU0R61c.js +0 -1
- package/dist/esm/WorksheetViewer-Bn_SoOic.js +0 -1
- package/dist/esm/abnfDiagram-WEYOIA3C-Dpw6XMB5.js +0 -1
- package/dist/esm/architectureDiagram-ZHVYKT53-CwRCJS-f.js +0 -1
- package/dist/esm/blockDiagram-RJAE7QA3-BsveJL2h.js +0 -1
- package/dist/esm/c4Diagram-XDPPPE54-DT_YwSdM.js +0 -1
- package/dist/esm/channel-DfU2WyO4.js +0 -1
- package/dist/esm/classDiagram-v2-4MYWR3UA-Ccw8sMnD.js +0 -1
- package/dist/esm/commons-Bam9oxAR.js +0 -1
- package/dist/esm/cose-bilkent-JH36ORCC-iT9n9qMD.js +0 -1
- package/dist/esm/cynefinDiagram-WF24UDRP-COkkadSX.js +0 -1
- package/dist/esm/dagre-NK4GIZVX-B2jYnU0Q.js +0 -1
- package/dist/esm/diagram-CBK3MWTC-DzCzOobH.js +0 -1
- package/dist/esm/diagram-I5XIIV2D-ChGPyzwT.js +0 -1
- package/dist/esm/diagram-ODIL2UCW-_jTs4ZGf.js +0 -1
- package/dist/esm/diagram-PFBEJUXE-C66lVsSz.js +0 -1
- package/dist/esm/diagram-RJA3I4VV-QELSA6fF.js +0 -1
- package/dist/esm/diagram-TYUNFSNR-Be-cdxPq.js +0 -1
- package/dist/esm/ebnfDiagram-V4P3TTPT-Cr1EANnv.js +0 -1
- package/dist/esm/elk-QONTBCTQ-CqfCbAWo.js +0 -1
- package/dist/esm/erDiagram-KYQIGQAA-DMgweTFG.js +0 -1
- package/dist/esm/flowDiagram-IUGLLWBU-B4pY13UK.js +0 -1
- package/dist/esm/ganttDiagram-R7GPNTJY-YkRR1QZl.js +0 -1
- package/dist/esm/gitGraphDiagram-PDYL7XHY-BuhZy85T.js +0 -1
- package/dist/esm/index-CTKRTL8i.js +0 -1
- package/dist/esm/index-DU7OAICx.js +0 -1
- package/dist/esm/index-c3o5xJQl.js +0 -1
- package/dist/esm/index-w_leOmyv.js +0 -1
- package/dist/esm/infoDiagram-MVDRKAX5-CfqZ5lu9.js +0 -1
- package/dist/esm/ishikawaDiagram-HPEHV2GE-fwZw1vDt.js +0 -1
- package/dist/esm/journeyDiagram-BOSHW7O7-CJ0qr25S.js +0 -1
- package/dist/esm/kanban-definition-FNSA4HC5-D467uQkY.js +0 -1
- package/dist/esm/mermaid.core-QEjDbduh.js +0 -5
- package/dist/esm/mindmap-definition-6OY57UG3-BLQmSwVy.js +0 -1
- package/dist/esm/pegDiagram-ECIUJNBX-BD9B5ipu.js +0 -1
- package/dist/esm/pieDiagram-GNMPY74T-ALgTthPz.js +0 -1
- package/dist/esm/quadrantDiagram-D57K4MC3-DvM56mui.js +0 -1
- package/dist/esm/railroadDiagram-Y72NRBL7-Bbmv8kBV.js +0 -1
- package/dist/esm/requirementDiagram-EQYSW5RA-B2-FtMv8.js +0 -1
- package/dist/esm/sankeyDiagram-SY24JHO5-a4Tjq4bh.js +0 -1
- package/dist/esm/sequenceDiagram-BLEHNHQU-D51n1e3_.js +0 -1
- package/dist/esm/settings-Cd8fftVp.js +0 -1
- package/dist/esm/sizeCapture-INFHLROL-EvtR_ZF3.js +0 -1
- package/dist/esm/stateDiagram-v2-A6IESKWZ-Dy_vLRVL.js +0 -1
- package/dist/esm/swimlanes-B3ENRKFQ-0pqT2-Jw.js +0 -1
- package/dist/esm/swimlanesDiagram-AYQRV4AK-COayinaD.js +0 -1
- package/dist/esm/timeline-definition-JXYKGLGB-DFhOynr-.js +0 -1
- package/dist/esm/usecaseDiagram-WPOLBNNX-MTVBbHK8.js +0 -1
- package/dist/esm/vennDiagram-Q3Y3IDCW-CgaIfPfv.js +0 -1
- package/dist/esm/wardleyDiagram-IVAIDKWA-CEQzSAI4.js +0 -1
- package/dist/esm/websocket-BppBoZUJ.js +0 -1
- package/dist/esm/worksheet-CQgex79V.js +0 -1
- package/dist/esm/xychartDiagram-4URNHDU4-BQJJ7mH2.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import*as s from"react";import r,{forwardRef as a,useState as i,useEffect as o,useRef as l,useId as c,useCallback as d,lazy as u,Suspense as h,useMemo as p,Children as m,Fragment as f,createElement as g,useContext as b,createContext as v,cloneElement as y,memo as w,useLayoutEffect as k,isValidElement as N,Component as x,useReducer as S}from"react";import{Sound as j,TriggerAction as E,QueryParamKey as C,Period as O,ContestTab as _,ProfileTab as I,Duration as T}from"./enums.js";import{c as A,i as P,g as z,k as L,r as R,l as M,d as $,t as F,f as D,j as V}from"./commons-Bam9oxAR.js";import{L as U,D as B,o as Z,p as H,v as W,S as K,aZ as J,aE as G,a_ as q,a$ as Y,b0 as X,b1 as Q,b2 as ee,b3 as te,b4 as ne,b5 as se,b6 as re,b7 as ae,b8 as ie,b9 as oe,ba as le,bb as ce,bc as de,bd as ue,be as he,bf as pe,bg as me,w as fe,aP as ge,x as be,ag as ve,J as ye,aS as we,P as ke,M as Ne,g as xe,C as Se,H as je,bh as Ee,bi as Ce,F as Oe,bj as _e,T as Ie,aV as Te,aO as Ae,aT as Pe,K as ze,bk as Le,bl as Re,bm as Me,f as $e,bn as Fe,c as De,bo as Ve,bp as Ue,bq as Be,br as Ze,bs as He,ae as We,bt as Ke,I as Je,bu as Ge,W as qe,y as Ye,G as Xe,R as Qe,b as et,bv as tt,bw as nt,bx as st,by as rt,bz as at,bA as it,bB as ot,bC as lt,A as ct,bD as dt}from"./settings-Cd8fftVp.js";import{RESIZE_DETECTOR_PROPS as ut,DAYS_2 as ht,DEFAULT_DATA_VIEWER_PROPS as pt,PAGE_SIZE_OPTIONS as mt,LEAST_ONE_UPPERCASE_LOWERCASE_NUMBER_REGEX as ft,ALPHANUMERIC_DASH_UNDERSCORE_REGEX as gt}from"./constants.js";import{S as bt,U as vt,K as yt,p as wt,i as kt,j as Nt,F as xt,k as St,G as jt,C as Et,a as Ct,a6 as Ot,ak as _t,q as It,l as Tt,aj as At,a9 as Pt,L as zt,Z as Lt,y as Rt,ae as Mt,$ as $t,aC as Ft,P as Dt,ar as Vt,W as Ut,E as Bt,au as Zt,R as Ht,V as Wt,b as Kt,f as Jt,av as Gt,n as qt,as as Yt,e as Xt,a7 as Qt,aD as en,A as tn,I as nn,ah as sn,ag as rn,ay as an,a1 as on,a0 as ln,z as cn,al as dn,o as un,az as hn,aw as pn,T as mn,aA as fn,O as gn,a4 as bn,ac as vn,aq as yn,ai as wn,_ as kn,H as Nn,m as xn,Y as Sn,s as jn,an as En,ab as Cn,ax as On,J as _n,a5 as In,B as Tn,aa as An,D as Pn,Q as zn,a8 as Ln,g as Rn,aB as Mn,a3 as $n,X as Fn,ap as Dn,am as Vn,ad as Un,h as Bn,a2 as Zn,ao as Hn,af as Wn,at as Kn}from"./LoaderLayer-aKmuHFys.js";import{c as Jn,f as Gn,D as qn,B as Yn,r as Xn,l as Qn,a as es,b as ts,H as ns,y as ss,g as rs,n as as,C as is,m as os,t as ls,h as cs,G as ds,F as us,z as hs}from"./websocket-BppBoZUJ.js";import{j as ps,c as ms,p as fs,a as gs}from"./index-c3o5xJQl.js";import{AnimatePresence as bs,motion as vs,MotionConfig as ys}from"motion/react";import ws from"react-dom";import ks,{useSWRConfig as Ns,preload as xs}from"swr";import Ss from"@ably/spaces";import{SpacesProvider as js,SpaceProvider as Es}from"@ably/spaces/react";import Cs from"ably";import{LiveObjects as Os}from"ably/liveobjects";import{useSpace as _s}from"@ably/spaces/dist/mjs/react";const Is=e=>{let t;const n=new Set,s=(e,s)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=s?s:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,a={setState:s,getState:r,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e))},i=t=e(s,r,a);return a},Ts=e=>e;function As(e,t=Ts){const n=r.useSyncExternalStore(e.subscribe,r.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return r.useDebugValue(n),n}const Ps=e=>{const t=(e=>e?Is(e):Is)(e),n=e=>As(t,e);return Object.assign(n,t),n},zs=e=>e?Ps(e):Ps,Ls="undefined"!=typeof document,Rs=[{hidden:"hidden",event:"visibilitychange",state:"visibilityState"},{hidden:"webkitHidden",event:"webkitvisibilitychange",state:"webkitVisibilityState"},{hidden:"mozHidden",event:"mozvisibilitychange",state:"mozVisibilityState"},{hidden:"msHidden",event:"msvisibilitychange",state:"msVisibilityState"},{hidden:"oHidden",event:"ovisibilitychange",state:"oVisibilityState"}],Ms=Ls&&Boolean(document.addEventListener),$s=(()=>{if(!Ms)return null;for(let e of Rs)if(e.hidden in document)return e;return null})(),Fs=()=>{if(!$s)return[!0,"visible"];const{hidden:e,state:t}=$s;return[!document[e],document[t]]},Ds=zs(e=>({isOnline:"undefined"!=typeof navigator&&navigator.onLine,setOnline:t=>e({isOnline:t}),isVisible:Fs()[0],setIsVisible:t=>e({isVisible:t}),isFocus:!0,setIsFocus:t=>e({isFocus:t}),isFullscreen:!1,setIsFullscreen:t=>e({isFullscreen:t}),viewPort:{screen:"",height:0,width:0,isSmallScreen:!1,isMediumScreen:!1,isLargeScreen:!1,isHugeScreen:!1},setViewPort:t=>e({viewPort:t})})),Vs=async(e,t=.3)=>{e&&(e.volume=t,e.currentTime=0,await e.play().catch(()=>{}))},Us=zs((e,t)=>({sounds:null,setSounds:t=>e({sounds:t}),playClick:()=>Vs(t().sounds?.[j.CLICK],.1),playSuccess:()=>Vs(t().sounds?.[j.SUCCESS],.1),playError:(e=.1)=>Vs(t().sounds?.[j.ERROR],e),playNotification:()=>Vs(t().sounds?.[j.NOTIFICATION]),playWarning:()=>Vs(t().sounds?.[j.WARNING]),playMessage:()=>Vs(t().sounds?.[j.MESSAGE]),playPop:()=>Vs(t().sounds?.[j.POP]),playBell:()=>Vs(t().sounds?.[j.BELL])}));const Bs=a(function(t,n){const{submit:s=!1,type:r="primary",className:a,expand:i=!1,icon:o,children:l,size:c="regular",onClick:d,disabled:u=!1,responsiveMobile:h=!1,tooltipContent:p,"aria-label":m,...f}=t,g=Us(),b=Ds(e=>e.viewPort.isSmallScreen),v=!(!l||h&&b),y=!v&&!!o;return e("button",{"data-tooltip-id":p?"jk-tooltip":"","data-tooltip-content":p,ref:n,"aria-disabled":u,"aria-label":m??(y?p:void 0),type:s?"submit":"button",className:A(a,`jk-button ${r} jk-br-ie`,h&&b?"large":c,{expand:i,"only-icon":y,disabled:u,icon:!!o}),onClick:u?e=>{e.preventDefault();const t=e.currentTarget;g.playError(),t.classList.remove("shake"),t.offsetWidth,t.classList.add("shake")}:e=>{const t=e.currentTarget;g.playClick(),t.classList.remove("shrink-click"),t.offsetWidth,t.classList.add("shrink-click"),d?.({onClickEvent:e})},...f,children:[o,v&&l]})});function Zs({children:e}){const[n,s]=i(!1);return o(()=>{s(!0)},[]),n?e:t("div",{className:"jk-loader-layer jk-overlay",children:t(bt,{})})}function Hs(n){const{text:s,iconSize:r="regular",tooltipContent:a,children:o,noStyling:l,className:c,disabled:d=!1}=n,[u,h]=i(!1);return e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":u?"copied":a??"copy",className:A("jk-row gap",c,{"link jk-br-ie jk-button secondary":!l,"jk-row nowrap":!!o,"only-icon":!o,disabled:d}),style:l||!o?{}:{width:"min-content"},"aria-disabled":d,onClick:d?void 0:async e=>{e.preventDefault(),e.stopPropagation(),await Jn(s),h(!0),setTimeout(()=>h(!1),600)},children:[t(u?vt:yt,{size:r}),o]})}const Ws=e=>"string"==typeof e,Ks=()=>{let e,t;const n=new Promise((n,s)=>{e=n,t=s});return n.resolve=e,n.reject=t,n},Js=e=>null==e?"":String(e),Gs=/###/g,qs=e=>e&&e.includes("###")?e.replace(Gs,"."):e,Ys=e=>!e||Ws(e),Xs=(e,t,n)=>{const s=Ws(t)?t.split("."):t;let r=0;for(;r<s.length-1;){if(Ys(e))return{};const t=qs(s[r]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++r}return Ys(e)?{}:{obj:e,k:qs(s[r])}},Qs=(e,t,n)=>{const{obj:s,k:r}=Xs(e,t,Object);if(void 0!==s||1===t.length)return void(s[r]=n);let a=t[t.length-1],i=t.slice(0,t.length-1),o=Xs(e,i,Object);for(;void 0===o.obj&&i.length;)a=`${i[i.length-1]}.${a}`,i=i.slice(0,i.length-1),o=Xs(e,i,Object),o?.obj&&void 0!==o.obj[`${o.k}.${a}`]&&(o.obj=void 0);o.obj[`${o.k}.${a}`]=n},er=(e,t)=>{const{obj:n,k:s}=Xs(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},tr=(e,t,n)=>{for(const s in t)"__proto__"!==s&&"constructor"!==s&&(Object.prototype.hasOwnProperty.call(e,s)?Ws(e[s])||e[s]instanceof String||Ws(t[s])||t[s]instanceof String?n&&(e[s]=t[s]):tr(e[s],t[s],n):e[s]=t[s]);return e},nr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),sr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},rr=e=>Ws(e)?e.replace(/[&<>"'\/]/g,e=>sr[e]):e;const ar=[" ",",","?","!",";"],ir=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}(20),or=(e,t,n=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const s=t.split(n);let r=e;for(let e=0;e<s.length;){if(!r||"object"!=typeof r)return;let t,a="";for(let i=e;i<s.length;++i)if(i!==e&&(a+=n),a+=s[i],t=r[a],"function"!=typeof t&&"__proto__"!==a||Object.prototype.hasOwnProperty.call(r,a)||(t=void 0),void 0!==t){if(["string","number","boolean"].includes(typeof t)&&i<s.length-1)continue;e+=i-e+1;break}r=t}return r},lr=e=>e?.replace(/_/g,"-"),cr={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class dr{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||cr,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,n,s){return s&&!this.debug?null:(e=e.map(e=>Ws(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g," "):e),Ws(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new dr(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new dr(this.logger,e)}}var ur=new dr;class hr{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}once(e,t){const n=(...s)=>{t(...s),this.off(e,n)};return this.on(e,n),this}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let s=0;s<n;s++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([n,s])=>{for(let r=0;r<s;r++)n(e,...t)})}}}const pr=new WeakSet;class mr extends hr{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,s={}){const r=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,a=void 0!==s.ignoreJSONStructure?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let i;e.includes(".")?i=e.split("."):(i=[e,t],n&&(Array.isArray(n)?i.push(...n):Ws(n)&&r?i.push(...n.split(r)):i.push(n)));const o=er(this.data,i);return null!=o||t||n||!e.includes(".")||(e=i[0],t=i[1],n=i.slice(2).join(".")),null==o&&a&&Ws(n)?or(this.data?.[e]?.[t],n,r):o}addResource(e,t,n,s,r={silent:!1}){const a=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator;let i=[e,t];n&&(i=i.concat(a?n.split(a):n)),e.includes(".")&&(i=e.split("."),s=t,t=i[1]),this.addNamespaces(t),Qs(this.data,i,s),r.silent||this.emit("added",e,t,n,s)}addResources(e,t,n,s={silent:!1}){for(const s in n)(Ws(n[s])||Array.isArray(n[s]))&&this.addResource(e,t,s,n[s],{silent:!0});s.silent||this.emit("added",e,t,n)}addResourceBundle(e,t,n,s,r,a={silent:!1,skipCopy:!1}){let i=[e,t];e.includes(".")&&(i=e.split("."),s=n,n=t,t=i[1]),this.addNamespaces(t);let o=er(this.data,i)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),s?tr(o,n,r):o={...o,...n},Qs(this.data,i,o),a.silent||this.emit("added",e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>{const n=t[e];return!!pr.has(n)||!(!n||0===Object.keys(n).length)&&("object"==typeof n&&pr.add(n),!0)})}toJSON(){return this.data}}var fr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,s,r){return e.forEach(e=>{t=this.processors[e]?.process(t,n,s,r)??t}),t}};const gr=Symbol("i18next/PATH_KEY");function br(e,t){const{[gr]:n}=e(function(){const e=[],t=Object.create(null);let n;return t.get=(s,r)=>(n?.revoke?.(),r===gr?e:(e.push(r),n=Proxy.revocable(s,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}()),s=t?.keySeparator??".",r=t?.nsSeparator??":",a="strict"===t?.enableSelector;if(n.length>1&&r){const e=t?.ns,i=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(i){if((a?i:i.length>1?i.slice(1):[]).includes(n[0]))return`${n[0]}${r}${n.slice(1).join(s)}`}}return n.join(s)}const vr=e=>!Ws(e)&&"boolean"!=typeof e&&"number"!=typeof e;class yr extends hr{constructor(e,t={}){super(),((e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=ur.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const n={...t};if(null==e)return!1;const s=this.resolve(e,n);if(void 0===s?.res)return!1;const r=vr(s.res);return!1!==n.returnObjects||!r}extractFromKey(e,t){let n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");const s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let r=t.ns||this.options.defaultNS||[];const a=n&&e.includes(n),i=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,n)=>{t=t||"",n=n||"";const s=ar.filter(e=>!t.includes(e)&&!n.includes(e));if(0===s.length)return!0;const r=ir.getRegExp(`(${s.map(e=>"?"===e?"\\?":e).join("|")})`);let a=!r.test(e);if(!a){const t=e.indexOf(n);t>0&&!r.test(e.substring(0,t))&&(a=!0)}return a})(e,n,s));if(a&&!i){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Ws(r)?[r]:r};const a=e.split(n);(n!==s||n===s&&this.options.ns.includes(a[0]))&&(r=a.shift()),e=a.join(s)}return{key:e,namespaces:Ws(r)?[r]:r}}translate(e,t,n){let s="object"==typeof t?{...t}:t;if("object"!=typeof s&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof s&&(s={...s}),s||(s={}),null==e)return"";"function"==typeof e&&(e=br(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(e=>"function"==typeof e?br(e,{...this.options,...s}):String(e));const r=void 0!==s.returnDetails?s.returnDetails:this.options.returnDetails,a=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,{key:i,namespaces:o}=this.extractFromKey(e[e.length-1],s),l=o[o.length-1];let c=void 0!==s.nsSeparator?s.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const d=s.lng||this.language,u=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===d?.toLowerCase())return u?r?{res:`${l}${c}${i}`,usedKey:i,exactUsedKey:i,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:`${l}${c}${i}`:r?{res:i,usedKey:i,exactUsedKey:i,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(s)}:i;const h=this.resolve(e,s);let p=h?.res;const m=h?.usedKey||i,f=h?.exactUsedKey||i,g=void 0!==s.joinArrays?s.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==s.count&&!Ws(s.count),y=yr.hasDefaultValue(s),w=v?this.pluralResolver.getSuffix(d,s.count,s):"",k=s.ordinal&&v?this.pluralResolver.getSuffix(d,s.count,{ordinal:!1}):"",N=v&&!s.ordinal&&0===s.count,x=N&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${w}`]||s[`defaultValue${k}`]||s.defaultValue;let S=p;b&&!p&&y&&(S=x);const j=vr(S),E=Object.prototype.toString.apply(S);if(!(b&&S&&j)||["[object Number]","[object Function]","[object RegExp]"].includes(E)||Ws(g)&&Array.isArray(S))if(b&&Ws(g)&&Array.isArray(p))p=p.join(g),p&&(p=this.extendTranslation(p,e,s,h,n));else{let t=!1,r=!1;!this.isValidLookup(p)&&y&&(t=!0,p=x),this.isValidLookup(p)||(r=!0,p=i);const o=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&r?void 0:p,u=y&&x!==p&&this.options.updateMissing;if(r||t||u){if(this.logger.log(u?"updateKey":"missingKey",d,l,v&&!u?`${i}${this.pluralResolver.getSuffix(d,s.count,s)}`:i,u?x:p),a){const e=this.resolve(i,{...s,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(s.lng||this.language):e.push(s.lng||this.language);const n=(e,t,n)=>{const r=y&&n!==p?n:o;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,u,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,u,s),this.emit("missingKey",e,l,t,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,s);N&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],i+t,s[`defaultValue${t}`]||x)})}):n(e,i,x))}p=this.extendTranslation(p,e,s,h,n),r&&p===i&&this.options.appendNamespaceToMissingKey&&(p=`${l}${c}${i}`),(r||t)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${i}`:i,t?p:void 0,s))}else{if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,S,{...s,ns:o}):`key '${i} (${this.language})' returned an object instead of string.`;return r?(h.res=e,h.usedParams=this.getUsedParamsDetails(s),h):e}if(a){const e=Array.isArray(S),t=e?[]:{},n=e?f:m;for(const e in S)if(Object.prototype.hasOwnProperty.call(S,e)){const r=`${n}${a}${e}`;t[e]=y&&!p?this.translate(r,{...s,defaultValue:vr(x)?x[e]:void 0,joinArrays:!1,ns:o}):this.translate(r,{...s,joinArrays:!1,ns:o}),t[e]===r&&(t[e]=S[e])}p=t}}return r?(h.res=p,h.usedParams=this.getUsedParamsDetails(s),h):p}extendTranslation(e,t,n,s,r){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const a=Ws(e)&&(void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let i;if(a){const t=e.match(this.interpolator.nestingRegexp);i=t&&t.length}let o=n.replace&&!Ws(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),e=this.interpolator.interpolate(e,o,n.lng||this.language||s.usedLng,n),a){const t=e.match(this.interpolator.nestingRegexp);i<(t&&t.length)&&(n.nest=!1)}!n.lng&&s&&s.res&&(n.lng=this.language||s.usedLng),!1!==n.nest&&(e=this.interpolator.nest(e,(...e)=>r?.[0]!==e[0]||n.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),n)),n.interpolation&&this.interpolator.reset()}const a=n.postProcess||this.options.postProcess,i=Ws(a)?[a]:a;return null!=e&&i?.length&&!1!==n.applyPostProcessor&&(e=fr.handle(i,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,s,r,a,i;return Ws(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>"function"==typeof e?br(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;const o=this.extractFromKey(e,t),l=o.key;s=l;let c=o.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const d=void 0!==t.count&&!Ws(t.count),u=d&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Ws(t.context)||"number"==typeof t.context)&&""!==t.context,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(n)||(i=e,this.checkedLoadedFor[`${p[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(i)||(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach(s=>{if(this.isValidLookup(n))return;a=s;const i=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,l,s,e,t);else{let e;d&&(e=this.pluralResolver.getSuffix(s,t.count,t));const n=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&e.startsWith(r)&&i.push(l+e.replace(r,this.options.pluralSeparator)),i.push(l+e),u&&i.push(l+n)),h){const s=`${l}${this.options.contextSeparator||"_"}${t.context}`;i.push(s),d&&(t.ordinal&&e.startsWith(r)&&i.push(s+e.replace(r,this.options.pluralSeparator)),i.push(s+e),u&&i.push(s+n))}}let o;for(;o=i.pop();)this.isValidLookup(n)||(r=o,n=this.getResource(s,e,o,t))}))})}),{res:n,usedKey:s,exactUsedKey:r,usedLng:a,usedNS:i}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,n,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!Ws(e.replace);let s=n?e.replace:e;if(n&&void 0!==e.count&&(s={...s,count:e.count}),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!n){s={...s};for(const e of t)delete s[e]}return s}static hasDefaultValue(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith("defaultValue")&&void 0!==e[t])return!0;return!1}}class wr{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ur.create("languageUtils"),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(!(e=lr(e))||!e.includes("-"))return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=lr(e))||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Ws(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const n=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(n)||(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;const s=this.getLanguagePartFromCode(e);if(this.isSupportedCode(s))return t=s;t=this.options.supportedLngs.find(e=>e===s||!(!e.includes("-")&&!s.includes("-"))&&!(!e.includes("-")||s.includes("-")||e.slice(0,e.indexOf("-"))!==s))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Ws(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){const n=this.options.fallbackLng,s=Array.isArray(n)?n.join("|"):n;s!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=s);const r=void 0===t||!1===t||Ws(t),a=void 0===t&&"function"==typeof this.options.fallbackLng;let i=null;if(Ws(e)&&r&&!a){let n;n=void 0===t?"undefined":!1===t?"boolean:false":`string:${t}`,i=`${e.length}:${e}|${n}`}if(null!==i){const e=this.resolveHierarchyCache[i];if(void 0!==e)return e.slice()}const o=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),l=[],c=e=>{e&&(this.isSupportedCode(e)?l.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Ws(e)&&(e.includes("-")||e.includes("_"))?("languageOnly"!==this.options.load&&c(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&c(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&c(this.getLanguagePartFromCode(e))):Ws(e)&&c(this.formatLanguageCode(e)),o.forEach(e=>{const t=this.formatLanguageCode(e);l.includes(t)||c(t)}),null!==i?(this.resolveHierarchyCache[i]=l,l.slice()):l}}const kr={zero:0,one:1,two:2,few:3,many:4,other:5},Nr={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class xr{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=ur.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const n=lr("dev"===e?"en":e),s=t.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:n,type:s});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let a;try{a=new Intl.PluralRules(n,{type:s})}catch(n){if("undefined"==typeof Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Nr;if(!e.match(/-|_/))return Nr;const s=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(s,t)}return this.pluralRulesCache[r]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule("dev",t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>kr[e]-kr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,n={}){const s=this.getRule(e,n);return s?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,n))}}const Sr=(e,t,n,s=".",r=!0)=>{let a=((e,t,n)=>{const s=er(e,n);return void 0!==s?s:er(t,n)})(e,t,n);return null==a&&r&&Ws(n)&&(a=or(e,n,s),void 0===a&&(a=or(t,n,s))),a};class jr{constructor(e={}){this.logger=ur.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:n,useRawValueToEscape:s,prefix:r,prefixEscaped:a,suffix:i,suffixEscaped:o,formatSeparator:l,unescapeSuffix:c,unescapePrefix:d,nestingPrefix:u,nestingPrefixEscaped:h,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:f,maxReplaces:g,alwaysFormat:b}=e.interpolation;this.escape=void 0!==t?t:rr,this.escapeValue=void 0===n||n,this.useRawValueToEscape=void 0!==s&&s,this.prefix=r?nr(r):a||"{{",this.suffix=i?nr(i):o||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":d?nr(d):"-",this.unescapeSuffix=this.unescapePrefix?"":c?nr(c):"",this.nestingPrefix=u?nr(u):h||nr("$t("),this.nestingSuffix=p?nr(p):m||nr(")"),this.nestingOptionsSeparator=f||",",this.maxReplaces=g||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']|"[^"]*"|'[^']*'|\\((?:[^()"']|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,s){let r,a,i;const o=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(!e.includes(this.formatSeparator)){const r=Sr(t,o,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,n,{...s,...t,interpolationkey:e}):r}const r=e.split(this.formatSeparator),a=r.shift().trim(),i=r.join(this.formatSeparator).trim();return this.format(Sr(t,o,a,this.options.keySeparator,this.options.ignoreJSONStructure),i,n,{...s,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&"string"==typeof e&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const c=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=void 0!==s?.interpolation?.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,u=[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}],h=[];let p=0;return u.forEach(t=>{for(i=0;r=t.regex.exec(e);){const n=r.index-p,o=h.find(([e,t])=>n>=e&&n<t);if(o){t.regex.lastIndex=o[1]+p;continue}const u=r[1].trim();if(a=l(u),void 0===a)if("function"==typeof c){const t=c(e,r,s);a=Ws(t)?t:""}else if(s&&Object.prototype.hasOwnProperty.call(s,u))a="";else{if(d){a=r[0];continue}this.logger.warn(`missed to pass in variable ${u} for interpolating ${e}`),a=""}else Ws(a)||this.useRawValueToEscape||(a=Js(a));const m=Js(t.safeValue(a));if(e=e.slice(0,r.index)+m+e.slice(r.index+r[0].length),d?(t.regex===this.regexpUnescape?h.push([r.index,r.index+m.length]):p+=m.length-r[0].length,t.regex.lastIndex+=m.length,t.regex.lastIndex-=r[0].length):t.regex.lastIndex=0,i++,i>=this.maxReplaces)break}}),e}nest(e,t,n={}){let s,r,a;const i=(e,t)=>{const n=this.nestingOptionsSeparator;if(!e.includes(n))return e;const s=e.split(new RegExp(`${nr(n)}[ ]*{`));let r=`{${s[1]}`;e=s[0],r=this.interpolate(r,a);const i=r.match(/'/g),o=r.match(/"/g);((i?.length??0)%2==0&&!o||(o?.length??0)%2!=0)&&(r=r.replace(/'/g,'"'));try{a=JSON.parse(r),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${r}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e},o=new RegExp(this.nestingRegexp);let l="",c=0;for(;s=o.exec(e);){let d=[];a={...n},a=a.replace&&!Ws(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;const u=/{.*}/s.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(-1!==u&&(d=s[1].slice(u).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),r=t(i.call(this,s[1].trim(),a),a),r&&s[0]===e&&!Ws(r))return r;Ws(r)||(r=Js(r)),r||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),r=""),d.length&&(r=d.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:s[1].trim()}),r.trim())),l+=e.slice(c,s.index)+Js(r),c=o.lastIndex,this.regexp.lastIndex=0}return c?l+e.slice(c):e}}const Er=e=>{const t={};return(n,s,r)=>{let a,i=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(i={...i,[r.interpolationkey]:void 0});try{a=s+JSON.stringify(i)}catch(t){return e(lr(s),r)(n)}let o=t[a];return o||(o=e(lr(s),r),t[a]=o),o(n)}},Cr=e=>(t,n,s)=>e(lr(n),s)(t);class Or{constructor(e={}){this.logger=ur.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const n=t.cacheInBuiltFormats?Er:Cr;this.formats={number:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{const n=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>n.format(e)}),datetime:n((e,t)=>{const n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{const n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||"day")}),list:n((e,t)=>{const n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Er(t)}format(e,t,n,s={}){if(!t)return e;if(null==e)return e;const r=t.split(this.formatSeparator),a=[];for(let e=0;e<r.length;e++){let t=r[e];for(;t.indexOf("(")>-1&&!t.includes(")")&&e+1<r.length;)t=`${t}${this.formatSeparator}${r[++e]}`;a.push(t)}return a.reduce((e,t)=>{const{formatName:r,formatOptions:a}=(e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const s=e.split("(");t=s[0].toLowerCase().trim();const r=s[1].slice(0,-1);"currency"!==t||r.includes(":")?"relativetime"!==t||r.includes(":")?r.split(";").forEach(e=>{if(e){const[t,...s]=e.split(":"),r=s.join(":").trim().replace(/^'+|'+$/g,""),a=t.trim();n[a]||(n[a]=r),"false"===r&&(n[a]=!1),"true"===r&&(n[a]=!0),isNaN(r)||(n[a]=parseInt(r,10))}}):n.range||(n.range=r.trim()):n.currency||(n.currency=r.trim())}return{formatName:t,formatOptions:n}})(t);if(this.formats[r]){let t=e;try{const i=s?.formatParams?.[s.interpolationkey]||{},o=i.locale||i.lng||s.locale||s.lng||n;t=this.formats[r](e,o,{...a,...s,...i})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e},e)}}class _r extends hr{constructor(e,t,n,s={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=s,this.logger=ur.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,s.backend,s)}queueLoad(e,t,n,s){const r={},a={},i={},o={};return e.forEach(e=>{let s=!0;t.forEach(t=>{const i=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[i]=2:this.state[i]<0||(1===this.state[i]?void 0===a[i]&&(a[i]=!0):(this.state[i]=1,s=!1,void 0===a[i]&&(a[i]=!0),void 0===r[i]&&(r[i]=!0),void 0===o[t]&&(o[t]=!0)))}),s||(i[e]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(i),toLoadNamespaces:Object.keys(o)}}loaded(e,t,n){const s=e.split("|"),r=s[0],a=s[1];t&&this.emit("failedLoading",r,a,t),!t&&n&&this.store.addResourceBundle(r,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);const i={};this.queue.forEach(n=>{((e,t,n)=>{const{obj:s,k:r}=Xs(e,t,Object);s[r]=s[r]||[],s[r].push(n)})(n.loaded,[r],a),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach(e=>{i[e]||(i[e]={});const t=n.loaded[e];t.length&&t.forEach(t=>{void 0===i[e][t]&&(i[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",i),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,s=0,r=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:s,wait:r,callback:a});this.readingCalls++;const i=(i,o)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}i&&o&&s<this.maxRetries?setTimeout(()=>{this.read(e,t,n,s+1,2*r,a)},r):a(i,o)},o=this.backend[n].bind(this.backend);if(2!==o.length)return o(e,t,i);try{const n=o(e,t);n&&"function"==typeof n.then?n.then(e=>i(null,e)).catch(i):i(null,n)}catch(e){i(e)}}prepareLoading(e,t,n={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();Ws(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Ws(t)&&(t=[t]);const r=this.queueLoad(e,t,n,s);if(!r.toLoad.length)return r.pending.length||s(),null;r.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=""){const n=e.split("|"),s=n[0],r=n[1];this.read(s,r,"read",void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${r} for language ${s} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${r} for language ${s}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,s,r,a={},i=()=>{}){if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=n&&""!==n){if(this.backend?.create){const o={...a,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;r=5===l.length?l(e,t,n,s,o):l(e,t,n,s),r&&"function"==typeof r.then?r.then(e=>i(null,e)).catch(i):i(null,r)}catch(e){i(e)}else l(e,t,n,s,i,o)}e&&e[0]&&this.store.addResource(e[0],t,n,s)}}else this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const Ir=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Ws(e[1])&&(t.defaultValue=e[1]),Ws(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Tr=e=>(Ws(e.ns)&&(e.ns=[e.ns]),Ws(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Ws(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Ar=()=>{};class Pr extends hr{constructor(e={},t){var n;if(super(),this.options=Tr(e),this.services={},this.logger=ur,this.modules={external:[]},n=this,Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(e=>{"function"==typeof n[e]&&(n[e]=n[e].bind(n))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Ws(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const n=Ir();this.options={...n,...this.options,...Tr(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);const s=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?ur.init(s(this.modules.logger),this.options):ur.init(null,this.options),e=this.modules.formatter?this.modules.formatter:Or;const t=new wr(this.options);this.store=new mr(this.options.resources,this.options);const n=this.services;n.logger=ur,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new xr(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=s(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new jr(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new _r(s(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=s(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=s(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new yr(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=Ar),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const r=Ks(),a=()=>{const e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),r.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),r}loadResources(e,t=Ar){let n=t;const s=Ws(e)?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===s?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return n();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&(e.includes(t)||e.push(t))})};if(s)t(s);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){const s=Ks();return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=Ar),this.services.backendConnector.reload(e,t,e=>{s.resolve(),n(e)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&fr.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!["cimode","dev"].includes(e)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!["cimode","dev"].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}this.resolvedLanguage||this.languages.includes(e)||!this.store.hasLanguageSomeTranslations(e)||(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const n=Ks();this.emit("languageChanging",e);const s=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},r=(r,a)=>{a?this.isLanguageChangingTo===e&&(s(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit("languageChanged",a),this.logger.log("languageChanged",a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(r,(...e)=>this.t(...e))},a=t=>{e||t||!this.services.languageDetector||(t=[]);const n=Ws(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(Ws(t)?[t]:t);a&&(this.language||s(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{r(e,a)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e):a(this.services.languageDetector.detect()),n}getFixedT(e,t,n,s){const r=s?.scopeNs,a=(e,t,...s)=>{let i;i="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(s)):{...t},i.lng=i.lng||a.lng,i.lngs=i.lngs||a.lngs;const o=void 0!==i.ns&&null!==i.ns;i.ns=i.ns||a.ns,""!==i.keyPrefix&&(i.keyPrefix=i.keyPrefix||n||a.keyPrefix);const l={...this.options,...i};Array.isArray(r)&&!o&&(l.ns=r),"function"==typeof i.keyPrefix&&(i.keyPrefix=br(i.keyPrefix,l));const c=this.options.keySeparator||".";let d;return i.keyPrefix&&Array.isArray(e)?d=e.map(e=>("function"==typeof e&&(e=br(e,l)),`${i.keyPrefix}${c}${e}`)):("function"==typeof e&&(e=br(e,l)),d=i.keyPrefix?`${i.keyPrefix}${c}${e}`:e),this.t(d,i)};return Ws(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=t.lng||this.resolvedLanguage||this.languages[0],s=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;const a=(e,t)=>{const n=this.services.backendConnector.state[`${e}|${t}`];return-1===n||0===n||2===n};if(t.precheck){const e=t.precheck(this,a);if(void 0!==e)return e}if(this.hasResourceBundle(n,e))return!0;if(!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages)return!0;const{languageUtils:i}=this.services,o=t.lng?i.isSupportedCode(n)&&i.toResolveHierarchy(n,!1)[0]:n;return!(o&&!a(o,e)||s&&!a(r,e))}loadNamespaces(e,t){const n=Ks();return this.options.ns?(Ws(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){const n=Ks();Ws(e)&&(e=[e]);const s=this.options.preload||[],r=e.filter(e=>!s.includes(e)&&this.services.languageUtils.isSupportedCode(e));return r.length?(this.options.preload=s.concat(r),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=this.services?.languageUtils||new wr(Ir());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].includes(t.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const n=new Pr(e,t);return n.createInstance=Pr.createInstance,n}cloneInstance(e={},t=Ar){const n=e.forkResourceStore;n&&delete(e={...e}).forkResourceStore;const s={...this.options,preload:!1,...e,isClone:!0},r=new Pr(s);void 0===e.debug&&void 0===e.prefix||(r.logger=r.logger.clone(e));if(["store","services","language"].forEach(e=>{r[e]=this[e]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},n){const e=t=>{const n=Array.isArray(t)?[...t]:{...t};return Object.keys(n).forEach(t=>{n[t]&&"object"==typeof n[t]&&(n[t]=e(n[t]))}),n},t=e(this.store.data);r.store=new mr(t,s),r.services.resourceStore=r.store}if(e.interpolation){const t={...Ir().interpolation,...this.options.interpolation,...e.interpolation},n={...s,interpolation:t};r.services.interpolator=new jr(n)}return r.translator=new yr(r.services,s),r.translator.on("*",(e,...t)=>{r.emit(e,...t)}),r.init(s,t),r.translator.options=s,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const zr=Pr.createInstance(),Lr=zr.createInstance;zr.dir,zr.init,zr.loadResources,zr.reloadResources,zr.use,zr.changeLanguage,zr.getFixedT,zr.t,zr.exists,zr.setDefaultNamespace,zr.hasLoadedNamespace,zr.loadNamespaces,zr.loadLanguages;const Rr={locales:[U.ES,U.EN],namespaces:["translation"]};const Mr=Lr();!async function(e){await e.init({supportedLngs:Rr.locales,defaultNS:Rr.namespaces[0],fallbackNS:Rr.namespaces[0],ns:Rr.namespaces,preload:Rr.locales,keySeparator:!1,interpolation:{escapeValue:!1}},e=>{if(e)return console.error("error on initI18next",e)})}(Mr);const $r=zs(e=>({i18n:Mr,changeLanguage:async t=>{Mr.language!==t&&(await Mr.changeLanguage(t),e({i18n:{...Mr,t:(...e)=>Mr.t(...e)}}))},loadResources:async(t="translation")=>{try{const[n,s]=await Promise.all([Gn(ps.API_V2.locale.get({params:{locale:U.EN,namespace:t}}).url),Gn(ps.API_V2.locale.get({params:{locale:U.ES,namespace:t}}).url)]),r=Mr.getResourceBundle(U.EN,t),a=Mr.getResourceBundle(U.ES,t),i=JSON.stringify(r)!==n,o=JSON.stringify(a)!==s;i&&Mr.addResourceBundle(U.EN,t,JSON.parse(n)),o&&Mr.addResourceBundle(U.ES,t,JSON.parse(s)),(i||o)&&e({i18n:{...Mr,t:(...e)=>Mr.t(...e)}})}catch(e){console.error("error on load resources",{error:e})}}}));function Fr({className:e="",children:n,style:s}){const r=$r(e=>e.i18n.t);return t("span",{className:e,style:s,children:r(n)})}function Dr(s){const{date:r,className:a,show:i="year-month-day-hours-minutes-seconds",twoLines:o,withDayName:l,style:c}=s,{showYears:d,showMonths:u,showDays:h,showHours:p,showMinutes:m,showSeconds:f,showMilliseconds:g}=qn(i);return e("div",{className:A("date-literal jk-br-ie",{"jk-row gap nowrap center":!o,"jk-col nowrap center":!!o},a),style:c,children:[e("div",{children:[l&&e(n,{children:[t(Fr,{children:B[r.getDay()]??r.getDay().toString()}),", "]}),h&&e(n,{children:[r.getDate()," "]}),u&&e(n,{children:[t(Fr,{children:Z[r.getMonth()]??r.getMonth().toString()})," "]}),d&&r.getFullYear()]}),p&&e("div",{className:"cr-tx-sc",children:[H(r.getHours(),2),m&&e(n,{children:[":",H(r.getMinutes(),2)]}),f&&e(n,{children:[":",H(r.getSeconds(),2)]}),g&&e(n,{children:[".",H(r.getMilliseconds(),3)]})]})]})}const Vr=zs((e,t)=>({frames:{},framePending:!1,addFrame:n=>{const s={...t().frames,[n]:(t().frames[n]??0)+1};e({frames:s,framePending:!0})},subFrame:n=>{const s=t().frames,r=s[n];if("number"==typeof r)if(r<=1){const{[n]:t,...r}=s;e({frames:r,framePending:Object.values(r).length>0})}else e({frames:{...t().frames,[n]:(t().frames[n]??0)-1}})}}));function Ur({name:e=""}){const t=l(e+W()),n=Vr(e=>e.addFrame),s=Vr(e=>e.subFrame);return o(()=>{n(t.current),requestAnimationFrame(()=>{s(t.current)})}),null}const Br=a(function(e,n){const{onClick:s,children:r,className:a,transition:l,onKeyDownClick:c,...d}=e,[u,h]=i(!1);o(()=>{l&&h(!0)},[l]);const p={...d};return c&&(p.tabIndex=0),t("div",{ref:n,...p,onKeyDown:e=>{s&&(!0===c&&"Enter"===e.code||e.code===c)&&(e.preventDefault(),e.stopPropagation(),s())},onClick:s,className:A(a,{"jk-transition":!!l,"jk-transition-open":u}),children:r})});const Zr=a(function(e,n){const{className:s,onChange:r,onBlur:a,type:i="text",value:l,register:c,disabled:d=!1,size:u,autoFocus:h=!1,required:p=!1,inputId:m,onClick:f,onFocus:g,onKeyDown:b,onEnter:v,...y}=e,{onChange:w,onBlur:k,ref:N,...x}=c?"function"==typeof c?c(e=>"number"===i?+e:e):c:{};o(()=>{h&&setTimeout(()=>n?.current?.focus(),10)},[h,N,n]);const S=Math.max((""+(l||"")).length,3);return t("input",{...y,...x,onWheel:e=>{"number"===e.currentTarget?.type&&"undefined"!=typeof document&&document.activeElement===e.currentTarget&&e.currentTarget?.blur()},onClick:e=>{f?.(e)},onFocus:e=>{e.currentTarget?.select(),g?.()},id:`input-${m}`,autoComplete:y.name,required:p,ref:N||n,type:"files"===i?"file":i,value:"file"===i||"files"===i?void 0:l,size:"auto"===u?S:u,disabled:d,className:A(s,`jk-input-${i} jk-br-ie`,{disabled:d}),onChange:w||("file"===i||"files"===i?e=>r?.(e.target.files,e):e=>{const t=e.target.value,n="number"===i?+t:t;r?.(n,e)}),onBlur:k||a,style:"auto"===u&&"number"===i?{width:`${S+1}em`}:{},multiple:"files"===i,onKeyDown:e=>{"Enter"===e.key&&v?.(e),b?.(e)}})});const Hr=a(function(s,r){const{type:a="text",expand:i=!1,label:o,icon:l,labelPlacement:d="top-border",required:u=!1,className:h,inputClassName:p,labelClassName:m,children:f,...g}=s,b=c();return e("div",{className:A(`jk-wrapper-input jk-wrapper-input-${a}`,h,{expand:i,[`label-${d}`]:!0,required:u,"no-label":!o}),children:[f,t(Zr,{...g,className:p,inputId:b,type:a,required:u,ref:r}),e("label",{htmlFor:`input-${b}`,className:m,children:[o,"left"===d?t(n,{children:": "}):""]}),l]})});function Wr({className:n,checked:s,disabled:r,onChange:a,label:i,size:o="regular",...l}){const c=r||!a;return e("label",{className:A("jk-wrapper-input jk-wrapper-input-checkbox jk-row nowrap left jk-br-ie",n),children:[t("input",{type:"checkbox",className:A("jk-input-checkbox jk-br-ie",o,{disabled:c}),onChange:c?void 0:({target:{checked:e}})=>a?.(e),checked:s,disabled:c,...l}),i]})}function Kr({onChange:e,register:n,...s}){const[r,a]=i("password");return t(Hr,{type:r,onChange:(t,n)=>e?.(t,n),register:n,icon:"password"===r?t(wt,{onClick:()=>a("text")}):t(kt,{onClick:()=>a("password")}),...s})}function Jr({className:n,checked:s,disabled:r,onChange:a,label:i,size:o,...l}){const c=r||!a;return e("label",{className:A("jk-wrapper-input jk-wrapper-input-radio jk-row gap",n,{disabled:c}),children:[t("input",{type:"radio",className:A("jk-input-radio",o,{disabled:c}),onChange:c?void 0:({target:{checked:e}})=>{a?.(e)},checked:s,disabled:c,...l}),i]})}function Gr(e,t,{signal:n,edges:s}={}){let r,a=null;const i=null!=s&&s.includes("leading"),o=null==s||s.includes("trailing"),l=()=>{null!==a&&(e.apply(r,a),r=void 0,a=null)};let c=null;const d=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,o&&l(),u()},t)},u=()=>{null!==c&&(clearTimeout(c),c=null),r=void 0,a=null},h=function(...e){if(n?.aborted)return;r=this,a=e;const t=null==c;d(),i&&t&&l()};return h.schedule=d,h.cancel=u,h.flush=()=>{l()},n?.addEventListener("abort",u,{once:!0}),h}function qr(e,t=0,n={}){"object"!=typeof n&&(n={});const{leading:s=!1,trailing:r=!0,maxWait:a}=n,i=Array(2);let o;s&&(i[0]="leading"),r&&(i[1]="trailing");let l=null;const c=Gr(function(...t){o=e.apply(this,t),l=null},t,{edges:i}),d=function(...t){return null!=a&&(null===l&&(l=Date.now()),Date.now()-l>=a)?(o=e.apply(this,t),l=Date.now(),c.cancel(),c.schedule(),o):(c.apply(this,t),o)};return d.cancel=c.cancel,d.flush=()=>(c.flush(),o),d}const Yr=(e,t,n,s)=>{switch(t){case"debounce":return qr(e,n,s);case"throttle":return function(e,t=0,n={}){const{leading:s=!0,trailing:r=!0}=n;return qr(e,t,{leading:s,maxWait:t,trailing:r})}(e,n,s);default:return e}};function Xr({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:r,handleWidth:a=!0,handleHeight:c=!0,targetRef:u,observerOptions:h,onResize:p,disableRerender:m=!1}={}){const f=l(e),g=(e=>{const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)},[])})(p),[b,v]=i({width:void 0,height:void 0}),y=l({width:void 0,height:void 0}),{refProxy:w,refElement:k}=(e=>{const[t,n]=s.useState((null==e?void 0:e.current)||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:s.useMemo(()=>new Proxy(e=>{e!==t&&n(e)},{get:(e,n)=>"current"===n?t:e[n],set:(e,t,s)=>("current"===t?n(s):e[t]=s,!0)}),[t]),refElement:t,setRefElement:n}})(u),{box:N}=h||{},x=d(e=>{if(!a&&!c)return;if(f.current)return void(f.current=!1);const t=(e,t)=>a&&e.width!==t.width||c&&e.height!==t.height;e.forEach(e=>{const n=((e,t)=>{var n,s;const r=null===(n=e.borderBoxSize)||void 0===n?void 0:n[0],a=null===(s=e.contentBoxSize)||void 0===s?void 0:s[0];return"border-box"===t&&r?{width:r.inlineSize,height:r.blockSize}:"content-box"===t&&a?{width:a.inlineSize,height:a.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}})(e,N);m?t(y.current,n)&&(y.current.width=n.width,y.current.height=n.height,null==g||g({width:n.width,height:n.height,entry:e})):v(s=>t(s,n)?(null==g||g({width:n.width,height:n.height,entry:e}),n):s)})},[a,c,f,N,m]),S=d(Yr(x,t,n,r),[x,t,n,r]);return o(()=>{let e;if(k)try{e=new window.ResizeObserver(S),e.observe(k,h)}catch(e){console.warn("ResizeObserver not supported or failed to initialize:",e)}else(b.width||b.height)&&(null==g||g({width:null,height:null,entry:null}),y.current.width=void 0,y.current.height=void 0,m||v({width:void 0,height:void 0}));return()=>{var t,n,s;null===(t=null==e?void 0:e.disconnect)||void 0===t||t.call(e),null===(s=(n=S).cancel)||void 0===s||s.call(n)}},[S,k]),Object.assign({ref:w},m?y.current:b)}const Qr=()=>import("./Popover-C0pozkRR.js"),ea=u(()=>Qr()),ta=e=>t(h,{fallback:t(bt,{}),children:t(ea,{...e})}),na={"top-start":t(jt,{className:"input-icon"}),top:t(jt,{className:"input-icon"}),"top-end":t(jt,{className:"input-icon"}),"right-start":t(St,{className:"input-icon"}),right:t(St,{className:"input-icon"}),"right-end":t(St,{className:"input-icon"}),"bottom-end":t(xt,{className:"input-icon"}),bottom:t(xt,{className:"input-icon"}),"bottom-start":t(xt,{className:"input-icon"}),"left-start":t(Nt,{className:"input-icon"}),left:t(Nt,{className:"input-icon"}),"left-end":t(Nt,{className:"input-icon"})};function sa(n){const{className:s,popoverClassName:r,options:a,selectedOption:c,onChange:d,disabled:u=!1,optionsPlacement:h="bottom",expand:m=!1,children:f,style:g}=n,{width:b=0,ref:v}=Xr(),{width:y=0,ref:w}=Xr(),k=`calc(var(--gap) * 2 + ${y}px + var(--tx-h-m))`,[N,x]=i(!1),S=l(null),{optionIndex:j,optionSelected:C,optionsWithKey:O}=p(()=>{const e=[],t=c?.key??JSON.stringify(c.value);let n=-1,s=0;for(const r of a){const a="key"in r?r.key:JSON.stringify(r.value);a===t&&(n=s),e.push({...r,key:a}),s++}return{optionIndex:n,optionSelected:{key:t,value:c.value,label:c.label||a[n]?.label,inputLabel:c.inputLabel||a[n]?.inputLabel},optionsWithKey:e}},[c.value,c.label,c.inputLabel,c.key,a]);o(()=>{const e=setTimeout(()=>{N&&(_.current?.scrollHeight||0)>(_.current?.clientHeight||0)&&S.current?.scrollIntoView({behavior:"smooth",block:"center"})},150);return()=>{clearTimeout(e)}},[N,j]);const _=l(null),I=u||!d,T=na[h];return t(ta,{triggerOn:E.CLICK,placement:h,popoverClassName:A("jk-select-options-content bc-sf-hi jk-br-ie elevation-1",r),offset:4,open:N,onOpenChange:x,content:t("div",{ref:e=>{_.current=e},role:"listbox","aria-label":"Select options",className:A("jk-select-options jk-col stretch nowrap wh-100 pn-re ow-ao",{disabled:I}),style:{width:"number"==typeof g?.width||m?b:k},children:O.map((e,n)=>{const s=j===n,r=!!e.disabled||I,a=()=>{d?.(e),x(!1)},i=I||e.disabled?void 0:e=>{e.stopPropagation(),a()},o=I||e.disabled?void 0:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())};return t("div",{className:A("jk-select-option ws-np",{selected:s,disabled:r}),role:"option","aria-selected":s,"aria-disabled":r,tabIndex:r?-1:0,onClick:i,onKeyDown:o,ref:e=>{s&&(S.current=e)},children:Yn(e.label)},e.key)})}),children:e("div",{className:A("jk-select-layout",s,h,{open:N,disabled:I}),style:{width:m?"100%":"auto"===g?.width?void 0:k,height:"fit-content"},onClick:()=>x(!N),children:[t("div",{ref:w,className:"jk-select-options fake jk-col stretch nowrap wh-100 pn-re ow-ao",style:{position:"fixed",width:"auto",pointerEvents:"none",opacity:0,top:0,left:0},children:O.map((e,n)=>t("div",{className:A("jk-select-option ws-np",{selected:j===n,disabled:!!e.disabled||I}),children:Yn(e.label)},e.key))}),t("div",{className:"jk-select-container",ref:v,style:{width:m?"100%":"auto"===g?.width?void 0:k,...g},children:f?Xn(f,{options:a,isOpen:N,disabled:I,optionSelected:C,expandIcon:T}):e("div",{className:A({open:N},"jk-input-select space-between jk-br-ie jk-row gap nowrap"),children:[e("div",{className:"jk-row left gap nowrap",children:[t("span",{className:"fake-gap"}),C.inputLabel?Yn(C.inputLabel):Yn(C.label)]}),T]})})]})})}function ra(s){const{expand:r=!1,labelPlacement:a="top-border",required:o=!1,label:l,onChange:d,register:u,selectedOption:h,...p}=s,{setValue:m,...f}=u||{},[g,b]=i(""),v=d||(({value:e})=>{b(e),"name"in f&&m?.(f?.name,e,{shouldTouch:!0})}),y=c();return e("div",{className:A("jk-wrapper-input jk-wrapper-input-select",{expand:r,[`label-${a}`]:!0,required:o,"no-label":!l}),children:[u&&t("input",{...f,ref:e=>{"ref"in f&&f?.ref?.(e)},value:g,style:{display:"none"}}),t(sa,{...p,onChange:v,selectedOption:h||{value:g,label:g?void 0:t(Fr,{className:"tt-se",children:"select an option"})}}),e("label",{htmlFor:`input-${y}`,children:[l,"left"===a?t(n,{children:": "}):""]})]})}const aa=a(function(e,n){const{value:s,onChange:r,style:a,className:i,register:o,onBlur:l,disabled:c,rows:d,onCtrlClick:u,onCtrlEnter:h,...p}=e,{onChange:m,onBlur:f,ref:g,...b}=o||{};return t("textarea",{...p,...b,ref:g??n,className:A("jk-pg-sm jk-input-textarea jk-br-ie wh-100",i,{disabled:!!c}),value:s,onChange:m||(({target:e})=>{const t=e.selectionStart,n=e;P()&&window.requestAnimationFrame?.(()=>{n.selectionStart=t,n.selectionEnd=t}),r?.(e.value)}),onBlur:f||l,onClick:u?e=>{(e.ctrlKey||e.metaKey)&&u()}:void 0,onKeyDown:h?e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&h()}:void 0,disabled:c,rows:d??Math.max((s||"").split("\n").length,2),style:a})});function ia(s){const{className:r,expand:a=!1,labelPlacement:i="top-border",required:o=!1,label:l,register:d,...u}=s,h=c();return e("div",{className:A("jk-wrapper-input jk-wrapper-input-text-area",r,{expand:a,[`label-${i}`]:!0,required:o,"no-label":!l}),children:[t(aa,{...u,register:d?"function"==typeof d?d(e=>e):d:void 0}),e("label",{htmlFor:`input-${h}`,children:[l,"left"===i?t(n,{children:": "}):""]})]})}function oa(n){const{className:s,checked:r,onChange:a,type:i="rounded",leftLabel:o,rightLabel:l,size:c="regular",disabled:d=!1,...u}=n,h=d||!a,p=e=>t=>{h||a?.(e),t.preventDefault()};return e("label",{className:A("jk-wrapper-input-toggle",i,s,c,{disabled:h}),...u,children:[t("div",{className:"jk-row",onClick:p(!1),children:o}),t("input",{className:"jk-input-toggle",type:"checkbox",checked:r,onChange:({target:{checked:e}})=>h?null:a?.(e)}),t("span",{className:"jk-input-toggle-slider",style:{marginLeft:o?"calc(var(--pad-xt) / 2)":void 0,marginRight:l?"calc(var(--pad-xt) / 2)":void 0}}),t("div",{className:"jk-row",onClick:p(!0),children:l})]})}const la=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function ca(e,t){const n=e.current;o(()=>{if(!t||!n)return;const e=e=>{if("Tab"!==e.key)return;const t=Array.from(n.querySelectorAll(la));if(0===t.length)return void e.preventDefault();const s=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===s&&(e.preventDefault(),r?.focus()):document.activeElement===r&&(e.preventDefault(),s?.focus())};return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}},[n,t])}function da(e,t,n,s){const r=l(e);return r.current=e,o(()=>{n?.(e=>{t("function"==typeof e?e(r.current):e)})},[n,t]),o(()=>{s?.(e)},[s,e]),r}const ua=e=>{const t=l(e);return t.current=e,t},ha=({src:e,className:n,alt:s,style:r,width:a,height:i,fill:o})=>t("img",o?{src:e,className:n,alt:s,width:"100%",height:"100%",style:{objectFit:"contain",...r}}:{src:e,className:n,alt:s,width:a,height:i,style:{...r,width:a,height:i}}),pa=e=>{const{href:n,children:s,className:r,style:a,target:i,rel:o}=e;let l;return l="string"==typeof n?n:n.href||n.pathname+"?"+n.query||"",t("a",{href:l,className:r,style:a,target:i,rel:o,children:s})},ma=zs(e=>({jukiAppDivRef:{current:null},components:{Image:ha,Link:pa,loaded:!1},setProps:t=>{e(t)}}));function fa({children:e}){const t=ma(e=>e.jukiAppDivRef).current||document.body;return ws.createPortal(e,t)}function ga(n){const{onClose:s,isOpen:r,className:a,containerClassName:c,children:u,closeIcon:h=!1,expand:p=!1,closeOnClickOverlay:m=!0,closeOnKeyEscape:f=!0,ariaLabelledBy:g,ariaDescribedBy:b,setLoaderStatusRef:v,onLoaderStatusChange:y}=n,[w,k]=i(K.NONE),N=da(w,k,v,y),x=ua(s),S=l(null),j=l(null);ca(S,r);const E=d(e=>{k("function"==typeof e?e(N.current):e)},[N]);o(()=>(r?(j.current=document.activeElement,setTimeout(()=>{S.current?.focus()},100)):j.current?.focus(),()=>{}),[r]),o(()=>{if(!r||!f)return;const e=e=>{"Escape"===e.key&&x.current?.(E,w,{onKeyDownEvent:e})};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[w,E,f,r,x]);const C=d(e=>{m&&x.current?.(E,w,{overlayOnClickEvent:e})},[m,w,x,E]),O=d(e=>{w!==K.LOADING&&x.current?.(E,w,{closeButtonOnClickEvent:e})},[w,x,E]);return t(fa,{children:t(bs,{children:r&&e("div",{className:A("jk-modal-container",c,{expand:p}),role:"dialog","aria-modal":"true","aria-labelledby":g,"aria-describedby":b,children:[t(vs.div,{className:"jk-modal-overlay jk-overlay jk-overlay-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:C}),e(vs.div,{ref:S,tabIndex:-1,className:A("jk-modal-content jk-br elevation-3",a),initial:{scale:.6,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.6,opacity:0},children:[h&&t("div",{className:"jk-modal-close-button wh-100",children:t("button",{type:"button",className:"jk-button bc-sf-hi only-icon jk-br-ie","aria-label":"Close modal",disabled:w===K.LOADING,onClick:O,children:w===K.LOADING?t(bt,{"aria-hidden":"true"}):t(Et,{"aria-hidden":"true"})})}),u]},"modal-content")]})})})}function ba(s){const{className:r,options:a,selectedOptions:c,onChange:d,disabled:u=!1,optionsPlacement:h="bottom",expand:p=!1,children:m,containerWidth:f}=s,{width:g,ref:b}=Xr(),[v,y]=i(!1),w=l(null),k=l(null);o(()=>{const e=setTimeout(()=>{v&&(k.current?.scrollHeight||0)>(k.current?.clientHeight||0)&&w.current?.scrollIntoView({behavior:"smooth",block:"center"})},100);return()=>{clearTimeout(e)}},[v]);const N=c.map(e=>{const t=a.find(t=>JSON.stringify(t.value)===JSON.stringify(e.value));return{value:e.value,label:e.label||t?.label||"",inputLabel:e.inputLabel||t?.inputLabel||""}}),x=Math.max(...[...a,...N].map(({label:e})=>z(e).length)),S=u||!d,j=17*x+35;return t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",placement:h,triggerOn:E.CLICK,offset:4,onOpenChange:y,content:t("div",{ref:k,className:A("jk-select-options jk-pg-xsm-tb ow-ao",{disabled:S}),style:{width:"child"===f?"auto":p?(g||0)+8+4-2:j-2},children:a.map(e=>{const n=N.some(t=>JSON.stringify(e.value)===JSON.stringify(t.value)),s=!!e.disabled;return t("div",{className:A("jk-select-option jk-row left multiselect",{selected:n,disabled:S||s}),ref:e=>{n&&(w.current=e)},children:t(Wr,{checked:n,onChange:S||e.disabled?void 0:()=>{d?.(n?N.filter(t=>JSON.stringify(e.value)!==JSON.stringify(t.value)):[...N,e],e)},disabled:S||s,label:Yn(e.label),className:"wh-100"})},JSON.stringify(e.value))})}),children:t("div",{className:A("jk-multi-select-layout",r,{open:v,disabled:S}),style:{width:"child"===f?"auto":p?"100%":`${j}px`},children:m||t(n,{children:e("div",{className:A({open:v},"jk-input-select jk-br-ie jk-row space-between nowrap"),ref:b,children:[t("div",{className:"jk-row left jk-multi-select-selected-options jk-pg-xsm",children:N.map(n=>e("div",{className:"jk-tag bc-ht-lt jk-row nowrap",children:[Yn(n?.inputLabel?n.inputLabel:n.label),!S&&t(Et,{size:"small",filledCircle:!0,onClick:e=>{d(N.filter(e=>JSON.stringify(n.value)!==JSON.stringify(e.value)),n),e.stopPropagation()},className:"cr-hd"})]},JSON.stringify(n.value)))}),e("div",{className:"jk-row nowrap jk-multi-select-selected-icons",children:[!S&&t(Et,{className:"input-icon",onClick:e=>{d([],void 0),e.stopPropagation()}}),t(Ct,{className:"input-icon"})]})]})})})})}const va=()=>import("./Collapse-Cx9QTKZD.js"),ya=u(()=>va()),wa=e=>t(h,{fallback:t(bt,{}),children:t(ya,{...e})}),ka=()=>import("./InputCellPhoneNumber-BaFBGcAe.js"),Na=u(()=>ka()),xa=e=>t(h,{fallback:t(bt,{}),children:t(Na,{...e})}),Sa=()=>import("./Tooltip-OI-qyixa.js"),ja=u(()=>Sa()),Ea=()=>t(h,{fallback:t(bt,{}),children:t(ja,{})}),Ca=()=>import("./VirtualizedRowsFixed-DH6WrMq1.js"),Oa=u(()=>Ca()),_a=e=>t(h,{fallback:t(bt,{}),children:t(Oa,{...e})});function Ia(){return t("div",{className:"expand-absolute pe-ne jk-col bc-tx-ht",children:e("h1",{className:"jk-row cr-tx-ht-it",style:{alignItems:"baseline"},children:[t(Fr,{className:"tt-se",children:"loading application"})," ",t("div",{className:"dot-flashing",style:{"--dot-flashing-color":"var(--cr-tx-ht-it)","--dot-flashing-color-light":"var(--cr-tx-ht-lt)","--dot-flashing-size":"10px"}})]})})}const Ta=({onOverflow:e,unOverflow:t,trigger:n,targetRef:s})=>{const{width:r=0}=Xr({targetRef:s,...ut}),a=l(0);o(()=>{const n=setTimeout(()=>{r&&s.current&&(L(s)?(a.current=s.current?.clientWidth,e()):s.current?.scrollWidth===s.current?.clientWidth&&s.current?.clientWidth>a.current&&t())},0);return()=>clearTimeout(n)},[r,e,t,n,s])};function Aa(){const s=Ds(e=>e.viewPort.isLargeScreen||e.viewPort.isHugeScreen),{Link:r}=ma(e=>e.components);return e(r,{href:"/",className:"link jk-row",children:[t(Ot,{size:"small"}),s&&e(n,{children:[" ",t(Fr,{className:"tt-se",children:"home"})]})]},"home")}function Pa({breadcrumbs:s,withoutHomeLink:r}){const a=p(()=>{const e=[...s];return r||e.unshift(t(Aa,{},"home")),e},[s,r]),o=a.length,[c,u]=i(0),h=!!c,g=h?a.slice(0,1):a,b=h?a.slice(1,1+c):[],v=h?a.slice(-(o-c-1)):[],y=l(null),w=d(()=>u(e=>Math.min(e+1,o)),[o]),k=d(()=>u(e=>Math.max(e-1,0)),[]),N=p(()=>[a,c],[a,c]);return Ta({targetRef:y,unOverflow:k,onOverflow:w,trigger:N}),e("div",{className:"jk-row nowrap left extend jk-breadcrumb",ref:y,style:{overflow:"auto"},children:[m.toArray(g.map((n,s)=>e(f,{children:[!!s&&t(_t,{className:"cr-tx-ds"}),t("div",{className:"jk-br-ie",children:n})]},s))),!!b.length&&e(n,{children:[t(_t,{className:"cr-tx-ds"}),t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:t("div",{className:"jk-pg-xsm",children:m.toArray(b.map((e,n)=>t("div",{children:e},n)))}),triggerOn:E.CLICK,placement:"bottom",children:t("div",{className:"link",children:"..."})})]}),m.toArray(v.map((n,s)=>e(f,{children:[t(_t,{className:"cr-tx-ds"}),t("div",{className:"jk-br-ie",children:n})]},s)))]})}function za(e){const{className:n="",onClick:s,children:r,setLoaderStatusRef:a,disabled:c,icon:d,...u}=e,[h,p]=i(K.NONE);da(h,p,a);const m=l(null);return o(()=>(h!==K.SUCCESS&&h!==K.ERROR||(m.current=setTimeout(()=>p(K.NONE),1200)),()=>{m.current&&clearTimeout(m.current)}),[h]),t(Bs,{className:A(n,"jk-button-loader",{"with-loader-icon":h!==K.NONE,success:h===K.SUCCESS,error:h===K.ERROR,loading:h===K.LOADING,"only-icon":(void 0===r||!1===r)&&!!d}),onClick:e=>s?.(e=>{p("function"==typeof e?e(h):e)},h,e),disabled:c||h!==K.NONE,icon:h===K.ERROR?t(It,{}):h===K.SUCCESS?t(Tt,{}):h===K.LOADING?t(bt,{}):d,...u,children:r})}function La(e){const{children:n,icon:s,type:r="primary",buttons:a=[],placement:i="left-start",offset:o=4,disabled:c,size:d="regular",className:u,popoverClassName:h,...p}=e,m=Ds(e=>e.viewPort.isSmallScreen),f=l(null),b=t("div",{className:A("button-action jk-row",u,i),children:n??t(za,{...p,icon:s,type:r,size:d,setLoaderStatusRef:e=>f.current=e,disabled:c})});return 0===a.length?b:t(ta,{triggerOn:m?E.CLICK:E.HOVER,placement:i,popoverClassName:h,offset:o,content:t("div",{className:"jk-col gap stretch nowrap",children:a.map(({icon:e,onClick:t,label:n,disabled:s,size:r="regular",type:a="primary",children:i,...o},l)=>i??g(za,{...o,key:l,type:a,icon:e,size:r,disabled:s,onClick:async e=>{const n=t?.();n instanceof Promise&&(e(K.LOADING),f.current?.(K.LOADING),n.then?.(()=>{e(K.SUCCESS),f.current?.(K.SUCCESS)}).catch(()=>{e(K.ERROR),f.current?.(K.ERROR)}))}},n))}),children:b})}function Ra({selectedOptions:e,options:n,onSelectOptions:s}){return t("div",{className:"jk-checkbox-list jk-col stretch",children:n.map(({value:n,label:r},a)=>t(Wr,{onChange:()=>{e.find(e=>e.value===n)?s(e.filter(e=>JSON.stringify(e.value)!==JSON.stringify(n))):s([...e,{value:n,label:r}])},checked:!!e.find(e=>e.value===n),label:r},`${JSON.stringify(n)}_${a}`))})}function Ma({progress:n,size:s=96}){return e("svg",{width:"96",height:"96",viewBox:"0 0 96 96",className:"jk-circular-progress",style:{"--progress":n,"--size":`${s}px`,"--stroke-width":s/12+"px"},children:[t("circle",{className:"bg"}),t("circle",{className:"fg"}),e("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle",children:[n," %"]})]})}function $a({onClick:e}){return t(Bs,{size:"small",icon:t(_t,{}),type:"secondary",onClick:e})}function Fa({onClick:e}){return t(Bs,{size:"small",icon:t(At,{}),type:"secondary",onClick:e})}function Da({date:s,onChange:r,isDisabled:a,isSelected:o}){const[l,c]=i(s),d=[];let u=new Date(J(G(l)));for(let e=0;e<6;e++){d.push([]);for(let t=0;t<7;t++)d[e].push(new Date(u)),u=q(u)}return e(n,{children:[e("div",{className:"jk-row jk-day-picker-header",children:[t(sa,{options:X.map(e=>({value:e,label:e,disabled:!!a?.(Y(new Date,e)).year})),selectedOption:{value:l.getFullYear(),label:l.getFullYear()},onChange:({value:e})=>c(Y(l,e))}),t(Fa,{onClick:()=>c(Q(l))}),t(sa,{options:Z.map((e,n)=>({value:n,label:t(Fr,{children:e}),disabled:!!a?.(ee(l,n)).month})),selectedOption:{value:l.getMonth(),label:t(Fr,{children:Z[l.getMonth()]??l.getMonth().toString()})},onChange:({value:e})=>c(ee(l,e))}),t($a,{onClick:()=>c(te(l))})]}),t("div",{className:"jk-row jk-date-picker-days fw-bd",children:ht.map(e=>t("div",{className:"day",children:t("div",{children:t(Fr,{children:e})})},e))}),t("div",{className:"jk-divider tiny",style:{marginBottom:-6}}),t("div",{className:"jk-date-picker-grid-dates",children:d.map((e,n)=>t("div",{className:"jk-row",children:e.map(e=>{const n=!!a?.(e).day,s=!!o?.(e).day;return t(Br,{className:A("date jk-row",{disabled:n,selected:s,"is-next-month":e.getMonth()>l.getMonth(),"is-previous-month":e.getMonth()<l.getMonth()}),onClick:()=>!n&&r(ne(ee(Y(e,e.getFullYear()),e.getMonth()),e.getDate())),onKeyDownClick:!0,children:t("div",{children:e.getDate()})},e.getTime())})},n))})]})}function Va({date:s,onChange:r,isDisabled:a,isSelected:o}){const[l,c]=i(s),d=[];let u=new Date(se(l));for(let e=0;e<4;e++){d.push([]);for(let t=0;t<3;t++)d[e].push(new Date(u)),u=te(u)}return e(n,{children:[e("div",{className:"jk-row jk-month-picker-header",children:[t(Fa,{onClick:()=>c(re(l))}),t(sa,{options:X.map(e=>({value:e,label:e,disabled:!!a?.(Y(new Date,e)).year})),selectedOption:{value:l.getFullYear(),label:l.getFullYear()},onChange:({value:e})=>c(Y(l,e))}),t($a,{onClick:()=>c(ae(l))})]}),t("div",{className:"jk-date-picker-grid-months",children:d.map((e,n)=>t("div",{className:"jk-row",children:e.map(e=>{const n=!!a?.(e).month,s=!!o?.(e).month;return t(Br,{className:A("month jk-row",{disabled:n,selected:s}),onClick:()=>!n&&r(ee(Y(e,e.getFullYear()),e.getMonth())),onKeyDownClick:!0,children:t("div",{children:t(Fr,{children:Z[e.getMonth()]??e.getMonth().toString()})})},e.getTime())})},n))})]})}function Ua(s){const{todayButton:r=!1,date:a,showMinutes:i,showSeconds:o,showMilliseconds:l,onChange:c,isDisabled:d}=s;return e("div",{className:"jk-col jk-date-picker-grid-time center",children:[e("div",{className:"jk-row",children:[t(sa,{options:oe.map(e=>({value:e,label:H(e,2),disabled:!!d?.(ie(a,e)).hours})),selectedOption:{value:a.getHours(),label:H(a.getHours(),2)},onChange:({value:e})=>c(ie(a,e))}),i&&e(n,{children:[":",t(sa,{options:ce.map(e=>({value:e,label:H(e,2),disabled:!!d?.(le(a,e)).minutes})),selectedOption:{value:a.getMinutes(),label:H(a.getMinutes(),2)},onChange:({value:e})=>c(le(a,e))}),o&&e(n,{children:[":",t(sa,{options:ue.map(e=>({value:e,label:H(e,2),disabled:!!d?.(de(a,e)).seconds})),selectedOption:{value:a.getSeconds(),label:H(a.getSeconds(),2)},onChange:({value:e})=>c(de(a,e))}),l&&e(n,{children:[".",t(sa,{options:pe.map(e=>({value:e,label:H(e,3),disabled:!!d?.(he(a,e)).milliseconds})),selectedOption:{value:a.getMilliseconds(),label:H(a.getMilliseconds(),3)},onChange:({value:e})=>c(he(a,e))})]})]})]})]}),e("div",{className:"jk-row labels tx-s",children:[t(Fr,{className:"cr-tx-sc",children:"HH"}),i&&e(n,{children:[":",t(Fr,{className:"cr-tx-sc",children:"MM"}),o&&e(n,{children:[":",t(Fr,{className:"cr-tx-sc",children:"SS"}),l&&e(n,{children:[".",t(Fr,{className:"cr-tx-sc",children:"MS"})]})]})]})]}),r&&e(n,{children:[t("div",{className:"jk-divider tiny"}),t(Bs,{size:"tiny",onClick:()=>c(new Date),style:{height:12},children:"today"})]})]})}function Ba({date:s,onChange:r,isDisabled:a,isSelected:o}){const[l,c]=i(s),d=[];let u=new Date(l);for(;u.getFullYear()%12;)u=re(u);for(let e=0;e<4;e++){d.push([]);for(let t=0;t<3;t++)d[e].push(new Date(u)),u=ae(u)}return e(n,{children:[e("div",{className:"jk-row jk-year-picker-header",children:[t(Fa,{onClick:()=>c(re(l,12))}),e("div",{className:"jk-row space-between years-label",children:[t("div",{children:d[0][0].getFullYear()})," - ",t("div",{children:d[3][2].getFullYear()})]}),t($a,{onClick:()=>c(ae(l,12))})]}),t("div",{className:"jk-date-picker-grid-years",children:d.map((e,n)=>t("div",{className:"jk-row",children:e.map(e=>{const n=!!a?.(e).year,s=!!o?.(e).year;return t(Br,{className:A("year",{disabled:n,selected:s}),onClick:()=>!n&&r(Y(e,e.getFullYear())),onKeyDownClick:!0,children:t("div",{children:e.getFullYear()})},e.getTime())})},n))})]})}const Za=a(function(s,r){const{todayButton:a=!1,date:i=new Date,isDisabled:o,isSelected:l,type:c="year-month-day-hours-minutes-seconds",onChange:d}=s,{showYears:u,showMonths:h,showDays:p,showHours:m,showMinutes:f,showSeconds:g,showMilliseconds:b}=qn(c);return e("div",{className:"jk-date-picker-layout jk-col jk-pg-sm",ref:r,children:[u&&!h&&!p&&t(Ba,{date:i,onChange:d,isSelected:l,isDisabled:o}),u&&h&&!p&&t(Va,{date:i,onChange:d,isSelected:l,isDisabled:o}),u&&h&&p&&t(Da,{date:i,onChange:d,isSelected:l,isDisabled:o}),m&&e(n,{children:[u&&t("div",{className:"jk-divider tiny",style:{marginTop:-6}}),e("div",{className:A("jk-row center jk-date-picker-time",{"only-time":!u}),children:[u&&e("div",{className:"label-time fw-bd tt-se",children:[t(Fr,{children:"time"}),": "]}),t(Ua,{date:i,onChange:d,showMinutes:f,showSeconds:g,showMilliseconds:b,isDisabled:o})]})]}),a&&e("div",{className:"jk-row left extend",children:[t("div",{className:"jk-divider tiny"}),t(Bs,{type:"secondary",size:"tiny",onClick:()=>d(new Date),children:t(Fr,{children:"select today"})})]})]})}),Ha=()=>import("./DrawerView-Cbw3l2O7.js"),Wa=u(()=>Ha()),Ka=e=>t(h,{fallback:t(bt,{}),children:t(Wa,{...e})});function Ja(s){const{content:r,children:a,triggerOn:o=E.CLICK,position:l,closeIcon:c,closeOnEscape:d,closeOnOutside:u}=s,[h,p]=i(!1),m=()=>p(!1),f=()=>p(!0),g=h?m:f,b=({props:{ref:e,onMouseEnter:t,onClick:n}={}})=>({ref:t=>{e?.(t)},onMouseEnter:e=>{M(o,E.HOVER)&&p(!0),t?.(e)},onClick:e=>{M(o,E.CLICK)&&p(e=>!e),n?.(e)}});return e(n,{children:[t(Ka,{isOpen:h,position:l,closeWhenKeyEscape:d,closeWhenClickOutside:u,onClose:m,closeIcon:c,children:Xn(r,{isOpen:h,onOpen:f,onClose:m,toggle:g})}),"function"==typeof a?R(a({isOpen:h,onOpen:f,onClose:m,toggle:g}),b(a({isOpen:h,onOpen:f,onClose:m,toggle:g}))):R(a,b(a))]})}const Ga=v(null);function qa({children:e,initialUser:n}){const s=l(null);var r;return s.current||(s.current=(r=n,zs()((e,t)=>{const n=W();return{uiId:n,clientId:me(r.user.sessionId,n),user:r.user,setUser:s=>{const r=t().user,a={...r,...s},i=me(a.sessionId,n);JSON.stringify(r)!==JSON.stringify(a)?e({user:a,isLoading:!a.sessionId,clientId:i}):t().clientId!==i&&e({clientId:i})},organization:r.organization,setOrganization:n=>{const s=t().organization;JSON.stringify(s)!==JSON.stringify(n)&&e({organization:n})},isLoading:r.isLoading,mutate:null,setMutate:t=>e({mutate:t}),device:{label:"",isMobile:!1,isBrowser:!1,type:"",osLabel:""},setDevice:t=>e({device:t})}}))),t(Ga.Provider,{value:s.current,children:e})}function Ya(e){const t=b(Ga);if(!t)throw new Error("useUserStore must be used within UserStoreProvider");return As(t,e)}const Xa=([e])=>Gn(e,{},!1),Qa=(e,t)=>"string"==typeof e&&e?[e,t]:null,ei=(e,t)=>{const n=Ya(e=>e.user.sessionId),s=Qa(e,n),{data:r,error:a,mutate:i,isValidating:o,isLoading:l}=ks(s,Xa,t);return{data:p(()=>r?fe(r):void 0,[r]),error:a,isLoading:l,mutate:i,isValidating:o}},ti=v({dispatch:()=>{}});var ni;!function(e){e.ADD_NOTIFICATION="ADD_NOTIFICATION",e.REMOVE_NOTIFICATION="REMOVE_NOTIFICATION"}(ni||(ni={}));const si=()=>{const{dispatch:n}=b(ti),s=d(e=>n({type:ni.ADD_NOTIFICATION,payload:{id:globalThis.crypto.randomUUID(),...e,silent:!!e.silent}}),[n]),r=d((n,r)=>(!1===n.success&&(s({type:ge.ERROR,message:e("div",{className:"jk-col stretch",style:{width:"100%"},children:[t("span",{className:"tt-se",children:t(Fr,{children:n.message})}),(n.errors[0]?.message!==n.message||n.errors.length>1)&&t("ul",{children:m.toArray(n.errors.map((e,n)=>t("li",{children:t(Fr,{className:"tt-se",children:e.message})},n+e.message)))})]})}),r?.(K.ERROR)),!0===n.success&&(s({type:ge.INFO,message:t("div",{className:"jk-col stretch",style:{width:"100%"},children:t("span",{className:"tt-se",children:t(Fr,{children:n.message})})})}),r?.(K.SUCCESS)),!!n.success),[s]);return{addNotification:s,addInfoNotification:d((e,t)=>s({type:ge.INFO,message:e,silent:t}),[s]),addSuccessNotification:d((e,t)=>s({type:ge.SUCCESS,message:e,silent:t}),[s]),addWarningNotification:d((e,t)=>s({type:ge.WARNING,message:e,silent:t}),[s]),addErrorNotification:d((e,t)=>s({type:ge.ERROR,message:e,silent:t}),[s]),addQuietNotification:d((e,t)=>s({type:ge.QUIET,message:e,silent:t}),[s]),removeNotification:d(e=>n({type:ni.REMOVE_NOTIFICATION,notificationId:e}),[n]),notifyResponse:r}},ri=e=>!(!e?.success||!e?.content),ai=e=>!(!e?.success||!e?.contents);function ii(s){const{url:r,options:a,errorView:i,loadingView:c,children:d,onError:u,triggerFetch:h}=s,m=l(u);m.current=u;const{isLoading:f,data:g,error:b,mutate:v,isValidating:y}=ei(r,a),{notifyResponse:w}=si(),{Image:k}=ma(e=>e.components);o(()=>{h&&v()},[h,v]);const N=l(g);N.current=g;const x=l(b);x.current=b;const S=!f&&(!1===g?.success||b);o(()=>{S&&((e=>!1===e?.success)(N.current)&&w(N.current),be(x.current),m.current?.(x.current))},[w,S]);const j=p(()=>ri(g)||ai(g)?Xn(d,{data:g,isLoading:f,error:b,mutate:v}):null,[g,b,f,v]);return f?c?t(n,{children:Yn(c)}):t(Pt,{loading:!0}):ri(g)||ai(g)?e(n,{children:[j,y&&t("div",{className:"pn-ae wh-100",style:{top:0},children:t(zt,{})})]}):i?t(n,{children:Xn(i,{data:g,isLoading:f,error:b,mutate:v})}):t("div",{className:"jk-row jk-col extend",children:t("div",{className:"jk-row pn-re",style:{height:"40%",width:"60%"},children:t(k,{className:"image-border",src:"https://images.juki.pub/assets/juki-image-surprised.png",alt:"Juki surprised image",fill:!0})})})}const oi=zs(e=>({searchParams:new URLSearchParams(""),appendSearchParams:()=>null,deleteSearchParams:()=>null,setSearchParams:()=>null,routeParams:{},pushRoute:()=>null,replaceRoute:()=>null,reloadRoute:()=>null,isLoadingRoute:!1,origin:"",pathname:"",replaceProps:t=>e({...t})}));function li({children:e}){const n=Ya(e=>e.user.isLogged),s=oi(e=>e.setSearchParams),{addWarningNotification:r}=si();if(n)return e;return y(e,{onClick:()=>{r(t(Fr,{className:"tt-se",children:"you must log in"})),s({name:C.SIGN_IN,value:"true"})}})}const ci=w(function(e){const{actionButtons:n,placement:s="left-top",className:r,offset:a,outer:i=!1}=e,{ref:o,width:l=0,height:c=0}=Xr();if(n.length){const e={"--jk-float-toolbar-container-width":`${l}px`,"--jk-float-toolbar-container-height":`${c}px`};return t("div",{className:A("jk-float-toolbar-layout",s,r,{outer:i}),style:a?{...e,"--offset":`${a}px`}:e,children:t("div",{className:"jk-float-toolbar-container jk-col gap stretch right",ref:o,children:n.map((e,t)=>g(La,{...e,key:t}))})})}return null}),di=({children:e,filledCircle:n,icon:s})=>t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1 jk-pg-xsm",content:t("div",{style:{maxWidth:"200px"},children:e}),children:t("div",{className:"jk-row",children:s??t(Lt,n?{rotate:180,filledCircle:!0,size:"small"}:{rotate:180,circle:!0,size:"small"})})}),ui=n=>e(di,{icon:t("div",{className:"jk-row jk-tag bc-io",children:t(Rt,{size:"small",filledCircle:!0,className:"cr-io"})}),...n,children:[t(Fr,{className:"tt-se fw-bd",children:"frozen period"}),t(Fr,{className:"tt-se",children:"in this period the scoreboard is not updated but the contestant will still be able to know the verdict of his submissions"})]}),hi=n=>e(di,{icon:t("div",{className:"jk-row jk-tag bc-er-lt",children:t(Mt,{size:"small",filledCircle:!0,className:"cr-er-lt"})}),...n,children:[t(Fr,{className:"tt-se fw-bd",children:"quiet period"}),t(Fr,{className:"tt-se",children:"in this period the scoreboard is not updated and the contestant will not be able to know the verdict of his submissions"})]}),pi=n=>e(di,{icon:t("div",{className:"jk-row jk-tag bc-ss",children:t($t,{size:"small",filledCircle:!0,className:"cr-ss"})}),...n,children:[t(Fr,{className:"tt-se fw-bd",children:"upsolving period"}),t(Fr,{className:"tt-se",children:"in this period the official scoreboard is not updated and the contestant will be able to send submissions"})]}),mi=({text:e})=>{const n=e.lastIndexOf("\n")===e.length-1;return t("div",{className:"jk-row","data-tooltip-id":"jk-tooltip","data-tooltip-content":(n?"":"no ")+"newline at end of file",children:t(Ft,{size:"tiny",letter:"⏎",letterSize:16,className:A({"cr-ss-lt":n,"cr-er-lt":!n})})})};function fi(n){const{todayButton:s=!1,date:r,onDatePick:a,onDateClean:i,inline:o=!1,type:l="year-month-day-hours-minutes-seconds",isDisabled:c,isSelected:d,baseDate:u,twoLines:h=!1,withDayName:p=!1,extend:m=!1,inputLabel:f,disabled:g=!1}=n,b=()=>f?f(n,()=>null):ve(r)?e("div",{className:"jk-row gap jk-input-date jk-br-ie",children:[t(Dr,{date:r,className:"flex-1 cr-tx-ht-dk",show:l,twoLines:h,withDayName:p}),i&&t(Bs,{icon:t(Dt,{rotate:45}),size:"small",type:"secondary",className:"clear-button",onClick:({onClickEvent:e,onKeyDownEvent:t})=>{(e||t)?.preventDefault(),(e||t)?.stopPropagation(),i()}})]}):t("div",{className:A("jk-row jk-input-date jk-br-ie cr-tx-ht-dk placeholder",{"two-lines":h}),style:{height:24},children:t(Fr,{className:"tt-se",children:"no date selected"})});return o?e("div",{className:"jk-date-picker-layout",children:[b(),t(Za,{todayButton:s,date:r||u,onChange:e=>a(e,()=>null),type:l,isDisabled:c,isSelected:d})]}):t("div",{className:A("jk-date-picker-layout",{disabled:g}),style:m?{width:"100%"}:{},children:t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:()=>t(Za,{todayButton:s,date:r||u,onChange:e=>a(e,()=>null),type:l,isDisabled:c,isSelected:d}),offset:4,placement:"bottom",triggerOn:E.CLICK,open:!g&&void 0,children:t("div",{children:b()})})})}function gi({height:e,width:n}){return t("svg",{height:e,width:n,version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25.394 25.394",fill:"currentColor",style:{height:e,width:n},children:t("g",{children:t("path",{fill:"currentColor",d:"M19.533,21.962c0,0.698-0.088,3.142-2.531,3.142c-1.309,0-1.92-2.182-4.798-2.182 c-1.919,0-1.571,0.784-5.147,0.784c-3.578,0-5.672-1.744-5.672-4.361c0-3.142,1.904-2.132,3.839-3.664 c2.095-1.658,1.92-2.967,4.538-2.967c2.18,0,3.398,2.981,4.885,3.577C16.828,17.163,19.533,20.13,19.533,21.962z M3.672,11.721 c0.057-1.491-0.574-2.754-1.778-2.754C0.631,8.967,0,10.23,0,11.261c0,1.435,0.803,2.811,1.894,2.811 C2.984,14.071,3.614,13.213,3.672,11.721z M12.734,10.344c1.09,0,2.524-2.007,2.581-3.499c0.058-1.492-0.114-3.039-1.319-3.039 c-1.262,0-3.04,1.892-3.04,3.441C10.956,8.681,11.645,10.344,12.734,10.344z M17.094,14.015c1.605,0,2.582-1.778,2.639-3.27 s-0.287-2.754-1.492-2.754c-1.949,0-2.925,1.894-2.925,3.442C15.316,12.867,16.004,14.015,17.094,14.015z M22.198,12.811 c-1.95,0-3.097,2.235-3.097,3.785c0,1.435,0.917,2.467,2.008,2.467c1.605,0,2.639-1.605,2.695-3.097 C23.861,14.473,23.402,12.811,22.198,12.811z M6.712,10.86c1.09,0,1.95-0.802,1.95-2.295c0-2.523,1.146-5.047-0.057-5.047 c-2.41,0-3.787,3.498-3.787,4.531C4.818,9.484,5.621,10.86,6.712,10.86z M2.053,8.109C2.387,8.2,2.699,8.369,2.69,7.897 C2.675,7.16,2.751,5.957,2.387,5.926C2.17,5.909,1.563,7.173,1.389,7.801C1.227,8.398,1.668,8.005,2.053,8.109z M8.846,2.325 C9.211,2.436,9.55,2.624,9.571,2.177C9.607,1.478,9.776,0.348,9.372,0.29C9.134,0.255,8.367,1.398,8.129,1.977 C7.906,2.528,8.425,2.192,8.846,2.325z M15.312,2.739c0.334,0.091,0.653,0.26,0.638-0.213c-0.03-0.849-0.09-2.026-0.453-2.057 c-0.216-0.018-0.703,1.064-0.876,1.692C14.458,2.759,14.928,2.634,15.312,2.739z M20.641,5.998 c0.334,0.092,0.654,0.261,0.637-0.212c-0.029-0.849-0.23-2.438-0.594-2.467c-0.216-0.018-0.537,1.245-0.795,1.928 C19.671,5.825,20.257,5.894,20.641,5.998z M24.822,9.556c-0.216-0.018-0.559,0.865-0.732,1.494 c-0.162,0.597,0.281,0.531,0.666,0.636c0.334,0.091,0.653,0.26,0.637-0.212C25.362,10.625,25.186,9.586,24.822,9.556z"})})})}const bi=w(function(n){const{totalSteps:s,N:r,delay:a,animationName:i,bottom:o,sec:l,size:c,trace:d,children:u}=n,h=[];for(let e=0;e<r;e++){const n=(r-e)*l+a;h.push(t("div",{className:"paw",style:{width:c,height:c,animation:`${i} ${(r+d)*l*s}s ${n}s ease-in-out infinite`},children:t(gi,{height:c,width:c})},e))}const p=Math.PI/2;return e("div",{className:"jk-loader-layout-container",style:{bottom:o},children:[u&&t("div",{className:"jk-row extend center",style:{marginTop:c,overflow:"visible"},children:u}),t("div",{className:"jk-loader-layout-paws",style:{width:56,"--paws-rotate":`${p}rad`},children:m.toArray(h)})]})});const vi=w(function(n){const{sec:s=.15,size:r=18,trace:a=6,children:i,style:o}=n,l=c().split(":").join(""),{width:d=0,height:u=0,ref:h}=Xr(),p=`pawAnimation${l}`,f=u/11,g=Math.min(d-2*r,200),b=g/r,v=[];for(let e=0;e<1;e++)v.push(t(bi,{sec:s,size:r,trace:a,N:b,H:4*f,W:g,step:e+1,totalSteps:1,delay:b*s*e,animationName:p,bottom:"50%",children:i},e));return e("div",{className:"jk-loader-layout expand-absolute pe-ne",ref:h,style:o,children:[t("style",{children:`\n @keyframes ${p} {\n 0% {\n opacity: 1;\n }\n ${Math.round(100/b*a)/1}% {\n opacity: 0;\n }\n 100% {\n opacity: 0;\n }\n }`}),m.toArray(v)]})}),yi=vi,wi=zs()((e,t)=>({lastPath:{},pushPath:({key:n,pathname:s,searchParams:r})=>{const a={...t().lastPath,[n]:{pathname:s,searchParams:r}};e({lastPath:a})},setInitialLastPath:t=>{e({lastPath:t})}}));function ki(e){const{children:n,lastPathKey:s,overwriteOrganizationKey:r}=e,{Link:a}=ma(e=>e.components),i=wi(e=>e.lastPath),o=p(()=>{const{searchParams:e}=Qn(i?.[s]??"");if(r){const t=ms(e);return t.set(C.ORGANIZATION,r||""),t}return e},[i,s,r]),l=Qn(i?.[s])?.pathname;return l?t(a,{href:{pathname:l,query:o.toString()},className:"link dy-cs",children:n}):n}const Ni=(e,t,n)=>{const[s,r]=i(t??e);o(()=>{void 0!==t&&r(t)},[t]);const a=l(n);a.current=n;const c=ua(s);return[s,d(e=>{void 0!==t&&a.current?"function"==typeof e?a.current?.(e?.(c.current)):a.current?.(e):r(e)},[t,c])]};function xi(n){const{className:s,options:r,selectedOptions:a,onChange:c,showOptions:u,onChangeShowOptions:h,disabled:m,optionsPlacement:f="bottom",expand:g,rowHeightOption:b=32,onFilter:v,multiselect:y=!0}=n,w=JSON.stringify(r.map(e=>e.value)),k=p(()=>r,[w]),N=JSON.stringify(a.map(e=>e.value)),x=p(()=>a,[N]),S=l(c);S.current=c;const j=!!v,{width:C,ref:O}=Xr(),[_,I]=Ni(!1,u,h),[T,P]=i(""),[L,R]=i(k),M=p(()=>x.map(e=>{const t=JSON.stringify(e.value),n=k.find(e=>JSON.stringify(e.value)===t);return{value:e.value,label:e.label||n?.label||"",inputLabel:e.inputLabel||n?.inputLabel||""}}),[x,k]);o(()=>{R(T&&v?k.filter(e=>v({search:T,option:e,options:k,selectedOptions:M})):k)},[v,k,T,M]);const $=l(null),F=Math.max(...[...k,...M].map(({label:e})=>z(e).length)),D=m||!S.current,V=17*F+35,U=d(e=>{const n=L[e];if(!n)return null;const s=JSON.stringify(n.value),r=M.some(e=>s===JSON.stringify(e.value)),a=!!n.disabled,i=n.disabled?void 0:()=>{S.current?.(r?M.filter(e=>JSON.stringify(n.value)!==JSON.stringify(e.value)):[...y?M:[],n],n)};return t("div",{className:A("jk-select-option",{selected:r,disabled:a,multiselect:y}),ref:e=>{r&&($.current=e)},onClick:y?void 0:i,children:y?t(Wr,{checked:r,disabled:a,onChange:i,label:Yn(n.label)}):Yn(n.label)},JSON.stringify(n.value))},[L,y,M]);return t(ta,{popoverClassName:"jk-select-options-content bc-sf-hi jk-br-ie elevation-1",triggerOn:E.CLICK,placement:f,onOpenChange:I,offset:4,content:e("div",{className:"jk-select-options-virtual",style:{width:g?(C||0)+8+4-2:V-2},children:[j&&e("div",{className:"jk-row nowrap gap jk-pg-md elevation-1",children:[t(Vt,{}),t(Hr,{value:T,onChange:P,expand:!0})]}),t("div",{style:{width:"100%",height:Math.ceil(256/b)*b},children:t(_a,{size:L.length,rowHeight:b,renderRow:U})})]}),children:t("div",{className:A("jk-multi-select-layout",s,{open:_,disabled:D}),style:{width:g?"100%":`${V}px`},children:e("div",{className:A({open:_},"jk-input-select jk-br-ie jk-row space-between nowrap"),ref:O,children:[t("div",{className:"jk-row left jk-multi-select-selected-options jk-pg-xsm",children:M.map(n=>e("div",{className:A("jk-row nowrap",{"jk-tag bc-sf-hi":y}),children:[Yn(n?.inputLabel?n?.inputLabel:n.label),S.current&&y&&t(Et,{size:"small",filledCircle:!0,onClick:e=>{S.current?.(M.filter(e=>JSON.stringify(n.value)!==JSON.stringify(e.value)),n),e.stopPropagation()},className:"cr-ht"})]},JSON.stringify(n.value)))}),e("div",{className:"jk-row nowrap jk-multi-select-selected-searchable-icons",children:[!!S.current&&t(Et,{className:"input-icon",onClick:e=>{S.current?.([],void 0),e.stopPropagation()}}),t(Ct,{className:"input-icon"})]})]})})})}const Si=s=>{const{dataLength:r,total:a,page:i,pageSize:l,loading:c,initializing:d,pageSizeOptions:u,jumpToPage:h,onPageSizeChange:p,isOnToolbar:m}=s,f=Math.max(Math.ceil(a/l),1),g=Ds(e=>e.viewPort.isSmallScreen),b=$r(e=>e.i18n.t);o(()=>{!d&&(i<1||f<i)&&h(1)},[f,d,h,i]),o(()=>{!u.includes(l)&&u[0]&&p(u[0])},[u,l,p]);const v=[i];i>1&&v.splice(0,0,i-1);for(let e=0;e<4;e++)v.length<3&&i<f-e&&v.push(i+1+e);const y=i>1?()=>h(i-1):void 0,w=i<f?()=>h(i+1):void 0,k=(i-1)*l+1,N=k+r-1;return e("div",{className:A("jk-data-viewer-pagination jk-row gap center",{loading:c}),children:[t("div",{className:"jk-row center nowrap",children:m?e("div",{className:"jk-row gap nowrap",children:[e("div",{className:"jk-row nowrap jk-br-ie tx-s ws-np bc-sf-md",children:[t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"previous",className:A("cr-pr jk-row jk-br-ie jk-input-",{disabled:1===i||d}),onClick:y,children:t(At,{})}),e("div",{style:{padding:"0 4px"},className:"ws-np",children:[r?k===N?k:`${k} - ${N}`:"0"," ",t(Fr,{children:"of"})," ",a]}),t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"next",className:A("cr-pr jk-row jk-br-ie jk-input-",{disabled:i===f||d}),onClick:w,children:t(_t,{})})]}),u.length>1&&t(sa,{options:u.map(n=>({value:n,label:e("div",{className:"jk-row left nowrap tx-s",children:[n," ",t(Fr,{className:"",children:"per page"})]})})),selectedOption:{value:l},onChange:d?void 0:({value:e})=>p(e),optionsPlacement:"bottom",className:"bc-sf-md jk-br-ie"})]}):e(n,{children:[!g&&t("div",{className:A("page-item cr-pr jk-row jk-br",{disabled:1===i}),onClick:y,children:t(At,{})}),e("div",{className:"jk-row jk-br center page-items",children:[1<(v[0]??0)&&e(n,{children:[t("div",{className:A("page-item cr-pr jk-row jk-br cr-tx-sc",{selected:1===i}),onClick:()=>h(1),children:c&&1===i?t(bt,{}):1}),2<(v[0]??0)&&t("div",{className:"jk-row",onClick:()=>h(Math.max(i-3,1)),children:t(Ut,{rotate:-90})})]}),v.map(e=>t("div",{className:A("page-item cr-pr jk-row jk-br fw-bd",{selected:e===i,"fw-br":e===i}),onClick:()=>h(e),children:c&&e===i?t(bt,{}):e},e)),(v[v.length-1]??0)<f&&e(n,{children:[f-1>(v[v.length-1]??0)&&t("div",{className:"jk-row",onClick:()=>h(Math.min(i+3,f)),children:t(Ut,{rotate:90})}),t("div",{className:A("page-item cr-pr jk-row jk-br-ie cr-tx-sc",{selected:f===i}),onClick:()=>h(f),children:c&&f===i?t(bt,{}):f})]})]}),!g&&t("div",{className:A("page-item cr-pr jk-row jk-br-ie",{disabled:i===f}),onClick:w,children:t(_t,{})})]})}),!m&&t(sa,{options:u.map(e=>({value:e,label:e+" / "+b("page")})),selectedOption:{value:l},onChange:d?void 0:({value:e})=>p(e),optionsPlacement:"top",disabled:d})]})};function ji({progress:n,points:s,label:r,height:a=12,tooltipPlacement:i="top"}){const o=e("div",{className:"jk-br-ie pn-re",style:{width:"100%"},children:[t("div",{className:"jk-row left jk-br-ie",style:{width:"100%",background:"var(--cr-ht-lt)"},children:n.map(({label:e,percentage:s,color:r},o)=>"string"==typeof e?t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-place":i,"data-tooltip-content":e,style:{width:s+"%",background:r,height:a,"--color":r,...o===n.length-1?{borderTopRightRadius:"var(--border-radius-inline)",borderBottomRightRadius:"var(--border-radius-inline)"}:{},...0===o?{borderTopLeftRadius:"var(--border-radius-inline)",borderBottomLeftRadius:"var(--border-radius-inline)"}:{}},className:"outline-hover"},o):t(ta,{content:e,popoverClassName:"bc-sf-hi jk-br-ie elevation-1",offset:4,placement:i,children:t("div",{style:{width:s+"%",background:r,height:a,"--color":r,...o===n.length-1?{borderRadius:"0 var(--border-radius-inline) var(--border-radius-inline) 0"}:{}},className:"outline-hover jk-br-ie"})},o))}),s&&t("div",{className:"jk-row left jk-br-ie",style:{width:"100%",top:0,left:0},children:s.map(({label:e,percentage:n,color:s},r)=>"string"==typeof e?t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-place":i,"data-tooltip-content":e,className:"br-50-pc pn-ae outline-hover br-we elevation-1",style:{top:-1,left:`calc(${n}% - ${a/2}px)`,width:a,height:a,background:s,"--color":s,zIndex:1}},r):t(ta,{content:e,popoverClassName:"bc-sf-hi jk-br-ie elevation-1",offset:6,placement:i,children:t("div",{className:"br-50-pc pn-ae outline-hover br-we elevation-1",style:{top:-1,left:`calc(${n}% - ${a/2}px)`,width:a,height:a,background:s,"--color":s,zIndex:1}})},r))})]});return r?t(ta,{content:r,placement:i,children:o}):o}const Ei=({height:e=12,progress:n=100,className:s,color:r="var(--cr-we-light)"})=>{const{ref:a,width:i=0}=Xr(ut),o=Math.ceil(i/e)*e*Math.sqrt(2);return t("div",{style:{width:`${n}%`,height:e,"--width":`${o}`,"--height":`${e}`,"--color":r,overflow:"hidden"},className:A("jk-progress-slide jk-br-ie",s),ref:a,children:t("div",{className:"slide",style:{width:o,height:e}})})};function Ci(n){const{children:s,title:r,graphic:a,...i}=n,{height:o=0,ref:l}=Xr(),{height:c=0,ref:d}=Xr(),u=Ds(e=>e.viewPort.isSmallScreen);return t(ga,{...i,children:e("div",{className:"split-modal jk-row stretch block",children:[e("div",{className:"jk-side-secondary bc-at cr-at-it jk-br jk-col nowrap stretch jk-pg-lg",style:{"--side-main-height":o+"px","--title-side-main-height":c+"px"},children:[t("div",{className:"title",ref:d,children:Yn(r)}),!u&&t("div",{className:"graphic jk-row pn-re",children:Yn(a)})]}),t("div",{className:"jk-side-main jk-col stretch jk-pg-lg",children:y(s,{ref:l})})]})})}const Oi=w(function(n){const{children:s,direction:r,onChangeDirection:a,className:c="",minSize:d=64,onlyFirstPane:u=!1,onlySecondPane:h=!1,closableFirstPane:p,closableSecondPane:m,toggleable:f=!1,onePanelAtATime:g=!1,style:b}=n,v=l(0),[y,w]=i(!1),k=l(0),N=l(null),x=l(null),S=l(""),j=l(null),{height:E=0,width:C=0}=Xr({...ut,targetRef:j}),[O,_]=i(!0),[I,T]=i(!0),[P,z]=Ni("row",r,a);o(()=>{g?u?(T(!0),_(!1)):h?(T(!1),_(!0)):(T(!0),_(!1)):(T(!0),_(!0))},[g,u,h]);const L=()=>{w(!1),k.current=0},R="row"===P?"clientWidth":"clientHeight";return o(()=>{const e=setTimeout(()=>{v.current=x.current?.[R]||0},400);return()=>{clearTimeout(e)}},[R,P,u,h,O,E,C]),o(()=>{x.current?.style&&(!O||u?(x.current.style["row"===P?"minWidth":"minHeight"]="100%",x.current.style["row"===P?"maxWidth":"maxHeight"]="100%"):!I||h?(x.current.style["row"===P?"minWidth":"minHeight"]="0%",x.current.style["row"===P?"maxWidth":"maxHeight"]="0%"):(x.current.style["row"===P?"minWidth":"minHeight"]=S.current,x.current.style["row"===P?"maxWidth":"maxHeight"]=S.current,x.current.style["row"!==P?"minWidth":"minHeight"]="100%",x.current.style["row"!==P?"maxWidth":"maxHeight"]="100%"))},[P,O,I,u,h]),e("div",{className:A("jk-split-pane",c,P,{dragging:y}),onMouseMove:e=>{if(k.current&&x.current?.style){v.current=Math.min(Math.max(v.current+(e["row"===P?"clientX":"clientY"]-(k.current||0)),d),(j.current?.[R]||0)-d-10);const t=100*v.current/(j.current?.[R]||1)+"%";S.current=t,x.current.style["row"===P?"minWidth":"minHeight"]=t,x.current.style["row"===P?"maxWidth":"maxHeight"]=t,k.current=e["row"===P?"clientX":"clientY"]}},onMouseUp:L,onMouseLeave:L,style:b,ref:j,children:[e("div",{className:"jk-split-first-pane",style:h?{display:"none"}:void 0,ref:x,children:[s?.[0],(!!m||g)&&t("div",{className:A("closable-tab",{"jk-row":"column"===P,"jk-col":"row"===P,top:"row"===P&&"right"===m?.align,bottom:"row"===P&&"left"===m?.align,right:"column"===P&&"right"===m?.align,left:"column"===P&&"left"===m?.align}),children:e("div",{className:A("notch opacity-hover bc-at-lt cr-at-it",{"jk-row":"column"===P,"jk-col":"row"===P}),onClick:()=>{g?O?(_(!1),T(!0)):(_(!0),T(!1)):_(e=>!e)},children:[t(O?"row"===P?At:Ct:"row"===P?_t:Bt,{size:"tiny"}),t("span",{className:"label tx-t",children:" "}),O?m?.hideLabel??t(Fr,{className:"label tx-t",children:"hide"}):m?.expandLabel??t(Fr,{className:"label tx-t",children:"expand"})]})})]}),t("div",{className:"jk-split-pane-divider",style:u||h||!O||!I?{display:"none"}:void 0,onMouseDown:e=>{w(!0),k.current=e["row"===P?"clientX":"clientY"]},ref:N,children:t("div",{className:"jk-split-pane-divider-line",children:f&&t("div",{className:A("extend",{"jk-row":"column"===P,"jk-col":"row"===P}),children:e("div",{className:A("notch opacity-hover bc-at-lt cr-at-it toggle-button nowrap",{"jk-row":"column"===P,"jk-col":"row"===P}),onClick:()=>{z(e=>"row"===e?"column":"row")},children:[t(Zt,{size:"tiny",rotate:"column"===P?90:0}),t("span",{className:"label tx-t",children:" "}),t(Fr,{className:"label tx-t",children:"rotate"})]})})})}),e("div",{className:"jk-split-second-pane",style:u||!O?{display:"none"}:void 0,children:[s?.[1],(!!p||g)&&t("div",{className:A("closable-tab",{"jk-row":"column"===P,"jk-col":"row"===P,top:"row"===P&&"right"===p?.align,bottom:"row"===P&&"left"===p?.align,right:"column"===P&&"right"===p?.align,left:"column"===P&&"left"===p?.align}),children:e("div",{className:A("notch opacity-hover bc-at-lt cr-at-it",{"jk-row":"column"===P,"jk-col":"row"===P}),onClick:()=>{g?I?(T(!1),_(!0)):(T(!0),_(!1)):T(e=>!e)},children:[t(O?"row"===P?At:Bt:"row"===P?_t:Ct,{size:"tiny"}),t("span",{className:"label tx-t",children:" "}),I?p?.hideLabel??t(Fr,{className:"label tx-t",children:"hide"}):p?.expandLabel??t(Fr,{className:"label tx-t",children:"expand"})]})})]})]})}),_i=()=>{const{cache:e,mutate:t}=Ns();return d(n=>{if(!(e instanceof Map))throw new Error("matchMutate requires the cache provider to be a Map instance");const s="string"==typeof n?new RegExp(n):n,r=[];for(const t of e.keys())s.test(t)&&r.push(t);const a=r.map(e=>t(e));return Promise.all(a)},[e,t])};function Ii({submissionId:e}){const{notifyResponse:n}=si(),s=_i();return t(za,{onClick:async(...t)=>{await(e=>async t=>{t(K.LOADING);const{url:s,...r}=ps.API_V2.submission.rejudge({params:{id:e}}),a=fe(await es(s,r));n(a,t)})(e)(...t),await s(new RegExp(`${ye}/submission`))},size:"tiny",icon:t(Ht,{}),type:"secondary",children:t(Fr,{className:"tt-se",children:"rejudge"})})}function Ti(e,t){o(()=>{function n(n){t.current&&n.target&&!t.current.contains(n.target)&&e(n)}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t])}const Ai={height:0,width:0,opacity:0,overflow:"hidden",zIndex:-1e6,pointerEvents:"none"};function Pi(n){const{tabs:s,selectedTabKey:r,onChange:a,className:c="",extraNodes:d,extend:u}=n,[h,f]=Ni(s[0]?.key||"",r,a),g=l(null),{width:b=0,ref:v}=Xr(ut),{width:y=0,ref:w}=Xr(ut),{width:k=0,ref:N}=Xr(ut),{height:x=0,ref:S}=Xr(ut),j=p(()=>{const e={};return s.forEach(({key:t},n)=>{e[t]=n}),e},[s]);o(()=>{const e=({keyCode:e})=>{if(C.current&&"number"==typeof j[h]){if(39===e){const e=s[(j[h]+1)%s.length];e&&f(e.key)}if(37===e){const e=s[(j[h]-1+s.length)%s.length];e&&f(e.key)}}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[h,f,j,s]);const C=l(!1);Ti(()=>C.current=!1,g);const O={};s.forEach(({key:e,header:t})=>{O[e]=Xn(t,{selectedTabKey:h})});const[_,I]=i(b+y+32);o(()=>{const e=b+y+32;e>_&&I(e)},[_,y,b]);const T="boolean"==typeof u?u:k>_,P=(d||[]).filter(Boolean);return e("div",{className:A("jk-tabs-layout",c,{"first-tab-selected":0===j[h],"select-mode":!T}),style:{"--tabs-header-height":`${x}px`},ref:N,children:[e("div",{className:"jk-tabs-header jk-row space-between nowrap",ref:S,children:[t("div",{className:"jk-tabs-tabs jk-row left",onClick:()=>C.current=!0,ref:g,style:T?{}:Ai,children:t("div",{className:"jk-row nowrap",ref:v,children:s.map(({clickable:e=!0,key:n})=>t("div",{className:A("jk-tab",{selected:h===n}),onClick:()=>e&&f(n),children:O[n]},n))})}),!T&&t(sa,{options:s.map(({key:e})=>({value:e,label:O[e]})),selectedOption:{value:h},onChange:({value:e})=>f(e),expand:!0,popoverClassName:"jk-tabs-select"}),e("div",{className:"jk-tabs-actions jk-row right nowrap gap",style:P.length&&T?{}:Ai,children:[t("div",{className:"jk-divider horizontal"}),t("div",{className:"jk-row gap nowrap",ref:w,children:m.toArray(P.map((e,t)=>Xn(e,{selectedTabKey:h},t)))})]}),!!P.length&&!T&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:t("div",{className:"jk-col gap stretch jk-tab-extra-nodes jk-pg-xsm",children:m.toArray(P.map((e,t)=>Xn(e,{selectedTabKey:h},t)))}),triggerOn:E.CLICK,placement:"bottom-end",children:t("div",{className:"jk-row nowrap left link",children:t(Wt,{})})})]}),t("div",{className:"jk-tabs-content",children:s.map(({body:e,key:n})=>t("div",{className:A({selected:h===n}),children:Xn(e,{selectedTabKey:h})},n))})]})}const zi=P()?k:o,Li=({tabKey:e,children:n,getHrefOnTabChange:s,routerReplace:r})=>{const{Link:a}=ma(e=>e.components);return s&&!r&&e?t(a,{href:s(e),children:n}):n},Ri=e=>{const{tab:{key:n,header:s},selectedTabKey:r,getHrefOnTabChange:a,routerReplace:i,setSelectedTabKey:o,buttonClassName:l}=e,c=n===r;return t(Li,{tabKey:c?void 0:n,getHrefOnTabChange:a,routerReplace:i,children:t(Bs,{type:"ghost",onClick:c?void 0:()=>o(n,!1),className:A("jk-tabs-inline-tab fw-bd",{selected:c,"cr-tx-ht":c},l),children:Xn(s,{selectedTabKey:r})})})};function Mi(s){const{tabs:r,selectedTabKey:a,onChange:o,extraNodes:c,extraNodesPlacement:u="right",className:h,tickStyle:p="classic",getHrefOnTabChange:f,routerReplace:g,withBody:b,tabButtonsClassName:v}=s,y=Object.values(r),[w,k]=Ni(y[0]?.key||"",a,o),N=y.length,x=oi(e=>e.replaceRoute),S=Ds(e=>e.viewPort.isSmallScreen),j=(e,t=!1)=>{e&&(f?(g||t)&&(k(e),x(f(e))):k(e))},E=l(null),C=l(!0),[O,_]=i({start:!1,end:!1}),[I,T]=i(null),{width:P}=Xr({targetRef:E,...ut}),z=d(()=>{const e=E.current;if(!e)return;const t=e.scrollLeft>1,n=e.scrollLeft+e.clientWidth<e.scrollWidth-1;_(e=>e.start===t&&e.end===n?e:{start:t,end:n})},[]);zi(()=>{const e=E.current,t=e?.querySelector(".jk-tabs-inline-tab.selected");if(!e||!t)return T(null),void z();T({left:t.offsetLeft,width:t.offsetWidth}),e.scrollTo({left:t.offsetLeft-(e.clientWidth-t.offsetWidth)/2,behavior:C.current?"auto":"smooth"}),C.current=!1,z()},[w,P,N,z]);const L=e=>{const t=E.current;t?.scrollBy({left:e*t.clientWidth*.7,behavior:"smooth"})},R=!S&&(O.start||O.end),M=()=>m.toArray(c?.map((e,t)=>Xn(e,{selectedTabKey:w},t)));return e(n,{children:[e("div",{className:A(`jk-row gap space-between nowrap jk-tabs-inline extend tick-style-${p}`,h),children:["left"===u&&!!c?.length&&t("div",{className:"jk-row gap nowrap jk-tabs-inline-extra-nodes",children:M()}),e("div",{className:"jk-row left nowrap jk-tabs-inline-strip",children:[R&&t("button",{type:"button",className:"jk-row jk-tabs-inline-arrow","aria-label":"Scroll tabs left",disabled:!O.start,onClick:()=>L(-1),children:t(At,{className:A("br-50-pc bc-at-lt cr-at-it elevation-1",{activated:O.start,disabled:!O.start}),size:"small"})}),e("div",{ref:E,onScroll:z,className:A("jk-row left stretch nowrap jk-tabs-headers-inline",{"fade-start":O.start,"fade-end":O.end}),children:[m.toArray(y.map(e=>t(Ri,{tab:e,selectedTabKey:w,getHrefOnTabChange:f,routerReplace:g,setSelectedTabKey:j,buttonClassName:v}))),"background"!==p&&I&&t("span",{className:"jk-tabs-inline-indicator",style:{width:I.width,transform:`translateX(${I.left}px)`}})]}),R&&t("button",{type:"button",className:"jk-row jk-tabs-inline-arrow","aria-label":"Scroll tabs right",disabled:!O.end,onClick:()=>L(1),children:t(_t,{className:A("br-50-pc bc-at-lt cr-at-it elevation-1",{activated:O.end,disabled:!O.end}),size:"small"})})]}),"right"===u&&!!c?.length&&t("div",{className:"jk-row gap nowrap jk-tabs-inline-extra-nodes",children:M()}),("bottomRight"===u||"bottomLeft"===u||"bottomCenter"===u)&&!!c?.length&&t("div",{className:"jk-col gap nowrap",style:{position:"absolute",bottom:"calc(var(--bottom-horizontal-menu-height, 0) + var(--pad-t))",right:"bottomRight"===u||"bottomCenter"===u?"var(--pad-t)":"",left:"bottomLeft"===u||"bottomCenter"===u?"var(--pad-t)":""},children:M()})]}),b&&Xn(r[w]?.body,{selectedTabKey:w})]})}function $i({tabs:e,selectedTabKey:n}){const s=Object.keys(e),r=s.findIndex(e=>e===n)??0,[{width:a,height:o},c]=i({width:0,height:0}),u=l(null),h=d(e=>{u.current?.disconnect(),e&&(u.current=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;c(t=>t.width!==e||t.height!==n?{width:e,height:n}:t)}}),u.current.observe(e))},[]);return t("div",{className:"ow-hn jk-row nowrap wh-100 ht-100 jk-tabs-inline-layout",ref:h,children:!!a&&!!o&&s.map((s,i)=>{const l=e[s],c=Math.abs(r-i)<=0;return t("div",{className:"jk-tabs-inline-body-content ow-ao bs-bb",style:{opacity:c?1:0,width:a,height:o,left:-r*a+i*a},children:Xn(l?.body,{selectedTabKey:n})},s)})})}const Fi={tiny:"tiny",small:"tiny",regular:"small",large:"regular",huge:"large"},Di=(e,t)=>{if(!N(e))return e;const n=e;return n.props.size?n:y(n,{size:Fi[t]})},Vi=({size:e,label:n,icon:s,...r})=>{const a=Ds(e=>e.viewPort.isSmallScreen),i=Ds(e=>e.viewPort.isMediumScreen),o=a||i,l=e||"regular";return t(Bs,{"data-tooltip-id":"jk-tooltip","data-tooltip-place":"top-end","data-tooltip-content":o?n:"",size:l,icon:Di(s,l),...r,children:!o&&t(Fr,{className:"tt-se ws-np",children:n})})},Ui=({size:e,label:n,icon:s,...r})=>{const a=Ds(e=>e.viewPort.isSmallScreen),i=Ds(e=>e.viewPort.isMediumScreen),o=a||i,l=e||"regular";return t(za,{"data-tooltip-id":"jk-tooltip","data-tooltip-place":"top-end","data-tooltip-content":o?n:"",size:l,icon:Di(s,l),...r,children:!o&&t(Fr,{className:"tt-se ws-np",children:n})})};function Bi(){return t("div",{className:"jk-row gap jk-pg",children:["light","dark"].map(n=>e("div",{className:"jk-pg-lg jk-col gap jk-theme-"+n,style:{backgroundColor:"var(--cr-we)"},children:[e("h3",{children:["Theme ",n]}),e("div",{className:"jk-row color-cells",children:[t("div",{style:{backgroundColor:"var(--base-white)"}}),t("div",{style:{backgroundColor:"var(--base-black)"}})]}),e("div",{className:"jk-row color-cells",children:[t("div",{style:{backgroundColor:"var(--cr-at-lt)"},children:"light"}),t("div",{style:{backgroundColor:"var(--cr-at)"},children:"error"}),t("div",{style:{backgroundColor:"var(--cr-at-dk)"},children:"dark"})]}),e("div",{className:"jk-row color-cells",children:[t("div",{style:{backgroundColor:"var(--cr-ss-lt)"},children:"light"}),t("div",{style:{backgroundColor:"var(--cr-ss)"},children:"error"}),t("div",{style:{backgroundColor:"var(--cr-ss-dk)"},children:"dark"})]}),e("div",{className:"jk-row color-cells",children:[t("div",{style:{backgroundColor:"var(--cr-wg-lt)"},children:"light"}),t("div",{style:{backgroundColor:"var(--cr-wg)"},children:"error"}),t("div",{style:{backgroundColor:"var(--cr-wg-dk)"},children:"dark"})]}),e("div",{className:"jk-row color-cells",children:[t("div",{style:{backgroundColor:"var(--cr-er-lt)"},children:"light"}),t("div",{style:{backgroundColor:"var(--cr-er)"},children:"error"}),t("div",{style:{backgroundColor:"var(--cr-er-dk)"},children:"dark"})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--cr-ht-lt)"},children:t("div",{children:"light"})}),t("div",{style:{backgroundColor:"var(--cr-ht)"},children:t("div",{children:"highlight"})}),t("div",{style:{backgroundColor:"var(--cr-ht-dark)"},children:t("div",{children:"dark"})})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--cr-sw--lt)"},children:t("div",{children:"light"})}),t("div",{style:{backgroundColor:"var(--cr-sw)"},children:t("div",{children:"shadow"})}),t("div",{style:{backgroundColor:"var(--cr-sw-dark)"},children:t("div",{children:"dark"})})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--cr-gw)"},children:t("div",{children:"glow"})}),t("div",{style:{backgroundColor:"var(--cr-gy)"},children:t("div",{children:"gray"})})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--cr-bk)"},children:t("div",{children:"black"})}),t("div",{style:{backgroundColor:"var(--cr-bk-light)"},children:t("div",{children:"light"})}),t("div",{style:{backgroundColor:"var(--cr-bk-lightest)"},children:t("div",{children:"lightest"})})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--cr-we)"},children:t("div",{children:"white"})}),t("div",{style:{backgroundColor:"var(--cr-we-dark)"},children:t("div",{children:"dark"})}),t("div",{style:{backgroundColor:"var(--cr-we-darkest)"},children:t("div",{children:"darkest"})})]}),e("div",{className:"jk-row color-cells with-labels",children:[t("div",{style:{backgroundColor:"var(--bc-sf)"},children:t("div",{children:"bc-sf"})}),t("div",{style:{backgroundColor:"var(--bc-sf-md)"},children:t("div",{children:"bc-sf-md"})}),t("div",{style:{backgroundColor:"var(--bc-sf-hi)"},children:t("div",{children:"bc-sf-hi"})})]})]},n))})}const Zi=zs((e,t)=>({timers:{},setTimer:(n,s)=>{const r={...t().timers};r[n]={nowRef:s?.nowRef??r[n]?.nowRef??0,counter:s?.counter??r[n]?.counter??0,accumulated:s?.accumulated??r[n]?.accumulated??0,remaining:s?.remaining??r[n]?.remaining??0,interval:s?.interval??r[n]?.interval??0,intervalRef:s?.intervalRef??r[n]?.intervalRef??void 0,tickInterval:s?.tickInterval??r[n]?.tickInterval??0},e({timers:r})},clearTimer:n=>{const s={...t().timers},r=s[n];r?.intervalRef&&clearInterval(r.intervalRef);const{[n]:a,...i}=s;e({timers:i})},resetTimer:n=>{const s={...t().timers},r=s[n];r?.intervalRef&&clearInterval(r.intervalRef),s[n]={nowRef:0,counter:0,accumulated:0,remaining:r?.remaining??0,interval:0,intervalRef:void 0,tickInterval:r?.tickInterval??0},e({timers:s})},startTimer:(n,s)=>{const{timers:r}=t(),a=r[n];a?.intervalRef&&clearInterval(a.intervalRef);const i={nowRef:Date.now(),counter:a?.counter??0,accumulated:a?.accumulated??0,remaining:a?.remaining??0,interval:s,intervalRef:void 0,tickInterval:Math.max(Math.min(s/10,we),10)},o=setInterval(()=>{e(e=>{const t={nowRef:e.timers[n]?.nowRef??i.nowRef,counter:e.timers[n]?.counter??i.counter,accumulated:e.timers[n]?.accumulated??i.accumulated,remaining:e.timers[n]?.remaining??i.remaining,interval:e.timers[n]?.interval??i.interval,intervalRef:e.timers[n]?.intervalRef??i.intervalRef,tickInterval:e.timers[n]?.tickInterval??i.tickInterval},r=t.accumulated+(Date.now()-t.nowRef);return Math.floor(t.counter/s)===Math.floor(r/t.interval)&&Math.floor((t.remaining-t.counter)/s)===Math.floor((t.remaining-r)/t.interval)?e:{timers:{...e.timers,[n]:{...t,counter:r}}}})},i.tickInterval);e(e=>({timers:{...e.timers,[n]:{...i,intervalRef:o}}}))},pauseTimer:t=>{e(e=>{const n=e.timers[t];if(!n)return e;n.intervalRef&&clearInterval(n.intervalRef);const s=Date.now(),r=s-n.nowRef,a=n.accumulated+r;return{timers:{...e.timers,[t]:{...n,nowRef:s,accumulated:a,interval:0,intervalRef:void 0}}}})}})),Hi=(e,t,n)=>{const s=Zi(t=>t.timers[e]?.remaining??0),r=Zi(t=>t.timers[e]?.counter??0),a=Zi(t=>t.timers[e]?.nowRef??0),i=Zi(t=>t.timers[e]?.interval??0),l=Zi(e=>e.setTimer),c=Zi(e=>e.startTimer),u=Zi(e=>e.pauseTimer),h=Zi(e=>e.resetTimer),p=Zi(e=>e.clearTimer),m=d(()=>{p(e)},[e,p]),f=d(()=>{h(e)},[e,h]),g=d(()=>{c(e,Math.abs(t))},[e,t,c]),b=d(()=>{u(e)},[e,u]),v=0!==a&&0!==i;o(()=>{t<0&&v&&s-r<=0&&(n?.(),p(e))},[t,r,n,s,p,e,v]);const y=d(t=>{l(e,{remaining:t})},[e,l]);return{counter:t<0?s-r:s+r,currentCounter:r,countdownFrom:s,setCountdownFrom:y,isStopped:0===a,isPaused:0===i,isRunning:v,clear:m,reset:f,start:g,pause:b}};function Wi(s){const{counter:r,inline:a,literal:i,ignoreLeadingZeros:o=!1,ignoreTrailingZeros:l=!1,maxSplit:c=6,minSplit:d=1,abbreviated:u=!1,type:h="hours-minutes-seconds",className:p}=s,m=ts(r,h,o,l,c,d);return t("div",{className:A("jk-timer-layout jk-row nowrap",p,{literal:!!i,inline:!!a}),children:i?m.map((n,s)=>e(f,{children:[s>0&&t(Fr,{children:"and"}),t("span",{children:n.remaining}),t(Fr,{children:u?n.abbreviatedLabel:n.label})]},n.label+s)):a?m.map((s,r)=>e("div",{children:[t("span",{className:"ff-me",children:H(s.remaining,s.digits,"0")}),r!==m.length-1&&["h","m"].includes(s.abbreviatedLabel)&&t("span",{className:"fw-bd",children:":"}),r!==m.length-1&&["s"].includes(s.abbreviatedLabel)&&t("span",{className:"fw-bd",children:"."}),["w","d"].includes(s.abbreviatedLabel)&&e(n,{children:[t(Fr,{children:u?s.abbreviatedLabel:s.label})," "]})]},s.label+r)):m.map((n,s)=>e(f,{children:[e("div",{className:"content-stamp",children:[t("div",{className:"jk-row ff-me",children:H(n.remaining,n.digits,"0")}),t("div",{className:"content-label jk-row",children:t(Fr,{className:"tt-se",children:u?n.abbreviatedLabel:n.label})})]}),s!==m.length-1&&t("span",{className:"fw-bd",children:":"})]},n.label+s))})}function Ki(e){const{remaining:n,interval:s,resetTrigger:r,timerKey:a,onTimeout:i,...l}=e,d=c(),{counter:u,start:h,clear:p,reset:m,setCountdownFrom:f}=Hi(a||d,s,i);return o(()=>{f(n)},[n,f]),o(()=>{m(),h()},[m,h,r]),o(()=>()=>{p()},[p]),t(Wi,{...l,counter:u})}const Ji={[O.FUTURE]:"stars in",[O.LIVE_START]:"starts ago",[O.LIVE_END]:"ends in",[O.PAST]:"ended ago",[O.TIME_OUT]:"time out",[O.CALC]:"..."};function Gi(n){const{startDate:s,endDate:r,currentDate:a,labels:l,type:c="hours-minutes-seconds",literal:d,inline:u,abbreviated:h,ignoreLeadingZeros:p,ignoreTrailingZeros:m,maxSplit:f=6,minSplit:g=1}=n,[b,v]=i({period:O.CALC,remaining:0,interval:0});o(()=>{const e=a||new Date;let t=O.CALC,n=0,i=0;s<e&&e<r?(t=O.LIVE_END,n=r.getTime()-e.getTime(),i=-1):r<e&&e<s?(t=O.LIVE_START,n=e.getTime()-r.getTime(),i=1):e<s?(t=O.FUTURE,n=s.getTime()-e.getTime(),i=-1):e>r&&(t=O.PAST,n=e.getTime()-r.getTime(),i=1),v({period:t,remaining:n,interval:i});const o=setTimeout(()=>{t!==O.LIVE_START&&t!==O.LIVE_END&&t!==O.FUTURE||v({period:O.TIME_OUT,remaining:0,interval:0})},n);return()=>{clearTimeout(o)}},[a,r,s]);const y={...Ji,...l},w=ts(Math.max(b.remaining,0),c,!1,!1,f,g),k=Math.max(w[w.length-1]?.milliseconds??0,1);return e("div",{className:A(`jk-timer-labeled-container period-${b.period.toLowerCase()}`,{"jk-row center gap":!!d,"jk-col":!d}),children:[t("div",{className:"fw-bd",children:t(Fr,{className:"tt-se",children:y[b.period]})}),t(Ki,{type:c,remaining:b.remaining,interval:b.interval*k,literal:d,inline:u,abbreviated:h,ignoreLeadingZeros:p,ignoreTrailingZeros:m,maxSplit:f})]})}function qi(n){const{isOpen:s,secondary:r,primary:a,title:o,children:c,onClose:d,containerClassName:u,...h}=n,[p,m]=i(K.NONE),f=l(void 0),g=Ds(e=>e.viewPort.isSmallScreen);return t(ga,{isOpen:s,containerClassName:u,onClose:d,setLoaderStatusRef:e=>f.current=e,onLoaderStatusChange:m,...h,children:e("div",{className:"jk-col stretch jk-pg gap",children:[e("div",{className:"jk-col gap",children:[t(Lt,{filledCircle:!0,className:"cr-er",size:"large"}),t("h3",{className:"cr-er",children:o})]}),t("div",{className:"wh-100",children:c}),e("div",{className:A("jk-row-col gap right wh-100",{nowrap:!g}),children:[r&&t(za,{onClick:r.onClick,disabled:r.disabled||p===K.LOADING,type:"secondary",expand:!0,children:r.label||t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{onClick:a.onClick,disabled:a.disabled||p===K.LOADING,expand:!0,children:a.label||t(Fr,{className:"tt-se",children:"ok"})})]})]})})}function Yi(n){const{children:s,className:r,firstClassName:a="jk-col stretch top jk-pg-rl",secondClassName:i}=n,{height:o=0,ref:l}=Xr();return e("section",{className:A("jk-two-content-section jk-col nowrap stretch",r),style:{"--first-content-section-height":o+"px"},children:[t("div",{ref:l,id:"jk-two-content-section-first-panel",className:a,children:s[0]}),t("div",{id:"jk-two-content-section-second-panel",className:i,children:s[1]})]})}function Xi(n){const{breadcrumbs:s,tabs:r={},tabButtons:a,getHrefOnTabChange:i,selectedTabKey:l,children:c}=n,d=Ds(e=>e.viewPort.isSmallScreen),u=Ya(e=>e.user.settings[ke.MENU_VIEW_MODE]),h=oi(e=>e.pushRoute),p=Object.keys(r),[m,f]=Ni(r[p[0]]?.key??"",l),g=e=>{i?h(i(e)):f(e)};o(()=>{l&&f(l)},[l,f]);const b=p.length>1,v=u===Ne.VERTICAL&&b,y=Xn(s,{selectedTabKey:m});return e(Yi,{className:"cards-style",children:[e("div",{children:[!!y?.length&&t(Pa,{breadcrumbs:y}),e("div",{className:A("jk-row gap jk-pg-rl",{"pad-top":u===Ne.HORIZONTAL&&b,"pad-top-bottom":!(u===Ne.HORIZONTAL&&b)}),children:[c,!(u===Ne.HORIZONTAL&&b)&&!!a?.length&&!v&&t("div",{className:"jk-row gap extend right",children:a.map(e=>Xn(e,{selectedTabKey:m}))})]}),u===Ne.HORIZONTAL&&b&&t("div",{className:"jk-pg-rl",children:t(Mi,{tabs:r,selectedTabKey:m,onChange:g,extraNodes:a,extraNodesPlacement:d?"bottomRight":void 0})})]}),e("div",{children:[v&&t(Mi,{tabs:r,selectedTabKey:m,onChange:g,extraNodes:a,extraNodesPlacement:d?"bottomRight":void 0}),t("div",{className:"two-content-layout-body jk-pg-trbl",style:{height:u===Ne.VERTICAL&&b?"calc(100% - 40px)":"100%"},children:t($i,{tabs:r,selectedTabKey:m})})]})]})}const Qi=(e,t)=>{const[n,s]=i(e),r=p(()=>{try{return JSON.stringify(a)}catch{return String(a)}},[a=e]);var a;const c=l(r);return o(()=>{r!==c.current&&(s(e),c.current=r)},[r,...t||[]]),[n,s]};function eo(s){const{breadcrumbs:r,tabs:a={},tabButtons:i,getHrefOnTabChange:o,selectedTabKey:l,children:c,loading:d,tabsInlineClassName:u,headerClassName:h,bodyClassName:p}=s,m="loading",f=Ds(e=>e.viewPort.isSmallScreen),g=Object.keys(a),[b,v]=Qi(d?m:l??(g?.[0]?a[g?.[0]]?.key:"")),y=d?{[m]:{key:m,header:t("div",{className:"jk-row",children:t("div",{className:"dot-flashing"})}),body:t(yi,{children:"boolean"==typeof d?void 0:d})}}:a,w=Object.keys(y),k=Xn(r,{selectedTabKey:b}),N=w.length>1,x=!!k?.length&&!f;return e(Yi,{className:A("rectangular-style",{loading:!!d}),secondClassName:p,children:[e(n,{children:[x&&t(Pa,{breadcrumbs:k}),(!!c||!N&&i&&i.length>0)&&e("div",{className:A("jk-pg-xsm-b",{"jk-pg-sm-t":!x,"jk-row gap extend":!h,left:!h&&!f,center:!h&&f},h),children:[c,!N&&i&&i.length>0&&t("div",{className:"jk-row gap extend right",children:i.map(e=>Xn(e,{selectedTabKey:b}))})]}),N&&t(Mi,{tabs:y,selectedTabKey:b,extraNodes:i,tickStyle:"classic",className:A(u),onChange:e=>{if(v(e),o&&P()){const{pathname:t,searchParams:n}=Qn(o(e)),s=fs(n);P()&&window.history.replaceState({},"",`${t}${s?"?"+s:""}`)}}})]}),t($i,{tabs:y,selectedTabKey:b})]})}const to=()=>{const s=Ya(e=>e.user.sessionId),r=Ya(e=>e.user.nickname),[a,l]=i(!0);return o(()=>{if(!s)return;const e=setTimeout(()=>{l(!1)},1e3);return()=>{clearTimeout(e)}},[s]),t(bs,{children:a&&t(vs.div,{initial:{opacity:1,y:0},exit:{opacity:.9,y:"-100vh"},transition:{ease:"easeOut"},className:"expand-absolute pe-ne jk-col bc-tx-ht",style:{zIndex:999},children:t("h1",{className:"jk-row cr-tx-ht-it",style:{alignItems:"baseline"},children:s?e("div",{className:"jk-col",children:[t(Fr,{className:"tt-se",children:"welcome"}),r&&t("div",{children:r})]}):e(n,{children:[t(Fr,{className:"tt-se",children:"loading user"})," ",t("div",{className:"dot-flashing",style:{"--dot-flashing-color":"var(--cr-tx-ht-it)","--dot-flashing-color-light":"var(--cr-tx-ht-lt)","--dot-flashing-size":"10px"}})]})})},"loader")})},no=()=>import("./BarChart-54h6GU3p.js"),so=u(()=>no()),ro=e=>t(h,{fallback:t(bt,{}),children:t(so,{...e})}),ao=()=>import("./CodeEditor-C5-1AgZR.js"),io=u(()=>ao()),oo=e=>t(h,{fallback:t(bt,{}),children:t(io,{...e})}),lo=()=>import("./CodeViewer-CQrzGpJT.js"),co=u(()=>lo()),uo=e=>t(h,{fallback:t(bt,{}),children:t(co,{...e})}),ho=()=>import("./DataGrid-Bu-7Atkf.js"),po=u(()=>ho()),mo=e=>t(h,{fallback:t(bt,{}),children:t(po,{...e})}),fo=u(()=>import("./ImageLoaderCropper-Bk1LxSbD.js")),go=e=>t(h,{fallback:t(bt,{}),children:t(fo,{...e})}),bo=()=>import("./InputColor-DhUlWGSD.js"),vo=u(()=>bo()),yo=e=>t(h,{fallback:t(bt,{}),children:t(vo,{...e})}),wo=()=>import("./LineChart-BQ1UY4l8.js"),ko=u(()=>wo()),No=e=>t(h,{fallback:t(bt,{}),children:t(ko,{...e})}),xo=()=>import("./SlideDeck-0cxhxG3b.js"),So=u(()=>xo()),jo=e=>t(h,{fallback:t(bt,{}),children:t(So,{...e})}),Eo=()=>import("./SortableItems-CvA8yugp.js"),Co=u(()=>Eo()),Oo=e=>t(h,{fallback:t(bt,{}),children:t(Co,{...e})}),_o="vercel.ai.error",Io=Symbol.for(_o);var To=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Io]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,_o)}static hasMarker(e,t){const n=Symbol.for(t);return null!=e&&"object"==typeof e&&n in e&&"boolean"==typeof e[n]&&!0===e[n]}};const Ao="AI_APICallError",Po=`vercel.ai.error.${Ao}`,zo=Symbol.for(Po);var Lo=class extends To{constructor({message:e,url:t,requestBodyValues:n,statusCode:s,responseHeaders:r,responseBody:a,cause:i,isRetryable:o=null!=s&&(408===s||409===s||429===s||s>=500),data:l}){super({name:Ao,message:e,cause:i}),this[zo]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=s,this.responseHeaders=r,this.responseBody=a,this.isRetryable=o,this.data=l}static isInstance(e){return To.hasMarker(e,Po)}};const Ro="AI_EmptyResponseBodyError",Mo=`vercel.ai.error.${Ro}`,$o=Symbol.for(Mo);var Fo=class extends To{constructor({message:e="Empty response body"}={}){super({name:Ro,message:e}),this[$o]=!0}static isInstance(e){return To.hasMarker(e,Mo)}};function Do(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.toString():JSON.stringify(e)}const Vo="AI_InvalidArgumentError",Uo=`vercel.ai.error.${Vo}`,Bo=Symbol.for(Uo);var Zo=class extends To{constructor({message:e,cause:t,argument:n}){super({name:Vo,message:e,cause:t}),this[Bo]=!0,this.argument=n}static isInstance(e){return To.hasMarker(e,Uo)}};const Ho="AI_JSONParseError",Wo=`vercel.ai.error.${Ho}`,Ko=Symbol.for(Wo);var Jo=class extends To{constructor({text:e,cause:t}){super({name:Ho,message:`JSON parsing failed: Text: ${e}.\nError message: ${Do(t)}`,cause:t}),this[Ko]=!0,this.text=e}static isInstance(e){return To.hasMarker(e,Wo)}};const Go="AI_TypeValidationError",qo=`vercel.ai.error.${Go}`,Yo=Symbol.for(qo);var Xo=class e extends To{constructor({value:e,cause:t,context:n}){let s="Type validation failed";if(n?.field&&(s+=` for ${n.field}`),n?.entityName||n?.entityId){s+=" (";const e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),s+=e.join(", "),s+=")"}super({name:Go,message:`${s}: Value: ${JSON.stringify(e)}.\nError message: ${Do(t)}`,cause:t}),this[Yo]=!0,this.value=e,this.context=n}static isInstance(e){return To.hasMarker(e,qo)}static wrap({value:t,cause:n,context:s}){return e.isInstance(n)&&n.value===t&&n.context?.field===s?.field&&n.context?.entityName===s?.entityName&&n.context?.entityId===s?.entityId?n:new e({value:t,cause:n,context:s})}};const Qo="AI_UnsupportedFunctionalityError",el=`vercel.ai.error.${Qo}`,tl=Symbol.for(el);var nl=class extends To{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:Qo,message:t}),this[tl]=!0,this.functionality=e}static isInstance(e){return To.hasMarker(e,el)}};function sl(e,t,n){function s(n,s){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:s,constr:i,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,s);const r=i.prototype,a=Object.keys(r);for(let e=0;e<a.length;e++){const t=a[e];t in n||(n[t]=r[t].bind(n))}}const r=n?.Parent??Object;class a extends r{}function i(e){var t;const r=n?.Parent?new a:this;s(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:s}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class rl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class al extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const il={};function ol(e){return il}function ll(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function cl(e,t){return"bigint"==typeof t?t.toString():t}function dl(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ul(e){return null==e}function hl(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const pl=Symbol("evaluating");function ml(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==pl)return void 0===s&&(s=pl,s=n()),s},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function fl(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gl(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function bl(e){return JSON.stringify(e)}const vl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yl(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const wl=dl(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function kl(e){if(!1===yl(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==yl(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Nl(e){return kl(e)?{...e}:Array.isArray(e)?[...e]:e}const xl=new Set(["string","number","symbol"]);function Sl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jl(e,t,n){const s=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(s._zod.parent=e),s}function El(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const Cl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ol(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function _l(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Il(e){return"string"==typeof e?e:e?.message}function Tl(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const r=Il(e.inst?._zod.def?.error?.(e))??Il(t?.error?.(e))??Il(n.customError?.(e))??Il(n.localeError?.(e))??"Invalid input";s.message=r}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function Al(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Pl(...e){const[t,n,s]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:s}:{...t}}const zl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,cl,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ll=sl("$ZodError",zl),Rl=sl("$ZodError",zl,{Parent:Error});const Ml=e=>(t,n,s,r)=>{const a=s?Object.assign(s,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new rl;if(i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>Tl(e,a,ol())));throw vl(t,r?.callee),t}return i.value},$l=e=>async(t,n,s,r)=>{const a=s?Object.assign(s,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(r?.Err??e)(i.issues.map(e=>Tl(e,a,ol())));throw vl(t,r?.callee),t}return i.value},Fl=e=>(t,n,s)=>{const r=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new rl;return a.issues.length?{success:!1,error:new(e??Ll)(a.issues.map(e=>Tl(e,r,ol())))}:{success:!0,data:a.value}},Dl=Fl(Rl),Vl=e=>async(t,n,s)=>{const r=s?Object.assign(s,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Tl(e,r,ol())))}:{success:!0,data:a.value}},Ul=Vl(Rl),Bl=e=>(t,n,s)=>{const r=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Ml(e)(t,n,r)},Zl=e=>(t,n,s)=>Ml(e)(t,n,s),Hl=e=>async(t,n,s)=>{const r=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return $l(e)(t,n,r)},Wl=e=>async(t,n,s)=>$l(e)(t,n,s),Kl=e=>(t,n,s)=>{const r=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Fl(e)(t,n,r)},Jl=e=>(t,n,s)=>Fl(e)(t,n,s),Gl=e=>async(t,n,s)=>{const r=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Vl(e)(t,n,r)},ql=e=>async(t,n,s)=>Vl(e)(t,n,s),Yl=/^[cC][^\s-]{8,}$/,Xl=/^[0-9a-z]+$/,Ql=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ec=/^[0-9a-vA-V]{20}$/,tc=/^[A-Za-z0-9]{27}$/,nc=/^[a-zA-Z0-9_-]{21}$/,sc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ac=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ic=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const oc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,lc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hc=/^[A-Za-z0-9_-]*$/,pc=/^\+[1-9]\d{6,14}$/,mc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",fc=new RegExp(`^${mc}$`);function gc(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const bc=/^-?\d+$/,vc=/^-?\d+(?:\.\d+)?$/,yc=/^(?:true|false)$/i,wc=/^null$/i,kc=/^[^A-Z]*$/,Nc=/^[^a-z]*$/,xc=sl("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Sc={number:"number",bigint:"bigint",object:"date"},jc=sl("$ZodCheckLessThan",(e,t)=>{xc.init(e,t);const n=Sc[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ec=sl("$ZodCheckGreaterThan",(e,t)=>{xc.init(e,t);const n=Sc[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cc=sl("$ZodCheckMultipleOf",(e,t)=>{xc.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let r=(s.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(s)){const e=s.match(/\d?e-(\d?)/);e?.[1]&&(r=Number.parseInt(e[1]))}const a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Oc=sl("$ZodCheckNumberFormat",(e,t)=>{xc.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[r,a]=Cl[t.format];e._zod.onattach.push(e=>{const s=e._zod.bag;s.format=t.format,s.minimum=r,s.maximum=a,n&&(s.pattern=bc)}),e._zod.check=i=>{const o=i.value;if(n){if(!Number.isInteger(o))return void i.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?i.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):i.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}))}o<r&&i.issues.push({origin:"number",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>a&&i.issues.push({origin:"number",input:o,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),_c=sl("$ZodCheckMaxLength",(e,t)=>{var n;xc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ul(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const s=n.value;if(s.length<=t.maximum)return;const r=Al(s);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Ic=sl("$ZodCheckMinLength",(e,t)=>{var n;xc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ul(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const s=n.value;if(s.length>=t.minimum)return;const r=Al(s);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Tc=sl("$ZodCheckLengthEquals",(e,t)=>{var n;xc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ul(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const s=n.value,r=s.length;if(r===t.length)return;const a=Al(s),i=r>t.length;n.issues.push({origin:a,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ac=sl("$ZodCheckStringFormat",(e,t)=>{var n,s;xc.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),Pc=sl("$ZodCheckRegex",(e,t)=>{Ac.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zc=sl("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kc),Ac.init(e,t)}),Lc=sl("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Nc),Ac.init(e,t)}),Rc=sl("$ZodCheckIncludes",(e,t)=>{xc.init(e,t);const n=Sl(t.includes),s=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(s)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Mc=sl("$ZodCheckStartsWith",(e,t)=>{xc.init(e,t);const n=new RegExp(`^${Sl(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),$c=sl("$ZodCheckEndsWith",(e,t)=>{xc.init(e,t);const n=new RegExp(`.*${Sl(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Fc=sl("$ZodCheckOverwrite",(e,t)=>{xc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Dc{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),s=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of s)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Vc={major:4,minor:3,patch:6},Uc=sl("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Vc;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const t of s)for(const n of t._zod.onattach)n(e);if(0===s.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let s,r=Ol(e);for(const a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,i=a._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new rl;if(s||i instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await i;e.issues.length!==t&&(r||(r=Ol(e,t)))});else{if(e.issues.length===t)continue;r||(r=Ol(e,t))}}return s?s.then(()=>e):e},n=(n,r,a)=>{if(Ol(n))return n.aborted=!0,n;const i=t(r,s,a);if(i instanceof Promise){if(!1===a.async)throw new rl;return i.then(t=>e._zod.parse(t,a))}return e._zod.parse(i,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if("backward"===a.direction){const t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}const i=e._zod.parse(r,a);if(i instanceof Promise){if(!1===a.async)throw new rl;return i.then(e=>t(e,s,a))}return t(i,s,a)}}ml(e,"~standard",()=>({validate:t=>{try{const n=Dl(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Ul(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Bc=sl("$ZodString",(e,t)=>{var n;Uc.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=String(n.value)}catch(s){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Zc=sl("$ZodStringFormat",(e,t)=>{Ac.init(e,t),Bc.init(e,t)}),Hc=sl("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rc),Zc.init(e,t)}),Wc=sl("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ac(e))}else t.pattern??(t.pattern=ac());Zc.init(e,t)}),Kc=sl("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ic),Zc.init(e,t)}),Jc=sl("$ZodURL",(e,t)=>{Zc.init(e,t),e._zod.check=n=>{try{const s=n.value.trim(),r=new URL(s);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=r.href:n.value=s)}catch(s){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Gc=sl("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Zc.init(e,t)}),qc=sl("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nc),Zc.init(e,t)}),Yc=sl("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yl),Zc.init(e,t)}),Xc=sl("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Xl),Zc.init(e,t)}),Qc=sl("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ql),Zc.init(e,t)}),ed=sl("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ec),Zc.init(e,t)}),td=sl("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tc),Zc.init(e,t)}),nd=sl("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=gc({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${mc}T(?:${s})$`)}(t)),Zc.init(e,t)}),sd=sl("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fc),Zc.init(e,t)}),rd=sl("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${gc(t)}$`)),Zc.init(e,t)}),ad=sl("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sc),Zc.init(e,t)}),id=sl("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=oc),Zc.init(e,t),e._zod.bag.format="ipv4"}),od=sl("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lc),Zc.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),ld=sl("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cc),Zc.init(e,t)}),cd=sl("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dc),Zc.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(2!==s.length)throw new Error;const[e,t]=s;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function dd(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const ud=sl("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=uc),Zc.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{dd(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const hd=sl("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=hc),Zc.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!hc.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return dd(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pd=sl("$ZodE164",(e,t)=>{t.pattern??(t.pattern=pc),Zc.init(e,t)});const md=sl("$ZodJWT",(e,t)=>{Zc.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[s]=n;if(!s)return!1;const r=JSON.parse(atob(s));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),fd=sl("$ZodNumber",(e,t)=>{Uc.init(e,t),e._zod.pattern=e._zod.bag.pattern??vc,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const r=n.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return n;const a="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...a?{received:a}:{}}),n}}),gd=sl("$ZodNumberFormat",(e,t)=>{Oc.init(e,t),fd.init(e,t)}),bd=sl("$ZodBoolean",(e,t)=>{Uc.init(e,t),e._zod.pattern=yc,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),vd=sl("$ZodNull",(e,t)=>{Uc.init(e,t),e._zod.pattern=wc,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const s=t.value;return null===s||t.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),t}}),yd=sl("$ZodUnknown",(e,t)=>{Uc.init(e,t),e._zod.parse=e=>e}),wd=sl("$ZodNever",(e,t)=>{Uc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function kd(e,t,n){e.issues.length&&t.issues.push(..._l(n,e.issues)),t.value[n]=e.value}const Nd=sl("$ZodArray",(e,t)=>{Uc.init(e,t),e._zod.parse=(n,s)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const a=[];for(let e=0;e<r.length;e++){const i=r[e],o=t.element._zod.run({value:i,issues:[]},s);o instanceof Promise?a.push(o.then(t=>kd(t,n,e))):kd(o,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function xd(e,t,n,s,r){if(e.issues.length){if(r&&!(n in s))return;t.issues.push(..._l(n,e.issues))}void 0===e.value?n in s&&(t.value[n]=void 0):t.value[n]=e.value}function Sd(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(s=e.shape,Object.keys(s).filter(e=>"optional"===s[e]._zod.optin&&"optional"===s[e]._zod.optout));var s;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function jd(e,t,n,s,r,a){const i=[],o=r.keySet,l=r.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const r in t){if(o.has(r))continue;if("never"===c){i.push(r);continue}const a=l.run({value:t[r],issues:[]},s);a instanceof Promise?e.push(a.then(e=>xd(e,n,r,t,d))):xd(a,n,r,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Ed=sl("$ZodObject",(e,t)=>{Uc.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const s=dl(()=>Sd(t));ml(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const s=e[t]._zod;if(s.values){n[t]??(n[t]=new Set);for(const e of s.values)n[t].add(e)}}return n});const r=yl,a=t.catchall;let i;e._zod.parse=(t,n)=>{i??(i=s.value);const o=t.value;if(!r(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};const l=[],c=i.shape;for(const e of i.keys){const s=c[e],r="optional"===s._zod.optout,a=s._zod.run({value:o[e],issues:[]},n);a instanceof Promise?l.push(a.then(n=>xd(n,t,e,o,r))):xd(a,t,e,o,r)}return a?jd(l,o,t,n,s.value,e):l.length?Promise.all(l).then(()=>t):t}}),Cd=sl("$ZodObjectJIT",(e,t)=>{Ed.init(e,t);const n=e._zod.parse,s=dl(()=>Sd(t));let r;const a=yl,i=!il.jitless,o=i&&wl.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=s.value);const h=d.value;return a(h)?i&&o&&!1===u?.async&&!0!==u.jitless?(r||(r=(e=>{const t=new Dc(["shape","payload","ctx"]),n=s.value,r=e=>{const t=bl(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);let i=0;for(const e of n.keys)a[e]="key_"+i++;t.write("const newResult = {};");for(const s of n.keys){const n=a[s],i=bl(s),o=e[s],l="optional"===o?._zod?.optout;t.write(`const ${n} = ${r(s)};`),l?t.write(`\n if (${n}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const o=t.compile();return(t,n)=>o(e,t,n)})(t.shape)),d=r(d,u),l?jd([],h,d,u,c,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function Od(e,t,n,s){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter(e=>!Ol(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Tl(e,s,ol())))}),t)}const _d=sl("$ZodUnion",(e,t)=>{Uc.init(e,t),ml(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ml(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ml(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ml(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>hl(e.source)).join("|")})$`)}});const n=1===t.options.length,s=t.options[0]._zod.run;e._zod.parse=(r,a)=>{if(n)return s(r,a);let i=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},a);if(t instanceof Promise)o.push(t),i=!0;else{if(0===t.issues.length)return t;o.push(t)}}return i?Promise.all(o).then(t=>Od(t,r,e,a)):Od(o,r,e,a)}}),Id=sl("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_d.init(e,t);const n=e._zod.parse;ml(e._zod,"propValues",()=>{const e={};for(const n of t.options){const s=n._zod.propValues;if(!s||0===Object.keys(s).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(s)){e[t]||(e[t]=new Set);for(const s of n)e[t].add(s)}}return e});const s=dl(()=>{const e=t.options,n=new Map;for(const s of e){const e=s._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,s)}}return n});e._zod.parse=(r,a)=>{const i=r.value;if(!yl(i))return r.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),r;const o=s.value.get(i?.[t.discriminator]);return o?o._zod.run(r,a):t.unionFallback?n(r,a):(r.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),r)}}),Td=sl("$ZodIntersection",(e,t)=>{Uc.init(e,t),e._zod.parse=(e,n)=>{const s=e.value,r=t.left._zod.run({value:s,issues:[]},n),a=t.right._zod.run({value:s,issues:[]},n);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then(([t,n])=>Pd(e,t,n)):Pd(e,r,a)}});function Ad(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(kl(e)&&kl(t)){const n=Object.keys(t),s=Object.keys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of s){const s=Ad(e[n],t[n]);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r[n]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let s=0;s<e.length;s++){const r=Ad(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};n.push(r.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pd(e,t,n){const s=new Map;let r;for(const n of t.issues)if("unrecognized_keys"===n.code){r??(r=n);for(const e of n.keys)s.has(e)||s.set(e,{}),s.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)s.has(e)||s.set(e,{}),s.get(e).r=!0;else e.issues.push(t);const a=[...s].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&r&&e.issues.push({...r,keys:a}),Ol(e))return e;const i=Ad(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const zd=sl("$ZodRecord",(e,t)=>{Uc.init(e,t),e._zod.parse=(n,s)=>{const r=n.value;if(!kl(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const a=[],i=t.keyType._zod.values;if(i){n.value={};const o=new Set;for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){o.add("number"==typeof e?e.toString():e);const i=t.valueType._zod.run({value:r[e],issues:[]},s);i instanceof Promise?a.push(i.then(t=>{t.issues.length&&n.issues.push(..._l(e,t.issues)),n.value[e]=t.value})):(i.issues.length&&n.issues.push(..._l(e,i.issues)),n.value[e]=i.value)}let l;for(const e in r)o.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:l})}else{n.value={};for(const i of Reflect.ownKeys(r)){if("__proto__"===i)continue;let o=t.keyType._zod.run({value:i,issues:[]},s);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof i&&vc.test(i)&&o.issues.length){const e=t.keyType._zod.run({value:Number(i),issues:[]},s);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(o=e)}if(o.issues.length){"loose"===t.mode?n.value[i]=r[i]:n.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>Tl(e,s,ol())),input:i,path:[i],inst:e});continue}const l=t.valueType._zod.run({value:r[i],issues:[]},s);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(..._l(i,e.issues)),n.value[o.value]=e.value})):(l.issues.length&&n.issues.push(..._l(i,l.issues)),n.value[o.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ld=sl("$ZodEnum",(e,t)=>{Uc.init(e,t);const n=ll(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(e=>xl.has(typeof e)).map(e=>"string"==typeof e?Sl(e):e.toString()).join("|")})$`),e._zod.parse=(t,r)=>{const a=t.value;return s.has(a)||t.issues.push({code:"invalid_value",values:n,input:a,inst:e}),t}}),Rd=sl("$ZodLiteral",(e,t)=>{if(Uc.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?Sl(e):e?Sl(e.toString()):String(e)).join("|")})$`),e._zod.parse=(s,r)=>{const a=s.value;return n.has(a)||s.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),s}}),Md=sl("$ZodTransform",(e,t)=>{Uc.init(e,t),e._zod.parse=(n,s)=>{if("backward"===s.direction)throw new al(e.constructor.name);const r=t.transform(n.value,n);if(s.async){return(r instanceof Promise?r:Promise.resolve(r)).then(e=>(n.value=e,n))}if(r instanceof Promise)throw new rl;return n.value=r,n}});function $d(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Fd=sl("$ZodOptional",(e,t)=>{Uc.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ml(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ml(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${hl(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const s=t.innerType._zod.run(e,n);return s instanceof Promise?s.then(t=>$d(t,e.value)):$d(s,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Dd=sl("$ZodExactOptional",(e,t)=>{Fd.init(e,t),ml(e._zod,"values",()=>t.innerType._zod.values),ml(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Vd=sl("$ZodNullable",(e,t)=>{Uc.init(e,t),ml(e._zod,"optin",()=>t.innerType._zod.optin),ml(e._zod,"optout",()=>t.innerType._zod.optout),ml(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${hl(e.source)}|null)$`):void 0}),ml(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Ud=sl("$ZodDefault",(e,t)=>{Uc.init(e,t),e._zod.optin="optional",ml(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const s=t.innerType._zod.run(e,n);return s instanceof Promise?s.then(e=>Bd(e,t)):Bd(s,t)}});function Bd(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Zd=sl("$ZodPrefault",(e,t)=>{Uc.init(e,t),e._zod.optin="optional",ml(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Hd=sl("$ZodNonOptional",(e,t)=>{Uc.init(e,t),ml(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,s)=>{const r=t.innerType._zod.run(n,s);return r instanceof Promise?r.then(t=>Wd(t,e)):Wd(r,e)}});function Wd(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Kd=sl("$ZodCatch",(e,t)=>{Uc.init(e,t),ml(e._zod,"optin",()=>t.innerType._zod.optin),ml(e._zod,"optout",()=>t.innerType._zod.optout),ml(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const s=t.innerType._zod.run(e,n);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>Tl(e,n,ol()))},input:e.value}),e.issues=[]),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>Tl(e,n,ol()))},input:e.value}),e.issues=[]),e)}}),Jd=sl("$ZodPipe",(e,t)=>{Uc.init(e,t),ml(e._zod,"values",()=>t.in._zod.values),ml(e._zod,"optin",()=>t.in._zod.optin),ml(e._zod,"optout",()=>t.out._zod.optout),ml(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const s=t.out._zod.run(e,n);return s instanceof Promise?s.then(e=>Gd(e,t.in,n)):Gd(s,t.in,n)}const s=t.in._zod.run(e,n);return s instanceof Promise?s.then(e=>Gd(e,t.out,n)):Gd(s,t.out,n)}});function Gd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const qd=sl("$ZodReadonly",(e,t)=>{Uc.init(e,t),ml(e._zod,"propValues",()=>t.innerType._zod.propValues),ml(e._zod,"values",()=>t.innerType._zod.values),ml(e._zod,"optin",()=>t.innerType?._zod?.optin),ml(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const s=t.innerType._zod.run(e,n);return s instanceof Promise?s.then(Yd):Yd(s)}});function Yd(e){return e.value=Object.freeze(e.value),e}const Xd=sl("$ZodLazy",(e,t)=>{Uc.init(e,t),ml(e._zod,"innerType",()=>t.getter()),ml(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),ml(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),ml(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),ml(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Qd=sl("$ZodCustom",(e,t)=>{xc.init(e,t),Uc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const s=n.value,r=t.fn(s);if(r instanceof Promise)return r.then(t=>eu(t,n,s,e));eu(r,n,s,e)}});function eu(e,t,n,s){if(!e){const e={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(e.params=s._zod.def.params),t.issues.push(Pl(e))}}var tu;class nu{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const s={...n,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(tu=globalThis).__zod_globalRegistry??(tu.__zod_globalRegistry=new nu);const su=globalThis.__zod_globalRegistry;function ru(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...El(t)})}function au(e,t){return new jc({check:"less_than",...El(t),value:e,inclusive:!1})}function iu(e,t){return new jc({check:"less_than",...El(t),value:e,inclusive:!0})}function ou(e,t){return new Ec({check:"greater_than",...El(t),value:e,inclusive:!1})}function lu(e,t){return new Ec({check:"greater_than",...El(t),value:e,inclusive:!0})}function cu(e,t){return new Cc({check:"multiple_of",...El(t),value:e})}function du(e,t){return new _c({check:"max_length",...El(t),maximum:e})}function uu(e,t){return new Ic({check:"min_length",...El(t),minimum:e})}function hu(e,t){return new Tc({check:"length_equals",...El(t),length:e})}function pu(e){return new Fc({check:"overwrite",tx:e})}function mu(e){const t=function(e,t){const n=new xc({check:"custom",...El(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Pl(e,n.value,t._zod.def));else{const s=e;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Pl(s))}},e(n.value,n)));return t}function fu(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??su,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function gu(e,t,n={path:[],schemaPath:[]}){var s;const r=e._zod.def,a=t.seen.get(e);if(a){a.count++;return n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema}const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const o=e._zod.toJSONSchema?.();if(o)i.schema=o;else{const s={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,s);else{const n=i.schema,a=t.processors[r.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${r.type}`);a(e,t,n,s)}const a=e._zod.parent;a&&(i.ref||(i.ref=a),gu(a,t,s),t.seen.get(a).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(i.schema,l),"input"===t.io&&yu(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((s=i.schema).default??(s.default=i.schema._prefault)),delete i.schema._prefault;return t.seen.get(e).schema}function bu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=s.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(n,t[0])}}const r=t=>{if(t[1].schema.$ref)return;const s=t[1],{ref:r,defId:a}=(t=>{const s="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,r=e.external.uri??(e=>e);if(n)return{ref:r(n)};const a=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=a,{defId:a,ref:`${r("__shared")}#/${s}/${a}`}}if(t[1]===n)return{ref:"#"};const r=`#/${s}/`,a=t[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:r+a}})(t);s.def={...s.schema},a&&(s.defId=a);const i=s.schema;for(const e in i)delete i[e];i.$ref=r};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const s=n[1];if(t===n[0]){r(n);continue}if(e.external){const s=e.external.registry.get(n[0])?.id;if(t!==n[0]&&s){r(n);continue}}const a=e.metadataRegistry.get(n[0])?.id;a?r(n):(s.cycle||s.count>1&&"ref"===e.reused)&&r(n)}}function vu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=t=>{const n=e.seen.get(t);if(null===n.ref)return;const r=n.def??n.schema,a={...r},i=n.ref;if(n.ref=null,i){s(i);const n=e.seen.get(i),o=n.schema;!o.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(r,o):(r.allOf=r.allOf??[],r.allOf.push(o)),Object.assign(r,a);if(t._zod.parent===i)for(const e in r)"$ref"!==e&&"allOf"!==e&&(e in a||delete r[e]);if(o.$ref&&n.def)for(const e in r)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(r[e])===JSON.stringify(n.def[e])&&delete r[e]}const o=t._zod.parent;if(o&&o!==i){s(o);const t=e.seen.get(o);if(t?.schema.$ref&&(r.$ref=t.schema.$ref,t.def))for(const e in r)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(r[e])===JSON.stringify(t.def[e])&&delete r[e]}e.override({zodSchema:t,jsonSchema:r,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())s(t[0]);const r={};if("draft-2020-12"===e.target?r.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?r.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(n)}Object.assign(r,n.def??n.schema);const a=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?r.$defs=a:r.definitions=a);try{const n=JSON.parse(JSON.stringify(r));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:wu(t,"input",e.processors),output:wu(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function yu(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if("transform"===s.type)return!0;if("array"===s.type)return yu(s.element,n);if("set"===s.type)return yu(s.valueType,n);if("lazy"===s.type)return yu(s.getter(),n);if("promise"===s.type||"optional"===s.type||"nonoptional"===s.type||"nullable"===s.type||"readonly"===s.type||"default"===s.type||"prefault"===s.type)return yu(s.innerType,n);if("intersection"===s.type)return yu(s.left,n)||yu(s.right,n);if("record"===s.type||"map"===s.type)return yu(s.keyType,n)||yu(s.valueType,n);if("pipe"===s.type)return yu(s.in,n)||yu(s.out,n);if("object"===s.type){for(const e in s.shape)if(yu(s.shape[e],n))return!0;return!1}if("union"===s.type){for(const e of s.options)if(yu(e,n))return!0;return!1}if("tuple"===s.type){for(const e of s.items)if(yu(e,n))return!0;return!(!s.rest||!yu(s.rest,n))}return!1}const wu=(e,t,n={})=>s=>{const{libraryOptions:r,target:a}=s??{},i=fu({...r??{},target:a,io:t,processors:n});return gu(e,i),bu(i,e),vu(i,e)},ku={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nu=(e,t,n,s)=>{const r=n;r.type="string";const{minimum:a,maximum:i,format:o,patterns:l,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(r.minLength=a),"number"==typeof i&&(r.maxLength=i),o&&(r.format=ku[o]??o,""===r.format&&delete r.format,"time"===o&&delete r.format),c&&(r.contentEncoding=c),l&&l.size>0){const e=[...l];1===e.length?r.pattern=e[0].source:e.length>1&&(r.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},xu=(e,t,n,s)=>{const r=n,{minimum:a,maximum:i,format:o,multipleOf:l,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof o&&o.includes("int")?r.type="integer":r.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=d,r.exclusiveMinimum=!0):r.exclusiveMinimum=d),"number"==typeof a&&(r.minimum=a,"number"==typeof d&&"draft-04"!==t.target&&(d>=a?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=c,r.exclusiveMaximum=!0):r.exclusiveMaximum=c),"number"==typeof i&&(r.maximum=i,"number"==typeof c&&"draft-04"!==t.target&&(c<=i?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof l&&(r.multipleOf=l)},Su=(e,t,n,s)=>{n.type="boolean"},ju=(e,t,n,s)=>{"openapi-3.0"===t.target?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Eu=(e,t,n,s)=>{n.not={}},Cu=(e,t,n,s)=>{},Ou=(e,t,n,s)=>{const r=ll(e._zod.def.entries);r.every(e=>"number"==typeof e)&&(n.type="number"),r.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=r},_u=(e,t,n,s)=>{const r=e._zod.def,a=[];for(const e of r.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(e))}else a.push(e);if(0===a.length);else if(1===a.length){const e=a[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else a.every(e=>"number"==typeof e)&&(n.type="number"),a.every(e=>"string"==typeof e)&&(n.type="string"),a.every(e=>"boolean"==typeof e)&&(n.type="boolean"),a.every(e=>null===e)&&(n.type="null"),n.enum=a},Iu=(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")},Tu=(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")},Au=(e,t,n,s)=>{const r=n,a=e._zod.def,{minimum:i,maximum:o}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof o&&(r.maxItems=o),r.type="array",r.items=gu(a.element,t,{...s,path:[...s.path,"items"]})},Pu=(e,t,n,s)=>{const r=n,a=e._zod.def;r.type="object",r.properties={};const i=a.shape;for(const e in i)r.properties[e]=gu(i[e],t,{...s,path:[...s.path,"properties",e]});const o=new Set(Object.keys(i)),l=new Set([...o].filter(e=>{const n=a.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(r.required=Array.from(l)),"never"===a.catchall?._zod.def.type?r.additionalProperties=!1:a.catchall?a.catchall&&(r.additionalProperties=gu(a.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):"output"===t.io&&(r.additionalProperties=!1)},zu=(e,t,n,s)=>{const r=e._zod.def,a=!1===r.inclusive,i=r.options.map((e,n)=>gu(e,t,{...s,path:[...s.path,a?"oneOf":"anyOf",n]}));a?n.oneOf=i:n.anyOf=i},Lu=(e,t,n,s)=>{const r=e._zod.def,a=gu(r.left,t,{...s,path:[...s.path,"allOf",0]}),i=gu(r.right,t,{...s,path:[...s.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,l=[...o(a)?a.allOf:[a],...o(i)?i.allOf:[i]];n.allOf=l},Ru=(e,t,n,s)=>{const r=n,a=e._zod.def;r.type="object";const i=a.keyType,o=i._zod.bag,l=o?.patterns;if("loose"===a.mode&&l&&l.size>0){const e=gu(a.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});r.patternProperties={};for(const t of l)r.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(r.propertyNames=gu(a.keyType,t,{...s,path:[...s.path,"propertyNames"]})),r.additionalProperties=gu(a.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const c=i._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(r.required=e)}},Mu=(e,t,n,s)=>{const r=e._zod.def,a=gu(r.innerType,t,s),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=r.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},$u=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType},Fu=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},Du=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},Vu=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);let a;t.seen.get(e).ref=r.innerType;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Uu=(e,t,n,s)=>{const r=e._zod.def,a="input"===t.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;gu(a,t,s);t.seen.get(e).ref=a},Bu=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType,n.readOnly=!0},Zu=(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType},Hu=(e,t,n,s)=>{const r=e._zod.innerType;gu(r,t,s);t.seen.get(e).ref=r},Wu={string:Nu,number:xu,boolean:Su,bigint:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")},symbol:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema")},null:ju,undefined:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")},void:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Void cannot be represented in JSON Schema")},never:Eu,any:(e,t,n,s)=>{},unknown:Cu,date:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")},enum:Ou,literal:_u,nan:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema")},template_literal:(e,t,n,s)=>{const r=n,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=a.source},file:(e,t,n,s)=>{const r=n,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:o,mime:l}=e._zod.bag;void 0!==i&&(a.minLength=i),void 0!==o&&(a.maxLength=o),l?1===l.length?(a.contentMediaType=l[0],Object.assign(r,a)):(Object.assign(r,a),r.anyOf=l.map(e=>({contentMediaType:e}))):Object.assign(r,a)},success:(e,t,n,s)=>{n.type="boolean"},custom:Iu,function:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Function types cannot be represented in JSON Schema")},transform:Tu,map:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Map cannot be represented in JSON Schema")},set:(e,t,n,s)=>{if("throw"===t.unrepresentable)throw new Error("Set cannot be represented in JSON Schema")},array:Au,object:Pu,union:zu,intersection:Lu,tuple:(e,t,n,s)=>{const r=n,a=e._zod.def;r.type="array";const i="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",l=a.items.map((e,n)=>gu(e,t,{...s,path:[...s.path,i,n]})),c=a.rest?gu(a.rest,t,{...s,path:[...s.path,o,..."openapi-3.0"===t.target?[a.items.length]:[]]}):null;"draft-2020-12"===t.target?(r.prefixItems=l,c&&(r.items=c)):"openapi-3.0"===t.target?(r.items={anyOf:l},c&&r.items.anyOf.push(c),r.minItems=l.length,c||(r.maxItems=l.length)):(r.items=l,c&&(r.additionalItems=c));const{minimum:d,maximum:u}=e._zod.bag;"number"==typeof d&&(r.minItems=d),"number"==typeof u&&(r.maxItems=u)},record:Ru,nullable:Mu,nonoptional:$u,default:Fu,prefault:Du,catch:Vu,pipe:Uu,readonly:Bu,promise:(e,t,n,s)=>{const r=e._zod.def;gu(r.innerType,t,s);t.seen.get(e).ref=r.innerType},optional:Zu,lazy:Hu};const Ku=sl("ZodISODateTime",(e,t)=>{nd.init(e,t),bh.init(e,t)});function Ju(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...El(t)})}(Ku,e)}const Gu=sl("ZodISODate",(e,t)=>{sd.init(e,t),bh.init(e,t)});function qu(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...El(t)})}(Gu,e)}const Yu=sl("ZodISOTime",(e,t)=>{rd.init(e,t),bh.init(e,t)});function Xu(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...El(t)})}(Yu,e)}const Qu=sl("ZodISODuration",(e,t)=>{ad.init(e,t),bh.init(e,t)});function eh(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...El(t)})}(Qu,e)}const th=sl("ZodError",(e,t)=>{Ll.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},s=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map(e=>s({issues:e}));else if("invalid_key"===r.code)s({issues:r.issues});else if("invalid_element"===r.code)s({issues:r.issues});else if(0===r.path.length)n._errors.push(t(r));else{let e=n,s=0;for(;s<r.path.length;){const n=r.path[s];s===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return s(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},s=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):s.push(t(r));return{formErrors:s,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,cl,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,cl,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),nh=Ml(th),sh=$l(th),rh=Fl(th),ah=Vl(th),ih=Bl(th),oh=Zl(th),lh=Hl(th),ch=Wl(th),dh=Kl(th),uh=Jl(th),hh=Gl(th),ph=ql(th),mh=sl("ZodType",(e,t)=>(Uc.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wu(e,"input"),output:wu(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const s=fu({...n,processors:t});return gu(e,s),bu(s,e),vu(s,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(gl(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>jl(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>nh(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>rh(e,t,n),e.parseAsync=async(t,n)=>sh(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ah(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ih(e,t,n),e.decode=(t,n)=>oh(e,t,n),e.encodeAsync=async(t,n)=>lh(e,t,n),e.decodeAsync=async(t,n)=>ch(e,t,n),e.safeEncode=(t,n)=>dh(e,t,n),e.safeDecode=(t,n)=>uh(e,t,n),e.safeEncodeAsync=async(t,n)=>hh(e,t,n),e.safeDecodeAsync=async(t,n)=>ph(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...El(n)})}(bp,e,t)}(t,n)),e.superRefine=t=>e.check(mu(t)),e.overwrite=t=>e.check(pu(t)),e.optional=()=>ap(e),e.exactOptional=()=>new ip({type:"optional",innerType:e}),e.nullable=()=>lp(e),e.nullish=()=>ap(lp(e)),e.nonoptional=t=>function(e,t){return new up({type:"nonoptional",innerType:e,...El(t)})}(e,t),e.array=()=>Kh(e),e.or=t=>qh([e,t]),e.and=t=>new Xh({type:"intersection",left:e,right:t}),e.transform=t=>mp(e,new sp({type:"transform",transform:t})),e.default=t=>{return n=t,new cp({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():Nl(n)}});var n},e.prefault=t=>{return n=t,new dp({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():Nl(n)}});var n},e.catch=t=>{return new hp({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>mp(e,t),e.readonly=()=>new fp({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return su.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>su.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return su.get(e);const n=e.clone();return su.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),fh=sl("_ZodString",(e,t)=>{Bc.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Nu(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Pc({check:"string_format",format:"regex",...El(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Rc({check:"string_format",format:"includes",...El(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Mc({check:"string_format",format:"starts_with",...El(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new $c({check:"string_format",format:"ends_with",...El(t),suffix:e})}(...t)),e.min=(...t)=>e.check(uu(...t)),e.max=(...t)=>e.check(du(...t)),e.length=(...t)=>e.check(hu(...t)),e.nonempty=(...t)=>e.check(uu(1,...t)),e.lowercase=t=>e.check(function(e){return new zc({check:"string_format",format:"lowercase",...El(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Lc({check:"string_format",format:"uppercase",...El(e)})}(t)),e.trim=()=>e.check(pu(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return pu(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(pu(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(pu(e=>e.toUpperCase())),e.slugify=()=>e.check(pu(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),gh=sl("ZodString",(e,t)=>{Bc.init(e,t),fh.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...El(t)})}(vh,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...El(t)})}(kh,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...El(t)})}(Rh,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...El(t)})}(Nh,t)),e.guid=t=>e.check(ru(yh,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...El(t)})}(wh,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...El(t)})}(wh,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...El(t)})}(wh,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...El(t)})}(wh,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...El(t)})}(xh,t)),e.guid=t=>e.check(ru(yh,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...El(t)})}(Sh,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...El(t)})}(jh,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...El(t)})}(Eh,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...El(t)})}(Ph,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...El(t)})}(zh,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...El(t)})}(Ch,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...El(t)})}(Oh,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...El(t)})}(_h,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...El(t)})}(Ih,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...El(t)})}(Th,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...El(t)})}(Ah,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...El(t)})}(Lh,t)),e.datetime=t=>e.check(Ju(t)),e.date=t=>e.check(qu(t)),e.time=t=>e.check(Xu(t)),e.duration=t=>e.check(eh(t))});const bh=sl("ZodStringFormat",(e,t)=>{Zc.init(e,t),fh.init(e,t)}),vh=sl("ZodEmail",(e,t)=>{Kc.init(e,t),bh.init(e,t)}),yh=sl("ZodGUID",(e,t)=>{Hc.init(e,t),bh.init(e,t)}),wh=sl("ZodUUID",(e,t)=>{Wc.init(e,t),bh.init(e,t)}),kh=sl("ZodURL",(e,t)=>{Jc.init(e,t),bh.init(e,t)}),Nh=sl("ZodEmoji",(e,t)=>{Gc.init(e,t),bh.init(e,t)}),xh=sl("ZodNanoID",(e,t)=>{qc.init(e,t),bh.init(e,t)}),Sh=sl("ZodCUID",(e,t)=>{Yc.init(e,t),bh.init(e,t)}),jh=sl("ZodCUID2",(e,t)=>{Xc.init(e,t),bh.init(e,t)}),Eh=sl("ZodULID",(e,t)=>{Qc.init(e,t),bh.init(e,t)}),Ch=sl("ZodXID",(e,t)=>{ed.init(e,t),bh.init(e,t)}),Oh=sl("ZodKSUID",(e,t)=>{td.init(e,t),bh.init(e,t)}),_h=sl("ZodIPv4",(e,t)=>{id.init(e,t),bh.init(e,t)}),Ih=sl("ZodIPv6",(e,t)=>{od.init(e,t),bh.init(e,t)}),Th=sl("ZodCIDRv4",(e,t)=>{ld.init(e,t),bh.init(e,t)}),Ah=sl("ZodCIDRv6",(e,t)=>{cd.init(e,t),bh.init(e,t)}),Ph=sl("ZodBase64",(e,t)=>{ud.init(e,t),bh.init(e,t)}),zh=sl("ZodBase64URL",(e,t)=>{hd.init(e,t),bh.init(e,t)}),Lh=sl("ZodE164",(e,t)=>{pd.init(e,t),bh.init(e,t)}),Rh=sl("ZodJWT",(e,t)=>{md.init(e,t),bh.init(e,t)}),Mh=sl("ZodNumber",(e,t)=>{fd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>xu(e,t,n),e.gt=(t,n)=>e.check(ou(t,n)),e.gte=(t,n)=>e.check(lu(t,n)),e.min=(t,n)=>e.check(lu(t,n)),e.lt=(t,n)=>e.check(au(t,n)),e.lte=(t,n)=>e.check(iu(t,n)),e.max=(t,n)=>e.check(iu(t,n)),e.int=t=>e.check(Fh(t)),e.safe=t=>e.check(Fh(t)),e.positive=t=>e.check(ou(0,t)),e.nonnegative=t=>e.check(lu(0,t)),e.negative=t=>e.check(au(0,t)),e.nonpositive=t=>e.check(iu(0,t)),e.multipleOf=(t,n)=>e.check(cu(t,n)),e.step=(t,n)=>e.check(cu(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});const $h=sl("ZodNumberFormat",(e,t)=>{gd.init(e,t),Mh.init(e,t)});function Fh(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...El(t)})}($h,e)}const Dh=sl("ZodBoolean",(e,t)=>{bd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Su(0,0,t)});const Vh=sl("ZodNull",(e,t)=>{vd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>ju(0,e,t)});const Uh=sl("ZodUnknown",(e,t)=>{yd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function Bh(){return new Uh({type:"unknown"})}const Zh=sl("ZodNever",(e,t)=>{wd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Eu(0,0,t)});function Hh(e){return function(e,t){return new e({type:"never",...El(t)})}(Zh,e)}const Wh=sl("ZodArray",(e,t)=>{Nd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Au(e,t,n,s),e.element=t.element,e.min=(t,n)=>e.check(uu(t,n)),e.nonempty=t=>e.check(uu(1,t)),e.max=(t,n)=>e.check(du(t,n)),e.length=(t,n)=>e.check(hu(t,n)),e.unwrap=()=>e.element});function Kh(e,t){return function(e,t,n){return new e({type:"array",element:t,...El(n)})}(Wh,e,t)}const Jh=sl("ZodObject",(e,t)=>{Cd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Pu(e,t,n,s),ml(e,"shape",()=>t.shape),e.keyof=()=>tp(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bh()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bh()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hh()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!kl(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=gl(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return fl(this,"shape",n),n}});return jl(e,s)}(e,t),e.safeExtend=t=>function(e,t){if(!kl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=gl(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return fl(this,"shape",n),n}});return jl(e,n)}(e,t),e.merge=t=>function(e,t){const n=gl(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return fl(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return jl(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return jl(e,gl(e._zod.def,{get shape(){const e={};for(const s in t){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(e[s]=n.shape[s])}return fl(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=gl(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete s[e]}return fl(this,"shape",s),s},checks:[]});return jl(e,r)}(e,t),e.partial=(...t)=>function(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=gl(t._zod.def,{get shape(){const s=t._zod.def.shape,r={...s};if(n)for(const t in n){if(!(t in s))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:s[t]}):s[t])}else for(const t in s)r[t]=e?new e({type:"optional",innerType:s[t]}):s[t];return fl(this,"shape",r),r},checks:[]});return jl(t,r)}(rp,e,t[0]),e.required=(...t)=>function(e,t,n){const s=gl(t._zod.def,{get shape(){const s=t._zod.def.shape,r={...s};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:s[t]}))}else for(const t in s)r[t]=new e({type:"nonoptional",innerType:s[t]});return fl(this,"shape",r),r}});return jl(t,s)}(up,e,t[0])});const Gh=sl("ZodUnion",(e,t)=>{_d.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>zu(e,t,n,s),e.options=t.options});function qh(e,t){return new Gh({type:"union",options:e,...El(t)})}const Yh=sl("ZodDiscriminatedUnion",(e,t)=>{Gh.init(e,t),Id.init(e,t)});const Xh=sl("ZodIntersection",(e,t)=>{Td.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Lu(e,t,n,s)});const Qh=sl("ZodRecord",(e,t)=>{zd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Ru(e,t,n,s),e.keyType=t.keyType,e.valueType=t.valueType});const ep=sl("ZodEnum",(e,t)=>{Ld.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Ou(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,s)=>{const r={};for(const s of e){if(!n.has(s))throw new Error(`Key ${s} not found in enum`);r[s]=t.entries[s]}return new ep({...t,checks:[],...El(s),entries:r})},e.exclude=(e,s)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new ep({...t,checks:[],...El(s),entries:r})}});function tp(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ep({type:"enum",entries:n,...El(t)})}const np=sl("ZodLiteral",(e,t)=>{Rd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>_u(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});const sp=sl("ZodTransform",(e,t)=>{Md.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Tu(0,e),e._zod.parse=(n,s)=>{if("backward"===s.direction)throw new al(e.constructor.name);n.addIssue=s=>{if("string"==typeof s)n.issues.push(Pl(s,n.value,t));else{const t=s;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Pl(t))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(e=>(n.value=e,n)):(n.value=r,n)}});const rp=sl("ZodOptional",(e,t)=>{Fd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Zu(e,t,0,s),e.unwrap=()=>e._zod.def.innerType});function ap(e){return new rp({type:"optional",innerType:e})}const ip=sl("ZodExactOptional",(e,t)=>{Dd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Zu(e,t,0,s),e.unwrap=()=>e._zod.def.innerType});const op=sl("ZodNullable",(e,t)=>{Vd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Mu(e,t,n,s),e.unwrap=()=>e._zod.def.innerType});function lp(e){return new op({type:"nullable",innerType:e})}const cp=sl("ZodDefault",(e,t)=>{Ud.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Fu(e,t,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const dp=sl("ZodPrefault",(e,t)=>{Zd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Du(e,t,n,s),e.unwrap=()=>e._zod.def.innerType});const up=sl("ZodNonOptional",(e,t)=>{Hd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>$u(e,t,0,s),e.unwrap=()=>e._zod.def.innerType});const hp=sl("ZodCatch",(e,t)=>{Kd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Vu(e,t,n,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const pp=sl("ZodPipe",(e,t)=>{Jd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Uu(e,t,0,s),e.in=t.in,e.out=t.out});function mp(e,t){return new pp({type:"pipe",in:e,out:t})}const fp=sl("ZodReadonly",(e,t)=>{qd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Bu(e,t,n,s),e.unwrap=()=>e._zod.def.innerType});const gp=sl("ZodLazy",(e,t)=>{Xd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(t,n,s)=>Hu(e,t,0,s),e.unwrap=()=>e._zod.def.getter()});const bp=sl("ZodCustom",(e,t)=>{Qd.init(e,t),mh.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Iu(0,e)});class vp extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const yp=32;function wp(e){}function kp(e){if("function"==typeof e)throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=wp,onError:n=wp,onRetry:s=wp,onComment:r,maxBufferSize:a}=e,i=[];let o,l,c=0,d=!0,u="",h=0,p=!1;function m(){void 0!==a&&(c+u.length<=a||(p=!0,i.length=0,c=0,o=void 0,u="",h=0,l=void 0,n(new vp(`Buffered data exceeded max buffer size of ${a} characters`,{type:"max-buffer-size-exceeded"}))))}function f(e){let n=0;if(-1===e.indexOf("\r")){let s=e.indexOf("\n",n);for(;-1!==s;){if(n===s){h>0&&t({id:o,event:l,data:u}),o=void 0,u="",h=0,l=void 0,n=s+1,s=e.indexOf("\n",n);continue}const r=e.charCodeAt(n);if(Np(e,n,r)){const r=e.charCodeAt(n+5)===yp?n+6:n+5,a=e.slice(r,s);if(0===h&&10===e.charCodeAt(s+1)){t({id:o,event:l,data:a}),o=void 0,u="",l=void 0,n=s+2,s=e.indexOf("\n",n);continue}u=0===h?a:`${u}\n${a}`,h++}else xp(e,n,r)?l=e.slice(e.charCodeAt(n+6)===yp?n+7:n+6,s)||void 0:g(e,n,s);n=s+1,s=e.indexOf("\n",n)}return e.slice(n)}for(;n<e.length;){const t=e.indexOf("\r",n),s=e.indexOf("\n",n);let r=-1;if(-1!==t&&-1!==s?r=t<s?t:s:-1!==t?r=t===e.length-1?-1:t:-1!==s&&(r=s),-1===r)break;g(e,n,r),n=r+1,13===e.charCodeAt(n-1)&&10===e.charCodeAt(n)&&n++}return e.slice(n)}function g(e,n,s){if(n===s)return h>0&&t({id:o,event:l,data:u}),o=void 0,u="",h=0,void(l=void 0);const a=e.charCodeAt(n);if(Np(e,n,a)){const t=e.charCodeAt(n+5)===yp?n+6:n+5,r=e.slice(t,s);return u=0===h?r:`${u}\n${r}`,void h++}if(xp(e,n,a))return void(l=e.slice(e.charCodeAt(n+6)===yp?n+7:n+6,s)||void 0);if(105===a&&100===e.charCodeAt(n+1)&&58===e.charCodeAt(n+2)){const t=e.slice(e.charCodeAt(n+3)===yp?n+4:n+3,s);return void(t.includes("\0")||(o=t))}if(58===a){if(r){const t=e.slice(n,s);r(t.slice(e.charCodeAt(n+1)===yp?2:1))}return}const i=e.slice(n,s),c=i.indexOf(":");if(-1===c)return void b(i,"",i);const d=i.slice(0,c),p=i.charCodeAt(c+1)===yp?2:1;b(d,i.slice(c+p),i)}function b(e,t,r){switch(e){case"event":l=t||void 0;break;case"data":u=0===h?t:`${u}\n${t}`,h++;break;case"id":t.includes("\0")||(o=t);break;case"retry":/^\d+$/.test(t)?s(parseInt(t,10)):n(new vp(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:r}));break;default:n(new vp(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:t,line:r}))}}return{feed:function(e){if(p)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(d&&(d=!1,239===e.charCodeAt(0)&&187===e.charCodeAt(1)&&191===e.charCodeAt(2)&&(e=e.slice(3))),0===i.length){const t=f(e);return""!==t&&(i.push(t),c=t.length),void m()}if(-1===e.indexOf("\n")&&-1===e.indexOf("\r"))return i.push(e),c+=e.length,void m();i.push(e);const t=i.join("");i.length=0,c=0;const n=f(t);""!==n&&(i.push(n),c=n.length),m()},reset:function(e={}){if(e.consume&&i.length>0){const e=i.join("");g(e,0,e.length)}d=!0,o=void 0,u="",h=0,l=void 0,i.length=0,c=0,p=!1}}}function Np(e,t,n){return 100===n&&97===e.charCodeAt(t+1)&&116===e.charCodeAt(t+2)&&97===e.charCodeAt(t+3)&&58===e.charCodeAt(t+4)}function xp(e,t,n){return 101===n&&118===e.charCodeAt(t+1)&&101===e.charCodeAt(t+2)&&110===e.charCodeAt(t+3)&&116===e.charCodeAt(t+4)&&58===e.charCodeAt(t+5)}class Sp extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,maxBufferSize:s}={}){let r;super({start(a){r=kp({onEvent:e=>{a.enqueue(e)},onError(t){"function"==typeof e&&e(t),("terminate"===e||"max-buffer-size-exceeded"===t.type)&&a.error(t)},onRetry:t,onComment:n,maxBufferSize:s})},transform(e){r.feed(e)}})}}function jp(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,s]of e)null!=s&&(t[n.toLowerCase()]=s)}return t}new TextDecoder;const Ep=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const e=n.length,s=new Array(t);for(let r=0;r<t;r++)s[r]=n[Math.random()*e|0];return s.join("")};if(null==e)return r;if(n.includes(s))throw new Zo({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${n}".`});return()=>`${e}${s}${r()}`},Cp=Ep();const Op=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,_p=/"(?: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*:/;function Ip(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===Op.test(e)&&!1===_p.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const n of e){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&null!==n.constructor&&"object"==typeof n.constructor&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in n){const s=n[e];s&&"object"==typeof s&&t.push(s)}}}return e}(t)}function Tp(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){const{additionalProperties:t}=e;e.additionalProperties=null!=t&&"boolean"!=typeof t&&Ap(t);const{properties:n}=e;if(null!=n)for(const e of Object.keys(n))n[e]=Ap(n[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(Ap):Ap(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(Ap)),null!=e.allOf&&(e.allOf=e.allOf.map(Ap)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(Ap));const{definitions:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=Ap(t[e]);return e}function Ap(e){return"boolean"==typeof e?e:Tp(e)}const Pp=Symbol("Let zodToJsonSchema decide on which parser to use"),zp={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};function Lp(e,t){return cm(e.type._def,t)}function Rp(e,t,n){const s=n??t.dateStrategy;if(Array.isArray(s))return{anyOf:s.map(n=>Rp(e,t,n))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Mp(e)}}const Mp=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value}return t};let $p;const Fp=/^[cC][^\s-]{8,}$/,Dp=/^[0-9a-z]+$/,Vp=/^[0-9A-HJKMNP-TV-Z]{26}$/,Up=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,Bp=()=>(void 0===$p&&($p=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$p),Zp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Hp=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wp=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kp=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jp=/^[a-zA-Z0-9_-]{21}$/,Gp=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function qp(e,t){const n={type:"string"};if(e.checks)for(const s of e.checks)switch(s.kind){case"min":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,s.value):s.value;break;case"max":n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,s.value):s.value;break;case"email":switch(t.emailStrategy){case"format:email":Qp(n,"email",s.message,t);break;case"format:idn-email":Qp(n,"idn-email",s.message,t);break;case"pattern:zod":em(n,Up,s.message,t)}break;case"url":Qp(n,"uri",s.message,t);break;case"uuid":Qp(n,"uuid",s.message,t);break;case"regex":em(n,s.regex,s.message,t);break;case"cuid":em(n,Fp,s.message,t);break;case"cuid2":em(n,Dp,s.message,t);break;case"startsWith":em(n,RegExp(`^${Yp(s.value,t)}`),s.message,t);break;case"endsWith":em(n,RegExp(`${Yp(s.value,t)}$`),s.message,t);break;case"datetime":Qp(n,"date-time",s.message,t);break;case"date":Qp(n,"date",s.message,t);break;case"time":Qp(n,"time",s.message,t);break;case"duration":Qp(n,"duration",s.message,t);break;case"length":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,s.value):s.value,n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,s.value):s.value;break;case"includes":em(n,RegExp(Yp(s.value,t)),s.message,t);break;case"ip":"v6"!==s.version&&Qp(n,"ipv4",s.message,t),"v4"!==s.version&&Qp(n,"ipv6",s.message,t);break;case"base64url":em(n,Kp,s.message,t);break;case"jwt":em(n,Gp,s.message,t);break;case"cidr":"v6"!==s.version&&em(n,Zp,s.message,t),"v4"!==s.version&&em(n,Hp,s.message,t);break;case"emoji":em(n,Bp(),s.message,t);break;case"ulid":em(n,Vp,s.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Qp(n,"binary",s.message,t);break;case"contentEncoding:base64":n.contentEncoding="base64";break;case"pattern:zod":em(n,Wp,s.message,t)}break;case"nanoid":em(n,Jp,s.message,t)}return n}function Yp(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)Xp.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}const Xp=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Qp(e,t,n,s){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&s.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function em(e,t,n,s){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:tm(t,s),...n&&s.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=tm(t,s)}function tm(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const n=e.flags.includes("i"),s=e.flags.includes("m"),r=e.flags.includes("s"),a=n?e.source.toLowerCase():e.source;let i="",o=!1,l=!1,c=!1;for(let e=0;e<a.length;e++)if(o)i+=a[e],o=!1;else{if(n)if(l){if(a[e].match(/[a-z]/)){c?(i+=a[e],i+=`${a[e-2]}-${a[e]}`.toUpperCase(),c=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(i+=a[e],c=!0):i+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){i+=`[${a[e]}${a[e].toUpperCase()}]`;continue}if(s){if("^"===a[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===a[e]){i+="($|(?=[\r\n]))";continue}}r&&"."===a[e]?i+=l?`${a[e]}\r\n`:`[${a[e]}\r\n]`:(i+=a[e],"\\"===a[e]?o=!0:l&&"]"===a[e]?l=!1:l||"["!==a[e]||(l=!0))}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function nm(e,t){const n={type:"object",additionalProperties:cm(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("ZodString"===e.keyType?._def.typeName&&e.keyType._def.checks?.length){const{type:s,...r}=qp(e.keyType._def,t);return{...n,propertyNames:r}}if("ZodEnum"===e.keyType?._def.typeName)return{...n,propertyNames:{enum:e.keyType._def.values}};if("ZodBranded"===e.keyType?._def.typeName&&"ZodString"===e.keyType._def.type._def.typeName&&e.keyType._def.type._def.checks?.length){const{type:s,...r}=Lp(e.keyType._def,t);return{...n,propertyNames:r}}return n}const sm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const rm=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>cm(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function am(e,t){const n={type:"object",properties:{}},s=[],r=e.shape();for(const e in r){let a=r[e];if(void 0===a||void 0===a._def)continue;const i=im(a),o=cm(a._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==o&&(n.properties[e]=o,i||s.push(e))}s.length&&(n.required=s);const a=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return cm(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==a&&(n.additionalProperties=a),n}function im(e){try{return e.isOptional()}catch{return!0}}const om=(e,t,n)=>{switch(t){case"ZodString":return qp(e,n);case"ZodNumber":return function(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case"ZodObject":return am(e,n);case"ZodBigInt":return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case"ZodBoolean":return{type:"boolean"};case"ZodDate":return Rp(e,n);case"ZodUndefined":case"ZodNaN":case"ZodNever":return{not:{}};case"ZodNull":return{type:"null"};case"ZodArray":return function(e,t){const n={type:"array"};return e.type?._def&&"ZodAny"!==e.type?._def?.typeName&&(n.items=cm(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}(e,n);case"ZodUnion":case"ZodDiscriminatedUnion":return function(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in sm&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=sm[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return rm(e,t)}(e,n);case"ZodIntersection":return function(e,t){const n=[cm(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),cm(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e),s=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...s}=e;t=s}s.push(t)}else s.push(...e.allOf);var t}),s.length?{allOf:s}:void 0}(e,n);case"ZodTuple":return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>cm(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:cm(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>cm(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case"ZodRecord":return nm(e,n);case"ZodLiteral":return function(e){const t=typeof e.value;return"bigint"!==t&&"number"!==t&&"boolean"!==t&&"string"!==t?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===t?"integer":t,const:e.value}}(e);case"ZodEnum":return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case"ZodNativeEnum":return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),s=Array.from(new Set(n.map(e=>typeof e)));return{type:1===s.length?"string"===s[0]?"string":"number":["string","number"],enum:n}}(e);case"ZodNullable":return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[sm[e.innerType._def.typeName],"null"]};const n=cm(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case"ZodOptional":return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return cm(e.innerType._def,t);const n=cm(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:{}},n]}:{}})(e,n);case"ZodMap":return function(e,t){return"record"===t.mapStrategy?nm(e,t):{type:"array",maxItems:125,items:{type:"array",items:[cm(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},cm(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,n);case"ZodSet":return function(e,t){const n={type:"array",uniqueItems:!0,items:cm(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}(e,n);case"ZodLazy":return()=>e.getter()._def;case"ZodPromise":return function(e,t){return cm(e.type._def,t)}(e,n);case"ZodEffects":return function(e,t){return"input"===t.effectStrategy?cm(e.schema._def,t):{}}(e,n);case"ZodAny":case"ZodUnknown":return{};case"ZodDefault":return function(e,t){return{...cm(e.innerType._def,t),default:e.defaultValue()}}(e,n);case"ZodBranded":return Lp(e,n);case"ZodReadonly":case"ZodCatch":return((e,t)=>cm(e.innerType._def,t))(e,n);case"ZodPipeline":return((e,t)=>{if("input"===t.pipeStrategy)return cm(e.in._def,t);if("output"===t.pipeStrategy)return cm(e.out._def,t);const n=cm(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,cm(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);default:return}},lm=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function cm(e,t,n=!1){const s=t.seen.get(e);if(t.override){const r=t.override?.(e,t,s,n);if(r!==Pp)return r}if(s&&!n){const e=dm(s,t);if(void 0!==e)return e}const r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);const a=om(e,e.typeName,t),i="function"==typeof a?cm(a(),t):a;if(i&&um(e,t,i),t.postProcess){const n=t.postProcess(i,e,t);return r.jsonSchema=i,n}return r.jsonSchema=i,i}const dm=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:lm(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},um=(e,t,n)=>(e.description&&(n.description=e.description),n),hm=e=>{const t=(e=>"string"==typeof e?{...zp,name:e}:{...zp,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},pm=Symbol.for("vercel.ai.schema");function mm(e,{validate:t}={}){return{[pm]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function fm(e){return null==e?mm({type:"object",properties:{},additionalProperties:!1}):"object"==typeof(t=e)&&null!==t&&pm in t&&!0===t[pm]&&"jsonSchema"in t&&"validate"in t?e:"~standard"in e?"zod"===e["~standard"].vendor?vm(e):function(e){return mm(()=>{if(!function(e){return null!=e["~standard"].jsonSchema}(e))throw new Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);return Tp(e["~standard"].jsonSchema.input({target:"draft-07"}))},{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Xo({value:t,cause:n.issues})}}})}(e):e();var t}function gm(e,t){return mm(()=>((e,t)=>{const n=hm(t);let s="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,s])=>({...e,[t]:cm(s._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??{}}),{}):void 0;const r="string"==typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,a=cm(e._def,void 0===r?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(a.title=i);const o=void 0===r?s?{...a,[n.definitionPath]:s}:a:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...s,[r]:a}};return o.$schema="http://json-schema.org/draft-07/schema#",o})(e,{$refStrategy:"none"}),{validate:async t=>{const n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function bm(e,t){return mm(()=>Tp(function(e,t){if("_idmap"in e){const n=e,s=fu({...t,processors:Wu}),r={};for(const e of n._idmap.entries()){const[t,n]=e;gu(n,s)}const a={},i={registry:n,uri:t?.uri,defs:r};s.external=i;for(const e of n._idmap.entries()){const[t,n]=e;bu(s,n),a[t]=vu(s,n)}if(Object.keys(r).length>0){const e="draft-2020-12"===s.target?"$defs":"definitions";a.__shared={[e]:r}}return{schemas:a}}const n=fu({...t,processors:Wu});return gu(e,n),bu(n,e),vu(n,e)}(e,{target:"draft-7",io:"input",reused:"inline"})),{validate:async t=>{const n=await ah(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function vm(e,t){return function(e){return"_zod"in e}(e)?bm(e):gm(e)}async function ym({value:e,schema:t,context:n}){const s=await wm({value:e,schema:t,context:n});if(!s.success)throw Xo.wrap({value:e,cause:s.error,context:n});return s.value}async function wm({value:e,schema:t,context:n}){const s=fm(t);try{if(null==s.validate)return{success:!0,value:e,rawValue:e};const t=await s.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:Xo.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Xo.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function km({text:e,schema:t}){try{const n=function(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Ip(e)}try{return Ip(e)}finally{Error.stackTraceLimit=t}}(e);return null==t?{success:!0,value:n,rawValue:n}:await wm({value:n,schema:t})}catch(t){return{success:!1,error:Jo.isInstance(t)?t:new Jo({text:e,cause:t}),rawValue:void 0}}}async function Nm(e){return"function"==typeof e&&(e=e()),e}new TextDecoder;var xm="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Sm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const jm="AI_InvalidArgumentError",Em=`vercel.ai.error.${jm}`,Cm=Symbol.for(Em);var Om=class extends To{constructor({parameter:e,value:t,message:n}){super({name:jm,message:`Invalid argument for parameter ${e}: ${n}`}),this[Cm]=!0,this.parameter=e,this.value=t}static isInstance(e){return To.hasMarker(e,Em)}};const _m="AI_UIMessageStreamError",Im=`vercel.ai.error.${_m}`,Tm=Symbol.for(Im);var Am=class extends To{constructor({chunkType:e,chunkId:t,message:n}){super({name:_m,message:n}),this[Tm]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return To.hasMarker(e,Im)}};function Pm(e,t){if(void 0===e&&void 0===t)return;if(void 0===e)return t;if(void 0===t)return e;const n={...e};for(const s in t)if("__proto__"!==s&&"constructor"!==s&&"prototype"!==s&&Object.prototype.hasOwnProperty.call(t,s)){const r=t[s];if(void 0===r)continue;const a=s in e?e[s]:void 0,i=!(null===r||"object"!=typeof r||Array.isArray(r)||r instanceof Date||r instanceof RegExp),o=!(null==a||"object"!=typeof a||Array.isArray(a)||a instanceof Date||a instanceof RegExp);n[s]=i&&o?Pm(a,r):r}return n}function zm(e){const t=["ROOT"];let n=-1,s=null,r=0;function a(e){return e>="0"&&e<="9"||e>="A"&&e<="F"||e>="a"&&e<="f"}function i(e,r,a){switch(e){case'"':n=r,t.pop(),t.push(a),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=r,s=r,t.pop(),t.push(a),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=r,t.pop(),t.push(a),t.push("INSIDE_NUMBER");break;case"{":n=r,t.pop(),t.push(a),t.push("INSIDE_OBJECT_START");break;case"[":n=r,t.pop(),t.push(a),t.push("INSIDE_ARRAY_START")}}function o(e,s){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=s,t.pop()}}function l(e,s){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=s,t.pop()}}for(let c=0;c<e.length;c++){const d=e[c];switch(t[t.length-1]){case"ROOT":i(d,c,"FINISH");break;case"INSIDE_OBJECT_START":switch(d){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=c,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":if('"'===d)t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"INSIDE_OBJECT_KEY":if('"'===d)t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break;case"INSIDE_OBJECT_AFTER_KEY":if(":"===d)t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break;case"INSIDE_OBJECT_BEFORE_VALUE":i(d,c,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":o(d,c);break;case"INSIDE_STRING":switch(d){case'"':t.pop(),n=c;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=c}break;case"INSIDE_ARRAY_START":if("]"===d)n=c,t.pop();else i(d,c,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_ARRAY_AFTER_VALUE":switch(d){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=c,t.pop();break;default:n=c}break;case"INSIDE_ARRAY_AFTER_COMMA":i(d,c,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),"u"===d?(r=0,t.push("INSIDE_STRING_UNICODE_ESCAPE")):n=c;break;case"INSIDE_STRING_UNICODE_ESCAPE":a(d)&&(r++,4===r&&(t.pop(),n=c));break;case"INSIDE_NUMBER":switch(d){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=c;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&l(d,c),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(d,c);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&o(d,c);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&l(d,c);break;default:t.pop()}break;case"INSIDE_LITERAL":{const r=e.substring(s,c+1);"false".startsWith(r)||"true".startsWith(r)||"null".startsWith(r)?n=c:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?o(d,c):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&l(d,c));break}}}let c=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{const t=e.substring(s,e.length);"true".startsWith(t)?c+="true".slice(t.length):"false".startsWith(t)?c+="false".slice(t.length):"null".startsWith(t)&&(c+="null".slice(t.length))}}return c}Ep({prefix:"steer",size:24}),new TextEncoder,new TextEncoder,Ep({prefix:"aitxt",size:24}),Ep({prefix:"call",size:24}),TransformStream;const Lm={array:Kh,boolean:function(e){return function(e,t){return new e({type:"boolean",...El(t)})}(Dh,e)},custom:function(e,t){return function(e,t,n){const s=El(n);return s.abort??(s.abort=!0),new e({type:"custom",check:"custom",fn:t,...s})}(bp,e??(()=>!0),t)},discriminatedUnion:function(e,t,n){return new Yh({type:"union",options:t,discriminator:e,...El(n)})},enum:tp,instanceof:function(e,t={}){const n=new bp({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...El(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n},lazy:function(e){return new gp({type:"lazy",getter:e})},literal:function(e,t){return new np({type:"literal",values:Array.isArray(e)?e:[e],...El(t)})},looseObject:function(e,t){return new Jh({type:"object",shape:e,catchall:Bh(),...El(t)})},never:Hh,null:function(e){return function(e,t){return new e({type:"null",...El(t)})}(Vh,e)},number:function(e){return function(e,t){return new e({type:"number",checks:[],...El(t)})}(Mh,e)},object:function(e,t){const n={type:"object",shape:e??{},...El(t)};return new Jh(n)},record:function(e,t,n){return new Qh({type:"record",keyType:e,valueType:t,...El(n)})},string:function(e){return function(e,t){return new e({type:"string",...El(t)})}(gh,e)},union:qh,unknown:Bh},Rm=Lm.lazy(()=>Lm.union([Lm.null(),Lm.string(),Lm.number(),Lm.boolean(),Lm.record(Lm.string(),Rm.optional()),Lm.array(Rm)])),Mm=Lm.record(Lm.string(),Lm.record(Lm.string(),Rm.optional())),$m=Lm.object({source:Lm.discriminatedUnion("sourceType",[Lm.object({type:Lm.literal("source"),sourceType:Lm.literal("url"),id:Lm.string(),url:Lm.string(),title:Lm.string().optional(),providerMetadata:Mm.optional()}),Lm.object({type:Lm.literal("source"),sourceType:Lm.literal("document"),id:Lm.string(),mediaType:Lm.string(),title:Lm.string(),filename:Lm.string().optional(),providerMetadata:Mm.optional()})]),startIndex:Lm.number().int().nonnegative().optional(),endIndex:Lm.number().int().nonnegative().optional(),citedText:Lm.string().optional()}),Fm=Lm.record(Lm.string(),Rm.optional()),Dm=function(e){let t;return()=>(null==t&&(t=e()),t)}(()=>vm(Lm.union([Lm.looseObject({type:Lm.literal("text-start"),id:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("text-delta"),id:Lm.string(),delta:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("text-end"),id:Lm.string(),citations:Lm.array($m).optional(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("error"),errorText:Lm.string()}),Lm.looseObject({type:Lm.literal("tool-input-start"),toolCallId:Lm.string(),toolName:Lm.string(),inputEncoding:Lm.enum(["json","text"]).optional(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional(),toolMetadata:Fm.optional(),dynamic:Lm.boolean().optional(),title:Lm.string().optional()}),Lm.looseObject({type:Lm.literal("tool-input-delta"),toolCallId:Lm.string(),inputTextDelta:Lm.string()}),Lm.looseObject({type:Lm.literal("tool-input-available"),toolCallId:Lm.string(),toolName:Lm.string(),input:Lm.unknown(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional(),toolMetadata:Fm.optional(),dynamic:Lm.boolean().optional(),title:Lm.string().optional()}),Lm.looseObject({type:Lm.literal("tool-input-error"),toolCallId:Lm.string(),toolName:Lm.string(),input:Lm.unknown(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional(),toolMetadata:Fm.optional(),dynamic:Lm.boolean().optional(),errorText:Lm.string(),title:Lm.string().optional()}),Lm.looseObject({type:Lm.literal("tool-approval-request"),approvalId:Lm.string(),toolCallId:Lm.string(),approvalDescriptor:Lm.unknown().optional(),inputSchemaInput:Lm.unknown().optional(),reason:Lm.string().optional(),isAutomatic:Lm.boolean().optional(),signature:Lm.string().optional()}),Lm.looseObject({type:Lm.literal("tool-approval-response"),approvalId:Lm.string(),approved:Lm.boolean(),reason:Lm.string().optional(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("tool-output-available"),toolCallId:Lm.string(),output:Lm.unknown(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional(),toolMetadata:Fm.optional(),dynamic:Lm.boolean().optional(),preliminary:Lm.boolean().optional()}),Lm.looseObject({type:Lm.literal("tool-output-error"),toolCallId:Lm.string(),errorText:Lm.string(),providerExecuted:Lm.boolean().optional(),providerMetadata:Mm.optional(),toolMetadata:Fm.optional(),dynamic:Lm.boolean().optional()}),Lm.looseObject({type:Lm.literal("tool-output-denied"),toolCallId:Lm.string()}),Lm.looseObject({type:Lm.literal("reasoning-start"),id:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("reasoning-delta"),id:Lm.string(),delta:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("reasoning-end"),id:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("custom"),kind:Lm.string().transform(e=>e),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("source-url"),sourceId:Lm.string(),url:Lm.string(),title:Lm.string().optional(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("source-document"),sourceId:Lm.string(),mediaType:Lm.string(),title:Lm.string(),filename:Lm.string().optional(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("file"),url:Lm.string(),mediaType:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.literal("reasoning-file"),url:Lm.string(),mediaType:Lm.string(),providerMetadata:Mm.optional()}),Lm.looseObject({type:Lm.custom(e=>"string"==typeof e&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:Lm.string().optional(),data:Lm.unknown(),transient:Lm.boolean().optional()}),Lm.looseObject({type:Lm.literal("start-step")}),Lm.looseObject({type:Lm.literal("finish-step")}),Lm.looseObject({type:Lm.literal("reset-step")}),Lm.looseObject({type:Lm.literal("start"),messageId:Lm.string().optional(),messageMetadata:Lm.unknown().optional()}),Lm.looseObject({type:Lm.literal("finish"),finishReason:Lm.enum(["stop","length","content-filter","tool-calls","error","interrupted","other"]).optional(),messageMetadata:Lm.unknown().optional()}),Lm.looseObject({type:Lm.literal("abort"),reason:Lm.string().optional()}),Lm.looseObject({type:Lm.literal("message-metadata"),messageMetadata:Lm.unknown()})])));function Vm(){return Object.create(null)}function Um(e){return e.type.startsWith("tool-")}function Bm(e){return Um(e)||function(e){return"dynamic-tool"===e.type}(e)}function Zm(e){return e.type.split("-").slice(1).join("-")}function Hm({lastMessage:e,messageId:t}){const n="assistant"===e?.role?e:{id:t,metadata:void 0,role:"assistant",parts:[]},s=Vm(),r=n.parts.findLastIndex(e=>"step-start"===e.type);let a=0;for(const e of n.parts.slice(r+1)){if(!Bm(e))continue;const t=a;Um(e)&&a++,"input-streaming"===e.state&&(s[e.toolCallId]={text:e.rawInput??"",inputEncoding:e.inputEncoding,index:t,toolName:"dynamic-tool"===e.type?e.toolName:Zm(e),dynamic:"dynamic-tool"===e.type,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:Vm(),activeReasoningParts:Vm(),partialToolCalls:s}}function Wm({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:s,onError:r,onToolCall:a,onData:i,resetStateOnMessageIdChange:o=!1,resetStateOnFirstMessageStart:l=!1}){let c=!0;return e.pipeThrough(new TransformStream({async transform(e,d){await s(async({state:s,write:u})=>{function h(){const e=s.message.parts;let t=e.length-1;for(;t>=0&&"step-start"!==e[t].type;)t--;return e.slice(t+1)}function p(e){let t=h().filter(Bm).find(t=>t.toolCallId===e);if(null==t){const n=s.message.parts;for(let s=n.length-1;s>=0;s--){const r=n[s];if(Bm(r)&&r.toolCallId===e){t=r;break}}}if(null==t)throw new Am({chunkType:"tool-invocation",chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function m(e,t){const n=t??h().find(t=>Um(t)&&t.toolCallId===e.toolCallId),r=e,a=n;if(null!=n){n.state=e.state,a.type=`tool-${e.toolName}`,a.input=r.input,a.output=r.output,a.errorText=r.errorText,a.rawInput=r.rawInput,null!=r.inputEncoding?a.inputEncoding=r.inputEncoding:delete a.inputEncoding,a.preliminary=r.preliminary,void 0!==e.title&&(a.title=e.title),void 0!==e.toolMetadata&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=r.providerExecuted??n.providerExecuted;const t=r.providerMetadata;if(null!=t)if("output-available"===e.state||"output-error"===e.state){n.resultProviderMetadata=t}else n.callProviderMetadata=t}else s.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},input:r.input,...null!=r.inputEncoding?{inputEncoding:r.inputEncoding}:{},output:r.output,rawInput:r.rawInput,errorText:r.errorText,providerExecuted:r.providerExecuted,preliminary:r.preliminary,...null==r.providerMetadata||"output-available"!==e.state&&"output-error"!==e.state?{}:{resultProviderMetadata:r.providerMetadata},...null!=r.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:r.providerMetadata}:{}})}function f(e,t){const n=t??h().find(t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId),r=e,a=n;if(null!=n){n.state=e.state,a.toolName=e.toolName,a.input=r.input,a.output=r.output,a.errorText=r.errorText,a.rawInput=r.rawInput,null!=r.inputEncoding?a.inputEncoding=r.inputEncoding:delete a.inputEncoding,a.preliminary=r.preliminary,void 0!==e.title&&(a.title=e.title),void 0!==e.toolMetadata&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=r.providerExecuted??n.providerExecuted;const t=r.providerMetadata;if(null!=t)if("output-available"===e.state||"output-error"===e.state){n.resultProviderMetadata=t}else n.callProviderMetadata=t}else s.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:r.input,...null!=r.inputEncoding?{inputEncoding:r.inputEncoding}:{},output:r.output,errorText:r.errorText,preliminary:r.preliminary,providerExecuted:r.providerExecuted,title:e.title,...void 0!==e.toolMetadata?{toolMetadata:e.toolMetadata}:{},...null==r.providerMetadata||"output-available"!==e.state&&"output-error"!==e.state?{}:{resultProviderMetadata:r.providerMetadata},...null!=r.providerMetadata&&"output-available"!==e.state&&"output-error"!==e.state?{callProviderMetadata:r.providerMetadata}:{}})}async function g(e){if(null!=e){const n=null!=s.message.metadata?Pm(s.message.metadata,e):e;null!=t&&await ym({value:n,schema:t,context:{field:"message.metadata",entityId:s.message.id}}),s.message.metadata=n}}switch(e.type){case"text-start":{const t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};s.activeTextParts[e.id]=t,s.message.parts.push(t),u();break}case"text-delta":{const t=s.activeTextParts[e.id];if(null==t)throw new Am({chunkType:"text-delta",chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,u();break}case"text-end":{const t=s.activeTextParts[e.id];if(null==t)throw new Am({chunkType:"text-end",chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state="done",null!=e.citations&&(t.citations=e.citations),t.providerMetadata=e.providerMetadata??t.providerMetadata,delete s.activeTextParts[e.id],u();break}case"custom":{const t={type:"custom",kind:e.kind,providerMetadata:e.providerMetadata};s.message.parts.push(t),u();break}case"reasoning-start":{const t={type:"reasoning",id:e.id,text:"",providerMetadata:e.providerMetadata,state:"streaming"};s.activeReasoningParts[e.id]=t,s.message.parts.push(t),u();break}case"reasoning-delta":{const t=s.activeReasoningParts[e.id];if(null==t)throw new Am({chunkType:"reasoning-delta",chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,u();break}case"reasoning-end":{const t=s.activeReasoningParts[e.id];if(null==t)throw new Am({chunkType:"reasoning-end",chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state="done",delete s.activeReasoningParts[e.id],u();break}case"file":case"reasoning-file":s.message.parts.push({type:e.type,mediaType:e.mediaType,url:e.url,...null!=e.providerMetadata?{providerMetadata:e.providerMetadata}:{}}),u();break;case"source-url":s.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),u();break;case"source-document":s.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),u();break;case"tool-input-start":{const t=h().filter(Um);s.partialToolCalls[e.toolCallId]={text:"",inputEncoding:e.inputEncoding,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),u();break}case"tool-input-delta":{const t=s.partialToolCalls[e.toolCallId];if(null==t)throw new Am({chunkType:"tool-input-delta",chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;const n="text"===t.inputEncoding?t.text:(await async function(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await km({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await km({text:zm(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}(t.text)).value;t.dynamic?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}):m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}),u();break}case"tool-input-available":e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),u(),a&&!e.providerExecuted&&await a({toolCall:e});break;case"tool-input-error":{const t=h().filter(Bm).find(t=>t.toolCallId===e.toolCallId);(null!=t?"dynamic-tool"===t.type:e.dynamic)?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),u();break}case"tool-approval-request":{const t=p(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId,...null!=e.approvalDescriptor?{descriptor:e.approvalDescriptor}:{},...Object.prototype.hasOwnProperty.call(e,"inputSchemaInput")?{inputSchemaInput:e.inputSchemaInput}:{},...null!=e.reason?{requestReason:e.reason}:{},...!0===e.isAutomatic?{isAutomatic:!0}:{},...null!=e.signature?{signature:e.signature}:{}},u();break}case"tool-approval-response":{const t=function(e){const t=s.message.parts.filter(Bm).find(t=>t.approval?.id===e);if(null==t)throw new Am({chunkType:"tool-approval-response",chunkId:e,message:`No tool invocation found for approval ID "${e}".`});return t}(e.approvalId),n=null==t.approval?{id:e.approvalId}:t.approval;t.state="approval-responded",t.approval={...n,id:e.approvalId,approved:e.approved,...null!=e.reason?{reason:e.reason}:{}},null!=e.providerExecuted&&(t.providerExecuted=e.providerExecuted),null!=e.providerMetadata&&(t.callProviderMetadata=e.providerMetadata),u();break}case"tool-output-denied":p(e.toolCallId).state="output-denied",u();break;case"tool-output-available":{const t=p(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):m({toolCallId:e.toolCallId,toolName:Zm(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),u();break}case"tool-output-error":{const t=p(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):m({toolCallId:e.toolCallId,toolName:Zm(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),u();break}case"start-step":s.message.parts.push({type:"step-start"});break;case"finish-step":break;case"reset-step":{const e=h();s.activeTextParts=Vm(),s.activeReasoningParts=Vm(),s.partialToolCalls=Vm(),e.length>0&&(s.message.parts.splice(s.message.parts.length-e.length,e.length),u());break}case"start":{const t=l&&c||o&&null!=e.messageId&&e.messageId!==s.message.id;c=!1,t&&Object.assign(s,Hm({lastMessage:void 0,messageId:e.messageId??s.message.id}),{finishReason:void 0}),null!=e.messageId&&(s.message.id=e.messageId),await g(e.messageMetadata),(t||null!=e.messageId||null!=e.messageMetadata)&&u({updateStatus:!1});break}case"finish":null!=e.finishReason&&(s.finishReason=e.finishReason),await g(e.messageMetadata),null!=e.messageMetadata&&u();break;case"message-metadata":await g(e.messageMetadata),null!=e.messageMetadata&&u();break;case"error":r?.(new Error(e.errorText));break;default:if(function(e){return e.type.startsWith("data-")}(e)){if(null!=n?.[e.type]){const t=s.message.parts.findIndex(t=>"id"in t&&"data"in t&&t.id===e.id&&t.type===e.type),r=t>=0?t:s.message.parts.length;await ym({value:e.data,schema:n[e.type],context:{field:`message.parts[${r}].data`,entityName:e.type,entityId:e.id}})}const t=e;if(t.transient){i?.(t);break}const r=null!=t.id?s.message.parts.find(e=>t.type===e.type&&t.id===e.id):void 0;null!=r?r.data=t.data:s.message.parts.push(t),i?.(t),u()}}d.enqueue(e)})}}))}Ep({prefix:"aitxt",size:24}),Ep({prefix:"call",size:24}),Ep({prefix:"aitxt",size:24}),Ep({prefix:"call",size:24}),Lm.record(Lm.string(),Rm.optional()),Lm.record(Lm.string(),Lm.string()),Ep({prefix:"call",size:24}),Ep({prefix:"call",size:24}),new TextEncoder,Ep({prefix:"call",size:24}),Ep({prefix:"aiobj",size:24});var Km=class{constructor(){this.queue=[],this.isProcessing=!1,this.idleWaiters=[]}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;this.queue.length>0;)await this.queue[0](),this.queue.shift()}finally{this.isProcessing=!1;for(const e of this.idleWaiters.splice(0))e()}}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}async waitForIdle(){(this.isProcessing||0!==this.queue.length)&&await new Promise(e=>{this.idleWaiters.push(e)})}};Ep({prefix:"aiobj",size:24}),Ep({prefix:"call",size:24});const Jm=Lm.union([Lm.string(),Lm.instanceof(Uint8Array),Lm.instanceof(ArrayBuffer),Lm.custom(function(e){return globalThis.Buffer?.isBuffer(e)??!1},{message:"Must be a Buffer"})]),Gm=Lm.record(Lm.string(),Lm.string()),qm=Lm.object({type:Lm.literal("text"),text:Lm.string(),providerOptions:Mm.optional()}),Ym=Lm.object({type:Lm.literal("image"),image:Lm.union([Jm,Lm.instanceof(URL),Gm]),mediaType:Lm.string().optional(),providerOptions:Mm.optional()}),Xm=Lm.discriminatedUnion("type",[Lm.object({type:Lm.literal("data"),data:Jm}),Lm.object({type:Lm.literal("url"),url:Lm.instanceof(URL)}),Lm.object({type:Lm.literal("reference"),reference:Gm}),Lm.object({type:Lm.literal("text"),text:Lm.string()})]),Qm=Lm.discriminatedUnion("type",[Lm.object({type:Lm.literal("data"),data:Jm}),Lm.object({type:Lm.literal("url"),url:Lm.instanceof(URL)})]),ef=Lm.object({type:Lm.literal("file"),data:Lm.union([Xm,Jm,Lm.instanceof(URL),Gm]),filename:Lm.string().optional(),mediaType:Lm.string(),providerOptions:Mm.optional()}),tf=Lm.object({type:Lm.literal("reasoning"),text:Lm.string(),providerOptions:Mm.optional()}),nf=Lm.object({type:Lm.literal("custom"),kind:Lm.string().transform(e=>e),providerOptions:Mm.optional()}),sf=Lm.object({type:Lm.literal("reasoning-file"),data:Lm.union([Qm,Jm,Lm.instanceof(URL)]),mediaType:Lm.string(),providerOptions:Mm.optional()}),rf=Lm.object({type:Lm.literal("tool-call"),toolCallId:Lm.string(),toolName:Lm.string(),input:Lm.unknown(),providerOptions:Mm.optional(),providerExecuted:Lm.boolean().optional()}),af=Lm.discriminatedUnion("type",[Lm.object({type:Lm.literal("text"),value:Lm.string(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("json"),value:Rm,providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("execution-denied"),reason:Lm.string().optional(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("error-text"),value:Lm.string(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("error-json"),value:Rm,providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("content"),value:Lm.array(Lm.union([Lm.object({type:Lm.literal("text"),text:Lm.string(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("file"),data:Xm,mediaType:Lm.string(),filename:Lm.string().optional(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("file-data"),data:Lm.string(),mediaType:Lm.string(),filename:Lm.string().optional(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("file-url"),url:Lm.string(),mediaType:Lm.string().optional(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("file-id"),fileId:Lm.union([Lm.string(),Lm.record(Lm.string(),Lm.string())]),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("file-reference"),providerReference:Lm.record(Lm.string(),Lm.string()),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("image-data"),data:Lm.string(),mediaType:Lm.string(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("image-url"),url:Lm.string(),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("image-file-id"),fileId:Lm.union([Lm.string(),Lm.record(Lm.string(),Lm.string())]),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("image-file-reference"),providerReference:Lm.record(Lm.string(),Lm.string()),providerOptions:Mm.optional()}),Lm.object({type:Lm.literal("custom"),providerOptions:Mm.optional()})]))})]),of=Lm.object({type:Lm.literal("tool-result"),toolCallId:Lm.string(),toolName:Lm.string(),output:af,providerOptions:Mm.optional()}),lf=Lm.object({type:Lm.literal("tool-approval-request"),approvalId:Lm.string(),toolCallId:Lm.string(),reason:Lm.string().optional(),isAutomatic:Lm.boolean().optional(),signature:Lm.string().optional(),inputSchemaInput:Lm.unknown().optional()}),cf=Lm.object({type:Lm.literal("tool-approval-response"),approvalId:Lm.string(),approved:Lm.boolean(),reason:Lm.string().optional()}),df=Lm.object({role:Lm.literal("system"),content:Lm.string(),providerOptions:Mm.optional()}),uf=Lm.object({role:Lm.literal("user"),content:Lm.union([Lm.string(),Lm.array(Lm.union([qm,Ym,ef]))]),providerOptions:Mm.optional()}),hf=Lm.object({role:Lm.literal("assistant"),content:Lm.union([Lm.string(),Lm.array(Lm.union([qm,nf,ef,tf,sf,rf,of,lf]))]),providerOptions:Mm.optional()}),pf=Lm.object({role:Lm.literal("tool"),content:Lm.array(Lm.union([of,cf])),providerOptions:Mm.optional()});async function mf({response:e,url:t,fallbackMessage:n}){const s=await e.text();return new Lo({message:s||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:s})}Lm.union([df,uf,hf,pf]),Lm.object({token:Lm.string().refine(e=>e.trim().length>0),url:Lm.string().refine(e=>{try{const t=new URL(e);return("ws:"===t.protocol||"wss:"===t.protocol)&&""!==t.hostname}catch{return!1}}),expiresAt:Lm.number().positive().max(Number.MAX_SAFE_INTEGER).optional(),tools:Lm.array(Lm.object({type:Lm.literal("function"),name:Lm.string().min(1),description:Lm.string().optional(),parameters:Lm.record(Lm.string(),Lm.unknown())})).optional()}),Ep({prefix:"call",size:24}),Ep({prefix:"call",size:24}),Ep({prefix:"call",size:24});var ff,gf,bf=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:s,fetch:r,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){const n=await Nm(this.body),s=await Nm(this.headers),r=await Nm(this.credentials),a={...jp(s),...jp(t.headers)},i=await(this.prepareSendMessagesRequest?.({api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:r,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),o=i?.api??this.api,l=void 0!==i?.headers?jp(i.headers):a,c=void 0!==i?.body?i.body:{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},d=i?.credentials??r,u=await(this.fetch??globalThis.fetch)(o,{method:"POST",headers:{"content-type":"application/json",...l},body:JSON.stringify(c),credentials:d,signal:e});if(!u.ok)throw await mf({response:u,url:o,fallbackMessage:"Failed to fetch the chat response."});if(!u.body)throw new Fo({message:"The response body is empty."});return this.processResponseStream(u.body)}async reconnectToStream(e){const t=await Nm(this.body),n=await Nm(this.headers),s=await Nm(this.credentials),r={...jp(n),...jp(e.headers)},a=await(this.prepareReconnectToStreamRequest?.({api:this.api,id:e.chatId,body:{...t,...e.body},headers:r,credentials:s,requestMetadata:e.metadata}));let i=a?.api;if(null==i){if("."===e.chatId||".."===e.chatId)throw new Om({parameter:"chatId",value:e.chatId,message:'Chat IDs must not be "." or ".." when using the default reconnect URL.'});i=function(e,t){const n=e.search(/[?#]/),s=-1===n?e:e.slice(0,n),r=-1===n?"":e.slice(n);return`${s.endsWith("/")&&t.startsWith("/")?s.slice(0,-1):s}${t}${r}`}(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}const o=void 0!==a?.headers?jp(a.headers):r,l=a?.credentials??s,c=await(this.fetch??globalThis.fetch)(i,{method:"GET",headers:o,credentials:l,signal:e.abortSignal});if(204===c.status)return null;if(!c.ok)throw await mf({response:c,url:i,fallbackMessage:"Failed to fetch the chat response."});if(!c.body)throw new Fo({message:"The response body is empty."});return this.processResponseStream(c.body)}},vf=class extends bf{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return function({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Sp).pipeThrough(new TransformStream({async transform({data:e},n){"[DONE]"!==e&&n.enqueue(await km({text:e,schema:t}))}}))}({stream:e,schema:Dm}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},yf=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=Cp,id:t,transport:n=new vf,messageMetadataSchema:s,dataPartSchemas:r,state:a,onError:i,onToolCall:o,onFinish:l,onData:c,sendAutomaticallyWhen:d}){this.pendingMessagePreparations=new Set,this.interruptedMessageIds=new Set,this.activeResponse=void 0,this.activeResumeRequest=void 0,this.resumableStreamState=void 0,this.jobExecutor=new Km,this.activeStopCount=0,this.stopGeneration=0,this.sendMessage=async(e,t)=>{if(null==e){let e=this.pendingApprovalMessageId;if(null==e){e=this.lastMessage?.id;for(let t=this.state.messages.length-1;t>=0;t--){const n=this.state.messages[t];if("assistant"===n.role&&n.parts.some(e=>Bm(e)&&"approval-responded"===e.state)){e=n.id;break}}}const n=null!=e&&e===this.pendingApprovalMessageId?this.state.messages.findIndex(t=>t.id===e):-1;return void await this.makeRequestForToolApproval({messageId:e,messageIndex:n,...t})}let n;if("text"in e||"files"in e){const t=new AbortController;let s;this.pendingMessagePreparations.add(t);try{s=Array.isArray(e.files)?e.files:await async function(e){if(null==e)return[];if(!(globalThis.FileList&&e instanceof globalThis.FileList))throw new nl({functionality:"FileList",message:"FileList is not supported in the current environment"});return Promise.all(Array.from(e).map(async e=>{const{name:t,type:n}=e;return{type:"file",mediaType:n,filename:t,url:await new Promise((t,n)=>{const s=new FileReader;s.onload=e=>{t(e.target?.result)},s.onerror=e=>n(e),s.readAsDataURL(e)})}}))}(e.files)}finally{this.pendingMessagePreparations.delete(t)}if(t.signal.aborted)return;n={parts:[...s,..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}}else n=e;if(null!=e.messageId){const t=this.state.messages.findIndex(t=>t.id===e.messageId);if(-1===t)throw new Om({parameter:"message.messageId",value:e.messageId,message:`message with id ${e.messageId} not found`});if("user"!==this.state.messages[t].role)throw new Om({parameter:"message.messageId",value:e.messageId,message:`message with id ${e.messageId} is not a user message`});this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{id:e.messageId,...n,role:n.role??"user",metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{const n=null==e?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(-1===n)throw new Om({parameter:"messageId",value:e,message:`message ${e} not found`});this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[n].role?n:n+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this["~resumeStreamIfDisconnected"]=async({shouldResume:e=()=>!0}={})=>{const t=this.activeResponse;null==this.resumableStreamState&&null!=t&&(await t.completionPromise,this.resumableStreamState!==t.state)||null!=this.resumableStreamState&&e()&&await this.resumeStream()},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:s})=>this.jobExecutor.run(async()=>{const r=this.state.messages,a=s=>Bm(s)&&"approval-requested"===s.state&&s.approval.id===e?{...s,state:"approval-responded",approval:{...s.approval,id:e,approved:t,reason:n}}:s,i=r.findIndex(t=>t.parts.some(t=>Bm(t)&&"approval-requested"===t.state&&t.approval.id===e));if(-1!==i){const e=r[i];this.state.replaceMessage(i,{...e,parts:e.parts.map(a)}),this.pendingApprovalMessageId=e.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(a)),-1!==i&&"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen){const e=await this.shouldSendAutomatically(r[i].id);e&&this.runAutomaticRequest(()=>{const e=-1===i?this.lastMessage?.id:r[i].id;return this.makeRequestForToolApproval({messageId:e,messageIndex:i,...s})},e)}}),this.addToolOutput=async({state:e,toolCallId:t,output:n,errorText:s,options:r})=>this.jobExecutor.run(async()=>{const a=this.state.messages,i=r=>{if(!Bm(r)||r.toolCallId!==t)return r;const{approval:a,...i}=r,o=!0===a?.approved?{approval:{...a,approved:a.approved}}:{};return"output-error"===e?{...i,...o,state:e,input:r.input,output:void 0,errorText:s}:{...i,...o,state:"output-available",input:r.input,output:n,errorText:void 0}},o=a.findIndex(e=>e.parts.some(e=>Bm(e)&&e.toolCallId===t));if(-1!==o){const e=a[o];this.state.replaceMessage(o,{...e,parts:e.parts.map(i)})}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(i)),-1!==o&&"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen){const e=await this.shouldSendAutomatically(a[o].id);e&&this.runAutomaticRequest(()=>this.makeRequest({trigger:"submit-message",messageId:a[o].id,...r}),e)}}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.activeStopCount++,this.stopGeneration++;try{const e=this.activeResumeRequest,t=this.activeResponse;for(const e of this.pendingMessagePreparations)e.abort();e?.abortController.abort(),t?.abortController.abort(),await Promise.all([e?.completionPromise,t?.completionPromise]),await this.jobExecutor.waitForIdle()}finally{this.activeStopCount--}},this.dispose=async()=>{await this.stop(),this.transport.close?.()},this._id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=a,this.onError=i,this.onToolCall=o,this.onFinish=l,this.onData=c,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e?(this.state.status=e,this.state.error=t):this.error!==t&&(this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(e=this.lastMessage?.id){const t=e=>null!=e&&this.interruptedMessageIds.has(e);return!(!this.sendAutomaticallyWhen||t(e)||t(this.lastMessage?.id))&&(await this.sendAutomaticallyWhen({messages:this.state.messages})&&!t(e)&&!t(this.lastMessage?.id))}async runAutomaticRequest(e,t){const n=this.stopGeneration,s=this.activeStopCount>0;(t??await this.shouldSendAutomatically())&&(s||n!==this.stopGeneration||this.activeStopCount>0||await e())}async makeRequestForToolApproval({messageId:e,messageIndex:t,...n}){const s=null!=e&&e===this.pendingApprovalMessageId;s&&(this.pendingApprovalMessageId=void 0),await this.makeRequest({trigger:"submit-message",messageId:e,...n}),s&&"error"===this.status&&null==this.pendingApprovalMessageId&&(this.pendingApprovalMessageId=this.state.messages[t]?.id??e)}async makeRequest(e){const t=function(){let e,t;return{promise:new Promise((n,s)=>{e=n,t=s}),resolve:e,reject:t}}();try{await this.makeRequestImpl({...e,completionPromise:t.promise})}finally{t.resolve()}}async makeRequestImpl({trigger:e,metadata:t,headers:n,body:s,messageId:r,completionPromise:a}){"resume-stream"!==e&&(this.resumableStreamState=void 0);const i=new AbortController,o="resume-stream"===e?{abortController:i,completionPromise:a}:void 0;o&&(this.activeResumeRequest?.abortController.abort(),this.activeResumeRequest=o);const l=()=>null==o||this.activeResumeRequest===o,c=()=>{this.activeResumeRequest===o&&(this.activeResumeRequest=void 0)};let d;if("resume-stream"===e)try{const e=await this.transport.reconnectToStream({chatId:this.id,abortSignal:i.signal,metadata:t,headers:n,body:s});if(i.signal.aborted||!l())return await(e?.cancel().catch(()=>{})),l()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),void c();if(null==e)return this.setStatus({status:"ready"}),this.resumableStreamState=void 0,void c();d=e}catch(e){if(i.signal.aborted||"AbortError"===e.name)return l()&&(this.setStatus({status:"ready"}),this.resumableStreamState=void 0),void c();if(!l())return;return this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e}),void c()}this.setStatus({status:"submitted",error:void 0});const u=this.lastMessage,h="submit-message"===e&&null!=r?this.state.messages.findIndex(e=>e.id===r):this.state.messages.length-1,p=-1===h?u:this.state.messages[h],m=p?.id,f="resume-stream"===e&&"assistant"===p?.role&&p.parts.some(e=>Bm(e)&&("input-streaming"===e.state||"input-available"===e.state&&e.providerExecuted||"approval-responded"===e.state))?this.state.snapshot(p):void 0,g=-1!==h&&h<this.state.messages.length-1&&"assistant"===p?.role;let b,v=!1,y=!1,w=!1;try{const o={state:"resume-stream"===e&&null!=this.resumableStreamState?this.resumableStreamState:Hm({lastMessage:"resume-stream"===e?f:"regenerate-message"===e?void 0:this.state.snapshot(p),messageId:this.generateId()}),abortController:i,completionPromise:a};let c;b=o,o.abortController.signal.addEventListener("abort",()=>{v=!0}),this.activeResponse=o,c="resume-stream"===e?d:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:n,body:s,trigger:e,messageId:r});const u=e=>this.jobExecutor.run(()=>o.abortController.signal.aborted?Promise.resolve():e({state:o.state,write:({updateStatus:e=!0}={})=>{if(o.abortController.signal.aborted)return;e&&this.setStatus({status:"streaming"});const t=this.state.messages.findLastIndex(e=>e.id===o.state.message.id);if(-1!==t)this.state.replaceMessage(t,o.state.message);else if(g){const e=this.state.messages.findLastIndex(e=>e.id===m);-1!==e?this.state.replaceMessage(e,o.state.message):this.state.pushMessage(o.state.message)}else this.state.pushMessage(o.state.message)}}));if(await async function({stream:e,onError:t,abortSignal:n}){const s=e.getReader(),r=()=>{s.cancel().catch(()=>{})};n?.aborted?r():n?.addEventListener("abort",r,{once:!0});try{for(;;){const{done:e}=await s.read();if(e)break}}catch(e){t?.(e)}finally{n?.removeEventListener("abort",r),s.releaseLock()}}({stream:Wm({stream:c,resetStateOnMessageIdChange:"resume-stream"===e,resetStateOnFirstMessageStart:"resume-stream"===e&&this.transport.resumeStreamIsReplay,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:u,onError:e=>{throw e}}),abortSignal:o.abortController.signal,onError:e=>{throw e}}),v)return l()&&(this.setStatus({status:"ready"}),this.resumableStreamState===o.state&&(this.resumableStreamState=void 0)),null;l()&&(this.setStatus({status:"ready"}),this.resumableStreamState===o.state&&(this.resumableStreamState=void 0))}catch(e){if(v||"AbortError"===e.name)return v=!0,l()&&(this.setStatus({status:"ready"}),this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0)),null;if(!l())return null;if(w=!0,e instanceof TypeError){const t=e.message.toLowerCase();y=t.includes("fetch")||t.includes("network")||"load failed"===t}y?this.resumableStreamState=b?.state:this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{if(b){const{message:e,finishReason:t}=b.state;"interrupted"===t?this.interruptedMessageIds.add(e.id):v||w||this.interruptedMessageIds.delete(e.id),this.onFinish?.({message:b.state.message,messages:this.state.messages,isAbort:v,isDisconnect:y,isError:w,finishReason:b.state.finishReason})}}finally{this.activeResponse===b&&(this.activeResponse=void 0),c()}}v||w||"interrupted"===b?.state.finishReason||await this.runAutomaticRequest(()=>this.makeRequest({trigger:"submit-message",messageId:this.lastMessage?.id,metadata:t,headers:n,body:s}))}};function wf(){if(gf)return ff;return gf=1,ff=function(e,t){if("function"!=typeof e)throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,s=0;return function(...r){clearTimeout(n);const a=Date.now(),i=t-(a-s);i<=0?(s=a,e.apply(this,r)):n=setTimeout(()=>{s=Date.now(),e.apply(this,r)},i)}}}var kf=Sm(wf());var Nf=class{#e;#t;#n;#s;#r;#a;constructor(e=[]){this.#t="ready",this.#n=void 0,this.#s=new Set,this.#r=new Set,this.#a=new Set,this.pushMessage=e=>{this.#e=this.#e.concat(e),this.#i()},this.popMessage=()=>{this.#e=this.#e.slice(0,-1),this.#i()},this.replaceMessage=(e,t)=>{this.#e=[...this.#e.slice(0,e),this.snapshot(t),...this.#e.slice(e+1)],this.#i()},this.snapshot=e=>{if(null==e||"object"!=typeof e||!("parts"in e)||!Array.isArray(e.parts))return e;const t=e,n={...t,parts:t.parts.map(e=>({...e}))};var s;return"metadata"in t&&(n.metadata=(s=t.metadata,Array.isArray(s)?[...s]:null==s||"object"!=typeof s||Object.getPrototypeOf(s)!==Object.prototype&&null!==Object.getPrototypeOf(s)?s:{...s})),n},this["~registerMessagesCallback"]=(e,t)=>{const n=t?(s=e,null!=(r=t)?kf(s,r):s):e;var s,r;return this.#s.add(n),()=>{this.#s.delete(n)}},this["~registerStatusCallback"]=e=>(this.#r.add(e),()=>{this.#r.delete(e)}),this["~registerErrorCallback"]=e=>(this.#a.add(e),()=>{this.#a.delete(e)}),this.#i=()=>{this.#s.forEach(e=>e())},this.#o=()=>{this.#r.forEach(e=>e())},this.#l=()=>{this.#a.forEach(e=>e())},this.#e=e}get status(){return this.#t}set status(e){this.#t=e,this.#o()}get error(){return this.#n}set error(e){this.#n=e,this.#l()}get messages(){return this.#e}set messages(e){this.#e=[...e],this.#i()}#i;#o;#l},xf=class extends yf{#c;constructor({messages:e,...t}){const n=new Nf(e);super({...t,state:n}),this["~registerMessagesCallback"]=(e,t)=>this.#c["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>this.#c["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>this.#c["~registerErrorCallback"](e),this.#c=n}};const Sf=new WeakMap;function jf({chat:e,state:t}){if("visible"!==document.visibilityState||null!=t.pendingVisibilityResume)return;const n=()=>{t.pendingVisibilityResume=void 0};t.pendingVisibilityResume=e["~resumeStreamIfDisconnected"]({shouldResume:()=>Sf.get(e)===t&&t.registrations.size>0&&"visible"===document.visibilityState}).then(n,n)}function Ef(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function Cf(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function Of({throttle:e,experimental_throttle:t,resume:n=!1,...s}={}){const r=e??t,a=l({}),c=l({});let u;"chat"in s||(c.current={onToolCall:s.onToolCall,onData:s.onData,onFinish:s.onFinish,onError:s.onError,sendAutomaticallyWhen:s.sendAutomaticallyWhen,transport:s.transport});const h=()=>c.current.transport??(u??=new vf),m={...s,transport:{get resumeStreamIsReplay(){return h().resumeStreamIsReplay},sendMessages:e=>h().sendMessages(e),reconnectToStream:e=>h().reconnectToStream(e)},onToolCall:e=>c.current.onToolCall?.(e),onData:e=>c.current.onData?.(e),onFinish:e=>c.current.onFinish?.(e),onError:e=>c.current.onError?.(e),sendAutomaticallyWhen:e=>c.current.sendAutomaticallyWhen?.(e)??!1},f="chat"in s?s.chat:s.id,{chat:g,isExternallyManaged:b}=p(()=>({chat:"chat"in s?s.chat:new xf(m),isExternallyManaged:"chat"in s}),[f]);o(()=>{if(!b)return()=>{g.stop()}},[g,b]);const[v,y]=i(()=>Ef(g));v.chat!==g&&y(Ef(g)),o(()=>{let e=!0;const t=()=>{if(!e)return;const t=Ef(g);y(e=>e.chat!==g||Cf(e,t)?e:t)},n=[g["~registerMessagesCallback"](t,r),g["~registerStatusCallback"](t),g["~registerErrorCallback"](t)],s=Ef(g);return y(e=>Cf(e,s)?e:s),()=>{e=!1,n.forEach(e=>e())}},[g,r]);const{messages:w,status:k,error:N}=v,x=d(e=>{"function"==typeof e&&(e=e(g.messages)),g.messages=e},[g]);return o(()=>{if(n)return function({chat:e,registration:t}){let n=Sf.get(e);if(null==n){const t={registrations:new Set};if(Sf.set(e,t),n=t,"undefined"!=typeof document){const n=()=>jf({chat:e,state:t});document.addEventListener("visibilitychange",n),t.cleanupVisibilityListener=()=>{document.removeEventListener("visibilitychange",n)}}}const{registrations:s}=n,r=0===s.size;return s.add(t),r&&"submitted"!==e.status&&"streaming"!==e.status&&e.resumeStream(),()=>{s.delete(t),0===s.size&&(n.cleanupVisibilityListener?.(),Sf.delete(e))}}({chat:g,registration:a.current})},[n,g]),{get id(){return g.id},messages:w,setMessages:x,sendMessage:g.sendMessage,regenerate:g.regenerate,clearError:g.clearError,stop:g.stop,error:N,resumeStream:g.resumeStream,status:k,addToolResult:g.addToolOutput,addToolOutput:g.addToolOutput,addToolApprovalResponse:g.addToolApprovalResponse}}const _f=()=>import("./MdMath-DvH_O_A3.js"),If=u(()=>_f()),Tf=e=>t(h,{fallback:t(bt,{}),children:t(If,{...e})});function Af({source:e,edit:n,onEdit:s,download:r}){const a=[];return n&&s&&a.push({icon:t(Kt,{size:"tiny"}),buttons:[{icon:t(Kt,{size:"tiny"}),label:t(Fr,{children:"edit"}),onClick:s}]}),r&&a.push({icon:t(Jt,{size:"tiny"}),buttons:[{icon:t(Jt,{size:"tiny"}),label:t(Fr,{children:"md"}),onClick:()=>$(new Blob([e],{type:"text/plain"}),"file.md")}]}),a.length?t(ci,{actionButtons:a}):null}function Pf(n){const{source:s,downloadButton:r,className:a,blur:i,unBlur:o,style:l,flatView:c,detectRequestAnimationFrame:d}=n;return e("div",{className:A("jk-md-math-viewer-layout",a),style:l,children:[!c&&t(Af,{source:s,download:r}),t(Tf,{source:s,blur:i,unBlur:o,flatView:c,detectRequestAnimationFrame:d})]})}const zf=s=>{const{title:r,api:a,storeKey:c,getBodyRef:d,onMessagesChangeRef:u,toolStateUI:h,suggestions:p,onWidthChange:m,actions:f}=s,[g,b]=i(!1),[v,y]=i(""),[w,k]=i([]),[N,x]=i(!1),[S,j]=i(!1),E=l(null),{ref:C,width:O=0}=Xr({handleHeight:!1}),_=l(null),I=l(null),T=l(!0),P=ua(m);o(()=>{P.current?.(O)},[O,P]);const z=$r(e=>e.i18n.t),{organization:{key:L},nickname:R}=Ya(e=>e.user),M=c?`jk-ai-chat/${xe(R,L)}/${c}`:"",{messages:$,sendMessage:F,status:D,setMessages:V,stop:U}=Of({transport:new vf({api:a}),messages:[]}),B=ua(V);o(()=>{if(M)try{const e=JSON.parse(localStorage.getItem(M)??"[]");B.current(Array.isArray(e)?e:[])}catch{localStorage.removeItem(M),B.current([])}else B.current([])},[B,M]),o(()=>{u.current?.($),T.current&&_.current?.scrollIntoView({behavior:"auto",block:"nearest"})},[$,u]),o(()=>{M&&$?.length>0&&localStorage.setItem(M,JSON.stringify($))},[M,$]),o(()=>{const e=I.current;if(!e)return;const t=()=>{const t=e.scrollHeight-e.scrollTop-e.clientHeight<10;T.current=t,j(!t)};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}},[g]),o(()=>{T.current&&_.current?.scrollIntoView({behavior:"auto",block:"nearest"})},[$]);const Z=e=>new Promise(t=>{const n=new FileReader;n.onload=()=>t(n.result),n.readAsDataURL(e)}),H=async e=>{const t=Array.from(e).filter(e=>e.type.startsWith("image/"));if(!t.length)return;const n=await Promise.all(t.map(async e=>({type:"file",mediaType:e.type,url:await Z(e)})));k(e=>[...e,...n])},W=e=>{T.current=!0;const t=e??v;if(!t)return;const n=[{type:"text",text:t},...w];F({parts:n},{body:{...d.current()}}),y(""),k([])},K=g?"var(--chat-right-panel-width, calc(100vw / 3))":"calc(var(--tx-h-m) + var(--pad-sm))";return e("div",{ref:e=>{I.current=e,C.current=e},className:A("chat-right-panel jk-br-ie jk-col gap nowrap stretch ht-100",{"bc-sf-md":g}),style:{width:K,minWidth:K},children:[e("div",{className:A("jk-row center cr-we bc-io jk-pg-xsm jk-br-ie hr-e1",{"vertical-text":!g}),onClick:()=>b(!g),style:{position:"sticky",top:0,zIndex:1,...g?{borderBottomLeftRadius:0,borderBottomRightRadius:0}:{}},children:[t(Gt,{})," ",t(Fr,{className:"fw-bd tt-se",children:r||"Juki AI Editor"})]}),g&&e("div",{className:"jk-col gap stretch ai-chat-messages tx-s flex-1 jk-pg-xsm",children:[t("div",{className:"flex-1"}),$.map(s=>t("div",{className:A("message jk-br-ie bc-ht-lt jk-pg-xsm",s.role),children:s.parts.map((r,a)=>{switch(r.type){case"file":return r.mediaType?.startsWith("image/")?t("img",{src:r.url,alt:"attachment",style:{maxWidth:"100%",maxHeight:200,borderRadius:4,objectFit:"contain"}},`${s.id}-${a}`):null;case"text":return t("div",{children:t(Pf,{source:r.text,flatView:!0})},`${s.id}-${a}`);case"tool-editMarkdown":return t("div",{className:"jk-col gap-sm",children:t("div",{className:"jk-row left fw-lr",children:h?.[r?.state]?e(n,{children:[t(Fr,{className:"tt-se",children:h[r.state].label})," ",h[r.state].icon]}):t(Tt,{filledCircle:!0,size:"tiny"})})},`${s.id}-${a}`);default:return null}})},s.id)),t("div",{className:"jk-row left gap tx-t cr-hd",children:"submitted"===D?e(n,{children:[t(Gt,{size:"tiny",className:"cr-io"}),e("div",{className:"jk-row",style:{alignItems:"baseline"},children:[t(Fr,{className:"tt-se",children:"thinking"})," ",t("div",{className:"dot-flashing",style:{"--dot-flashing-color":"var(--cr-hd)","--dot-flashing-color-light":"var(--cr-ht)","--dot-flashing-size":"4px"}})]})]}):"streaming"===D?e(n,{children:[t(Gt,{size:"tiny",className:"cr-io"}),e("div",{className:"jk-row",style:{alignItems:"baseline"},children:[t(Fr,{className:"tt-se",children:"writing"})," ",t("div",{className:"dot-flashing",style:{"--dot-flashing-color":"var(--cr-hd)","--dot-flashing-color-light":"var(--cr-ht)","--dot-flashing-size":"4px"}})]})]}):"error"===D?e(n,{children:[t(It,{size:"tiny",className:"cr-er"}),t(Fr,{className:"tt-se cr-er",children:"something went wrong"})]}):e("div",{className:"jk-col stretch gap",children:[e("div",{className:"jk-row",children:[t(Gt,{size:"tiny",className:"cr-io"}),t(Fr,{className:"tt-se",children:"select text and ask me to edit it"})]}),!!f&&t("div",{children:f({setPendingParts:k})})]})}),t("input",{ref:E,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>e.target.files&&void H(e.target.files)}),t("form",{onSubmit:e=>{e.preventDefault(),"ready"===D&&W()},children:e("div",{className:A("jk-col gap-sm jk-br-ie",{"bc-at-lt":N}),style:{border:N?"2px dashed var(--cr-io)":"2px dashed transparent",padding:4},onDragOver:e=>{e.preventDefault(),x(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||x(!1)},onDrop:e=>{e.preventDefault(),x(!1),H(e.dataTransfer.files)},children:[w.length>0&&t("div",{className:"jk-row gap left",style:{flexWrap:"wrap"},children:w.map((n,s)=>e("div",{style:{position:"relative",display:"inline-block"},children:[n.mediaType?.startsWith("image/")?t("img",{src:n.url,alt:n.name??`image-${s}`,style:{width:56,height:56,objectFit:"cover",borderRadius:4}}):t("div",{style:{width:56,height:56,borderRadius:4,background:"var(--cr-hl)",display:"flex",alignItems:"center",justifyContent:"center",padding:4,overflow:"hidden"},children:t("span",{style:{fontSize:10,wordBreak:"break-all",textAlign:"center",lineHeight:1.2},children:n.name??`file-${s}`})}),t("button",{type:"button",onClick:()=>k(e=>e.filter((e,t)=>t!==s)),style:{position:"absolute",top:-4,right:-4,background:"var(--cr-er)",border:"none",borderRadius:"50%",width:16,height:16,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0},children:t(Et,{size:"tiny",className:"cr-we"})})]},s))}),e("div",{className:"jk-row wh-100 nowrap top gap",children:[t(aa,{value:v,placeholder:ns($.length?z("ask a follow-up"):z("select text and describe what to do"))+", "+z("control + click to send message"),onChange:y,onCtrlEnter:W}),e("div",{className:"jk-col gap",style:{height:"100%"},children:[t(Bs,{type:"secondary",size:"small",icon:t("span",{style:{fontSize:14},children:"🖼"}),onClick:()=>E.current?.click()}),t(Bs,"submitted"===D||"streaming"===D?{icon:t(qt,{}),type:"secondary",style:{flex:1},onClick:({onClickEvent:e})=>{e?.preventDefault(),U()}}:{icon:t(Yt,{}),submit:!0,style:{flex:1},disabled:"ready"!==D||!v})]})]})]})}),!!p?.length&&t("div",{className:"jk-row gap jk-pg-xsm",children:p.map(e=>t(Bs,{onClick:()=>W(e.prompt),icon:e.icon,size:"tiny",type:"ghost",disabled:"ready"!==D,children:t(Fr,{className:"tt-se",children:e.label})},e.label))}),S&&t("div",{style:{position:"sticky",bottom:8,display:"flex",justifyContent:"center"},children:t(Bs,{icon:t(Xt,{}),size:"small",type:"secondary",onClick:()=>{T.current=!0,j(!1),_.current?.scrollIntoView({behavior:"smooth",block:"nearest"})}})}),t("div",{ref:_})]})]})};ge.ERROR,ge.SUCCESS,ge.WARNING,ge.INFO,ge.QUIET;const Lf={[ge.ERROR]:t(It,{}),[ge.SUCCESS]:t(Tt,{circle:!0}),[ge.WARNING]:t(en,{}),[ge.INFO]:t(Qt,{circle:!0}),[ge.QUIET]:null};function Rf({ids:n,type:s,message:r}){const[a,c]=i(!1),[u,h]=i(0),p=l(void 0),{removeNotification:m}=si(),f=Ds(e=>e.viewPort.isSmallScreen),g=z(r),b=d(()=>{const e=setInterval(()=>{h(t=>t<100?t+1e4/(g.length/5*1e3+3e3):(clearInterval(e),c(!0),t))},100);p.current&&clearInterval(p.current),p.current=e},[g.length]),v=()=>{p.current&&clearInterval(p.current)},y=Ds(e=>e.isFocus),w=Ds(e=>e.isVisible);o(()=>(w&&y?b():v(),()=>{p.current&&clearInterval(p.current)}),[b,w,y]);const k=JSON.stringify(n);return o(()=>{a&&setTimeout(()=>{for(const e of JSON.parse(k))m(e)},400)},[a,k,m]),t("div",{onMouseEnter:v,onMouseLeave:b,className:A("jk-notification-item-container",s,{exit:a}),style:s!==ge.QUIET||f?{}:{"--width-notification":8*z(r).length+26+"px"},children:e("div",{className:"jk-notification-item jk-pg-xsm elevation-2 jk-br-ie",children:[Lf[s],e("div",{className:"jk-row stretch space-between nowrap flex-1",children:[t("div",{className:A("jk-notification-message-content jk-row flex-1",{"text-message":"string"==typeof r,"wb-bw":!0}),children:"string"==typeof r?t("span",{className:"tt-se",children:r}):r}),t("div",{className:"jk-col",children:t("div",{className:A("jk-button secondary only-icon jk-br-ie",{tiny:"quiet"===s}),children:t(Et,{onClick:()=>c(!0)})})})]}),t("div",{className:"bar jk-br-ie",style:{width:`${u}%`}})]})})}let Mf=class{diff(e,t,n={}){let s;"function"==typeof n?(s=n,n={}):"callback"in n&&(s=n.callback);const r=this.castInput(e,n),a=this.castInput(t,n),i=this.removeEmpty(this.tokenize(r,n)),o=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(i,o,n,s)}diffWithOptionsObj(e,t,n,s){var r;const a=e=>(e=this.postProcess(e,n),s?void setTimeout(function(){s(e)},0):e),i=t.length,o=e.length;let l=1,c=i+o;null!=n.maxEditLength&&(c=Math.min(c,n.maxEditLength));const d=null!==(r=n.timeout)&&void 0!==r?r:1/0,u=Date.now()+d,h=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=o&&p+1>=i)return a(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,f=1/0;const g=()=>{for(let s=Math.max(m,-l);s<=Math.min(f,l);s+=2){let r;const l=h[s-1],c=h[s+1];l&&(h[s-1]=void 0);let d=!1;if(c){const e=c.oldPos-s;d=c&&0<=e&&e<i}const u=l&&l.oldPos+1<o;if(d||u){if(r=!u||d&&l.oldPos<c.oldPos?this.addToPath(c,!0,!1,0,n):this.addToPath(l,!1,!0,1,n),p=this.extractCommon(r,t,e,s,n),r.oldPos+1>=o&&p+1>=i)return a(this.buildValues(r.lastComponent,t,e))||!0;h[s]=r,r.oldPos+1>=o&&(f=Math.min(f,s-1)),p+1>=i&&(m=Math.max(m,s+1))}else h[s]=void 0}l++};if(s)!function e(){setTimeout(function(){if(l>c||Date.now()>u)return s(void 0);g()||e()},0)}();else for(;l<=c&&Date.now()<=u;){const e=g();if(e)return e}}addToPath(e,t,n,s,r){const a=e.lastComponent;return a&&!r.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,s,r){const a=t.length,i=n.length;let o=e.oldPos,l=o-s,c=0;for(;l+1<a&&o+1<i&&this.equals(n[o+1],t[l+1],r);)l++,o++,c++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!r.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=o,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const s=[];let r;for(;e;)s.push(e),r=e.previousComponent,delete e.previousComponent,e=r;s.reverse();const a=s.length;let i=0,o=0,l=0;for(;i<a;i++){const e=s[i];if(e.removed)e.value=this.join(n.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let s=t.slice(o,o+e.count);s=s.map(function(e,t){const s=n[l+t];return s.length>e.length?s:e}),e.value=this.join(s)}else e.value=this.join(t.slice(o,o+e.count));o+=e.count,e.added||(l+=e.count)}}return s}};function $f(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Ff(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Df(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Vf(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Uf(e,t){return Df(e,t,"")}function Bf(e,t){return Vf(e,t,"")}function Zf(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let s=t.length;e.length<t.length&&(s=e.length);const r=Array(s);let a=0;r[0]=0;for(let e=1;e<s;e++){for(t[e]==t[a]?r[e]=r[a]:r[e]=a;a>0&&t[e]!=t[a];)a=r[a];t[e]==t[a]&&a++}a=0;for(let s=n;s<e.length;s++){for(;a>0&&e[s]!=t[a];)a=r[a];e[s]==t[a]&&a++}return a}(e,t))}function Hf(e,t){const n=[];for(const s of Array.from(t.segment(e))){const e=s.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Wf(e,t){if(t)return Jf(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Kf(e,t){if(t)return Jf(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function Jf(e,t){if(!t)return[Kf(e),Wf(e)];if("word"!=t.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');const n=Hf(e,t),s=n[0],r=n[n.length-1];return[/\s/.test(s)?s:"",/\s/.test(r)?r:""]}const Gf="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",qf=new RegExp(`[${Gf}]+|\\s+|[^${Gf}]`,"ug");const Yf=new class extends Mf{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const s=t.intlSegmenter;if("word"!=s.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=Hf(e,s)}else n=e.match(qf)||[];const s=[];let r=null;return n.forEach(e=>{/\s/.test(e)?null==r?s.push(e):s.push(s.pop()+e):null!=r&&/\s/.test(r)?s[s.length-1]==r?s.push(s.pop()+e):s.push(r+e):s.push(e),r=e}),s}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,s=null,r=null;return e.forEach(e=>{e.added?s=e:e.removed?r=e:((s||r)&&Qf(n,r,s,e,t.intlSegmenter),n=e,s=null,r=null)}),(s||r)&&Qf(n,r,s,null,t.intlSegmenter),e}};function Xf(e,t,n){return Yf.diff(e,t,n)}function Qf(e,t,n,s,r){if(t&&n){const[a,i]=Jf(t.value,r),[o,l]=Jf(n.value,r);if(e){const s=$f(a,o);e.value=Vf(e.value,o,s),t.value=Uf(t.value,s),n.value=Uf(n.value,s)}if(s){const e=Ff(i,l);s.value=Df(s.value,l,e),t.value=Bf(t.value,e),n.value=Bf(n.value,e)}}else if(n){if(e){const e=Kf(n.value,r);n.value=n.value.substring(e.length)}if(s){const e=Kf(s.value,r);s.value=s.value.substring(e.length)}}else if(e&&s){const n=Kf(s.value,r),[a,i]=Jf(t.value,r),o=$f(n,a);t.value=Uf(t.value,o);const l=Ff(Uf(n,o),i);t.value=Bf(t.value,l),s.value=Df(s.value,n,l),e.value=Vf(e.value,n,n.slice(0,n.length-l.length))}else if(s){const e=Kf(s.value,r),n=Zf(Wf(t.value,r),e);t.value=Bf(t.value,n)}else if(e){const n=Zf(Wf(e.value,r),Kf(t.value,r));t.value=Uf(t.value,n)}}const eg=new class extends Mf{constructor(){super(...arguments),this.tokenize=ng}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function tg(e,t,n){return eg.diff(e,t,n)}function ng(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],s=e.split(/(\n|\r\n)/);s[s.length-1]||s.pop();for(let e=0;e<s.length;e++){const r=s[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}const sg=["Date","RegExp","String","Number"],rg=Object.getOwnPropertyNames(globalThis.Temporal||{});function ag(e,t,n={cyclesFix:!0},s=[]){let r=[];const a=Array.isArray(e);for(const i in e){const o=e[i],l=a?+i:i;if(!(i in t)){r.push({type:"REMOVE",path:[l],oldValue:o});continue}const c=t[i],d="object"==typeof o&&"object"==typeof c&&Array.isArray(o)===Array.isArray(c),u=d&&o?Object.getPrototypeOf(o)?.constructor?.name:void 0;if(!(o&&c&&d)||sg.includes(u)||rg.includes(u)||n.cyclesFix&&s.includes(o))Object.is(o,c)||rg.includes(u)&&String(o)===String(c)||sg.includes(u)&&(isNaN(o)?o+""==c+"":+o===+c)||r.push({path:[l],type:"CHANGE",value:c,oldValue:o});else{n.cyclesFix&&s.push(o);const e=ag(o,c,n,s);n.cyclesFix&&s.pop();for(const t of e)t.path.unshift(l),r.push(t)}}const i=Array.isArray(t);for(const n in t)n in e||r.push({type:"CREATE",path:[i?+n:n],value:t[n]});return r}function ig(e,t){const n=ag(e,t);let s="";for(const e of n){if(s+=` ${e.path.join(".")}:\n`,"CHANGE"===e.type)if("string"==typeof e.oldValue&&"string"==typeof e.value){const t=tg(e.oldValue,e.value);for(const e of t)if(e.added)s+=`+ ${e.value.replaceAll("\n","⏎")}\n`;else if(e.removed)s+=`- ${e.value.replaceAll("\n","⏎")}\n`;else{const t=Xf(e.value,e.value);for(const n of t)n.added?s+=`+ ${n.value.replaceAll("\n","⏎")}\n`:n.removed?s+=`- ${n.value.replaceAll("\n","⏎")}\n`:s+=` ${e.value.replaceAll("\n","⏎")}\n`}}else s+=`- ${JSON.stringify(e.oldValue)}\n`,s+=`+ ${JSON.stringify(e.value)}\n`;"CREATE"===e.type&&(s+=`+ ${JSON.stringify(e.value)}\n`),"REMOVE"===e.type&&(s+=`- ${JSON.stringify(e.oldValue)}\n`),s+="\n"}return s}function og(s){const{children:r,onClickContinue:a,value:o}=s,c=l(o),[d,u]=i(null),h=Us(e=>e.playWarning);return e(n,{children:[d,y(r,{onClick:()=>{const n=ag(c.current,o);JSON.stringify(c.current)===JSON.stringify(o)||0===Object.keys(n).length?a():(h(),u(t(qi,{isOpen:!0,title:t(Fr,{className:"tt-se",children:"attention"}),primary:{onClick:()=>u(null),label:t(Fr,{className:"tt-se",children:"close"})},secondary:{onClick:a,label:t(Fr,{className:"tt-se",children:"continue without saving"})},onClose:()=>u(null),children:e("div",{children:[t(Fr,{className:"tt-se",children:"there are unsaved changes"}),":",t("div",{className:"alert-modal-json-viewer jk-br-ie",children:t(uo,{code:ig(c.current,o),language:Se.DIFF,maxHeight:"calc(var(--modal-max-height) - var(--text-large-height) - (var(--font-size-h3) * var(--line-height-head)) - (var(--pad-md) *2) - (var(--gap) * 4) - var(--tx-h-m) - (var(--tx-h-m) * 2))"})})]})})))}})]})}function lg({onClick:e,className:n="",children:s,style:r}){return t("div",{className:A("field",n),style:r,onClick:e,children:s})}function cg({date:n,label:s,show:r,twoLines:a,withDayName:i,className:o,onClick:l}){return e(lg,{className:"jk-col nowrap",onClick:l,children:[t("div",{className:A("date-field jk-row",o),children:t(Dr,{date:n,twoLines:a,show:r,withDayName:i})}),t("div",{className:"jk-row date-field-label cr-tx-sc tx-t",children:"string"==typeof s?t(Fr,{className:"tt-se",children:s}):s})]})}function dg({text:n,label:s,onClick:r,className:a}){return e(lg,{className:"text-field-container jk-col nowrap",onClick:r,children:[t("div",{className:A("text-field jk-row",a),children:n}),t("div",{className:"jk-row text-field-label cr-tx-sc tx-t",children:"string"==typeof s?t(Fr,{className:"tt-se",children:s}):s})]})}const ug=()=>import("./GraphvizViewer-DsTGulG0.js"),hg=u(()=>ug()),pg=e=>t(h,{fallback:t(bt,{}),children:t(hg,{...e})});function mg({value:n,onSave:s}){return t("div",{className:"jk-graph-editor-modal jk-col nowrap gap stretch wh-100",children:e(Oi,{style:{height:`calc(${24*(n?.split("\n").length||1)}px + var(--pad-sm) * 3 + 24px + 8px)`},children:[t("div",{className:"jk-col jk-pg-xsm ht-100",children:t(aa,{value:n,onChange:s,className:"ws-np flex-1"})}),t("div",{className:"jk-row",style:{overflow:"auto"},children:t(pg,{dot:n})})]})})}function fg({value:n,onChange:s,className:r}){const[a,o]=i(!1);return e("div",{className:A("jk-row nowrap center jk-graphviz-editor-container",r),style:{position:"relative"},children:[s&&t(Bs,{onClick:()=>o(!0),style:{},icon:t(Kt,{}),className:"float-top-right pad-t"}),t(pg,{dot:n}),s&&t(ga,{isOpen:a,onClose:()=>o(!1),children:t(mg,{value:n,onSave:s})})]})}const gg=(n,s)=>n.map(({selected:n,icon:r,label:a,tooltipLabel:i,onClick:o,menuItemWrapper:l},c)=>{const d="vertical"===s.type,u=!!d&&s.open,h=!d&&s.isSmallScreen,p=e("div",d?{className:A("jk-menu-item jk-pg-xsm jk-br-ie cr-pr jk-row gap left",{selected:!!n}),style:{margin:u?"0 var(--pad-xt)":void 0},onClick:()=>o?.(u),"data-tooltip-id":"jk-tooltip","data-tooltip-content":u?"":i,"data-tooltip-place":"right",children:[t("div",{className:"jk-menu-item-icon jk-row",children:Yn(r)}),t("div",{className:"jk-menu-item-label",children:Yn(a)})]}:{className:A("jk-menu-item pn-re jk-pg-xsm jk-br-ie nowrap cr-pr",{"selected cr-tx-ht-it":!!n,"jk-row gap cr-tx-ht-it":!h,"jk-col flex-1 bottom":h}),onClick:()=>o?.(),children:[r&&t("div",{className:"jk-menu-item-icon jk-row",children:Yn(r)}),t("div",{className:"jk-menu-item-label tx-t",children:Yn(a)})]},c);return l?t(f,{children:Xn(l,{selected:n,icon:r,label:a,onClick:o,children:p,index:c,isOpenVerticalMenu:d?u:null},c)},c):p}),bg={isOpen:!1,onOpen:()=>null,onClose:()=>null,toggle:()=>null},vg=({menu:n,rightMobile:s,centerMobile:r,drawerMenuMobile:a,onBack:i})=>e("section",{className:"jk-row nowrap block jk-menu-content space-between elevation-1",children:[t("div",{className:"jk-horizontal-menu-mobile-left jk-row stretch left",children:a?t(Ja,{content:e=>Xn(a,{...e,menu:n}),position:"left",triggerOn:E.NONE,closeOnOutside:!0,children:({onOpen:e})=>t("div",{className:"jk-row sides-mobile-padding",children:t(Bs,{size:"small",onClick:e,icon:t(Wt,{})})})}):i&&t("div",{className:"jk-row sides-mobile-padding",children:t(Bs,{size:"small",onClick:i,icon:t(tn,{})})})}),t("div",{className:"jk-horizontal-menu-mobile-center jk-row stretch",children:!!r&&(r.content?t(Ja,{content:e=>Xn(r.content,e),position:"top",closeOnOutside:!0,children:e=>Xn(r.children,e)}):Xn(r.children,bg))}),t("div",{className:"jk-horizontal-menu-mobile-right jk-row stretch right",children:!!s&&(s.content?t(Ja,{content:e=>Xn(s.content,e),position:"right",closeOnOutside:!0,children:e=>t("div",{className:"jk-row sides-mobile-padding stretch",children:Xn(s.children,e)})}):t("div",{className:"jk-row sides-mobile-padding stretch",children:Xn(s.children,bg)}))})]}),yg=({items:e})=>t("section",{className:"jk-row nowrap jk-bottom-horizontal-menu elevation-1",children:t("div",{className:"jk-menu-items ht-100 jk-pg-sm-rl flex-1 jk-row gap nowrap extend",children:e})});function wg(n){const{className:s="",leftSection:r,rightSection:a,children:i,menu:o,rightMobile:l,drawerMenuMobile:c,centerMobile:d,onBack:u}=n,h=Ds(e=>e.viewPort.isSmallScreen),m=p(()=>gg(o,{type:"horizontal",isSmallScreen:h}),[o,h]);return e("div",{className:A("jk-horizontal-menu-layout-container ht-100 wh-100",s),children:[t("header",{className:"jk-menu wh-100 jk-top-horizontal-menu sticky-top",children:h?t(vg,{menu:o,rightMobile:l,centerMobile:d,drawerMenuMobile:c,onBack:u}):e("section",{className:"jk-row nowrap jk-menu-content wh-100 pn-re",children:[t("div",{className:"jk-menu-left-section jk-row stretch left nowrap",children:Yn(r)}),t("div",{className:"jk-menu-items flex-1 jk-row gap left nowrap",children:m}),t("div",{className:"jk-menu-right-section jk-row stretch right nowrap",children:Yn(a)})]})}),t("section",{className:"jk-menu-main-layout",children:i}),h&&t(yg,{items:m})]})}const kg=n=>{const{copyButtons:s,onPickImageUrl:r,publicImages:a}=n,{addNotification:i}=si();return t("div",{className:"public-images-tab jk-row",children:a.map((n,a)=>e("div",{className:"thumbnail",children:[t("img",{src:n.imageThumbnailUrl+`?v=${(new Date).getTime()}`,alt:"image "+a}),t(ci,{actionButtons:[...s?[{icon:t(yt,{}),buttons:[{icon:t(yt,{size:"small"}),label:t(Fr,{children:"URL"}),onClick:async()=>{await Jn(n.imageUrl),i({type:ge.QUIET,message:t(Fr,{children:"copied"})})}},{icon:t(yt,{}),label:t(Fr,{children:"MD"}),onClick:async()=>{await Jn(``),i({type:ge.QUIET,message:t(Fr,{children:"copied"})})}}]}]:[],...r?[{icon:t(Tt,{}),buttons:[{icon:t(Tt,{size:"small"}),label:t(Fr,{children:"pick"}),onClick:()=>{r(n),i({type:ge.QUIET,message:t(Fr,{children:"picked"})})}}]}]:[]]})]},n.imageUrl))})},Ng=e=>t(ii,{url:ps.API_V2.image.getPublicList().url,triggerFetch:e.trigger,children:({data:{contents:n}})=>t(kg,{publicImages:n,copyButtons:e.copyButtons,onPickImageUrl:e.onPickImageUrl})}),xg=w(function({copyButtons:s,onPickImageUrl:r,onUploadedImage:a}){const[o,l]=i(""),[c,d]=i(),[u,h]=i(!1),{addNotification:p}=si();return e("div",{className:"upload-new-image-tab jk-col top gap",children:[o&&e("div",{className:"jk-col left",children:[s&&e(n,{children:[e("div",{className:"jk-row gap left fw-bd",children:[t(Fr,{children:"public url"}),":",e("div",{className:"copyable jk-row",children:[t("a",{href:o,className:"link",target:"_blank",rel:"noreferrer",children:o}),t(Hs,{text:o,iconSize:"small"})]})]}),e("div",{className:"jk-row gap left fw-bd",children:[t(Fr,{children:"markdown use"}),":",e("div",{className:"copyable jk-row",children:[e("span",{className:"tx-t fw-bd",children:[""]}),t(Hs,{text:``,iconSize:"small"})]})]})]}),r&&t(Bs,{onClick:()=>r({imageUrl:o,imageThumbnailUrl:o.replace("https://images.juki.pub/o/","https://images.juki.pub/t/")}),expand:!0,children:t(Fr,{children:"pick"})})]}),t(oa,{checked:u,leftLabel:t(Fr,{className:A("tt-se",{"fw-bd":!u}),children:"not public"}),rightLabel:t(Fr,{className:A("tt-se",{"fw-bd":u}),children:"public"}),onChange:h}),t(za,{onClick:async e=>{if(c?.previewCanvasRef.current){const n=await F(c.previewCanvasRef.current);if(n){e?.(K.LOADING);const{status:s,message:r,content:i}=await ss(n,u);s===K.SUCCESS?(p({type:ge.SUCCESS,message:t(Fr,{children:r})}),e?.(K.SUCCESS),l(i.imageUrl),a()):(p({type:ge.ERROR,message:t(Fr,{children:r})}),e?.(K.ERROR))}}},disabled:!c||!c?.previewCanvasRef.current,children:t(Fr,{children:"upload image"})}),t(go,{onCropChange:d,withAspect:!0,withRotate:!0,withScale:!0})]})});function Sg(s){const{isOpen:r,onClose:a,withPublicImagesTab:o=!0,copyButtons:l,onPickImageUrl:c}=s,[d,u]=i(0),h=[];return o&&h.push({key:"public-images",header:e(n,{children:[t(Fr,{className:"tt-se",children:"public images"}),t(Bs,{icon:t(Ht,{}),type:"secondary",onClick:()=>u(d+1)})]}),body:t(Ng,{trigger:d,copyButtons:l,onPickImageUrl:c},"public-images-tab")}),h.push({key:"upload-new-image",header:t(Fr,{className:"tt-se",children:"upload new image"}),body:t(xg,{copyButtons:l,onPickImageUrl:c,onUploadedImage:()=>u(d+1)},"upload-new-image-tab")}),t(ga,{isOpen:r,onClose:a,className:"modal-upload-image",children:t("div",{children:t(Pi,{tabs:h})})})}function jg(s){const{open:r,setOpen:a,isOpenRef:i,withLabel:o=!1,copyButtons:l,onPickImageUrl:c,children:d}=s;i&&(i.current=r);const u=d||(({setOpen:e,withLabel:n})=>t(Bs,{icon:t(nn,{}),type:"secondary",size:"small",onClick:()=>e(!0),children:n&&t(Fr,{children:"pick / upload image"})}));return e(n,{children:[t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":o?"":"upload image","data-tooltip-t-class-name":"ws-np tt-se",children:u({open:r,setOpen:a,withLabel:o})}),t(Sg,{isOpen:r,onClose:()=>a(!1),copyButtons:l,onPickImageUrl:c})]})}const Eg=()=>{const{notifyResponse:e,addErrorNotification:n}=si(),s=Ya(e=>e.mutate),r=d(async({url:t,options:n,setLoader:s,onSuccess:r,onError:a,onFinally:i})=>{s?.(K.LOADING);const o=fe(await es(t,n));e(o,s)?await(r?.(o)):await(a?.(o)),i?.(o)},[e]),a=d(async({params:e,body:t,onSuccess:n,...a})=>{const{url:i,...o}=ps.API_V2.auth.signIn({body:t,params:e});await r({url:i,options:o,onSuccess:async e=>{await s(),await(n?.(e))},...a})},[r,s]),i=d(async({body:e,onSuccess:t,...n})=>{const{url:a,...i}=ps.API_V2.auth.signUp({body:e});await r({url:a,options:i,onSuccess:async e=>{await s(),await(t?.(e))},...n})},[r,s]),o=d(async({params:e,body:t,...n})=>{const{url:s,...a}=ps.API_V2.auth.createUser({params:e,body:t});await r({url:s,options:a,...n})},[r]),l=d(async({params:e,body:t,...n})=>{const{url:s,...a}=ps.API_V2.user.updateProfileData({params:e,body:t});await r({url:s,options:a,...n})},[r]),c=d(async({params:t,body:n,setLoader:s,onSuccess:r,onError:a,onFinally:i})=>{const{url:o,...l}=ps.API_V2.user.updateProfileImage({params:t,body:{contentType:n.type}});s?.(K.LOADING);const c=fe(await es(o,l));if(c.success)try{if(!(await fetch(c.content.signedUrl,{method:je.PUT,headers:{"Content-Type":n.type},body:n})).ok)return s?.(K.ERROR),a?.({success:!1,message:"Error on upload image with signed url",errors:[]}),void i?.(c)}catch(e){return s?.(K.ERROR),a?.({success:!1,message:e?.message||"Unknow error on upload image with signed url",errors:[]}),void i?.(c)}e(c,s)?r?.(c):a?.(c),i?.(c)},[e]),u=d(async({body:e,params:t,...n})=>{const{url:s,...a}=ps.API_V2.auth.updatePassword({params:t,body:e});await r({url:s,options:a,...n})},[r]),h=d(async({params:{organizationKey:e,nickname:t},...n})=>{const{url:s,...a}=ps.API_V2.auth.resetPassword({params:{organizationKey:e,nickname:t}});await r({url:s,options:a,...n})},[r]);return{signIn:a,signUp:i,logout:d(async({onError:e,onFinally:a,...i})=>{const{url:o,...l}=ps.API_V2.auth.signOut();await r({url:o,options:l,onError:async s=>{n(t(Fr,{className:"tt-se",children:"force Logout"})),await(e?.(s))},onFinally:async e=>{await s(),await(a?.(e))},...i})},[n,r,s]),updatePassword:u,createUser:o,updateUserProfileData:l,updateUserProfileImage:c,resetUserPassword:h,deleteUserSession:d(async({params:e,...t})=>{const{url:n,...s}=ps.API_V2.user.deleteSession({params:e});await r({url:n,options:s,...t})},[r]),updateUserPreferences:d(async({params:e,body:t,...n})=>{const{url:s,...a}=ps.API_V2.user.updatePreferences({params:e,body:t});await r({url:s,options:a,...n})},[r])}},Cg=()=>{const e=$r(e=>e.changeLanguage),t=Ya(e=>e.setUser),{isLogged:n,settings:s,nickname:r,organization:{key:a}}=Ya(e=>e.user),o=Ya(e=>e.mutate),{updateUserPreferences:l}=Eg(),[c,u]=i(K.NONE),h=d(async i=>{const c={...s};for(const{key:e,value:t}of i)e===ke.LANGUAGE&&(c[ke.LANGUAGE]=t),e===ke.THEME&&(c[ke.THEME]=t),e===ke.DATA_VIEW_MODE&&(c[ke.DATA_VIEW_MODE]=t),e===ke.MENU_VIEW_MODE&&(c[ke.MENU_VIEW_MODE]=t),e===ke.NEWSLETTER_SUBSCRIPTION&&(c[ke.NEWSLETTER_SUBSCRIPTION]=t),e===ke.TIME_ZONE&&(c[ke.TIME_ZONE]=t),e===ke.FONT_SIZE&&(c[ke.FONT_SIZE]=t);n?await l({params:{nickname:r,organizationKey:a},body:{...c},setLoader:u,onSuccess:async()=>{u?.(K.LOADING),await o(),u?.(K.SUCCESS)}}):t({settings:c}),e(c[ke.LANGUAGE])},[e,n,o,r,t,s,l,a]),p=c===K.LOADING;return{...s,loading:p,setSettings:h}};function Og({children:e,nickname:n,organizationKey:s}){const r=oi(e=>e.searchParams),{Link:a}=ma(e=>e.components),i=p(()=>{const e=ms(r);return e.delete(C.USER_PREVIEW),e.append(C.USER_PREVIEW,n),s&&e.append(C.USER_PREVIEW,s),e},[s,r,n]);return t(a,{href:{query:i.toString()},children:e})}function _g(n){const{className:s}=n;return e("div",{className:A("jk-row nowrap center fr-4",s),children:[t("div",{className:A("jk-user-profile-img bc-bk",{huge:!1}),style:{height:24,width:24}})," ",t("div",{className:"jk-col flex-1",children:t("div",{className:"fw-bd",children:"nickname"})})]})}const Ig=a(function(s,r){const{imageUrl:a,email:i,familyName:o,nickname:l,givenName:c,className:d,organizationKey:u,withoutLink:h,children:p,onlyImage:m}=s,{Image:f}=ma(e=>e.components),g=Ya(e=>e.organization.key),b=t("span",{className:A("jk-user-profile-img pn-re",{large:!(!c&&!o&&!i)}),children:t(f,{src:a,alt:l,fill:!0,className:"br-50-pc"})});return e("div",{ref:r,className:A("jk-row nowrap center",d),children:[h?e(n,{children:[b,!m&&e(n,{children:[" ",t("div",{className:"jk-col flex-1",children:t("div",{className:"fw-bd",children:l})})]})]}):t(Og,{nickname:l,organizationKey:u,children:e("div",{className:"jk-row nowrap",children:[b,!m&&e(n,{children:[" ",e("div",{className:"jk-col flex-1",children:[t("div",{className:"fw-bd",children:l}),g!==u&&t("div",{className:"jk-tag bc-ht-lt tx-t cr-tx-sc",style:{padding:"1px 2px"},children:u}),(!!c||!!o)&&e("div",{className:"fw-lt ta-cr tx-s",style:{lineHeight:1},children:[c," ",o]}),!!i&&t("div",{className:"fw-lt tx-s",style:{lineHeight:1},children:i})]})]})]})}),p]})});const Tg=w(function({withLabel:n,isVertical:s,popoverPlacement:r,isHorizontal:a,onSeeMyProfile:i,profileSelected:o,className:l}){const{logout:c}=Eg(),d=Ya(e=>e.user.nickname),u=Ya(e=>e.user.organization.key),h=Ya(e=>e.user.imageUrl),p=Ya(e=>e.user.isLogged),m=Ya(e=>e.isLoading),f=oi(e=>e.setSearchParams),{Image:g}=ma(e=>e.components);return m?t("div",{className:"jk-row",children:t(bt,{className:"cr-we"})}):p?t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:e("div",{className:"jk-col gap user-profile-popup jk-pg-sm",children:[t(g,{src:h,className:"jk-user-profile-img huge elevation-1",alt:d,height:50,width:50}),d,e("div",{className:"jk-col gap",children:[!!i&&t(za,{expand:!0,onClick:()=>i(d,u),children:t(Fr,{className:"ws-np tt-se",children:"my account"})}),t(za,{expand:!0,onClick:e=>c({setLoader:e}),type:"secondary",icon:t(sn,{}),disabled:!!rs(),children:t(Fr,{className:"ws-np tt-se",children:"sign out"})})]})]}),offset:4,placement:r,children:e(Ig,{organizationKey:u,imageUrl:h,nickname:d,className:A("user-logged-head extend",{left:!!n},l),onlyImage:!n,children:[a&&o&&t("div",{className:"selected horizontal"}),s&&o&&t("div",{className:"selected vertical"})]})}):t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":n?"":"sign in","data-tooltip-t-class-name":"ws-np ws-np",className:"jk-row extend",children:t(Bs,{onClick:()=>f({name:C.SIGN_IN,value:"true"}),icon:t(rn,{}),expand:!0,children:n&&t(Fr,{className:"ws-np tt-se",children:"sign in"})})})});function Ag({children:s,style:r}){const{Link:a,Image:i}=ma(e=>e.components);return e("div",{className:"jk-col gap extend center nowrap",style:r,children:[t("div",{className:"jk-row pn-re",style:{height:"40%",width:"80%"},children:t(i,{alt:"Juki surprised image",className:"image-border",fill:!0,src:"https://images.juki.pub/assets/juki-image-surprised.png"})}),s||e(n,{children:[t("h3",{children:t(Fr,{className:"tt-se ta-cr",children:"page not found"})}),t("p",{className:"ta-cr",children:t(Fr,{className:"tt-se",children:"the page does not exist or you do not have permissions to view it"})}),t(a,{href:"/public",children:t(Bs,{icon:t(Ot,{}),children:t(Fr,{children:"go to home page"})})})]})]})}const Pg=(e,t)=>{const n=l(null),[s,r]=i(void 0),{data:a,error:c,isLoading:u,mutate:h,isValidating:p}=ei(s,t),m=ua(e),f=d(async({pagination:e,filter:t,sort:n})=>{const s=m.current?.({pagination:e||{page:0,pageSize:25},filter:t,sort:n});if(!s)return;let a=!1;r(e=>(a=e===s,s)),a&&await h()},[m,h]);return o(()=>{n.current?.(u||p?K.LOADING:K.NONE)},[u,p]),{data:a,error:c,isLoading:u,isValidating:p,request:f,setLoaderStatusRef:d(e=>n.current=e,[])}},zg=()=>import("./DataViewer-Cv0iOPJ_.js"),Lg=u(()=>zg()),Rg=e=>t(h,{fallback:t(bt,{}),children:t(Lg,{...e})});function Mg(e){const{cards:n,rows:s={height:68},headers:r,name:a,toRow:i,getUrl:o,refreshInterval:c,extraNodes:d,getRecordKey:u,onRecordClick:h,onRecordHover:m,getRecordStyle:f,downloads:g,className:b,groups:v,deps:y=[],virtualizerOverscan:w,focusRowKey:k}=e,N=Ds(e=>e.viewPort.isSmallScreen),{data:x,request:S,setLoaderStatusRef:j}=Pg(o,{refreshInterval:c}),E=l(-1);E.current=x?.success?x.meta.totalElements:E.current;const C=ua(i),O=p(()=>{const e=x?.success?x.contents:[];return C.current?e.map(C.current):e},[x,C]);return t(Rg,{getRecordStyle:f,cards:n,headers:r,data:O,rows:s,requestRef:S,rowsView:!N,name:a,setLoaderStatusRef:j,extraNodes:d,extraNodesFloating:!0,totalData:Math.max(E.current,0),getRecordKey:u,onRecordClick:h,onRecordHover:m,pageSizeOptions:mt,initializing:-1===E.current,downloads:g,deps:y,className:b,groups:v,virtualizerOverscan:w,focusRowKey:k,...pt})}const $g=()=>import("./ExcalidrawButton-zJFah1nC.js"),Fg=u(()=>$g()),Dg=()=>t(h,{fallback:t(bt,{}),children:t(Fg,{})});function Vg(){const s=Us(e=>e.playBell),[r,a]=i(!1),[o,l]=i(!0),[c,u]=i("timer"),h=d(()=>{if("countdown"===c){s();for(let e=1;e<=3;e++)setTimeout(()=>{s()},1e3*e)}},[s,c]),p=Hi("tool-buttons-countdown",-1e3,h),m=Hi("tool-buttons-timer",1e3),f="timer"===c?m:p,g=n=>t(oa,{size:n,className:"ht-ao",leftLabel:e("div",{className:A(`jk-row tx-${(n||"").at(0)} fw-bd`,{"--cr-tx-ht":"timer"===c}),children:[t(Fr,{className:"tt-se",children:"timer"})," ",t(an,{size:n,filledCircle:"timer"===c||"var(--cr-tx-ht)",className:A({"cr-tx-ht":"timer"===c,"cr-we":"timer"!==c})})]}),rightLabel:e("div",{className:A(`jk-row tx-${(n||"").at(0)} fw-bd`,{"--cr-tx-ht":"timer"===c}),children:[t(cn,{size:n,filledCircle:"countdown"===c||"var(--cr-tx-ht)",className:A({"cr-tx-ht":"countdown"===c,"cr-we":"countdown"!==c})})," ",t(Fr,{className:"tt-se",children:"countdown"})]}),checked:"countdown"===c,onChange:()=>{u("countdown"===c?"timer":"countdown"),m.clear(),p.clear()}}),b=t(Wi,{inline:!0,type:"hours-minutes-seconds",counter:f.counter}),v=s=>e(n,{children:["countdown"===c&&e("div",{className:"jk-row gap",children:[t(Bs,{size:s,icon:t("div",{children:"+1"}),onClick:()=>p.setCountdownFrom(p.countdownFrom+Ee)}),t(Bs,{size:s,icon:t("div",{children:"+5"}),onClick:()=>p.setCountdownFrom(p.countdownFrom+5*Ee)}),t(Bs,{size:s,icon:t("div",{children:"-1"}),onClick:()=>p.setCountdownFrom(Math.max(p.countdownFrom-Ee,0))}),t(Bs,{size:s,icon:t("div",{children:"-5"}),onClick:()=>p.setCountdownFrom(Math.max(p.countdownFrom-5*Ee,0))})]}),e("div",{className:"jk-row gap block",children:[t(Bs,{size:s,icon:f.isRunning?t(dn,{}):t(un,{}),onClick:()=>{f.isRunning?f.pause():f.start()},type:f.isRunning?"secondary":"primary",className:f.isRunning?"":"bc-ss cr-we"}),t(Bs,{size:s,icon:t(hn,{}),disabled:f.isStopped,className:"bc-er cr-we",onClick:()=>{m.clear(),p.clear()}})]})]});return e(n,{children:[r?t(La,{offset:8,className:A("is-active right",{}),icon:t(an,{}),size:"tiny",buttons:[{icon:t(an,{}),label:t(Fr,{className:"tt-se",children:"exit"}),size:"tiny",onClick:()=>{a(!1),m.clear(),p.clear()}},{children:e("div",{className:"jk-col gap bc-sf-hi elevation-1 jk-pg-xsm jk-br-ie",children:[g("tiny"),b,v("tiny"),e("div",{className:"jk-row",children:[t(Fr,{className:"tt-se tx-t",children:"fullscreen"}),t(oa,{size:"tiny",className:"ht-ao",leftLabel:t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"no fullscreen","data-tooltip-place":"bottom-end",className:"jk-row",children:t(ln,{})}),rightLabel:t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"fullscreen","data-tooltip-place":"bottom-end",className:"jk-row",children:t(on,{})}),checked:o,onChange:()=>l(!o)})]})]})}],children:r&&!o?t("div",{className:A({"jk-overlay-backdrop jk-br-ie cr-ss-lt jk-pg-xsm-rl":!f.isStopped&&!o}),children:b}):void 0}):t("div",{className:"jk-row right",children:t(Bs,{tooltipContent:"active timer / countdown",type:"secondary",size:"tiny",icon:t(an,{}),onClick:()=>a(!0)})}),o&&t(fa,{children:t("div",{style:{pointerEvents:r?void 0:"none",opacity:r?1:0,backgroundColor:"var(--cr-ht-lt)"},className:"bc-sf-hi jk-col stretch jk-overlay-backdrop jk-overlay",children:e("div",{className:"jk-col gap huge-text",children:[t("div",{className:"jk-col gap display-on-hover-1 bf-4 jk-pg-sm jk-br",children:g("huge")}),t("div",{className:"jk-col jk-pg-sm bc-sf-hi wh-100",style:{"--background-color":"#FAFBFC44"},children:b}),t("div",{className:"jk-col gap display-on-hover-2 bf-4 jk-pg-sm jk-br",children:v("huge")})]})})})]})}const Ug=()=>Ds(e=>e.isFullscreen)?t(n,{children:t("div",{className:"jk-row right",children:t(Bs,{tooltipContent:"exit fullscreen",type:"secondary",size:"tiny",icon:t(ln,{}),onClick:()=>{"undefined"!=typeof document&&(document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen())}})})}):t("div",{className:"jk-row right",children:t(Bs,{tooltipContent:"fullscreen",type:"secondary",size:"tiny",icon:t(on,{}),onClick:()=>function(){if("undefined"!=typeof document){const e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen()}}()})});function Bg(){const e=l(null),[n,s]=i(!1);return o(()=>{const t=t=>{e.current&&(e.current.style.left=`${t.clientX}px`,e.current.style.top=`${t.clientY}px`)};if(n){const n=document.createElement("div");n.className="laser-pointer",document.body.appendChild(n),e.current=n,window.addEventListener("mousemove",t)}else e.current&&e.current.remove();return()=>{window.removeEventListener("mousemove",t),e.current&&e.current.remove()}},[n]),t("div",{className:A("jk-row right",{"is-active":n}),children:t(Bs,{tooltipContent:n?"exit laser pointer":"active laser pointer",type:n?"primary":"secondary",size:"tiny",icon:t(pn,{}),onClick:()=>s(!n)})})}function Zg({style:n}){return t(fa,{children:e("div",{style:n,className:"jk-col gap stretch right presentation-tool-buttons opacity-hover-4",children:[t("div",{className:"jk-row right",children:t(mn,{size:"tiny","data-tooltip-id":"jk-tooltip","data-tooltip-content":"page tools"})}),t(Vg,{}),t(Dg,{}),t(Bg,{}),t(Ug,{})]})})}function Hg({onSelect:s,extend:r=!1,organizationKey:a=""}){const[l,c]=i(null),[d,u]=i(""),[h,p]=i({}),{notifyResponse:m}=si(),[f,g]=i(0),{data:b}=ei(ps.API_V2.organization.getJudgeList({params:{organizationKey:a}}).url),v=b?.success?b.content:[],y=v[0];o(()=>{!l&&y&&c(y)},[y,l]),o(()=>{u(""),(async()=>{if(l){p(e=>({...e,[l.key]:{problems:e[l.key]?.problems||[],loading:!0}}));const{url:e}=ps.API_V2.problem.getBasicSummaryList({params:{page:1,pageSize:1e5,filterUrl:`judgeKeys=${l.key}`}}),t=fe(await es(e)),n=t.success&&t.contents||[];p(e=>({...e,[l.key]:{problems:n,loading:!1}}))}})()},[l,f]);const w=t(za,{onClick:async e=>{e(K.LOADING);const{url:t}=ps.API_V2.problem.getSummary({params:{key:d}}),n=fe(await es(t));n.success?(s(n.content),e(K.SUCCESS)):m(n,e)},size:"tiny",icon:t(Jt,{}),disabled:!(l?.key===Ce.CODEFORCES?{valid:2!==d.split("-").filter(Boolean).length}:!1===l?.isExternal||l?.key===Ce.JUKI_JUDGE||l?.key===Ce.JV_UMSA?{valid:!!d}:{valid:!1}).valid,children:t(Fr,{children:"select"})});return t("div",{className:A("jk-row-col gap nowrap",{extend:r}),children:e("div",{className:"jk-col gap extend flex-1",children:[e("div",{className:"jk-row nowrap gap",children:[e("label",{className:"jk-row nowrap",children:[t(Fr,{className:"tt-se ws-np fw-bd",children:"judge"}),": ",t(sa,{options:v.map(e=>({label:e.name,value:e})),selectedOption:{value:l},onChange:({value:e})=>c(e)})]}),(!1===l?.isExternal||l?.key===Ce.JUKI_JUDGE||l?.key===Ce.JV_UMSA)&&e(n,{children:[t(Hr,{labelPlacement:"left",label:t(Fr,{className:"tt-se ws-np",children:"key"}),size:6,value:d,onChange:e=>u(e)}),w]}),l?.key===Ce.CODEFORCES&&e(n,{children:[t(Hr,{labelPlacement:"left",label:t(Fr,{className:"tt-se ws-np fw-bd",children:"contest id"}),size:6,value:d.split("-")[0]||"",onChange:e=>u(`${e}-${d.split("-")[1]||""}`)}),t(Hr,{labelPlacement:"left",label:t(Fr,{className:"tt-se ws-np fw-bd",children:"index"}),size:"auto",value:d.split("-")[1]||"",onChange:e=>u(`${d.split("-")[0]||""}-${e}`)}),w]})]}),l&&e("div",{className:"jk-row extend gap",children:[h[l.key]?.problems?.length?t("div",{className:"jk-row flex-1",children:t(xi,{options:(h[l.key]?.problems??[]).map(n=>({label:e("div",{className:"jk-row stretch gap nowrap jk-pg-xsm-tb left ht-100",children:[e("div",{className:"jk-col gap",children:[t("span",{className:"fw-br cr-tx-ht",children:n.key}),t("span",{style:{fontFamily:"monospace"},className:"tx-t",children:n.shortname})]}),e("div",{className:"jk-col stretch",children:[e("div",{className:"jk-row gap left",children:[n.name,t("div",{className:"jk-tag bc-io-lt cr-we tx-t",children:Oe[n.settings.type].label})]}),t("div",{className:"jk-row left gap tx-s",children:n.tags?.map(e=>t("div",{className:"jk-tag bc-ht-lt",children:e},e))})]})]}),inputLabel:e("div",{children:[n.key," ",n.name," ",n.tags?.map(e=>t("div",{className:"jk-tag bc-sf-hi",children:e},e))]}),value:n})),selectedOptions:[].map(e=>({value:e})),onChange:e=>e[0]?s({...e[0].value}):null,optionsPlacement:"bottom",expand:!0,rowHeightOption:72,onFilter:({search:e,option:t})=>{const n=e.toLowerCase();return t.value.name.toLowerCase().indexOf(n)>-1||t.value.key.toLowerCase().indexOf(n)>-1||t.value.tags.some(e=>e.toLowerCase().indexOf(n)>-1)},multiselect:!1})}):t("div",{className:"jk-row flex-1",style:{height:34},children:t(Fr,{className:"tt-se",children:"no problems"})}),t(za,{type:"secondary",tooltipContent:"reload",icon:h[l.key]?.loading?t(bt,{}):t(Ht,{}),onClick:()=>g(Date.now())})]})]})})}function Wg({verdict:e,small:n}){const s=Ya(e=>e.user.settings[ke.THEME])===Ie.DARK?"CC":"";return t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":_e[e]?.label,className:"jk-tag tx-t",style:{backgroundColor:_e[e]?.color+s,...n?{lineHeight:1,padding:"2px 4px"}:{}},children:e})}const Kg=e=>!(e===Te.CE||e===Te.HIDDEN||e===Te.NONE||e===Te.PENDING);var Jg;!function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(Jg||(Jg={}));var Gg;!function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"}(Gg||(Gg={}));const qg=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");function Yg(e){return e?e.replace(/\\/g,"/"):e}function Xg(e){const t=e.length;let n=-1/0;for(let s=0;s<t;s++)n=Math.max(n,e[s]);return n}function Qg(e,t){const n=e.split(".");return n.length>1?n[n.length-1]:t}function eb(e,t){return t.reduce((t,n)=>t||e.startsWith(n),!1)}const tb=["a/","b/","i/","w/","c/","o/"];function nb(e,t,n){const s=void 0!==n?[...tb,n]:tb,r=t?new RegExp(`^${a=t,a.replace(qg,"\\$&")} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$');var a;const[,i=""]=r.exec(e)||[],o=s.find(e=>0===i.indexOf(e));return(o?i.slice(o.length):i).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function sb(e,t={}){const n=[];let s=null,r=null,a=null,i=null,o=null,l=null,c=null;const d="--- ",u="+++ ",h="@@",p=/^old mode (\d{6})/,m=/^new mode (\d{6})/,f=/^deleted file mode (\d{6})/,g=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,v=/^copy to "?(.+)"?/,y=/^rename from "?(.+)"?/,w=/^rename to "?(.+)"?/,k=/^similarity index (\d+)%/,N=/^dissimilarity index (\d+)%/,x=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,j=/^GIT binary patch/,E=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,C=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,O=/^new file mode (\d{6})/,_=/^deleted file mode (\d{6}),(\d{6})/,I=e.replace(/\/g,"").replace(/\r\n?/g,"\n").split("\n");function T(){null!==r&&null!==s&&(s.blocks.push(r),r=null)}function A(){null!==s&&(s.oldName||null===l||(s.oldName=l),s.newName||null===c||(s.newName=c),s.newName&&(n.push(s),s=null)),l=null,c=null}function P(){T(),A(),s={blocks:[],deletedLines:0,addedLines:0}}function z(e){let t;T(),null!==s&&((t=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(e))?(s.isCombined=!1,a=parseInt(t[1],10),o=parseInt(t[2],10)):(t=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(e))?(s.isCombined=!0,a=parseInt(t[1],10),i=parseInt(t[2],10),o=parseInt(t[3],10)):(e.startsWith(h)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,s.isCombined=!1)),r={lines:[],oldStartLine:a,oldStartLine2:i,newStartLine:o,header:e}}return I.forEach((e,i)=>{if(!e||e.startsWith("*"))return;let T;const A=I[i-1],L=I[i+1],R=I[i+2];if(e.startsWith("diff --git")||e.startsWith("diff --combined")){P();if((T=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(e))&&(l=nb(T[1],void 0,t.dstPrefix),c=nb(T[2],void 0,t.srcPrefix)),null===s)throw new Error("Where is my file !!!");return void(s.isGitDiff=!0)}if(e.startsWith("Binary files")&&!(null==s?void 0:s.isGitDiff)){P();if((T=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(e))&&(l=nb(T[1],void 0,t.dstPrefix),c=nb(T[2],void 0,t.srcPrefix)),null===s)throw new Error("Where is my file !!!");return void(s.isBinary=!0)}if((!s||!s.isGitDiff&&s&&e.startsWith(d)&&L.startsWith(u)&&R.startsWith(h))&&P(),null==s?void 0:s.isTooBig)return;if(s&&("number"==typeof t.diffMaxChanges&&s.addedLines+s.deletedLines>t.diffMaxChanges||"number"==typeof t.diffMaxLineLength&&e.length>t.diffMaxLineLength)){s.isTooBig=!0,s.addedLines=0,s.deletedLines=0,s.blocks=[],r=null;return void z("function"==typeof t.diffTooBigMessage?t.diffTooBigMessage(n.length):"Diff too big to be displayed")}if(e.startsWith(d)&&L.startsWith(u)||e.startsWith(u)&&A.startsWith(d)){if(s&&!s.oldName&&e.startsWith("--- ")&&(T=function(e,t){return nb(e,"---",t)}(e,t.srcPrefix)))return s.oldName=T,void(s.language=Qg(s.oldName,s.language));if(s&&!s.newName&&e.startsWith("+++ ")&&(T=function(e,t){return nb(e,"+++",t)}(e,t.dstPrefix)))return s.newName=T,void(s.language=Qg(s.newName,s.language))}if(s&&(e.startsWith(h)||s.isGitDiff&&s.oldName&&s.newName&&!r))return void z(e);if(r&&(e.startsWith("+")||e.startsWith("-")||e.startsWith(" ")))return void function(e){if(null===s||null===r||null===a||null===o)return;const t={content:e},n=s.isCombined?["+ "," +","++"]:["+"],i=s.isCombined?["- "," -","--"]:["-"];eb(e,n)?(s.addedLines++,t.type=Jg.INSERT,t.oldNumber=void 0,t.newNumber=o++):eb(e,i)?(s.deletedLines++,t.type=Jg.DELETE,t.oldNumber=a++,t.newNumber=void 0):(t.type=Jg.CONTEXT,t.oldNumber=a++,t.newNumber=o++),r.lines.push(t)}(e);const M=!function(e,t){let n=t;for(;n<I.length-3;){if(e.startsWith("diff"))return!1;if(I[n].startsWith(d)&&I[n+1].startsWith(u)&&I[n+2].startsWith(h))return!0;n++}return!1}(e,i);if(null===s)throw new Error("Where is my file !!!");(T=p.exec(e))?s.oldMode=T[1]:(T=m.exec(e))?s.newMode=T[1]:(T=f.exec(e))?(s.deletedFileMode=T[1],s.isDeleted=!0):(T=g.exec(e))?(s.newFileMode=T[1],s.isNew=!0):(T=b.exec(e))?(M&&(s.oldName=T[1]),s.isCopy=!0):(T=v.exec(e))?(M&&(s.newName=T[1]),s.isCopy=!0):(T=y.exec(e))?(M&&(s.oldName=T[1]),s.isRename=!0):(T=w.exec(e))?(M&&(s.newName=T[1]),s.isRename=!0):(T=S.exec(e))?(s.isBinary=!0,s.oldName=nb(T[1],void 0,t.srcPrefix),s.newName=nb(T[2],void 0,t.dstPrefix),z("Binary file")):j.test(e)?(s.isBinary=!0,z(e)):(T=k.exec(e))?s.unchangedPercentage=parseInt(T[1],10):(T=N.exec(e))?s.changedPercentage=parseInt(T[1],10):(T=x.exec(e))?(s.checksumBefore=T[1],s.checksumAfter=T[2],T[3]&&(s.mode=T[3])):(T=E.exec(e))?(s.checksumBefore=[T[2],T[3]],s.checksumAfter=T[1]):(T=C.exec(e))?(s.oldMode=[T[2],T[3]],s.newMode=T[1]):(T=O.exec(e))?(s.newFileMode=T[1],s.isNew=!0):(T=_.exec(e))&&(s.deletedFileMode=T[1],s.isDeleted=!0)}),T(),A(),n}class rb{diff(e,t,n={}){let s;"function"==typeof n?(s=n,n={}):"callback"in n&&(s=n.callback);const r=this.castInput(e,n),a=this.castInput(t,n),i=this.removeEmpty(this.tokenize(r,n)),o=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(i,o,n,s)}diffWithOptionsObj(e,t,n,s){var r;const a=e=>(e=this.postProcess(e,n),s?void setTimeout(function(){s(e)},0):e),i=t.length,o=e.length;let l=1,c=i+o;null!=n.maxEditLength&&(c=Math.min(c,n.maxEditLength));const d=null!==(r=n.timeout)&&void 0!==r?r:1/0,u=Date.now()+d,h=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=o&&p+1>=i)return a(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,f=1/0;const g=()=>{for(let s=Math.max(m,-l);s<=Math.min(f,l);s+=2){let r;const l=h[s-1],c=h[s+1];l&&(h[s-1]=void 0);let d=!1;if(c){const e=c.oldPos-s;d=c&&0<=e&&e<i}const u=l&&l.oldPos+1<o;if(d||u){if(r=!u||d&&l.oldPos<c.oldPos?this.addToPath(c,!0,!1,0,n):this.addToPath(l,!1,!0,1,n),p=this.extractCommon(r,t,e,s,n),r.oldPos+1>=o&&p+1>=i)return a(this.buildValues(r.lastComponent,t,e))||!0;h[s]=r,r.oldPos+1>=o&&(f=Math.min(f,s-1)),p+1>=i&&(m=Math.max(m,s+1))}else h[s]=void 0}l++};if(s)!function e(){setTimeout(function(){if(l>c||Date.now()>u)return s(void 0);g()||e()},0)}();else for(;l<=c&&Date.now()<=u;){const e=g();if(e)return e}}addToPath(e,t,n,s,r){const a=e.lastComponent;return a&&!r.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+s,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,s,r){const a=t.length,i=n.length;let o=e.oldPos,l=o-s,c=0;for(;l+1<a&&o+1<i&&this.equals(n[o+1],t[l+1],r);)l++,o++,c++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!r.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=o,l}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const s=[];let r;for(;e;)s.push(e),r=e.previousComponent,delete e.previousComponent,e=r;s.reverse();const a=s.length;let i=0,o=0,l=0;for(;i<a;i++){const e=s[i];if(e.removed)e.value=this.join(n.slice(l,l+e.count)),l+=e.count;else{if(!e.added&&this.useLongestToken){let s=t.slice(o,o+e.count);s=s.map(function(e,t){const s=n[l+t];return s.length>e.length?s:e}),e.value=this.join(s)}else e.value=this.join(t.slice(o,o+e.count));o+=e.count,e.added||(l+=e.count)}}return s}}const ab=new class extends rb{};const ib="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";const ob=new class extends rb{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${ib}]+|[^\\S\\n\\r]+|[^${ib}]`,"ug");return e.match(t)||[]}};function lb(e){return(t,n)=>{const s=e(t).trim(),r=e(n).trim(),a=function(e,t){if(0===e.length)return t.length;if(0===t.length)return e.length;const n=[];let s,r;for(s=0;s<=t.length;s++)n[s]=[s];for(r=0;r<=e.length;r++)n[0][r]=r;for(s=1;s<=t.length;s++)for(r=1;r<=e.length;r++)t.charAt(s-1)===e.charAt(r-1)?n[s][r]=n[s-1][r-1]:n[s][r]=Math.min(n[s-1][r-1]+1,Math.min(n[s][r-1]+1,n[s-1][r]+1));return n[t.length][e.length]}(s,r);return a/(s.length+r.length)}}function cb(e){return function t(n,s,r=0,a=new Map){const i=function(t,n,s=new Map){let r,a=1/0;for(let i=0;i<t.length;++i)for(let o=0;o<n.length;++o){const l=JSON.stringify([t[i],n[o]]);let c;s.has(l)&&(c=s.get(l))||(c=e(t[i],n[o]),s.set(l,c)),c<a&&(a=c,r={indexA:i,indexB:o,score:a})}return r}(n,s,a);if(!i||n.length+s.length<3)return[[n,s]];const o=n.slice(0,i.indexA),l=s.slice(0,i.indexB),c=[n[i.indexA]],d=[s[i.indexB]],u=i.indexA+1,h=i.indexB+1,p=n.slice(u),m=s.slice(h),f=t(o,l,r+1,a),g=t(c,d,r+1,a),b=t(p,m,r+1,a);let v=g;return(i.indexA>0||i.indexB>0)&&(v=f.concat(v)),(n.length>u||s.length>h)&&(v=v.concat(b)),v}}const db={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ub={matching:"none",matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:"word",colorScheme:Gg.LIGHT},hb="/",pb=lb(e=>e.value),mb=cb(pb);function fb(e){return-1!==e.indexOf("dev/null")}function gb(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function bb(e){switch(e){case Jg.CONTEXT:return db.CONTEXT;case Jg.INSERT:return db.INSERTS;case Jg.DELETE:return db.DELETES}}function vb(e){switch(e){case Gg.DARK:return"d2h-dark-color-scheme";case Gg.AUTO:return"d2h-auto-color-scheme";case Gg.LIGHT:default:return"d2h-light-color-scheme"}}function yb(e){return e.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function wb(e,t,n=!0){const s=function(e){return e?2:1}(t);return{prefix:e.substring(0,s),content:n?yb(e.substring(s)):e.substring(s)}}function kb(e){const t=Yg(e.oldName),n=Yg(e.newName);if(t===n||fb(t)||fb(n))return fb(n)?t:n;{const e=[],s=[],r=t.split(hb),a=n.split(hb);let i=0,o=r.length-1,l=a.length-1;for(;i<o&&i<l&&r[i]===a[i];)e.push(a[i]),i+=1;for(;o>i&&l>i&&r[o]===a[l];)s.unshift(a[l]),o-=1,l-=1;const c=e.join(hb),d=s.join(hb),u=r.slice(i,o+1).join(hb),h=a.slice(i,l+1).join(hb);return c.length&&d.length?c+hb+"{"+u+" → "+h+"}"+hb+d:c.length?c+hb+"{"+u+" → "+h+"}":d.length?"{"+u+" → "+h+"}"+hb+d:t+" → "+n}}function Nb(e){return`d2h-${function(e){let t,n,s,r=0;for(t=0,s=e.length;t<s;t++)n=e.charCodeAt(t),r=(r<<5)-r+n,r|=0;return r}(kb(e)).toString().slice(-6)}`}function xb(e){let t="file-changed";return e.isRename||e.isCopy?t="file-renamed":e.isNew?t="file-added":e.isDeleted?t="file-deleted":e.newName!==e.oldName&&(t="file-renamed"),t}function Sb(e,t,n,s={}){const{matching:r,maxLineLengthHighlight:a,matchWordsThreshold:i,diffStyle:o}=Object.assign(Object.assign({},ub),s),l=wb(e,n,!1),c=wb(t,n,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:yb(l.content)},newLine:{prefix:c.prefix,content:yb(c.content)}};const d="char"===o?(u=l.content,h=c.content,ab.diff(u,h,p)):function(e,t,n){return ob.diff(e,t,n)}(l.content,c.content);var u,h,p;const m=[];if("word"===o&&"words"===r){const e=d.filter(e=>e.removed),t=d.filter(e=>e.added);mb(t,e).forEach(e=>{if(1===e[0].length&&1===e[1].length){pb(e[0][0],e[1][0])<i&&(m.push(e[0][0]),m.push(e[1][0]))}})}const f=d.reduce((e,t)=>{const n=t.added?"ins":t.removed?"del":null,s=m.indexOf(t)>-1?' class="d2h-change"':"",r=yb(t.value);return null!==n?`${e}<${n}${s}>${r}</${n}>`:`${e}${r}`},"");return{oldLine:{prefix:l.prefix,content:(g=f,g.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,""))},newLine:{prefix:c.prefix,content:gb(f)}};var g}const jb="file-summary",Eb={colorScheme:ub.colorScheme};class Cb{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Eb),t)}render(e){const t=e.map(e=>this.hoganUtils.render(jb,"line",{fileHtmlId:Nb(e),oldName:e.oldName,newName:e.newName,fileName:kb(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template("icon",xb(e))})).join("\n");return this.hoganUtils.render(jb,"wrapper",{colorScheme:vb(this.config.colorScheme),filesNumber:e.length,files:t})}}const Ob=Object.assign(Object.assign({},ub),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),_b="generic",Ib="line-by-line";class Tb{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Ob),t)}render(e){const t=e.map(e=>{let t;return t=e.blocks.length?this.generateFileHtml(e):this.generateEmptyDiff(),this.makeFileDiffHtml(e,t)}).join("\n");return this.hoganUtils.render(_b,"wrapper",{colorScheme:vb(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&0===e.blocks.length)return"";const n=this.hoganUtils.template(Ib,"file-diff"),s=this.hoganUtils.template(_b,"file-path"),r=this.hoganUtils.template("icon","file"),a=this.hoganUtils.template("tag",xb(e));return n.render({file:e,fileHtmlId:Nb(e),diffs:t,filePath:s.render({fileDiffName:kb(e)},{fileIcon:r,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(_b,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:db})}generateFileHtml(e){const t=cb(lb(t=>wb(t.content,e.isCombined).content));return e.blocks.map(n=>{let s=this.hoganUtils.render(_b,"block-header",{CSSLineClass:db,blockHeader:e.isTooBig?n.header:yb(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([n,r,a])=>{if(r.length&&a.length&&!n.length)this.applyRematchMatching(r,a,t).map(([t,n])=>{const{left:r,right:a}=this.processChangedLines(e,e.isCombined,t,n);s+=r,s+=a});else if(n.length)n.forEach(t=>{const{prefix:n,content:r}=wb(t.content,e.isCombined);s+=this.generateSingleLineHtml(e,{type:db.CONTEXT,prefix:n,content:r,oldNumber:t.oldNumber,newNumber:t.newNumber})});else if(r.length||a.length){const{left:t,right:n}=this.processChangedLines(e,e.isCombined,r,a);s+=t,s+=n}else console.error("Unknown state reached while processing groups of lines",n,r,a)}),s}).join("\n")}applyLineGroupping(e){const t=[];let n=[],s=[];for(let r=0;r<e.lines.length;r++){const a=e.lines[r];(a.type!==Jg.INSERT&&s.length||a.type===Jg.CONTEXT&&n.length>0)&&(t.push([[],n,s]),n=[],s=[]),a.type===Jg.CONTEXT?t.push([[a],[],[]]):a.type===Jg.INSERT&&0===n.length?t.push([[],[],[a]]):a.type===Jg.INSERT&&n.length>0?s.push(a):a.type===Jg.DELETE&&n.push(a)}return(n.length||s.length)&&(t.push([[],n,s]),n=[],s=[]),t}applyRematchMatching(e,t,n){const s=e.length*t.length,r=Xg(e.concat(t).map(e=>e.content.length));return s<this.config.matchingMaxComparisons&&r<this.config.maxLineSizeInBlockForComparison&&("lines"===this.config.matching||"words"===this.config.matching)?n(e,t):[[e,t]]}processChangedLines(e,t,n,s){const r={right:"",left:""},a=Math.max(n.length,s.length);for(let i=0;i<a;i++){const a=n[i],o=s[i],l=void 0!==a&&void 0!==o?Sb(a.content,o.content,t,this.config):void 0,c=void 0!==a&&void 0!==a.oldNumber?Object.assign(Object.assign({},void 0!==l?{prefix:l.oldLine.prefix,content:l.oldLine.content,type:db.DELETE_CHANGES}:Object.assign(Object.assign({},wb(a.content,t)),{type:bb(a.type)})),{oldNumber:a.oldNumber,newNumber:a.newNumber}):void 0,d=void 0!==o&&void 0!==o.newNumber?Object.assign(Object.assign({},void 0!==l?{prefix:l.newLine.prefix,content:l.newLine.content,type:db.INSERT_CHANGES}:Object.assign(Object.assign({},wb(o.content,t)),{type:bb(o.type)})),{oldNumber:o.oldNumber,newNumber:o.newNumber}):void 0,{left:u,right:h}=this.generateLineHtml(e,c,d);r.left+=u,r.right+=h}return r}generateLineHtml(e,t,n){return{left:this.generateSingleLineHtml(e,t),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,t){if(void 0===t)return"";const n=this.hoganUtils.render(Ib,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(_b,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:" "===t.prefix?" ":t.prefix,content:t.content,lineNumber:n,line:t,file:e})}}const Ab=Object.assign(Object.assign({},ub),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Pb="generic";class zb{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Ab),t)}render(e){const t=e.map(e=>{let t;return t=e.blocks.length?this.generateFileHtml(e):this.generateEmptyDiff(),this.makeFileDiffHtml(e,t)}).join("\n");return this.hoganUtils.render(Pb,"wrapper",{colorScheme:vb(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&0===e.blocks.length)return"";const n=this.hoganUtils.template("side-by-side","file-diff"),s=this.hoganUtils.template(Pb,"file-path"),r=this.hoganUtils.template("icon","file"),a=this.hoganUtils.template("tag",xb(e));return n.render({file:e,fileHtmlId:Nb(e),diffs:t,filePath:s.render({fileDiffName:kb(e)},{fileIcon:r,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Pb,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:db})}}generateFileHtml(e){const t=cb(lb(t=>wb(t.content,e.isCombined).content));return e.blocks.map(n=>{const s={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([n,r,a])=>{if(r.length&&a.length&&!n.length)this.applyRematchMatching(r,a,t).map(([t,n])=>{const{left:r,right:a}=this.processChangedLines(e.isCombined,t,n);s.left+=r,s.right+=a});else if(n.length)n.forEach(t=>{const{prefix:n,content:r}=wb(t.content,e.isCombined),{left:a,right:i}=this.generateLineHtml({type:db.CONTEXT,prefix:n,content:r,number:t.oldNumber},{type:db.CONTEXT,prefix:n,content:r,number:t.newNumber});s.left+=a,s.right+=i});else if(r.length||a.length){const{left:t,right:n}=this.processChangedLines(e.isCombined,r,a);s.left+=t,s.right+=n}else console.error("Unknown state reached while processing groups of lines",n,r,a)}),s}).reduce((e,t)=>({left:e.left+t.left,right:e.right+t.right}),{left:"",right:""})}applyLineGroupping(e){const t=[];let n=[],s=[];for(let r=0;r<e.lines.length;r++){const a=e.lines[r];(a.type!==Jg.INSERT&&s.length||a.type===Jg.CONTEXT&&n.length>0)&&(t.push([[],n,s]),n=[],s=[]),a.type===Jg.CONTEXT?t.push([[a],[],[]]):a.type===Jg.INSERT&&0===n.length?t.push([[],[],[a]]):a.type===Jg.INSERT&&n.length>0?s.push(a):a.type===Jg.DELETE&&n.push(a)}return(n.length||s.length)&&(t.push([[],n,s]),n=[],s=[]),t}applyRematchMatching(e,t,n){const s=e.length*t.length,r=Xg(e.concat(t).map(e=>e.content.length));return s<this.config.matchingMaxComparisons&&r<this.config.maxLineSizeInBlockForComparison&&("lines"===this.config.matching||"words"===this.config.matching)?n(e,t):[[e,t]]}makeHeaderHtml(e,t){return this.hoganUtils.render(Pb,"block-header",{CSSLineClass:db,blockHeader:(null==t?void 0:t.isTooBig)?e:yb(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,t,n){const s={right:"",left:""},r=Math.max(t.length,n.length);for(let a=0;a<r;a++){const r=t[a],i=n[a],o=void 0!==r&&void 0!==i?Sb(r.content,i.content,e,this.config):void 0,l=void 0!==r&&void 0!==r.oldNumber?Object.assign(Object.assign({},void 0!==o?{prefix:o.oldLine.prefix,content:o.oldLine.content,type:db.DELETE_CHANGES}:Object.assign(Object.assign({},wb(r.content,e)),{type:bb(r.type)})),{number:r.oldNumber}):void 0,c=void 0!==i&&void 0!==i.newNumber?Object.assign(Object.assign({},void 0!==o?{prefix:o.newLine.prefix,content:o.newLine.content,type:db.INSERT_CHANGES}:Object.assign(Object.assign({},wb(i.content,e)),{type:bb(i.type)})),{number:i.newNumber}):void 0,{left:d,right:u}=this.generateLineHtml(l,c);s.left+=d,s.right+=u}return s}generateLineHtml(e,t){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(t)}}generateSingleHtml(e){const t="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(Pb,"line",{type:(null==e?void 0:e.type)||`${db.CONTEXT} d2h-emptyplaceholder`,lineClass:void 0!==e?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:void 0!==e?n:`${n} d2h-code-side-emptyplaceholder`,prefix:" "===(null==e?void 0:e.prefix)?" ":null==e?void 0:e.prefix,content:null==e?void 0:e.content,lineNumber:null==e?void 0:e.number})}}var Lb,Rb={};function Mb(){return Lb||(Lb=1,function(e){var t=/\S/,n=/\"/g,s=/\n/g,r=/\r/g,a=/\\/g,i=/\u2028/,o=/\u2029/;function l(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function c(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function d(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var s=1,r=e.length;s<r;s++)if(t.charAt(n+s)!=e.charAt(s))return!1;return!0}e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(n,s){var r=n.length,a=0,i=null,o=null,u="",h=[],p=!1,m=0,f=0,g="{{",b="}}";function v(){u.length>0&&(h.push({tag:"_t",text:new String(u)}),u="")}function y(n,s){if(v(),n&&function(){for(var n=!0,s=f;s<h.length;s++)if(!(n=e.tags[h[s].tag]<e.tags._v||"_t"==h[s].tag&&null===h[s].text.match(t)))return!1;return n}())for(var r,a=f;a<h.length;a++)h[a].text&&((r=h[a+1])&&">"==r.tag&&(r.indent=h[a].text.toString()),h.splice(a,1));else s||h.push({tag:"\n"});p=!1,f=h.length}function w(e,t){var n="="+b,s=e.indexOf(n,t),r=c(e.substring(e.indexOf("=",t)+1,s)).split(" ");return g=r[0],b=r[r.length-1],s+n.length-1}for(s&&(s=s.split(" "),g=s[0],b=s[1]),m=0;m<r;m++)0==a?d(g,n,m)?(--m,v(),a=1):"\n"==n.charAt(m)?y(p):u+=n.charAt(m):1==a?(m+=g.length-1,"="==(i=(o=e.tags[n.charAt(m+1)])?n.charAt(m+1):"_v")?(m=w(n,m),a=0):(o&&m++,a=2),p=m):d(b,n,m)?(h.push({tag:i,n:c(u),otag:g,ctag:b,i:"/"==i?p-g.length:m+b.length}),u="",m+=b.length-1,a=0,"{"==i&&("}}"==b?m++:l(h[h.length-1]))):u+=n.charAt(m);return y(p,!0),h};var u={_t:!0,"\n":!0,$:!0,"/":!0};function h(t,n,s,r){var a,i=[],o=null,l=null;for(a=s[s.length-1];t.length>0;){if(l=t.shift(),a&&"<"==a.tag&&!(l.tag in u))throw new Error("Illegal content in < super tag.");if(e.tags[l.tag]<=e.tags.$||p(l,r))s.push(l),l.nodes=h(t,l.tag,s,r);else{if("/"==l.tag){if(0===s.length)throw new Error("Closing tag without opener: /"+l.n);if(o=s.pop(),l.n!=o.n&&!m(l.n,o.n,r))throw new Error("Nesting error: "+o.n+" vs. "+l.n);return o.end=l.i,i}"\n"==l.tag&&(l.last=0==t.length||"\n"==t[0].tag)}i.push(l)}if(s.length>0)throw new Error("missing closing tag: "+s.pop().n);return i}function p(e,t){for(var n=0,s=t.length;n<s;n++)if(t[n].o==e.n)return e.tag="#",!0}function m(e,t,n){for(var s=0,r=n.length;s<r;s++)if(n[s].c==e&&n[s].o==t)return!0}function f(e){var t=[];for(var n in e.partials)t.push('"'+b(n)+'":{name:"'+b(e.partials[n].name)+'", '+f(e.partials[n])+"}");return"partials: {"+t.join(",")+"}, subs: "+function(e){var t=[];for(var n in e)t.push('"'+b(n)+'": function(c,p,t,i) {'+e[n]+"}");return"{ "+t.join(",")+" }"}(e.subs)}e.stringify=function(t,n,s){return"{code: function (c,p,i) { "+e.wrapMain(t.code)+" },"+f(t)+"}"};var g=0;function b(e){return e.replace(a,"\\\\").replace(n,'\\"').replace(s,"\\n").replace(r,"\\r").replace(i,"\\u2028").replace(o,"\\u2029")}function v(e){return~e.indexOf(".")?"d":"f"}function y(e,t){var n="<"+(t.prefix||"")+e.n+g++;return t.partials[n]={name:e.n,partials:{}},t.code+='t.b(t.rp("'+b(n)+'",c,p,"'+(e.indent||"")+'"));',n}function w(e,t){t.code+="t.b(t.t(t."+v(e.n)+'("'+b(e.n)+'",c,p,0)));'}function k(e){return"t.b("+e+");"}e.generate=function(t,n,s){g=0;var r={code:"",subs:{},partials:{}};return e.walk(t,r),s.asString?this.stringify(r,n,s):this.makeTemplate(r,n,s)},e.wrapMain=function(e){return'var t=this;t.b(i=i||"");'+e+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(e,t,n){var s=this.makePartials(e);return s.code=new Function("c","p","i",this.wrapMain(e.code)),new this.template(s,t,this,n)},e.makePartials=function(e){var t,n={subs:{},partials:e.partials,name:e.name};for(t in n.partials)n.partials[t]=this.makePartials(n.partials[t]);for(t in e.subs)n.subs[t]=new Function("c","p","t","i",e.subs[t]);return n},e.codegen={"#":function(t,n){n.code+="if(t.s(t."+v(t.n)+'("'+b(t.n)+'",c,p,1),c,p,0,'+t.i+","+t.end+',"'+t.otag+" "+t.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(t.nodes,n),n.code+="});c.pop();}"},"^":function(t,n){n.code+="if(!t.s(t."+v(t.n)+'("'+b(t.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(t.nodes,n),n.code+="};"},">":y,"<":function(t,n){var s={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,s);var r=n.partials[y(t,n)];r.subs=s.subs,r.partials=s.partials},$:function(t,n){var s={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,s),n.subs[t.n]=s.code,n.inPartial||(n.code+='t.sub("'+b(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=k('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+v(e.n)+'("'+b(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=k('"'+b(e.text)+'"')},"{":w,"&":w},e.walk=function(t,n){for(var s,r=0,a=t.length;r<a;r++)(s=e.codegen[t[r].tag])&&s(t[r],n);return n},e.parse=function(e,t,n){return h(e,0,[],(n=n||{}).sectionTags||[])},e.cache={},e.cacheKey=function(e,t){return[e,!!t.asString,!!t.disableLambda,t.delimiters,!!t.modelGet].join("||")},e.compile=function(t,n){n=n||{};var s=e.cacheKey(t,n),r=this.cache[s];if(r){var a=r.partials;for(var i in a)delete a[i].instance;return r}return r=this.generate(this.parse(this.scan(t,n.delimiters),t,n),t,n),this.cache[s]=r}}(Rb)),Rb}var $b,Fb,Db,Vb={};var Ub=function(){if(Db)return Fb;Db=1;var e=Mb();return e.Template=($b||($b=1,function(e){function t(e,t,n){var s;return t&&"object"==typeof t&&(void 0!==t[e]?s=t[e]:n&&t.get&&"function"==typeof t.get&&(s=t.get(e))),s}e.Template=function(e,t,n,s){e=e||{},this.r=e.code||this.r,this.c=n,this.options=s||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(e,t,n){return""},v:function(e){return e=l(e),o.test(e)?e.replace(n,"&").replace(s,"<").replace(r,">").replace(a,"'").replace(i,"""):e},t:l,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var n=this.partials[e],s=t[n.name];if(n.instance&&n.base==s)return n.instance;if("string"==typeof s){if(!this.c)throw new Error("No compiler available.");s=this.c.compile(s,this.options)}if(!s)return null;if(this.partials[e].base=s,n.subs){for(key in t.stackText||(t.stackText={}),n.subs)t.stackText[key]||(t.stackText[key]=void 0!==this.activeSub&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);s=function(e,t,n,s,r,a){function i(){}function o(){}var l;i.prototype=e,o.prototype=e.subs;var c=new i;for(l in c.subs=new o,c.subsText={},c.buf="",s=s||{},c.stackSubs=s,c.subsText=a,t)s[l]||(s[l]=t[l]);for(l in s)c.subs[l]=s[l];for(l in r=r||{},c.stackPartials=r,n)r[l]||(r[l]=n[l]);for(l in r)c.partials[l]=r[l];return c}(s,n.subs,n.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=s,s},rp:function(e,t,n,s){var r=this.ep(e,n);return r?r.ri(t,n,s):""},rs:function(e,t,n){var s=e[e.length-1];if(c(s))for(var r=0;r<s.length;r++)e.push(s[r]),n(e,t,this),e.pop();else n(e,t,this)},s:function(e,t,n,s,r,a,i){var o;return(!c(e)||0!==e.length)&&("function"==typeof e&&(e=this.ms(e,t,n,s,r,a,i)),o=!!e,!s&&o&&t&&t.push("object"==typeof e?e:t[t.length-1]),o)},d:function(e,n,s,r){var a,i=e.split("."),o=this.f(i[0],n,s,r),l=this.options.modelGet,d=null;if("."===e&&c(n[n.length-2]))o=n[n.length-1];else for(var u=1;u<i.length;u++)void 0!==(a=t(i[u],o,l))?(d=o,o=a):o="";return!(r&&!o)&&(r||"function"!=typeof o||(n.push(d),o=this.mv(o,n,s),n.pop()),o)},f:function(e,n,s,r){for(var a=!1,i=!1,o=this.options.modelGet,l=n.length-1;l>=0;l--)if(void 0!==(a=t(e,n[l],o))){i=!0;break}return i?(r||"function"!=typeof a||(a=this.mv(a,n,s)),a):!r&&""},ls:function(e,t,n,s,r,a){var i=this.options.delimiters;return this.options.delimiters=a,this.b(this.ct(l(e.call(t,r,n)),t,s)),this.options.delimiters=i,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,s,r,a,i){var o,l=t[t.length-1],c=e.call(l);return"function"==typeof c?!!s||(o=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,l,t,n,o.substring(r,a),i)):c},mv:function(e,t,n){var s=t[t.length-1],r=e.call(s);return"function"==typeof r?this.ct(l(r.call(s)),s,n):r},sub:function(e,t,n,s){var r=this.subs[e];r&&(this.activeSub=e,r(t,n,this,s),this.activeSub=!1)}};var n=/&/g,s=/</g,r=/>/g,a=/\'/g,i=/\"/g,o=/[&<>\"\']/;function l(e){return String(null==e?"":e)}var c=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(Vb)),Vb).Template,e.template=e.Template,Fb=e}();const Bb={};Bb["file-summary-line"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<li class="d2h-file-list-line">'),s.b("\n"+n),s.b(' <span class="d2h-file-name-wrapper">'),s.b("\n"+n),s.b(s.rp("<fileIcon0",e,t," ")),s.b(' <a href="#'),s.b(s.v(s.f("fileHtmlId",e,t,0))),s.b('" class="d2h-file-name">'),s.b(s.v(s.f("fileName",e,t,0))),s.b("</a>"),s.b("\n"+n),s.b(' <span class="d2h-file-stats">'),s.b("\n"+n),s.b(' <span class="d2h-lines-added">'),s.b(s.v(s.f("addedLines",e,t,0))),s.b("</span>"),s.b("\n"+n),s.b(' <span class="d2h-lines-deleted">'),s.b(s.v(s.f("deletedLines",e,t,0))),s.b("</span>"),s.b("\n"+n),s.b(" </span>"),s.b("\n"+n),s.b(" </span>"),s.b("\n"+n),s.b("</li>"),s.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}}),Bb["file-summary-wrapper"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<div class="d2h-file-list-wrapper '),s.b(s.v(s.f("colorScheme",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="d2h-file-list-header">'),s.b("\n"+n),s.b(' <span class="d2h-file-list-title">Files changed ('),s.b(s.v(s.f("filesNumber",e,t,0))),s.b(")</span>"),s.b("\n"+n),s.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),s.b("\n"+n),s.b(' <a class="d2h-file-switch d2h-show">show</a>'),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(' <ol class="d2h-file-list">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("files",e,t,0))),s.b("\n"+n),s.b(" </ol>"),s.b("\n"+n),s.b("</div>"),s.fl()},partials:{},subs:{}}),Bb["generic-block-header"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b("<tr>"),s.b("\n"+n),s.b(' <td class="'),s.b(s.v(s.f("lineClass",e,t,0))),s.b(" "),s.b(s.v(s.d("CSSLineClass.INFO",e,t,0))),s.b('"></td>'),s.b("\n"+n),s.b(' <td class="'),s.b(s.v(s.d("CSSLineClass.INFO",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="'),s.b(s.v(s.f("contentClass",e,t,0))),s.b('">'),s.s(s.f("blockHeader",e,t,1),e,t,0,156,173,"{{ }}")&&(s.rs(e,t,function(e,t,n){n.b(n.t(n.f("blockHeader",e,t,0)))}),e.pop()),s.s(s.f("blockHeader",e,t,1),e,t,1,0,0,"")||s.b(" "),s.b("</div>"),s.b("\n"+n),s.b(" </td>"),s.b("\n"+n),s.b("</tr>"),s.fl()},partials:{},subs:{}}),Bb["generic-empty-diff"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b("<tr>"),s.b("\n"+n),s.b(' <td class="'),s.b(s.v(s.d("CSSLineClass.INFO",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="'),s.b(s.v(s.f("contentClass",e,t,0))),s.b('">'),s.b("\n"+n),s.b(" File without changes"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(" </td>"),s.b("\n"+n),s.b("</tr>"),s.fl()},partials:{},subs:{}}),Bb["generic-file-path"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<span class="d2h-file-name-wrapper">'),s.b("\n"+n),s.b(s.rp("<fileIcon0",e,t," ")),s.b(' <span class="d2h-file-name">'),s.b(s.v(s.f("fileDiffName",e,t,0))),s.b("</span>"),s.b("\n"+n),s.b(s.rp("<fileTag1",e,t," ")),s.b("</span>"),s.b("\n"+n),s.b('<label class="d2h-file-collapse">'),s.b("\n"+n),s.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),s.b("\n"+n),s.b(" Viewed"),s.b("\n"+n),s.b("</label>"),s.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}}),Bb["generic-line"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b("<tr>"),s.b("\n"+n),s.b(' <td class="'),s.b(s.v(s.f("lineClass",e,t,0))),s.b(" "),s.b(s.v(s.f("type",e,t,0))),s.b('">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("lineNumber",e,t,0))),s.b("\n"+n),s.b(" </td>"),s.b("\n"+n),s.b(' <td class="'),s.b(s.v(s.f("type",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="'),s.b(s.v(s.f("contentClass",e,t,0))),s.b('">'),s.b("\n"+n),s.s(s.f("prefix",e,t,1),e,t,0,162,238,"{{ }}")&&(s.rs(e,t,function(e,t,s){s.b(' <span class="d2h-code-line-prefix">'),s.b(s.t(s.f("prefix",e,t,0))),s.b("</span>"),s.b("\n"+n)}),e.pop()),s.s(s.f("prefix",e,t,1),e,t,1,0,0,"")||(s.b(' <span class="d2h-code-line-prefix"> </span>'),s.b("\n"+n)),s.s(s.f("content",e,t,1),e,t,0,371,445,"{{ }}")&&(s.rs(e,t,function(e,t,s){s.b(' <span class="d2h-code-line-ctn">'),s.b(s.t(s.f("content",e,t,0))),s.b("</span>"),s.b("\n"+n)}),e.pop()),s.s(s.f("content",e,t,1),e,t,1,0,0,"")||(s.b(' <span class="d2h-code-line-ctn"><br></span>'),s.b("\n"+n)),s.b(" </div>"),s.b("\n"+n),s.b(" </td>"),s.b("\n"+n),s.b("</tr>"),s.fl()},partials:{},subs:{}}),Bb["generic-wrapper"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<div class="d2h-wrapper '),s.b(s.v(s.f("colorScheme",e,t,0))),s.b('">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("content",e,t,0))),s.b("\n"+n),s.b("</div>"),s.fl()},partials:{},subs:{}}),Bb["icon-file-added"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),s.b("\n"+n),s.b(' width="14">'),s.b("\n"+n),s.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),s.b("\n"+n),s.b("</svg>"),s.fl()},partials:{},subs:{}}),Bb["icon-file-changed"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),s.b("\n"+n),s.b(' viewBox="0 0 14 16" width="14">'),s.b("\n"+n),s.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),s.b("\n"+n),s.b("</svg>"),s.fl()},partials:{},subs:{}}),Bb["icon-file-deleted"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),s.b("\n"+n),s.b(' viewBox="0 0 14 16" width="14">'),s.b("\n"+n),s.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),s.b("\n"+n),s.b("</svg>"),s.fl()},partials:{},subs:{}}),Bb["icon-file-renamed"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),s.b("\n"+n),s.b(' viewBox="0 0 14 16" width="14">'),s.b("\n"+n),s.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),s.b("\n"+n),s.b("</svg>"),s.fl()},partials:{},subs:{}}),Bb["icon-file"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),s.b("\n"+n),s.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),s.b("\n"+n),s.b("</svg>"),s.fl()},partials:{},subs:{}}),Bb["line-by-line-file-diff"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<div id="'),s.b(s.v(s.f("fileHtmlId",e,t,0))),s.b('" class="d2h-file-wrapper" data-lang="'),s.b(s.v(s.d("file.language",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="d2h-file-header">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("filePath",e,t,0))),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(' <div class="d2h-file-diff">'),s.b("\n"+n),s.b(' <div class="d2h-code-wrapper">'),s.b("\n"+n),s.b(' <table class="d2h-diff-table">'),s.b("\n"+n),s.b(' <tbody class="d2h-diff-tbody">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("diffs",e,t,0))),s.b("\n"+n),s.b(" </tbody>"),s.b("\n"+n),s.b(" </table>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b("</div>"),s.fl()},partials:{},subs:{}}),Bb["line-by-line-numbers"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<div class="line-num1">'),s.b(s.v(s.f("oldNumber",e,t,0))),s.b("</div>"),s.b("\n"+n),s.b('<div class="line-num2">'),s.b(s.v(s.f("newNumber",e,t,0))),s.b("</div>"),s.fl()},partials:{},subs:{}}),Bb["side-by-side-file-diff"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<div id="'),s.b(s.v(s.f("fileHtmlId",e,t,0))),s.b('" class="d2h-file-wrapper" data-lang="'),s.b(s.v(s.d("file.language",e,t,0))),s.b('">'),s.b("\n"+n),s.b(' <div class="d2h-file-header">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.f("filePath",e,t,0))),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(' <div class="d2h-files-diff">'),s.b("\n"+n),s.b(' <div class="d2h-file-side-diff">'),s.b("\n"+n),s.b(' <div class="d2h-code-wrapper">'),s.b("\n"+n),s.b(' <table class="d2h-diff-table">'),s.b("\n"+n),s.b(' <tbody class="d2h-diff-tbody">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.d("diffs.left",e,t,0))),s.b("\n"+n),s.b(" </tbody>"),s.b("\n"+n),s.b(" </table>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(' <div class="d2h-file-side-diff">'),s.b("\n"+n),s.b(' <div class="d2h-code-wrapper">'),s.b("\n"+n),s.b(' <table class="d2h-diff-table">'),s.b("\n"+n),s.b(' <tbody class="d2h-diff-tbody">'),s.b("\n"+n),s.b(" "),s.b(s.t(s.d("diffs.right",e,t,0))),s.b("\n"+n),s.b(" </tbody>"),s.b("\n"+n),s.b(" </table>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b(" </div>"),s.b("\n"+n),s.b("</div>"),s.fl()},partials:{},subs:{}}),Bb["tag-file-added"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),s.fl()},partials:{},subs:{}}),Bb["tag-file-changed"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),s.fl()},partials:{},subs:{}}),Bb["tag-file-deleted"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),s.fl()},partials:{},subs:{}}),Bb["tag-file-renamed"]=new Ub.Template({code:function(e,t,n){var s=this;return s.b(n=n||""),s.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),s.fl()},partials:{},subs:{}});class Zb{constructor({compiledTemplates:e={},rawTemplates:t={}}){const n=Object.entries(t).reduce((e,[t,n])=>{const s=Ub.compile(n,{asString:!1});return Object.assign(Object.assign({},e),{[t]:s})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Bb),e),n)}static compile(e){return Ub.compile(e,{asString:!1})}render(e,t,n,s,r){const a=this.templateKey(e,t);try{return this.preCompiledTemplates[a].render(n,s,r)}catch(e){throw new Error(`Could not find template to render '${a}'`)}}template(e,t){return this.preCompiledTemplates[this.templateKey(e,t)]}templateKey(e,t){return`${e}-${t}`}}const Hb=Object.assign(Object.assign(Object.assign({},Ob),Ab),{outputFormat:"line-by-line",drawFileList:!0});var Wb,Kb={};var Jb=function(){return Wb||(Wb=1,Object.defineProperty(Kb,"__esModule",{value:!0}),Kb.ColorSchemeType=Kb.DiffStyleType=Kb.LineMatchingType=Kb.OutputFormatType=Kb.LineType=void 0,function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(e||(Kb.LineType=e={})),Kb.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},Kb.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"},Kb.DiffStyleType={WORD:"word",CHAR:"char"},function(e){e.AUTO="auto",e.DARK="dark",e.LIGHT="light"}(t||(Kb.ColorSchemeType=t={}))),Kb;var e,t}();const Gb=({verdict:s,memoryUsed:r})=>Kg(s)?e(n,{children:[r," ",t(Fr,{className:"cr-tx-sc",children:"KB"})]}):t(n,{children:"-"}),qb=({verdict:s,timeUsed:r})=>Kg(s)?e(n,{children:[(r/1e3).toFixed(3)," ",t(Fr,{className:"cr-tx-sc",children:"s"})]}):t(n,{children:"-"}),Yb=[Ae.RECEIVED,Ae.COMPILING,Ae.COMPILED,Ae.FETCHING_TEST_CASES,Ae.JUDGING_TEST_CASE,Ae.RUNNING_TEST_CASES,Ae.RUNNING_SAMPLE_TEST_CASES,Ae.RUNNING_TEST_CASE,Ae.EXECUTED_TEST_CASE,Ae.FAILED_TEST_CASE,Ae.GRADING],Xb=w(s=>{const{verdict:r,points:a,submissionData:i,processedCases:o,shortLabel:l,className:c}=s,d=Ya(e=>e.user.settings?.[ke.THEME]),u=$r(e=>e.i18n.t),h=d===Ie.DARK?"CC":"";if(l){const s=_e[r]?.label?u(_e[r]?.label):r,i=[s.charAt(0).toUpperCase()+s.slice(1),r===Te.PENDING&&o&&o.samples.total+o.tests.total?`(${o.samples.processed+o.tests.processed} / ${o.samples.total+o.tests.total})`:"",r===Te.PA&&a?`(${(+a||0).toFixed(2)} ${u("pts.")})`:""].filter(Boolean).join(" ");return e("div",{className:"jk-row center jk-tag",style:{backgroundColor:_e[r]?.color+h},"data-tooltip-id":"jk-tooltip","data-tooltip-content":i,"data-tooltip-t":"false",children:[r===Te.PENDING&&e(n,{children:[t(bt,{size:"small"})," "]}),t(Fr,{className:"tt-se ws-np",children:r}),r===Te.PENDING&&o&&!!(o.samples.total+o.tests.total)&&e(n,{children:[" ",o.samples.processed+o.tests.processed," / ",o.samples.total+o.tests.total]}),r===Te.PA&&a&&e(n,{children:[" ",e("span",{className:"ws-np",children:["(",(+a||0).toFixed(2)," ",t(Fr,{children:"pts."}),")"]})]})]})}const p=i?.verdict??r,m=i?.status??Ae.COMPLETED,f=i?.testInfo,g=i?.points??a??0;return e("div",{className:A("jk-row nowrap jk-tag tx-s",c),style:{backgroundColor:_e[p]?.color+h,lineHeight:1.2,padding:"6px 8px"},children:[(Yb.includes(m)||p===Te.PENDING)&&e(n,{children:[t(bt,{size:"small"})," "]}),e("div",{className:"jk-col",children:[m===Ae.EXECUTED_TEST_CASE?e(n,{children:[t(Fr,!0===f?.sampleCase?{className:"tt-se",children:"running sample cases"}:!1===f?.sampleCase?{className:"tt-se",children:"running test cases"}:{className:"tt-se",children:"running cases"}),f&&e("span",{className:"ws-np",children:[f.caseResultsExecuted," / ",f.caseResultsTotal]})]}):m===Ae.COMPLETED?t(Fr,{className:"tt-se",children:_e[p]?.label||p}):t(Fr,{className:"tt-se",children:Pe?.[m].label||m}),m===Ae.COMPLETED&&p===Te.PA&&e("div",{className:"jk-row nowrap",style:{},children:["(",(+g||0).toFixed(2)," ",t(Fr,{children:"pts."}),")"]})]})]})});function Qb({diffInput:s,croppedDiff:r,isProblemEditor:a}){const[l,c]=i(!1),[d,u]=i(""),h=Ya(e=>e.user.settings[ke.THEME]),p=$r(e=>e.i18n.t);o(()=>{if(l)if(/\$\/.*\.out/.test(s)||/\$\/.*\.judge.out/.test(s)){let n=s;a||(e=s,t=p("file"),n=e.replace(/\$\S+\.out/,`$/${t}.out`).replace(/\$\S+\.judge\.out/g,`$/${t}.judge.out`));const r=function(e,t={}){const n=Object.assign(Object.assign({},Hb),t),s="string"==typeof e?sb(e,n):e,r=new Zb(n),{colorScheme:a}=n,i={colorScheme:a};return(n.drawFileList?new Cb(r,i).render(s):"")+("side-by-side"===n.outputFormat?new zb(r,n).render(s):new Tb(r,n).render(s))}(n,{drawFileList:!1,matching:"words",renderNothingWhenEmpty:!1,colorScheme:h===Ie.DARK?Jb.ColorSchemeType.DARK:Jb.ColorSchemeType.LIGHT,outputFormat:"side-by-side"});u(r)}else u(s);var e,t},[s,h,l,a,p]);const m=s.length-s.indexOf("No newline at end of file")>26;return e(n,{children:[t(Bs,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"view diff",icon:t(kt,{}),size:"tiny",type:"secondary",onClick:()=>c(!0)}),t(ga,{isOpen:l,onClose:()=>c(!1),closeIcon:!0,expand:!0,children:e("div",{className:"jk-col stretch gap jk-pg-lg diff-body-modal",children:[t("div",{children:r&&t(Fr,{className:"tt-se cr-er fw-bd",children:"only the first 1000 characters of the difference are being displayed"})}),t("div",{className:"wh-100",dangerouslySetInnerHTML:{__html:d}}),s.includes("No newline at end of file")&&e("div",{className:"jk-row block center",children:[t("div",{className:"bc-er cr-we",children:m&&t(Fr,{children:"no newline at end of file"})}),t("div",{className:"bc-er cr-we",children:!m&&t(Fr,{children:"no newline at end of file"})})]})]})})]})}function ev(s){const{groupKey:r,problemScoringMode:a,timeUsed:i,memoryUsed:o,verdict:l,points:c,testCases:u,submitId:h,isProblemEditor:p}=s,m=Ds(e=>e.viewPort.isSmallScreen||e.viewPort.isMediumScreen)?70:40,f=JSON.stringify(u),g=d(n=>{const s=JSON.parse(f)[n];return s?e("div",{className:"jk-row extend block gap jk-table-inline-row",style:{borderBottom:"1px solid var(--cr-ht)",height:"100%",padding:0},children:[t("div",p?{"data-tooltip-id":"jk-tooltip","data-tooltip-content":s.testCaseKey,"data-tooltip-t-class-name":"ws-np",className:"jk-row",style:{flex:.4},children:n+1}:{className:"jk-row",style:{flex:.4},children:n+1}),e("div",{className:"jk-row gap center nowrap",style:{flex:2},children:[t(Xb,{verdict:s.verdict,submitId:h}),s.diff&&t(Qb,{croppedDiff:s.croppedDiff,diffInput:s.diff.replaceAll(s.testCaseKey+".judge.out","A").replaceAll(s.testCaseKey+".out","B"),isProblemEditor:p})]}),a===ze.PARTIAL&&t("div",{className:"jk-row",children:s.points?.toFixed(3)}),t("div",{className:"jk-row center ws-np nowrap",children:t(qb,{verdict:s.verdict,timeUsed:s.timeUsed})}),t("div",{className:"jk-row center ws-np nowrap",children:t(Gb,{verdict:s.verdict,memoryUsed:s.memoryUsed})}),t("div",{className:A("jk-row center gap",{"cr-er fw-bd":0!==s?.exitCode}),children:s.exitCode})]},n):null},[p,a,h,f]);return t(wa,{header:({isOpen:s,toggle:d})=>e("div",{className:A("jk-row extend block gap jk-table-inline-row jk-pg-md group-info",{"fw-br":s}),children:[e("div",{className:"jk-row left nowrap",children:[!!u.length&&e(n,{children:[t(fn,{onClick:d,rotate:s?0:180,className:"link"})," "]}),+r?a===ze.SUBTASK?e(n,{children:[t(Fr,{className:"tt-se ws-np",children:"subtask"})," ",r]}):a===ze.PARTIAL?e(n,{children:[t(Fr,{className:"tt-se ws-np",children:"group"})," ",r]}):t(Fr,{className:"tt-se",children:"test cases"}):t(Fr,{className:"tt-se",children:"sample cases"})]}),t("div",{className:"jk-row center gap nowrap",style:{flex:3},children:t(Xb,{verdict:l,points:c,submitId:h})}),(a===ze.SUBTASK||a===ze.PARTIAL)&&t("div",{className:"jk-row center",children:+c.toFixed(4)}),t("div",{className:"jk-row center",children:t(qb,{timeUsed:i,verdict:l})}),t("div",{className:"jk-row center",children:t(Gb,{verdict:l,memoryUsed:o})})]}),className:"wh-100 tx-s",children:e("div",{className:"jk-row extend group-info-details",children:[e("div",{className:"jk-row extend block gap jk-table-inline-row fw-bd",children:[t("div",{className:"jk-row",style:{flex:.4},children:t(Fr,{children:"#"})}),t("div",{className:"jk-row center gap",style:{flex:2},children:t(Fr,{className:"tt-se",children:"verdict"})}),a===ze.PARTIAL&&t("div",{className:"jk-row center gap",children:t(Fr,{className:"tt-se",children:"points"})}),t("div",{className:"jk-row center gap",children:t(Fr,{className:"tt-se",children:"time"})}),t("div",{className:"jk-row center gap",children:t(Fr,{className:"tt-se",children:"memory"})}),t("div",{className:"jk-row center gap",children:t(Fr,{className:"tt-se",children:"exit code"})})]}),t("div",{style:{width:"100%",height:m*Math.min(u.length,3)+1},className:A({"top-bottom-inset-shadow":u.length>3}),children:t(_a,{size:u.length,rowHeight:m,renderRow:g})})]})})}const tv=e=>({[Ae.RECEIVED]:0,[Ae.COMPILING]:1,[Ae.COMPILED]:2,[Ae.COMPILATION_ERROR]:3,[Ae.RUNNING_SAMPLE_TEST_CASES]:4,[Ae.RUNNING_TEST_CASES]:5+(e?0:2),[Ae.RUNNING_TEST_CASE]:5+(e?0:2),[Ae.EXECUTED_TEST_CASE]:5+(e?0:2),[Ae.FAILED_TEST_CASE]:5+(e?0:2),[Ae.JUDGING_TEST_CASE]:5+(e?0:2),[Ae.FETCHING_TEST_CASES]:6,[Ae.GRADING]:8,[Ae.FAILED]:9,[Ae.COMPLETED]:10,[Ae.NONE]:10}),nv=tv(!0),sv=tv(!1),rv=({status:e,testInfo:t})=>(t?.sampleCase?nv:sv)[e],av=new Map,iv=zs((e,t)=>({entries:{},apply:(n,s)=>{const r=t().entries[n];if(r&&!((e,t)=>{if(t.status===Ae.RECEIVED)return t.createdAt>e.createdAt;const n=rv(t),s=rv(e);return n>s||n===s&&t.createdAt>e.createdAt})(r.data,s))return;const a=!((i=s.status)===Ae.COMPLETED||i===Ae.FAILED);var i;clearTimeout(av.get(n)),av.delete(n),a||av.set(n,setTimeout(()=>t().remove(n),3e4)),e(e=>{const t={...e.entries,[n]:{judging:a,data:s,receivedAt:Date.now()}},r=Object.keys(t);return r.length>1e3&&r.sort((e,n)=>t[e].receivedAt-t[n].receivedAt).slice(0,r.length-1e3).forEach(e=>delete t[e]),{entries:t}})},remove:t=>{clearTimeout(av.get(t)),av.delete(t),e(e=>{if(!e.entries[t])return e;const{[t]:n,...s}=e.entries;return{entries:s}})}}));let ov=null,lv="",cv=()=>{};const dv=new Map,uv=new Map,hv=new Map,pv=new Map,mv=new Map,fv=[],gv=new Set,bv=(e,t)=>e.set(t,(e.get(t)??0)+1),vv=(e,t)=>{const n=(e.get(t)??0)-1;n>0?e.set(t,n):e.delete(t)},yv=e=>[...e.keys()].pop(),wv=()=>{const e=yv(uv),t=yv(hv),n=yv(pv);return{...e?{contestKey:e}:{},...t?{problemKey:t}:{},...n?{presenceCompanyKey:n}:{}}};let kv={};const Nv=()=>kv,xv=e=>{const t=Be(e,lv);if(!t)return;const n=JSON.stringify(e);gv.has(n)||(fv.push(n),gv.add(n),fv.length>200&&gv.delete(fv.shift()),cv(t,e))},Sv=e=>{if(e.startsWith("submission:"))return{params:{rewind:"1"}};const t=e.split(":");return Ue(e)||"user"===t[0]&&3===t.length?{params:{rewind:"2m"}}:void 0},jv=()=>{const e=Nv(),t=new Set(dv.keys());for(const n of Object.keys(e)){if(n.includes("*"))continue;(n.startsWith("session:")||n.startsWith("user:"))&&t.add(n);const e=Ve(n);e&&uv.has(e.contestKey)&&t.add(n)}return new Set([...t].filter(t=>((e,t)=>Object.entries(e).some(([e,n])=>(n.includes("subscribe")||n.includes("*"))&&((e,t)=>{if("*"===e)return!0;const n=e.split(":"),s=t.split(":");for(let e=0;e<n.length;e++){const t=e===n.length-1;if("*"!==n[e]){if(n[e]!==s[e])return!1}else{if(t)return s.length>e;if(void 0===s[e])return!1}}return n.length===s.length})(e,t)))(e,t)))};let Ev=null;const Cv=new Map,Ov=new Map,_v=e=>{const t=kv[e]??[],n=[];return(t.includes("presence")||t.includes("*"))&&n.push("PRESENCE"),(t.includes("presence-subscribe")||t.includes("subscribe")||t.includes("*"))&&n.push("PRESENCE_SUBSCRIBE"),n},Iv=async(e,t)=>{const n=Ov.get(t);if(n?.size)try{const s=await e.channels.get(t).presence.get();n.forEach(e=>e(s))}catch(e){De("error getting presence members",{name:t,error:e})}};let Tv=Promise.resolve();const Av=()=>{const e=ov;e&&(Tv=Tv.then(()=>(async e=>{const t=new Set(Object.keys(kv).filter(e=>e.startsWith("presence:organization:")&&!e.includes("*")));for(const n of[...Cv.keys()])if(!t.has(n)){Cv.delete(n);const t=e.channels.get(n);t.presence.unsubscribe(),t.detach().then(()=>e.channels.release(n)).catch(e=>De("error detaching presence channel",{name:n,error:e}))}for(const n of t){const t=_v(n);if(!t.length)continue;const s=Cv.get(n)??{modes:"",entered:!1,subscribed:!1};Cv.set(n,s);const r=e.channels.get(n);try{const a=t.join(",");s.modes!==a&&(await r.setOptions({modes:t}),s.modes=a),t.includes("PRESENCE")&&Ev&&(await(s.entered?r.presence.update(Ev):r.presence.enter(Ev)),s.entered=!0),t.includes("PRESENCE_SUBSCRIBE")&&!s.subscribed?(await r.presence.subscribe(()=>{Iv(e,n)}),s.subscribed=!0,Iv(e,n)):!t.includes("PRESENCE_SUBSCRIBE")&&s.subscribed&&(r.presence.unsubscribe(),s.subscribed=!1)}catch(e){De("error reconciling presence channel",{name:n,error:e})}}})(e)))},Pv=()=>{if(!ov)return;Av();const e=ov,t=jv();for(const[n,s]of mv)if(!t.has(n)){mv.delete(n);const t=e.channels.get(n);t.unsubscribe(s),t.detach().then(()=>e.channels.release(n)).catch(e=>De("error detaching channel",{name:n,error:e}))}for(const n of t)if(!mv.has(n)){const t=e=>xv(e.data);mv.set(n,t),e.channels.get(n,Sv(n)).subscribe(t).catch(e=>{mv.delete(n),De("error subscribing channel",{name:n,error:e})})}};let zv=Promise.resolve();const Lv=()=>{zv=zv.then(async()=>{if(ov){try{await ov.auth.authorize()}catch(e){De("error re-authorizing ably",{error:e})}Pv()}})},Rv=(e,t,n)=>{ov=e,lv=t,cv=n,mv.clear(),Cv.clear(),e.connection.on(["connected","update"],()=>{$e("ably token updated, reconciling topic channels"),Pv()})},Mv=zs((e,t)=>{const n=()=>($e("new SubscribeToEvent function"),(t,n)=>{const s=as(t),r=(e=>{const t=Le(e),n=Re(e),s=Me(e),r=JSON.stringify(wv());t&&bv(dv,t),n&&bv(uv,n),s&&bv(hv,s),JSON.stringify(wv())!==r?Lv():Pv();let a=!1;return()=>{if(a)return;a=!0;const e=JSON.stringify(wv());t&&vv(dv,t),n&&vv(uv,n),s&&vv(hv,s),JSON.stringify(wv())!==e?Lv():Pv()}})(t);return e(e=>({subscribers:{...e.subscribers,[s]:[...e.subscribers[s]||[],n]}})),()=>{r(),e(e=>({subscribers:{...e.subscribers,[s]:(e.subscribers[s]||[]).filter(e=>e!==n)}}))}});return{subscribers:{},newAuth:()=>e({subscribeToEvent:n()}),broadcastMessage:(e,n)=>{const s={key:e,data:n};(t().subscribers[e]||[]).forEach(e=>e(s))},subscribeToEvent:n()}}),$v=(e,t,n=()=>!0)=>{const s=Ya(e=>e.clientId),r=Mv(e=>e.subscribeToEvent),[a]=Qi(e),i=ua(t),l=ua(n);o(()=>{if(!l.current())return;const e={...a,clientId:s};return r(e,async t=>{const n=t.data;try{await(i.current?.(n))}catch(t){await is(t,null,{message:"Error on callback useSubscribe",data:n,event:e})}})},[i,s,l,a,r])};let Fv;const Dv=()=>{const e=_i(),t=l(e);return t.current=e,d(()=>{clearTimeout(Fv),Fv=setTimeout(()=>{t.current(new RegExp(`${ye}/submission`))},500)},[])},Vv=e=>{const t=iv(e=>e.apply),n=Dv();$v({event:We.SUBSCRIBE_SUBMISSIONS_JUDGING,...e},e=>{if(He(e)){const{status:n,verdict:s,points:r,createdAt:a}=e;t(e.submitId,{status:n,verdict:s,points:r,createdAt:a})}},()=>Ze(e));const s="contestKey"in e?e.contestKey:"";o(()=>{if(!s)return;const e=setTimeout(n,3e3);return()=>clearTimeout(e)},[s,n])},Uv=w(({submitId:e})=>{const t=iv(e=>e.apply),n={event:We.SUBSCRIBE_SUBMISSION_RUN_STATUS,submitId:e};return $v(n,e=>{if(Ke(e)){const{status:n,verdict:s,points:r,testInfo:a,createdAt:i}=e;t(e.submitId,{status:n,verdict:s,points:r,testInfo:a,createdAt:i})}}),null});Uv.displayName="SubmissionRunStatusListener";const Bv=({submit:s,className:r,alwaysListen:a=!1})=>{const{points:i,status:l,verdict:c,submitId:d,processedCases:u}=s,h=iv(e=>e.entries[d]),p=iv(e=>e.remove),m=Dv(),f=c===Te.PENDING,g=h?h.judging:f,b=h&&!h.judging?h.data.createdAt:0;o(()=>{b&&m()},[b,m]);const v=ua(h),y=ua(f);return o(()=>{if(!g)return;const e=()=>{"visible"===document.visibilityState&&m()},t=setInterval(()=>{if("visible"!==document.visibilityState)return;const e=v.current,t=e?Date.now()-e.receivedAt:1/0;e&&!y.current&&t>6e4&&p(d),t>2e4&&m()},2e4);return document.addEventListener("visibilitychange",e),()=>{clearInterval(t),document.removeEventListener("visibilitychange",e)}},[g,v,y,p,m,d]),e(n,{children:[(a||g)&&t(Uv,{submitId:d}),t(Xb,{verdict:c,points:i,status:l,submitId:d,submissionData:h?.data,processedCases:u,className:r})]})},Zv=({data:n})=>t("div",{className:"jk-table-grid wh-100",children:n.map(({title:n,content:s},r)=>e("div",{className:"jk-col bc-sf-hi jk-pg-xsm jk-br-ie",children:[t("div",{children:n}),t("div",{children:s})]},r))}),Hv=({submit:n,header:s,className:r})=>{const{runId:a,submitId:i,problem:{isManager:o,isAdministrator:l,scoringMode:c,key:d},user:{nickname:u,canViewSourceCode:h},language:p,sourceCode:m,memoryUsed:f,timeUsed:g,verdict:b,timestamp:v,testCaseResults:y,verdictByGroups:w,compilationResult:k,judgmentTime:N,contest:x}=n,S=o||l,j=new Date(v),E={};(y||[]).forEach(e=>{const t=e.group?c===ze.SUBTASK?e.group:1:0;E[t]?E[t].push(e):E[t]=[e]});const C=b!==Te.NONE&&b!==Te.PENDING&&!1===k?.success,{Link:O}=ma(e=>e.components),I=Ya(e=>e.organization.key),T=os(n.problem.organization.key,I),P=n.problem.judge.key===Ce.LEETCODE,{data:z}=ei(ps.API_V2.judge.getSummaryList().url),L=z?.success?z.contents.find(({key:e})=>e===Ce.LEETCODE)?.getSubmissionUrl:"",R=new Function("problemKey","submissionId","username","submissionRunId",L||"return ''")(d,i,u,a);return e("div",{className:A("jk-col stretch gap wh-100",r),children:[s,t(wa,{header:({isOpen:s,toggle:r})=>t(Zv,{data:[{title:t(Fr,{className:"fw-bd tt-se",children:"nickname"}),content:t(Ig,{imageUrl:n.user.imageUrl,nickname:n.user.nickname,organizationKey:n.user.organization.key})},{title:t(Fr,{className:"fw-bd tt-se",children:"problem"}),content:t(O,x?{href:gs.JUDGE(T).contests.view({key:x.key,tab:_.PROBLEMS,subTab:x.problemIndex}),target:T?"_blank":void 0,className:"link",children:t("div",{children:n.problem.key})}:{href:gs.JUDGE(T).problems.view({key:n.problem.key}),target:T?"_blank":void 0,className:"link",children:t("div",{children:n.problem.key})})},{title:t(Fr,{className:"fw-bd tt-se",children:"language"}),content:t("div",{className:"jk-row",children:Je[p]?.label||p})},{title:t(Fr,{className:"fw-bd tt-se",children:"verdict"}),content:e("div",{className:"jk-row gap center",children:[t(Bv,{submit:n,alwaysListen:!0}),C&&t(fn,{onClick:r,rotate:s?0:180,className:"link"})]})},...Kg(b)?[{title:t(Fr,{className:"fw-bd tt-se",children:"time used"}),content:t(qb,{timeUsed:g,verdict:b})},{title:t(Fr,{className:"fw-bd tt-se",children:"memory used"}),content:t(Gb,{memoryUsed:f,verdict:b})}]:[],{title:t(Fr,{className:"fw-bd tt-se",children:"date"}),content:t(Dr,{date:j,twoLines:!0})},...S?[{title:t(Fr,{className:"fw-bd tt-se",children:N>0?"judgment time":"judging"}),content:e("div",{className:"jk-row",children:["~ ",N>0?t(Wi,{counter:N,literal:!0,type:"minutes-seconds-milliseconds",maxSplit:2,abbreviated:!0}):t(Ki,{remaining:Date.now()- -N,interval:1e3,literal:!0,type:"seconds"})]})},{title:t(Fr,{className:"fw-bd tt-se",children:"actions"}),content:t(Ii,{submissionId:n.submitId})}]:[]]}),startsShowing:C,className:"wh-100",children:!!k?.err&&t("div",{className:"submission-stderr-content jk-text-stderr tx-t bc-er cr-we jk-pg-xsm",children:k?.err})}),(w&&!!Object.keys(w).length||E&&!!Object.keys(E).length)&&e("div",{className:"wh-100",children:[t("div",{className:"tx-l fw-bd cr-tx-ht-dk",children:t(Fr,{className:"tt-se",children:c===ze.SUBTASK?"information by subtasks":c===ze.PARTIAL?"information by groups":"sample and test case information"})}),t("div",{className:"jk-col gap",children:e("div",{className:"jk-row extend block gap jk-table-inline-header",children:[t("div",{className:"jk-row",children:t(Fr,{className:"tt-se",children:c===ze.SUBTASK?"groups":""})}),t("div",{className:"jk-row",style:{flex:3},children:t(Fr,{className:"tt-se",children:"verdict"})}),(c===ze.SUBTASK||c===ze.PARTIAL)&&t("div",{className:"jk-row",children:t(Fr,{className:"tt-se",children:"points"})}),t("div",{className:"jk-row",children:t(Fr,{className:"tt-se",children:"time"})}),t("div",{className:"jk-row",children:t(Fr,{className:"tt-se",children:"memory"})})]})}),w&&Object.keys(w).length?t("div",{className:"jk-col jk-br-ie",children:Object.entries(w).map(([e,n])=>t(ev,{groupKey:+e,isProblemEditor:S,problemScoringMode:c,memoryUsed:n.memoryUsed,verdict:n.verdict,timeUsed:n.timeUsed,points:n.points,testCases:E[n.group]||[],submitId:i},e))}):t("div",{className:"jk-col jk-br-ie",children:Object.entries(E).map(([e,n])=>t(ev,{groupKey:+e,isProblemEditor:S,problemScoringMode:c,memoryUsed:0,verdict:b,timeUsed:0,points:c===ze.PARTIAL?+n.reduce((e,t)=>e+t.points,0).toFixed(3):0,testCases:n,submitId:i},e))})]}),!!h&&!P&&e("div",{className:"jk-col stretch wh-100",children:[t("div",{className:"tx-l fw-bd cr-tx-ht-dk",children:t(Fr,{className:"tt-se",children:"source code"})}),t("div",{className:"submission-info-code-source",children:t(uo,{code:m,language:p,lineNumbers:!0})})]}),P&&t("div",{className:"jk-row wh-100",children:t(O,{href:R,target:"_blank",children:e(Bs,{children:[t(Fr,{className:"tt-se",children:"view submission on LeetCode"}),t(gn,{})]})})})]})};function Wv({submitId:n,triggerFetch:s,header:r,className:a}){return t(ii,{url:ps.API_V2.submission.getData({params:{id:n}}).url,errorView:()=>e(Ag,{children:[t("h3",{children:t(Fr,{className:"tt-se",children:"submission not found"})}),t("p",{children:t(Fr,{className:"tt-se",children:"the submission does not exist or you do not have permissions to view it"})})]}),triggerFetch:s,children:({data:e})=>t(Hv,{submit:e.content,header:r,className:a})})}function Kv({text:e,className:n}){return t("div",{className:A("text-head-field jk-row",n),children:"string"==typeof e?t(Fr,{className:"tt-se",children:e}):e})}function Jv(n){const{selectedUsers:s,onChangeSelectedUsers:r,maxUsersSelection:a=-1,organizationKey:l}=n,{isLoading:c,data:d,mutate:u}=ei(ps.API_V2.user.getSummaryList({params:{organizationKey:l}}).url),[h,m]=i(!1),[f,g]=i(""),[b,v]=i([]),[y,w]=i(""),k=p(()=>{const e={};return(d?.success?d?.contents:[]).forEach(t=>{e[xe(t.nickname,t.organization.key)]=t}),e},[d]),N=Object.values(k);o(()=>{const e=f.split(",").map(e=>e.trim()).filter(Boolean);let t="";const n=[];e.forEach(e=>{const s=xe(e,l);k[s]?n.push(s):t+=`${t?", ":""}"${e}" unknown nickname`}),w(t),v(n)},[l,f,k]);if(c)return t("div",{children:t(bt,{})});const x=e=>{const t=e.map(e=>k[e]).filter(Boolean);r(a>0?t.slice(-a):t)};return e("div",{className:"jk-row left gap nowrap extend",children:[h&&t(ga,{isOpen:!0,onClose:()=>m(!1),children:e("div",{className:"jk-col stretch left gap jk-pg-md",children:[e("div",{className:"jk-row left",children:[t(Fr,{className:"tt-se",children:"write the nicknames separated by commas"})," (",t(Fr,{children:"the nicknames are case sensitive"}),")"]}),t(aa,{value:f,onChange:g}),t("p",{className:"cr-er",children:y}),e("div",{className:"jk-row right gap",children:[t(Bs,{type:"secondary",onClick:()=>m(!1),children:t(Fr,{children:"cancel"})}),t(Bs,{disabled:!b.length,onClick:()=>{x(Array.from(new Set([...b]))),m(!1)},children:t(Fr,{children:"add valid users"})})]})]})}),t(xi,{options:N.map(e=>({label:t(Ig,{nickname:e.nickname,organizationKey:e.organization.key,imageUrl:e.imageUrl,email:e.email,familyName:e.familyName,givenName:e.givenName,className:"flex-1 jk-pg-xsm-tb"}),inputLabel:e.nickname,value:xe(e.nickname,e.organization.key)})),selectedOptions:s.map(e=>({value:e})),onChange:e=>x(e.map(e=>e.value)),optionsPlacement:"bottom",expand:!0,rowHeightOption:72,onFilter:({search:e,option:t})=>{const n=e.toLowerCase(),s=k[t.value];return!!s&&(s.nickname.toLowerCase().indexOf(n)>-1||s.familyName.toLowerCase().indexOf(n)>-1||s.givenName.toLowerCase().indexOf(n)>-1||s.email.toLowerCase().indexOf(n)>-1)},multiselect:1!==a}),t(Bs,{icon:t(Ht,{}),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"reload",type:"secondary",size:"small",onClick:()=>u()}),1!==a&&t(Bs,{icon:t(bn,{}),"data-tooltip-id":"jk-tooltip","data-tooltip-content":"add users by nicknames in batches",type:"secondary",size:"small",onClick:()=>{g(s.join(",")),m(!0)}})]})}function Gv(n){const{isOpen:s=!0,onToggle:r,topSection:a,bottomSection:o,children:l,menu:c,rightMobile:d,centerMobile:u,drawerMenuMobile:h,onBack:m}=n,[f,g]=Qi(s),b=Ds(e=>e.viewPort.screen),v="sm"===b,[y,w]=i(null);y!==b&&(w(b),"md"===b?g(!1):"lg"!==b&&"hg"!==b||g(!0));const k=p(()=>gg(c,v?{type:"horizontal",isSmallScreen:!0}:{type:"vertical",open:f}),[c,f,v]);return e("div",{className:A("ht-100 wh-100",v?"jk-horizontal-menu-layout-container":"jk-vertical-menu-layout-container",{collapsed:!v&&!f}),children:[t("header",v?{className:"jk-menu wh-100 jk-top-horizontal-menu sticky-top",children:t(vg,{menu:c,rightMobile:d,centerMobile:u,drawerMenuMobile:h,onBack:m})}:{className:"jk-menu ht-100",children:e("section",{className:"jk-menu-content ht-100",children:[t("div",{className:"jk-row right jk-menu-collapse-section",children:t("div",{className:"jk-row jk-menu-collapse",onClick:()=>{r?r(!f):g(!f)},children:t(f?At:_t,{})})}),t("div",{className:"flex-2",children:Xn(a,{isOpen:f})}),e("div",{className:A("jk-menu-items jk-col gap nowrap flex-8",{stretch:f}),children:[k,t("div",{className:"jk-menu-item extra"})]}),t("div",{children:Xn(o,{isOpen:f})})]})}),t("section",{className:"jk-menu-main-layout",children:l}),v&&t(yg,{items:k})]})}function qv({submitId:n,...s}){const{Link:r}=ma(e=>e.components),[a,l]=i(0);return o(()=>{l(Date.now())},[s.isOpen]),t(ga,{closeIcon:!0,expand:!0,...s,children:t(Wv,{className:"jk-pg",submitId:n,triggerFetch:a,header:e("div",{className:"fw-bd tx-l jk-row-col left gap wh-100",children:[t("h3",{children:t(Fr,{className:"tt-se",children:"submission"})}),e("div",{className:"jk-row gap",children:[t(r,{href:gs.JUDGE().submissions.view({id:n}),target:"_blank",className:"jk-row",children:t(Bs,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"open submission in new tab",size:"small",type:"secondary",icon:t(gn,{size:"tiny"})})}),t(Hs,{text:n,iconSize:"tiny",tooltipContent:"copy id",className:"small"}),t(za,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"reload",size:"small",icon:t(Ht,{size:"tiny"}),onClick:async e=>{e(K.LOADING),l(Date.now()),e(K.SUCCESS)}})]})]})})})}function Yv(){const e=oi(e=>e.searchParams),n=oi(e=>e.deleteSearchParams);return t(qv,{submitId:e.get(C.SUBMISSION),isOpen:!!e.get(C.SUBMISSION),onClose:()=>n({name:C.SUBMISSION})})}var Xv={attributes:!0,characterData:!0,subtree:!0,childList:!0};var Qv=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some(function(e,s){return e[0]===t&&(n=s,!0)}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),s=this.__entries__[n];return s&&s[1]},t.prototype.set=function(t,n){var s=e(this.__entries__,t);~s?this.__entries__[s][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,s=e(n,t);~s&&n.splice(s,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,s=this.__entries__;n<s.length;n++){var r=s[n];e.call(t,r[1],r[0])}},t}()}(),ey="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,ty="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),ny="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(ty):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)};var sy=["top","right","bottom","left","width","height","size","weight"],ry="undefined"!=typeof MutationObserver,ay=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,s=!1,r=0;function a(){n&&(n=!1,e()),s&&o()}function i(){ny(a)}function o(){var e=Date.now();if(n){if(e-r<2)return;s=!0}else n=!0,s=!1,setTimeout(i,t);r=e}return o}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){ey&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ry?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){ey&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;sy.some(function(e){return!!~n.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),iy=function(e,t){for(var n=0,s=Object.keys(t);n<s.length;n++){var r=s[n];Object.defineProperty(e,r,{value:t[r],enumerable:!1,writable:!1,configurable:!0})}return e},oy=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||ty},ly=my(0,0,0,0);function cy(e){return parseFloat(e)||0}function dy(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(t,n){return t+cy(e["border-"+n+"-width"])},0)}function uy(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return ly;var s=oy(e).getComputedStyle(e),r=function(e){for(var t={},n=0,s=["top","right","bottom","left"];n<s.length;n++){var r=s[n],a=e["padding-"+r];t[r]=cy(a)}return t}(s),a=r.left+r.right,i=r.top+r.bottom,o=cy(s.width),l=cy(s.height);if("border-box"===s.boxSizing&&(Math.round(o+a)!==t&&(o-=dy(s,"left","right")+a),Math.round(l+i)!==n&&(l-=dy(s,"top","bottom")+i)),!function(e){return e===oy(e).document.documentElement}(e)){var c=Math.round(o+a)-t,d=Math.round(l+i)-n;1!==Math.abs(c)&&(o-=c),1!==Math.abs(d)&&(l-=d)}return my(r.left,r.top,o,l)}var hy="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof oy(e).SVGGraphicsElement}:function(e){return e instanceof oy(e).SVGElement&&"function"==typeof e.getBBox};function py(e){return ey?hy(e)?function(e){var t=e.getBBox();return my(0,0,t.width,t.height)}(e):uy(e):ly}function my(e,t,n,s){return{x:e,y:t,width:n,height:s}}var fy=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=my(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=py(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),gy=function(e,t){var n=function(e){var t=e.x,n=e.y,s=e.width,r=e.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,i=Object.create(a.prototype);return iy(i,{x:t,y:n,width:s,height:r,top:n,right:t+s,bottom:r+n,left:t}),i}(t);iy(this,{target:e,contentRect:n})},by=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new Qv,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof oy(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new fy(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof oy(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new gy(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),vy="undefined"!=typeof WeakMap?new WeakMap:new Qv,yy=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ay.getInstance(),s=new by(t,n,this);vy.set(this,s)};["observe","unobserve","disconnect"].forEach(function(e){yy.prototype[e]=function(){var t;return(t=vy.get(this))[e].apply(t,arguments)}});var wy=void 0!==ty.ResizeObserver?ty.ResizeObserver:yy,ky=({mutationObservables:e,resizeObservables:t,refresh:n})=>{const[s,r]=i(0);function a(t){const s=Array.from(t);for(const t of s)if(e){if(!t.attributes)continue;e.find(e=>t.matches(e))&&n(!0)}}function c(e){const n=Array.from(e);for(const e of n)if(t){if(!e.attributes)continue;t.find(t=>e.matches(t))&&r(s+1)}}return function(e,t,n=Xv){o(()=>{if(e.current){const s=new MutationObserver(t);return s.observe(e.current,n),()=>{s.disconnect()}}},[t,n])}(l(document.documentElement||document.body),e=>{for(const t of e)0!==t.addedNodes.length&&(a(t.addedNodes),c(t.addedNodes)),0!==t.removedNodes.length&&(a(t.removedNodes),c(t.removedNodes))},{childList:!0,subtree:!0}),o(()=>{if(!t)return;const e=new wy(()=>{n()});for(const n of t){const t=document.querySelector(n);t&&e.observe(t)}return()=>{e.disconnect()}},[t,s]),null};function Ny(e){let t=xy;if(e){t=e.getBoundingClientRect()}return t}var xy={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Sy(e){return e<0?0:e}function jy(){return{w:Math.max(document.documentElement.clientWidth,window.innerWidth||0),h:Math.max(document.documentElement.clientHeight,window.innerHeight||0)}}var Ey=(e,t)=>e>t,Cy=(e,t)=>e>t;function Oy(e,t=[]){return Object.keys(e).map(t=>({position:t,value:e[t]})).sort((e,t)=>t.value-e.value).sort((e,n)=>((e,n)=>t.includes(e)?1:t.includes(n)?-1:0)(e.position,n.position)).filter(e=>e.value>0).map(e=>e.position)}function _y(e=10){return Array.isArray(e)?1===e.length?[e[0],e[0],e[0],e[0]]:2===e.length?[e[1],e[0],e[1],e[0]]:3===e.length?[e[0],e[1],e[2],e[1]]:e.length>3?[e[0],e[1],e[2],e[3]]:[10,10]:[e,e,e,e]}var Iy={maskWrapper:()=>({opacity:.7,left:0,top:0,position:"fixed",zIndex:99999,pointerEvents:"none",color:"#000"}),svgWrapper:({windowWidth:e,windowHeight:t,wpt:n,wpl:s})=>({width:e,height:t,left:Number(s),top:Number(n),position:"fixed"}),maskArea:({x:e,y:t,width:n,height:s})=>({x:e,y:t,width:n,height:s,fill:"black",rx:0}),maskRect:({windowWidth:e,windowHeight:t,maskID:n})=>({x:0,y:0,width:e,height:t,fill:"currentColor",mask:`url(#${n})`}),clickArea:({windowWidth:e,windowHeight:t,clipID:n})=>({x:0,y:0,width:e,height:t,fill:"currentcolor",pointerEvents:"auto",clipPath:`url(#${n})`}),highlightedArea:({x:e,y:t,width:n,height:s})=>({x:e,y:t,width:n,height:s,pointerEvents:"auto",fill:"transparent",display:"none"})};var Ty=({padding:e=10,wrapperPadding:t=0,onClick:n,onClickHighlighted:s,styles:a={},sizes:i,className:o,highlightedAreaClassName:l,maskId:c,clipId:d})=>{const u=c||Ay("mask__"),h=d||Ay("clip__"),p=function(e){return(t,n)=>{const s=Iy[t](n),r=e[t];return r?r(s,n):s}}(a),[m,f,g,b]=_y(e),[v,y,w,k]=_y(t),{w:N,h:x}=jy(),S=Sy((null==i?void 0:i.width)+b+f),j=Sy((null==i?void 0:i.height)+m+g),E=Sy((null==i?void 0:i.top)-m-v),C=Sy((null==i?void 0:i.left)-b-k),O=N-k-y,_=x-v-w,I=p("maskArea",{x:C,y:E,width:S,height:j}),T=p("highlightedArea",{x:C,y:E,width:S,height:j});return r.createElement("div",{style:p("maskWrapper",{}),onClick:n,className:o},r.createElement("svg",{width:O,height:_,xmlns:"http://www.w3.org/2000/svg",style:p("svgWrapper",{windowWidth:O,windowHeight:_,wpt:v,wpl:k})},r.createElement("defs",null,r.createElement("mask",{id:u},r.createElement("rect",{x:0,y:0,width:O,height:_,fill:"white"}),r.createElement("rect",{style:I,rx:I.rx?1:void 0})),r.createElement("clipPath",{id:h},r.createElement("polygon",{points:`0 0, 0 ${_}, ${C} ${_}, ${C} ${E}, ${C+S} ${E}, ${C+S} ${E+j}, ${C} ${E+j}, ${C} ${_}, ${O} ${_}, ${O} 0`}))),r.createElement("rect",{style:p("maskRect",{windowWidth:O,windowHeight:_,maskID:u})}),r.createElement("rect",{style:p("clickArea",{windowWidth:O,windowHeight:_,top:E,left:C,width:S,height:j,clipID:h})}),r.createElement("rect",{style:T,className:l,onClick:s,rx:T.rx?1:void 0})))};function Ay(e){return e+Math.random().toString(36).substring(2,16)}var Py=Object.defineProperty,zy=Object.getOwnPropertySymbols,Ly=Object.prototype.hasOwnProperty,Ry=Object.prototype.propertyIsEnumerable,My=(e,t,n)=>t in e?Py(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$y=(e,t)=>{for(var n in t||(t={}))Ly.call(t,n)&&My(e,n,t[n]);if(zy)for(var n of zy(t))Ry.call(t,n)&&My(e,n,t[n]);return e},Fy={popover:()=>({position:"fixed",maxWidth:353,backgroundColor:"#fff",padding:"24px 30px",boxShadow:"0 0.5em 3em rgba(0, 0, 0, 0.3)",color:"inherit",zIndex:1e5,transition:"transform 0.3s",top:0,left:0})};var Dy=e=>{var t=e,{children:n,position:s="bottom",padding:a=10,styles:c={},sizes:u,refresher:h}=t,p=((e,t)=>{var n={};for(var s in e)Ly.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&zy)for(var s of zy(e))t.indexOf(s)<0&&Ry.call(e,s)&&(n[s]=e[s]);return n})(t,["children","position","padding","styles","sizes","refresher"]);const m=l(null),f=l(""),g=l(""),b=l(""),{w:v,h:y}=jy(),w=function(e){return(t,n)=>{const s=Fy[t](n),r=e[t];return r?r(s,n):s}}(c),k=function(e,t){const[n,s]=i(xy),r=d(()=>{(null==e?void 0:e.current)&&s(Ny(null==e?void 0:e.current))},[null==e?void 0:e.current]);return o(()=>(r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)),[null==e?void 0:e.current,t]),n}(m,h),{width:N,height:x}=k,[S,j,E,C]=_y(a),O=(null==u?void 0:u.left)-C,_=(null==u?void 0:u.top)-S,I=(null==u?void 0:u.right)+j,T=(null==u?void 0:u.bottom)+E,A=s&&"function"==typeof s?s({width:N,height:x,windowWidth:v,windowHeight:y,top:_,left:O,right:I,bottom:T,x:u.x,y:u.y},k):s,P={left:O,right:v-I,top:_,bottom:y-T},z=(e,t,n)=>{switch(e){case"top":return P.top>x+E;case"right":return!t&&P.right>N+C;case"bottom":return!n&&P.bottom>x+S;case"left":return P.left>N+j;default:return!1}},L=(e=>{if(Array.isArray(e)){const t=Ey(e[0],v),n=Cy(e[1],y);return f.current="custom",[t?v/2-N/2:e[0],n?y/2-x/2:e[1]]}const t=Ey(O+N,v),n=Cy(T+x,y),s=t?Math.min(O,v-N):Math.max(O,0),r=n?x>P.bottom?Math.max(T-x,0):Math.max(_,0):_;g.current=n&&x>P.bottom?"bottom":"top",b.current=t?"left":"right";const a={top:[s-C,_-x-E],right:[I+C,r-S],bottom:[s-C,T+S],left:[O-N-j,r-S],center:[v/2-N/2,y/2-x/2]};return"center"===e||z(e,t,n)&&!t&&!n?(f.current=e,a[e]):((e,t,n)=>{const s=Oy(P,n?["right","left"]:t?["top","bottom"]:[]);for(let r=0;r<s.length;r++)if(z(s[r],t,n))return f.current=s[r],e[s[r]];return f.current="center",e.center})(a,t,n)})(A);return r.createElement("div",$y({className:"reactour__popover",style:$y({transform:`translate(${Math.round(L[0])}px, ${Math.round(L[1])}px)`},w("popover",{position:f.current,verticalAlign:g.current,horizontalAlign:b.current,helperRect:k,targetRect:u})),ref:m},p),n)},Vy=Object.defineProperty,Uy=Object.defineProperties,By=Object.getOwnPropertyDescriptors,Zy=Object.getOwnPropertySymbols,Hy=Object.prototype.hasOwnProperty,Wy=Object.prototype.propertyIsEnumerable,Ky=(e,t,n)=>t in e?Vy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jy=(e,t)=>{for(var n in t||(t={}))Hy.call(t,n)&&Ky(e,n,t[n]);if(Zy)for(var n of Zy(t))Wy.call(t,n)&&Ky(e,n,t[n]);return e},Gy=(e,t)=>Uy(e,By(t)),qy=(e,t)=>{var n={};for(var s in e)Hy.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&Zy)for(var s of Zy(e))t.indexOf(s)<0&&Wy.call(e,s)&&(n[s]=e[s]);return n},Yy={bottom:0,height:0,left:0,right:0,top:0,width:0,windowWidth:0,windowHeight:0,x:0,y:0};function Xy(e,t={block:"center",behavior:"smooth",inViewThreshold:0}){const[n,s]=i(!1),[r,a]=i(!1),[l,c]=i(!1),[u,h]=i(null),[p,m]=i(Yy),f=(null==e?void 0:e.selector)instanceof Element?null==e?void 0:e.selector:document.querySelector(null==e?void 0:e.selector),g=d(()=>{const t=Qy(f,null==e?void 0:e.highlightedSelectors,null==e?void 0:e.bypassElem),{hasHighligtedElems:n}=t,s=qy(t,["hasHighligtedElems"]);Object.entries(p).some(([e,t])=>s[e]!==t)&&m(s)},[f,null==e?void 0:e.highlightedSelectors,p]);o(()=>(g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)),[f,null==e?void 0:e.highlightedSelectors,u]),o(()=>{var e,n;!function({top:e,right:t,bottom:n,left:s,threshold:r}){const{w:a,h:i}=jy(),{thresholdX:o,thresholdY:l}=function(e){return"object"==typeof e&&null!==e?{thresholdX:e.x||0,thresholdY:e.y||0}:{thresholdX:e||0,thresholdY:e||0}}(r);return e<0&&n-e>i||e>=0+l&&s>=0+o&&n<=i-l&&t<=a-o}(Gy(Jy({},p),{threshold:t.inViewThreshold}))&&f&&(s(!0),(e=f,n=t,new Promise(t=>{if(!(e instanceof Element))throw new TypeError("Argument 1 must be an Element");let s=0,r=null;const a=Object.assign({behavior:"smooth"},n);e.scrollIntoView(a),requestAnimationFrame(function n(){const a=null==e?void 0:e.getBoundingClientRect().top;if(a===r){if(s++>2)return t(null)}else s=0,r=a;requestAnimationFrame(n)})})).then(()=>{r||h(Date.now())}).finally(()=>{s(!1)}))},[p]);const b=d(()=>{a(!0);const t=Qy(f,null==e?void 0:e.highlightedSelectors,null==e?void 0:e.bypassElem),{hasHighligtedElems:n}=t,s=qy(t,["hasHighligtedElems"]);c(n),m(s),a(!1)},[f,null==e?void 0:e.highlightedSelectors,p]);return{sizes:p,transition:n,target:f,observableRefresher:b,isHighlightingObserved:l}}function Qy(e,t=[],n=!0){let s=!1;const{w:r,h:a}=jy();if(!t)return Gy(Jy({},Ny(e)),{windowWidth:r,windowHeight:a,hasHighligtedElems:!1});let i=Ny(e),o={bottom:0,height:0,left:r,right:0,top:a,width:0};for(const r of t){const t=document.querySelector(r);if(!t||"none"===t.style.display||"hidden"===t.style.visibility)continue;const a=Ny(t);s=!0,n||!e?(a.top<o.top&&(o.top=a.top),a.right>o.right&&(o.right=a.right),a.bottom>o.bottom&&(o.bottom=a.bottom),a.left<o.left&&(o.left=a.left),o.width=o.right-o.left,o.height=o.bottom-o.top):(a.top<i.top&&(i.top=a.top),a.right>i.right&&(i.right=a.right),a.bottom>i.bottom&&(i.bottom=a.bottom),a.left<i.left&&(i.left=a.left),i.width=i.right-i.left,i.height=i.bottom-i.top)}const l=!(!n&&e)&&(o.width>0&&o.height>0);return{left:(l?o:i).left,top:(l?o:i).top,right:(l?o:i).right,bottom:(l?o:i).bottom,width:(l?o:i).width,height:(l?o:i).height,windowWidth:r,windowHeight:a,hasHighligtedElems:s,x:i.x,y:i.y}}var ew=({disableKeyboardNavigation:e,setCurrentStep:t,currentStep:n,setIsOpen:s,stepsLength:r,disable:a,rtl:i,clickProps:l,keyboardHandler:c})=>{function d(o){if(o.stopPropagation(),!0===e||a)return;let d,u,h;function p(){t(Math.min(n+1,r-1))}function m(){t(Math.max(n-1,0))}e&&(d=e.includes("esc"),u=e.includes("right"),h=e.includes("left")),c&&"function"==typeof c?c(o,l,{isEscDisabled:d,isRightDisabled:u,isLeftDisabled:h}):(27!==o.keyCode||d||(o.preventDefault(),s(!1)),39!==o.keyCode||u||(o.preventDefault(),i?m():p()),37!==o.keyCode||h||(o.preventDefault(),i?p():m()))}return o(()=>(window.addEventListener("keydown",d,!1),()=>{window.removeEventListener("keydown",d)}),[a,t,n]),null},tw={badge:()=>({position:"absolute",fontFamily:"monospace",background:"var(--reactour-accent,#007aff)",height:"1.875em",lineHeight:2,paddingLeft:"0.8125em",paddingRight:"0.8125em",fontSize:"1em",borderRadius:"1.625em",color:"white",textAlign:"center",boxShadow:"0 0.25em 0.5em rgba(0, 0, 0, 0.3)",top:"-0.8125em",left:"-0.8125em"}),controls:()=>({display:"flex",marginTop:24,alignItems:"center",justifyContent:"space-between"}),navigation:()=>({counterReset:"dot",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"}),button:({disabled:e})=>({display:"block",padding:0,border:0,background:"none",cursor:e?"not-allowed":"pointer"}),arrow:({disabled:e})=>({color:e?"#caccce":"#646464",width:16,height:12,flex:"0 0 16px"}),dot:({current:e,disabled:t,showNumber:n})=>({counterIncrement:"dot",width:8,height:8,border:e?"0":"1px solid #caccce",borderRadius:"100%",padding:0,display:"block",margin:4,transition:"opacity 0.3s, transform 0.3s",cursor:t?"not-allowed":"pointer",transform:`scale(${e?1.25:1})`,color:e?"var(--reactour-accent, #007aff)":"#caccce",background:e?"var(--reactour-accent, #007aff)":"none"}),close:({disabled:e})=>({position:"absolute",top:22,right:22,width:9,height:9,"--rt-close-btn":e?"#caccce":"#5e5e5e","--rt-close-btn-disabled":e?"#caccce":"#000"}),svg:()=>({display:"block"})};function nw(e){return(t,n)=>{const s=tw[t](n),r=e[t];return r?r(s,n):s}}var sw=e=>{var t=e,{styles:n={},onClick:s,disabled:a}=t,i=qy(t,["styles","onClick","disabled"]);const o=nw(n);return r.createElement("button",Jy({className:"reactour__close-button",style:Jy(Jy({},o("button",{})),o("close",{disabled:a})),onClick:s},i),r.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation",style:Jy({},o("svg",{}))},r.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))},rw=({styles:e={},steps:t,setCurrentStep:n,currentStep:s,setIsOpen:a,nextButton:i,prevButton:o,disableDots:l,hideDots:c,hideButtons:d,disableAll:u,rtl:h,Arrow:p=aw})=>{const m=t.length,f=nw(e),g=({onClick:t,kind:a="next",children:i,hideArrow:o})=>r.createElement("button",{style:f("button",{kind:a,disabled:u||("next"===a?m-1===s:0===s)}),onClick:function(){u||(t&&"function"==typeof t?t():n("next"===a?Math.min(s+1,m-1):Math.max(s-1,0)))},"aria-label":`Go to ${a} step`},o?null:r.createElement(p,{styles:e,inverted:h?"prev"===a:"next"===a,disabled:u||("next"===a?m-1===s:0===s)}),i);return r.createElement("div",{style:f("controls",{}),dir:h?"rtl":"ltr"},d?null:o&&"function"==typeof o?o({Button:g,setCurrentStep:n,currentStep:s,stepsLength:m,setIsOpen:a,steps:t}):r.createElement(g,{kind:"prev"}),c?null:r.createElement("div",{style:f("navigation",{})},Array.from({length:m},(e,t)=>t).map(e=>{var a;return r.createElement("button",{style:f("dot",{current:e===s,disabled:l||u}),onClick:()=>{l||u||n(e)},key:`navigation_dot_${e}`,"aria-label":(null==(a=t[e])?void 0:a.navDotAriaLabel)||`Go to step ${e+1}`})})),d?null:i&&"function"==typeof i?i({Button:g,setCurrentStep:n,currentStep:s,stepsLength:m,setIsOpen:a,steps:t}):r.createElement(g,null))},aw=({styles:e={},inverted:t=!1,disabled:n})=>{const s=nw(e);return r.createElement("svg",{viewBox:"0 0 18.4 14.4",style:s("arrow",{inverted:t,disabled:n})},r.createElement("path",{d:t?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"}))},iw={Badge:({styles:e={},children:t})=>{const n=nw(e);return r.createElement("span",{style:n("badge",{})},t)},Close:sw,Content:({content:e,setCurrentStep:t,transition:n,isHighlightingObserved:s,currentStep:r,setIsOpen:a})=>"function"==typeof e?e({setCurrentStep:t,transition:n,isHighlightingObserved:s,currentStep:r,setIsOpen:a}):e,Navigation:rw,Arrow:aw},ow=({styles:e,components:t={},badgeContent:n,accessibilityOptions:s,disabledActions:a,onClickClose:i,steps:o,setCurrentStep:l,currentStep:c,transition:d,isHighlightingObserved:u,setIsOpen:h,nextButton:p,prevButton:m,disableDotsNavigation:f,rtl:g,showPrevNextButtons:b=!0,showCloseButton:v=!0,showNavigation:y=!0,showBadge:w=!0,showDots:k=!0,meta:N,setMeta:x,setSteps:S})=>{const j=o[c],{Badge:E,Close:C,Content:O,Navigation:_,Arrow:I}=(T=t,Jy(Jy({},iw),T));var T;const A=n&&"function"==typeof n?n({currentStep:c,totalSteps:o.length,transition:d}):c+1;return r.createElement(r.Fragment,null,w?r.createElement(E,{styles:e},A):null,v?r.createElement(C,{styles:e,"aria-label":null==s?void 0:s.closeButtonAriaLabel,disabled:a,onClick:function(){a||(i&&"function"==typeof i?i({setCurrentStep:l,setIsOpen:h,currentStep:c,steps:o,meta:N,setMeta:x,setSteps:S}):h(!1))}}):null,r.createElement(O,{content:null==j?void 0:j.content,setCurrentStep:l,currentStep:c,transition:d,isHighlightingObserved:u,setIsOpen:h}),y?r.createElement(_,{setCurrentStep:l,currentStep:c,setIsOpen:h,steps:o,styles:e,"aria-hidden":!(null==s?void 0:s.showNavigationScreenReaders),nextButton:p,prevButton:m,disableDots:f,hideButtons:!b,hideDots:!k,disableAll:a,rtl:g,Arrow:I}):null)},lw=e=>{var t,n=e,{currentStep:s,setCurrentStep:a,setIsOpen:i,steps:l=[],setSteps:c,styles:d={},scrollSmooth:u,afterOpen:h,beforeClose:p,padding:m=10,position:f,onClickMask:g,onClickHighlighted:b,keyboardHandler:v,className:y="reactour__popover",maskClassName:w="reactour__mask",highlightedMaskClassName:k,clipId:N,maskId:x,disableInteraction:S,disableKeyboardNavigation:j,inViewThreshold:E,disabledActions:C,setDisabledActions:O,disableWhenSelectorFalsy:_,rtl:I,accessibilityOptions:T={closeButtonAriaLabel:"Close Tour",showNavigationScreenReaders:!0},ContentComponent:A,Wrapper:P,meta:z,setMeta:L,onTransition:R=()=>"center"}=n,M=qy(n,["currentStep","setCurrentStep","setIsOpen","steps","setSteps","styles","scrollSmooth","afterOpen","beforeClose","padding","position","onClickMask","onClickHighlighted","keyboardHandler","className","maskClassName","highlightedMaskClassName","clipId","maskId","disableInteraction","disableKeyboardNavigation","inViewThreshold","disabledActions","setDisabledActions","disableWhenSelectorFalsy","rtl","accessibilityOptions","ContentComponent","Wrapper","meta","setMeta","onTransition"]);const $=l[s],F=Jy(Jy({},d),null==$?void 0:$.styles),{sizes:D,transition:V,observableRefresher:U,isHighlightingObserved:B,target:Z}=Xy($,{block:"center",behavior:u?"smooth":"auto",inViewThreshold:E});o(()=>(h&&"function"==typeof h&&h(Z),()=>{p&&"function"==typeof p&&p(Z)}),[]);const{maskPadding:H,popoverPadding:W,wrapperPadding:K}=function(e){if("object"==typeof e&&null!==e)return{maskPadding:e.mask,popoverPadding:e.popover,wrapperPadding:e.wrapper};return{maskPadding:e,popoverPadding:e,wrapperPadding:0}}(null!=(t=null==$?void 0:$.padding)?t:m),J={setCurrentStep:a,setIsOpen:i,currentStep:s,setSteps:c,steps:l,setMeta:L,meta:z};const G="boolean"==typeof(null==$?void 0:$.stepInteraction)?!(null==$?void 0:$.stepInteraction):!!S&&("boolean"==typeof S?S:S(J));o(()=>((null==$?void 0:$.action)&&"function"==typeof(null==$?void 0:$.action)&&(null==$||$.action(Z)),void 0!==(null==$?void 0:$.disableActions)&&O(null==$?void 0:$.disableActions),()=>{(null==$?void 0:$.actionAfter)&&"function"==typeof(null==$?void 0:$.actionAfter)&&(null==$||$.actionAfter(Z))}),[$]);const q=V?R:(null==$?void 0:$.position)?null==$?void 0:$.position:f,Y=P||r.Fragment;return $?r.createElement(Y,null,r.createElement(ky,{mutationObservables:null==$?void 0:$.mutationObservables,resizeObservables:null==$?void 0:$.resizeObservables,refresh:U}),r.createElement(ew,{setCurrentStep:a,currentStep:s,setIsOpen:i,stepsLength:l.length,disableKeyboardNavigation:j,disable:C,rtl:I,clickProps:J,keyboardHandler:v}),(!_||Z)&&r.createElement(Ty,{sizes:V?cw:D,onClick:function(){C||(g&&"function"==typeof g?g(J):i(!1))},styles:Jy({highlightedArea:e=>Gy(Jy({},e),{display:G?"block":"none"})},F),padding:V?0:H,highlightedAreaClassName:k,className:w,onClickHighlighted:e=>{e.preventDefault(),e.stopPropagation(),b&&b(e,J)},wrapperPadding:K,clipId:N,maskId:x}),(!_||Z)&&r.createElement(Dy,{sizes:D,styles:F,position:q,padding:W,"aria-labelledby":null==T?void 0:T.ariaLabelledBy,className:y,refresher:s},A?r.createElement(A,Jy({styles:F,setCurrentStep:a,currentStep:s,setIsOpen:i,steps:l,accessibilityOptions:T,disabledActions:C,transition:V,isHighlightingObserved:B,rtl:I},M)):r.createElement(ow,Jy({styles:F,setCurrentStep:a,currentStep:s,setIsOpen:i,steps:l,setSteps:c,accessibilityOptions:T,disabledActions:C,transition:V,isHighlightingObserved:B,rtl:I,meta:z,setMeta:L},M)))):null};var cw={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},dw=r.createContext({isOpen:!1,setIsOpen:()=>!1,currentStep:0,setCurrentStep:()=>0,steps:[],setSteps:()=>[],setMeta:()=>"",disabledActions:!1,setDisabledActions:()=>!1,components:{}}),uw=e=>{var t=e,{children:n,defaultOpen:s=!1,startAt:a=0,steps:o,setCurrentStep:l,currentStep:c}=t,d=qy(t,["children","defaultOpen","startAt","steps","setCurrentStep","currentStep"]);const[u,h]=i(s),[p,m]=i(a),[f,g]=i(o),[b,v]=i(""),[y,w]=i(!1),k=Jy({isOpen:u,setIsOpen:h,currentStep:c||p,setCurrentStep:l&&"function"==typeof l?l:m,steps:f,setSteps:g,disabledActions:y,setDisabledActions:w,meta:b,setMeta:v},d);return r.createElement(dw.Provider,{value:k},n,u?r.createElement(lw,Jy({},k)):null)};var hw=e=>"checkbox"===e.type,pw=e=>"file"===e.type,mw=e=>e instanceof Date,fw=e=>null==e;const gw=e=>"object"==typeof e;var bw=e=>!fw(e)&&!Array.isArray(e)&&gw(e)&&!mw(e),vw=e=>bw(e)&&e.target?hw(e.target)?e.target.checked:pw(e.target)?e.target.files:e.target.value:e;const yw=/[.[\]'"]/;var ww=e=>e.split(yw).filter(Boolean);var kw=(e,t)=>t.split(".").some((t,n,s)=>!isNaN(Number(t))&&e.has(s.slice(0,n).join("."))),Nw="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function xw(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Date)return new Date(e);const t="undefined"!=typeof Blob&&e instanceof Blob,n="undefined"!=typeof FileList&&e instanceof FileList;if(Nw&&(t||n))return e;const s=Array.isArray(e),r=Object.getPrototypeOf(e);if(!s&&r&&r.constructor!==Object)return e;const a=s?new Array(e.length):Object.create(r);for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=xw(e[t]));return a}const Sw="blur",jw="focusout",Ew="change",Cw="submit",Ow="trigger",_w="valid",Iw="onBlur",Tw="onChange",Aw="onSubmit",Pw="onTouched",zw="all",Lw="max",Rw="min",Mw="maxLength",$w="minLength",Fw="pattern",Dw="required",Vw="validate",Uw=[Dw,Rw,Lw,$w,Mw,Fw,Vw],Bw="form",Zw="root",Hw=["__proto__","constructor","prototype"],Ww=/^\w*$/;var Kw=e=>Ww.test(e),Jw=e=>void 0===e,Gw=(e,t,n)=>{if(!t||!bw(e))return n;const s=Kw(t)?[t]:ww(t);if(s.some(e=>Hw.includes(e)))return n;const r=s.reduce((e,t)=>fw(e)?void 0:e[t],e);return Jw(r)||r===e?Jw(e[t])?n:e[t]:r},qw=e=>"boolean"==typeof e,Yw=e=>"function"==typeof e,Xw=(e,t,n)=>{let s=-1;const r=Kw(t)?[t]:ww(t),a=r.length,i=a-1;for(;++s<a;){const t=r[s];let a=n;if(s!==i){const n=e[t];a=bw(n)||Array.isArray(n)?n:isNaN(+r[s+1])?{}:[]}if(Hw.includes(t))return;e[t]=a,e=e[t]}};const Qw=r.createContext(null);Qw.displayName="HookFormControlContext";const ek=()=>r.useContext(Qw);var tk=(e,t,n,s=!0)=>{const r={};for(const a in e)Object.defineProperty(r,a,{get:()=>{const r=a;return t._proxyFormState[r]!==zw&&(t._proxyFormState[r]=!s||zw),n&&(n[r]=!0),e[r]}});return r};const nk=Nw?r.useLayoutEffect:r.useEffect;var sk=e=>fw(e)||!gw(e);const rk=(e,t)=>0===t.length&&!Array.isArray(e)&&null!==Object.getPrototypeOf(e)&&!(e=>{const t=e.constructor&&e.constructor.prototype;return bw(t)&&t.hasOwnProperty("isPrototypeOf")})(e);function ak(e,t,n=!1,s=new WeakMap){if(e===t)return!0;if(sk(e)||sk(t))return Object.is(e,t);if(mw(e)&&mw(t))return Object.is(e.getTime(),t.getTime());if(Array.isArray(e)&&Array.isArray(t)&&e.length!==t.length)return!1;const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(rk(e,r)||rk(t,a))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=s.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const n=new WeakSet;n.add(t),s.set(e,n)}for(const a of r){const r=e[a];if(!Object.prototype.hasOwnProperty.call(t,a))return!1;if(!n||"ref"!==a){const e=t[a];if(mw(r)&&mw(e)||(bw(r)||Array.isArray(r))&&(bw(e)||Array.isArray(e))?!ak(r,e,n,s):!Object.is(r,e))return!1}}return!0}function ik(e){const t=r.useRef(!1),n=r.useRef(!1),s=r.useRef(void 0),a=r.useRef(0);a.current++,!n.current&&e&&(n.current=!0,s.current=xw(e()));return{resyncIfNeeded:r.useCallback((e,r,i)=>{if(e&&(t.current||n.current&&a.current>1)){const e=r();ak(s.current,e)||i(e)}t.current=!0},[]),snapshot:r.useCallback((e,t)=>{e&&(s.current=xw(t()))},[])}}var ok=e=>"string"==typeof e,lk=(e,t,n,s,r)=>ok(e)?(s&&t.watch.add(e),Gw(n,e,r)):Array.isArray(e)?e.map(e=>(s&&t.watch.add(e),Gw(n,e,Gw(r,e)))):(s&&(t.watchAll=!0),n);function ck(e){const t=ek(),{name:n,disabled:s,control:a=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=kw(a._names.array,n),d=r.useMemo(()=>{const e=Gw(a._formValues,n,Gw(a._defaultValues,n,o));return Jw(e)?function(e,t){const n=ww(t);let s=e._formValues,r=e._defaultValues;for(let e=0;e<n.length-1;e++){const t=n[e];if(s=null==s?s:s[t],r=null==r?r:r[t],null===s||null===r)return null}}(a,n):e},[a,n,o]),u=function(e){const t=ek(),{control:n=t,name:s,defaultValue:a,disabled:i,exact:o,compute:l}=e||{},c=r.useRef(a),d=r.useRef(l),u=r.useRef(n),h=r.useRef(s);d.current=l;const p=()=>{const e=n._getWatch(s,c.current);return d.current?d.current(e):e},[m,f]=r.useState(p),g=r.useRef(m),b=r.useCallback(e=>{const t=lk(s,n._names,e||n._formValues,!1,c.current);return d.current?d.current(t):t},[n._formValues,n._names,s]),v=r.useCallback(e=>{if(!i){const t=lk(s,n._names,e||n._formValues,!1,c.current);if(d.current){const e=d.current(t);ak(e,g.current)||(f(e),g.current=e)}else f(t)}},[n._formValues,n._names,i,s]),{resyncIfNeeded:y,snapshot:w}=ik(p),k=r.useRef(v);k.current=v;const N=r.useRef(b);N.current=b,nk(()=>{u.current===n&&ak(h.current,s)?y(!i,()=>N.current(),e=>{const t=xw(e);f(t),g.current=t}):(u.current=n,h.current=s,k.current());const e=n._subscribe({name:s,formState:{values:!0},exact:o,callback:e=>{k.current(e.values)}});return()=>{e(),w(!i,()=>N.current())}},[n,o,s,i,y,w]),r.useEffect(()=>n._removeUnmounted());const x=u.current!==n,S=h.current,j=r.useMemo(()=>!x&&!ak(S,s),[x,s,S]);return(x||j)&&(c.current=a),i||!x&&!j?m:b()}({control:a,name:n,defaultValue:d,exact:l}),h=function(e){const t=ek(),{control:n=t,disabled:s,name:a,exact:i}=e||{},o=()=>({...n._formState,defaultValues:n._defaultValues}),[l,c]=r.useState(o),d=r.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:h}=ik(o);return nk(()=>{u(!s,o,c);const e=n._subscribe({name:a,formState:d.current,exact:i,callback:e=>{!s&&c({...n._formState,...e,defaultValues:n._defaultValues})}});return()=>{e(),h(!s,o)}},[n,a,s,i,u,h]),r.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),r.useMemo(()=>tk(l,n,d.current,!1),[l,n])}({control:a,name:n,exact:l}),p=r.useRef(e),m=r.useRef(null),f=r.useRef(a.register(n,{...e.rules,value:u,...qw(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const g=r.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Gw(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!Gw(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Gw(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Gw(h.validatingFields,n)},error:{enumerable:!0,get:()=>Gw(h.errors,n)}}),[h,n]),b=r.useCallback(e=>{const t=vw(e);return Gw(a._fields,n)||(f.current=a.register(n,{...p.current.rules,value:t})),f.current.onChange({target:{value:vw(e),name:n},type:Ew})},[n,a]),v=r.useCallback(()=>{const e=Gw(a._formValues,n);return Gw(a._fields,n)||(f.current=a.register(n,{...p.current.rules,value:e})),f.current.onBlur({target:{value:e,name:n},type:Sw})},[n,a]),y=r.useCallback(e=>{e&&(m.current={focus:()=>Yw(e.focus)&&e.focus(),select:()=>Yw(e.select)&&e.select(),setCustomValidity:t=>Yw(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Yw(e.reportValidity)&&e.reportValidity()});const t=Gw(a._fields,n);t&&t._f&&e&&(t._f.ref=m.current,t._f._c=!0)},[a._fields,n]),w=r.useMemo(()=>({name:n,value:u,...qw(s)||h.disabled?{disabled:h.disabled||s}:{},onChange:b,onBlur:v,ref:y}),[n,s,h.disabled,b,v,y,u]);return r.useEffect(()=>{const e=a._options.shouldUnregister||i;f.current=a.register(n,{...p.current.rules,...qw(p.current.disabled)?{disabled:p.current.disabled}:{}});const t=(e,t)=>{const n=Gw(a._fields,e);n&&n._f&&(n._f.mount=t,n._f._c=t)};if(t(n,!0),e){const e=xw(Gw(i?a._defaultValues:a._options.values||a._defaultValues,n,Gw(a._options.defaultValues,n,p.current.defaultValue)));Xw(a._defaultValues,n,e),Jw(Gw(a._formValues,n))&&Xw(a._formValues,n,e)}if(!c&&a.register(n,{...p.current.rules,...qw(p.current.disabled)?{disabled:p.current.disabled}:{}}),m.current){const e=Gw(a._fields,n);e&&e._f&&(e._f.ref=m.current)}return()=>{(c?e&&!a._state.action:e)?a.unregister(n):t(n,!1)}},[n,a,c,i]),r.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),r.useMemo(()=>({field:w,formState:h,fieldState:g}),[w,h,g])}const dk=e=>e.render(ck(e));var uk=e=>({isOnSubmit:!e||e===Aw,isOnBlur:e===Iw,isOnChange:e===Tw,isOnAll:e===zw,isOnTouch:e===Pw}),hk=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const n of t.watch)if(e.startsWith(n)&&"."===e.charAt(n.length))return!0;return!1};const pk=(e,t,n)=>{for(const s of n||Object.keys(e)){if("_f"===s)continue;const r=n?Gw(e,s):e[s];if(r){const{_f:e}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],e.name))return!0;if(e.ref&&t(e.ref,e.name))return!0;if(pk(r,t))return!0}else if((bw(r)||Array.isArray(r))&&pk(r,t))return!0}}};var mk=(e,t,n)=>{const s=Gw(e,n),r=Array.isArray(s)?s:[];return Xw(r,Zw,t[n]),Xw(e,n,r),e},fk=e=>bw(e)&&!Object.keys(e).length,gk=e=>{if(!Nw)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},bk=e=>"radio"===e.type,vk=e=>e instanceof RegExp,yk=(e,t,n,s,r)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:r||!0}}:{};const wk={value:!1,isValid:!1},kk={value:!0,isValid:!0};var Nk=e=>{if(!Array.isArray(e))return wk;if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}const t=e[0];return t&&t.checked&&!t.disabled?t.attributes&&"value"in t.attributes?Jw(t.value)||""===t.value?kk:{value:t.value,isValid:!0}:kk:wk};const xk={isValid:!1,value:null};var Sk=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,xk):xk;function jk(e,t,n="validate"){if(ok(e)||Array.isArray(e)&&e.length&&e.every(ok)||qw(e)&&!e)return{type:n,message:ok(e)?e:"",ref:t}}var Ek=e=>bw(e)&&!vk(e)?e:{value:e,message:""},Ck=async(e,t,n,s,r,a)=>{const{ref:i,refs:o,required:l,maxLength:c,minLength:d,min:u,max:h,pattern:p,validate:m,name:f,valueAsNumber:g,mount:b,_c:v}=e._f,y=Gw(n,f);if(!b||t.has(f))return{};const w=o?o[0]:i,k=e=>{if(r&&w.reportValidity){const t=qw(e)?"":e||"";o?o.forEach(e=>Yw(e.setCustomValidity)&&e.setCustomValidity(t)):w.setCustomValidity(t),w.reportValidity()}},N={},x=!v&&bk(i),S=!v&&hw(i),j=x||S,E=(g||pw(i))&&Jw(i.value)&&Jw(y)||gk(i)&&""===i.value&&!v||""===y||Array.isArray(y)&&!y.length,C=yk.bind(null,f,s,N),O=(e,t,n,s=Mw,r=$w)=>{const a=e?t:n;N[f]={type:e?s:r,message:a,ref:i,...C(e?s:r,a)}};if(a?!Array.isArray(y)||!y.length:l&&(!j&&(E||fw(y))||qw(y)&&!y||S&&!Nk(o).isValid||x&&!Sk(o).isValid)){const{value:e,message:t}=ok(l)?{value:!!l,message:l}:Ek(l);if(e&&(N[f]={type:Dw,message:t,ref:w,...C(Dw,t)},!s))return k(t),N}if(!(E||fw(u)&&fw(h))){let e,t;const n=Ek(h),r=Ek(u);if(fw(y)||mw(y)||isNaN(y)){const s=!v&&i.valueAsDate||new Date(y),a=e=>new Date((new Date).toDateString()+" "+e),o="time"==i.type,l="week"==i.type;ok(n.value)&&y&&(e=o?a(y)>a(n.value):l?y>n.value:s>new Date(n.value)),ok(r.value)&&y&&(t=o?a(y)<a(r.value):l?y<r.value:s<new Date(r.value))}else{const s=!v&&i.valueAsNumber||(y?+y:y);fw(n.value)||(e=s>n.value),fw(r.value)||(t=s<r.value)}if((e||t)&&(O(!!e,n.message,r.message,Lw,Rw),!s))return k(N[f].message),N}if((!fw(c)||!fw(d))&&!E&&(ok(y)||a&&Array.isArray(y))){const e=Ek(c),t=Ek(d),n=!fw(e.value)&&y.length>+e.value,r=!fw(t.value)&&y.length<+t.value;if((n||r)&&(O(n,e.message,t.message),!s))return k(N[f].message),N}if(p&&!E&&ok(y)){const{value:e,message:t}=Ek(p);if(vk(e)&&!y.match(e)&&(N[f]={type:Fw,message:t,ref:i,...C(Fw,t)},!s))return k(t),N}if(m)if(Yw(m)){const e=jk(await m(y,n),w);if(e&&(N[f]={...e,...C(Vw,e.message)},!s))return k(e.message),N}else if(bw(m)){let e={};for(const t in m){if(!fk(e)&&!s)break;const r=jk(await m[t](y,n),w,t);r&&(e={...r,...C(t,r.message)},s||k(r.message),s&&(N[f]=e))}if(!fk(e)&&(N[f]={ref:w,...e},!s))return N}const _=N[f];return k(!_||_.message),N},Ok=e=>Array.isArray(e)?e:[e],_k=e=>Array.isArray(e)?e.filter(Boolean):[];function Ik(e,t){if(ok(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:Kw(t)?[t]:ww(t);if(n.some(e=>Hw.includes(String(e))))return e;const s=1===n.length?e:function(e,t){const n=t.length-1;let s=0;for(;s<n;){if(fw(e)){e=void 0;break}e=e[t[s]],s++}return e}(e,n),r=n.length-1,a=n[r];return s&&delete s[a],0!==r&&(bw(s)&&fk(s)||Array.isArray(s)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Jw(e[t]))return!1;return!0}(s))&&Ik(e,n.slice(0,-1)),e}var Tk=()=>{let e=new Set,t=0;return{get observers(){return Array.from(e)},next:n=>{const s=e;t++;for(const e of s)e.next&&e.next(n);s===e&&t--},subscribe:n=>(e.add(n),{unsubscribe:()=>{t&&(e=new Set(e),t=0),e.delete(n)}}),unsubscribe:()=>{e=new Set,t=0}}};function Ak(e,t){const n=Array.isArray(e)?[]:{};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s],a=t[s];r&&(bw(r)||Array.isArray(r))&&a?n[s]=Ak(r,a):e[s]&&(n[s]=a)}return n}const Pk=(e,t)=>null!==e&&gw(e)&&Object.prototype.hasOwnProperty.call(e,t);var zk=(e,t)=>{if(!t)return!1;let n=e;for(const s of Kw(t)?[t]:ww(t)){if(!Pk(n,s))return Pk(e,t);n=n[s]}return!0},Lk=e=>"select-multiple"===e.type;var Rk=e=>gk(e)&&e.isConnected;function Mk(e){return Array.isArray(e)||bw(e)}function $k(e,t,n="",s=[]){for(const r in e){const a=n?`${n}.${r}`:r,i=e[r];Mk(i)&&Mk(Gw(t,a))?$k(i,t,a,s):s.push(a)}return s}function Fk(e){return Array.isArray(e)||bw(e)&&!(e=>{for(const t in e)if(Yw(e[t]))return!0;return!1})(e)}function Dk(e){return!(!e||!("_f"in e))}function Vk(e){return Array.isArray(e)?!e.some(e=>!Jw(e)):!Object.keys(e).length}function Uk(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function Bk(e,t={},n){for(const s in e){const r=e[s],a=n&&n[s];!Fk(r)||Array.isArray(r)&&Dk(a)?Jw(r)||(t[s]=!0):(t[s]=Array.isArray(r)?[]:{},Bk(r,t[s],a),Vk(t[s])&&Uk(t,s))}return t}function Zk(e,t,n,s){n||(n=Bk(t,Array.isArray(fw(t)?e:t)?[]:{},s));for(const r in e){const a=e[r],i=s&&s[r];!Fk(a)||Array.isArray(a)&&Dk(i)?ak(a,fw(t)?void 0:t[r])?Uk(n,r):n[r]=!0:(Jw(t)||sk(n[r])?n[r]=Bk(a,Array.isArray(a)?[]:{},i):Zk(a,fw(t)?{}:t[r],n[r],i),Vk(n[r])&&Uk(n,r))}return n}var Hk=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>Jw(e)?e:t?""===e?NaN:e?+e:e:n&&ok(e)?new Date(e):s?s(e):e;function Wk(e){const t=e.ref;return pw(t)?t.files:bk(t)?Sk(e.refs).value:Lk(t)?[...t.selectedOptions].map(({value:e})=>e):hw(t)?Nk(e.refs).value:Hk(t.value,e)}var Kk=e=>Jw(e)?e:vk(e)?e.source:bw(e)?vk(e.value)?e.value.source:e.value:e;const Jk="AsyncFunction";var Gk=e=>{if(!e||!e.validate)return!1;if(Yw(e.validate))return e.validate.constructor.name===Jk;if(bw(e.validate))for(const t in e.validate)if(e.validate[t].constructor.name===Jk)return!0;return!1};function qk(e,t,n){const s=Gw(e,n);if(s&&(s.type||s.message)||Array.isArray(s))return{error:s,name:n};const r=n.split(".");for(;r.length;){const s=r.join("."),a=Gw(t,s),i=Gw(e,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(i&&i.type)return{name:s,error:i};if(i&&i.root&&i.root.type)return{name:`${s}.root`,error:i.root};r.pop()}return{name:n}}const Yk=(e,t,n)=>n?e===t||e.startsWith(t+"."):e.startsWith(t)||t.startsWith(e);var Xk=(e,t,n)=>{if(!e||!t||e===t)return!0;if(!Array.isArray(e))return Yk(e,t,n);for(const s of e)if(s&&Yk(s,t,n))return!0;return!1};const Qk={mode:Aw,reValidateMode:Tw,shouldFocusError:!0},eN={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function tN(e={}){let t={...Qk,...e},n={...xw(eN),isLoading:Yw(t.defaultValues),errors:xw(t.errors)||{},disabled:t.disabled||!1},s={},r=(bw(t.defaultValues)||bw(t.values))&&xw(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:xw(r),i={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},o=!1,l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const c={},d={},u=new Set;let h=uk(t.mode),p=uk(t.reValidateMode);const m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={...m},g={},b=(...e)=>e.some(e=>f[e]||g[e]),v=e=>{for(const t of u)if(Xk(t.name,e,t.exact))return!0;return!1},y={array:Tk(),state:Tk()};let w=0,k=0,N=0;const x={};let S=t.criteriaMode===zw;const j=(e,t)=>n=>{clearTimeout(d[e]),d[e]=setTimeout(t,n)},E=e=>{clearTimeout(d[e]),delete d[e],delete c[e]},C=e=>{E(e);const t=`${e}.`;for(const e of Object.keys(c))e.startsWith(t)&&E(e)},O=async e=>{if(!i.keepIsValid&&!t.disabled&&(b("isValid")||e)){const e=++w;let r;t.resolver?(r=fk((await R()).errors),e===w&&I()):r=await $({fields:s,onlyCheckValid:!0,eventType:_w}),e===w&&r!==n.isValid&&y.state.next({isValid:r})}},_=(e,t)=>{const s=[...e];if(!s.some(e=>e&&(t?!0!==Gw(n.validatingFields,e):zk(n.validatingFields,e))))return;const r=xw(n.validatingFields);for(const e of s)e&&(t?Xw(r,e,!0):Ik(r,e));ak(n.validatingFields,r)||(n.validatingFields=r)},I=(e,s)=>{!t.disabled&&b("isValidating","validatingFields")&&(_(e||l.mount,s),y.state.next({validatingFields:n.validatingFields,isValidating:!fk(n.validatingFields)}))},T=()=>{n.dirtyFields=Zk(r,a,void 0,s)},A=(e,t)=>{Xw(n.errors,e,t),n.errors={...n.errors},y.state.next({errors:n.errors})},P=e=>Kw(e)?[e]:ww(e),z=(e,c,d,u)=>{const h=Gw(s,e);if(h){if((e=>{const t=P(e);let n=a,s=r;for(let e=0;e<t.length-1;e++){const r=t[e];if(n=fw(n)?n:n[r],s=fw(s)?s:s[r],null===n&&null!==s)return!0}return!1})(e)||(e=>{if(!i.actionArrayLengths.size)return!1;const t=P(e);let n=a,s="",r=-1,o=0;for(let e=0;e<t.length;e++){if(fw(n))return!1;const a=t[e];if(s=s?`${s}.${a}`:a,Array.isArray(n)&&+a>=n.length)return-1!==r&&(e!==r||+a<o);if(i.actionArrayLengths.has(s)&&(r=e+1,o=i.actionArrayLengths.get(s)),n=n[a],Jw(n)&&-1!==r&&e>r&&+t[r]<o)return!0}return!1})(e))return;const s=Jw(Gw(a,e)),p=Gw(a,e,Jw(d)?Gw(r,e):d),m=!!u&&!n.isReady&&(e=>hw(e)?e.checked!==e.defaultChecked:"select-one"===e.type||Lk(e)?(e=>{const t=[...e.options];return!e.multiple&&e.size<2&&!t.some(e=>e.defaultSelected)?e.selectedIndex!==t.findIndex(e=>!e.disabled):t.some(e=>e.selected!==e.defaultSelected)})(e):!bk(e)&&"defaultValue"in e&&e.value!==e.defaultValue)(u);if(Jw(p)||u&&u.defaultChecked||m||c){const t=c?p:Wk(h._f);Jw(t)&&(e=>{let t=a;for(const n of P(e)){if(Array.isArray(t)&&+n>=t.length)return!0;t=t&&t[n]}return!1})(e)||(b("dirtyFields")&&!ak(Gw(a,e),t)&&(o=!0),Xw(a,e,t),m&&L(e,t))}else V(e,p);if(i.mount&&!i.action){if(t.resolver&&b("isValidating","validatingFields")?Promise.resolve().then(()=>O()):O(),s&&n.isDirty&&b("isDirty")){F()||(n.isDirty=!1,y.state.next({...n}))}t.shouldUnregister&&s&&!Jw(Gw(a,e))&&hk(e,l)&&(i.watch=!0)}}},L=(e,i,l,c,d)=>{let u=!1,h=!1;const p={name:e};if(!t.disabled||!0===c){if(!l||c){const t=ak(Gw(r,e),i);if(b("isDirty")&&(h=n.isDirty,n.isDirty=p.isDirty=!t||F(),u=h!==p.isDirty),h=!!Gw(n.dirtyFields,e),t)Ik(n.dirtyFields,e);else{const t=Gw(r,e),a=Gw(s,e),o=!!(a&&a._f||!bw(t)&&!Array.isArray(t))||Zk(t,i,void 0,a);Xw(n.dirtyFields,e,o)}let l=!1;if(o||t&&(b("isDirty")?n.isDirty:F())){o=!1;const e=Zk(r,a,void 0,s);ak(n.dirtyFields,e)||(l=!0,((e,t)=>{for(const t in e)delete e[t];Object.assign(e,t)})(n.dirtyFields,e))}p.dirtyFields=n.dirtyFields,u=u||b("dirtyFields")&&(l||h!==!t)}if(l){const t=zk(n.touchedFields,e)?Gw(n.touchedFields,e):void 0;t||(Xw(n.touchedFields,e,l),p.touchedFields=n.touchedFields,u=u||b("touchedFields")&&t!==l)}u&&d&&y.state.next(p)}return u?p:{}},R=async e=>(I(e,!0),await t.resolver(a,t.context,((e,t,n,s)=>{const r={};for(const n of e){const e=Gw(t,n);e&&Xw(r,n,e._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:s}})(e||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),M=async({name:e,eventType:s})=>{if(t.validate){const r=k,i=await t.validate({formValues:a,formState:n,name:e,eventType:s});if(r!==k)return!0;if(bw(i)){let e=!0;G(Bw);for(const t in i){const n=i[t];n&&(e=!1,q(`${Bw}.${t}`,{message:ok(n.message)?n.message:"",type:n.type||Vw}))}return e}return ok(i)||!i?(q(Bw,{message:i||"",type:Vw}),!1):(G(Bw),!0)}return!0},$=async({fields:e,onlyCheckValid:r,name:i,eventType:o,context:c={valid:!0,runRootValidation:!1}})=>{const d=k;if(t.validate&&!c.runRootValidation){c.runRootValidation=!0;if(!await M({name:i,eventType:o})&&(c.valid=!1,r))return c.valid}for(const i in e){const u=e[i];if(u){const{_f:e,...h}=u;if(e){const i=l.array.has(e.name),o=u._f&&Gk(u._f),h=b("isValidating","validatingFields");o&&h&&I([e.name],!0);const p=N,m=await Ck(u,l.disabled,a,S,t.shouldUseNativeValidation&&!r,i);if(d!==k)return c.valid;if(o&&h&&I([e.name]),!Gw(s,e.name)||x[e.name]>p)continue;if(m[e.name]&&(c.valid=!1,r))break;if(r||(E(e.name),Gw(m,e.name)?i?mk(n.errors,m,e.name):Xw(n.errors,e.name,m[e.name]):Ik(n.errors,e.name)),t.shouldUseNativeValidation&&m[e.name])break}!fk(h)&&await $({context:c,onlyCheckValid:r,fields:h,name:i,eventType:o})}}return c.valid},F=(e,t)=>(e&&!Jw(t)&&Xw(a,e,t),!ak(i.mount?a:r,r)),D=(e,t,n)=>{const s=i.mount?a:Jw(t)||!Jw(e)?r:t;return lk(e,l,Jw(e)?{...s}:s,n,t)},V=(e,t,n={},r=!1,i=!1,o=!1)=>{const l=Gw(s,e);let c=t;if(l){const n=l._f;n&&(!n.disabled&&Xw(a,e,Hk(t,n)),c=gk(n.ref)&&fw(t)?"":t,Lk(n.ref)?[...n.ref.options].forEach(e=>e.selected=c.includes(e.value)):n.refs?hw(n.ref)?n.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(c)?e.checked=!!c.find(t=>t===e.value):e.checked=c===e.value||!!c)}):n.refs.forEach(e=>e.checked=e.value===c):pw(n.ref)?n.ref.value="":(n.ref.value=c,n.ref.type||i||o||y.state.next({name:e,values:r?a:v(e)?xw(a):void 0})))}(n.shouldDirty||n.shouldTouch)&&L(e,l&&l._f&&!l._f.disabled&&(l._f.valueAsNumber||l._f.valueAsDate||l._f.setValueAs)?Hk(t,l._f):c,n.shouldTouch,n.shouldDirty,!i),n.shouldValidate&&K(e,{delayError:n.delayError}),n.shouldValidate&&l&&l._f&&l._f.deps&&(!Array.isArray(l._f.deps)||l._f.deps.length>0)&&K(l._f.deps)},U=(e,t,n,r=!1,i=!1,o=!1)=>{for(const c in t){if(!Object.prototype.hasOwnProperty.call(t,c))continue;const d=t[c],u=e+"."+c,h=Gw(s,u);l.array.has(u)&&y.array.next({name:u,values:r?a:xw(a)}),(l.array.has(e)||bw(d)||h&&!h._f)&&!mw(d)?U(u,d,n,r,i,o):V(u,d,n,r,i,o)}},B=(e,t,r,o,c=!1)=>{const d=Gw(s,e),u=l.array.has(e),h=o?t:xw(t),p=ak(Gw(a,e),h);if(p||Xw(a,e,h),u)y.array.next({name:e,values:o?a:xw(a)}),b("isDirty","dirtyFields")&&r.shouldDirty&&(T(),n.isDirty=F(e,h),c||y.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:n.isDirty})),r.shouldValidate&&K(e,{delayError:r.delayError});else{const t=Array.isArray(h)&&!h.length||fk(h),n=!p&&!c;!d||d._f||fw(h)||t?V(e,h,r,o,c,n):U(e,h,r,o,c,n)}if(!p&&!c){const t=hk(e,l),s=i.mount||t?e:void 0,r=u?[]:((e,t)=>{const n=t.split("."),s=[];let r=n[0];for(let t=1;t<n.length;r+="."+n[t++])!isNaN(+n[t])&&e.has(r)&&s.push(`${r}.${n[t]}`);return s})(l.array,e),c=o?a:v(s)||r.some(v)?xw(a):void 0;y.state.next({...t&&n,name:s,values:c});for(const e of r)y.state.next({name:e,values:c})}},Z=(e,t,n={})=>B(e,t,n,!1),H=async e=>{i.mount=!0;const r=e.target;let o=r.name,d=!0;const u=Gw(s,o),m=N,f=e=>{d=!!Gw(s,o)&&!(x[o]>m)&&ak(e,Gw(a,o,e))};if(u){let m,N;i.keepIsValid=!1;let x=!1;const C=r.type?Wk(u._f):vw(e),_=e.type===Sw||e.type===jw,T=!(g=u._f,g.mount&&(g.required||!Jw(g.required)&&!1!==g.required||!Jw(g.min)||!Jw(g.max)||!Jw(g.maxLength)||!Jw(g.minLength)||g.pattern||g.validate)||t.validate||t.resolver||Gw(n.errors,o)||u._f.deps),P=T||((e,t,n,s,r)=>!r.isOnAll&&(!n&&r.isOnTouch?!(t||e):(n?s.isOnBlur:r.isOnBlur)?!e:!(n?s.isOnChange:r.isOnChange)||e))(_,Gw(n.touchedFields,o),n.isSubmitted,p,h),z=hk(o,l,_);Xw(a,o,xw(C)),_?r&&r.readOnly||(u._f.onBlur&&u._f.onBlur(e),Object.prototype.hasOwnProperty.call(c,o)&&(x=!0,c[o](0))):u._f.onChange&&u._f.onChange(e);const F=L(o,C,_),D=!fk(F)||z;if(!_&&y.state.next({name:o,type:e.type,...v(o)?{values:xw(a)}:{}}),P)return T&&n.isValid||!b("isValid")||("onBlur"===t.mode?_&&O():_||O()),D&&y.state.next({name:o,...z?{}:F});if(!t.resolver&&t.validate&&await M({name:o,eventType:e.type}),!_&&z&&y.state.next({...n}),t.resolver){const e=k,{errors:t}=await R([o]);if(e!==k)return;if(I([o]),f(C),!d)return void(!fk(F)&&y.state.next(F));const r=qk(n.errors,s,o),a=qk(t,s,r.name||o);m=a.error,o=a.name,N=fk(t)}else{const n=k,r=++w;if(I([o],!0),m=(await Ck(u,l.disabled,a,S,t.shouldUseNativeValidation))[o],n!==k)return;if(I([o]),f(C),d)if(m)N=!1;else if(b("isValid")){if(N=await $({fields:s,onlyCheckValid:!0,name:o,eventType:e.type}),n!==k)return;f(C),r!==w&&(N=void 0)}}d&&(u._f.deps&&(!Array.isArray(u._f.deps)||u._f.deps.length>0)&&K(u._f.deps),((e,s,r,a)=>{const i=Gw(n.errors,e),o=b("isValid")&&qw(s)&&n.isValid!==s;if(t.delayError&&r?(c[e]=j(e,()=>A(e,r)),c[e](t.delayError)):(E(e),r?Xw(n.errors,e,r):Ik(n.errors,e),n.errors={...n.errors}),(r?!ak(i,r,!0):i)||!fk(a)||o){const t={...a,...o&&qw(s)?{isValid:s}:{},errors:n.errors,name:e};y.state.next(t)}})(o,N,m,F),x&&Object.prototype.hasOwnProperty.call(c,o)&&c[o](0))}var g},W=(e,t)=>{if(Gw(n.errors,t)&&e.focus)return e.focus(),1},K=async(e,r={})=>{let a,o;i.keepIsValid=!1;const d=Ok(e),u=k;if(t.resolver){const t=await(async e=>{const t=k,r=N,a=e?e.filter(e=>Gw(s,e)):[],{errors:i}=await R(e);if(t!==k)return i;if(I(e),e){for(const t of e){if(a.includes(t)&&(!Gw(s,t)||x[t]>r)){Ik(i,t);continue}const e=Gw(i,t);C(t);const o=l.array.has(t)&&bw(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e))),c=Gw(s,t),d=bw(c)&&Object.keys(c).some(e=>"_f"!==e);o?mk(n.errors,{[t]:e},t):e&&(e.type||e.message)||Array.isArray(e)||bw(e)&&d?Xw(n.errors,t,e):Ik(n.errors,t)}n.errors={...n.errors}}else Object.keys(c).forEach(E),n.errors=i;return i})(Jw(e)?e:d);a=fk(t),o=e?!d.some(e=>Gw(t,e)):a}else e?(o=(await Promise.all(d.map(async e=>{const t=Gw(s,e);return await $({fields:t&&t._f?{[e]:t}:t,eventType:Ow})}))).every(Boolean),(o||n.isValid)&&O()):o=a=await $({fields:s,name:e,eventType:Ow});if(u!==k)return o;if(r.delayError&&t.delayError&&ok(e)){const s=Gw(n.errors,e);s?(Ik(n.errors,e),c[e]=j(e,()=>A(e,s)),c[e](t.delayError)):E(e)}if(r.shouldTouch)for(const t of e?d:l.mount)!l.array.has(t)&&Xw(n.touchedFields,t,!0);return n.errors={...n.errors},y.state.next({...!ok(e)||b("isValid")&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},...r.shouldTouch&&b("touchedFields")?{touchedFields:n.touchedFields}:{},errors:n.errors}),r.shouldFocus&&!o&&pk(s,W,e?d:l.mount),o},J=(e,t)=>{const s=t||n,r=Gw(s.errors,e);return{invalid:!!r,isDirty:!!Gw(s.dirtyFields,e),error:r,isValidating:!!Gw(s.validatingFields,e),isTouched:!!Gw(s.touchedFields,e)}},G=e=>{const t=e?Ok(e):void 0;t?t.forEach(e=>{C(e),Ik(n.errors,e),n.errors={...n.errors},y.state.next({name:e,errors:n.errors})}):(Object.keys(c).forEach(E),n.errors={},y.state.next({errors:n.errors}))},q=(e,t,r)=>{C(e);const a=Gw(s,e,{_f:{}}),i=a._f&&a._f.ref,o=Gw(n.errors,e)||{},{ref:l,message:c,type:d,types:u,...h}=o;Xw(n.errors,e,{...h,...t,ref:i}),n.errors={...n.errors},y.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},Y=e=>{const t={name:e.name,exact:e.exact};e.formState&&e.formState.values&&u.add(t);const{unsubscribe:s}=y.state.subscribe({next:t=>{if(Xk(e.name,t.name,e.exact)&&((e,t,n)=>{const s=Object.keys(e).filter(e=>"name"!==e);return!s.length||n&&s.length>=Object.keys(t).length||s.find(e=>t[e]===(!n||zw))})(t,e.formState||f,e.reRenderRoot)){const s=t.values||{...a};e.callback({...n,...t,validatingFields:n.validatingFields,isValidating:n.isValidating,values:s,defaultValues:r})}}});return()=>{u.delete(t),s()}},X=(e,i={})=>{const o=e?Ok(e):l.mount;i.keepIsValidating||_(o);for(const e of o)l.mount.delete(e),l.array.delete(e),l.disabled.delete(e),Ik(s,e),!i.keepValue&&Ik(a,e),i.keepError||(C(e),Ik(n.errors,e)),!i.keepDirty&&Ik(n.dirtyFields,e),!i.keepTouched&&Ik(n.touchedFields,e),!t.shouldUnregister&&!i.keepDefaultValue&&Ik(r,e);i.keepError||(n.errors={...n.errors}),u.size&&y.state.next({values:xw(a)}),y.state.next({...n,...i.keepDirty?{}:{isDirty:F()},...i.keepIsValidating?{}:{isValidating:!fk(n.validatingFields)}}),!i.keepIsValid&&O()},Q=({disabled:e,name:t})=>{if(qw(e)&&i.mount||e||l.disabled.has(t)){const n=l.disabled.has(t)!==!!e;e?l.disabled.add(t):l.disabled.delete(t),n&&i.mount&&!i.action&&O()}},ee=(e,n={})=>{let a=Gw(s,e);const o=qw(n.disabled)||qw(t.disabled),c=!l.registerName.has(e)&&a&&a._f&&!a._f.mount;if(a&&a._f||(x[e]=++N),Xw(s,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),a&&a._f){const t=Gw(s,e);for(const e of Uw)e in n||delete t._f[e]}return a&&!c?Q({disabled:qw(n.disabled)?n.disabled:t.disabled,name:e}):z(e,!0,n.value),{...o?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!Kk(n.required),min:Kk(n.min),max:Kk(n.max),minLength:Kk(n.minLength),maxLength:Kk(n.maxLength),pattern:Kk(n.pattern)}:{},name:e,onChange:H,onBlur:H,ref:o=>{if(o){l.registerName.add(e),ee(e,n),l.registerName.delete(e),a=Gw(s,e);const t=Jw(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,i=(e=>bk(e)||hw(e))(t),c=a._f.refs||[];if(i?c.find(e=>e===t):t===a._f.ref)return;const d={...a._f};i?(d.refs=[...c.filter(Rk),t,...Array.isArray(Gw(r,e))?[{}]:[]],d.ref={type:t.type,name:e}):(d.ref=t,delete d.refs),Xw(s,e,{_f:d}),z(e,!1,void 0,t)}else a=Gw(s,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!kw(l.array,e)||!i.action)&&l.unMount.add(e)}}},te=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&pk(s,W,l.mount),ne=(e,r)=>async i=>{let o,d;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let u=xw(a);y.state.next({isSubmitting:!0});const h=k,p=e=>{throw h===k&&y.state.next({isSubmitting:!1}),e};if(t.resolver){let e;try{e=await R()}catch(e){p(e)}const{errors:t,values:s}=e;if(h!==k)return;I(),Object.keys(c).forEach(E),n.errors=t,u=xw(s)}else{try{await $({fields:s,eventType:Cw})}catch(e){p(e)}if(h!==k)return;Ik(n.errors,Zw),n.errors={...n.errors}}if(l.disabled.size)for(const e of l.disabled)Ik(u,e);if(fk(n.errors)){y.state.next({errors:{}});try{o=await e(u,i)}catch(e){d=e}}else{if(r)try{await r({...n.errors},i)}catch(e){p(e)}te(),setTimeout(te)}if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:fk(n.errors)&&!d,submitCount:n.submitCount+1,errors:n.errors}),d)throw d;return o},se=(e,d={})=>{k++,w++;const u=e?xw(e):r,h=xw(u),p=fk(e),m=h,g=s;if(Object.keys(c).forEach(E),d.keepDefaultValues||(r=u),!d.keepValues){if(d.keepDirtyValues){const e=new Set([...l.mount,...$k(Zk(r,a,void 0,g),n.dirtyFields)]);for(const t of e){const e=Gw(n.dirtyFields,t),s=Gw(a,t),r=Gw(m,t);e&&!Jw(s)?Xw(m,t,s):e||Jw(r)||Z(t,r)}}else{if(Nw&&Jw(e))for(const e of l.mount){const t=Gw(s,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(gk(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(d.keepFieldsRef)for(const e of l.mount)Z(e,Gw(m,e));else s={}}if(t.shouldUnregister){if(a=d.keepDefaultValues?xw(r):{},d.keepFieldsRef)for(const e of l.mount)Xw(a,e,Gw(m,e))}else a=xw(m);y.array.next({values:{...m}}),y.state.next({name:void 0,type:void 0,values:{...m}})}l={mount:d.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:d.keepValues||d.keepDirtyValues||d.keepFieldsRef?new Set([...l.disabled].filter(e=>Gw(s,e))):new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!d.keepIsValid||!!d.keepDirtyValues||!t.shouldUnregister&&!fk(m),i.watch=!!t.shouldUnregister,i.keepIsValid=!!d.keepIsValid,i.action=!1,i.actionArrayLengths.clear(),o=!1,d.keepErrors||(n.errors={}),y.state.next({submitCount:d.keepSubmitCount?n.submitCount:0,isDirty:!p&&(d.keepDirty?n.isDirty:d.keepValues?F():!(!d.keepDefaultValues||!e||ak(e,r))),isSubmitted:!!d.keepIsSubmitted&&n.isSubmitted,dirtyFields:p?{}:d.keepDirtyValues?d.keepDefaultValues&&a?Zk(r,a,void 0,g):n.dirtyFields:d.keepDefaultValues&&e?Zk(r,e,void 0,g):d.keepDirty?n.dirtyFields:d.keepValues?Zk(r,a,void 0,g):{},touchedFields:d.keepTouched?n.touchedFields:{},...d.keepIsValidating||!n.isValidating&&fk(n.validatingFields)?null:{validatingFields:{},isValidating:!1},errors:d.keepErrors?n.errors:{},isSubmitSuccessful:!!d.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:r})},re=(e,n)=>se(Yw(e)?e(a):e,{...t.resetOptions,...n});y.state.subscribe({next:e=>{const{name:t,type:s,values:r,...a}=e;Object.keys(a).length&&(n={...n,...a})}});const ae={control:{register:ee,unregister:X,getFieldState:J,handleSubmit:ne,setError:q,_subscribe:Y,_runSchema:R,_updateIsValidating:I,_focusError:te,_getWatch:D,_getDirty:F,_setValid:O,_setFieldArray:(e,r=[],l,c,d=!0,u=!0)=>{if(c&&l&&!t.disabled){i.action=!0,i.keepIsValid=!1;const t=Gw(s,e),a=t&&t._f,h=a?Object.assign([],t):t;if(i.actionArrayLengths.has(e)||i.actionArrayLengths.set(e,Array.isArray(h)?h.length:0),u&&Array.isArray(h)){const t=l(h,c.argA,c.argB)||h;a?Xw(s,e,{...t,_f:a}):d&&Xw(s,e,t)}const p=Gw(n.errors,e);if(u&&Array.isArray(p)){const t=p.root,s=l(p,c.argA,c.argB)||p;t&&(s.root=t),d&&Xw(n.errors,e,s),((e,t)=>{const n=Gw(e,t);!_k(n).length&&(!n||!n.root)&&Ik(e,t)})(n.errors,e),n.errors={...n.errors}}const m=Gw(n.touchedFields,e),f=u&&Array.isArray(m);if(f){const t=l(m,c.argA,c.argB);d&&Xw(n.touchedFields,e,t)}const g=Gw(n.dirtyFields,e);if(u&&Array.isArray(g)){const t=l(g,c.argA,c.argB)||g;d&&Xw(n.dirtyFields,e,t)}b("dirtyFields")?T():o=!0,y.state.next({name:e,isDirty:F(e,r),dirtyFields:n.dirtyFields,...f&&{touchedFields:n.touchedFields},errors:n.errors,isValid:n.isValid})}else Xw(a,e,r)},_setDisabledField:Q,_setErrors:e=>{Object.keys(c).forEach(E);const t=!fk(e);n.errors=xw(e),y.state.next({errors:n.errors,...t?{isValid:!1}:{}}),!t&&i.mount&&O()},_getFieldArray:e=>_k(Gw(i.mount?a:r,e,t.shouldUnregister?Gw(r,e,[]):[])),_reset:se,_resetDefaultValues:()=>Yw(t.defaultValues)&&t.defaultValues().then(e=>{re(e,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of l.unMount){const t=Gw(s,e);t&&(t._f.refs?t._f.refs.every(e=>!Rk(e)):!Rk(t._f.ref))&&X(e)}l.unMount=new Set},_disableForm:e=>{qw(e)&&(y.state.next({disabled:e}),pk(s,(t,n)=>{const r=Gw(s,n);r&&(t.disabled=r._f.disabled||e,Array.isArray(r._f.refs)&&r._f.refs.forEach(t=>{t.disabled=r._f.disabled||e}))},0))},_subjects:y,_proxyFormState:f,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(e){i=e},get _defaultValues(){return r},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},h=uk(t.mode),p=uk(t.reValidateMode),S=t.criteriaMode===zw}},subscribe:e=>{i.mount=!0;const t=Object.keys(e.formState||{}).filter(t=>e.formState&&e.formState[t]);for(const e of t)g[e]=(g[e]||0)+1;const n=Y({...e,formState:{...m,...e.formState}});return()=>{for(const e of t.splice(0))g[e]--;n()}},trigger:K,register:ee,handleSubmit:ne,watch:(e,t)=>{if(Yw(e)){const n={};u.add(n);const{unsubscribe:s}=y.state.subscribe({next:n=>"values"in n&&e(n.values||D(void 0,t),n)});return{unsubscribe:()=>{u.delete(n),s()}}}return D(e,t,!0)},setValue:Z,setValues:(e,t={})=>{const s=Yw(e)?e(a):e;if(!ak(a,s)){a={...a,...s};for(const e of new Set([...l.mount,...l.array]))zk(s,e)&&B(e,Gw(s,e),t,!0,!0);y.state.next({...n,name:void 0,type:void 0,...u.size?{values:a}:{}}),t.shouldValidate&&O()}},getValues:(e,t)=>{let s=Jw(e)&&!t?{...i.mount?a:r}:i.mount?a:r;return t&&(s=Ak(t.dirtyFields?n.dirtyFields:n.touchedFields,s)),Jw(e)?s:ok(e)?Gw(s,e):e.map(e=>Gw(s,e))},getErrors:e=>Jw(e)?{...n.errors}:ok(e)?Gw(n.errors,e):e.map(e=>Gw(n.errors,e)),reset:re,resetField:(e,t={})=>{Gw(s,e)&&(_([e]),Jw(t.defaultValue)?Z(e,xw(Gw(r,e))):(Z(e,t.defaultValue),Xw(r,e,xw(t.defaultValue))),t.keepTouched||Ik(n.touchedFields,e),t.keepDirty||(Ik(n.dirtyFields,e),n.isDirty=Jw(t.defaultValue)?F():F(e,xw(Gw(r,e)))),t.keepError||(C(e),Ik(n.errors,e),n.errors={...n.errors},O()),y.state.next({...n,isValidating:!fk(n.validatingFields)}))},resetDefaultValues:(e,t={})=>{if(r=xw(e),!t.keepDirty){const e=Zk(r,a,void 0,s);n.dirtyFields=e,n.isDirty=!fk(e)}t.keepIsValid||O(),y.state.next({...n,defaultValues:r})},clearErrors:G,unregister:X,setError:q,setFocus:(e,t={})=>{const n=Gw(s,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Yw(e.select)&&e.select()})}},getFieldState:J};return{...ae,formControl:ae}}const nN={mode:Qk.mode,reValidateMode:Qk.reValidateMode,shouldFocusError:Qk.shouldFocusError,resolver:void 0,criteriaMode:void 0,delayError:void 0,shouldUnregister:void 0,shouldUseNativeValidation:void 0,context:void 0,progressive:void 0,resetOptions:void 0};function sN(e={}){const t=r.useRef(void 0),n=r.useRef(void 0),s=r.useRef(e.formControl),a=r.useRef(!1),i=r.useRef(!!e.validate),o=r.useRef(!!e.errors),l=r.useRef(!1),[c,d]=r.useState(()=>({...xw(eN),isLoading:Yw(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Yw(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&s.current!==e.formControl)if(s.current=e.formControl,a.current=!1,e.formControl)t.current={...e.formControl,formState:c},e.defaultValues&&!Yw(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:n,...s}=tN(e);t.current={...s,formState:c}}const u=t.current.control,h=u._options,p={};for(const t in nN)t in h&&!(t in e)&&(p[t]=nN[t]);a.current&&!e.disabled&&(p.disabled=!1),u._options={...p,...e,validate:e.validate};const m=()=>({...u._formState,defaultValues:u._defaultValues}),{resyncIfNeeded:f,snapshot:g}=ik(m);return nk(()=>{f(!0,m,d);const e=u._subscribe({formState:u._proxyFormState,callback:()=>d({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return d(e=>({...e,isReady:!0})),u._formState.isReady=!0,u._subjects.state.next({isReady:!0}),()=>{e(),g(!0,m)}},[u,f,g]),r.useEffect(()=>{u._disableForm(!(a.current&&!e.disabled)&&e.disabled),a.current=!!e.disabled},[u,e.disabled]),r.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),r.useEffect(()=>{e.errors?(u._setErrors(e.errors),u._focusError()):o.current&&u._setErrors({}),o.current=!!e.errors},[u,e.errors]),r.useEffect(()=>{i.current&&!e.validate&&t.current&&t.current.clearErrors(Bw),i.current=!!e.validate},[e.validate]),r.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),r.useEffect(()=>{if(u._proxyFormState.isDirty){const e=u._getDirty();e!==c.isDirty&&u._subjects.state.next({isDirty:e})}},[u,c.isDirty]),r.useEffect(()=>{e.values&&!ak(e.values,n.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),u._options.resetOptions&&u._options.resetOptions.keepIsValid||u._setValid(),n.current=e.values,d(e=>({...e}))):u._resetDefaultValues()},[u,e.values]),r.useEffect(()=>{u._state.mount&&(l.current||e.values)||(u._setValid(),u._state.mount=!0),l.current=!0,u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),t.current.formState=r.useMemo(()=>tk(c,u),[u,c]),t.current}r.createContext(null).displayName="HookFormContext";const rN=(e,t,n)=>{if(e&&"reportValidity"in e){const s=Gw(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},aN=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?rN(s.ref,n,e):s&&s.refs&&s.refs.forEach(t=>rN(t,n,e))}},iN=(e,t)=>{t.shouldUseNativeValidation&&aN(e,t);const n={};for(const s in e){const r=Gw(t.fields,s),a=Object.assign(e[s]||{},{ref:r&&r.refs?r.refs[0]:r&&r.ref});if(oN(t.names||Object.keys(e),s)){const e=Object.assign({},Gw(n,s));Xw(e,"root",a),Xw(n,s,e)}else Xw(n,s,a)}return n},oN=(e,t)=>{const n=lN(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(e=>lN(e).match(`^${n}\\.\\d+`))};function lN(e){return e.replace(/\[(\d+)]/g,".$1").replace(/[[\]]/g,"")}function cN(e,t,n){return void 0===n&&(n={}),function(s,r,a){try{return Promise.resolve(function(i,o){try{var l=(null!=t&&t.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e["sync"===n.mode?"validateSync":"validate"](s,Object.assign({abortEarly:!1},t,{context:r}))).then(function(e){return a.shouldUseNativeValidation&&aN({},a),{values:n.raw?Object.assign({},s):e,errors:{}}}))}catch(e){return o(e)}return l&&l.then?l.then(void 0,o):l}(0,function(e){if(!e.inner)throw e;return{values:{},errors:iN((t=e,n=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,(t.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var s=e[t.path].types,r=s&&s[t.type];e[t.path]=yk(t.path,n,e,t.type,r?[].concat(r,t.message):t.message)}return e},Object.create(null))),a)};var t,n}))}catch(e){return Promise.reject(e)}}}var dN,uN;var hN,pN,mN=function(){if(uN)return dN;function e(e){this._maxSize=e,this.clear()}uN=1,e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(e){return this._values[e]},e.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,s=/^\d/,r=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=new e(512),o=new e(512),l=new e(512);function c(e){return i.get(e)||i.set(e,d(e).map(function(e){return e.replace(a,"$2")}))}function d(e){return e.match(t)||[""]}function u(e){return"string"==typeof e&&e&&-1!==["'",'"'].indexOf(e.charAt(0))}function h(e){return!u(e)&&(function(e){return e.match(s)&&!e.match(n)}(e)||function(e){return r.test(e)}(e))}return dN={Cache:e,split:d,normalizePath:c,setter:function(e){var t=c(e);return o.get(e)||o.set(e,function(e,n){for(var s=0,r=t.length,a=e;s<r-1;){var i=t[s];if("__proto__"===i||"constructor"===i||"prototype"===i)return e;a=a[t[s++]]}a[t[s]]=n})},getter:function(e,t){var n=c(e);return l.get(e)||l.set(e,function(e){for(var s=0,r=n.length;s<r;){if(null==e&&t)return;e=e[n[s++]]}return e})},join:function(e){return e.reduce(function(e,t){return e+(u(t)||n.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(e,t,n){!function(e,t,n){var s,r,a,i,o=e.length;for(r=0;r<o;r++)(s=e[r])&&(h(s)&&(s='"'+s+'"'),a=!(i=u(s))&&/^\d+$/.test(s),t.call(n,s,i,a,r,e))}(Array.isArray(e)?e:d(e),t,n)}},dN}();var fN,gN=function(){if(pN)return hN;pN=1;const e=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,t=t=>t.match(e)||[],n=e=>e[0].toUpperCase()+e.slice(1),s=(e,n)=>t(e).join(n).toLowerCase(),r=e=>t(e).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");return hN={words:t,upperFirst:n,camelCase:r,pascalCase:e=>n(r(e)),snakeCase:e=>s(e,"_"),kebabCase:e=>s(e,"-"),sentenceCase:e=>n(s(e," ")),titleCase:e=>t(e).map(n).join(" ")}}(),bN={exports:{}};var vN=function(){if(fN)return bN.exports;function e(e,t){var n=e.length,s=new Array(n),r={},a=n,i=function(e){for(var t=new Map,n=0,s=e.length;n<s;n++){var r=e[n];t.has(r[0])||t.set(r[0],new Set),t.has(r[1])||t.set(r[1],new Set),t.get(r[0]).add(r[1])}return t}(t),o=function(e){for(var t=new Map,n=0,s=e.length;n<s;n++)t.set(e[n],n);return t}(e);for(t.forEach(function(e){if(!o.has(e[0])||!o.has(e[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});a--;)r[a]||l(e[a],a,new Set);return s;function l(e,t,a){if(a.has(e)){var c;try{c=", node was:"+JSON.stringify(e)}catch(e){c=""}throw new Error("Cyclic dependency"+c)}if(!o.has(e))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(e));if(!r[t]){r[t]=!0;var d=i.get(e)||new Set;if(t=(d=Array.from(d)).length){a.add(e);do{var u=d[--t];l(u,o.get(u),a)}while(t);a.delete(e)}s[--n]=e}}}return fN=1,bN.exports=function(t){return e(function(e){for(var t=new Set,n=0,s=e.length;n<s;n++){var r=e[n];t.add(r[0]),t.add(r[1])}return Array.from(t)}(t),t)},bN.exports.array=e,bN.exports}(),yN=Sm(vN);const wN=Object.prototype.toString,kN=Error.prototype.toString,NN=RegExp.prototype.toString,xN="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",SN=/^Symbol\((.*)\)(.*)$/;function jN(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const n=typeof e;if("number"===n)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===n)return t?`"${e}"`:e;if("function"===n)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===n)return xN.call(e).replace(SN,"Symbol($1)");const s=wN.call(e).slice(8,-1);return"Date"===s?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===s||e instanceof Error?"["+kN.call(e)+"]":"RegExp"===s?NN.call(e):null}function EN(e,t){let n=jN(e,t);return null!==n?n:JSON.stringify(e,function(e,n){let s=jN(this[e],t);return null!==s?s:n},2)}function CN(e){return null==e?[]:[].concat(e)}let ON,_N,IN,TN=/\$\{\s*(\w+)\s*\}/g;ON=Symbol.toStringTag;class AN{constructor(e,t,n,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[ON]="Error",this.name="ValidationError",this.value=t,this.path=n,this.type=s,this.errors=[],this.inner=[],CN(e).forEach(e=>{if(PN.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}_N=Symbol.hasInstance,IN=Symbol.toStringTag;class PN extends Error{static formatError(e,t){const n=t.label||t.path||"this";return t=Object.assign({},t,{path:n,originalPath:t.path}),"string"==typeof e?e.replace(TN,(e,n)=>EN(t[n])):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,n,s,r){const a=new AN(e,t,n,s);if(r)return a;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[IN]="Error",this.name=a.name,this.message=a.message,this.type=a.type,this.value=a.value,this.path=a.path,this.errors=a.errors,this.inner=a.inner,Error.captureStackTrace&&Error.captureStackTrace(this,PN)}static[_N](e){return AN[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let zN={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:s})=>{const r=null!=s&&s!==n?` (cast from the value \`${EN(s,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${EN(n,!0)}\``+r:`${e} must match the configured type. The validated value was: \`${EN(n,!0)}\``+r}},LN={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},RN={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},MN={isValue:"${path} field must be ${value}"},$N={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},FN={notType:e=>{const{path:t,value:n,spec:s}=e,r=s.types.length;if(Array.isArray(n)){if(n.length<r)return`${t} tuple value has too few items, expected a length of ${r} but got ${n.length} for value: \`${EN(n,!0)}\``;if(n.length>r)return`${t} tuple value has too many items, expected a length of ${r} but got ${n.length} for value: \`${EN(n,!0)}\``}return PN.formatError(zN.notType,e)}};Object.assign(Object.create(null),{mixed:zN,string:LN,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:RN,object:$N,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:MN,tuple:FN});const DN=e=>e&&e.__isYupSchema__;class VN{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:s,otherwise:r}=t,a="function"==typeof n?n:(...e)=>e.every(e=>e===n);return new VN(e,(e,t)=>{var n;let i=a(...e)?s:r;return null!=(n=null==i?void 0:i(t))?n:t})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context)),s=this.fn(n,e,t);if(void 0===s||s===e)return e;if(!DN(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const UN="$",BN=".";function ZN(e,t){return new HN(e,t)}class HN{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof e)throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),""===e)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===UN,this.isValue=this.key[0]===BN,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?UN:this.isValue?BN:"";this.path=this.key.slice(n.length),this.getter=this.path&&mN.getter(this.path,!0),this.map=t.map}getValue(e,t,n){let s=this.isContext?n:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}HN.prototype.__isYupRef=!0;const WN=e=>null==e;function KN(e){function t({value:t,path:n="",options:s,originalValue:r,schema:a},i,o){const{name:l,test:c,params:d,message:u,skipAbsent:h}=e;let{parent:p,context:m,abortEarly:f=a.spec.abortEarly,disableStackTrace:g=a.spec.disableStackTrace}=s;const b={value:t,parent:p,context:m};function v(e={}){const s=JN(Object.assign({value:t,originalValue:r,label:a.spec.label,path:e.path||n,spec:a.spec,disableStackTrace:e.disableStackTrace||g},d,e.params),b),i=new PN(PN.formatError(e.message||u,s),t,s.path,e.type||l,s.disableStackTrace);return i.params=s,i}const y=f?i:o;let w={path:n,parent:p,type:l,from:s.from,createError:v,resolve:e=>GN(e,b),options:s,originalValue:r,schema:a};const k=e=>{PN.isError(e)?y(e):e?o(null):y(v())},N=e=>{PN.isError(e)?y(e):i(e)};if(h&&WN(t))return k(!0);let x;try{var S;if(x=c.call(w,t,w),"function"==typeof(null==(S=x)?void 0:S.then)){if(s.sync)throw new Error(`Validation test of type: "${w.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(x).then(k,N)}}catch(e){return void N(e)}k(x)}return t.OPTIONS=e,t}function JN(e,t){if(!e)return e;for(const n of Object.keys(e))e[n]=GN(e[n],t);return e}function GN(e,t){return HN.isRef(e)?e.getValue(t.value,t.parent,t.context):e}function qN(e,t,n,s=n){let r,a,i;return t?(mN.forEach(t,(o,l,c)=>{let d=l?o.slice(1,o.length-1):o,u="tuple"===(e=e.resolve({context:s,parent:r,value:n})).type,h=c?parseInt(d,10):0;if(e.innerType||u){if(u&&!c)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);if(n&&h>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${o}, in the path: ${t}. because there is no value at that index. `);r=n,n=n&&n[h],e=u?e.spec.types[h]:e.innerType}if(!c){if(!e.fields||!e.fields[d])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e.type}")`);r=n,n=n&&n[d],e=e.fields[d]}a=d,i=l?"["+o+"]":"."+o}),{schema:e,parent:r,parentPath:a}):{parent:r,parentPath:t,schema:e}}class YN extends Set{describe(){const e=[];for(const t of this.values())e.push(HN.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const n of this.values())t.push(e(n));return t}clone(){return new YN(this.values())}merge(e,t){const n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}}function XN(e,t=new Map){if(DN(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=new Array(e.length),t.set(e,n);for(let s=0;s<e.length;s++)n[s]=XN(e[s],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(const[s,r]of e.entries())n.set(s,XN(r,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(const s of e)n.add(XN(s,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);n={},t.set(e,n);for(const[s,r]of Object.entries(e))n[s]=XN(r,t)}return n}function QN(e){if(null==e||!e.length)return;const t=[];let n="",s=!1,r=!1;for(let a=0;a<e.length;a++){const i=e[a];"["!==i||r?"]"!==i||r?'"'!==i?"."!==i||s||r?n+=i:n&&(t.push(n),n=""):r=!r:(n&&(/^\d+$/.test(n)?t.push(n):t.push(n.replace(/^"|"$/g,"")),n=""),s=!1):(n&&(t.push(...n.split(".").filter(Boolean)),n=""),s=!0)}return n&&t.push(...n.split(".").filter(Boolean)),t}function ex(e,t){var n;if((null==(n=e.inner)||!n.length)&&e.errors.length)return function(e,t){const n=t?`${t}.${e.path}`:e.path;return e.errors.map(e=>({message:e,path:QN(n)}))}(e,t);const s=t?`${t}.${e.path}`:e.path;return e.inner.flatMap(e=>ex(e,s))}class tx{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new YN,this._blacklist=new YN,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(zN.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=XN(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();const s=Object.assign({},t.spec,n.spec);return n.spec=s,n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,n,s,r;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(n=e.abortEarly)?n:this.spec.abortEarly,recursive:null!=(s=e.recursive)?s:this.spec.recursive,disableStackTrace:null!=(r=e.disableStackTrace)?r:this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({},t,{value:e})),s="ignore-optionality"===t.assert,r=n._cast(e,t);if(!1!==t.assert&&!n.isType(r)){if(s&&WN(r))return r;let a=EN(e),i=EN(r);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${a} \n`+(i!==a?`result of cast: ${i}`:""))}return r}_cast(e,t){let n=void 0===e?e:this.transforms.reduce((n,s)=>s.call(this,n,e,this,t),e);return void 0===n&&(n=this.getDefault(t)),n}_validate(e,t={},n,s){let{path:r,originalValue:a=e,strict:i=this.spec.strict}=t,o=e;i||(o=this._cast(o,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:r,value:o,originalValue:a,options:t,tests:l},n,e=>{if(e.length)return s(e,o);this.runTests({path:r,value:o,originalValue:a,options:t,tests:this.tests},n,s)})}runTests(e,t,n){let s=!1,{tests:r,value:a,originalValue:i,path:o,options:l}=e,c=e=>{s||(s=!0,t(e,a))},d=e=>{s||(s=!0,n(e,a))},u=r.length,h=[];if(!u)return d([]);let p={value:a,originalValue:i,path:o,options:l,schema:this};for(let e=0;e<r.length;e++){(0,r[e])(p,c,function(e){e&&(Array.isArray(e)?h.push(...e):h.push(e)),--u<=0&&d(h)})}}asNestedTest({key:e,index:t,parent:n,parentPath:s,originalParent:r,options:a}){const i=null!=e?e:t;if(null==i)throw TypeError("Must include `key` or `index` for nested validations");const o="number"==typeof i;let l=n[i];const c=Object.assign({},a,{strict:!0,parent:n,value:l,originalValue:r[i],key:void 0,[o?"index":"key"]:i,path:o||i.includes(".")?`${s||""}[${o?i:`"${i}"`}]`:(s?`${s}.`:"")+e});return(e,t,n)=>this.resolve(c)._validate(l,c,t,n)}validate(e,t){var n;let s=this.resolve(Object.assign({},t,{value:e})),r=null!=(n=null==t?void 0:t.disableStackTrace)?n:s.spec.disableStackTrace;return new Promise((n,a)=>s._validate(e,t,(e,t)=>{PN.isError(e)&&(e.value=t),a(e)},(e,t)=>{e.length?a(new PN(e,t,void 0,void 0,r)):n(t)}))}validateSync(e,t){var n;let s,r=this.resolve(Object.assign({},t,{value:e})),a=null!=(n=null==t?void 0:t.disableStackTrace)?n:r.spec.disableStackTrace;return r._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw PN.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new PN(t,e,void 0,void 0,a);s=n}),s}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(PN.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(PN.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):XN(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const n=this.clone({nullable:e});return n.internalTests.nullable=KN({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),n}optionality(e,t){const n=this.clone({optional:e});return n.internalTests.optionality=KN({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),n}optional(){return this.optionality(!0)}defined(e=zN.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=zN.notNull){return this.nullability(!1,e)}required(e=zN.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=zN.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let n=this.clone(),s=KN(t),r=t.exclusive||t.name&&!0===n.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>{if(e.OPTIONS.name===t.name){if(r)return!1;if(e.OPTIONS.test===s.OPTIONS.test)return!1}return!0}),n.tests.push(s),n}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let n=this.clone(),s=CN(e).map(e=>new HN(e));return s.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push("function"==typeof t?new VN(s,t):VN.fromOptions(s,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=KN({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=zN.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=KN({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return!!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}notOneOf(e,t=zN.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=KN({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return!n.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:n}})}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:n,meta:s,optional:r,nullable:a}=t.spec,i={meta:s,label:n,optional:r,nullable:a,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((e,t,n)=>n.findIndex(t=>t.OPTIONS.name===e.OPTIONS.name)===t).map(t=>{const n=t.OPTIONS.params&&e?JN(Object.assign({},t.OPTIONS.params),e):t.OPTIONS.params;return{name:t.OPTIONS.name,params:n}})};return i}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(t){try{return{value:await e.validate(t,{abortEarly:!1})}}catch(e){if(e instanceof PN)return{issues:ex(e)};throw e}}}}}tx.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])tx.prototype[`${e}At`]=function(t,n,s={}){const{parent:r,parentPath:a,schema:i}=qN(this,t,n,s.context);return i[e](r&&r[a],Object.assign({},s,{parent:r,path:t}))};for(const e of["equals","is"])tx.prototype[e]=tx.prototype.oneOf;for(const e of["not","nope"])tx.prototype[e]=tx.prototype.notOneOf;function nx(){return new sx}class sx extends tx{constructor(){super({type:"boolean",check:e=>(e instanceof Boolean&&(e=e.valueOf()),"boolean"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=MN.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test:e=>WN(e)||!0===e})}isFalse(e=MN.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test:e=>WN(e)||!1===e})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}nx.prototype=sx.prototype;const rx=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function ax(e){var t,n;const s=rx.exec(e);return s?{year:ix(s[1]),month:ix(s[2],1)-1,day:ix(s[3],1),hour:ix(s[4]),minute:ix(s[5]),second:ix(s[6]),millisecond:s[7]?ix(s[7].substring(0,3)):0,precision:null!=(t=null==(n=s[7])?void 0:n.length)?t:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:ix(s[10]),minuteOffset:ix(s[11])}:null}function ix(e,t=0){return Number(e)||t}let ox=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[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])?)*$/,lx=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,cx=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,dx=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),ux=e=>WN(e)||e===e.trim(),hx={}.toString();function px(){return new mx}class mx extends tx{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e))return e;if(Array.isArray(e))return e;const n=null!=e&&e.toString?e.toString():e;return n===hx?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||zN.required,name:"required",skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>"required"!==e.OPTIONS.name),e))}length(e,t=LN.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=LN.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=LN.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n,s,r=!1;return t&&("object"==typeof t?({excludeEmptyString:r=!1,message:n,name:s}=t):n=t),this.test({name:s||"matches",message:n||LN.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&r||-1!==t.search(e)})}email(e=LN.email){return this.matches(ox,{name:"email",message:e,excludeEmptyString:!0})}url(e=LN.url){return this.matches(lx,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=LN.uuid){return this.matches(cx,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,n,s="";return e&&("object"==typeof e?({message:s="",allowOffset:t=!1,precision:n}=e):s=e),this.matches(dx,{name:"datetime",message:s||LN.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:s||LN.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const n=ax(e);return!!n&&!!n.z}}).test({name:"datetime_precision",message:s||LN.datetime_precision,params:{precision:n},skipAbsent:!0,test:e=>{if(!e||null==n)return!0;const t=ax(e);return!!t&&t.precision===n}})}ensure(){return this.default("").transform(e=>null===e?"":e)}trim(e=LN.trim){return this.transform(e=>null!=e?e.trim():e).test({message:e,name:"trim",test:ux})}lowercase(e=LN.lowercase){return this.transform(e=>WN(e)?e:e.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>WN(e)||e===e.toLowerCase()})}uppercase(e=LN.uppercase){return this.transform(e=>WN(e)?e:e.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>WN(e)||e===e.toUpperCase()})}}px.prototype=mx.prototype;let fx=new Date("");class gx extends tx{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||null===e?e:(e=function(e){const t=ax(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(n=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}(e),isNaN(e)?gx.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let n;if(HN.isRef(e))n=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=s}return n}min(e,t=RN.min){let n=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=RN.max){let n=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}}function bx(e,t){let n=1/0;return e.some((e,s)=>{var r;if(null!=(r=t.path)&&r.includes(e))return n=s,!0}),n}function vx(e){return(t,n)=>bx(e,t)-bx(e,n)}gx.INVALID_DATE=fx;const yx=(e,t,n)=>{if("string"!=typeof e)return e;let s=e;try{s=JSON.parse(e)}catch(e){}return n.isType(s)?s:e};function wx(e){if("fields"in e){const t={};for(const[n,s]of Object.entries(e.fields))t[n]=wx(s);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=wx(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(wx)}):"optional"in e?e.optional():e}let kx=e=>"[object Object]"===Object.prototype.toString.call(e);function Nx(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>-1===n.indexOf(e))}const xx=vx([]);function Sx(e){return new jx(e)}class jx extends tx{constructor(e){super({type:"object",check:e=>kx(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=xx,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var n;let s=super._cast(e,t);if(void 0===s)return this.getDefault(t);if(!this._typeCheck(s))return s;let r=this.fields,a=null!=(n=t.stripUnknown)?n:this.spec.noUnknown,i=[].concat(this._nodes,Object.keys(s).filter(e=>!this._nodes.includes(e))),o={},l=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),c=!1;for(const e of i){let n=r[e],i=e in s,d=s[e];if(n){let r;l.path=(t.path?`${t.path}.`:"")+e,n=n.resolve({value:d,context:t.context,parent:o});let a=n instanceof tx?n.spec:void 0,i=null==a?void 0:a.strict;if(null!=a&&a.strip){c=c||e in s;continue}r=t.__validating&&i?d:n.cast(d,l),void 0!==r&&(o[e]=r)}else i&&!a&&(o[e]=d);i===e in o&&o[e]===d||(c=!0)}return c?o:s}_validate(e,t={},n,s){let{from:r=[],originalValue:a=e,recursive:i=this.spec.recursive}=t;t.from=[{schema:this,value:a},...r],t.__validating=!0,t.originalValue=a,super._validate(e,t,n,(e,r)=>{if(!i||!kx(r))return void s(e,r);a=a||r;let o=[];for(let e of this._nodes){let n=this.fields[e];n&&!HN.isRef(n)&&o.push(n.asNestedTest({options:t,key:e,parent:r,parentPath:t.path,originalParent:a}))}this.runTests({tests:o,value:r,originalValue:a,options:t},n,t=>{s(t.sort(this._sortErrors).concat(e),r)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){const s=n[e];n[e]=void 0===s?t:s}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(n=>{var s;const r=this.fields[n];let a=e;null!=(s=a)&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[n]})),t[n]=r&&"getDefault"in r?r.getDefault(a):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=function(e,t=[]){let n=[],s=new Set,r=new Set(t.map(([e,t])=>`${e}-${t}`));function a(e,t){let a=mN.split(e)[0];s.add(a),r.has(`${t}-${a}`)||n.push([t,a])}for(const t of Object.keys(e)){let n=e[t];s.add(t),HN.isRef(n)&&n.isSibling?a(n.path,t):DN(n)&&"deps"in n&&n.deps.forEach(e=>a(e,t))}return yN.array(Array.from(s),n).reverse()}(e,t),n._sortErrors=vx(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let s=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),s)})}partial(){const e={};for(const[t,n]of Object.entries(this.fields))e[t]="optional"in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return wx(this)}pick(e){const t={};for(const n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){const t=[];for(const n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let s=mN.getter(e,!0);return this.transform(r=>{if(!r)return r;let a=r;return((e,t)=>{const n=[...mN.normalizePath(t)];if(1===n.length)return n[0]in e;let s=n.pop(),r=mN.getter(mN.join(n),!0)(e);return!(!r||!(s in r))})(r,e)&&(a=Object.assign({},r),n||delete a[e],a[t]=s(r)),a})}json(){return this.transform(yx)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||$N.exact,test(e){if(null==e)return!0;const t=Nx(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=$N.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const n=Nx(this.schema,t);return!e||0===n.length||this.createError({params:{unknown:n.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=$N.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const n={};for(const s of Object.keys(t))n[e(s)]=t[s];return n})}camelCase(){return this.transformKeys(gN.camelCase)}snakeCase(){return this.transformKeys(gN.snakeCase)}constantCase(){return this.transformKeys(e=>gN.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(const[r,a]of Object.entries(t.fields)){var s;let t=e;null!=(s=t)&&s.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[r]})),n.fields[r]=a.describe(t)}return n}}Sx.prototype=jx.prototype;const Ex=Sx().shape({nickname:px().required("cannot be empty"),password:px().required("cannot be empty"),organizationKey:px().required("cannot be empty")}),Cx=s=>{const{isOpen:r,onClose:a,onSignUpButton:i,onSubmit:c,loginWithGoogle:d,reactAppGoogleClientId:u,multiOrganizations:h,openForgotPasswordModal:p,setOpenForgotPasswordModal:m}=s,{Image:f}=ma(e=>e.components),g=Ya(e=>e.organization.key),{handleSubmit:b,formState:{isValid:v,errors:y,touchedFields:w},register:k,reset:N,setValue:x,getValues:S}=sN({resolver:cN(Ex),mode:"all",reValidateMode:"onBlur"});o(()=>{N({organizationKey:g})},[r,N,g]);const j=l(void 0),{data:E}=ei(ps.API_V2.organization.getTrustedOrganizationsList().url),C=E?.success?E.content:[];return t(Ci,{isOpen:r&&!p,onClose:a,title:e(n,{children:[t("h3",{children:t(Fr,{className:"tt-se cr-at-it",children:"login"})}),t("p",{className:"tx-h",children:t(Fr,{className:"tt-se",children:"Nice see you again!"})})]}),graphic:t(f,{alt:"Juki with laptop image",fill:!0,src:"https://images.juki.pub/assets/juki-image-laptop.png",className:"image-border"}),expand:!0,children:e("div",{className:"jk-col stretch",children:[d&&u&&t(n,{children:t("div",{className:"jk-divider",children:t(Fr,{children:"or"})})}),t("form",{onSubmit:b(e=>c(e,j.current)),children:e("div",{className:"jk-col stretch",children:[!!C.length&&e("div",{className:"jk-row gap nowrap",children:[t(ra,{label:t(Fr,{className:"tt-se",children:"platform"}),labelPlacement:"left",options:C.map(({name:e,key:t})=>({label:e,value:t})),selectedOption:{value:S("organizationKey")},onChange:({value:e})=>{x("organizationKey",e,{shouldTouch:!0,shouldValidate:!0})},expand:!0}),t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-place":"top-end","data-tooltip-content":"choose the platform you want to use to sign in",className:"jk-row",children:t(Qt,{filledCircle:!0,className:"cr-at"})})]}),h&&e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"company key"}),register:k("organizationKey"),className:A({error:!!y?.organizationKey?.message,success:!!w.organizationKey&&!y?.organizationKey?.message}),expand:!0,required:!0}),t("p",{children:t(Fr,{children:!v&&y?.organizationKey?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"nickname"}),register:k("nickname"),className:A({error:!!y?.nickname?.message,success:!!w.nickname&&!y?.nickname?.message}),expand:!0,required:!0}),t("p",{children:t(Fr,{children:!v&&y?.nickname?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Kr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"password"}),register:k("password"),className:A({error:!!y?.password?.message,success:!!w.password&&!y?.password?.message}),expand:!0,required:!0}),t("p",{children:t(Fr,{children:y?.password?.message||""})})]}),e("div",{className:"jk-col gap stretch",children:[t("div",{className:"jk-row left",children:t("div",{className:"link","data-tour-key":"forgot-password",onClick:()=>m(!0),children:t(Fr,{className:"tt-se",children:"forgot password?"})})}),!h&&t("div",{children:e("p",{className:"label",children:[t(Fr,{className:"tt-se",children:"not a member?"}),", ",t("span",{className:"link",onClick:i,children:t(Fr,{children:"sign up now"})})]})}),e("div",{className:"jk-row-col gap block",children:[t(za,{type:"secondary",onClick:a,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{disabled:!v,setLoaderStatusRef:e=>j.current=e,submit:!0,children:t(Fr,{className:"tt-se",children:"login"})})]})]})]})})]})})},Ox=({isOpen:n,onClose:s,onForgotPassword:r})=>{const[a,l]=i(""),[c,d]=i(!1),{Image:u}=ma(e=>e.components);o(()=>{!c&&a&&d(!0)},[a,c]);const h=!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/.test(a);return t(Ci,{isOpen:n,onClose:s,title:t("h3",{children:t(Fr,{className:"cr-tx-ht-dk tt-se",children:"recover your account"})}),graphic:t(u,{className:"image-border",alt:"Juki with laptop image",fill:!0,src:"https://images.juki.pub/assets/juki-image-laptop.png"}),expand:!0,children:e("div",{className:"jk-col gap stretch extend",children:[t("div",{className:"jk-row left",children:t(Fr,{className:"tt-se",children:"enter your email, if the user exists, you will shortly receive an email with reset instructions"})}),e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"email"}),name:"email",value:a,onChange:e=>l(e),type:"email",expand:!0,className:A({error:c&&h,success:c&&!h}),onBlur:()=>d(!0),required:!0}),t("p",{children:t(Fr,{children:c&&h?"must be a valid email":""})})]}),e("div",{className:"jk-row-col gap block",children:[t(za,{type:"secondary",onClick:s,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{onClick:e=>r(a,e),disabled:h,submit:!0,children:t(Fr,{className:"ws-np tt-se",children:"send me"})})]})]})})},_x=({isOpen:e,onClose:n})=>{const{notifyResponse:s}=si();return t(Ox,{isOpen:e,onForgotPassword:async(e,t)=>{t?.(K.LOADING);const{url:n,...r}=ps.API_V2.auth.initiateResetPassword({body:{email:e}}),a=fe(await es(n,r));s(a,t)},onClose:n})},Ix=[{selector:'[data-tour-key="forgot-password"]',content:()=>t("div",{children:t(Fr,{className:"tt-se fw-bd",children:"forgot your password? Recover it here"})})}];function Tx({multiOrganizations:e,openForgotPasswordModal:n,setOpenForgotPasswordModal:s}){const{signIn:r}=Eg(),{osLabel:a,label:o}=Ya(e=>e.device),l=oi(e=>e.searchParams),c=oi(e=>e.appendSearchParams),d=oi(e=>e.deleteSearchParams),[u,h]=i(!1),p=()=>{u||(m(!0),h(!0))},{setIsOpen:m}=b(dw);return t(Cx,{isOpen:l.has(C.SIGN_IN),onClose:()=>d({name:C.SIGN_IN}),onSignUpButton:()=>{d({name:C.SIGN_IN}),c({name:C.SIGN_UP,value:"1"})},onSubmit:({organizationKey:e,...t},n)=>r({params:e?{organizationKey:e}:void 0,body:{...t,osName:a,deviceName:o},setLoader:n,onError:p}),openForgotPasswordModal:n,setOpenForgotPasswordModal:s,multiOrganizations:e})}function Ax(s){const[r,a]=i(!1);return e(n,{children:[t(_x,{isOpen:r,onClose:()=>a(!1)}),t(uw,{steps:Ix,onClickHighlighted:(e,{setIsOpen:t})=>{t(!1),a(!0)},maskClassName:"jk-tour-mask-opacity-0",disableInteraction:!0,showBadge:!1,showNavigation:!1,showCloseButton:!1,children:t(Tx,{...s,openForgotPasswordModal:r,setOpenForgotPasswordModal:a})})]})}const Px=Sx().shape({givenName:px().required("cannot be empty").min(3,"must be at least 3 characters"),familyName:px().required("cannot be empty").min(3,"must be at least 3 characters"),email:px().required("cannot be empty").email("must be a valid email"),checkbox:nx().required("you must accept the terms of service").oneOf([!0],"you must accept the terms of service"),nickname:px().required("cannot be empty").matches(gt,"only alphanumeric characters or dash or underscore is valid").min(3,"must be at least 3 characters").max(32,"must be less than 32 characters"),password:px().required("cannot be empty").min(8,"must be at least 8 characters").matches(ft,"must have at least one uppercase, one lowercase letter and one number"),passwordConfirmation:px().required("cannot be empty").oneOf([ZN("password"),""],"both passwords must match")}),zx=s=>{const{isOpen:r,onClose:a,onSubmit:i,signUpWithGoogle:c,reactAppGoogleClientId:d,onSignInButton:u}=s,{Image:h}=ma(e=>e.components),{register:p,handleSubmit:m,formState:{errors:f,isValid:g,touchedFields:b},control:v,reset:y}=sN({resolver:cN(Px),mode:"all",reValidateMode:"onBlur"});o(()=>{y()},[r,y]);const w=l(void 0);return t(Ci,{isOpen:r,onClose:a,title:e(n,{children:[t("h3",{children:t(Fr,{className:"tt-se cr-at-it",children:"sign up"})}),t("p",{className:"tx-h",children:t(Fr,{className:"tt-se",children:"happy you join us"})})]}),graphic:t(h,{className:"image-border",alt:"Juki with laptop image",fill:!0,src:"https://images.juki.pub/assets/juki-image-laptop.png"}),expand:!0,children:e("div",{className:"jk-col stretch",children:[c&&d&&t(n,{children:t("div",{className:"jk-divider",children:t(Fr,{children:"or"})})}),t("form",{onSubmit:m(e=>i(e,w.current)),children:e("div",{className:"jk-col stretch",children:[e("div",{className:"jk-row-col gap block",children:[e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"first name"}),register:{...p("givenName")},className:A({error:!!f?.givenName?.message,success:!!b.givenName&&!f?.givenName?.message}),required:!0}),t("p",{children:t(Fr,{children:f?.givenName?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"last name"}),register:p("familyName"),className:A({error:!!f?.familyName?.message,success:!!b.familyName&&!f?.familyName?.message}),required:!0}),t("p",{children:t(Fr,{children:f.familyName?.message||""})})]})]}),e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"nickname"}),register:p("nickname"),className:A({error:!!f?.nickname?.message,success:!!b.nickname&&!f?.nickname?.message}),required:!0}),t("p",{children:t(Fr,{children:!g&&f?.nickname?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Hr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"e-mail address"}),register:p("email"),className:A({error:!!f?.email?.message,success:!!b.email&&!f?.email?.message}),required:!0}),t("p",{children:t(Fr,{children:!g&&f?.email?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Kr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"password"}),register:p("password"),className:A({error:!!f?.password?.message,success:!!b.password&&!f?.password?.message}),required:!0}),t("p",{children:t(Fr,{children:!g&&f?.password?.message||""})})]}),e("div",{className:"jk-form-item",children:[t(Kr,{labelPlacement:"top",label:t(Fr,{className:"tt-se",children:"confirm password"}),register:p("passwordConfirmation"),className:A({error:!!f?.passwordConfirmation?.message,success:!!b.passwordConfirmation&&!f?.passwordConfirmation?.message}),required:!0}),t("p",{children:t(Fr,{children:!g&&f?.passwordConfirmation?.message||""})})]}),e("div",{className:"jk-form-item required",children:[t(dk,{control:v,name:"checkbox",defaultValue:!1,render:({field:{value:e,...n}})=>t(Wr,{...n,checked:e,label:t(Fr,{children:"I accept the Terms of Service and Privacy Policy"})})}),t("p",{children:t(Fr,{children:!g&&f?.checkbox?.message||""})})]}),t("div",{className:"jk-pg-b",children:e("p",{className:"label",children:[t(Fr,{className:"tt-se",children:"are you already a member?"}),", ",t("span",{className:"link",onClick:u,children:t(Fr,{children:"sign in now"})})]})}),e("div",{className:"jk-row-col gap block",children:[t(za,{type:"secondary",onClick:a,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{setLoaderStatusRef:e=>w.current=e,disabled:!g,submit:!0,children:t(Fr,{className:"ws-np tt-se",children:"sign up"})})]})]})})]})})};function Lx(){const{osLabel:e,label:n}=Ya(e=>e.device),s=oi(e=>e.searchParams),r=oi(e=>e.appendSearchParams),a=oi(e=>e.deleteSearchParams),{signUp:i}=Eg();return t(zx,{isOpen:s.has(C.SIGN_UP),onClose:()=>a({name:C.SIGN_UP}),onSignInButton:()=>{a({name:C.SIGN_UP}),r({name:C.SIGN_IN,value:"1"})},onSubmit:(t,s)=>i({body:{...t,osName:e,deviceName:n},setLoader:s,onSuccess:()=>{a({name:C.SIGN_UP}),r({name:C.WELCOME,value:"1"})}})})}function Rx({user:n,className:s}){const{Image:r,Link:a}=ma(e=>e.components),{data:i}=ei(ps.API_V2.judge.getSummaryList().url);return e("div",{className:A("jk-col stretch",s),children:[e("div",{className:"jk-col stretch",children:[e("div",{className:"jk-row left gap nowrap",children:[t("h3",{className:"fl-tt-il",children:n?.nickname}),t(Hs,{text:n?.nickname,iconSize:"small"})]}),e("div",{className:"cr-tx-sc",children:[n?.givenName," ",n?.familyName]}),t("div",{className:"cr-tx-mt",children:n?.aboutMe})]}),t("div",{className:"jk-divider tiny"}),e("div",{className:"jk-col gap stretch",children:[(n?.city?.trim()||n?.country?.trim())&&e("div",{className:"jk-row left gap",children:[t(vn,{}),n?.city,n?.city&&","," ",n?.country]}),n?.institution?.trim()&&e("div",{className:"jk-row left gap nowrap wb-ba",children:[t(yn,{}),n?.institution]}),e("div",{className:"jk-row left gap nowrap wb-ba",children:[t(wn,{}),n?.email]})]}),t("div",{className:"jk-divider tiny"}),Object.entries(n?.handles||{}).filter(([e,t])=>!!t&&!!Ge[e]).map(([n,s])=>{const o=i?.success?i.contents.find(({key:e})=>e===n)?.getProfileUrl:"",l=new Function("userNickname",o||"return ''")(s);let[c,d]=Ge[n]?.logoSize||[1,1],u=64/c*d,h=64;return u>32&&(u=32,h=32/d*c),t("div",{className:"jk-col left gap block stretch",children:e("div",{className:"jk-row gap",children:[t("div",{style:{width:64},className:"jk-row",children:t(r,{src:Ge[n]?.logo,alt:n,height:u,width:h})}),l?t(a,{href:l,target:"_blank",rel:"noopener noreferrer",className:"link",children:s}):s]})},n)})]})}const Mx=({user:n,onClose:s,userHref:r})=>{const{Image:a,Link:i}=ma(e=>e.components);return e("div",{className:"jk-pg jk-col stretch gap",children:[e("div",{className:"jk-row center gap",children:[t(a,{src:n?.imageUrl,className:"jk-user-profile-img elevation-1",alt:n?.nickname,height:100,width:100}),t(Rx,{user:n})]}),e("div",{className:"jk-row-col gap block stretch",children:[t(za,{type:"secondary",onClick:s,children:t(Fr,{className:"tt-se",children:"close"})}),t(i,{href:r,target:"_blank",rel:"noreferrer",children:t(Bs,{expand:!0,children:e("div",{className:"jk-row nowrap gap",children:[t(Fr,{className:"ws-np tt-se",children:"see profile"}),t(gn,{size:"small"})]})})})]})]})},$x=({isOpen:e,nickname:n,organizationKey:s,onClose:r,userHref:a})=>t(ga,{isOpen:e,onClose:r,className:"modal-user-preview",children:t(ii,{url:ps.API_V2.user.getSummary({params:{nickname:n,organizationKey:s}}).url,onError:r,children:({data:e})=>t(Mx,{user:e?.content,onClose:r,userHref:a})})});function Fx(){const e=oi(e=>e.searchParams),n=oi(e=>e.deleteSearchParams),s=e.getAll(C.USER_PREVIEW),r=Ya(e=>e.organization.key),[a,i]=Array.isArray(s)?s:[s,r];return t($x,{isOpen:!!e.get(C.USER_PREVIEW),nickname:a,organizationKey:i,onClose:()=>n({name:C.USER_PREVIEW}),userHref:gs.JUDGE().profiles.view({nickname:a,organizationKey:i})})}function Dx({onSeeMyProfile:n}){const{Image:s}=ma(e=>e.components),r=oi(e=>e.searchParams),a=oi(e=>e.deleteSearchParams),i=Ya(e=>e.user.nickname),o=Ya(e=>e.user.organization.key),l=()=>a({name:C.WELCOME});return t(ga,{isOpen:r.has(C.WELCOME),onClose:l,children:e("div",{className:"jk-pg-md jk-row nowrap",children:[e("div",{className:"jk-col gap stretch",children:[e("h2",{children:[t(Fr,{className:"tt-se",children:"hi"})," ",t("span",{className:"given-name",children:i}),"!"]}),t("h3",{children:t(Fr,{className:"tt-se",children:"welcome to the platform!"})}),t("div",{className:"jk-col gap stretch flex-1",children:e("div",{className:"jk-row-col gap block",children:[t(za,{size:"large",type:"secondary",onClick:async e=>{e(K.LOADING),await n(i,o),a({name:C.WELCOME}),e(K.SUCCESS)},expand:!0,children:t(Fr,{className:"ws-np tt-se",children:"see my profile"})}),t(za,{size:"large",onClick:l,expand:!0,children:t(Fr,{className:"tt-se",children:"continue"})})]})})]}),t("div",{style:{width:"40%"},className:"pn-re",children:t(s,{className:"image-border",alt:"Juki with laptop image",fill:!0,src:"https://images.juki.pub/assets/juki-image-laptop.png"})})]})})}const Vx=()=>import("./ChangePasswordModal-DGIG264-.js"),Ux=u(()=>Vx()),Bx=e=>t(h,{fallback:t(bt,{}),children:t(Ux,{...e})}),Zx=e=>({[qe.JK_MD]:{icon:t(jn,{size:e}),label:"jk md"},[qe.QUIZ_PROBLEM]:{icon:t(kn,{size:e}),label:"quiz problem"},[qe.QUIZ_TEXT]:{icon:t(kn,{size:e}),label:"quiz text"},[qe.QUIZ_OPTIONS]:{icon:t(Sn,{size:e,rotate:180}),label:"quiz options"},[qe.NEW_PAGE]:{icon:t(kn,{size:e}),label:"new page"},[qe.CODE_EDITOR]:{icon:t(xn,{size:e}),label:"code editor"},[qe.GRAPH]:{icon:t(Nn,{size:e}),label:"graph"},[qe.LIST]:{icon:t(kn,{size:e}),label:"list"}}),Hx=()=>import("./MdMathEditor-4-bjr11C.js"),Wx=u(()=>Hx()),Kx=a(function(e,n){return t(h,{fallback:t(bt,{}),children:t(Wx,{...e,ref:n})})}),Jx=()=>import("./UserCodeEditor-XI5CMxYI.js"),Gx=u(()=>Jx()),qx=a(function(e,n){return t(h,{fallback:t(bt,{}),children:t(Gx,{...e,ref:n})})}),Yx=()=>import("./WorksheetAsSlides-vK1Nqrlr.js"),Xx=u(()=>Yx()),Qx=e=>t(h,{fallback:t(bt,{}),children:t(Xx,{...e})}),eS=()=>import("./WorksheetContents-RcU2Wigz.js"),tS=u(()=>eS()),nS=e=>t(h,{fallback:t(bt,{}),children:t(tS,{...e})}),sS=()=>import("./WorksheetEditor-BExsBWi8.js"),rS=u(()=>sS()),aS=e=>t(h,{fallback:t(bt,{}),children:t(rS,{...e})}),iS=()=>import("./WorksheetViewer-Bn_SoOic.js"),oS=u(()=>iS()),lS=e=>t(h,{fallback:t(bt,{}),children:t(oS,{...e})}),cS=(n,s)=>{const{addWarningNotification:r}=si(),a=l(n),i=JSON.stringify(n);o(()=>{s||(a.current=n)},[s,n]),o(()=>{if(s&&i!==JSON.stringify(a.current)){const n=JSON.parse(i),s=JSON.stringify(ag(a.current,n),null,2),o=s.split("\n").length;r(e("div",{className:"jk-notification-message-body",children:[t(Fr,{className:"tt-se",children:"something changed, your changes may overwrite others' changes, we suggest you reload the page."})," ",t(Fr,{className:"tt-se",children:"differences_colon"}),t("div",{style:{height:24*o+8+"px",color:"initial"},children:t(oo,{source:s,language:Se.JSON,readOnly:!0})})]})),a.current=n}},[i,s,r])};function dS({isOpen:n,onClose:s,nickname:r,organizationKey:a}){const{updateUserProfileImage:o}=Eg(),l=Ya(e=>e.mutate),c=_i(),[d,u]=i();return t(ga,{onClose:s,isOpen:n,children:e("div",{className:"jk-pg-lg jk-col gap",children:[t(go,{aspect:1,onCropChange:u,rotate:0,scale:1,withRotate:!0,withScale:!0,circularCrop:!0}),e("div",{className:"jk-row right gap extend",children:[t(Bs,{type:"secondary",onClick:s,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{onClick:async e=>{if(d?.previewCanvasRef.current){const t=await F(d.previewCanvasRef.current);t&&await o({params:{nickname:r,organizationKey:a},setLoader:e,body:t,onSuccess:async()=>{e?.(K.LOADING),await l(),await c(ps.API_V2.user.getProfile({params:{nickname:r,organizationKey:a}}).url),e?.(K.SUCCESS),s()}})}},disabled:!d||!d?.previewCanvasRef.current,children:t(Fr,{className:"tt-se",children:"save image"})})]})]})})}function uS({judge:{value:n,label:s,logo:r,logoSize:a},user:i,setUser:o}){const{Image:l}=ma(e=>e.components),c=32/a[0]*a[1],d=24/a[1]*a[0];let u,h;return Math.max(c,32)>Math.max(d,24)?(u=d,h=24):(u=c,h=32),t("div",{className:"jk-form-item",children:t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(l,{src:r,alt:s,height:u,width:h}),t("span",{children:s})]}),labelPlacement:"top",onChange:e=>o({...i,handles:{...i.handles||{},[n]:e}}),value:i?.handles?.[n]})},n)}function hS({user:n,isOpen:s,onClose:r,onSuccess:a}){const[o,c]=i(n),{updateUserProfileData:d}=Eg(),{Image:u}=ma(e=>e.components),h=l(!1);cS(n,s&&!h.current);const[p,m]=i(!1),f=o.nickname.length>=3&&o.nickname.length<=32,g=gt.test(o.nickname);return t(ga,{isOpen:s,onClose:r,children:e("div",{className:"user-profile jk-row stretch center gap jk-pg-md pn-re",children:[t(dS,{isOpen:p,onClose:()=>m(!1),nickname:n.nickname,organizationKey:n.organization.key}),e("div",{className:"jk-col top jk-pg-md",children:[t(u,{width:48,height:48,src:n?.imageUrl,className:"jk-user-profile-img huge elevation-1",alt:n?.nickname}),t(Kt,{onClick:()=>m(!0)})]}),e("div",{className:"jk-col top stretch left jk-pg-md gap",children:[e("div",{className:"jk-form-item",children:[t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(En,{size:"small"}),t(Fr,{className:"tt-se",children:"nickname"})]}),labelPlacement:"top",onChange:e=>c({...o,nickname:e}),value:o.nickname}),t("p",{children:f?!g&&t(Fr,{className:"tt-se",children:"only alphanumeric characters or dash or underscore is valid"}):t(Fr,{className:"tt-se",children:"must be at least 3 characters and must be less than 32 characters"})})]}),e("div",{className:"jk-row-col gap",children:[t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(En,{size:"small"}),t(Fr,{className:"tt-se",children:"given name"})]}),labelPlacement:"top",onChange:e=>c({...o,givenName:e}),value:o.givenName,className:"flex-1"}),t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(En,{size:"small"}),t(Fr,{className:"tt-se",children:"family name"})]}),labelPlacement:"top",onChange:e=>c({...o,familyName:e}),value:o.familyName,className:"flex-1"})]}),t("div",{className:"jk-form-item",children:e("label",{children:[e("div",{className:"jk-row left gap",children:[t(En,{size:"small"}),t(Fr,{className:"tt-se",children:"about me"})]}),t(aa,{onChange:e=>c({...o,aboutMe:e}),value:o.aboutMe})]})}),e("div",{className:"jk-row-col gap",children:[t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(Cn,{size:"small"}),t(Fr,{className:"tt-se",children:"country"})]}),labelPlacement:"top",onChange:e=>c({...o,country:e}),value:o.country}),t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(vn,{size:"small"}),t(Fr,{className:"tt-se",children:"city"})]}),labelPlacement:"top",onChange:e=>c({...o,city:e}),value:o.city})]}),t(Hr,{label:e("div",{className:"jk-row left gap",children:[t(yn,{size:"small"}),t(Fr,{className:"tt-se",children:"institution"})]}),labelPlacement:"top",onChange:e=>c({...o,institution:e}),value:o.institution}),t("div",{className:"fw-bd",children:t(Fr,{className:"tt-se",children:"nicknames from other judges"})}),[[Ce.CODEFORCES,Ce.CODEFORCES_GYM],[Ce.UVA_ONLINE_JUDGE,Ce.CODECHEF],[Ce.AT_CODER,Ce.TOPCODER],[Ce.JV_UMSA,Ce.JUKI_JUDGE],[Ce.LEETCODE]].map(([n,s])=>e("div",{className:"jk-row gap block",children:[n&&Ge[n]?t(uS,{judge:Ge[n],user:o,setUser:c}):t("div",{className:"jk-form-item"}),s&&Ge[s]?t(uS,{judge:Ge[s],user:o,setUser:c}):t("div",{className:"jk-form-item"})]},`${n}-${s}`))]}),e("div",{className:"jk-row-col gap right wh-100",children:[t(Bs,{type:"secondary",onClick:r,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{disabled:!f||!g,onClick:e=>{const t={nickname:o.nickname,givenName:o.givenName,familyName:o.familyName,aboutMe:o.aboutMe,country:o.country,city:o.city,institution:o.institution,handles:o.handles};return d({params:{nickname:n.nickname,organizationKey:n.organization.key},body:t,setLoader:e,onSuccess:async n=>{h.current=!0,e?.(K.LOADING),await(a?.({body:t,response:n})),e?.(K.SUCCESS),h.current=!1,r()}})},children:t(Fr,{className:"tt-se",children:"update"})})]})]})})}function pS({url:n,...s}){return t(ga,{...s,closeIcon:!0,children:e("div",{className:"jk-pg",children:[t("h3",{children:t(Fr,{children:"logs"})}),t(ii,{url:n,children:({data:n})=>t("div",{children:n.content.map(({timestamp:n,changes:s,customerUser:r},a)=>e("div",{className:"jk-col stretch jk-pg-sm-tb",children:[e("div",{className:"jk-row gap center",children:[t(Dr,{date:new Date(n)}),t(Ig,{imageUrl:r.imageUrl,nickname:r.nickname,organizationKey:r.organization.key})]}),t("div",{className:"jk-col gap stretch",children:s.map(({type:n,valueType:s,oldValue:r,value:a,path:i},o)=>e("div",{className:"jk-row gap nowrap left",children:[t("div",{className:A("jk-tag tx-t",{warning:"UPDATE"===n,error:"REMOVE"===n,success:"ADD"===n}),style:{fontFamily:"monospace"},children:"ADD"===n?"+":"REMOVE"===n?"-":"*"}),t("div",{className:"tx-t jk-tag bc-sf-hi",children:s}),t("div",{className:"tx-t jk-tag bc-io",children:i}),e("div",{className:"jk-row gap nowrap",children:[t("div",{className:"tx-t",children:Ye(r)?JSON.stringify(r):""}),"=>",t("div",{className:"tx-t",children:Ye(a)?JSON.stringify(a):""})]})]},o))})]},a))})})]})})}function mS(){const{contactEmail:n,contactTelegram:s,contactCellPhoneNumber:r}=Ya(e=>e.organization);return e("div",{className:"jk-col gap left stretch extend",children:[t("h3",{className:"",children:t(Fr,{className:"tt-se ws-np",children:"need help?"})}),e("div",{className:"jk-row left ta-cr",children:[t(Fr,{className:"tt-se ws-np",children:"contact the webmaster"}),":"]}),t("div",{}),e("div",{className:"jk-row left gap nowrap",children:[t(On,{}),t("div",{className:"jk-row link fw-bd",children:t("a",{href:s,target:"_blank",rel:"noreferrer",children:s.replace("https://","")})})]}),t("div",{}),e("div",{className:"jk-row left gap nowrap",children:[t(_n,{}),t("div",{className:"jk-row fw-bd",children:r})]}),t("div",{}),e("div",{className:"jk-row left gap nowrap",children:[t(wn,{}),t("div",{className:"jk-row fw-bd",children:n})]})]})}const fS=()=>{const e=ma(e=>e.components.Image);return t(e,{fill:!0,src:"https://images.juki.pub/assets/juki-image-surprised.png",alt:"Juki surprised image"})};function gS(){const{Link:n}=ma(e=>e.components);return e(n,{href:"/",className:"link jk-row",children:[t(Ot,{size:"small"})," ",t(Fr,{className:"tt-se",children:"go to home"})]},"home")}class bS extends x{constructor(e){super(e),this.state={hasError:!1,errorPersist:!1}}static getDerivedStateFromError(e){return be("getDerivedStateFromError",{error:e}),{hasError:!0}}async componentDidCatch(e,t){await is(e,t)}render(){return this.state.hasError?this.props.background?null:t("div",{className:"jk-col extend stretch jk-pg-lg",children:e("div",{className:"bc-sf-md jk-br-ie jk-pg-md",children:[t("div",{className:"jk-col",children:t("div",{style:{width:"50vw",height:"20vh"},children:t(fS,{})})}),e("div",{className:"jk-col gap",children:[t("h2",{children:t(Fr,{className:"tt-se ta-cr",children:"Oops, there is an error!"})}),this.state.errorPersist?t(Bs,{onClick:this.props.reload,children:t(Fr,{className:"tt-se",children:"reload page again"})}):t(Bs,{onClick:()=>this.setState({hasError:!1,errorPersist:!0}),children:t(Fr,{className:"tt-se",children:"reload page"})}),t(gS,{})]}),t("div",{className:"jk-divider"}),e("div",{className:"jk-col gap",children:[e("div",{className:"fw-bd",children:[t(Fr,{className:"tt-se",children:"supported browsers"}),":"]}),t("div",{children:e("ul",{children:[t("li",{children:"Chrome 64+"}),t("li",{children:"Edge 79+"}),t("li",{children:"Firefox 67+"}),t("li",{children:"Opera 51+"}),t("li",{children:"Safari 12+"})]})}),t("div",{children:t(Fr,{className:"tt-se",children:"if your browser is not supported, update it or contact us"})})]}),t("div",{className:"jk-divider"}),t("div",{className:"jk-col",children:t(mS,{})})]})}):this.props.children}}const vS=({isOpen:n,popoverPlacement:s})=>{const{loading:r,setSettings:a,[ke.LANGUAGE]:i}=Cg(),{Image:o}=ma(e=>e.components),l=i===U.ES;return e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":l?"switch to english":"cambiar a español","data-tooltip-place":s,className:A("jk-row gap center extend",{"cr-pr":!r}),onClick:r?void 0:()=>a([{key:ke.LANGUAGE,value:i===U.EN?U.ES:U.EN}]),children:[r?t(An,{}):t("div",l?{className:"jk-row pn-re",style:{width:24,height:24},children:t(o,{alt:"ES image",width:24,height:24,src:"https://images.juki.pub/assets/image-es.png"})}:{className:"jk-row pn-re",style:{width:24,height:24},children:t(o,{alt:"US image",width:24,height:24,src:"https://images.juki.pub/assets/image-us.png"})}),n&&t("div",{className:"flex-1 ta-lt",children:t(Fr,{className:"tt-se",children:l?"español":"english"})})]})},yS=({isOpen:n,popoverPlacement:s})=>{const{loading:r,setSettings:a,[ke.THEME]:i}=Cg(),o=i===Ie.DARK,l=r?void 0:e=>{e?.stopPropagation(),e?.preventDefault(),a([{key:ke.THEME,value:i===Ie.LIGHT?Ie.DARK:Ie.LIGHT}])};return e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":o?"switch to light mode":"switch to dark mode","data-tooltip-place":s,className:A("jk-row gap center extend",{"cr-pr":!r}),onClick:l,children:[r?t(bt,{}):e("div",{className:A("jk-theme-toggle-input container--toggle",{"cr-pr":!r}),title:"color mode toggle",children:[t("input",{role:"switch","aria-checked":o,onKeyDown:e=>{"Enter"===e.code&&l?.()},type:"checkbox",id:"toggle",className:"toggle--checkbox",checked:!o,readOnly:!0}),t("label",{htmlFor:"toggle",className:A("toggle--label",{"cr-pr":!r}),children:t("span",{className:"toggle--label-background"})})]}),n&&t("div",{className:"flex-1 ta-lt",children:t(Fr,{className:"tt-se",children:o?"dark mode":"light mode"})})]})},wS=w(s=>{const{isMobile:r,isOpen:a,helpOpen:i,setHelpOpen:o,popoverPlacement:l,moreApps:c}=s,d=Ya(e=>e.user.settings[ke.THEME]),{Image:u}=ma(e=>e.components),h=Ds(e=>e.viewPort.screen),p=d===Ie.DARK,m="right"===l&&a||!("md"===h&&"bottom"===l),f=e("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":a?"":"help","data-tooltip-place":l,className:"jk-row gap center extend",onClick:()=>o(!0),children:[t(In,{}),a&&t("div",{className:"flex-1 ta-lt",children:t(Fr,{className:"tt-se",children:"help"})})]});return e(n,{children:[t(vS,{isOpen:a,small:m,popoverPlacement:l}),t(yS,{isOpen:a,small:m,popoverPlacement:l}),t(ga,{isOpen:i&&!r,onClose:()=>o(!1),className:"wh-ao",children:t("div",{className:"jk-col nowrap extend stretch jk-pg-md",children:e("div",{className:"jk-row",children:[t(mS,{}),t("div",{className:"jk-row ",children:t(u,{src:"https://images.juki.pub/c/juki-help-2-image.svg",alt:"help",height:220,width:220})})]})})}),f,c&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:e("div",{className:"jk-col gap more-apps-popover jk-pg-sm",children:[t("div",{className:"fw-bd tt-se",children:t(Fr,{children:"more apps"})}),t("div",{className:A("jk-col gap stretch",{"cr-tx-ht":!p,"cr-b2":p}),children:c})]}),placement:l,offset:4,children:e("div",{className:"jk-row gap center extend cr-pr",children:[t(Tn,{}),a&&t("div",{className:"flex-1 ta-lt",children:t(Fr,{className:"tt-se",children:"more apps"})})]})})]})}),kS={"":160,sm:80,md:120,lg:160,hg:192};function NS(n){const{menu:s,onSeeMyProfile:r,menuViewMode:a,profileSelected:o,moreApps:l,multiOrganizations:c,children:u,topImageUrl:h,onBack:m}=n,{Link:f,Image:g}=ma(e=>e.components),b=Ds(e=>e.viewPort.screen),v=oi(e=>e.setSearchParams),y=Ya(e=>e.isLoading),{imageUrl:w,name:k,styles:N}=Ya(e=>e.organization),x=Ya(e=>e.user.isLogged),S=Ya(e=>e.user.settings[ke.THEME]),j=Ya(e=>e.user.settings[ke.MENU_VIEW_MODE]),E=h||w,C=ua(r),O=d((...e)=>C.current?.(...e),[C]),_=!!c&&x&&!1,{data:I}=ei(null),T=oi(e=>""),P=p(()=>I?.success?I.contents:[],[I]),z=p(()=>P.find(e=>e.key===T),[T,P]),L="sm"===b,R="md"===b,[M,$]=i(!1),F=p(()=>y?t(yi,{}):u,[y,u]),D=p(()=>{const e=[];return e.push(...s),e},[_,s,P,z,v,L,S,g]),V=a||j,U=N?.[S||Ie.LIGHT]?.navbar?.logoTheme===Ie.LIGHT?E.replace("white","color"):E,B={children:t(Tg,{popoverPlacement:"bottom-end",isHorizontal:!0,onSeeMyProfile:O,profileSelected:o})},Z={children:t("div",{className:"jk-row",children:t(f,{href:"/",style:{display:"contents"},children:y||!U?t(bt,{}):t(g,{src:U,alt:k,height:40,width:80})})})};return V===Ne.HORIZONTAL?t(wg,{menu:D,leftSection:()=>t(f,{href:"/",children:t("div",{className:"jk-col extend",children:t("div",{className:"jk-row jk-pg-rl",children:y||!U?t(bt,{}):t(g,{src:U,alt:k,height:"md"===b?40:46,width:"md"===b?80:92})})})}),rightSection:()=>e("div",{className:"jk-row stretch gap-2 settings-apps-login-user-content nowrap jk-pg-rl",children:[t(wS,{isOpen:!1,isMobile:!1,helpOpen:M,setHelpOpen:$,popoverPlacement:"bottom",moreApps:l}),t(Tg,{withLabel:!(L||R),isHorizontal:!0,popoverPlacement:"bottom-end",onSeeMyProfile:O,profileSelected:o})]}),rightMobile:B,centerMobile:Z,onBack:m,children:F}):t(Gv,{menu:D,topSection:({isOpen:e})=>t(f,{href:"/",children:t("div",{className:"jk-row",style:{height:"100%"},children:y||!U?t(bt,{}):t(g,{src:e?U:U.replace("horizontal","vertical"),alt:k,height:e?kS[b]/2:80,width:e?kS[b]:40})})}),bottomSection:({isOpen:n})=>e("div",{className:A("jk-col stretch gap settings-apps-login-user-content nowrap jk-pg-tb",{"jk-pg-xsm-rl":n}),children:[t(wS,{isOpen:n,isMobile:!1,helpOpen:M,setHelpOpen:$,popoverPlacement:"right",moreApps:l}),t(Tg,{withLabel:n&&!(L||R),isVertical:!0,popoverPlacement:"right-end",onSeeMyProfile:O,profileSelected:o,className:!n||L||R?"":"left"})]}),rightMobile:B,centerMobile:Z,onBack:m,children:F})}function xS(n){const{reload:s,previousVersion:r,newVersion:a,...i}=n;return t(qi,{...i,secondary:{label:t(Fr,{className:"tt-se",children:"cancel"}),onClick:n.onClose},primary:{label:t(Fr,{className:"tt-se",children:"reload"}),onClick:s},title:t("div",{children:t(Fr,{className:"tt-se",children:"attention"})}),className:"jk-pg",children:e("div",{className:"jk-col gap left stretch",children:[t("div",{children:t(Fr,{className:"tt-se",children:"there is an interface update available, to use the new interface you need to reload the application."})}),e("div",{children:[t(Fr,{className:"tt-se",children:"your UI version is"})," ",t("span",{className:"jk-tag bc-sf-hi",children:r})," ",t(Fr,{children:"and the new UI version available is"})," ",t("span",{className:"jk-tag bc-sf-hi",children:a}),"."]}),t("div",{children:t(Fr,{className:"tt-se",children:"an interface update may mean improvements in the user experience and/or bug fixes."})}),t("div",{children:t(Fr,{className:"tt-se fw-bd",children:"if you reload the page, any changes that are not saved will be lost."})})]})})}function SS({apiVersionUrl:e}){const{data:n}=ei(e,{revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,revalidateOnMount:!0}),s=n?.success&&n.content.version||"",[r,a]=i([]);o(()=>{a(e=>[s,...e])},[s]);const[l,c]=i(!1);return o(()=>{r.length>=2&&r[0]&&r[1]&&r[0]!==r[1]&&c(!0)},[r]),t(xS,{isOpen:l,onClose:()=>c(!1),previousVersion:r[1]??"0.0.0",newVersion:s,reload:()=>window?.location?.reload?.()})}function jS(n){const{label:s,value:r,children:a,expand:i,valueAsList:o,centered:l,withoutPadding:c}=n,d=e("div",l?{className:"jk-col",children:[t(Fr,{className:"fw-bd tt-ce",children:s}),o?t("div",{className:"jk-row gap",style:{maxWidth:300},children:r}):r]}:{className:A("jk-row left",{gap:!!o}),style:{maxWidth:o?300:void 0},children:[e("div",{children:[t(Fr,{className:"fw-bd tt-ce",children:s}),": "]}),r]});return e("div",i?{className:A("jk-col stretch jk-br-ie",{"jk-pg-sm":!c}),children:[d,a&&t("div",{className:"jk-pg-sm-l",children:a})]}:{className:A("jk-col stretch jk-br-ie",{"jk-pg-sm":!c}),children:[d,a&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:a,placement:"bottom",children:e("div",{className:"jk-row",children:[" ",t(Lt,{filledCircle:!0,className:"cr-tx-ht",rotate:180})]})})]})}function ES({tags:s,author:r,centered:a,withoutPadding:i}){return e(n,{children:[!!s.length&&t(jS,{label:"tags",value:m.toArray(s.filter(e=>!!e.trim()).map(n=>e(f,{children:[t("span",{className:"jk-tag bc-sf-hi",children:t(Fr,{children:n})})," "]},n))),valueAsList:!0,centered:a,withoutPadding:i}),r&&t(jS,{label:"author",value:r,centered:a,withoutPadding:i})]})}function CS(e){const{settings:n,centered:s,withoutPadding:r}=e;return t(jS,{label:"type",value:t(Fr,{className:"tt-ce",children:Oe[n?.type]?.label}),centered:s,withoutPadding:r})}function OS({settings:s,expand:r,centered:a,withoutPadding:i}){const o=e(n,{children:[Object.keys(s?.pointsByGroups||{}).map(n=>"0"===n?null:e("div",{className:"jk-row left nowrap",children:[e("span","0"===n?{className:"label tt-ce fw-bd",children:[t(Fr,{className:"ws-np",children:"sample cases"}),":"," "]}:{className:"label tt-ce fw-bd",children:[t(Fr,{children:"subtask"})," ",n,":"," "]})," ",s?.pointsByGroups[+n].points," ",t(Fr,{children:"points"})]},n)),t("div",{className:"jk-divider tiny",style:{height:"2px"}}),e("div",{className:"jk-row left nowrap",children:[e("span",{className:"label tt-ce fw-bd",children:[t(Fr,{children:"total"}),": "]}),Object.values(s?.pointsByGroups||{}).reduce((e,{points:t})=>+e+ +t,0)," ",t(Fr,{children:"points"})]})]});return t(jS,{label:"mode",value:t(Fr,{className:"tt-ce",children:Xe[s?.scoringMode]?.label}),expand:r,centered:a,withoutPadding:i,children:s?.scoringMode===ze.SUBTASK?o:null})}const _S=s=>{const r=t(Fr,{children:1===(s/=1e3)?"second":"seconds"});return e(n,s===~~s?{children:[s," ",r]}:{children:[s.toFixed(1)," ",r]})};function IS({settings:n,expand:s,centered:r,withoutPadding:a}){const i=Object.values(n?.byProgrammingLanguage||{}).filter(({timeLimit:e})=>e!==n.timeLimit),o=i.map(t=>e("div",{className:"jk-row nowrap left",children:[e("span",{className:"fw-bd",children:[Je[t.language]?.label,":"]}),_S(t?.timeLimit)]},t.language));return t(jS,{label:i.length?"time limit general":"time limit",value:_S(n?.timeLimit),expand:s,centered:r,withoutPadding:a,children:i.length?o:null})}const TS=s=>{s/=1e3;const r=t(Fr,{children:"MB"});return e(n,s===~~s?{children:[s," ",r]}:{children:[s.toFixed(1)," ",r]})};function AS({settings:n,expand:s,centered:r,withoutPadding:a}){const i=Object.values(n?.byProgrammingLanguage||{}).filter(({memoryLimit:e})=>e!==n.memoryLimit),o=i.map(t=>e("div",{className:"jk-row nowrap left",children:[e("span",{className:"fw-bd",children:[Je[t.language]?.label,":"]}),TS(t?.memoryLimit)]},t.language));return t(jS,{label:i.length?"memory limit general":"memory limit",value:TS(n?.memoryLimit),expand:s,centered:r,withoutPadding:a,children:i.length?o:null})}function PS(n){const{settings:s,expand:r,asPopover:a,centered:i,withoutPadding:o,children:l}=n;return e("div",{className:A("jk-br-ie jk-col stretch",{"jk-pg-sm gap":!a,gap:!!o}),children:[t(IS,{settings:s,expand:r,centered:i,withoutPadding:o}),t(AS,{settings:s,expand:r,centered:i,withoutPadding:o}),t(CS,{settings:s,centered:i,withoutPadding:o}),t(OS,{settings:s,expand:r,centered:i,withoutPadding:o}),t(ES,{...n}),l]})}function zS({problem:e,size:n}){return e.judge.key===Ce.LEETCODE?null:t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:e.judge?.isExternal?t("div",{className:"jk-row extend top jk-pg-xsm",children:t("div",{className:`${e.judge?.key}-statement only-info`,dangerouslySetInnerHTML:{__html:e.statement.html[U.EN]||e.statement.html[U.ES]}})}):t("div",{className:"jk-pg-xsm",children:t(PS,{author:e.author,tags:e.tags,settings:e.settings,expand:!0,asPopover:!0,withoutPadding:!0})}),placement:"bottom",children:t("div",{className:"jk-row link",children:t(Qt,{filledCircle:!0,className:"cr-tx-ht",color:"var(--cr-tx-ht-it)",size:n})})})}const LS=({key:n,isExternal:s},r)=>{const{data:a}=ei(s?ps.API_V2.judge.getData({params:{key:n}}).url:null),i=JSON.stringify(r.map(({value:e})=>e)),o=p(()=>{const n=JSON.parse(i)||[];let r,o;return o=s?(a?.success&&a.content.languages||[]).filter(e=>e.enabled).map(e=>({value:e.value,label:e.label||e.value})):Qe.map(n=>{const s=Je[n]?.label||n,[r,...a]=s.split(" "),i=a.join(" ");return{value:n,label:e("div",{className:"jk-row left",children:[r," ",t("span",{className:"cr-tx-mt fw-lt",children:i})]})}}),r=[...o],r.length||(r=[{value:Se.TEXT,label:Je[Se.TEXT]?.label}]),n?.length>0&&(r=r.filter(({value:e})=>n.includes(e))),{languages:r,judgeLanguages:o}},[i,s,a]);return{virtualJudgeData:a,...o}},RS=e=>{const{problem:n,codeEditorLeftButtons:s,codeEditorCenterButtons:r,codeEditorRightButtons:a,codeEditorStoreKey:i,expandPosition:o,languages:l}=e,c={};n.statement.sampleCases?.forEach((e,t)=>{const s="sample-"+t;c[s]={key:s,log:"",sample:!0,status:Ae.NONE,err:"",out:"",index:t,in:e.input,withPE:n.settings.withPE,testOut:e.output,hidden:!1,createdAt:0}});const{languages:d}=LS({key:n.judge.key,isExternal:n.judge.isExternal},l||[]);return t(qx,{languages:d,storeKey:i,leftButtons:s,centerButtons:r,rightButtons:a,initialTestCases:n.judge.isExternal?void 0:c,enableAddCustomSampleCases:!n.judge.isExternal,expandPosition:o,withoutRunCodeButton:n.judge.isExternal,onlyCodeEditor:n.judge.isExternal})},MS=({index:n,sampleCases:s,withPE:r,forPrinting:a})=>{const i=s?.[n]||{input:"",output:""};return t("div",{className:"jk-row stretch gap",children:e("div",{className:"jk-row block stretch gap flex-1",children:[t("div",{className:"jk-row nowrap left stretch gap bc-ht-lt jk-br-ie",children:e("div",{className:"sample-text-content jk-br-ie",children:[e("div",{className:"jk-row gap sample-text-icons",children:[!a&&r&&t(mi,{text:i.input}),!a&&t(Hs,{text:i.input,iconSize:"tiny",className:"small"})]}),t("span",{children:i.input})]})}),t("div",{className:"jk-row nowrap left stretch gap bc-ht-lt jk-br-ie",children:e("div",{className:"sample-text-content jk-br-ie",children:[e("div",{className:"jk-row gap sample-text-icons",children:[!a&&r&&t(mi,{text:i.output}),!a&&t(Hs,{text:i.output,iconSize:"tiny",className:"small"})]}),t("span",{children:i.output})]})})]})})},$S=({problem:n,contest:s,infoPlacement:r,withoutName:a,forPrinting:i,withoutDownloadButtons:o})=>{const{judge:{key:l,isExternal:c,name:d},key:u,name:h,settings:p,tags:m,author:f,statement:g}=n,b=Ya(e=>e.user.settings?.[ke.LANGUAGE]),v=$r(e=>e.i18n.t),y=s?.index?`${s?.index}. (${u}) ${h}`:`(${u}) ${h}`,{statementDescription:w,statementInput:k,statementOutput:N,statementNote:x,mdStatement:S,shouldViewPDF:j}=ls(v,{statement:g,settings:p},b,y),{addWarningNotification:E}=si(),{Link:C}=ma(e=>e.components);if(c){let s=g.html[U.EN]||g.html[U.ES];const r=l===Ce.LEETCODE;return r&&(s=""),e("div",{className:"jk-col wh-100 extend top gap nowrap stretch left",style:{position:"relative"},children:[t("div",{className:`${l}-statement`,dangerouslySetInnerHTML:{__html:s}}),r&&t("div",{className:"jk-row",children:t(C,{href:n.externalUrl,target:"_blank",rel:"noopener noreferrer",children:t(Bs,{type:"secondary",children:t(Fr,{className:"tt-se",children:"click to view the full problem"})})})})]})}if(j)return t("div",{className:"wh-100 ht-100",children:t("iframe",{src:n.statement.pdfUrl[b]||n.statement.pdfUrl[U.ES]||n.statement.pdfUrl[U.EN],width:"100%",height:"100%",style:{border:"none"},title:"PDF Viewer"})});const O=async()=>{const{url:e,...n}=ps.API_V2.export.problem.statementToPdf({params:{key:u,language:b}}),s=fe(await es(e,n));if(!s.success)throw new Error("error on download pdf");if(!s.content.urlExportedPDF)return E(t("div",{className:"jk-col stretch",style:{width:"100%"},children:t("span",{className:"tt-se",children:t(Fr,{children:s.message})})}));await D("https://"+s.content.urlExportedPDF,`${d} - ${y}`)},_=()=>{$(new Blob([S],{type:"text/plain"}),`${d} - ${y}.md`)};return e("div",{className:"jk-row extend top gap nowrap stretch left",children:[e("div",{className:"jk-col top stretch flex-3",children:[!i&&"left"!==r&&!o&&t(ci,{className:"opacity-hover",actionButtons:[{icon:t(Jt,{size:"tiny"}),buttons:[{icon:t(Jt,{size:"tiny"}),label:t(Fr,{children:"pdf"}),onClick:O},{icon:t(Jt,{size:"tiny"}),label:t(Fr,{children:"jk md"}),onClick:_}]}]}),!a&&e("div",{className:A({"jk-row gap":!i,"jk-col block":!!i},"center"),children:[t("h3",{children:n.name}),"name"===r&&t(zS,{problem:n}),i&&e("div",{className:"jk-col",style:{width:"100%"},children:[e("div",{className:"jk-row gap extend center",children:[t(IS,{settings:p,expand:!0,withoutPadding:!0}),t(AS,{settings:p,expand:!0,withoutPadding:!0})]}),e("div",{className:"jk-row gap extend center",children:[t(CS,{settings:p,withoutPadding:!0}),t(OS,{settings:p,expand:!0,withoutPadding:!0})]})]})]}),e("div",{children:[t(Fr,{className:"tt-se cr-tx-ht fw-bd",children:"description"}),t(Pf,{source:w})]}),!!k&&e("div",{children:[t(Fr,{className:"tt-se cr-tx-ht fw-bd",children:"input"}),t(Pf,{source:k})]}),!!N&&e("div",{children:[t(Fr,{className:"tt-se cr-tx-ht fw-bd",children:"output"}),t(Pf,{source:N})]}),p.scoringMode===ze.SUBTASK&&e("div",{children:[t(Fr,{className:"tt-se tx-l cr-tx-ht fw-bd",children:"subtasks description"}),e("div",{className:"jk-col left stretch gap",children:[Object.values(p.pointsByGroups).map(n=>t("div",{className:"jk-row extend gap",children:e("div",{className:"flex-1 bc-sf-md jk-pg-sm jk-br-ie",children:[e("div",{className:"fw-bd cr-tx-ht-dk",children:[t(Fr,{className:"tt-se",children:"subtask"})," ",n.group," (",n.points," ",1===n.points?t(Fr,{className:"tt-se",children:"point"}):t(Fr,{className:"tt-se",children:"points"}),")"]}),t(Pf,{source:n.description?.[b]||n.description?.[U.ES]||n.description?.[U.EN]})]})},n.group)),t("div",{})]})]}),t("div",{className:"jk-row stretch gap",children:e("div",{className:"jk-row stretch gap nowrap flex-1 jk-pg-xsm-tb",children:[t("div",{className:"jk-row",children:t(Fr,{className:"tt-se cr-tx-ht fw-bd",children:"input sample"})}),t("div",{className:"jk-row",children:t(Fr,{className:"tt-se cr-tx-ht fw-bd",children:"output sample"})})]})}),t("div",{className:"jk-col stretch gap",children:(g.sampleCases||[{input:"",output:""}]).map((e,s)=>t(MS,{index:s,sampleCases:g.sampleCases,withPE:n.settings.withPE,forPrinting:!!i},s))}),!!x&&e("div",{children:[t("h3",{children:t(Fr,{className:"tt-se",children:"note"})}),t("div",{className:"bc-sf-md jk-pg-sm jk-br-ie",children:t(Pf,{source:x})})]})]}),!i&&"left"===r&&!o&&t("div",{className:"screen md lg hg flex-1",children:e(PS,{settings:p,tags:m,author:f,expand:!0,children:[t(za,{size:"small",icon:t(Jt,{}),onClick:async e=>{e(K.LOADING);try{await O(),e(K.SUCCESS)}catch(t){is(t,null,{message:"Error on handleDownloadPdf",problemKey:n.key}),e(K.ERROR)}},children:t(Fr,{children:"download as pdf"})}),t(za,{size:"small",icon:t(Jt,{}),onClick:async e=>{e(K.LOADING);try{_(),e(K.SUCCESS)}catch(t){is(t,null,{message:"Error on handleDownloadMd",problemKey:n.key}),e(K.ERROR)}},children:t(Fr,{children:"download as md"})})]})})]})};function FS(n){const{problem:s,codeEditorCenterButtons:r,codeEditorStoreKey:a,infoPlacement:o,withoutName:l,forPrinting:c,expandPosition:d,withoutDownloadButtons:u,children:h,languages:p,className:m}=n,f=Ds(e=>e.viewPort.isSmallScreen),[g,b]=i(!1),v=Ya(e=>e.user.settings?.[ke.LANGUAGE]),y=$r(e=>e.i18n.t);if(c)return t($S,{problem:s,withoutName:!g&&l,infoPlacement:o,forPrinting:!!c,withoutDownloadButtons:u});const{shouldViewPDF:w}=ls(y,{statement:s.statement,settings:s.settings},v,s.name),k=e("div",{className:A("jk-problem-view-statement",s.judge.isSubmitSupported?"":m,{"jk-pg-sm jk-br-ie bc-sf-md":!w,"ow-ve":w}),children:[h,t($S,{problem:s,withoutName:!g&&l,infoPlacement:o,withoutDownloadButtons:u})]});let N;return N=s.judge.isSubmitSupported?e(Oi,{minSize:400,className:A("jk-problem-view-layout",m,{"jk-full-screen-overlay elevation-1 jk-br-ie":g}),style:g?d:{},closableSecondPane:{expandLabel:t(Fr,{className:"label tx-t",children:"code editor"}),align:"center"},closableFirstPane:{expandLabel:t(Fr,{className:"label tx-t",children:"problem statement"}),align:"center"},onePanelAtATime:f,children:[k,t(RS,{problem:s,languages:p,codeEditorLeftButtons:()=>s.judge.isExternal?t(Qt,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"run the code in the code editor is not enabled for external judges to Juki Judge","data-tooltip-place":"bottom",size:"small",filledCircle:!0}):null,codeEditorCenterButtons:r,codeEditorRightButtons:({withLabels:e})=>t(Bs,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":e?"":g?"back":"expand","data-tooltip-place":"bottom-end",size:"tiny",type:"secondary",onClick:()=>b(e=>!e),icon:t(g?ln:on,{}),children:e&&t(Fr,{children:g?"back":"expand"})}),codeEditorStoreKey:a})]}):k,g?t(fa,{children:t("div",{className:"jk-overlay jk-overlay-backdrop",children:t("div",{style:{position:"absolute",...d},children:N})})}):N}function DS({nickname:n,organizationKey:s,...r}){const{resetUserPassword:a}=Eg();return t(ga,{...r,children:e("div",{className:"jk-pg-md jk-col gap left stretch",children:[t("h2",{children:t(Fr,{className:"tt-se",children:"reset password"})}),e("div",{className:"jk-row left",children:[t(Fr,{className:"tt-se",children:"the password for"})," ",t(Og,{nickname:n,organizationKey:s,children:t("div",{className:"link",children:n})})," ",t(Fr,{children:"will be reset"}),"."]}),e("div",{className:"jk-row left",children:[t(Fr,{className:"tt-se",children:"the new password will be sent to user's email"}),"."]}),e("div",{className:"jk-row right gap extend",children:[t(Bs,{type:"secondary",onClick:r.onClose,children:t(Fr,{className:"tt-se",children:"cancel"})}),t(za,{onClick:e=>a({params:{nickname:n,organizationKey:s},setLoader:e,onSuccess:r.onClose}),children:t(Fr,{className:"tt-se",children:"reset_2"})})]})]})})}function VS(n){const{deleteUserSession:s}=Eg(),r=Ya(e=>e.user.sessionId),{data:a,request:i,setLoaderStatusRef:o}=Pg(()=>ps.API_V2.user.getMySessions().url),l=_i(),c=p(()=>[{head:"session",index:"session",Field:({record:{updatedAt:n,deviceName:s,osName:a,id:i}})=>e(lg,{className:"jk-col center",children:[t("div",{className:"fw-bd",children:s}),t("div",{children:a}),t(Dr,{date:new Date(n)}),r===i&&t("div",{className:"jk-tag bc-io",children:t(Fr,{className:"tt-se",children:"this device"})})]}),cardPosition:"top",minWidth:250,sort:{compareFn:()=>(e,t)=>t.updatedAt-e.updatedAt}},{head:"operations",index:"operations",Field:({record:{id:e}})=>t(lg,{className:"jk-col center gap",children:r!==e&&t(za,{icon:t(Pn,{}),onClick:t=>s({params:{sessionId:e},setLoader:t,onSuccess:async()=>{t(K.LOADING),await l(ps.API_V2.user.getMySessions().url),t(K.SUCCESS)}}),size:"tiny",children:t(Fr,{children:"delete session"})})}),cardPosition:"bottom",minWidth:190}],[s,l,r]);return t(Rg,{headers:c,data:a?.success?a?.contents:[],rows:{height:100},cards:{width:300,height:160},requestRef:i,name:C.LOGGED_USERS_TABLE,setLoaderStatusRef:o,...pt})}function US({user:n}){const{Image:s}=ma(e=>e.components);return t("div",{className:"jk-col gap",children:e("div",{className:"user-profile jk-row stretch center gap pn-re",children:[t("div",{className:"jk-col top jk-pg-md",children:t(s,{src:n?.imageUrl,className:"jk-user-profile-img elevation-1 bc-sf-md",alt:n?.nickname,width:104,height:104,style:{width:104,height:104}})}),t(Rx,{user:n,className:"top left jk-pg-md bc-sf-md jk-br-ie"})]})})}function BS({user:n,onClickUpdatePassword:s}){const{loading:r,setSettings:a,[ke.LANGUAGE]:i,[ke.THEME]:o,[ke.DATA_VIEW_MODE]:l,[ke.MENU_VIEW_MODE]:c,[ke.NEWSLETTER_SUBSCRIPTION]:d,[ke.TIME_ZONE]:u,[ke.FONT_SIZE]:h}=Cg(),{Image:p}=ma(e=>e.components);return e("div",{className:"jk-row gap top stretch",children:[e("div",{className:"jk-col top extend",children:[t("h3",{children:t(Fr,{className:"tt-se",children:"preferences"})}),e("div",{className:"jk-col stretch gap bc-sf-md jk-br-ie jk-pg-md pn-re",children:[r&&t(zt,{}),e("div",{className:"jk-col gap left stretch",children:[[{key:ke.LANGUAGE,title:"language",value:i,valueFirst:U.EN,labelFirst:e("div",{className:"jk-row nowrap",children:[t("div",{className:"jk-row pn-re",style:{width:24,height:24},children:t(p,{alt:"US image",width:24,height:18,src:"https://images.juki.pub/assets/image-us.png"})})," ",t(Fr,{className:"ws-np tt-se",children:"english"})]}),valueSecond:U.ES,labelSecond:e("div",{className:"jk-row nowrap",children:[t("div",{className:"jk-row pn-re",style:{width:24,height:24},children:t(p,{alt:"ES image",width:24,height:18,src:"https://images.juki.pub/assets/image-es.png"})})," ",t(Fr,{className:"ws-np tt-se",children:"español"})]})},{key:ke.THEME,title:"theme",value:o,valueFirst:Ie.LIGHT,labelFirst:e("div",{className:"jk-row nowrap",children:[t(Ln,{}),t(Fr,{className:"ws-np tt-se",children:"light"})]}),valueSecond:Ie.DARK,labelSecond:e("div",{className:"jk-row nowrap",children:[t(zn,{}),t(Fr,{className:"ws-np tt-se",children:"dark"})]})},{key:ke.DATA_VIEW_MODE,title:"data view",value:l,valueFirst:et.ROWS,labelFirst:e("div",{className:"jk-row nowrap",children:[t(Wt,{}),t(Fr,{className:"ws-np tt-se",children:"rows"})]}),valueSecond:et.CARDS,labelSecond:e("div",{className:"jk-row nowrap",children:[t(Rn,{}),t(Fr,{className:"ws-np tt-se",children:"cards"})]})},{key:ke.MENU_VIEW_MODE,title:"menu view",value:c,valueFirst:Ne.VERTICAL,labelFirst:e("div",{className:"jk-row nowrap",children:[t(Mn,{rotate:180}),t(Fr,{className:"ws-np tt-se",children:"vertical"})]}),valueSecond:Ne.HORIZONTAL,labelSecond:e("div",{className:"jk-row nowrap",children:[t(Mn,{rotate:-90}),t(Fr,{className:"ws-np tt-se",children:"horizontal"})]})}].map(({title:n,key:s,value:i,valueFirst:o,labelFirst:l,valueSecond:c,labelSecond:d})=>e("div",{className:"jk-col stretch left gap",style:{width:"100%"},children:[e("div",{className:"jk-row left extend",children:[t(Fr,{className:"tt-se tx-l fw-bd ta-ed ws-np",children:n}),": "]}),e("div",{className:"jk-col stretch gap space-between",children:[t("div",{className:"jk-row gap left nowrap",children:t(Jr,{disabled:r,checked:i===o,onChange:()=>a([{key:s,value:o}]),label:l})}),t("div",{className:"jk-row gap left nowrap",children:t(Jr,{disabled:r,checked:i===c,onChange:()=>a([{key:s,value:c}]),label:d})})]})]},s)),e("div",{className:"jk-col stretch left gap",style:{width:"100%"},children:[e("div",{className:"jk-row left extend",children:[t(Fr,{className:"tt-se tx-l fw-bd ta-ed ws-np",children:"time zone"}),": "]}),t("div",{className:"jk-col stretch gap space-between",children:t(sa,{disabled:r,options:Intl.supportedValuesOf("timeZone").map(t=>({value:t,label:e("div",{className:"jk-row left",children:[t," (",Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date).find(e=>"timeZoneName"===e.type)?.value,")"]})})),selectedOption:{value:u},onChange:({value:e})=>a([{key:ke.TIME_ZONE,value:e}])})})]}),e("div",{className:"jk-col stretch left gap",style:{width:"100%"},children:[e("div",{className:"jk-row left extend",children:[t(Fr,{className:"tt-se tx-l fw-bd ta-ed ws-np",children:"font size"}),": "]}),t("div",{className:"jk-col stretch gap space-between",children:t(sa,{disabled:r,options:[14,16,18,20,24,28,32].map(n=>({value:n,label:e("div",{children:[n," ",t(Fr,{children:"pixels"})]})})),selectedOption:{value:h},onChange:({value:e})=>a([{key:ke.FONT_SIZE,value:e}])})})]}),t("div",{className:"jk-col left gap nowrap jk-pg-sm",style:{width:"100%"},children:t(Bs,{type:"secondary",onClick:()=>a([{key:ke.LANGUAGE,value:U.EN},{key:ke.THEME,value:Ie.LIGHT},{key:ke.DATA_VIEW_MODE,value:et.ROWS},{key:ke.MENU_VIEW_MODE,value:Ne.VERTICAL}]),children:t(Fr,{className:"tt-se",children:"restore default preferences"})})})]})]})]}),e("div",{className:"jk-col top extend",children:[t("h3",{children:t(Fr,{className:"tt-se",children:"actions"})}),e("div",{className:"jk-col stretch gap bc-sf-md jk-br-ie jk-pg-md",children:[n?.canUpdatePassword&&t(Bs,{icon:t(Mt,{}),onClick:s,expand:!0,children:t(Fr,{className:"ws-np",children:"update password"})}),e("div",{className:"jk-col left gap nowrap",style:{width:"100%"},children:[e("div",{className:"jk-row left extend",children:[t(Fr,{className:"tt-se tx-l fw-bd ta-ed ws-np",children:"newsletter subscription"}),": "]}),t("div",{className:"jk-row stretch gap space-between block extend",children:t("div",{className:"jk-row gap left nowrap",children:t(oa,{disabled:r,checked:d,onChange:e=>a([{key:ke.NEWSLETTER_SUBSCRIPTION,value:e}]),leftLabel:t("div",{className:A("jk-row nowrap",{"fw-bd":!d}),children:t(Fr,{className:"ws-np tt-se",children:"no subscribed"})}),rightLabel:t("div",{className:A("jk-row nowrap",{"fw-bd":d}),children:t(Fr,{className:"ws-np tt-se",children:"subscribed"})})})})})]})]})]})]})}function ZS(){return{head:"contestants",index:"totalContestants",Field:({record:{totalContestants:n},isCard:s})=>t(lg,{className:"jk-row",children:s?e("div",{className:"jk-row gap nowrap center",children:[t($n,{size:"small"}),e("div",{className:"jk-col stretch",children:[t("div",{className:"jk-row",children:n}),t(Fr,{className:"cr-tx-mt tx-s tt-se ws-np",children:"contestants"})]})]}):n}),sort:!0,cardPosition:"bottom"}}function HS(){return{head:"dates",index:"date",Field:({record:{settings:n,isEndless:s},isCard:r})=>e(lg,{className:"jk-row extend",children:[s?r?"":"-":r?e("div",{className:"jk-row block extend nowrap space-between",children:[e("div",{className:"jk-row gap nowrap",children:[t(Fn,{size:"small"}),e("div",{className:"jk-col",children:[t("div",{className:"jk-row nowrap",children:new Date(n.startsAt).toLocaleDateString()}),t(Fr,{className:"cr-tx-mt tx-s tt-se ws-np",children:"start date"})]})]}),e("div",{className:"jk-row gap nowrap",children:[t(Dn,{size:"small"}),e("div",{className:"jk-col",children:[t("div",{className:"jk-row ws-np",children:new Date(n.startsAt).toLocaleTimeString()}),t(Fr,{className:"cr-tx-mt tx-s tt-se",children:"hour"})]})]})]}):t(Dr,{date:new Date(n.startsAt),show:"year-month-day-hours-minutes",twoLines:!0}),"-",s?r?"":"-":r?e("div",{className:"jk-row block extend nowrap space-between",children:[e("div",{className:"jk-row gap nowrap",children:[t(Fn,{size:"small"}),e("div",{className:"jk-col",children:[t("div",{children:new Date(n.endsAt).toLocaleDateString()}),t(Fr,{className:"cr-tx-mt tx-s tt-se",children:"end date"})]})]}),e("div",{className:"jk-row gap nowrap",children:[t(Dn,{size:"small"}),e("div",{className:"jk-col",children:[t("div",{children:new Date(n.endsAt).toLocaleTimeString()}),t(Fr,{className:"cr-tx-mt tx-s tt-se",children:"hour"})]})]})]}):t(Dr,{date:new Date(n.endsAt),show:"year-month-day-hours-minutes",twoLines:!0})]}),sort:!0,filter:{type:"date-range",pickerType:"year-month-day-hours-minutes"},cardPosition:"center",minWidth:320}}function WS(n){const{record:{name:s,key:r,user:a,organization:{key:i}},isCard:o}=n,{Link:l}=ma(e=>e.components),c=Ya(e=>e.organization.key),d=os(i,c);return t(lg,{className:"jk-row left block",children:a.isGuest||a.isAdministrator||a.isParticipant||a.isManager||a.isSpectator?e("div",{className:A("gap nowrap",{"jk-col":o,"jk-row left":!o}),children:[e(l,{href:gs.JUDGE(d).contests.view({key:r}),className:A("link jk-row nowrap",{"ta-lt":!o}),target:d?"_blank":void 0,children:[t("div",{style:{textAlign:o?void 0:"left",display:"inline"},children:s})," ",!!d&&t(gn,{size:"small"})]}),a.isAdministrator?t(Ft,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are admin","data-tooltip-t-class-name":"tt-se ws-np",size:"small",filledSquare:!0,letter:"A",className:"cr-tx-ht",letterColor:"var(--cr-tx-ht-it)"}):a.isManager?t(Ft,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are judge","data-tooltip-t-class-name":"tt-se ws-np",size:"small",filledSquare:!0,letter:"J",className:"cr-tx-ht",letterColor:"var(--cr-tx-ht-it)"}):a.isParticipant?t("div",{children:t(Tt,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"registered","data-tooltip-t-class-name":"tt-se ws-np",filledCircle:!0,className:"cr-ss"})}):a.isGuest?t(Ft,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are guest","data-tooltip-t-class-name":"tt-se ws-np",size:"small",filledSquare:!0,letter:"G",className:"cr-tx-ht",letterColor:"var(--cr-tx-ht-it)"}):a.isSpectator&&t(Ft,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are spectator","data-tooltip-t-class-name":"tt-se ws-np",size:"small",filledSquare:!0,letter:"S",className:"cr-tx-ht",letterColor:"var(--cr-tx-ht-it)"})]}):t("div",{className:A("jk-row gap fw-bd",{center:o,left:!o}),children:s})})}function KS(){return{head:"contest name",headClassName:"left",index:"name",Field:WS,sort:!0,filter:{type:"text"},cardPosition:"top",minWidth:320}}function JS(){return{head:"status",index:"status",Field:({record:n})=>e(lg,{className:"jk-col center gap",children:[t("div",{className:`jk-tag cr-we ${cs(n).bc}`,children:t(Fr,{className:"tt-ue tx-s",children:cs(n).label})}),n.isLive&&n.isQuietTime?t(hi,{}):n.isLive&&n.isFrozenTime&&t(ui,{}),n.isPast&&n.settings.upsolvingEnabled&&t(pi,{})]}),filter:{type:"select",options:["upcoming","live","past","endless"].map(e=>({value:e,label:t(Fr,{className:"tt-ce",children:e})}))},cardPosition:"upper",minWidth:130}}function GS({record:{tags:e},isCard:n}){return t(lg,{className:A("jk-row gap",{center:n,left:!n,"jk-pg-smp":n}),children:e.filter(Boolean).map(e=>t("div",{className:"jk-tag bc-ht-lt tx-s",children:t(Fr,{children:e})},e))})}function qS(e){return{head:"tags",index:"tags",Field:GS,filter:{type:"select",options:e},cardPosition:"lower",minWidth:250}}function YS({record:{key:n}}){const[s,r]=i(null);return e(lg,{className:"jk-row",children:[s,t(Bs,{type:"secondary",size:"tiny",onClick:()=>{r(t(pS,{url:ps.API_V2.problem.getLogs({params:{key:n}}).url,isOpen:!0,onClose:()=>r(null)}))},children:t(Fr,{children:"view logs"})})]})}function XS(){return{head:"actions",index:"actions",Field:YS,cardPosition:"bottom",minWidth:100}}function QS({record:{key:n}}){return t(lg,{className:"jk-col center",children:e("div",{className:"jk-row",children:[t("div",{className:"jk-row tx-s fw-bd",children:n})," ",t(Hs,{text:n,iconSize:"tiny"})]})})}function ej(){return{head:"key",index:"key",Field:QS,sort:!0,filter:{type:"text"},cardPosition:"top",sticky:!0,minWidth:120}}function tj({record:{settings:{scoringMode:e}}}){return t(dg,{className:"jk-row",text:t(Fr,{className:"tt-se",children:Xe[e]?.label}),label:t(Fr,{className:"tt-se",children:"mode"})})}function nj(){return{head:"mode",index:"mode",Field:tj,sort:!0,filter:{type:"select",options:tt.map(e=>({value:e,label:Xe[e].label}))},cardPosition:"upperRight"}}function sj({solved:e,tried:n,size:s}){return e?t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you solved it","data-tooltip-t-class-name":"tt-se ws-np",className:"jk-row",children:t(Tt,{size:s,filledCircle:!0,className:"cr-ss"})}):n&&t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you tried it","data-tooltip-t-class-name":"tt-se ws-np",className:"jk-row",children:t(Vn,{size:s,filledCircle:!0,className:"cr-wg"})})}function rj(s){const{record:{name:r,shortname:a,user:i,key:o},isCard:l}=s,{Link:c}=ma(e=>e.components);return t(lg,{className:A("jk-row",{left:!l,center:l}),children:e("div",{className:"jk-row nowrap",children:[t(c,{href:gs.JUDGE().problems.view({key:o}),className:A("link jk-row nowrap",{"ta-lt":!l}),children:t("div",{style:{textAlign:l?void 0:"left",display:"inline"},children:(a?`[${a}] `:"")+r})}),(i.tried||i.solved)&&t(n,{children:" "}),t(sj,{...i,size:"small"}),i.isManager&&e(n,{children:[" ",t(Ft,{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are editor",size:"small",filledSquare:!0,letter:"E",className:"cr-tx-ht",letterColor:"var(--cr-tx-ht-it)"})]})]})})}function aj(s){const{record:{name:r,user:a,key:o,shortname:l},isCard:c}=s,[d,u]=i(null);return e(lg,{className:A("jk-row",{left:!c,center:c}),children:[d,e("div",{className:"jk-row nowrap",children:[t("div",{className:A("jk-row link",{"ta-lt":!c}),onClick:()=>{u(t(ga,{isOpen:!0,onClose:()=>u(null),children:t(ii,{url:ps.API_V2.problem.getData({params:{key:o}}).url,children:e=>t(FS,{problem:e.data.content,infoPlacement:"name",codeEditorStoreKey:e.data.content.key})})}))},children:(l?`[${l}] `:"")+r}),(a.tried||a.solved)&&t(n,{children:" "}),t(sj,{...a,size:"small"}),a.isManager&&e(n,{children:[" ",t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"you are editor","data-tooltip-t-class-name":"tt-se ws-np",className:"jk-row tx-s cr-tx-ht",children:t(Ft,{size:"small",filledSquare:!0,letter:"E"})})]})]})]})}function ij(e,t){return{head:"problem name",headClassName:"left",index:"name",Field:e?aj:rj,sort:!0,filter:{type:"text"},cardPosition:"center",minWidth:300,...t}}function oj({record:{owner:{organization:{key:e},imageUrl:n,nickname:s}}}){return t(dg,{className:"jk-row",text:t(Ig,{nickname:s,imageUrl:n,organizationKey:e}),label:t(Fr,{className:"tt-se",children:"crawler"})})}function lj({record:{owner:{imageUrl:e,nickname:n,organization:{key:s}}}}){return t(dg,{className:"jk-row",text:t(Ig,{nickname:n,imageUrl:e,organizationKey:s}),label:t(Fr,{className:"tt-se",children:"owner"})})}function cj(e){return{head:e?"crawler":"owner",index:"owner",Field:e?oj:lj,sort:!0,cardPosition:"bottom",minWidth:200}}function dj(e){return{head:"tags",index:"tags",Field:GS,filter:{type:"select",options:e},cardPosition:"lower",minWidth:250}}function uj({record:{settings:{type:e}}}){return t(dg,{className:"jk-row",text:t(Fr,{className:"tt-se",children:Oe[e].label}),label:t(Fr,{className:"tt-se",children:"type"})})}function hj(){return{head:"type",index:"type",Field:uj,sort:!0,filter:{type:"select",options:[nt.STANDARD,nt.DYNAMIC].map(e=>({value:e,label:Oe[e].label}))},cardPosition:"upperLeft",minWidth:100}}function pj(n){const{record:{contest:s},isCard:r}=n,{Link:a}=ma(e=>e.components),i=Ya(e=>e.organization.key),o=s?os(s.organization.key,i):"";return t(dg,{text:s?e(a,{href:gs.JUDGE(o).contests.view({key:s.key,tab:_.PROBLEMS,subTab:s.problemIndex}),target:o?"_blank":void 0,className:"link jk-row",children:[t("div",{style:{textAlign:r?void 0:"left",display:"inline"},children:s.name})," ",!!o&&t(gn,{size:"small"})]}):t("div",{className:"jk-row",children:"-"}),label:"contest"})}function mj(){return{head:"contest",index:"contestKeys",Field:pj,sort:!0,cardPosition:"top",minWidth:280}}function fj(n){const{record:{problem:{key:s,name:r,organization:{key:a}},contest:i},isCard:o,contest:l}=n,{Link:c}=ma(e=>e.components),d=Ya(e=>e.organization.key),u=os(i?i.organization.key:a,d);return t(dg,{text:i?t(c,{href:gs.JUDGE(u).contests.view({key:i.key,tab:_.PROBLEMS,subTab:i.problemIndex}),target:u?"_blank":void 0,className:"link",children:e("div",{className:"jk-col",children:[l?.key===i.key?e("div",{className:"jk-row",children:["(",i.problemIndex||"-",")"]}):e("div",{className:"jk-row",children:[i.name," (",i.problemIndex||"-",")"]}),e("div",{className:"jk-row",children:[r," ",!!u&&t(gn,{size:"small"})]})]})}):e(c,{href:gs.JUDGE(u).problems.view({key:s}),target:u?"_blank":void 0,className:"link jk-row",children:[t("div",{style:{textAlign:o?void 0:"left",display:"inline"},children:r})," ",!!u&&t(gn,{size:"small"})]}),label:"problem / contest"})}function gj(e){return{head:"problem",index:"problemKeys",Field:n=>t(fj,{...n,contest:e?.contest}),sort:!0,filter:e?.header?.filter,cardPosition:"top",minWidth:280}}function bj({record:{timestamp:n,contest:s},isCard:r}){const a=new Date(n);return e(lg,{className:"jk-col center nowrap",children:[e("div",{className:"date-field jk-col center",children:[t(Dr,{date:a,twoLines:!r}),s?.settingsStartsAt&&e("div",{className:"jk-row tx-t cr-hd",style:{lineHeight:1},children:[t(Fr,{className:"tt-se",children:"sent at"})," ",t(Wi,{counter:n-s.settingsStartsAt,maxSplit:2,ignoreLeadingZeros:!0,ignoreTrailingZeros:!0,literal:!0,abbreviated:!0})]})]}),t("div",{className:"jk-row date-field-label cr-tx-sc tx-t",children:t(Fr,{className:"tt-se",children:"date"})})]})}function vj(){return{head:"date",index:"timestamp",Field:bj,sort:!0,filter:{type:"date-range",pickerType:"year-month-day-hours-minutes"},cardPosition:"center",minWidth:180}}function yj({submitId:e,canViewSourceCode:n,children:s}){const r=oi(e=>e.searchParams),{Link:a}=ma(e=>e.components),i=p(()=>{const t=ms(r);return t.delete(C.SUBMISSION),t.append(C.SUBMISSION,e),t},[r,e]);return n?t(a,{href:{query:i.toString()},className:"link",children:s}):s}function wj({record:{submitId:e,user:{canViewSourceCode:n},language:s,problem:{judge:{key:r}},hiddenSubmission:a},isCard:i,languagesByJudge:o}){return i?null:t(lg,{children:a?t("div",{className:"jk-col extend fr-4",children:o[r]?.languages[s]?.label||Je[s]?.label||s}):t(yj,{submitId:e,canViewSourceCode:n,children:t("div",{className:"jk-col extend link",children:o[r]?.languages[s]?.label||Je[s]?.label||s})})})}function kj(n){return{head:"language",index:"languages",Field:e=>t(wj,{...e,languagesByJudge:n}),sort:!0,filter:{type:"select",options:Object.values(n).map(({name:s,languages:r})=>Object.values(r).map(({label:r,value:a})=>({label:1===Object.keys(n).length?r:e("div",{className:"jk-row",children:[r," ",t("div",{className:"jk-tag bc-ht-lt tx-t",children:s})]}),value:a}))).flat()},cardPosition:"bottom",minWidth:180}}function Nj(){return{head:"memory",index:"memoryUsed",Field:({record:{memoryUsed:e,verdict:n,hiddenVerdict:s,hiddenSubmission:r},isCard:a})=>a?null:t(dg,{text:t(Gb,{memoryUsed:e,verdict:n}),label:"memory used",className:A({"fr-4":r||s})}),sort:!0,cardPosition:"center",minWidth:120}}function xj({record:{user:{imageUrl:e,nickname:n,organization:{key:s}},hiddenSubmission:r}}){return t(dg,{className:"gap",text:r?t(_g,{}):t(Ig,{imageUrl:e,nickname:n,organizationKey:s}),label:"user nickname"})}function Sj(e){return{head:"nickname",index:"nicknames",Field:xj,sort:!0,filter:e?{type:"select",options:e}:{type:"text"},cardPosition:"top",minWidth:250}}function jj(n){const{record:{problem:{key:s,name:r,organization:{key:a}}},isCard:i}=n,{Link:o}=ma(e=>e.components),l=Ya(e=>e.organization.key),c=os(a,l);return t(dg,{text:e(o,{href:gs.JUDGE(c).problems.view({key:s}),target:c?"_blank":void 0,className:"link jk-row",children:[t("div",{style:{textAlign:i?void 0:"left",display:"inline"},children:r})," ",!!c&&t(gn,{size:"small"})]}),label:"problem"})}function Ej(e){return{head:"problem",index:"problemKeys",Field:jj,sort:!0,filter:e?.header?.filter,cardPosition:"top",minWidth:280}}function Cj({submissionId:e}){const{notifyResponse:n}=si(),s=_i();return t(za,{onClick:async(...t)=>{await(e=>async t=>{t(K.LOADING);const{url:s,...r}=ps.API_V2.submission.retrieve({params:{id:e}}),a=fe(await es(s,r));n(a,t)})(e)(...t),await s(new RegExp(`${ye}/submission`))},size:"tiny",icon:t(Ht,{}),type:"secondary",children:t(Fr,{className:"tt-se",children:"retrieve"})})}function Oj(){return{head:"rejudge",index:"rejudge",Field:({record:{submitId:e,problem:n}})=>t(lg,{children:t("div",{className:"jk-col nowrap extend",style:{padding:"4px 0",boxSizing:"border-box"},children:n.judge.isSubmitSupported?t(Ii,{submissionId:e}):t(Cj,{submissionId:e})})}),cardPosition:"bottom",minWidth:180}}function _j({record:{timeUsed:n,submitId:s,user:{canViewSourceCode:r},language:a,verdict:i,memoryUsed:o,hiddenVerdict:l,hiddenSubmission:c},isCard:d}){const u=l||c,h=e(lg,{className:A("jk-row gap nowrap",{"fr-4":u}),children:[t(dg,{text:t("div",{className:"jk-col extend",children:Je[a]?.label||a}),label:"language"}),t(dg,{text:t(qb,{timeUsed:n,verdict:i}),label:"time used"}),t(dg,{text:t(Gb,{memoryUsed:o,verdict:i}),label:"memory used"})]});return d?u?h:t(yj,{submitId:s,canViewSourceCode:r,children:h}):t(dg,{text:t(qb,{timeUsed:n,verdict:i}),label:"time used",className:A({"fr-4":u})})}function Ij(){return{head:"time",index:"timeUsed",Field:_j,sort:!0,cardPosition:"center",minWidth:120}}function Tj(){return{head:"verdict",index:"verdicts",Field:({record:s})=>t(dg,{text:e(n,{children:[s.hiddenSubmission||s.hiddenVerdict?t(Bv,{submit:s,className:"fr-4"}):t(yj,{submitId:s.submitId,canViewSourceCode:s.user.canViewSourceCode,children:t(Bv,{submit:s})}),s.contest&&t("div",{className:"jk-row gap",children:s.contest.isUpsolving?t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"this submission is within the upsolving period, it is not shown on the offial scoreboard",className:"jk-row",children:t($t,{size:"tiny",className:"cr-ss"})}):s.contest.isQuiet?t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"this submission is within the silent period, it is not shown on the scoreboard and the verdict is not visible to participants",className:"jk-row",children:t(Un,{size:"tiny",className:"cr-er-lt"})}):s.contest.isFrozen&&t("div",{"data-tooltip-id":"jk-tooltip","data-tooltip-content":"this submission is within the Frozen period, it is not shown on the scoreboard",className:"jk-row",children:t(Rt,{size:"tiny",className:"cr-io"})})})]}),label:"verdict",className:"jk-col"}),sort:!0,filter:{type:"select",options:Object.values(_e).map(({value:e,label:n})=>({label:t(Fr,{className:"tt-se",children:n}),value:e}))},cardPosition:"bottom",minWidth:220}}function Aj({userKey:e}){Vv({userKey:e});const{data:n}=ei(ps.API_V2.judge.getSummaryList().url),s=p(()=>{const e={},t=n?.success?n.contents:[];for(const{name:n,languages:s,key:r}of t){const t={};for(const{value:e,label:n}of s.filter(e=>e.enabled))t[e]={label:n,value:e};e[r]={key:r,languages:t,name:n}}return e},[n]),r=p(()=>[Ej(),vj(),Tj(),kj(s),Ij(),Nj()],[s]);return t(Mg,{rows:{height:80},cards:{expanded:!0},headers:r,getUrl:({pagination:{page:t,pageSize:n},filter:s,sort:r})=>ps.API_V2.submission.getSummaryList({params:{page:t,pageSize:n,filterUrl:us({...s,nicknames:e}),sortUrl:ds(r)}}).url,name:C.PROFILE_SUBMISSIONS_TABLE,toRow:e=>e,refreshInterval:6e4})}function Pj({user:s,reloadUser:r,extraTabs:a}){const o=Ya(e=>e.mutate),l=Ya(e=>e.user.nickname),c=Ya(e=>e.user.organization.key),d=oi(e=>e.replaceRoute),u=oi(e=>e.searchParams),[h,p]=i(""),m=()=>p(""),f=u.get("tab")||I.OVERVIEW,g=s.nickname===l&&s.organization.key===c;let b={[I.OVERVIEW]:{key:I.OVERVIEW,header:t(Fr,{className:"tt-ce ws-np",children:"overview"}),body:t(US,{user:s})}};g&&(b[I.SETTINGS]={key:I.SETTINGS,header:t(Fr,{className:"tt-ce ws-np",children:"settings"}),body:t(BS,{user:s,onClickUpdatePassword:()=>p("UPDATE_PASSWORD")})},b[I.MY_SESSIONS]={key:I.MY_SESSIONS,header:t(Fr,{className:"tt-ce ws-np",children:"active sessions"}),body:t(VS,{})}),hs()&&(b[I.SUBMISSIONS]={key:I.SUBMISSIONS,header:t(Fr,g?{className:"tt-ce ws-np",children:"my submissions"}:{className:"tt-ce ws-np",children:"submissions"}),body:t(Aj,{userKey:xe(s.nickname,s.organization.key)})}),a&&(b={...b,...a});const v=[...s.canResetPassword?[t(Vi,{icon:t(Mt,{}),onClick:()=>p("RESET_PASSWORD"),type:"secondary",label:"reset password"},"reset-password")]:[],...s.canEditProfileData?[t(Vi,{icon:t(Mt,{}),onClick:()=>p("DATA"),label:"update profile"},"update-profile")]:[]];return e(n,{children:[t(Bx,{isOpen:"UPDATE_PASSWORD"===h,onClose:m}),t(DS,{isOpen:"RESET_PASSWORD"===h,onClose:m,nickname:s.nickname,organizationKey:s.organization.key}),t(hS,{isOpen:"DATA"===h,onClose:m,user:s,onSuccess:async({body:{nickname:e}})=>{e!==s.nickname?d(gs.JUDGE().profiles.view({nickname:e,organizationKey:s.organization.key,tab:I.OVERVIEW})):(await r(),await o())}}),t(eo,{tabs:b,tabButtons:v,selectedTabKey:f,getHrefOnTabChange:e=>gs.JUDGE().profiles.view({nickname:s.nickname,organizationKey:s.organization.key,tab:e}),children:t("h1",{children:s.nickname})})]})}function zj(e){const{Cmp:n,newEntity:s,listRoute:r,viewRoute:a,createApiURL:o,toEntityUpsert:l}=e,[c]=i(s()),{notifyResponse:d}=si(),u=oi(e=>e.pushRoute);return t(n,{entity:c,entityKey:"",tabButtons:({entityData:e})=>[t(og,{onClickContinue:()=>u(r()),value:e,children:t(Vi,{type:"secondary",icon:t(Et,{}),label:"cancel"})},"cancel"),t(Ui,{icon:t(Bn,{}),onClick:async t=>{t(K.LOADING);const n=fe(await es(o(),{method:je.POST,body:JSON.stringify(l(e))}));if(d(n,t)){const e=n.content.key;u(a(e))}},label:"create"},"save")]})}function Lj(e){const{Cmp:n,entity:s,entityKey:r,viewRoute:a,updateApiURL:o,viewApiURL:l,toEntityUpsert:c}=e,d=oi(e=>e.pushRoute),{notifyResponse:u}=si(),h=_i(),[p]=i(s);return t(n,{entity:p,entityKey:r,tabButtons:({entityData:e,disableUpdateButton:n})=>[t(og,{onClickContinue:()=>d(a(r)),value:e,children:t(Vi,{type:"secondary",icon:t(Et,{}),label:"cancel"})},"cancel"),t(Ui,{disabled:n,icon:t(Bn,{}),onClick:async t=>{t(K.LOADING);const n=fe(await es(o(e)(r),{method:je.PUT,body:JSON.stringify(c(e))}));u(n,t)&&(t(K.LOADING),await h(l(r)),d(a(r)))},label:"update"},"save")]})}function Rj({members:e,renderMember:n}){const s=Object.values(e||{});return s.length?t("div",{className:"jk-row left gap",children:s.map(e=>n?n(e):t(Ig,{imageUrl:e.imageUrl,nickname:e.nickname,organizationKey:e.organization.key},e.nickname))}):t("div",{className:"jk-row extend left",children:t(Fr,{className:"fw-lr tt-se tx-s",children:"nobody"})})}function Mj(s){const{members:r,setMembers:a,documentOwner:i,administrators:o,managers:l,participants:c,guests:d,spectators:u}=s,h=Ya(e=>e.organization.key),p=st({members:r}),m=o?.name||"administrators",f=l?.name||"managers",g=c?.name||"participants",b=d?.name||"guests",v=u?.name||"spectators";return e("div",{className:"jk-col gap stretch gap",children:[e("div",{children:[t(Fr,{className:"tt-se fw-bd",children:"owner"}),t("div",{className:"jk-row extend left",children:t(Ig,{nickname:i.nickname,organizationKey:i.organization.key,imageUrl:i.imageUrl})})]}),void 0!==o&&e("div",{children:[e("div",{className:"jk-row left gap",children:[t(Fr,{className:"tt-se fw-bd",children:m}),!!o?.description&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:o?.description||"",children:t("div",{className:"jk-row",children:t(Qt,{circle:!0,size:"small"})})})]}),r.rankAdministrators===rt.NONE?t(Fr,{className:"tt-se",children:"not selectable"}):r.rankAdministrators===rt.CLOSE?e(n,{children:[t(Fr,{className:"tt-se",children:`only the following users will be ${m}`}),":"]}):t(Fr,{className:"tt-se",children:`all users will be ${m}`}),(r.rankAdministrators===rt.CLOSE||r.rankAdministrators===rt.OPEN)&&(o&&a?t(Jv,{selectedUsers:Object.keys(r.administrators??{}),onChangeSelectedUsers:e=>{const t={};for(const n of e)t[xe(n.nickname,n.organization.key)]={imageUrl:n.imageUrl,nickname:n.nickname,organization:{key:n.organization.key},type:at.USER};a(e=>({...e,administrators:t}))},organizationKey:h}):t(Rj,{members:r.administrators,renderMember:o.renderMember}))]}),void 0!==l&&e("div",{children:[e("div",{className:"jk-row left gap",children:[t(Fr,{className:"tt-se fw-bd",children:l?.name||"managers"}),!!l?.description&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:l?.description||"",children:t("div",{className:"jk-row",children:t(Qt,{circle:!0,size:"small"})})})]}),r.rankManagers===rt.NONE?t(Fr,{className:"tt-se",children:"not selectable"}):r.rankManagers===rt.CLOSE?e(n,{children:[t(Fr,{className:"tt-se",children:`only the following users will be ${f}`}),":"]}):t(Fr,{className:"tt-se",children:`all users will be ${f}`}),(r.rankManagers===rt.CLOSE||r.rankManagers===rt.OPEN)&&(l&&a?t(Jv,{selectedUsers:Object.keys(r.managers??{}),onChangeSelectedUsers:e=>{const t={};for(const n of e)t[xe(n.nickname,n.organization.key)]={imageUrl:n.imageUrl,nickname:n.nickname,organization:{key:n.organization.key},type:at.USER};a(e=>({...e,managers:t}))},organizationKey:h}):t(Rj,{members:r.managers,renderMember:l.renderMember}))]}),void 0!==c&&e("div",{children:[e("div",{className:"jk-row left gap",children:[t(Fr,{className:"tt-se fw-bd",children:c?.name||"participants"}),!!c?.description&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:c?.description||"",children:t("div",{className:"jk-row",children:t(Qt,{circle:!0,size:"small"})})}),c?.closeable&&a&&p!==it.PRIVATE&&e(n,{children:[t("div",{className:"jk-divider horizontal tiny"}),t(oa,{checked:r.rankParticipants===rt.CLOSE,onChange:e=>a(t=>({...t,rankParticipants:e?rt.CLOSE:rt.OPEN})),leftLabel:t(Fr,{className:A({"fw-bd":r.rankParticipants===rt.OPEN}),children:r.rankParticipants===rt.OPEN?"opened":"open"}),rightLabel:t(Fr,{className:A({"fw-bd":r.rankParticipants===rt.CLOSE}),children:r.rankParticipants===rt.CLOSE?"closed":"close"}),size:"small"})]})]}),r.rankParticipants===rt.NONE?t(Fr,{className:"tt-se",children:"not selectable"}):r.rankParticipants===rt.CLOSE?e(n,{children:[t(Fr,{className:"tt-se",children:`only the following users will be ${g}`}),":"]}):t(Fr,{className:"tt-se",children:`all users will be ${g}`}),(r.rankParticipants===rt.CLOSE||r.rankParticipants===rt.OPEN)&&(c&&a?t(Jv,{selectedUsers:Object.keys(r.participants??{}),onChangeSelectedUsers:e=>{const t={};for(const n of e)t[xe(n.nickname,n.organization.key)]={imageUrl:n.imageUrl,nickname:n.nickname,organization:{key:n.organization.key},type:at.USER};a(e=>({...e,participants:t}))},organizationKey:h}):t(Rj,{members:r.participants,renderMember:c.renderMember}))]}),void 0!==d&&e("div",{children:[e("div",{className:"jk-row left gap",children:[t(Fr,{className:"tt-se fw-bd",children:d?.name||"guests"}),!!d?.description&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:d?.description||"",children:t("div",{className:"jk-row",children:t(Qt,{circle:!0,size:"small"})})}),d?.closeable&&a&&p!==it.PRIVATE&&e(n,{children:[t("div",{className:"jk-divider horizontal tiny"}),t(oa,{checked:r.rankGuests===rt.CLOSE,onChange:e=>a(t=>({...t,rankGuests:e?rt.CLOSE:rt.OPEN})),leftLabel:t(Fr,{className:A({"fw-bd":r.rankGuests===rt.OPEN}),children:r.rankGuests===rt.OPEN?"opened":"open"}),rightLabel:t(Fr,{className:A({"fw-bd":r.rankGuests===rt.CLOSE}),children:r.rankGuests===rt.CLOSE?"closed":"close"}),size:"small"})]})]}),r.rankGuests===rt.NONE?t(Fr,{className:"tt-se",children:"not selectable"}):r.rankGuests===rt.CLOSE?e(n,{children:[t(Fr,{className:"tt-se",children:`only the following users will be ${b}`}),":"]}):t(Fr,{className:"tt-se",children:`all users will be ${b}`}),(r.rankGuests===rt.CLOSE||r.rankGuests===rt.OPEN)&&(d&&a?t(Jv,{selectedUsers:Object.keys(r.guests??{}),onChangeSelectedUsers:e=>{const t={};for(const n of e)t[xe(n.nickname,n.organization.key)]={imageUrl:n.imageUrl,nickname:n.nickname,organization:{key:n.organization.key},type:at.USER};a(e=>({...e,guests:t}))},organizationKey:h}):t(Rj,{members:r.guests,renderMember:d.renderMember}))]}),void 0!==u&&e("div",{children:[e("div",{className:"jk-row left gap",children:[t(Fr,{className:"tt-se fw-bd",children:u?.name||"spectators"}),!!u?.description&&t(ta,{popoverClassName:"bc-sf-hi jk-br-ie elevation-1",content:u?.description||"",children:t("div",{className:"jk-row",children:t(Qt,{circle:!0,size:"small"})})})]}),r.rankSpectators===rt.NONE?t(Fr,{className:"tt-se",children:"not selectable"}):r.rankSpectators===rt.CLOSE?e(n,{children:[t(Fr,{className:"tt-se",children:`only the following users will be ${v}`}),":"]}):t(Fr,{className:"tt-se",children:`all users will be ${v}`}),(r.rankSpectators===rt.CLOSE||r.rankSpectators===rt.OPEN)&&(u&&a?t(Jv,{selectedUsers:Object.keys(r.spectators??{}),onChangeSelectedUsers:e=>{const t={};for(const n of e)t[xe(n.nickname,n.organization.key)]={imageUrl:n.imageUrl,nickname:n.nickname,organization:{key:n.organization.key},type:at.USER};a(e=>({...e,spectators:t}))},organizationKey:h}):t(Rj,{members:r.spectators,renderMember:u.renderMember}))]})]})}const $j={[it.PRIVATE]:t(Mt,{}),[it.RESTRICTED]:t(Wn,{}),[it.PUBLIC]:t(Hn,{}),[it.EXPOSED]:t(Zn,{})};function Fj(n){const{members:s,setMembers:r,documentOwner:a,administrators:i,managers:o,participants:l,guests:c,spectators:d,entityAccess:u}=n,h=st({members:s});return e("div",{className:"jk-col gap stretch gap",children:[e("div",{children:[t(Fr,{className:"fw-bd tt-se",children:"access type"}),t("div",{children:t(sa,{options:Object.values(ot).map(n=>({value:n.value,label:t("div",{className:"jk-row gap left jk-pg-sm",children:e("div",{className:"jk-col left stretch",children:[e("div",{className:"jk-row gap left",children:[$j[n.value],t(Fr,{className:"tt-se fw-bd",children:u?.[n.value]?.name??n.label})]}),t(Fr,{className:"tt-se",children:u?.[n.value]?.description??n.description})]})})})),selectedOption:{value:h},expand:!0,onChange:r?({value:e})=>{r(t=>{const n={...t};switch(n.rankAdministrators=i?.closeable?rt.CLOSE:rt.NONE,n.rankGuests=c?.closeable?n.rankGuests===rt.CLOSE?rt.CLOSE:rt.OPEN:rt.NONE,n.rankParticipants=l?.closeable?n.rankParticipants===rt.CLOSE?rt.CLOSE:rt.OPEN:rt.NONE,e){case it.EXPOSED:n.rankManagers=rt.OPEN,n.rankSpectators=rt.OPEN;break;case it.PUBLIC:n.rankManagers=rt.CLOSE,n.rankSpectators=rt.OPEN;break;case it.RESTRICTED:n.rankManagers=rt.CLOSE,n.rankSpectators=rt.CLOSE;break;case it.PRIVATE:n.rankAdministrators=rt.NONE,n.rankManagers=rt.NONE,n.rankGuests=rt.NONE,n.rankSpectators=rt.NONE,n.rankParticipants=rt.NONE}return n})}:void 0})})]}),t(Mj,{members:s,setMembers:r,documentOwner:a,administrators:i,managers:o,participants:l,guests:c,spectators:d},"members")]})}function Dj(n){const{documentName:s,members:r,documentOwner:a,administrators:o,managers:l,participants:c,guests:d,spectators:u,entityAccess:h,onClose:p,onSave:m,isOpen:f}=n,[g,b]=Qi(r),[v,y]=i(!1),w=JSON.stringify(g)===JSON.stringify(r);return t(ga,{isOpen:f,onClose:v?()=>null:p,closeOnClickOverlay:w,closeOnKeyEscape:w,className:"wh-ao",children:e("div",{className:"jk-col stretch gap jk-pg-md",children:[t("div",{className:"jk-row left extend",children:e("h3",{children:[t(Fr,{className:"tt-se",children:"share"})," ",s]})}),t(Fj,{members:g,setMembers:b,documentOwner:a,administrators:o,managers:l,participants:c,guests:d,spectators:u,entityAccess:h}),e("div",{className:"jk-row-col gap block",children:[t(za,{type:"secondary",onClick:p,disabled:v,children:t(Fr,{className:"tt-se",children:"close"})}),t(za,{disabled:w,submit:!0,onClick:async e=>{e(K.LOADING),y(!0),await m(g,p),y(!1),e(K.SUCCESS)},children:t(Fr,{className:"tt-se",children:"save"})})]})]})})}function Vj(s){const{isAdministrator:r,members:a,documentOwner:o,documentName:l,onSave:c,saveUrl:d,reloadDocument:u,copyLink:h,entityAccess:p,administrators:m,managers:f,participants:g,spectators:b,guests:v,children:y,buttonSize:w="regular"}=s,[k,N]=i(!1),{notifyResponse:x}=si(),S=st({members:a}),j=c??(async(e,t)=>{const n={members:{rankAdministrators:e.rankAdministrators,administrators:Object.keys(e.administrators),rankManagers:e.rankManagers,managers:Object.keys(e.managers),rankGuests:e.rankGuests,guests:Object.keys(e.guests),rankSpectators:e.rankSpectators,spectators:Object.keys(e.spectators),rankParticipants:e.rankParticipants,participants:Object.keys(e.participants)}},s=fe(await es(d,{method:je.PUT,body:JSON.stringify(n)}));await(u?.()),x(s),t()}),E=[{children:y||t(Bs,{icon:t(Kn,{size:{tiny:"tiny",small:"tiny",regular:"small",large:"regular",huge:"large"}[w]}),size:w,children:t(Fr,{className:"tt-se",children:"share"})},"share"),buttons:[{children:e("div",{children:[e("div",{style:{maxWidth:256},className:"jk-pg-xsm jk-br-ie",children:[e("div",{className:"fw-bd",children:[t(Fr,{className:"tt-se",children:"access"}),":"," ",t(Fr,{className:"tt-se",children:p?.[S]?.name??ot[S]?.label})]}),t(Fr,{className:"tt-se",children:p?.[S]?.description??ot[S]?.description})]}),(h||r)&&e("div",{className:"jk-row gap nowrap",children:[h&&t(Hs,{text:h(),className:"flex-1",iconSize:"small",children:t(Fr,{className:"tt-se",children:"copy link"})}),r&&t(Bs,{icon:t(Kt,{size:"small"}),onClick:()=>N(!0),className:"flex-1",children:t(Fr,{className:"tt-se",children:"edit"})})]})]})}]}];return e(n,{children:[t(La,{...E[0],className:"top center",placement:"bottom",popoverClassName:"jk-pg-xsm bc-sf-hi jk-br-ie elevation-1"}),t(Dj,{isOpen:k,onClose:()=>N(!1),members:a,documentName:l,documentOwner:o,onSave:j,administrators:m,managers:f,participants:g,spectators:b,guests:v})]})}const Uj=()=>{const e=Ya(e=>e.clientId),t=oi(e=>e.origin),n=oi(e=>e.pathname),s=oi(e=>e.searchParams);o(()=>{const{uiId:r}=lt(e),a=`${t}${n}?${s.toString()}`,i=setTimeout(()=>{return e={href:a,uiId:r},void(Ev?.href===e.href&&Ev?.uiId===e.uiId||(Ev=e,Av()));var e},1e3);return()=>clearTimeout(i)},[e,t,n,s])},Bj=zs(e=>({realtimeClient:null,spaces:null,setRealtimeClient:t=>e({realtimeClient:t}),setSpaces:t=>e({spaces:t})})),Zj=e=>P()?new Cs.Realtime({logLevel:ct,authCallback:async(t,n)=>{if(P()){let t;$e("new request to auth ably");try{const n=fe(await es(ps.API_V2.websocket.auth().url+"?"+new URLSearchParams({uiId:e,...wv()}).toString()));t=n.success?n.content:null,t&&"object"==typeof t&&"capability"in t&&(e=>{try{kv="string"==typeof e?JSON.parse(e):e??{}}catch{kv={}}})(t.capability)}catch(e){return void n(e?.toString()||"Error on authCallback",null)}n(null,t)}else console.warn("authCallback executed on server side"),n(null,null)},plugins:{LiveObjects:Os}}):null,Hj=()=>{const e=Ya(e=>e.clientId),t=Mv(e=>e.newAuth),{setRealtimeClient:n,realtimeClient:s,setSpaces:r}=Bj(),a=ua(s);return o(()=>{(async()=>{try{a.current&&($e("Closing previous Ably connection due to clientId change"),a.current.close());const{sessionId:s,uiId:i}=lt(e);if(s&&i){$e(`Creating new Ably connection clientId: "${e}"`);const s=Zj(i);s?(s.connection.on("connected",()=>{$e("Ably connected")}),s.connection.on("disconnected",()=>{De("Ably disconnected")}),s.connection.on("suspended",()=>{De("Ably connection suspended")}),s.connection.on("failed",e=>{be("Ably connection failed",{reason:e.reason}),is(new Error("Ably connection failed: "+e.reason?.message),null,{message:"Ably connection failed"})}),s.connection.on("closed",()=>{De("Ably connection closed")}),s.connection.on("update",e=>{$e("Ably connection state changed",{previous:e.previous,current:e.current})}),Rv(s,e,Mv.getState().broadcastMessage),n(s),r(new Ss(s)),setTimeout(t,1e3)):De("Failed creating realtimeClient ",{realtimeClient:s})}else De("sessionId or uiId are empty",{sessionId:s,uiId:i})}catch(e){is(e,null,{message:"Error during Ably authorization"})}})()},[e,t,a,n,r]),null},Wj=({children:e})=>{const n=oi(e=>e.searchParams).get(C.ROOM),s=Bj(e=>e.spaces);return P()&&s&&n?t(js,{client:s,children:t(Es,{name:"room:"+n,children:e})}):e},Kj=({initialLastPath:e})=>{const t=wi(e=>e.setInitialLastPath),n=Ya(e=>e.user.nickname),s=JSON.stringify(e);return o(()=>{const e=JSON.parse(s);t(e)},[n,s,t]),null},Jj=Ms&&!!$s,Gj=()=>((()=>{const e=Ds(e=>e.setOnline);o(()=>{const t=()=>e(navigator.onLine);return window.addEventListener("online",t),window.addEventListener("offline",t),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",t)}},[e])})(),(()=>{const e=Ds(e=>e.setIsVisible);o(()=>{if(!Jj)return;const t=()=>{const[t]=Fs();e(t)};return t(),document.addEventListener($s.event,t),()=>{document.removeEventListener($s.event,t)}},[e])})(),(()=>{const e=Ds(e=>e.setIsFocus);o(()=>{const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("focus",t),window.addEventListener("blur",n),()=>{window.removeEventListener("focus",t),window.removeEventListener("blur",n)}},[e])})(),(()=>{const e=Ds(e=>e.setIsFullscreen);o(()=>{const t=()=>{e(!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement))};return window.addEventListener("fullscreenchange",t),window.addEventListener("webkitfullscreenchange",t),window.addEventListener("mozfullscreenchange",t),window.addEventListener("MSFullscreenChange",t),window.addEventListener("msFullscreenChange",t),()=>{window.removeEventListener("fullscreenchange",t),window.removeEventListener("webkitfullscreenchange",t),window.removeEventListener("mozfullscreenchange",t),window.removeEventListener("MSFullscreenChange",t),window.removeEventListener("msFullscreenChange",t)}},[e])})(),(()=>{const e=Ds(e=>e.setViewPort);o(()=>{let t=0;const n=()=>{t=0;const n=.01*window.innerHeight;document?.documentElement.style.setProperty("--vh",`${n}px`);const s=window.innerWidth,r=window.innerHeight;let a;a=s>=1920?"hg":s>=1280?"lg":s>=640?"md":"sm",e({screen:a,height:r,width:s,isSmallScreen:"sm"===a,isMediumScreen:"md"===a,isLargeScreen:"lg"===a,isHugeScreen:"hg"===a})},s=()=>{t||(t=requestAnimationFrame(n))};return n(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s),t&&cancelAnimationFrame(t)}},[e])})(),null),qj=e=>{const{routeParams:t,pushRoute:n,replaceRoute:s,reloadRoute:r,pathname:a,isLoadingRoute:l,...c}=e,[u,h]=i(new URLSearchParams("")),p=d(e=>{const t=ms(e),n=ms(u);e.sort(),n.sort(),t.toString()!==n.toString()&&h(e)},[u]),m=d(e=>{const t=ms(u);for(const{name:n,value:s}of Array.isArray(e)?e:[e])t.append(n,s);p(t)},[u,p]),f=d(e=>{const t=ms(u);for(const{name:n,value:s}of Array.isArray(e)?e:[e]){const e=t.getAll(n);if(t.delete(n),void 0!==s)for(const r of e)r!==s&&t.append(n,r)}p(t)},[u,p]),g=d(e=>{const t=ms(u);for(const{name:n,value:s}of Array.isArray(e)?e:[e]){t.delete(n);let e=[];"string"==typeof s?e.push(s):e=s;for(const s of e)t.append(n,s)}p(t)},[u,p]),[b,v]=i(0),y=d(async e=>{v(e=>e+1);const t=await n(Qn(e).path);return v(e=>e-1),t},[n]),w=d(async e=>{v(e=>e+1);const t=await s(Qn(e).path);return v(e=>e-1),t},[s]),k=d(async()=>{v(e=>e+1);const e=await r();return v(e=>e-1),e},[r]),N=d(e=>{let t,n;if("string"==typeof e){const[s="",r]=e.split("?");n=s,t=new URLSearchParams(r)}else n=e.pathname??"",t=ms(e.searchParams??new URLSearchParams);const s=(c.searchParams??u).get(C.TOKEN);s&&t.set(C.TOKEN,s);const r=(c.searchParams??u).get(C.ORGANIZATION);r&&t.set(C.ORGANIZATION,r),y({pathname:n,searchParams:t})},[c.searchParams,u,y]),x=oi(e=>e.replaceProps);return o(()=>{P()&&x({origin:window.location.origin})},[x]),o(()=>{x(Object.values(c).filter(Boolean).length?c:{searchParams:u,appendSearchParams:m,deleteSearchParams:f,setSearchParams:g})},[u,m,f,x,c,g]),o(()=>{x({routeParams:t})},[x,t]),o(()=>{x({pathname:a})},[x,a]),o(()=>{x({pushRoute:N,replaceRoute:w,reloadRoute:k})},[N,k,w,x]),o(()=>{x({routeParams:t})},[x,t]),o(()=>{x({isLoadingRoute:l||!!b})},[l,b,x,t]),null};function Yj({children:n}){const s=Us(),[r,a]=S((e,t)=>{switch(t.type){case ni.ADD_NOTIFICATION:return t.payload.type!==ge.SUCCESS||t.payload.silent||s.playSuccess(),t.payload.type!==ge.INFO||t.payload.silent||s.playNotification(),t.payload.type!==ge.ERROR||t.payload.silent||s.playError(),t.payload.type!==ge.WARNING||t.payload.silent||s.playWarning(),[...e,{...t.payload}];case ni.REMOVE_NOTIFICATION:return e.filter(e=>e.id!==t.notificationId);default:return e}},[]),i=Ds(e=>e.viewPort.isSmallScreen),o=r.filter(e=>e.type!==ge.QUIET),l=i?[...o].reverse():o,c=l.length?[[l[0]]]:[];for(let e=1;e<l.length;e++)c[c.length-1][0]?.type===l[e].type?c[c.length-1].push(l[e]):c.push([l[e]]);return e(ti.Provider,{value:{dispatch:a},children:[n,t("div",{className:"notification-wrapper",children:c.map(e=>t(Rf,{ids:e.map(({id:e})=>e),message:t("div",{className:"jk-col gap",children:e.map(e=>t("div",{children:e.message},e.id))}),type:e[0].type},e[0].id))}),t("div",{className:"notification-wrapper-quiet",children:r.filter(e=>e.type===ge.QUIET).map(e=>t(Rf,{ids:[e.id],...e,type:ge.QUIET},e.id))})]})}const Xj=({children:s,components:r,multiOrganizations:a,onSeeMyProfile:i})=>{const{Image:c=ha,Link:u=pa}=r||{Image:ha,Link:pa},h=oi(e=>e.isLoadingRoute),p=l(null),m=ma(e=>e.setProps),f=ma(e=>e.components.loaded),g=oi(e=>e.deleteSearchParams),b=oi(e=>e.searchParams),{isLogged:v}=Ya(e=>e.user),y=d(({href:e,...n})=>{let s,r;if("string"==typeof e){const[t,n]=e.split("?");s=t,r=new URLSearchParams(n)}else s=e?.pathname??"",r=new URLSearchParams("?"+(e?.query||""));const a=fs(r);return t(u,{href:{pathname:s,query:a},...n})},[u]);return o(()=>{m({components:{Image:c,Link:y,loaded:!0}})},[c,y,m]),o(()=>{m({jukiAppDivRef:p})},[p,m]),o(()=>{v&&b.has(C.SIGN_IN)&&g({name:C.SIGN_IN}),v&&b.has(C.SIGN_UP)&&g({name:C.SIGN_UP})},[v,b,g]),t(ys,{transition:{duration:T.NORMAL},children:e(Yj,{children:[h&&t("div",{className:"page-line-loader",children:t(zt,{delay:2})}),t("div",{id:"juki-app",translate:"no",className:A({"loading-route":h}),ref:p,children:f&&e(n,{children:[s,t(Ea,{}),t(Lx,{}),t(Ax,{multiOrganizations:a}),t(Dx,{onSeeMyProfile:i}),t(Fx,{}),t(Yv,{})]})})]})})},Qj=["--body-tx-cr","--body-tx-cr-ht","--body-tx-cr-ht-it","--body-at-cr","--body-at-cr-it","--navbar-tx-cr","--navbar-bd-cr","--navbar-at-cr"],eE=e=>{const t=Ya(e=>e.user.settings?.[ke.FONT_SIZE]);o(()=>(document.body.style.removeProperty("--tx-bs"),document.body.style.setProperty("--tx-bs",`${e??t}px`),()=>{document.body.style.removeProperty("--tx-bs")}),[t,e])},tE=e=>{const t=Ya(e=>e.user.settings?.[ke.THEME]);o(()=>(document.body.classList.remove("jk-theme-dark"),document.body.classList.remove("jk-theme-light"),(e??t)===Ie.DARK?document.body.classList.add("jk-theme-dark"):document.body.classList.add("jk-theme-light"),()=>{document.body.classList.remove("jk-theme-dark"),document.body.classList.remove("jk-theme-light")}),[t,e])},nE=()=>{const e=Ya(e=>e.setUser),t=Ya(e=>e.setOrganization),n=Ya(e=>e.setDevice),s=Ya(e=>e.setMutate),r=Ya(e=>e.isLoading),a=Ya(e=>e.user.nickname),i=Ya(e=>e.organization.key),c=Ya(e=>e.user.sessionId),u=Ya(e=>e.user.settings?.[ke.LANGUAGE]),h=$r(e=>e.changeLanguage),p=Ds(e=>e.isOnline),m=Ds(e=>e.isFocus),f=Ds(e=>e.isVisible),g=l(!0),b=l(!0),{data:v,mutate:y}=ei(ps.API_V2.auth.ping().url,{refreshInterval:5*Ee}),w=_i(),k=d(async()=>{await w(new RegExp(`${ye}`))},[w]);return o(()=>{r||(g.current?g.current=!1:k())},[a,i,c,k,r]),o(()=>{h(u)},[h,u]),o(()=>{r||(b.current?b.current=!1:m&&f&&y())},[y,p,m,f,r]),o(()=>{if(v&&v?.success)if(t(v.content.organization),v.content.user.isLogged)e(v.content.user);else{let t=localStorage.getItem(ke.LANGUAGE);t!==U.EN&&t!==U.ES&&(t=U.ES);let n=localStorage.getItem(ke.THEME);n!==Ie.DARK&&n!==Ie.LIGHT&&(n=Ie.LIGHT),e({...v?.content.user,settings:{...v.content.user.settings,[ke.THEME]:n,[ke.LANGUAGE]:t,[ke.DATA_VIEW_MODE]:et.ROWS,[ke.MENU_VIEW_MODE]:Ne.VERTICAL,[ke.NEWSLETTER_SUBSCRIPTION]:!0,[ke.TIME_ZONE]:"America/La_Paz",[ke.FONT_SIZE]:16}})}},[v,t,e]),o(()=>{P()&&import("./lib-DdKR2uQv.js").then(function(e){return e.l}).then(e=>{n({type:e.deviceType,isMobile:e.isMobile,isBrowser:e.isBrowser,label:e.isMobile?`${e.mobileModel} ${e.mobileVendor}`:`${e.browserName} ${e.browserVersion}`,osLabel:`${e.osName} ${e.osVersion}`})}),s(y)},[y,n,s]),tE(),eE(),(()=>{const e=Ya(e=>e.user.settings?.[ke.THEME]),t=Ya(e=>e.organization?.styles);o(()=>{const n=document.body,s=(e,t)=>{n.style.removeProperty(e),t&&n.style.setProperty(e,t)},r=t?.[e||Ie.LIGHT];return s("--body-tx-cr",r?.body?.textColor),s("--body-tx-cr-ht",r?.body?.textColorHighlight),s("--body-tx-cr-ht-it",r?.body?.textColorHighlightInset),s("--body-at-cr",r?.body?.accentColor),s("--body-at-cr-it",r?.body?.accentColorInset),s("--navbar-tx-cr",r?.navbar?.textColor),s("--navbar-bd-cr",r?.navbar?.backgroundColor),s("--navbar-at-cr",r?.navbar?.accentColor),()=>{Qj.forEach(e=>n.style.removeProperty(e))}},[t,e])})(),null};function sE(){const e=Us(e=>e.setSounds);return o(()=>{e({[j.CLICK]:new Audio("https://files.juki.pub/sounds/click.wav"),[j.SUCCESS]:new Audio("https://files.juki.pub/sounds/success.mp3"),[j.ERROR]:new Audio("https://files.juki.pub/sounds/trim-error.mp3"),[j.NOTIFICATION]:new Audio("https://files.juki.pub/sounds/notification.wav"),[j.WARNING]:new Audio("https://files.juki.pub/sounds/warning.mp3"),[j.MESSAGE]:new Audio("https://files.juki.pub/sounds/message.mp3"),[j.POP]:new Audio("https://files.juki.pub/sounds/pop.wav"),[j.BELL]:new Audio("https://files.juki.pub/sounds/bell.mp3")})},[e]),null}const rE=w(function(){return Uj(),null}),aE=s=>{const{children:r,components:a,multiOrganizations:i,onSeeMyProfile:o,router:{routeParams:l,pushRoute:c,replaceRoute:d,reloadRoute:u,pathname:h,isLoadingRoute:p,setSearchParams:m,appendSearchParams:f,searchParams:g,deleteSearchParams:b},initialLastPath:v}=s,y={routeParams:l,pushRoute:c,replaceRoute:d,reloadRoute:u,pathname:h,isLoadingRoute:p},w=!!(g&&f&&m&&b)?{...y,searchParams:g,appendSearchParams:f,setSearchParams:m,deleteSearchParams:b}:y;return e(n,{children:[t(Xj,{components:a,multiOrganizations:i,onSeeMyProfile:o,children:t(Wj,{children:r})}),t(rE,{}),t(nE,{}),t(Hj,{}),t(sE,{}),t(Kj,{initialLastPath:v}),t(Gj,{}),t(qj,{...w})]})},iE=()=>{const e=$r(e=>e.loadResources);return o(()=>{e()},[e]),null};const oE=(e=0)=>{const[t,n]=i({atoms:!1,molecules:!1,organisms:!1});return o(()=>{const t=setTimeout(async()=>{await async function(){await va(),await ka(),await Qr(),await Sa(),await Ca()}(),n(e=>({...e,atoms:!0})),await async function(){await no(),await ao(),await lo(),await ho(),await Ha(),await bo(),await wo(),await xo(),await Eo()}(),n(e=>({...e,molecules:!0})),await async function(){await Vx(),await zg(),await $g(),await ug(),await Hx(),await _f(),await Jx(),await Yx(),await eS(),await sS(),await iS()}(),n(e=>({...e,organisms:!0}))},e);return()=>{clearTimeout(t)}},[e]),t};function lE(e){const t=ua(e);o(()=>{const e=e=>t.current(e);return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0})}},[t])}function cE(){const[e,t]=i({width:0,height:0});return o(()=>{function e(){t({width:window.innerWidth,height:window.innerHeight})}return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}function dE(e,t){const n=ua(e);o(()=>{if(t){const e=setInterval(function(){n.current&&n.current()},t);return()=>clearInterval(e)}return()=>null},[t,n])}const uE=()=>{const e=Ds(e=>e.isOnline&&e.isFocus&&e.isVisible);o(()=>{if(!e)return;const t=async()=>{if(V())return;const e=+(localStorage.getItem("lastRequestedServicesCheck")||"0");if(Date.now()-e>=Ee){localStorage.setItem("lastRequestedServicesCheck",Date.now().toString());const{url:e,...t}=ps.API_V2.system.services.checkAndStart(),n=fe(await es(e,t));$e("runner services wake up requested",n)}};t();const n=setInterval(t,Ee);return()=>{clearInterval(n)}},[e])};function hE(e,t,n){o(()=>{const n=setTimeout(()=>{e()},t);return()=>{clearTimeout(n)}},n)}const pE=()=>P()?decodeURIComponent(window.location.hash.replace("#","")):void 0,mE=()=>{const[e,t]=i(()=>pE()??""),n=oi(e=>e.routeParams);return o(()=>{const e=()=>{t(pE()??"")};return e(),window.addEventListener("hashchange",e),()=>{window.removeEventListener("hashchange",e)}},[n]),e},fE=e=>{o(()=>(document.body.style.removeProperty("--cr-tx-ht"),e&&document.body.style.setProperty("--cr-tx-ht",e),()=>{document.body.style.removeProperty("--cr-tx-ht")}),[e])},gE=e=>{const t=wi(e=>e.pushPath),n=oi(e=>e.pathname),s=oi(e=>e.searchParams);o(()=>{t?.({key:e,pathname:n,searchParams:s})},[e,s,n,t])},bE=e=>{const t=l(e);return p(()=>dt(t.current,e)?(t.current=e,e):t.current,[e])},vE=()=>{const e=oi(e=>e.searchParams).get(C.PAGE_FOCUS),t=l(!1);o(()=>{let n=null,s=0;if(e){t.current=!1;const r=()=>{s++;const a=document.getElementById(e);a?(a.focus(),a.scrollIntoView({behavior:"smooth",block:"start"}),t.current=!0):s<50&&(n=setTimeout(r,200))};t.current||r()}return()=>{null!==n&&clearTimeout(n)}},[e])},yE=()=>{const e=Ya(e=>e.user.sessionId);return d(t=>xs(Qa(t,e),Xa),[e])};function wE(e,t){const n=l(t);return o(()=>{n.current=e},[e]),n.current}const kE=(e,t,n=null)=>{const[s,r]=Qi(null!==t?t:sessionStorage.getItem(e)??n??"",[e]);return[s,d(t=>{sessionStorage.setItem(e,t+""),r(t+"")},[r,e]),d(()=>{sessionStorage.removeItem(e),r("")},[r,e])]},NE=e=>{const{nickname:t,imageUrl:n}=Ya(e=>e.user),{space:s}=_s(),[r,a]=i(!1);o(()=>{let e=!1;const r=async()=>{try{await(s?.leave())}catch(e){De("Leaving space error",e)}finally{e||a(!1)}};return(async()=>{if(await r(),!e&&s)try{await s.enter({username:t,avatar:n}),e||a(!0)}catch(t){be(t),e||a(!1)}})(),()=>{e=!0,r()}},[n,t,s]),o(()=>{if(s&&r){let t=null;const n=n=>{null===t&&(t=requestAnimationFrame(()=>{s.cursors.set({position:{x:e.current.x+n.clientX/e.current.zoom,y:e.current.y+n.clientY/e.current.zoom},data:{}}),t=null}))};return window.addEventListener("mousemove",n),()=>{window.removeEventListener("mousemove",n),null!==t&&cancelAnimationFrame(t)}}return()=>null},[s,r,e])},xE=e=>{const[t,n]=i([]);return o(()=>{if(e)return((e,t)=>{const n=Fe(e),s=JSON.stringify(wv());bv(pv,e),Ov.set(n,new Set([...Ov.get(n)??[],t])),JSON.stringify(wv())!==s?Lv():ov&&Iv(ov,n);let r=!1;return()=>{if(r)return;r=!0;const s=JSON.stringify(wv());vv(pv,e),Ov.get(n)?.delete(t),JSON.stringify(wv())!==s&&Lv()}})(e,e=>{n(e.map(e=>{const{sessionId:t,uiId:n}=lt(e.clientId),s=e.data??{};return{clientId:e.clientId,sessionId:t,uiId:n,connectionId:e.connectionId,href:"string"==typeof s.href?s.href:"",timestamp:e.timestamp}}))});n([])},[e]),t},SE=zs((e,t)=>({loadingIds:new Set,loadingCount:0,startLoading:n=>{const s=new Set(t().loadingIds);s.has(n)||(s.add(n),e({loadingIds:s,loadingCount:s.size}))},stopLoading:n=>{const s=new Set(t().loadingIds);s.has(n)&&(s.delete(n),e({loadingIds:s,loadingCount:s.size}))}}));export{ia as $,Zs as A,Bs as B,wa as C,Ur as D,Vr as E,tE as F,eE as G,fE as H,Kr as I,Xr as J,Kv as K,Zx as L,ga as M,fi as N,Ra as O,fa as P,ta as Q,Ka as R,si as S,Fr as T,kE as U,Si as V,nS as W,sa as X,ba as Y,Zr as Z,Pf as _,ua as a,iE as a$,Wr as a0,qx as a1,ci as a2,mg as a3,pg as a4,Jr as a5,ii as a6,Ag as a7,Hg as a8,FS as a9,Za as aA,Da as aB,Br as aC,Mj as aD,Vj as aE,Fj as aF,Ja as aG,hS as aH,zj as aI,pS as aJ,Lj as aK,bS as aL,lg as aM,cg as aN,dg as aO,ui as aP,fg as aQ,mS as aR,Aa as aS,wg as aT,go as aU,dS as aV,jg as aW,di as aX,xa as aY,yo as aZ,ra as a_,li as aa,uo as ab,Ig as ac,aa as ad,Sg as ae,qi as af,$v as ag,oo as ah,Hs as ai,mi as aj,Wg as ak,Oi as al,Mi as am,$i as an,zf as ao,Ia as ap,ro as aq,Pa as ar,Rf as as,Bx as at,og as au,Ma as av,WS as aw,mo as ax,Rg as ay,Dr as az,lE as b,BS as b$,yi as b0,aE as b1,No as b2,ki as b3,Ax as b4,Tg as b5,NS as b6,Va as b7,xi as b8,SS as b9,Yv as bA,xj as bB,jj as bC,Ii as bD,Cj as bE,_j as bF,Wv as bG,Pi as bH,Vi as bI,Ui as bJ,GS as bK,Bi as bL,Ua as bM,Ki as bN,Wi as bO,Gi as bP,Ea as bQ,Xi as bR,eo as bS,Yi as bT,pi as bU,to as bV,VS as bW,Og as bX,Fx as bY,US as bZ,Rx as b_,Mg as ba,vi as bb,Zg as bc,YS as bd,oj as be,zS as bf,QS as bg,tj as bh,rj as bi,aj as bj,lj as bk,sj as bl,uj as bm,Aj as bn,ji as bo,Ei as bp,hi as bq,DS as br,Lx as bs,jo as bt,Oo as bu,Ci as bv,pj as bw,fj as bx,bj as by,wj as bz,sN as c,qa as c0,Pj as c1,Jv as c2,Gv as c3,_a as c4,Dx as c5,Qx as c6,aS as c7,lS as c8,Ba as c9,Ti as cA,Pg as cB,cS as cC,ca as cD,mE as cE,dE as cF,LS as cG,Cg as cH,wi as cI,SE as cJ,_i as cK,bE as cL,xE as cM,Ta as cN,Uj as cO,vE as cP,yE as cQ,oE as cR,wE as cS,Dv as cT,Us as cU,Vv as cV,NE as cW,gE as cX,Mv as cY,cE as cZ,Xa as ca,ZS as cb,HS as cc,KS as cd,JS as ce,qS as cf,XS as cg,ej as ch,nj as ci,ij as cj,cj as ck,dj as cl,hj as cm,mj as cn,gj as co,vj as cp,kj as cq,Nj as cr,Sj as cs,Ej as ct,Oj as cu,Ij as cv,Tj as cw,Qa as cx,Bj as cy,uE as cz,Eg as d,Ya as e,Ds as f,za as g,Sx as h,px as i,ZN as j,zs as k,$r as l,ei as m,Tf as n,cN as o,oi as p,Qi as q,oa as r,La as s,Kx as t,Ni as u,hE as v,Hr as w,ma as x,xm as y,Sm as z};
|