@arcgis/ai-components 6.0.0-next.1 → 6.0.0-next.2
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/agent-utils/BaseAgent.js +1 -1
- package/dist/agent-utils/FunctionAgent.js +1 -1
- package/dist/agent-utils/LLMAgent.js +1 -1
- package/dist/agent-utils/SkillAgent.js +1 -1
- package/dist/agent-utils/WorkflowAgent.js +1 -1
- package/dist/agent-utils/createSchema.js +1 -1
- package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/agent-utils/middlewares/middleware.js +1 -1
- package/dist/agent-utils/middlewares/trace.js +1 -1
- package/dist/agent-utils/middlewares/types.js +1 -1
- package/dist/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/agent-utils/tools/MCPToolProvider.js +1 -1
- package/dist/agent-utils/tools/WebMCPToolProvider.js +1 -1
- package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/agents/agents/arcgisKnowledge/graph/arcgisKnowledgeGraph.js +1 -1
- package/dist/agents/agents/dataExploration/dataExplorationAgent.js +1 -1
- package/dist/agents/agents/dataExplorationGraph/graph/dataExplorationGraph.js +1 -1
- package/dist/agents/agents/help/helpAgent.js +1 -1
- package/dist/agents/agents/helpGraph/graph/helpGraph.js +1 -1
- package/dist/agents/agents/layerStyling/context/layerStylingContext.js +1 -1
- package/dist/agents/agents/layerStyling/graph/layerStylingGraph.js +1 -1
- package/dist/agents/agents/navigation/navigationAgent.js +1 -1
- package/dist/agents/agents/navigationGraph/graph/navigationGraph.js +1 -1
- package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
- package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
- package/dist/agents/tools/help/listFields/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
- package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
- package/dist/agents/tools/query/getAttribute/adapter.js +1 -1
- package/dist/agents/tools/query/getStatistics/adapter.js +1 -1
- package/dist/agents/tools/query/getTopFeatures/adapter.js +1 -1
- package/dist/agents/tools/query/queryFeatures/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
- package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
- package/dist/agents/tools/shared/types.js +1 -1
- package/dist/cdn/24KEZCPF.js +2 -0
- package/dist/cdn/{2UKFCF2J.js → 272R36XK.js} +2 -2
- package/dist/cdn/{FX4LV2S3.js → 2H32MDP2.js} +1 -1
- package/dist/cdn/{VAXH6RUQ.js → 2HNGMLFD.js} +2 -2
- package/dist/cdn/{24TK55FP.js → 2JD3G7IW.js} +2 -2
- package/dist/cdn/{P4CHI7W3.js → 2NOLMOEP.js} +2 -2
- package/dist/cdn/{ZU2FHVNK.js → 2OW3DCUT.js} +2 -2
- package/dist/cdn/2PGZDONH.js +2 -0
- package/dist/cdn/2WY5MPMY.js +2 -0
- package/dist/cdn/{2DWN3SKH.js → 3COVQI26.js} +2 -2
- package/dist/cdn/{VIJVRJHL.js → 3UVQLYUK.js} +2 -2
- package/dist/cdn/{BIEX4MVV.js → 5HNKH5OK.js} +2 -2
- package/dist/cdn/{46DT6BIG.js → 5INBG23U.js} +1 -1
- package/dist/cdn/{YJXRCO4T.js → 5LBUP33F.js} +2 -2
- package/dist/cdn/{UZLQALHY.js → 5PV2GUZW.js} +1 -1
- package/dist/cdn/{YBWRFVA6.js → 5SRRG7WG.js} +2 -2
- package/dist/cdn/{EEHDAYOG.js → 5XZ5VL42.js} +2 -2
- package/dist/cdn/{DI3VGUJY.js → 63OF33IL.js} +2 -2
- package/dist/cdn/{NHWT7CXX.js → 6ELWX4W5.js} +2 -2
- package/dist/cdn/{OKVLGJAG.js → 6J3J7VLW.js} +2 -2
- package/dist/cdn/{AOVJ34QE.js → 6QOSUG64.js} +2 -2
- package/dist/cdn/{GVFJHADC.js → 6UGT2UG5.js} +2 -2
- package/dist/cdn/{JEWJ4M25.js → 7APXFHDF.js} +3 -3
- package/dist/cdn/{QEGO4B2W.js → 7GDMXAF5.js} +2 -2
- package/dist/cdn/7JIXXYZR.js +2 -0
- package/dist/cdn/{X5ET73QZ.js → 7OQK2F7O.js} +2 -2
- package/dist/cdn/{KX6CZEVZ.js → 7XVIZ7HK.js} +2 -2
- package/dist/cdn/{FSLPYC4Y.js → A4ZVCRVF.js} +2 -2
- package/dist/cdn/{OVIQ5NSE.js → AGDGDULE.js} +2 -2
- package/dist/cdn/{TPULIO6I.js → AMA67DVI.js} +2 -2
- package/dist/cdn/AO42IPOX.js +2 -0
- package/dist/cdn/{UOKYHQNO.js → AOT3PM2Q.js} +2 -2
- package/dist/cdn/{EG5BMYZO.js → AQ7KG25Q.js} +2 -2
- package/dist/cdn/{6PK2UPG3.js → AWH4VDPD.js} +2 -2
- package/dist/cdn/AY2ZONWQ.js +2 -0
- package/dist/cdn/{JZPPP4QY.js → BMVPOFHU.js} +2 -2
- package/dist/cdn/BWUQRZPK.js +2 -0
- package/dist/cdn/{XWNZMKQF.js → C3VLDYS2.js} +2 -2
- package/dist/cdn/{PQ2DPOFM.js → C5Q6E7UC.js} +2 -2
- package/dist/cdn/{FDOMMK2M.js → CETIZ4IQ.js} +1 -1
- package/dist/cdn/{TENUVOFJ.js → COANVCKH.js} +2 -2
- package/dist/cdn/{2O52MJ3D.js → D7CRICBG.js} +2 -2
- package/dist/cdn/D7FEOAW3.js +2 -0
- package/dist/cdn/{PGUEODFA.js → DY6MO2CA.js} +2 -2
- package/dist/cdn/EKMCGN6R.js +2 -0
- package/dist/cdn/EUIURCPS.js +2 -0
- package/dist/cdn/{DGCWQYN3.js → FGQH46Z2.js} +2 -2
- package/dist/cdn/FIZMK7GS.js +1 -0
- package/dist/cdn/FONIQ7VF.js +2 -0
- package/dist/cdn/G3KILEGJ.js +2 -0
- package/dist/cdn/{FYZATVB3.js → G7MCIFV2.js} +2 -2
- package/dist/cdn/{SDWWUWAF.js → GGAXXX5X.js} +2 -2
- package/dist/cdn/GS5JDPZH.js +2 -0
- package/dist/cdn/{T3SCINN5.js → H4QWVTEZ.js} +2 -2
- package/dist/cdn/{ZSLHB6MF.js → H6J65TWL.js} +2 -2
- package/dist/cdn/{UHEYPSOR.js → HCPI2RJE.js} +2 -2
- package/dist/cdn/{PCAMBPOA.js → HJOWCZPL.js} +2 -2
- package/dist/cdn/{7HVIVV3O.js → HOMSK66Q.js} +2 -2
- package/dist/cdn/{5REENYPV.js → HTNKDDEV.js} +2 -2
- package/dist/cdn/{6WYVG3JI.js → HU527DML.js} +2 -2
- package/dist/cdn/I37ZJHTM.js +2 -0
- package/dist/cdn/{GHFOAS7T.js → I724KIFI.js} +2 -2
- package/dist/cdn/IH5P2PWJ.js +2 -0
- package/dist/cdn/{C67KQCPS.js → J3T5HB77.js} +2 -2
- package/dist/cdn/{EXLDRGUC.js → JCWFLYB4.js} +2 -2
- package/dist/cdn/{IHP25JWI.js → JSRNLNOE.js} +2 -2
- package/dist/cdn/{MPWEXYYB.js → KDA5VPLO.js} +2 -2
- package/dist/cdn/KRPPMEOF.js +2 -0
- package/dist/cdn/{GBFRJF4F.js → KURNYULZ.js} +2 -2
- package/dist/cdn/{ZKWXHSEQ.js → L46O52F7.js} +2 -2
- package/dist/cdn/{BBB5EJUB.js → L5OYOLWV.js} +3 -3
- package/dist/cdn/{FJV7CI7O.js → LDDP7NSY.js} +2 -2
- package/dist/cdn/{ZQTCPJUV.js → LGIXZLOP.js} +2 -2
- package/dist/cdn/{OGZFST2A.js → LMAIOLS2.js} +2 -2
- package/dist/cdn/{CFAC4FN3.js → LWEKPFV6.js} +2 -2
- package/dist/cdn/{L5IPMRHC.js → M52LKZN7.js} +2 -2
- package/dist/cdn/{AQF6BBWC.js → M5UMOOL2.js} +2 -2
- package/dist/cdn/{HWIM4KWF.js → MHXM37QI.js} +2 -2
- package/dist/cdn/{7X22QXJP.js → MR3R5YHQ.js} +2 -2
- package/dist/cdn/{M6JQGHCE.js → MUSLUFKI.js} +2 -2
- package/dist/cdn/MYLY2ABI.js +2 -0
- package/dist/cdn/{AMP43OT2.js → N2GN5WOI.js} +2 -2
- package/dist/cdn/{RE7MJTEF.js → NAVK5JJ2.js} +3 -3
- package/dist/cdn/NDSYDURO.js +2 -0
- package/dist/cdn/{7ZTYHZIN.js → NK2QRPS6.js} +2 -2
- package/dist/cdn/{GMZUN5SF.js → NYFL2F5L.js} +2 -2
- package/dist/cdn/{PGH7POKS.js → OKDXM5D4.js} +2 -2
- package/dist/cdn/{JFL5IWPK.js → OMUWBY75.js} +2 -2
- package/dist/cdn/{34O57OGV.js → OPQCY33W.js} +1 -1
- package/dist/cdn/{R74ZHFA6.js → OUMTV5H5.js} +1 -1
- package/dist/cdn/{5FDBJI24.js → OZDRETY2.js} +2 -2
- package/dist/cdn/{DYSPEU7W.js → PR4VMSKD.js} +1 -1
- package/dist/cdn/{HSMAXOOA.js → PXBS2FXE.js} +2 -2
- package/dist/cdn/{DJG6DBCU.js → Q7BJGEFH.js} +3 -3
- package/dist/cdn/{XEJFVUNQ.js → QAVDW7A7.js} +1 -1
- package/dist/cdn/{ONQ6JSBJ.js → QBZP6XOE.js} +1 -1
- package/dist/cdn/{OT5ECP4V.js → RFIN7KO6.js} +2 -2
- package/dist/cdn/RNJ7T5GF.js +2 -0
- package/dist/cdn/{BMPBJXD7.js → S6OUM5X2.js} +2 -2
- package/dist/cdn/SG6PAUVR.js +2 -0
- package/dist/cdn/{7MCFHVEH.js → SRXUC4QB.js} +2 -2
- package/dist/cdn/{A22375P3.js → SUMXIUIS.js} +2 -2
- package/dist/cdn/SW3D6QD4.js +2 -0
- package/dist/cdn/{GEFFWUB2.js → T2OYUOSO.js} +1 -1
- package/dist/cdn/T7LYQ56H.js +2 -0
- package/dist/cdn/{DZOQFEOB.js → TFXK2POV.js} +2 -2
- package/dist/cdn/{XQ3NBBQ3.js → TIQUULA4.js} +1 -1
- package/dist/cdn/{LCI5MEDN.js → TOUYGIGK.js} +2 -2
- package/dist/cdn/{RFDMNYTA.js → UJMM5QA4.js} +2 -2
- package/dist/cdn/{5LA77ZBW.js → UMTRLI63.js} +2 -2
- package/dist/cdn/{NPV4MEAZ.js → UP7RW5K2.js} +2 -2
- package/dist/cdn/{XCLICBG7.js → UR2S7L6Z.js} +2 -2
- package/dist/cdn/{CEKOEHB3.js → UWHRBGWN.js} +2 -2
- package/dist/cdn/{UQRBY7ID.js → UXDRYDOD.js} +2 -2
- package/dist/cdn/{JUPTVXLY.js → UZ7XFHYI.js} +2 -2
- package/dist/cdn/V66TS2BB.js +2 -0
- package/dist/cdn/{AAUVOBPS.js → VINKTQFR.js} +1 -1
- package/dist/cdn/{SWXUQFB6.js → VU7IOGNS.js} +2 -2
- package/dist/cdn/{HC5DJL2U.js → W2SIOY2B.js} +2 -2
- package/dist/cdn/{FBARYPZ7.js → W36IUEUB.js} +2 -2
- package/dist/cdn/{5TW2NFES.js → WEBAQIUT.js} +2 -2
- package/dist/cdn/{WSIZ2OTL.js → WHIWOYHN.js} +1 -1
- package/dist/cdn/WOL5YMJ2.js +2 -0
- package/dist/cdn/{66VWTARH.js → X3YFCWQZ.js} +2 -2
- package/dist/cdn/{ICBIUFK7.js → X4EQEKM7.js} +2 -2
- package/dist/cdn/{TJBU5BQK.js → XBWGOD6I.js} +2 -2
- package/dist/cdn/{6E6T6U7W.js → XGDXTTYW.js} +2 -2
- package/dist/cdn/{CDS2HGQY.js → XLHYQNAM.js} +2 -2
- package/dist/cdn/{NEV6OZN3.js → XMQJWPXI.js} +2 -2
- package/dist/cdn/{QT3B5K4R.js → XQUKC4YK.js} +2 -2
- package/dist/cdn/{JEBRN3EU.js → XSH4B7FP.js} +2 -2
- package/dist/cdn/{LK7ZIQW6.js → XVWSIDZV.js} +2 -2
- package/dist/cdn/{J6A4AS7E.js → XYMIFFBW.js} +2 -2
- package/dist/cdn/{MPQ2OZXN.js → Y3ZKMD47.js} +2 -2
- package/dist/cdn/{YPLPDUMB.js → YAANCUW2.js} +2 -2
- package/dist/cdn/{KY7M4WHO.js → YD5LVM7V.js} +2 -2
- package/dist/cdn/{AMURN3LO.js → YGI277SH.js} +2 -2
- package/dist/cdn/{YI6NIHNI.js → YGSDJ4V3.js} +2 -2
- package/dist/cdn/YJEARDAZ.js +2 -0
- package/dist/cdn/{XC3T3Z5R.js → YSEHJQ4L.js} +2 -2
- package/dist/cdn/Z44NI2YQ.js +2 -0
- package/dist/cdn/{74CVYM72.js → ZEDDYT24.js} +2 -2
- package/dist/cdn/{MD2FTKQT.js → ZROI63CW.js} +2 -2
- package/dist/cdn/{UYP5PH5E.js → ZUKM4DGB.js} +2 -2
- package/dist/cdn/ZVVNATCX.js +2 -0
- package/dist/cdn/agent-utils/BaseAgent.js +2 -2
- package/dist/cdn/agent-utils/FunctionAgent.js +2 -2
- package/dist/cdn/agent-utils/LLMAgent.js +2 -2
- package/dist/cdn/agent-utils/SkillAgent.js +2 -2
- package/dist/cdn/agent-utils/WorkflowAgent.js +2 -2
- package/dist/cdn/agent-utils/createSchema.js +2 -2
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -2
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
- package/dist/cdn/agent-utils/tools/FunctionTool.js +2 -2
- package/dist/cdn/agent-utils/tools/MCPToolProvider.js +2 -2
- package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -2
- package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +2 -2
- package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +2 -2
- package/dist/cdn/orchestrator/models/chatModel.js +2 -2
- package/dist/cdn/orchestrator/models/prompts.js +2 -2
- package/dist/cdn/orchestrator/signals.js +2 -2
- package/dist/cdn/orchestrator/state/runtime.js +2 -2
- package/dist/chunks/BaseWorkflow.js +1 -1
- package/dist/chunks/SKILL.js +1 -1
- package/dist/chunks/SKILL2.js +1 -1
- package/dist/chunks/SKILL3.js +1 -1
- package/dist/chunks/SKILL4.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/adapter2.js +1 -1
- package/dist/chunks/aiFactory.js +1 -1
- package/dist/chunks/aiUtilityService.js +1 -1
- package/dist/chunks/arcgisToolRegistry.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
- package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
- package/dist/chunks/converterUtils.js +1 -1
- package/dist/chunks/createSkillAgent.js +1 -1
- package/dist/chunks/data_explore_filter_prompt.js +1 -1
- package/dist/chunks/data_explore_query_prompt.js +1 -1
- package/dist/chunks/embeddings.worker.js +1 -1
- package/dist/chunks/fetchAgentContext.js +1 -1
- package/dist/chunks/fetchService.js +1 -1
- package/dist/chunks/fetchUtils.js +1 -1
- package/dist/chunks/fieldStatistics.js +1 -1
- package/dist/chunks/field_descriptions_prompt.js +1 -1
- package/dist/chunks/formatFeatureAttributes.js +1 -1
- package/dist/chunks/getPrompt.js +1 -1
- package/dist/chunks/graph.js +1 -1
- package/dist/chunks/helpState.js +1 -1
- package/dist/chunks/help_prompt.js +1 -1
- package/dist/chunks/intent_prompt.js +1 -1
- package/dist/chunks/layerQueryToolCalling.js +1 -1
- package/dist/chunks/layerStylingState.js +1 -1
- package/dist/chunks/layer_descriptions_prompt.js +1 -1
- package/dist/chunks/layer_styling_prompt.js +1 -1
- package/dist/chunks/localization.js +1 -1
- package/dist/chunks/mergeWhereClauses.js +1 -1
- package/dist/chunks/modelConfig.js +1 -1
- package/dist/chunks/modelPricing.js +1 -1
- package/dist/chunks/navigationState.js +1 -1
- package/dist/chunks/navigation_intent_prompt.js +1 -1
- package/dist/chunks/navigation_tool_prompt.js +1 -1
- package/dist/chunks/observationSnapshot.js +1 -1
- package/dist/chunks/reducers.js +1 -1
- package/dist/chunks/requireAgentServices.js +1 -1
- package/dist/chunks/resolveFieldNames.js +1 -1
- package/dist/chunks/resolveGeometryFilter.js +1 -1
- package/dist/chunks/runtime.js +2 -2
- package/dist/chunks/runtime2.js +1 -1
- package/dist/chunks/runtimeSpans.js +1 -1
- package/dist/chunks/schema.js +1 -1
- package/dist/chunks/slottableRequestUtils.js +1 -1
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/summarize_query_response_prompt.js +1 -1
- package/dist/chunks/textFormatters.js +1 -1
- package/dist/chunks/toolCallResponse.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utils.js +1 -1
- package/dist/chunks/utils2.js +1 -1
- package/dist/chunks/utils3.js +1 -1
- package/dist/chunks/webmapSchema.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +1 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-log/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-inspector/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-latency/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-panel/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-run/customElement.js +1 -1
- package/dist/components/arcgis-assistant-observation-usage/customElement.js +1 -1
- package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
- package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/orchestrator/embeddings/cosineSimilarity.js +1 -1
- package/dist/orchestrator/embeddings/getEmbeddings.js +1 -1
- package/dist/orchestrator/embeddings/webmapEmbeddings.js +1 -1
- package/dist/orchestrator/models/chatModel.js +1 -1
- package/dist/orchestrator/models/prompts.js +1 -1
- package/dist/orchestrator/orchestrator/orchestrator.js +1 -1
- package/dist/orchestrator/orchestrator/orchestratorEvents.js +1 -1
- package/dist/orchestrator/signals.js +1 -1
- package/dist/orchestrator/state/runtime.js +1 -1
- package/dist/orchestrator/state/types.js +1 -1
- package/dist/orchestrator/types.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +5 -5
- package/dist/cdn/2UDDCWNW.js +0 -2
- package/dist/cdn/434TAA3J.js +0 -2
- package/dist/cdn/4KFTUBFL.js +0 -2
- package/dist/cdn/AO2G4EXA.js +0 -2
- package/dist/cdn/AWPLRVPS.js +0 -2
- package/dist/cdn/C76HLPKU.js +0 -2
- package/dist/cdn/CADNOKIK.js +0 -2
- package/dist/cdn/CHHC6YNW.js +0 -2
- package/dist/cdn/DBRBT54R.js +0 -2
- package/dist/cdn/DJKEGIQZ.js +0 -2
- package/dist/cdn/EGSD465U.js +0 -2
- package/dist/cdn/HLWG7OIR.js +0 -2
- package/dist/cdn/KKWCHNYQ.js +0 -2
- package/dist/cdn/M2G44RTS.js +0 -2
- package/dist/cdn/MB7SEHPZ.js +0 -2
- package/dist/cdn/MC2V5WT3.js +0 -2
- package/dist/cdn/MZFWD5CQ.js +0 -2
- package/dist/cdn/NMFEXE4D.js +0 -2
- package/dist/cdn/OYHYHALE.js +0 -2
- package/dist/cdn/QUZTFUWM.js +0 -1
- package/dist/cdn/RF6HWZMB.js +0 -2
- package/dist/cdn/RFPTOFM4.js +0 -2
- package/dist/cdn/RKURZ5T2.js +0 -2
- package/dist/cdn/SJ4UMNIS.js +0 -2
- package/dist/cdn/USPB2QBX.js +0 -2
- package/dist/cdn/V6EX4YCY.js +0 -2
- package/dist/cdn/VA4M72JC.js +0 -2
- package/dist/cdn/VQ67NANV.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as Y}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{a as Y}from"./OUMTV5H5.js";var X=globalThis,Z=X.ShadowRoot&&(X.ShadyCSS===void 0||X.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,vt=Symbol(),kt=new WeakMap,I=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==vt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Z&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=kt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&kt.set(e,t))}return t}toString(){return this.cssText}},jt=o=>new I(typeof o=="string"?o:o+"",void 0,vt),_e=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((s,r,n)=>s+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[n+1],o[0]);return new I(e,o,vt)},Ht=(o,t)=>{if(Z)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),r=X.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=e.cssText,o.appendChild(s)}},Et=Z?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return jt(e)})(o):o;var{is:Ae,defineProperty:Ce,getOwnPropertyDescriptor:we,getOwnPropertyNames:Oe,getOwnPropertySymbols:Te,getPrototypeOf:Se}=Object,et=globalThis,Vt=et.trustedTypes,Pe=Vt?Vt.emptyScript:"",Ne=et.reactiveElementPolyfillSupport,k=(o,t)=>o,tt={toAttribute(o,t){switch(t){case Boolean:o=o?Pe:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},j=(o,t)=>!Ae(o,t),zt={attribute:!0,type:String,converter:tt,reflect:!1,useDefault:!1,hasChanged:j};Symbol.metadata??=Symbol("metadata"),et.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=zt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),r=this.getPropertyDescriptor(t,s,e);r!==void 0&&Ce(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){let{get:r,set:n}=we(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:r,set(i){let a=r?.call(this);n?.call(this,i),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??zt}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;let t=Se(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){let e=this.properties,s=[...Oe(e),...Te(e)];for(let r of s)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,r]of e)this.elementProperties.set(s,r)}this._$Eh=new Map;for(let[e,s]of this.elementProperties){let r=this._$Eu(e,s);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let r of s)e.unshift(Et(r))}else t!==void 0&&e.push(Et(t));return e}static _$Eu(t,e){let s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ht(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){let s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(r!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute!==void 0?s.converter:tt).toAttribute(e,s.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let s=this.constructor,r=s._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=s.getPropertyOptions(r),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:tt;this._$Em=r;let a=i.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(t!==void 0){let i=this.constructor;if(r===!1&&(n=this[t]),s??=i.getPropertyOptions(t),!((s.hasChanged??j)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[r,n]of s){let{wrapped:i}=n,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[k("elementProperties")]=new Map,_[k("finalized")]=new Map,Ne?.({ReactiveElement:_}),(et.reactiveElementVersions??=[]).push("2.1.2");var bt=globalThis,Bt=o=>o,st=bt.trustedTypes,Wt=st?st.createPolicy("lit-html",{createHTML:o=>o}):void 0,_t="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+A,De=`<${At}>`,T=document,V=()=>T.createComment(""),z=o=>o===null||typeof o!="object"&&typeof o!="function",Ct=Array.isArray,Qt=o=>Ct(o)||typeof o?.[Symbol.iterator]=="function",$t=`[
|
|
3
3
|
\f\r]`,H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ft=/-->/g,qt=/>/g,w=RegExp(`>|${$t}(?:([^\\s"'>=/]+)(${$t}*=${$t}*(?:[^
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gt=/'/g,Kt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,wt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),ds=wt(1),ps=wt(2),us=wt(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Jt=new WeakMap,O=T.createTreeWalker(T,129);function Xt(o,t){if(!Ct(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wt!==void 0?Wt.createHTML(t):t}var Zt=(o,t)=>{let e=o.length-1,s=[],r,n=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let l=o[a],h,u,c=-1,m=0;for(;m<l.length&&(i.lastIndex=m,u=i.exec(l),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Ft:u[1]!==void 0?i=qt:u[2]!==void 0?(Yt.test(u[2])&&(r=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=r??H,c=-1):u[1]===void 0?c=-2:(c=i.lastIndex-u[2].length,h=u[1],i=u[3]===void 0?w:u[3]==='"'?Kt:Gt):i===Kt||i===Gt?i=w:i===Ft||i===qt?i=H:(i=w,r=void 0);let v=i===w&&o[a+1].startsWith("/>")?" ":"";n+=i===H?l+De:c>=0?(s.push(h),l.slice(0,c)+_t+l.slice(c)+A+v):l+A+(c===-2?a:v)}return[Xt(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},B=class o{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0,a=t.length-1,l=this.parts,[h,u]=Zt(t,e);if(this.el=o.createElement(h,s),O.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=O.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let c of r.getAttributeNames())if(c.endsWith(_t)){let m=u[i++],v=r.getAttribute(c).split(A),C=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?rt:C[1]==="?"?nt:C[1]==="@"?it:P}),r.removeAttribute(c)}else c.startsWith(A)&&(l.push({type:6,index:n}),r.removeAttribute(c));if(Yt.test(r.tagName)){let c=r.textContent.split(A),m=c.length-1;if(m>0){r.textContent=st?st.emptyScript:"";for(let v=0;v<m;v++)r.append(c[v],V()),O.nextNode(),l.push({type:2,index:++n});r.append(c[m],V())}}}else if(r.nodeType===8)if(r.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=r.data.indexOf(A,c+1))!==-1;)l.push({type:7,index:n}),c+=A.length-1}n++}}static createElement(t,e){let s=T.createElement("template");return s.innerHTML=t,s}};function S(o,t,e=o,s){if(t===f)return t;let r=s!==void 0?e._$Co?.[s]:e._$Cl,n=z(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=r:e._$Cl=r),r!==void 0&&(t=S(o,r._$AS(o,t.values),r,s)),t}var ot=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??T).importNode(e,!0);O.currentNode=r;let n=O.nextNode(),i=0,a=0,l=s[0];for(;l!==void 0;){if(i===l.index){let h;l.type===2?h=new L(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new at(n,this,t)),this._$AV.push(h),l=s[++a]}i!==l?.index&&(n=O.nextNode(),i++)}return O.currentNode=T,r}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),z(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Xt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new ot(r,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Jt.get(t.strings);return e===void 0&&Jt.set(t.strings,e=new B(t)),e}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,r=0;for(let n of t)r===e.length?e.push(s=new o(this.O(V()),this.O(V()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=Bt(t).nextSibling;Bt(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,r){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!z(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,l,h;for(t=n[0],l=0;l<n.length-1;l++)h=S(this,a[s+l],e,l),h===f&&(h=this._$AH[l]),i||=!z(h)||h!==this._$AH[l],h===d?t=d:t!==d&&(t+=(h??"")+n[l+1]),this._$AH[l]=h}i&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},rt=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},nt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},it=class extends P{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let s=this._$AH,r=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},at=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},te={M:_t,P:A,A:At,C:1,L:Zt,R:ot,D:Qt,V:S,I:L,H:P,N:nt,U:it,B:rt,F:at},xe=bt.litHtmlPolyfillSupport;xe?.(B,L),(bt.litHtmlVersions??=[]).push("3.3.2");var Ot=(o,t,e)=>{let s=e?.renderBefore??t,r=s._$litPart$;if(r===void 0){let n=e?.renderBefore??null;s._$litPart$=r=new L(t.insertBefore(V(),n),n,void 0,e??{})}return r._$AI(o),r};var Tt=globalThis,E=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};E._$litElement$=!0,E.finalized=!0,Tt.litElementHydrateSupport?.({LitElement:E});var Le=Tt.litElementPolyfillSupport;Le?.({LitElement:E});(Tt.litElementVersions??=[]).push("4.2.2");var ee=new Set,se;var oe=o=>typeof o=="string"?o:"el"in o?o.el.localName:"localName"in o?o.localName:o.declaredClass,Os=(o,t,e,s)=>{let r=oe(t);if(s?.once){let i=`${o}${r}${e}`;if(ee.has(i))return;ee.add(i)}let n;if(s?.detail){n={};for(let[i,a]of Object.entries(s.detail))if((typeof a=="object"||typeof a=="function")&&a!==null){let l=new WeakRef(a);Object.defineProperty(n,i,{enumerable:!0,get(){return l.deref()}})}else n[i]=a;se?.log.interceptors?.forEach(i=>i(o,r,e,n)),console[o](`[${r}]: ${e}`,n)}else se?.log.interceptors?.forEach(i=>i(o,r,e)),console[o](`[${r}]: ${e}`)},re=o=>{let t=`[${oe(o)}] `;return e=>{let s=e instanceof Error&&e.message?e:new Error(String(e));s.message=`${t}${s.message}`,setTimeout(()=>{throw e})}};var p=(o,t,...e)=>{try{return o?.call(t,...e)}catch(s){console.error(s,o)}},W=async(o,t,...e)=>{try{return await o?.call(t,...e)}catch(s){console.error(s,o)}};var q=Symbol.for("controller"),Re=o=>typeof o=="object"&&o!==null&&(q in o||"hostConnected"in o||"hostDisconnected"in o||"hostUpdate"in o||"hostUpdated"in o),Ps=o=>typeof o?.then=="function";var F,D=o=>{F!==o&&(F=o,queueMicrotask(()=>F===o?F=void 0:0))},G=o=>F,N=[],ct=o=>{if(o===void 0){N=[];return}let t=N.indexOf(o);N=t===-1?[...N,o]:N.slice(0,t+1),queueMicrotask(()=>N=[])},ne=()=>N,R,Ns=o=>{R!==o&&(R=o,queueMicrotask(()=>R===o?R=void 0:0))},Ue=()=>{let o=R;return R=void 0,o},ie=async(o,t)=>{let e=ht(o);if(e===void 0)return o;if(await e.ready,typeof t=="function"){let s=e.watchExports(r=>t(r,s))}return e.exports},ae=async o=>{let t=ht(o);return await t.ready,t},ht=o=>{let e=G().manager.X(o);if(e!==void 0)return e;if(Re(o))return o;let s=Ue();if(s!==void 0)return s},lt=!1,Ds=o=>{lt=!0;try{return o()}finally{lt=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}};var le=(o,t)=>{let e=t>Me?Ie:t/ke,s=0,r=setInterval(()=>{s+=e,s>=t&&(clearInterval(r),o())},e);return r},Me=4e3,Ie=2e3,ke=4;var je=(o,t,e)=>{let s=Object.keys(o),r=s.length;U===void 0&&queueMicrotask(M),U??=new Map;let n=U.get(o);return n===void 0&&(n={callbacks:[],keyCount:r},U.set(o,n)),n.keyCount!==r&&(n.callbacks.forEach(i=>i(s)),n.callbacks=[],n.keyCount=r),n.callbacks.push(i=>{let a=h=>p(t,null,h),l=i[r];l===void 0?a(void 0):o[l]===e?a(l):a(void 0)}),e},U,M=()=>{U?.forEach(({callbacks:o},t)=>{let e=Object.keys(t);o.forEach(s=>s(e))}),U=void 0},He=(o,t,e)=>{let s=o.manager;return s.V!==d&&s.V!==e&&s.S(void 0,void 0),s.T.length===0&&queueMicrotask(()=>s.S(void 0,void 0)),s.V=e,s.T.push((r,n)=>p(t,void 0,e===n?r:void 0)),e},Ve=(o=[G(),...ne()],t,e)=>{let s=Array.isArray(o)?o:[o],r=s.length+1,n=i=>{r-=1,i!==void 0&&(r=Math.min(r,0)),r===0&&t(i)};s.forEach(i=>je(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of s)if("manager"in i&&i.manager.component===i){He(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},ze=(o="",t={},e=G())=>{let s={emit:r=>{o===""&&M();let n=new CustomEvent(o,{detail:r,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(n),n}};return o===""&&Ve(void 0,r=>o=r.key,s),s},Be=ze.bind(null,""),de;de=q;var St=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#r=[],this.#n=[],this.#l=[],this.#c=[],this.#d=[],this.#i=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[de]=!0,this.#h=[];let e=this,s=t??G(new.target.name);e.#o=s,e.ready=e.P.promise,e.#a=he(e),e.component=s,e.#o.addController(e),e.#o.manager===void 0||(ct(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#r;#n;#l;#c;#d;#i;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(re(this.#o))}#a;get exports(){return this.#a}set exports(t){let e=this.#a;e!==t&&(this.#a=t,this.#h.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#a=e?he(t):t,this.#h.forEach(p)}#h;watchExports(t){let e=()=>t(this.#a);return this.#h.push(e),()=>{this.#h.splice(this.#h.indexOf(e),1)}}get use(){return D(this.#o),ie}get useRef(){return D(this.#o),ae}get useRefSync(){return D(this.#o),ht}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#r.push(t)}onUpdate(t){this.#n.push(t)}onUpdated(t){this.#l.push(t)}onDestroy(t){this.#c.push(t)}onLifecycle(t){this.#d.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#i.forEach(p),t.#i=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#a)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#r.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#n.forEach(ce,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#l.forEach(ce,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#c.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#d.forEach(this.#u,this)}#u(t){D(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(r=>{typeof r=="function"?this.#i.push(r):typeof r=="object"&&typeof r.remove=="function"&&this.#i.push(r.remove)})}};function ce(o){p(o,void 0,this)}var he=o=>{if(typeof o!="object"&&typeof o!="function"||o===null)return o;let t={get(s,r,n){if(!((r==="exports"||r==="_exports")&&r in s&&s[r]===e)&&(r in s||r in Promise.prototype||typeof r=="symbol"))return typeof s=="function"?s[r]:Reflect.get(s,r,n)}},e=new Proxy(o,t);return e};var pe=St;var{I:zs}=te;var dt=o=>o.strings===void 0;var We={},ue=(o,t=We)=>o._$AH=t;var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=o=>(...t)=>({_$litDirective$:o,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),K(s,t);return!0},pt=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},fe=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Ge(t)}};function Fe(o){this._$AN!==void 0?(pt(this),this._$AM=o,fe(this)):this._$AM=o}function qe(o,t=!1,e=0){let s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)K(s[n],!1),pt(s[n]);else s!=null&&(K(s,!1),pt(s));else K(this,o)}var Ge=o=>{o.type==y.CHILD&&(o._$AP??=qe,o._$AQ??=Fe)},ut=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),pt(this))}setValue(t){if(dt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Xs=()=>new Nt,Nt=class{},Pt=new WeakMap,Dt=$(class extends ut{render(o){return d}update(o,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),d}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Pt.get(t);e===void 0&&(e=new WeakMap,Pt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Pt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Lt=o=>{let t=o;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(o),(e.I??e._postLoad).promise}return!1},Rt={};function Ut(){}function Mt(o){for(let t of["Associated","Disabled","Reset","StateRestore"]){let e=`orm${t}Callback`;o.prototype["f"+e]=async function(...s){await this.componentOnReady(),(this.el??this).dispatchEvent(new CustomEvent(`luminaF${e}`,{detail:s}))}}}var Je=(o,t)=>function(s,r){if(!globalThis.customElements)return;let i=(r??s??{}).resourcesUrl;i&&o.setAssetPath(i);for(let[a,[l,h="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[c,m,v]=h.split(";"),C=c?c?.split(",").map(Qe):void 0,gt=C?.map(([x])=>x),Q=class extends xt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,x])=>x).filter(x=>x!=="")}static{this.C=gt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=o}constructor(){!Q.B&&(Q.B=l(),Q.F()),super()}};customElements.define(a,Q)}},ft=Object.defineProperty,Qe=o=>{let t=o.split(":");return t.length===1?[t[0],Y(t[0])]:t},Ye=globalThis.HTMLElement??Ut,xt=class extends Ye{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(s=>{Object.hasOwn(t,s)&&(t.#e[s]=t[s],delete t[s])}),e.A?t.#r({a:e.A}):e.B.then(async s=>{await e.K.p,t.#r(await(s.default?.then(r=>typeof r=="function"?{a:r}:r)??s))}).catch(s=>{t.H.reject(s),setTimeout(()=>{throw s})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ft(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ft(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ft(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{Mt(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,s){this.#t?.attributeChangedCallback(t,e,s),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=Lt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#r(t){let e=this.constructor,s=e.L,r=this.#e,n=Object.values(t).find(c=>c.L===s),i=`${s}--lazy`,a=n;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);Ze(a),!e.A&&(e.A=n,customElements.define(i,n)),n.N=this;let h=document.createElement(i);n.N=void 0,this.#t=h,this.#e=h,this.#s.forEach(c=>h.attributeChangedCallback(c,null,this.getAttribute(c))),Object.entries(r).forEach(Xe,h);let u=this.isConnected;(u||this.G)&&(h.connectedCallback?.(),u||h.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function Xe([o,t]){this[o]=t}var Ze=o=>{let t=o.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(r,n){e.setAttribute.call(this.el,r,n)},t.removeAttribute=function(r){e.removeAttribute.call(this.el,r)},t.hasAttribute=function(r){return e.hasAttribute.call(this.el,r)},ft(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var mt=class extends pe{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=yt in t&&typeof t.destroy=="function",E.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${yt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),M();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),ct(void 0),D(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>{this.#e.destroy()};this.#t=le(t,ts)}}S(t,e){let s=this.T;this.V=d,this.T=[],s.forEach(r=>r(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},ts=1e3,yt="autoDestroyDisabled";var ye=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let e=o.element.classList;for(let s of this.st)s in t||(e.remove(s),this.st.delete(s));for(let s in t){let r=!!t[s];r===this.st.has(s)||this.nt?.has(s)||(r?(e.add(s),this.st.add(s)):(e.remove(s),this.st.delete(s)))}return f}});var ge="important",es=" !"+ge,ve=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let s=o[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(let s in t){let r=t[s];if(r!=null){this.ft.add(s);let n=typeof r=="string"&&r.endsWith(es);s.includes("-")||n?e.setProperty(s,n?r.slice(0,-11):r,n?ge:""):e[s]=r}}return f}});var ss=$(class extends g{constructor(o){if(super(o),o.type!==y.PROPERTY&&o.type!==y.ATTRIBUTE&&o.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dt(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===f||t===d)return t;let e=o.element,s=o.name;if(o.type===y.PROPERTY){if(t===e[s])return f}else if(o.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(s))return f}else if(o.type===y.ATTRIBUTE&&e.getAttribute(s)===t+"")return f;return ue(o),t}});var Ee=class o extends E{constructor(){super(),this.M=[],this.manager=new mt(this);let t=this,e=t.constructor,s=e.N,r=e.K.o,n=o.prototype.shouldUpdate;t.#r=s?.H??new b,t.I=s?.I??new b,t.J=s?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=s??t,t.#s=t.enableUpdating,t.enableUpdating=Ut,t.shouldUpdate!==n&&(t.#e=t.shouldUpdate,t.shouldUpdate=n),r&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,r()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),s=this.shadowRootOptions===Rt;return this.K?.commonStyles===void 0||s?e:[this.K.commonStyles,...e]}static createProperty(t,e){let s=typeof e=="number"?e:Array.isArray(e)?e[0]:0,r=Array.isArray(e)?e[1]:void 0,n=r?.hasChanged??j,i={attribute:s&1&&typeof t=="string"?Y(t):!1,reflect:!!(s&2),type:s&4?Boolean:s&8?Number:void 0,state:!!(s&16),readOnly:!!(s&32),noAccessor:!!(s&64),useDefault:!!(s&128),c:!1,...r,hasChanged(a,l){let h=n(a,l);return i.c=h,h}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,s){let r=this.K,n=super.getPropertyDescriptor(t,e,s);return s.d=n,{...n,get(){return r.t?.(this.#t.get(t)),n.get?.call(this)},set(i){let a=this.manager;if(s.readOnly&&!lt&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);n.set.call(this,i??void 0),s.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(M(),a?.S(t,i))}}}static{this.lumina=!0}static{Mt(this)}#t;#e;#s;#r;#n;#l;get elementInternals(){return this.#l??=this.el.attachInternals(),this.#l}connectedCallback(){this.hasAttribute("defer-hydration")||this.#c(!0)}#c(t){let e=this.constructor.K.c?.(()=>this.requestUpdate());this.#n=e;let s=!this.manager.connectedCalled;t&&super.connectedCallback(),s?queueMicrotask(()=>this.#i().catch(r=>{this.#r.reject(r),setTimeout(()=>{throw r})})):e&&this.requestUpdate()}#d(t){try{this.#n.clear(),this.constructor.K.r(this.#n,()=>super.update(t))}catch(e){throw this.#n.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#n?.destroy(),this.#n=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,s=e.shadowRootOptions,n=t??(s===Rt?this.el:this.el.attachShadow(s));if(t)return this.manager.connectedCalled||this.#c(!1),E.prototype.createRenderRoot.call(this),t;if(this.isConnected){let i=n.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return n}async#i(){let t=this.el.G??Lt(this.el);t&&await t;let e=[];for(let r of this.M)"triggerLoad"in r?e.push(r.triggerLoad()):e.push(W(r.hostLoad,r));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(r=>r.has(yt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await 0;let s=this.J.filter(r=>!r.manager?.loadedCalled);s.length&&await Promise.allSettled(s.map(async r=>await r.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let r of this.M)"triggerLoaded"in r?r.triggerLoaded():p(r.hostLoaded,r);this.loaded?.(),this.#r.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#n?this.#d(t):super.update(t)}listen(t,e,s){let r=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,r,s),()=>this.el.removeEventListener(t,r,s)))}listenOn(t,e,s,r){let n=s?.bind(this)??s;this.manager.onLifecycle(()=>(t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)))}async componentOnReady(){return await this.#r.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var be=o=>{let t,e=r=>{t=new URL(r,globalThis.location?.href||void 0).href},s={...o,getAssetPath(r){let n=new URL(r,t);return n.origin!==globalThis.location?.origin?n.href:n.pathname},setAssetPath:e,customElement(r,n){n.K=s,n.L=r,customElements.get(r)||customElements.define(r,n)}};return e(o.defaultAssetPath),s};var $r=o=>typeof o=="object"&&o!=null?ye(o):o,br=o=>typeof o=="object"&&o!=null?ve(o):o;var It=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(r){return e.#t.call(this,r)}}render(t){return typeof t=="function"?(this.#t=t,Dt(this.#e)):Dt(t)}},_r=$(It);var Ar=d;var J=be({defaultAssetPath:"https://jsdev.arcgis.com/5.2.0-next/ai-components/",hydratedAttribute:"hydrated"}),{customElement:Sr,getAssetPath:Pr,setAssetPath:Nr}=J;J.t=void 0;J.o=void 0;J.c=void 0;J.r=void 0;export{Ps as a,D as b,ct as c,ne as d,Ns as e,Ds as f,_e as g,ds as h,f as i,d as j,Ot as k,Os as l,re as m,Ve as n,Be as o,St as p,Je as q,y as r,$ as s,g as t,ue as u,Xs as v,Dt as w,Ee as x,$r as y,br as z,Ar as A,J as B,Sr as C,Pr as D};
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Gt=/'/g,Kt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,wt=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),ds=wt(1),ps=wt(2),us=wt(3),f=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Jt=new WeakMap,O=T.createTreeWalker(T,129);function Xt(o,t){if(!Ct(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wt!==void 0?Wt.createHTML(t):t}var Zt=(o,t)=>{let e=o.length-1,s=[],r,n=t===2?"<svg>":t===3?"<math>":"",i=H;for(let a=0;a<e;a++){let l=o[a],h,u,c=-1,m=0;for(;m<l.length&&(i.lastIndex=m,u=i.exec(l),u!==null);)m=i.lastIndex,i===H?u[1]==="!--"?i=Ft:u[1]!==void 0?i=qt:u[2]!==void 0?(Yt.test(u[2])&&(r=RegExp("</"+u[2],"g")),i=w):u[3]!==void 0&&(i=w):i===w?u[0]===">"?(i=r??H,c=-1):u[1]===void 0?c=-2:(c=i.lastIndex-u[2].length,h=u[1],i=u[3]===void 0?w:u[3]==='"'?Kt:Gt):i===Kt||i===Gt?i=w:i===Ft||i===qt?i=H:(i=w,r=void 0);let v=i===w&&o[a+1].startsWith("/>")?" ":"";n+=i===H?l+De:c>=0?(s.push(h),l.slice(0,c)+_t+l.slice(c)+A+v):l+A+(c===-2?a:v)}return[Xt(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},B=class o{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0,a=t.length-1,l=this.parts,[h,u]=Zt(t,e);if(this.el=o.createElement(h,s),O.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=O.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let c of r.getAttributeNames())if(c.endsWith(_t)){let m=u[i++],v=r.getAttribute(c).split(A),C=/([.?@])?(.*)/.exec(m);l.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?rt:C[1]==="?"?nt:C[1]==="@"?it:P}),r.removeAttribute(c)}else c.startsWith(A)&&(l.push({type:6,index:n}),r.removeAttribute(c));if(Yt.test(r.tagName)){let c=r.textContent.split(A),m=c.length-1;if(m>0){r.textContent=st?st.emptyScript:"";for(let v=0;v<m;v++)r.append(c[v],V()),O.nextNode(),l.push({type:2,index:++n});r.append(c[m],V())}}}else if(r.nodeType===8)if(r.data===At)l.push({type:2,index:n});else{let c=-1;for(;(c=r.data.indexOf(A,c+1))!==-1;)l.push({type:7,index:n}),c+=A.length-1}n++}}static createElement(t,e){let s=T.createElement("template");return s.innerHTML=t,s}};function S(o,t,e=o,s){if(t===f)return t;let r=s!==void 0?e._$Co?.[s]:e._$Cl,n=z(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,s)),s!==void 0?(e._$Co??=[])[s]=r:e._$Cl=r),r!==void 0&&(t=S(o,r._$AS(o,t.values),r,s)),t}var ot=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??T).importNode(e,!0);O.currentNode=r;let n=O.nextNode(),i=0,a=0,l=s[0];for(;l!==void 0;){if(i===l.index){let h;l.type===2?h=new L(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new at(n,this,t)),this._$AV.push(h),l=s[++a]}i!==l?.index&&(n=O.nextNode(),i++)}return O.currentNode=T,r}p(t){let e=0;for(let s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},L=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=S(this,t,e),z(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==f&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Qt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:s}=t,r=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=B.createElement(Xt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new ot(r,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=Jt.get(t.strings);return e===void 0&&Jt.set(t.strings,e=new B(t)),e}k(t){Ct(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,s,r=0;for(let n of t)r===e.length?e.push(s=new o(this.O(V()),this.O(V()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let s=Bt(t).nextSibling;Bt(t).remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,r){let n=this.strings,i=!1;if(n===void 0)t=S(this,t,e,0),i=!z(t)||t!==this._$AH&&t!==f,i&&(this._$AH=t);else{let a=t,l,h;for(t=n[0],l=0;l<n.length-1;l++)h=S(this,a[s+l],e,l),h===f&&(h=this._$AH[l]),i||=!z(h)||h!==this._$AH[l],h===d?t=d:t!==d&&(t+=(h??"")+n[l+1]),this._$AH[l]=h}i&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},rt=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},nt=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},it=class extends P{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=S(this,t,e,0)??d)===f)return;let s=this._$AH,r=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==d&&(s===d||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},at=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}},te={M:_t,P:A,A:At,C:1,L:Zt,R:ot,D:Qt,V:S,I:L,H:P,N:nt,U:it,B:rt,F:at},xe=bt.litHtmlPolyfillSupport;xe?.(B,L),(bt.litHtmlVersions??=[]).push("3.3.2");var Ot=(o,t,e)=>{let s=e?.renderBefore??t,r=s._$litPart$;if(r===void 0){let n=e?.renderBefore??null;s._$litPart$=r=new L(t.insertBefore(V(),n),n,void 0,e??{})}return r._$AI(o),r};var Tt=globalThis,E=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ot(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return f}};E._$litElement$=!0,E.finalized=!0,Tt.litElementHydrateSupport?.({LitElement:E});var Le=Tt.litElementPolyfillSupport;Le?.({LitElement:E});(Tt.litElementVersions??=[]).push("4.2.2");var ee=new Set,se;var oe=o=>typeof o=="string"?o:"el"in o?o.el.localName:"localName"in o?o.localName:o.declaredClass,Os=(o,t,e,s)=>{let r=oe(t);if(s?.once){let i=`${o}${r}${e}`;if(ee.has(i))return;ee.add(i)}let n;if(s?.detail){n={};for(let[i,a]of Object.entries(s.detail))if((typeof a=="object"||typeof a=="function")&&a!==null){let l=new WeakRef(a);Object.defineProperty(n,i,{enumerable:!0,get(){return l.deref()}})}else n[i]=a;se?.log.interceptors?.forEach(i=>i(o,r,e,n)),console[o](`[${r}]: ${e}`,n)}else se?.log.interceptors?.forEach(i=>i(o,r,e)),console[o](`[${r}]: ${e}`)},re=o=>{let t=`[${oe(o)}] `;return e=>{let s=e instanceof Error&&e.message?e:new Error(String(e));s.message=`${t}${s.message}`,setTimeout(()=>{throw e})}};var p=(o,t,...e)=>{try{return o?.call(t,...e)}catch(s){console.error(s,o)}},W=async(o,t,...e)=>{try{return await o?.call(t,...e)}catch(s){console.error(s,o)}};var q=Symbol.for("controller"),Re=o=>typeof o=="object"&&o!==null&&(q in o||"hostConnected"in o||"hostDisconnected"in o||"hostUpdate"in o||"hostUpdated"in o),Ps=o=>typeof o?.then=="function";var F,D=o=>{F!==o&&(F=o,queueMicrotask(()=>F===o?F=void 0:0))},G=o=>F,N=[],ct=o=>{if(o===void 0){N=[];return}let t=N.indexOf(o);N=t===-1?[...N,o]:N.slice(0,t+1),queueMicrotask(()=>N=[])},ne=()=>N,R,Ns=o=>{R!==o&&(R=o,queueMicrotask(()=>R===o?R=void 0:0))},Ue=()=>{let o=R;return R=void 0,o},ie=async(o,t)=>{let e=ht(o);if(e===void 0)return o;if(await e.ready,typeof t=="function"){let s=e.watchExports(r=>t(r,s))}return e.exports},ae=async o=>{let t=ht(o);return await t.ready,t},ht=o=>{let e=G().manager.X(o);if(e!==void 0)return e;if(Re(o))return o;let s=Ue();if(s!==void 0)return s},lt=!1,Ds=o=>{lt=!0;try{return o()}finally{lt=!1}};var b=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}};var le=(o,t)=>{let e=t>Me?Ie:t/ke,s=0,r=setInterval(()=>{s+=e,s>=t&&(clearInterval(r),o())},e);return r},Me=4e3,Ie=2e3,ke=4;var je=(o,t,e)=>{let s=Object.keys(o),r=s.length;U===void 0&&queueMicrotask(M),U??=new Map;let n=U.get(o);return n===void 0&&(n={callbacks:[],keyCount:r},U.set(o,n)),n.keyCount!==r&&(n.callbacks.forEach(i=>i(s)),n.callbacks=[],n.keyCount=r),n.callbacks.push(i=>{let a=h=>p(t,null,h),l=i[r];l===void 0?a(void 0):o[l]===e?a(l):a(void 0)}),e},U,M=()=>{U?.forEach(({callbacks:o},t)=>{let e=Object.keys(t);o.forEach(s=>s(e))}),U=void 0},He=(o,t,e)=>{let s=o.manager;return s.V!==d&&s.V!==e&&s.S(void 0,void 0),s.T.length===0&&queueMicrotask(()=>s.S(void 0,void 0)),s.V=e,s.T.push((r,n)=>p(t,void 0,e===n?r:void 0)),e},Ve=(o=[G(),...ne()],t,e)=>{let s=Array.isArray(o)?o:[o],r=s.length+1,n=i=>{r-=1,i!==void 0&&(r=Math.min(r,0)),r===0&&t(i)};s.forEach(i=>je(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!1}),e));for(let i of s)if("manager"in i&&i.manager.component===i){He(i,a=>n(a===void 0?void 0:{key:a,host:i,isReactive:!0}),e);break}return e},ze=(o="",t={},e=G())=>{let s={emit:r=>{o===""&&M();let n=new CustomEvent(o,{detail:r,cancelable:!0,bubbles:!0,composed:!0,...t});return e.el.dispatchEvent(n),n}};return o===""&&Ve(void 0,r=>o=r.key,s),s},Be=ze.bind(null,""),de;de=q;var St=class{constructor(t){this.#t=[],this.#e=[],this.#s=[],this.#r=[],this.#n=[],this.#l=[],this.#c=[],this.#d=[],this.#i=[],this.#p=!1,this.P=new b,this.connectedCalled=!1,this.loadedCalled=!1,this[de]=!0,this.#h=[];let e=this,s=t??G(new.target.name);e.#o=s,e.ready=e.P.promise,e.#a=he(e),e.component=s,e.#o.addController(e),e.#o.manager===void 0||(ct(e),queueMicrotask(()=>e.catchUpLifecycle()))}#t;#e;#s;#r;#n;#l;#c;#d;#i;#p;#o;catchUpLifecycle(){let{manager:t}=this.#o;t.connectedCalled&&!this.connectedCalled&&this.triggerConnected(),t.#p&&this.triggerLoad().then(()=>t.loadedCalled&&this.triggerLoaded()).catch(re(this.#o))}#a;get exports(){return this.#a}set exports(t){let e=this.#a;e!==t&&(this.#a=t,this.#h.forEach(p),this.connectedCalled&&this.O!==!1&&this.#o.requestUpdate(this.O,e)),this.P.resolve(t)}setProvisionalExports(t,e=!0){this.#a=e?he(t):t,this.#h.forEach(p)}#h;watchExports(t){let e=()=>t(this.#a);return this.#h.push(e),()=>{this.#h.splice(this.#h.indexOf(e),1)}}get use(){return D(this.#o),ie}get useRef(){return D(this.#o),ae}get useRefSync(){return D(this.#o),ht}controllerRemoved(){this.#o.el.isConnected&&this.triggerDisconnected(),this.triggerDestroy()}onConnected(t){this.#t.push(t)}onDisconnected(t){this.#e.push(t)}onLoad(t){this.#s.push(t)}onLoaded(t){this.#r.push(t)}onUpdate(t){this.#n.push(t)}onUpdated(t){this.#l.push(t)}onDestroy(t){this.#c.push(t)}onLifecycle(t){this.#d.push(t),this.connectedCalled&&this.#o.el.isConnected&&this.#u(t)}triggerConnected(){let t=this;t.hostConnected&&p(t.hostConnected,t),t.#t.forEach(p),t.triggerLifecycle(),t.connectedCalled=!0}triggerDisconnected(){let t=this;t.hostDisconnected&&p(t.hostDisconnected,t),t.#e.forEach(p),t.#i.forEach(p),t.#i=[]}async triggerLoad(){if(this.#p)return;this.#p=!0;let t=this;t.hostLoad&&await W(t.hostLoad,t),this.#s.length>0&&await Promise.allSettled(this.#s.map(W)),this.P.resolve(this.#a)}triggerLoaded(){this.loadedCalled||(this.hostLoaded&&p(this.hostLoaded,this),this.#r.forEach(p),this.loadedCalled=!0)}triggerUpdate(t){this.hostUpdate&&p(this.hostUpdate,this,t),this.#n.forEach(ce,t)}triggerUpdated(t){this.hostUpdated&&p(this.hostUpdated,this,t),this.#l.forEach(ce,t)}triggerDestroy(){this.hostDestroy&&p(this.hostDestroy,this),this.#c.forEach(p)}triggerLifecycle(){this.hostLifecycle&&this.#u(()=>this.hostLifecycle()),this.#d.forEach(this.#u,this)}#u(t){D(this.#o);let e=p(t);(Array.isArray(e)?e:[e]).forEach(r=>{typeof r=="function"?this.#i.push(r):typeof r=="object"&&typeof r.remove=="function"&&this.#i.push(r.remove)})}};function ce(o){p(o,void 0,this)}var he=o=>{if(typeof o!="object"&&typeof o!="function"||o===null)return o;let t={get(s,r,n){if(!((r==="exports"||r==="_exports")&&r in s&&s[r]===e)&&(r in s||r in Promise.prototype||typeof r=="symbol"))return typeof s=="function"?s[r]:Reflect.get(s,r,n)}},e=new Proxy(o,t);return e};var pe=St;var{I:zs}=te;var dt=o=>o.strings===void 0;var We={},ue=(o,t=We)=>o._$AH=t;var y={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$=o=>(...t)=>({_$litDirective$:o,values:t}),g=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var K=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let s of e)s._$AO?.(t,!1),K(s,t);return!0},pt=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},fe=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Ge(t)}};function Fe(o){this._$AN!==void 0?(pt(this),this._$AM=o,fe(this)):this._$AM=o}function qe(o,t=!1,e=0){let s=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(s))for(let n=e;n<s.length;n++)K(s[n],!1),pt(s[n]);else s!=null&&(K(s,!1),pt(s));else K(this,o)}var Ge=o=>{o.type==y.CHILD&&(o._$AP??=qe,o._$AQ??=Fe)},ut=class extends g{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(K(this,t),pt(this))}setValue(t){if(dt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Xs=()=>new Nt,Nt=class{},Pt=new WeakMap,Dt=$(class extends ut{render(o){return d}update(o,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),d}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Pt.get(t);e===void 0&&(e=new WeakMap,Pt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Pt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Lt=o=>{let t=o;for(;t=t.parentNode??t.host;)if(t?.constructor?.lumina){let e=t;return e.manager?.loadedCalled||(e.J??e._offspring).push(o),(e.I??e._postLoad).promise}return!1},Rt={};function Ut(){}function Mt(o){for(let t of["Associated","Disabled","Reset","StateRestore"]){let e=`orm${t}Callback`;o.prototype["f"+e]=async function(...s){await this.componentOnReady(),(this.el??this).dispatchEvent(new CustomEvent(`luminaF${e}`,{detail:s}))}}}var Je=(o,t)=>function(s,r){if(!globalThis.customElements)return;let i=(r??s??{}).resourcesUrl;i&&o.setAssetPath(i);for(let[a,[l,h="",u=0]]of Object.entries(t)){if(customElements.get(a))continue;let[c,m,v]=h.split(";"),C=c?c?.split(",").map(Qe):void 0,gt=C?.map(([x])=>x),Q=class extends xt{static{this.formAssociated=u===1}static{this.observedAttributes=C?.map(([,x])=>x).filter(x=>x!=="")}static{this.C=gt}static{this.E=m?m?.split(","):void 0}static{this.D=v?.split(",")}static{this.L=a}static{this.K=o}constructor(){!Q.B&&(Q.B=l(),Q.F()),super()}};customElements.define(a,Q)}},ft=Object.defineProperty,Qe=o=>{let t=o.split(":");return t.length===1?[t[0],Y(t[0])]:t},Ye=globalThis.HTMLElement??Ut,xt=class extends Ye{constructor(){super(),this.#e={},this.#s=[],this.I=new b,this.H=new b,this.J=[];let t=this,e=t.constructor;t._offspring=t.J,t._postLoad=t.I,e.C?.forEach(s=>{Object.hasOwn(t,s)&&(t.#e[s]=t[s],delete t[s])}),e.A?t.#r({a:e.A}):e.B.then(async s=>{await e.K.p,t.#r(await(s.default?.then(r=>typeof r=="function"?{a:r}:r)??s))}).catch(s=>{t.H.reject(s),setTimeout(()=>{throw s})})}static{this.lumina=!0}static F(){for(let t of this.C??[])ft(this.prototype,t,{configurable:!0,enumerable:!0,get(){return this.#e[t]},set(e){this.#e[t]=e}});for(let t of this.E??[])ft(this.prototype,t,{async value(...e){return this.#t||await this.H.promise,await this.#t[t](...e)},configurable:!0});for(let t of this.D??[])ft(this.prototype,t,{value(...e){return this.#t[t](...e)},configurable:!0})}static{Mt(this)}#t;#e;#s;get manager(){return this.#t?.manager}attributeChangedCallback(t,e,s){this.#t?.attributeChangedCallback(t,e,s),this.#t||this.#s.push(t)}connectedCallback(){this.#t?this.#t.connectedCallback?.():queueMicrotask(()=>this.G=Lt(this))}disconnectedCallback(){this.#t?.disconnectedCallback?.()}async componentOnReady(){return await this.H.promise,this}#r(t){let e=this.constructor,s=e.L,r=this.#e,n=Object.values(t).find(c=>c.L===s),i=`${s}--lazy`,a=n;for(;a&&!Object.hasOwn(a,"lumina");)a=Object.getPrototypeOf(a);Ze(a),!e.A&&(e.A=n,customElements.define(i,n)),n.N=this;let h=document.createElement(i);n.N=void 0,this.#t=h,this.#e=h,this.#s.forEach(c=>h.attributeChangedCallback(c,null,this.getAttribute(c))),Object.entries(r).forEach(Xe,h);let u=this.isConnected;(u||this.G)&&(h.connectedCallback?.(),u||h.disconnectedCallback())}addController(){}requestUpdate(){this.#t?.requestUpdate()}};function Xe([o,t]){this[o]=t}var Ze=o=>{let t=o.prototype,e=Element.prototype;Object.hasOwn(t,"isConnected")||(t.setAttribute=function(r,n){e.setAttribute.call(this.el,r,n)},t.removeAttribute=function(r){e.removeAttribute.call(this.el,r)},t.hasAttribute=function(r){return e.hasAttribute.call(this.el,r)},ft(t,"isConnected",{get(){return Reflect.get(e,"isConnected",this.el)}}))};var mt=class extends pe{constructor(t){super(t),this.destroyed=!1,this.R=!1,this.V=d,this.T=[],this.#s=new WeakMap,this.#e=t,this.exports=void 0,this.hasDestroy=yt in t&&typeof t.destroy=="function",E.prototype.addController.call(t,{hostConnected:()=>{if(this.destroyed){let e=t.el.localName;throw t.el.remove(),new Error(`The ${e} component has already been destroyed. It cannot be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the ${yt} prop.`)}this.#t!==void 0&&clearTimeout(this.#t),M();for(let e of t.M)"triggerConnected"in e?e.triggerConnected():p(e.hostConnected,e)},hostDisconnected:()=>{for(let e of t.M)"triggerDisconnected"in e?e.triggerDisconnected():p(e.hostDisconnected,e);this.hasDestroy&&!this.destroyed&&this.U()},hostUpdate:()=>{for(let e of t.M)"triggerUpdate"in e?e.triggerUpdate(this.Q):p(e.hostUpdate,e,this.Q)},hostUpdated:()=>{for(let e of t.M)"triggerUpdated"in e?e.triggerUpdated(this.Q):p(e.hostUpdated,e,this.Q);this.Q=void 0}}),queueMicrotask(()=>this.R=!0),ct(void 0),D(t)}#t;#e;async destroy(){if(!this.destroyed){this.#e.el.isConnected&&(this.hasDestroy=!1,this.#e.el.remove()),this.#t=void 0,this.destroyed=!0;for(let t of this.#e.M)"triggerDestroy"in t?t.triggerDestroy():p(t.hostDestroy,t);this.#e.M.splice(0)}}U(){if(this.#t!==void 0&&clearTimeout(this.#t),!this.#e.el.isConnected&&!this.#e.autoDestroyDisabled){let t=()=>{this.#e.destroy()};this.#t=le(t,ts)}}S(t,e){let s=this.T;this.V=d,this.T=[],s.forEach(r=>r(t,e))}#s;W(t,e){(typeof e=="object"&&e!==null||typeof e=="function")&&this.#s.set(e,t)}X(t){if(typeof t=="object"&&t!==null||typeof t=="function")return this.#s.get(t)}},ts=1e3,yt="autoDestroyDisabled";var ye=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return" "+Object.keys(o).filter(t=>o[t]).join(" ")+" "}update(o,[t]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(let s in t)t[s]&&!this.nt?.has(s)&&this.st.add(s);return this.render(t)}let e=o.element.classList;for(let s of this.st)s in t||(e.remove(s),this.st.delete(s));for(let s in t){let r=!!t[s];r===this.st.has(s)||this.nt?.has(s)||(r?(e.add(s),this.st.add(s)):(e.remove(s),this.st.delete(s)))}return f}});var ge="important",es=" !"+ge,ve=$(class extends g{constructor(o){if(super(o),o.type!==y.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let s=o[e];return s==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let s of this.ft)t[s]==null&&(this.ft.delete(s),s.includes("-")?e.removeProperty(s):e[s]=null);for(let s in t){let r=t[s];if(r!=null){this.ft.add(s);let n=typeof r=="string"&&r.endsWith(es);s.includes("-")||n?e.setProperty(s,n?r.slice(0,-11):r,n?ge:""):e[s]=r}}return f}});var ss=$(class extends g{constructor(o){if(super(o),o.type!==y.PROPERTY&&o.type!==y.ATTRIBUTE&&o.type!==y.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!dt(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[t]){if(t===f||t===d)return t;let e=o.element,s=o.name;if(o.type===y.PROPERTY){if(t===e[s])return f}else if(o.type===y.BOOLEAN_ATTRIBUTE){if(!!t===e.hasAttribute(s))return f}else if(o.type===y.ATTRIBUTE&&e.getAttribute(s)===t+"")return f;return ue(o),t}});var Ee=class o extends E{constructor(){super(),this.M=[],this.manager=new mt(this);let t=this,e=t.constructor,s=e.N,r=e.K.o,n=o.prototype.shouldUpdate;t.#r=s?.H??new b,t.I=s?.I??new b,t.J=s?.J??[],t._offspring=t.J,t._postLoad=t.I,t.el=s??t,t.#s=t.enableUpdating,t.enableUpdating=Ut,t.shouldUpdate!==n&&(t.#e=t.shouldUpdate,t.shouldUpdate=n),r&&(t.#t=new Map,e.elementProperties.forEach((i,a)=>t.#t.set(a,r()))),!1}static finalizeStyles(t){let e=super.finalizeStyles(t),s=this.shadowRootOptions===Rt;return this.K?.commonStyles===void 0||s?e:[this.K.commonStyles,...e]}static createProperty(t,e){let s=typeof e=="number"?e:Array.isArray(e)?e[0]:0,r=Array.isArray(e)?e[1]:void 0,n=r?.hasChanged??j,i={attribute:s&1&&typeof t=="string"?Y(t):!1,reflect:!!(s&2),type:s&4?Boolean:s&8?Number:void 0,state:!!(s&16),readOnly:!!(s&32),noAccessor:!!(s&64),useDefault:!!(s&128),c:!1,...r,hasChanged(a,l){let h=n(a,l);return i.c=h,h}};super.createProperty(t,i)}static getPropertyDescriptor(t,e,s){let r=this.K,n=super.getPropertyDescriptor(t,e,s);return s.d=n,{...n,get(){return r.t?.(this.#t.get(t)),n.get?.call(this)},set(i){let a=this.manager;if(s.readOnly&&!lt&&(a.R||a.connectedCalled))throw Error(`Cannot assign to read-only property "${t}" of ${this.el.localName}. Trying to assign "${i}"`);n.set.call(this,i??void 0),s.c&&this.#t?.get(t)?.notify(),a.T.length>0&&(M(),a?.S(t,i))}}}static{this.lumina=!0}static{Mt(this)}#t;#e;#s;#r;#n;#l;get elementInternals(){return this.#l??=this.el.attachInternals(),this.#l}connectedCallback(){this.hasAttribute("defer-hydration")||this.#c(!0)}#c(t){let e=this.constructor.K.c?.(()=>this.requestUpdate());this.#n=e;let s=!this.manager.connectedCalled;t&&super.connectedCallback(),s?queueMicrotask(()=>this.#i().catch(r=>{this.#r.reject(r),setTimeout(()=>{throw r})})):e&&this.requestUpdate()}#d(t){try{this.#n.clear(),this.constructor.K.r(this.#n,()=>super.update(t))}catch(e){throw this.#n.clear(),e}}disconnectedCallback(){super.disconnectedCallback(),this.#n?.destroy(),this.#n=void 0}createRenderRoot(){let t=this.el.shadowRoot,e=this.constructor,s=e.shadowRootOptions,n=t??(s===Rt?this.el:this.el.attachShadow(s));if(t)return this.manager.connectedCalled||this.#c(!1),E.prototype.createRenderRoot.call(this),t;if(this.isConnected){let i=n.getRootNode();i.adoptedStyleSheets=[...i.adoptedStyleSheets,...e.elementStyles.map(a=>"styleSheet"in a?a.styleSheet:a)]}return n}async#i(){let t=this.el.G??Lt(this.el);t&&await t;let e=[];for(let r of this.M)"triggerLoad"in r?e.push(r.triggerLoad()):e.push(W(r.hostLoad,r));await Promise.all(e),await this.load?.(),this.manager.hasDestroy&&this.manager.onUpdate(r=>r.has(yt)&&this.manager.U()),this.#s(!0),this.performUpdate(),this.I.resolve(),await 0;let s=this.J.filter(r=>!r.manager?.loadedCalled);s.length&&await Promise.allSettled(s.map(async r=>await r.componentOnReady())),this.J.length=0,this.el.setAttribute(this.constructor.K.hydratedAttribute,"");for(let r of this.M)"triggerLoaded"in r?r.triggerLoaded():p(r.hostLoaded,r);this.loaded?.(),this.#r.resolve()}shouldUpdate(t){return this.manager.Q=t,this.#e?.(t)??!0}update(t){this.#n?this.#d(t):super.update(t)}listen(t,e,s){let r=e?.bind(this)??e;this.manager.onLifecycle(()=>(this.el.addEventListener(t,r,s),()=>this.el.removeEventListener(t,r,s)))}listenOn(t,e,s,r){let n=s?.bind(this)??s;this.manager.onLifecycle(()=>(t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)))}async componentOnReady(){return await this.#r.promise,this}addController(t){this.M.push(t),!(q in t)&&this.renderRoot&&this.el.isConnected&&t.hostConnected?.()}removeController(t){this.M.splice(this.M.indexOf(t),1),t.controllerRemoved?.()}};var be=o=>{let t,e=r=>{t=new URL(r,globalThis.location?.href||void 0).href},s={...o,getAssetPath(r){let n=new URL(r,t);return n.origin!==globalThis.location?.origin?n.href:n.pathname},setAssetPath:e,customElement(r,n){n.K=s,n.L=r,customElements.get(r)||customElements.define(r,n)}};return e(o.defaultAssetPath),s};var $r=o=>typeof o=="object"&&o!=null?ye(o):o,br=o=>typeof o=="object"&&o!=null?ve(o):o;var It=class extends g{#t;#e;constructor(t){super(t);let e=this;this.#e=function(r){return e.#t.call(this,r)}}render(t){return typeof t=="function"?(this.#t=t,Dt(this.#e)):Dt(t)}},_r=$(It);var Ar=d;var J=be({defaultAssetPath:"https://jsdev.arcgis.com/6.0.0-next/ai-components/",hydratedAttribute:"hydrated"}),{customElement:Sr,getAssetPath:Pr,setAssetPath:Nr}=J;J.t=void 0;J.o=void 0;J.c=void 0;J.r=void 0;export{Ps as a,D as b,ct as c,ne as d,Ns as e,Ds as f,_e as g,ds as h,f as i,d as j,Ot as k,Os as l,re as m,Ve as n,Be as o,St as p,Je as q,y as r,$ as s,g as t,ue as u,Xs as v,Dt as w,Ee as x,$r as y,br as z,Ar as A,J as B,Sr as C,Pr as D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{b as n}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{b as n}from"./ZUKM4DGB.js";import"./FIZMK7GS.js";import"./SUMXIUIS.js";import"./PR4VMSKD.js";import{C as a,g as e,h as i,x as r}from"./NAVK5JJ2.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";var c=e`.interrupt-details{word-wrap:break-word}.interrupt-details ul{margin-block:var(--calcite-spacing-xxs) 0;padding-inline-start:var(--calcite-spacing-xxl)}.interrupt-details li{margin-block:0}.interrupts-container{display:flex;flex-direction:column;gap:var(--calcite-spacing-lg)}`,t=class extends r{constructor(){super(...arguments),this._messages=n({blocking:!0})}static{this.properties={interrupts:0}}static{this.styles=c}render(){return this.interrupts?.length?i`<calcite-block expandable expanded .heading=${this._messages.assistantQuestions}><div class="interrupts-container">${this.interrupts?.map(({interrupt:l,response:s})=>i`<div class="interrupt-details"><div>Q: ${l.message}</div><ul>${Array.isArray(s)?s.length?s.map(p=>i`<li>${p}</li>`):i`<li>${this._messages.questionSkipped}</li>`:i`<li>${s!=null?String(s):this._messages.questionSkipped}</li>`}</ul></div>`)}</div></calcite-block>`:null}};a("arcgis-assistant-interrupt-preview",t);export{t as ArcgisAssistantInterruptPreview};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{b as s,c as o}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{b as s,c as o}from"./AGDGDULE.js";import{b as r}from"./PR4VMSKD.js";function c(e,n){let t=s(e.el,e.referenceElement);if(t)return t;let i=r(e.el,"arcgis-assistant"),a=s(e.el,i?.referenceElement);if(a)return a;throw new Error(`${n}: Reference element not found`)}function g(e,n){let t=c(e,n).view;if(!t)throw new Error(`${n}: Reference element does not have a view`);return t}function m(e){return typeof e=="function"}function w(e){let n=r(e.el,"arcgis-assistant");if(n===void 0)throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");return n.register({agent:"registration"in e.agent?e.agent.registration:e.agent,getContext:async()=>await e.getContext?.()??e.context??{}}),n}function f(e){let n=o(e.el,e.referenceElement);if(n)return n;let t=r(e.el,"arcgis-assistant");return s(e.el,t?.referenceElement)||null}function E(e){let n=f(e);return n?n.view:null}export{g as a,m as b,w as c,E as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as u}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{a as u}from"./QBZP6XOE.js";import{Ga as d}from"./A4ZVCRVF.js";import{N as s}from"./N2GN5WOI.js";async function f(o,a,n){let e=n.map?.allLayers.find(r=>r.id===o);if(!e)return{text:`Error: Layer with id ${o} not found`};let t=a?.trim()?a:"1=1",l=e.createQuery();l.where=t;try{let{extent:r,count:i}=await e.queryExtent(l);if(i===0)return{text:`No features found in ${e.title} matching: ${t}`,where:t};if(r)await n.goTo(r);else return{text:`Error: Unable to determine extent for ${e.title}`,where:t};let c={layerId:o,layerTitle:e.title??o,where:t,count:i};return{text:`Successfully zoomed to ${i} feature(s) in ${e.title} matching: ${t}`,where:t,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(r){return console.error("Error in goToFeatures:",r),{text:`Error: ${r instanceof Error?r.message:"Unknown error"}`,where:t}}}async function h({layerId:o,where:a},n){let{mapView:e}=u(n,["mapView"]);return await f(o,a,e)}var m=s.object({layerId:s.string().describe("The layerId of the layer to zoom to."),where:s.string().describe("ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Start with a fresh filter for the current request unless the task explicitly refers to prior results. Use only field name values from the selected layer, not aliases. Use field metadata only to interpret intent: prefer LIKE '%value%' for string fields, and use =, <, >, BETWEEN, IN, IS NULL, AND/OR/NOT as appropriate for number/date fields. For coded-value domain fields, use the domain code already provided in layerInfo.domain.codedValues, never the display label. Respect range-domain bounds when they are provided. Do NOT include subqueries, nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons.")}),E=d(h,{name:"goToFeatures",description:"Go to the features that match the given filter for the given layerId. Use coded-value domain codes from layer field metadata when building the WHERE clause.",schema:m});export{E as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{a as r}from"./
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{a as r}from"./CETIZ4IQ.js";import{a as s}from"./GS5JDPZH.js";import{Ga as o}from"./A4ZVCRVF.js";import"./N2GN5WOI.js";import"./272R36XK.js";import"./5PV2GUZW.js";var m=.7;async function h(a){let{query:e,layerSearch:t,layersAndFieldsRegistry:c,embeddingCache:l,minScore:d=m}=a;return(await t.searchLayers({text:e,minScore:d,embeddingCache:l})).map(({id:i,score:y})=>{let n=c.get(i)?.layerItem;return{layerId:i,score:y,name:n?.name??void 0,title:n?.title,description:n?.description}})}var f=s.object({query:s.string().describe("A concise semantic description of the layers relevant to the user's task.")});async function u({query:a},e){let t=await h({query:a,layerSearch:r(e,"layerSearch"),layersAndFieldsRegistry:r(e,"layersAndFieldsRegistry"),embeddingCache:r(e,"embeddingCache")});return JSON.stringify({layers:t},null,2)}var S=o(u,{name:"findRelevantLayers",description:"Finds map layers relevant to a task and returns their layer IDs, similarity scores, names, titles, and descriptions. Call this before finding fields or querying data when layer IDs are not already known.",schema:f});export{S as findRelevantLayersTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
var n=(r,e,a)=>{if(!(a?r.hasAllFeaturesInView:r.hasAllFeatures))return!1;let l=new Set((r.availableFields??[]).map(t=>t.toLowerCase()));return l.has("*")?!0:e.every(t=>l.has(t.toLowerCase()))};function s(r,e){let a=r??"";return e!=null&&e&&(a=a?`(${a}) AND (${e})`:e),a||null}export{n as a,s as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
var s=t=>t.replace(o,(e,n)=>`${n===0?"":"-"}${e.toLowerCase()}`),o=/[A-Z]+(?![a-z])|[A-Z]/gu;var r="randomUUID"in crypto,c=()=>{if(r)return crypto.randomUUID();let t=crypto.getRandomValues(new Uint16Array(8));t[3]=t[3]&4095|16384,t[4]=t[4]&16383|32768;let e=n=>t[n].toString(16).padStart(4,"0");return`${e(0)+e(1)}-${e(2)}-${e(3)}-${e(4)}-${e(5)}${e(6)}${e(7)}`};export{s as a,c as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
2
|
-
import{b as hr}from"./UZLQALHY.js";var Z=new TextEncoder,ve=new TextDecoder,Se=new TextDecoder("utf-8",{fatal:!0}),et=2**32;function R(...t){let e=t.reduce((o,{length:i})=>o+i,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function Ot(t,e,r){if(e<0||e>=et)throw new RangeError(`value must be >= 0 and <= ${et-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}function Ht(t){let e=Math.floor(t/et),r=t%et,n=new Uint8Array(8);return Ot(n,e,0),Ot(n,r,4),n}function tt(t){let e=new Uint8Array(4);return Ot(e,t),e}var Qr=/[^\x00-\x7f]/;function x(t){if(typeof t=="string"&&t.length>=128){if(Qr.test(t))throw new TypeError("non-ASCII string encountered in encode()");return Z.encode(t)}let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(n>127)throw new TypeError("non-ASCII string encountered in encode()");e[r]=n}return e}function rt(t,e=!1){if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:e?"base64url":"base64",omitPadding:e});let r=32768,n=[];for(let i=0;i<t.length;i+=r)n.push(String.fromCharCode.apply(null,t.subarray(i,i+r)));let o=btoa(n.join(""));return e?o.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):o}function nt(t,e=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t,{alphabet:e?"base64url":"base64"});if(e){if(t.includes("+")||t.includes("/"))throw new TypeError("Invalid base64url");t=t.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(t),n=new Uint8Array(r.length);for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o);return n}async function ot(t,e){let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,e))}var wr={};hr(wr,{JOSEAlgNotAllowed:()=>oe,JOSEError:()=>P,JOSENotSupported:()=>S,JWEDecryptionFailed:()=>Q,JWEInvalid:()=>p,JWKInvalid:()=>Je,JWKSInvalid:()=>Ke,JWKSMultipleMatchingKeys:()=>Ne,JWKSNoMatchingKey:()=>le,JWKSTimeout:()=>je,JWSInvalid:()=>f,JWSSignatureVerificationFailed:()=>ie,JWTClaimValidationFailed:()=>j,JWTExpired:()=>Ae,JWTInvalid:()=>C});var P=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,r){super(e,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},j=class extends P{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},Ae=class extends P{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},oe=class extends P{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},S=class extends P{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},Q=class extends P{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",r){super(e,r)}},p=class extends P{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"},f=class extends P{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},C=class extends P{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"},Je=class extends P{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"},Ke=class extends P{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},le=class extends P{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r)}},Ne=class extends P{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r)}},je=class extends P{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",r){super(e,r)}},ie=class extends P{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",r){super(e,r)}};var Ut={};hr(Ut,{decode:()=>G,encode:()=>K});var en="The input to be decoded is not correctly encoded.";function G(t){try{return nt(typeof t=="string"?t:ve.decode(t),!0)}catch(e){throw new TypeError(en,{cause:e})}}function K(t){return rt(typeof t=="string"?Z.encode(t):t,!0)}function T(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must be an instance of Uint8Array`)}function g(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}function it(t){return g(t)&&Array.isArray(t.keys)&&Array.from(t.keys).every(g)}function ae(...t){let e=new Set;for(let r of t)if(r)for(let n of Object.keys(r)){if(e.has(n))return!1;e.add(n)}return!0}function A(t,e){if(t!==void 0)throw new TypeError(`${e} can only be called once`)}function H(t,e,r){try{return G(t)}catch{throw new r(`Failed to base64url decode the ${e}`)}}function at(t,e,r){try{return x(t)}catch{throw new r(`The ${e} is not a valid base64url string`)}}function se(t,e,r){let n;try{n=JSON.parse(Se.decode(G(t)))}catch{throw new e(r)}if(!g(n))throw new e(r);return n}var We={__proto__:null,b64:!0},st={__proto__:null};function Me(t,e){if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);return e===void 0?void 0:new Set(e)}function ct(t,e){let{crit:r}=e??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new t('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function F(t,e,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(a=>typeof a!="string"||a.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?e:{__proto__:null,...r,...e};for(let a of n.crit){if(!(a in i))throw new S(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(o,a)||o[a]===void 0)throw new t(`Extension Header Parameter "${a}" is missing`);if(i[a]&&(!Object.hasOwn(n,a)||n[a]===void 0))throw new t(`Extension Header Parameter "${a}" MUST be integrity protected`)}return n.crit}function Ce(t,e){if(e.includes("b64")){let r=t.b64;if(typeof r!="boolean")throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function he(t,e){let r,n;try{r=JSON.stringify(e),n=JSON.parse(r)}catch(o){throw new t("JOSE Header is not valid JSON",{cause:o})}if(!g(n))throw new t("JOSE Header is not a JSON object");return[n,r]}var tn=t=>t[Symbol.toStringTag],rn=(t,e,r)=>{let{alg:n}=t;if(e.use!==void 0){let o=r==="sign"||r==="verify"?"sig":"enc";if(e.use!==o)throw new TypeError(`Invalid key for this operation, its "use" must be "${o}" when present`)}if(e.alg!==void 0&&e.alg!==n)throw new TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(e.key_ops)){let o=r==="encrypt"||r==="decrypt"?t.ops?.[r==="encrypt"?0:1]:r;if(o&&!e.key_ops.includes(o))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}};async function M(t,e,r){let{alg:n,secret:o}=t,i=r==="decrypt"||r==="sign";if(o&&e instanceof Uint8Array)return e;let a,s;if(g(e)){if(a=Le(e),typeof a.kty!="string")throw gr(n,e,o);if(!(o?a.kty==="oct"&&typeof a.k=="string":a.kty!=="oct"&&(i?a.kty==="AKP"&&typeof a.priv=="string"||typeof a.d=="string":a.d===void 0&&a.priv===void 0)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(rn(t,a,r),a.kty==="oct")return G(a.k);if(!Object.isFrozen(e)){let{key_ops:d}=e;Array.isArray(d)&&Object.freeze(d),Object.freeze(e)}}else{if(!Rt(e))throw gr(n,e,o);let d=o?"secret":i?"private":"public";if(e.type!==d&&(o||["secret","public","private"].includes(e.type)))throw new TypeError(`${tn(e)} instances must be of type "${d}" for the ${n} algorithm`);if(X(e))return e;if(s=e,s.type==="secret")return s.export()}_t||=new WeakMap;let u=e,c=_t.get(u);if(c?.[n])return c[n];if(c||_t.set(u,c={}),s&&typeof s.toCryptoKey=="function"){let d=s.type==="public",m=nn[s.asymmetricKeyDetails?.namedCurve],y=t.resolve?.({crv:m,asymmetricKeyType:s.asymmetricKeyType})??t.subtle;return c[n]=s.toCryptoKey(y,d,t.usages[d?0:1])}return a??=s.export({format:"jwk"}),a.alg=n,c[n]=await q(t,a)}var _t,nn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function dt(t){if(!X(t))throw new Error("CryptoKey instance expected")}var X=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},Be=t=>t?.[Symbol.toStringTag]==="KeyObject",Rt=t=>X(t)||Be(t);function Er(t,e,...r){if(r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var B=(t,...e)=>Er("Key must be ",t,...e);function gr(t,e,r){let n=["CryptoKey","KeyObject","JSON Web Key"];return r&&n.push("Uint8Array"),new TypeError(Er(`Key for the ${t} algorithm must be `,e,...n))}var pt=(t,e="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);function Dt(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function Pe(t,e){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}function Nt(t,e,r){let n=t.algorithm;if(n.name!==e.name)throw pt(e.name);if(e.hash&&n.hash?.name!==e.hash)throw pt(e.hash,"algorithm.hash");if(e.namedCurve&&n.namedCurve!==e.namedCurve)throw pt(e.namedCurve,"algorithm.namedCurve");if(e.length!==void 0&&n.length!==e.length)throw pt(e.length,"algorithm.length");Dt(t,r)}function Ie(t){return{__proto__:null,...t}}function Le(t){let e=Ie(t);if(e.ext!==void 0&&typeof e.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(e.key_ops!==void 0){let r=e.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some(o=>typeof o!="string")||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');e.key_ops=n}return e}function ce(t){if(t!==void 0&&typeof t!="boolean")throw new TypeError('"extractable" option must be a boolean');return t}async function q(t,e,r){if(!t.kty.includes(e.kty))throw new S('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let n=t.resolve?.({kty:e.kty,crv:e.crv})??t.subtle,o=!!(e.d||e.priv),i={...e,ext:r??e.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,n,i.ext??!o,e.key_ops??t.usages[o?1:0])}async function L(t,e,r,n=!1){return t instanceof Uint8Array&&(t=await crypto.subtle.importKey("raw",t,e,n,[r])),Nt(t,e,r),t}var we=t=>crypto.getRandomValues(new Uint8Array(t.cekBits>>3));function ut(t,e){let r=t.byteLength<<3;if(r!==e)throw new p(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)}var on=t=>crypto.getRandomValues(new Uint8Array(t.ivBits>>3));function br(t,e){if(e.length<<3!==t.ivBits)throw new p("Invalid Initialization Vector length")}async function vr(t,e,r){if(!(e instanceof Uint8Array))throw new TypeError(B(e,"Uint8Array"));let n=t.cekBits>>1,o=await crypto.subtle.importKey("raw",e.subarray(n>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",e.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[o,i,n]}async function Sr(t,e,r){return new Uint8Array((await crypto.subtle.sign("HMAC",t,e)).slice(0,r>>3))}async function an(t,e,r,n,o){let[i,a,s]=await vr(t,r,"encrypt"),u=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},i,e)),c=R(o,n,u,Ht(o.length*8)),d=await Sr(a,c,s);return{ciphertext:u,tag:d,iv:n}}async function sn(t,e){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),o=await crypto.subtle.sign(r,n,t);return crypto.subtle.verify(r,n,o,e)}async function cn(t,e,r,n,o,i){let[a,s,u]=await vr(t,e,"decrypt"),c=R(i,n,r,Ht(i.length*8)),d=await Sr(s,c,u);try{if(await sn(o,d))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},a,r))}catch{}throw new Q}async function yt(t,e,r,n,o){if(!X(r)&&!(r instanceof Uint8Array))throw new TypeError(B(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n?br(t,n):n=on(t),r instanceof Uint8Array&&ut(r,t.cekBits),t.cbc)return an(t,e,r,n,o);let i=await L(r,t.subtle,"encrypt"),a=new Uint8Array(await crypto.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},i,e));return{ciphertext:a.subarray(0,-16),tag:a.subarray(-16),iv:n}}async function mt(t,e,r,n,o,i){if(!X(e)&&!(e instanceof Uint8Array))throw new TypeError(B(e,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new p("JWE Initialization Vector missing");if(!o)throw new p("JWE Authentication Tag missing");if(!t.cbc&&o.length!==16)throw new p("Invalid Authentication Tag length");if(br(t,n),e instanceof Uint8Array&&ut(e,t.cekBits),t.cbc)return cn(t,e,r,n,o,i);let a=await L(e,t.subtle,"decrypt");try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,R(r,o)))}catch{throw new Q}}function $e(t){let e={__proto__:null};for(let r in t)e[r]={...t[r],alg:r};return e}var pn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],dn=[[],["deriveBits"]],ht=[[],[]];function ft(t){return{kty:["RSA"],mode:"key-encryption",subtle:{name:"RSA-OAEP",hash:`SHA-${t}`},usages:pn,ops:["wrapKey","unwrapKey"]}}function lt(t){return{kty:["EC","OKP"],mode:t,subtle:{name:"ECDH"},resolve:({kty:e,crv:r,asymmetricKeyType:n})=>{if(r==="X25519"||n==="x25519")return{name:"X25519"};if(e==="OKP")throw new S('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:r}},usages:dn,ops:[void 0,"deriveBits"]}}function Te(t,e=!1){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:e?"AES-GCM":"AES-KW",length:t},usages:ht,ops:e?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function jt(){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:"PBKDF2"},usages:ht,ops:["deriveBits","deriveBits"]}}var ee=$e({dir:{kty:["oct"],mode:"direct-encryption",secret:!0,subtle:{name:"AES-GCM"},usages:ht,ops:["encrypt","decrypt"]},"RSA-OAEP":ft(1),"RSA-OAEP-256":ft(256),"RSA-OAEP-384":ft(384),"RSA-OAEP-512":ft(512),"ECDH-ES":lt("direct-key-agreement"),"ECDH-ES+A128KW":lt("key-agreement-with-key-wrapping"),"ECDH-ES+A192KW":lt("key-agreement-with-key-wrapping"),"ECDH-ES+A256KW":lt("key-agreement-with-key-wrapping"),A128KW:Te(128),A192KW:Te(192),A256KW:Te(256),A128GCMKW:Te(128,!0),A192GCMKW:Te(192,!0),A256GCMKW:Te(256,!0),"PBES2-HS256+A128KW":jt(),"PBES2-HS384+A192KW":jt(),"PBES2-HS512+A256KW":jt()}),un=["encrypt","decrypt"];function ke(t,e=!1){return{kty:["oct"],secret:!0,subtle:{name:e?"AES-CBC":"AES-GCM",length:t},usages:ht,ops:un,cekBits:t,ivBits:e?128:96,cbc:e}}var yn=$e({A128GCM:ke(128),A192GCM:ke(192),A256GCM:ke(256),"A128CBC-HS256":ke(256,!0),"A192CBC-HS384":ke(384,!0),"A256CBC-HS512":ke(512,!0)});function Ar(t,e){throw new S(`Invalid or unsupported "${t}" (JWE ${e}) header value`)}function $(t){return(typeof t=="string"?ee[t]:void 0)??Ar("alg","Algorithm")}function V(t){return t.mode==="key-wrapping"||t.mode==="key-encryption"||t.mode==="key-agreement-with-key-wrapping"}function ge(t){return(typeof t=="string"?yn[t]:void 0)??Ar("enc","Encryption Algorithm")}function Jr(t,e){if(t.algorithm.name!=="ECDH"&&t.algorithm.name!=="X25519")throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");Dt(t,e)}async function mn(t,e,r){let n=await L(e,$(t).subtle,"wrapKey",!0),o=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",o,n,"AES-KW"))}async function fn(t,e,r){let n=await L(e,$(t).subtle,"unwrapKey",!0),o=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",o))}function Wr(t,e,r){Nt(e,$(t).subtle,r),Pe(t,e)}async function Cr(t,e,r,n){if(!(t instanceof Uint8Array)||t.length<8)throw new p("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new p("PBES2 Count Input must be a positive integer");let o=R(x(e),Uint8Array.of(0),t),i=parseInt(e.slice(13,16),10),a={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:o},s=await L(n,$(e).subtle,"deriveBits");return new Uint8Array(await crypto.subtle.deriveBits(a,s,i))}function Mt(t){return R(tt(t.length),t)}async function ln(t,e,r){let n=e>>3,o=32,i=Math.ceil(n/o),a=new Uint8Array(i*o);for(let s=1;s<=i;s++){let u=await ot("sha256",R(tt(s),t,r));a.set(u,(s-1)*o)}return a.slice(0,n)}async function Pr(t,e,r,n,o=new Uint8Array,i=new Uint8Array){Jr(t),Jr(e,"deriveBits");let a=R(Mt(x(r)),Mt(o),Mt(i),tt(n)),s=new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},e,t.algorithm.name==="X25519"?256:Math.ceil(parseInt(t.algorithm.namedCurve.slice(-3),10)/8)<<3));return ln(s,n,a)}function Ir(t){dt(t);let e=t.algorithm.namedCurve;if(e!=="P-256"&&e!=="P-384"&&e!=="P-521"&&t.algorithm.name!=="X25519")throw new S("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function wt(t,e){let r=t[e];if(r!==void 0){if(typeof r!="string")throw new p(`JOSE Header "${e}" (Agreement Party${e==="apu"?"U":"V"}Info) invalid`);return H(r,e,p)}}function Tr(t,e){if(!(t===void 0||e===void 0||t.byteLength!==e.byteLength)){for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return;throw new p('JOSE Header "apu" and "apv" values must be distinct')}}function hn(t){if(t===void 0)throw new p("JWE Encrypted Key missing")}function Kr(t){if(t!==void 0)throw new p("Encountered unexpected JWE Encrypted Key")}function wn(t){if(t!==void 0&&t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw new TypeError("maxPBES2Count must be a positive safe integer or Infinity")}async function kr(t,e,r,n,o,i){let{alg:a}=t,s=t.mode;if(s==="direct-encryption")return Kr(n),r;let u=s==="direct-key-agreement";switch(u?Kr(n):hn(n),t.subtle.name){case"ECDH":{let{epk:c}=o;if(!g(c)||["d","k","p","q","dp","dq","qi","oth","priv"].some(l=>Object.hasOwn(c,l)))throw new p('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');Ir(r);let d=await q(t,c),m=wt(o,"apu"),y=wt(o,"apv");Tr(m,y);let h=await Pr(d,r,u?e.alg:a,u?e.cekBits:parseInt(a.slice(-5,-2),10),m,y);if(u)return h;r=h;break}case"RSA-OAEP":return dt(r),Wr(a,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(typeof o.p2c!="number")throw new p('JOSE Header "p2c" (PBES2 Count) missing or invalid');wn(i);let c=i??1e4;if(o.p2c>c)throw new p('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof o.p2s!="string")throw new p('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let d=H(o.p2s,"p2s",p);r=await Cr(d,a,o.p2c,r);break}case"AES-GCM":{if(typeof o.iv!="string")throw new p('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof o.tag!="string")throw new p('JOSE Header "tag" (Authentication Tag) missing or invalid');let c=H(o.iv,"iv",p),d=H(o.tag,"tag",p);if(c.byteLength!==12)throw new p("Invalid Initialization Vector length");if(d.byteLength!==16)throw new p("Invalid Authentication Tag length");return mt(ge(a.slice(0,-2)),r,n,c,d,new Uint8Array)}}return fn(a.slice(-6),r,n)}async function gt(t,e,r,n,o,i={}){let{alg:a,mode:s}=t,u=V(t);if(o!==void 0&&!u)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${a}`);let c=await M(s==="direct-encryption"?e:t,r,"encrypt");if(s==="direct-encryption")return[c,void 0,void 0];let d=u?o??we(e):void 0;d&&ut(d,e.cekBits);let m,y;switch(t.subtle.name){case"ECDH":{Ir(c);let{apu:h,apv:l}=i;h!==void 0&&T(h,'"apu"'),l!==void 0&&T(l,'"apv"');let b=h??wt(n,"apu"),J=l??wt(n,"apv");Tr(b,J);let w;i.epk!==void 0?w=await M(t,i.epk,"decrypt"):w=(await crypto.subtle.generateKey(c.algorithm,!0,["deriveBits"])).privateKey;let v=crypto.subtle,E=w;if(!E.extractable){if(typeof v.getPublicKey!="function")throw new TypeError('CryptoKey for "epk" must be extractable');E=await v.getPublicKey(w,[])}let{x:W,y:I,crv:O,kty:U}=await v.exportKey("jwk",E),k=s==="direct-key-agreement",Y=await Pr(c,w,k?e.alg:a,k?e.cekBits:parseInt(a.slice(-5,-2),10),b,J),D={x:W,crv:O,kty:U};if(U==="EC"&&(D.y=I),y={epk:D},h!==void 0&&(y.apu=K(h)),l!==void 0&&(y.apv=K(l)),k)return[Y,void 0,y];c=Y;break}case"RSA-OAEP":{dt(c),Wr(a,c,"encrypt"),m=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",c,d));break}case"PBKDF2":{let{p2c:h=2048,p2s:l=crypto.getRandomValues(new Uint8Array(16))}=i;c=await Cr(l,a,h,c),y={p2c:h,p2s:K(l)};break}case"AES-GCM":{let h=i.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):i.iv;if(!(h instanceof Uint8Array))throw new TypeError('"iv" must be an instance of Uint8Array');let l=await yt(ge(a.slice(0,-2)),d,c,h,new Uint8Array);m=l.ciphertext,y={iv:K(l.iv),tag:K(l.tag)}}}if(m??=await mn(a.slice(-6),c,d),!(m instanceof Uint8Array)||!m.byteLength)throw new TypeError("JWE key management algorithm did not produce an Encrypted Key");return[d,m,y]}function Et(t,e){if(t.zip!==void 0&&t.zip!=="DEF")throw new S('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!e?.zip)throw new p('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function xr(t){if(typeof globalThis[t]>"u")throw new S(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function Or(t,e,r=1/0){let n=t.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let o=[],i=0,a=t.readable.getReader();for(;;){let{value:s,done:u}=await a.read();if(u)break;if(o.push(s),i+=s.byteLength,r!==1/0&&i>r)throw new p("Decompressed plaintext exceeded the configured limit")}return R(...o)}async function Hr(t){return xr("CompressionStream"),Or(new CompressionStream("deflate-raw"),t)}async function Ur(t,e){return xr("DecompressionStream"),Or(new DecompressionStream("deflate-raw"),t,e)}function bt(t){let{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a}=t;if(n!==void 0&&(typeof n!="string"||!n))throw new p("JWE Initialization Vector incorrect type");if(typeof r!="string")throw new p("JWE Ciphertext missing or incorrect type");if(i!==void 0&&(typeof i!="string"||!i))throw new p("JWE Authentication Tag incorrect type");if(o!==void 0&&typeof o!="string")throw new p("JWE Protected Header incorrect type");if(e!==void 0&&(typeof e!="string"||!e))throw new p("JWE AAD incorrect type");if(a!==void 0&&!g(a))throw new p("JWE Shared Unprotected Header incorrect type");return{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a===void 0?void 0:{...a}}}function vt(t){let e,r;try{let{header:n}=t;if(g(n)){r=n.alg;let i=Object.keys(n);i.includes("alg")||(r=void 0),e=Object.fromEntries(i.map(a=>[a,a==="alg"?r:n[a]]))}else e=n;let{encrypted_key:o}=t;return[{encrypted_key:o,header:e},r]}catch(n){return[void 0,r,n]}}function St(t){let{encrypted_key:e,header:r}=t;if(e!==void 0&&typeof e!="string")throw new p("JWE Encrypted Key incorrect type");if(r!==void 0&&!g(r))throw new p("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected===void 0&&r===void 0&&t.unprotected===void 0)throw new p("JOSE Header missing")}function Bt(t){let{protected:e,ciphertext:r,iv:n,tag:o,aad:i}=t,a;return e!==void 0&&(a=se(e,p,"JWE Protected Header is invalid")),[a,H(r,"ciphertext",p),n!==void 0?H(n,"iv",p):void 0,o!==void 0?H(o,"tag",p):void 0,at((e??"")+(i!==void 0?`.${i}`:""),"aad",p)]}function pe(t){return[t&&Me("keyManagementAlgorithms",t.keyManagementAlgorithms),t&&Me("contentEncryptionAlgorithms",t.contentEncryptionAlgorithms),t?.crit,t?.maxPBES2Count,t?.maxDecompressedLength]}async function Ve(t,e,r,n=Bt(t)){let[o,i,a,s,u]=n,{header:c,unprotected:d,aad:m}=t,y;if(c!==void 0||d!==void 0){if(!ae(o,c,d))throw new p("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");y={...o,...c,...d}}else y=o??{};let[h,l,b,J,w]=e,{encrypted_key:v}=t;F(p,st,b,o,y),Et(y,o);let{alg:E,enc:W}=y;if(typeof E!="string"||!E)throw new p("missing JWE Algorithm (alg) in JWE Header");let I=ee[E];if(v===""&&(!I||!V(I)))throw new p("JWE Encrypted Key incorrect type");let O=I?.mode==="integrated-encryption";if(!O&&(typeof W!="string"||!W))throw new p("missing JWE Encryption Algorithm (enc) in JWE Header");if(h&&!h.has(E)||!h&&E.startsWith("PBES2"))throw new oe('"alg" (Algorithm) Header Parameter value not allowed');let U;if(O){if(W!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(a?.byteLength)throw new p("JWE Initialization Vector must be empty for integrated encryption");if(s?.byteLength)throw new p("JWE Authentication Tag must be empty for integrated encryption")}else{if(l&&!l.has(W))throw new oe('"enc" (Encryption Algorithm) Header Parameter value not allowed');U=ge(W)}let k;if(v!==void 0)try{k=H(v,"encrypted_key",p)}catch(_){if(!I||!V(I))throw _;k=new Uint8Array}let Y=!1;typeof r=="function"&&(r=await r(o,t),Y=!0);let D=I??$(E);V(D)&&k===void 0&&(k=new Uint8Array);let fe=await M(D.mode==="direct-encryption"?U:D,r,"decrypt"),N;if(D.mode==="integrated-encryption")N=await D.decrypt(fe,k,i,u,o,y);else{let _=U,z;try{z=await kr(D,_,fe,k,y,J),V(D)&&z instanceof Uint8Array&&z.byteLength<<3!==_.cekBits&&(z=we(_))}catch(Qe){if(Qe instanceof TypeError||Qe instanceof p||Qe instanceof S)throw Qe;z=we(_)}N=await mt(_,z,i,a,s,u)}if(y.zip==="DEF"){let _=w??25e4;if(_===0)throw new S('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(_!==1/0&&(!Number.isSafeInteger(_)||_<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");N=await Ur(N,_).catch(z=>{throw z instanceof p?z:new p("Failed to decompress plaintext",{cause:z})})}return{plaintext:N,...o&&{protectedHeader:o},...m!==void 0&&{additionalAuthenticatedData:H(m,"aad",p)},...d&&{sharedUnprotectedHeader:d},...c&&{unprotectedHeader:c},...Y&&{key:fe}}}async function At(t,e,r){if(t instanceof Uint8Array&&(t=ve.decode(t)),typeof t!="string")throw new p("Compact JWE must be a string or Uint8Array");let{0:n,1:o,2:i,3:a,4:s,length:u}=t.split(".");if(u!==5)throw new p("Invalid Compact JWE");return Ve({ciphertext:a,iv:i||void 0,protected:n,tag:s||void 0,encrypted_key:o||void 0},e,r)}async function gn(t,e,r){return At(t,pe(r),e)}async function En(t,e,r){if(!g(t))throw new p("Flattened JWE must be an object");let n=bt(t),[o,,i]=vt(t);if(!o)throw i;let a={...n,...o};return St(a),Ve(a,pe(r),e)}async function bn(t,e,r){if(!g(t))throw new p("General JWE must be an object");let n=t.recipients;if(!Array.isArray(n))throw new p("JWE Recipients missing or incorrect type");let o=Array.from(n);if(!o.every(g))throw new p("JWE Recipients missing or incorrect type");if(!o.length)throw new p("JWE Recipients has no members");let i,a,s;try{i=pe(r),a=bt(t),s=Bt(a)}catch{throw new Q}let u=o.map(c=>vt(c));if(o.length>1)for(let[,c]of u){let d=s[0]?.alg??c??a.unprotected?.alg,m=typeof d=="string"?ee[d]:void 0;if(m&&!V(m))throw new p(`"${d}" alg may only have a single recipient`)}for(let[c]of u)if(c)try{let d={...a,...c};return St(d),await Ve(d,i,e,s)}catch{}throw new Q}function Jt(t,e,r){if(!ae(t,e,r))throw new p("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Lt(t,e,r=!1){if(!t[1]&&!t[2]&&!t[3])throw new p("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");e!==void 0&&(t[8]=e?.crit);let[,n,o,i,a,s,u,c,d]=t;if(a!==void 0&&T(a,"JWE Additional Authenticated Data"),s!==void 0&&T(s,"JWE Content Encryption Key"),u!==void 0&&T(u,"JWE Initialization Vector"),!r&&n!==void 0&&(n=he(p,n)[0],t[1]=n),o!==void 0&&(o=he(p,o)[0],t[2]=o),!r&&i!==void 0&&(i=he(p,i)[0],t[3]=i),c!==void 0&&!g(c))throw new TypeError("JWE Key Management Parameters must be an object");Jt(n,o,i);let m={...n,...o,...i};ct(p,n),F(p,st,d,n,m),Et(m,n);let{alg:y,enc:h}=m;if(typeof y!="string"||!y)throw new p('JWE "alg" (Algorithm) Header Parameter missing or invalid');let l=ee[y];if(l?.mode==="integrated-encryption"){if(h!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(s!==void 0)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${y}`);if(u!==void 0)throw new TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${y}`);return[m,void 0,l]}if(typeof h!="string"||!h)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[m,ge(h),l]}async function $t(t,e,r){let[n,o,i]=e,[a,s,u,c,d,m,y,h,,l]=t,b=s,J=u,w=i??$(n.alg),v,E,W;w.mode==="integrated-encryption"?W=await M(w,r,"encrypt"):[W,v,E]=await gt(w,o,r,n,m,h),E&&(l?J=J?{...J,...E}:E:b=b?{...b,...E}:E,Jt(b,J,c));let I=b?K(JSON.stringify(b)):"",O=d?.byteLength?K(d):void 0,U=x(O?`${I}.${O}`:I),k=a;n.zip==="DEF"&&(k=await Hr(k).catch(_=>{throw new p("Failed to compress plaintext",{cause:_})}));let Y,D,fe;w.mode==="integrated-encryption"?[v,Y]=await w.encrypt(W,k,U,b,n,h):{ciphertext:Y,tag:D,iv:fe}=await yt(o,k,W,y,U);let N={ciphertext:K(Y)};return fe&&(N.iv=K(fe)),D&&(N.tag=K(D)),v?.byteLength&&(N.encrypted_key=K(v)),O&&(N.aad=O),b&&(N.protected=I),c&&(N.unprotected=c),J&&(N.header=J),N}async function xe(t,e,r){return $t(t,Lt(t,r),e)}function Kt(t){return[t.protected,t.encrypted_key,t.iv,t.ciphertext,t.tag].join(".")}var Vt=class{#e;state;constructor(e,r,n){this.#e=e,this.state=[void 0,void 0,r,n]}setUnprotectedHeader(e){return A(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return A(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}},zt=class{#e;#t=[];#r;#n;#o;constructor(e){this.#e=e}addRecipient(e,r){let n=new Vt(this,e,r?.crit);return this.#t.push(n),n}setProtectedHeader(e){return A(this.#r,"setProtectedHeader"),this.#r=e,this}setSharedUnprotectedHeader(e){return A(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#o=e,this}async encrypt(){if(!this.#t.length)throw new p("at least one recipient must be added");T(this.#e,"plaintext");let e=this.#t.length>1,r,n=this.#r,o=this.#n,i=[];for(let l of this.#t){let[b,J,w,v]=l.state,E=[this.#e,n,b,o,this.#o,void 0,void 0,J,v,e],W=Lt(E,void 0,i.length>0);i.length||(n=E[1],o=E[3]),i.push([E,W,w]);let[{alg:I,enc:O},,U]=W;if(e&&U&&!V(U))throw new p(`"${I}" alg may only have a single recipient`);if(!r)r=O;else if(r!==O)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}for(let[,l]of i)l[2]??=$(l[0].alg);let[a,s,u]=i[0],c=e?we(s[1]):void 0;a[5]=c;let{encrypted_key:d,header:m,...y}=await $t(a,s,u),h={...y,recipients:[{}]};d&&(h.recipients[0].encrypted_key=d),m&&(h.recipients[0].header=m);for(let l=1;l<i.length;l++){let[b,[J,w,v],E]=i[l],W=b[2],[,I,O]=await gt(v,w,E,J,c,b[7]),U={encrypted_key:K(I)};if(W||O){let k={...W,...O};O&&Jt(b[1],k,b[3]),U.header=k}h.recipients.push(U)}return h}};var ze=[["verify"],["sign"]];function Gt(t){let e={name:"HMAC",hash:`SHA-${t}`};return{kty:["oct"],secret:!0,subtle:e,signing:e,usages:ze}}function Oe(t,e){let r={name:e?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${t}`};return{kty:["RSA"],subtle:r,signing:e?{...r,saltLength:e}:r,usages:ze,minRsaBits:2048}}function Ft(t,e){return{kty:["EC"],crv:t,subtle:{name:"ECDSA",namedCurve:t},signing:{name:"ECDSA",hash:`SHA-${e}`},usages:ze}}function _r(){let t={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:t,signing:t,usages:ze}}function Xt(t){let e={name:`ML-DSA-${t}`};return{kty:["AKP"],subtle:e,signing:e,usages:ze}}var Ge=$e({HS256:Gt(256),HS384:Gt(384),HS512:Gt(512),RS256:Oe(256),RS384:Oe(384),RS512:Oe(512),PS256:Oe(256,32),PS384:Oe(384,48),PS512:Oe(512,64),ES256:Ft("P-256",256),ES384:Ft("P-384",384),ES512:Ft("P-521",512),EdDSA:_r(),Ed25519:_r(),"ML-DSA-44":Xt(44),"ML-DSA-65":Xt(65),"ML-DSA-87":Xt(87)});function He(t){let e=typeof t=="string"?Ge[t]:void 0;if(!e)throw new S(`alg ${t} is not supported either by JOSE or your javascript runtime`);return e}function Wt(t,e){let r=t.protected,n=t.header,o=g(n)?{...n}:n,i=e?e[0]:t.payload;!e&&i instanceof Uint8Array&&(i=new Uint8Array(i));let a=t.signature,s={payload:i,signature:a};if(r!==void 0&&(s.protected=r),n!==void 0&&(s.header=o),r===void 0&&o===void 0)throw new f('Flattened JWS must have either of the "protected" or "header" members');if(r!==void 0&&typeof r!="string")throw new f("JWS Protected Header incorrect type");if(i===void 0)throw new f("JWS Payload missing");if(typeof a!="string")throw new f("JWS Signature missing or incorrect type");if(o!==void 0&&!g(o))throw new f("JWS Unprotected Header incorrect type");return s}function de(t){return[t&&Me("algorithms",t.algorithms),t?.crit]}function qt(t){return t===void 0?{}:se(t,f,"JWS Protected Header is invalid")}function Ct(t){let e=/[\p{Cs}\p{Cn}]/u.exec(t)?.[0];if(e!==void 0)throw new f(/\p{Cs}/u.test(e)?"JWS Payload must be a well-formed Unicode string":"JWS Payload must not contain unassigned Unicode code points");return Z.encode(t)}function vn(t){try{return x(t)}catch{throw new f("JWS Compact Serialization payload must use only ASCII characters")}}async function Fe(t,e,r,n,o){let{protected:i,header:a,payload:s}=t,u=o??qt(i);if(!ae(u,a))throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...u,...a},d=Ce(u,F(f,We,e[1],u,c)),{alg:m}=c;if(typeof m!="string"||!m)throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(e[0]&&!e[0].has(m))throw new oe('"alg" (Algorithm) Header Parameter value not allowed');if(d){if(typeof s!="string")throw new f("JWS Payload must be a string")}else if(typeof s!="string"&&!(s instanceof Uint8Array))throw new f("JWS Payload must be a string or an Uint8Array instance");let y=d||typeof s!="string"?s:n(s),h=!1;typeof r=="function"&&(r=await r(u,t),h=!0);let l=He(m),b=R(i!==void 0?x(i):new Uint8Array,x("."),typeof y=="string"?e[2]??=at(y,"payload",f):y),J=H(t.signature,"signature",f),w=await M(l,r,"verify"),v=await L(w,l.subtle,"verify");l.minRsaBits&&Pe(l.alg,v);let E=!1;try{E=await crypto.subtle.verify(l.signing,v,J,b)}catch{}if(!E)throw new ie;let W={payload:typeof y=="string"?H(y,"payload",f):y};return i!==void 0&&(W.protectedHeader=u),a!==void 0&&(W.unprotectedHeader=a),h?[{...W,key:w},d]:[W,d]}async function Pt(t,e,r){if(t instanceof Uint8Array&&(t=ve.decode(t)),typeof t!="string")throw new f("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:a}=t.split(".");if(a!==3)throw new f("Invalid Compact JWS");return Fe({payload:o,protected:n,signature:i},e,r,vn)}async function Sn(t,e,r){let[n]=await Pt(t,de(r),e);return n}async function An(t,e,r){if(!g(t))throw new f("Flattened JWS must be an object");let n=Wt(t),[o]=await Fe(n,de(r),e,Ct);return o}function Jn(t,e){try{let r=Wt(t,[e]),n=qt(r.protected),{b64:o,crit:i}=n;return[r,n,Array.isArray(i)&&i.includes("b64")?typeof o=="boolean"?o?1:2:0:1]}catch{return}}async function Kn(t,e,r){if(!g(t))throw new f("General JWS must be an object");let{signatures:n,payload:o}=t;if(!Array.isArray(n))throw new f("JWS Signatures missing or incorrect type");let i=Array.from(n);if(!i.every(g))throw new f("JWS Signatures missing or incorrect type");let a;try{if(o===void 0)throw new Error;a=de(r)}catch{throw new ie}let s=o instanceof Uint8Array?new Uint8Array(o):o,u=i.map(d=>Jn(d,s)).filter(d=>d!==void 0),c=0;for(let[,,d]of u)if(c|=d,c===3)throw new f("inconsistent use of JWS Unencoded Payload (RFC7797)");for(let d of u)try{let[m]=await Fe(d[0],a,e,Ct,d[1]);return m}catch{}throw new ie}var Xe=t=>Math.floor(t.getTime()/1e3),Wn={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Cn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Ue="check_failed";function Yt(){throw new TypeError("Invalid time period format")}function It(t){typeof t!="string"&&Yt();let e=Cn.exec(t);(!e||e[4]&&e[1])&&Yt();let r=parseFloat(e[2]),n=Math.round(r*Wn[e[3][0].toLowerCase()]);return Number.isFinite(n)||Yt(),e[1]==="-"||e[4]==="ago"?-n:n}function _e(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}function Zt(t,e){if(typeof e!="string")throw new TypeError(`"${t}" claim must be a string`)}function Pn(t){if(typeof t!="string"&&(!Array.isArray(t)||Array.from(t).some(e=>typeof e!="string")))throw new TypeError('"aud" claim must be a string or an array of strings')}function Qt(t,e){return typeof t=="number"?_e(e,t):t instanceof Date?_e(e,Xe(t)):Xe(new Date)+It(t)}var Rr=t=>{let e=t.toLowerCase();return t.includes("/")?e:`application/${e}`},In=(t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(r=>t.includes(r)):!1;function er(t,e,r=!1){let n=t[e];if(!(n===void 0&&!r)){if(typeof n!="number")throw new j(`"${e}" claim must be a number`,t,e,"invalid");return n}}function tr(t,e){throw new j(`unexpected "${e}" claim value`,t,e,Ue)}function Re(t,e,r={}){let n;try{n=JSON.parse(Se.decode(e))}catch{}if(!g(n))throw new C("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o!==void 0&&(typeof t.typ!="string"||Rr(t.typ)!==Rr(o)))throw new j('unexpected "typ" JWT header value',n,"typ",Ue);let{requiredClaims:i=[],issuer:a,subject:s,audience:u,maxTokenAge:c}=r,d=[...i];c!==void 0&&d.push("iat"),u!==void 0&&d.push("aud"),s!==void 0&&d.push("sub"),a!==void 0&&d.push("iss");for(let v of new Set(d.reverse()))if(!Object.hasOwn(n,v))throw new j(`missing required "${v}" claim`,n,v,"missing");a!==void 0&&!(Array.isArray(a)?a:[a]).includes(n.iss)&&tr(n,"iss"),s!==void 0&&n.sub!==s&&tr(n,"sub"),u!==void 0&&!In(n.aud,typeof u=="string"?[u]:u)&&tr(n,"aud");let{clockTolerance:m}=r,y=0;if(typeof m=="string")y=It(m);else if(m!==void 0){if(typeof m!="number")throw new TypeError("Invalid clockTolerance option type");y=m}_e("clockTolerance option",y);let{currentDate:h}=r,l=_e("currentDate option",Xe(h===void 0?new Date:h)),b=er(n,"iat",c!==void 0),J=er(n,"nbf");if(J!==void 0&&J>l+y)throw new j('"nbf" claim timestamp check failed',n,"nbf",Ue);let w=er(n,"exp");if(w!==void 0&&w<=l-y)throw new Ae('"exp" claim timestamp check failed',n,"exp",Ue);if(c!==void 0){let v=l-b,E=_e("maxTokenAge option",typeof c=="number"?c:It(c));if(v-y>E)throw new Ae('"iat" claim timestamp check failed (too far in the past)',n,"iat",Ue);if(v<-y)throw new j('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Ue)}return n}var Dr;function te(t){return Dr.get(t)}function De(t){let e=te(t);for(let r of["iat","nbf","exp"]){let n=e[r];if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`"${r}" claim must be a finite number`)}return Z.encode(JSON.stringify(e))}function Tt(t,e){return te(t)[e]}var ue=class{constructor(e={}){if(!g(e))throw new TypeError("JWT Claims Set MUST be an object");(Dr||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return Zt("iss",e),te(this).iss=e,this}setSubject(e){return Zt("sub",e),te(this).sub=e,this}setAudience(e){return Pn(e),te(this).aud=e,this}setJti(e){return Zt("jti",e),te(this).jti=e,this}setNotBefore(e){return te(this).nbf=Qt(e,"setNotBefore"),this}setExpirationTime(e){return te(this).exp=Qt(e,"setExpirationTime"),this}setIssuedAt(e){let r=te(this);return e===void 0?r.iat=Xe(new Date):typeof e=="string"?r.iat=_e("setIssuedAt",Xe(new Date)+It(e)):r.iat=Qt(e,"setIssuedAt"),this}};async function Tn(t,e,r){let[n,o]=await Pt(t,de(r),e);if(!o)throw new C("JWTs MUST NOT use unencoded payload");let i=Re(n.protectedHeader,n.payload,r);return{...n,payload:i}}async function kn(t,e,r){let{plaintext:n,...o}=await At(t,pe(r),e),{protectedHeader:i}=o,a=Re(i,n,r);for(let s of["iss","sub","aud"])if(i[s]!==void 0&&(s==="aud"?JSON.stringify(i.aud)!==JSON.stringify(a.aud):i[s]!==a[s]))throw new j(`replicated "${s}" claim header parameter mismatch`,a,s,"mismatch");return{payload:a,...o}}var rr=class{#e;constructor(e){T(e,"plaintext"),this.#e=[e]}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}async encrypt(e,r){return Kt(await xe([...this.#e],e,r))}};var nr=class{#e;constructor(e){T(e,"plaintext"),this.#e=[e]}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setSharedUnprotectedHeader(e){return A(this.#e[3],"setSharedUnprotectedHeader"),this.#e[3]=e,this}setUnprotectedHeader(e){return A(this.#e[2],"setUnprotectedHeader"),this.#e[2]=e,this}setAdditionalAuthenticatedData(e){return this.#e[4]=e,this}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}async encrypt(e,r){return xe([...this.#e],e,r)}};async function qe(t,e,r){let[n,o,i,a]=t,s="";if(o!==void 0){let w=he(f,o);o=w[0],s=K(w[1])}if(i!==void 0&&(i=he(f,i)[0]),!o&&!i)throw new f("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ae(o,i))throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...o,...i};ct(f,o);let c=Ce(o,F(f,We,a,o,u));c||r?.();let{alg:d}=u;if(typeof d!="string"||!d)throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');let m=He(d),y="",h=n,l;if(c){let w=t[4];w?(y=w[0]??=K(n),h=w[1]??=x(y)):(y=K(n),l=Z.encode(`${s}.${y}`))}l??=R(x(s),x("."),h);let b=await L(await M(m,e,"sign"),m.subtle,"sign");m.minRsaBits&&Pe(m.alg,b);let J={signature:K(new Uint8Array(await crypto.subtle.sign(m.signing,b,l))),payload:y};return o&&(J.protected=s),i&&(J.header=i),[J,c]}async function kt(t,e,r,n,o){let[i]=await qe([t,e,void 0,r],n,o);return`${i.protected}.${i.payload}.${i.signature}`}var or=class{#e;#t;constructor(e){T(e,"payload"),this.#e=e}setProtectedHeader(e){return A(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,r){return kt(this.#e,this.#t,r?.crit,e,()=>{throw new TypeError("use the flattened module for creating JWS with b64: false")})}};var ir=class{#e;constructor(e){T(e,"payload"),this.#e=[e]}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setUnprotectedHeader(e){return A(this.#e[2],"setUnprotectedHeader"),this.#e[2]=e,this}async sign(e,r){let n=[...this.#e];n[3]=r?.crit;let[o]=await qe(n,e);return o}};var ar=class{#e;state;constructor(e,r,n){this.#e=e,this.state=[void 0,void 0,r,n?.crit]}setProtectedHeader(e){return A(this.state[0],"setProtectedHeader"),this.state[0]=e,this}setUnprotectedHeader(e){return A(this.state[1],"setUnprotectedHeader"),this.state[1]=e,this}addSignature(...e){return this.#e.addSignature(...e)}sign(...e){return this.#e.sign(...e)}done(){return this.#e}},sr=class{#e;#t=[];constructor(e){this.#e=e}addSignature(e,r){let n=new ar(this,e,r);return this.#t.push(n),n}async sign(){if(!this.#t.length)throw new f("at least one signature must be added");T(this.#e,"payload");let e={signatures:[],payload:""},r=[],n;for(let o of this.#t){let[i,a,s,u]=o.state,[{payload:c,...d},m]=await qe([this.#e,i,a,u,r],s);if(n===void 0)n=m,e.payload=c;else if(n!==m)throw new f("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(d)}return e}};var xn=ue,cr=class extends xn{#e;setProtectedHeader(e){return A(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,r){return kt(De(this),this.#e,r?.crit,e,()=>{throw new C("JWTs MUST NOT use unencoded payload")})}};var On=ue,pr=class extends On{#e=[void 0];#t;#r;#n;setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}replicateIssuerAsHeader(){return this.#t=!0,this}replicateSubjectAsHeader(){return this.#r=!0,this}replicateAudienceAsHeader(){return this.#n=!0,this}async encrypt(e,r){let n=De(this);this.#e[1]&&(this.#t||this.#r||this.#n)&&(this.#e[1]={...this.#e[1],iss:this.#t?Tt(this,"iss"):void 0,sub:this.#r?Tt(this,"sub"):void 0,aud:this.#n?Tt(this,"aud"):void 0});let o=[...this.#e];return o[0]=n,Kt(await xe(o,e,r))}};var ye='"alg" (Algorithm)';function Ee(t='JWK "alg" (Algorithm) Parameter'){throw new S(`Invalid or unsupported ${t} value`)}function be(t,e){return(typeof t=="string"?Ge[t]??ee[t]:void 0)??Ee(e)}var Hn=(t,e)=>{let r=(t.match(/.{1,64}/g)||[]).join(`
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
import{b as hr}from"./5PV2GUZW.js";var Z=new TextEncoder,ve=new TextDecoder,Se=new TextDecoder("utf-8",{fatal:!0}),et=2**32;function R(...t){let e=t.reduce((o,{length:i})=>o+i,0),r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}function Ot(t,e,r){if(e<0||e>=et)throw new RangeError(`value must be >= 0 and <= ${et-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}function Ht(t){let e=Math.floor(t/et),r=t%et,n=new Uint8Array(8);return Ot(n,e,0),Ot(n,r,4),n}function tt(t){let e=new Uint8Array(4);return Ot(e,t),e}var Qr=/[^\x00-\x7f]/;function x(t){if(typeof t=="string"&&t.length>=128){if(Qr.test(t))throw new TypeError("non-ASCII string encountered in encode()");return Z.encode(t)}let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++){let n=t.charCodeAt(r);if(n>127)throw new TypeError("non-ASCII string encountered in encode()");e[r]=n}return e}function rt(t,e=!1){if(Uint8Array.prototype.toBase64)return t.toBase64({alphabet:e?"base64url":"base64",omitPadding:e});let r=32768,n=[];for(let i=0;i<t.length;i+=r)n.push(String.fromCharCode.apply(null,t.subarray(i,i+r)));let o=btoa(n.join(""));return e?o.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):o}function nt(t,e=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(t,{alphabet:e?"base64url":"base64"});if(e){if(t.includes("+")||t.includes("/"))throw new TypeError("Invalid base64url");t=t.replace(/-/g,"+").replace(/_/g,"/")}let r=atob(t),n=new Uint8Array(r.length);for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o);return n}async function ot(t,e){let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await crypto.subtle.digest(r,e))}var wr={};hr(wr,{JOSEAlgNotAllowed:()=>oe,JOSEError:()=>P,JOSENotSupported:()=>S,JWEDecryptionFailed:()=>Q,JWEInvalid:()=>p,JWKInvalid:()=>Je,JWKSInvalid:()=>Ke,JWKSMultipleMatchingKeys:()=>Ne,JWKSNoMatchingKey:()=>le,JWKSTimeout:()=>je,JWSInvalid:()=>f,JWSSignatureVerificationFailed:()=>ie,JWTClaimValidationFailed:()=>j,JWTExpired:()=>Ae,JWTInvalid:()=>C});var P=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,r){super(e,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},j=class extends P{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},Ae=class extends P{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},oe=class extends P{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},S=class extends P{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},Q=class extends P{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(e="decryption operation failed",r){super(e,r)}},p=class extends P{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"},f=class extends P{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},C=class extends P{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"},Je=class extends P{static code="ERR_JWK_INVALID";code="ERR_JWK_INVALID"},Ke=class extends P{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},le=class extends P{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r)}},Ne=class extends P{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r)}},je=class extends P{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",r){super(e,r)}},ie=class extends P{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",r){super(e,r)}};var Ut={};hr(Ut,{decode:()=>G,encode:()=>K});var en="The input to be decoded is not correctly encoded.";function G(t){try{return nt(typeof t=="string"?t:ve.decode(t),!0)}catch(e){throw new TypeError(en,{cause:e})}}function K(t){return rt(typeof t=="string"?Z.encode(t):t,!0)}function T(t,e){if(!(t instanceof Uint8Array))throw new TypeError(`${e} must be an instance of Uint8Array`)}function g(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;let e=Object.getPrototypeOf(t);return e===null||Object.getPrototypeOf(e)===null}function it(t){return g(t)&&Array.isArray(t.keys)&&Array.from(t.keys).every(g)}function ae(...t){let e=new Set;for(let r of t)if(r)for(let n of Object.keys(r)){if(e.has(n))return!1;e.add(n)}return!0}function A(t,e){if(t!==void 0)throw new TypeError(`${e} can only be called once`)}function H(t,e,r){try{return G(t)}catch{throw new r(`Failed to base64url decode the ${e}`)}}function at(t,e,r){try{return x(t)}catch{throw new r(`The ${e} is not a valid base64url string`)}}function se(t,e,r){let n;try{n=JSON.parse(Se.decode(G(t)))}catch{throw new e(r)}if(!g(n))throw new e(r);return n}var We={__proto__:null,b64:!0},st={__proto__:null};function Me(t,e){if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);return e===void 0?void 0:new Set(e)}function ct(t,e){let{crit:r}=e??{};if(Array.isArray(r)&&new Set(r).size!==r.length)throw new t('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}function F(t,e,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return[];if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(a=>typeof a!="string"||a.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i=r===void 0?e:{__proto__:null,...r,...e};for(let a of n.crit){if(!(a in i))throw new S(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(o,a)||o[a]===void 0)throw new t(`Extension Header Parameter "${a}" is missing`);if(i[a]&&(!Object.hasOwn(n,a)||n[a]===void 0))throw new t(`Extension Header Parameter "${a}" MUST be integrity protected`)}return n.crit}function Ce(t,e){if(e.includes("b64")){let r=t.b64;if(typeof r!="boolean")throw new f('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return r}return!0}function he(t,e){let r,n;try{r=JSON.stringify(e),n=JSON.parse(r)}catch(o){throw new t("JOSE Header is not valid JSON",{cause:o})}if(!g(n))throw new t("JOSE Header is not a JSON object");return[n,r]}var tn=t=>t[Symbol.toStringTag],rn=(t,e,r)=>{let{alg:n}=t;if(e.use!==void 0){let o=r==="sign"||r==="verify"?"sig":"enc";if(e.use!==o)throw new TypeError(`Invalid key for this operation, its "use" must be "${o}" when present`)}if(e.alg!==void 0&&e.alg!==n)throw new TypeError(`Invalid key for this operation, its "alg" must be "${n}" when present`);if(Array.isArray(e.key_ops)){let o=r==="encrypt"||r==="decrypt"?t.ops?.[r==="encrypt"?0:1]:r;if(o&&!e.key_ops.includes(o))throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${o}" when present`)}};async function M(t,e,r){let{alg:n,secret:o}=t,i=r==="decrypt"||r==="sign";if(o&&e instanceof Uint8Array)return e;let a,s;if(g(e)){if(a=Le(e),typeof a.kty!="string")throw gr(n,e,o);if(!(o?a.kty==="oct"&&typeof a.k=="string":a.kty!=="oct"&&(i?a.kty==="AKP"&&typeof a.priv=="string"||typeof a.d=="string":a.d===void 0&&a.priv===void 0)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${i?"private":"public"} JWK`);if(rn(t,a,r),a.kty==="oct")return G(a.k);if(!Object.isFrozen(e)){let{key_ops:d}=e;Array.isArray(d)&&Object.freeze(d),Object.freeze(e)}}else{if(!Rt(e))throw gr(n,e,o);let d=o?"secret":i?"private":"public";if(e.type!==d&&(o||["secret","public","private"].includes(e.type)))throw new TypeError(`${tn(e)} instances must be of type "${d}" for the ${n} algorithm`);if(X(e))return e;if(s=e,s.type==="secret")return s.export()}_t||=new WeakMap;let u=e,c=_t.get(u);if(c?.[n])return c[n];if(c||_t.set(u,c={}),s&&typeof s.toCryptoKey=="function"){let d=s.type==="public",m=nn[s.asymmetricKeyDetails?.namedCurve],y=t.resolve?.({crv:m,asymmetricKeyType:s.asymmetricKeyType})??t.subtle;return c[n]=s.toCryptoKey(y,d,t.usages[d?0:1])}return a??=s.export({format:"jwk"}),a.alg=n,c[n]=await q(t,a)}var _t,nn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function dt(t){if(!X(t))throw new Error("CryptoKey instance expected")}var X=t=>{if(t?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return t instanceof CryptoKey}catch{return!1}},Be=t=>t?.[Symbol.toStringTag]==="KeyObject",Rt=t=>X(t)||Be(t);function Er(t,e,...r){if(r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}var B=(t,...e)=>Er("Key must be ",t,...e);function gr(t,e,r){let n=["CryptoKey","KeyObject","JSON Web Key"];return r&&n.push("Uint8Array"),new TypeError(Er(`Key for the ${t} algorithm must be `,e,...n))}var pt=(t,e="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);function Dt(t,e){if(e&&!t.usages.includes(e))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${e}.`)}function Pe(t,e){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}function Nt(t,e,r){let n=t.algorithm;if(n.name!==e.name)throw pt(e.name);if(e.hash&&n.hash?.name!==e.hash)throw pt(e.hash,"algorithm.hash");if(e.namedCurve&&n.namedCurve!==e.namedCurve)throw pt(e.namedCurve,"algorithm.namedCurve");if(e.length!==void 0&&n.length!==e.length)throw pt(e.length,"algorithm.length");Dt(t,r)}function Ie(t){return{__proto__:null,...t}}function Le(t){let e=Ie(t);if(e.ext!==void 0&&typeof e.ext!="boolean")throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(e.key_ops!==void 0){let r=e.key_ops,n=Array.isArray(r)?[...r]:void 0;if(!n||n.some(o=>typeof o!="string")||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');e.key_ops=n}return e}function ce(t){if(t!==void 0&&typeof t!="boolean")throw new TypeError('"extractable" option must be a boolean');return t}async function q(t,e,r){if(!t.kty.includes(e.kty))throw new S('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let n=t.resolve?.({kty:e.kty,crv:e.crv})??t.subtle,o=!!(e.d||e.priv),i={...e,ext:r??e.ext};return i.kty!=="AKP"&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,n,i.ext??!o,e.key_ops??t.usages[o?1:0])}async function L(t,e,r,n=!1){return t instanceof Uint8Array&&(t=await crypto.subtle.importKey("raw",t,e,n,[r])),Nt(t,e,r),t}var we=t=>crypto.getRandomValues(new Uint8Array(t.cekBits>>3));function ut(t,e){let r=t.byteLength<<3;if(r!==e)throw new p(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)}var on=t=>crypto.getRandomValues(new Uint8Array(t.ivBits>>3));function br(t,e){if(e.length<<3!==t.ivBits)throw new p("Invalid Initialization Vector length")}async function vr(t,e,r){if(!(e instanceof Uint8Array))throw new TypeError(B(e,"Uint8Array"));let n=t.cekBits>>1,o=await crypto.subtle.importKey("raw",e.subarray(n>>3),"AES-CBC",!1,[r]),i=await crypto.subtle.importKey("raw",e.subarray(0,n>>3),{hash:`SHA-${n<<1}`,name:"HMAC"},!1,["sign"]);return[o,i,n]}async function Sr(t,e,r){return new Uint8Array((await crypto.subtle.sign("HMAC",t,e)).slice(0,r>>3))}async function an(t,e,r,n,o){let[i,a,s]=await vr(t,r,"encrypt"),u=new Uint8Array(await crypto.subtle.encrypt({iv:n,name:"AES-CBC"},i,e)),c=R(o,n,u,Ht(o.length*8)),d=await Sr(a,c,s);return{ciphertext:u,tag:d,iv:n}}async function sn(t,e){let r={name:"HMAC",hash:"SHA-256"},n=await crypto.subtle.generateKey(r,!1,["sign","verify"]),o=await crypto.subtle.sign(r,n,t);return crypto.subtle.verify(r,n,o,e)}async function cn(t,e,r,n,o,i){let[a,s,u]=await vr(t,e,"decrypt"),c=R(i,n,r,Ht(i.length*8)),d=await Sr(s,c,u);try{if(await sn(o,d))return new Uint8Array(await crypto.subtle.decrypt({iv:n,name:"AES-CBC"},a,r))}catch{}throw new Q}async function yt(t,e,r,n,o){if(!X(r)&&!(r instanceof Uint8Array))throw new TypeError(B(r,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(n?br(t,n):n=on(t),r instanceof Uint8Array&&ut(r,t.cekBits),t.cbc)return an(t,e,r,n,o);let i=await L(r,t.subtle,"encrypt"),a=new Uint8Array(await crypto.subtle.encrypt({additionalData:o,iv:n,name:"AES-GCM",tagLength:128},i,e));return{ciphertext:a.subarray(0,-16),tag:a.subarray(-16),iv:n}}async function mt(t,e,r,n,o,i){if(!X(e)&&!(e instanceof Uint8Array))throw new TypeError(B(e,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));if(!n)throw new p("JWE Initialization Vector missing");if(!o)throw new p("JWE Authentication Tag missing");if(!t.cbc&&o.length!==16)throw new p("Invalid Authentication Tag length");if(br(t,n),e instanceof Uint8Array&&ut(e,t.cekBits),t.cbc)return cn(t,e,r,n,o,i);let a=await L(e,t.subtle,"decrypt");try{return new Uint8Array(await crypto.subtle.decrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},a,R(r,o)))}catch{throw new Q}}function $e(t){let e={__proto__:null};for(let r in t)e[r]={...t[r],alg:r};return e}var pn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],dn=[[],["deriveBits"]],ht=[[],[]];function ft(t){return{kty:["RSA"],mode:"key-encryption",subtle:{name:"RSA-OAEP",hash:`SHA-${t}`},usages:pn,ops:["wrapKey","unwrapKey"]}}function lt(t){return{kty:["EC","OKP"],mode:t,subtle:{name:"ECDH"},resolve:({kty:e,crv:r,asymmetricKeyType:n})=>{if(r==="X25519"||n==="x25519")return{name:"X25519"};if(e==="OKP")throw new S('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:r}},usages:dn,ops:[void 0,"deriveBits"]}}function Te(t,e=!1){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:e?"AES-GCM":"AES-KW",length:t},usages:ht,ops:e?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function jt(){return{kty:["oct"],mode:"key-wrapping",secret:!0,subtle:{name:"PBKDF2"},usages:ht,ops:["deriveBits","deriveBits"]}}var ee=$e({dir:{kty:["oct"],mode:"direct-encryption",secret:!0,subtle:{name:"AES-GCM"},usages:ht,ops:["encrypt","decrypt"]},"RSA-OAEP":ft(1),"RSA-OAEP-256":ft(256),"RSA-OAEP-384":ft(384),"RSA-OAEP-512":ft(512),"ECDH-ES":lt("direct-key-agreement"),"ECDH-ES+A128KW":lt("key-agreement-with-key-wrapping"),"ECDH-ES+A192KW":lt("key-agreement-with-key-wrapping"),"ECDH-ES+A256KW":lt("key-agreement-with-key-wrapping"),A128KW:Te(128),A192KW:Te(192),A256KW:Te(256),A128GCMKW:Te(128,!0),A192GCMKW:Te(192,!0),A256GCMKW:Te(256,!0),"PBES2-HS256+A128KW":jt(),"PBES2-HS384+A192KW":jt(),"PBES2-HS512+A256KW":jt()}),un=["encrypt","decrypt"];function ke(t,e=!1){return{kty:["oct"],secret:!0,subtle:{name:e?"AES-CBC":"AES-GCM",length:t},usages:ht,ops:un,cekBits:t,ivBits:e?128:96,cbc:e}}var yn=$e({A128GCM:ke(128),A192GCM:ke(192),A256GCM:ke(256),"A128CBC-HS256":ke(256,!0),"A192CBC-HS384":ke(384,!0),"A256CBC-HS512":ke(512,!0)});function Ar(t,e){throw new S(`Invalid or unsupported "${t}" (JWE ${e}) header value`)}function $(t){return(typeof t=="string"?ee[t]:void 0)??Ar("alg","Algorithm")}function V(t){return t.mode==="key-wrapping"||t.mode==="key-encryption"||t.mode==="key-agreement-with-key-wrapping"}function ge(t){return(typeof t=="string"?yn[t]:void 0)??Ar("enc","Encryption Algorithm")}function Jr(t,e){if(t.algorithm.name!=="ECDH"&&t.algorithm.name!=="X25519")throw new TypeError("CryptoKey does not support this operation, its algorithm.name must be ECDH or X25519");Dt(t,e)}async function mn(t,e,r){let n=await L(e,$(t).subtle,"wrapKey",!0),o=await crypto.subtle.importKey("raw",r,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.wrapKey("raw",o,n,"AES-KW"))}async function fn(t,e,r){let n=await L(e,$(t).subtle,"unwrapKey",!0),o=await crypto.subtle.unwrapKey("raw",r,n,"AES-KW",{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(await crypto.subtle.exportKey("raw",o))}function Wr(t,e,r){Nt(e,$(t).subtle,r),Pe(t,e)}async function Cr(t,e,r,n){if(!(t instanceof Uint8Array)||t.length<8)throw new p("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(r)||Math.sign(r)!==1)throw new p("PBES2 Count Input must be a positive integer");let o=R(x(e),Uint8Array.of(0),t),i=parseInt(e.slice(13,16),10),a={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:o},s=await L(n,$(e).subtle,"deriveBits");return new Uint8Array(await crypto.subtle.deriveBits(a,s,i))}function Mt(t){return R(tt(t.length),t)}async function ln(t,e,r){let n=e>>3,o=32,i=Math.ceil(n/o),a=new Uint8Array(i*o);for(let s=1;s<=i;s++){let u=await ot("sha256",R(tt(s),t,r));a.set(u,(s-1)*o)}return a.slice(0,n)}async function Pr(t,e,r,n,o=new Uint8Array,i=new Uint8Array){Jr(t),Jr(e,"deriveBits");let a=R(Mt(x(r)),Mt(o),Mt(i),tt(n)),s=new Uint8Array(await crypto.subtle.deriveBits({name:t.algorithm.name,public:t},e,t.algorithm.name==="X25519"?256:Math.ceil(parseInt(t.algorithm.namedCurve.slice(-3),10)/8)<<3));return ln(s,n,a)}function Ir(t){dt(t);let e=t.algorithm.namedCurve;if(e!=="P-256"&&e!=="P-384"&&e!=="P-521"&&t.algorithm.name!=="X25519")throw new S("ECDH with the provided key is not allowed or not supported by your javascript runtime")}function wt(t,e){let r=t[e];if(r!==void 0){if(typeof r!="string")throw new p(`JOSE Header "${e}" (Agreement Party${e==="apu"?"U":"V"}Info) invalid`);return H(r,e,p)}}function Tr(t,e){if(!(t===void 0||e===void 0||t.byteLength!==e.byteLength)){for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return;throw new p('JOSE Header "apu" and "apv" values must be distinct')}}function hn(t){if(t===void 0)throw new p("JWE Encrypted Key missing")}function Kr(t){if(t!==void 0)throw new p("Encountered unexpected JWE Encrypted Key")}function wn(t){if(t!==void 0&&t!==1/0&&(!Number.isSafeInteger(t)||t<1))throw new TypeError("maxPBES2Count must be a positive safe integer or Infinity")}async function kr(t,e,r,n,o,i){let{alg:a}=t,s=t.mode;if(s==="direct-encryption")return Kr(n),r;let u=s==="direct-key-agreement";switch(u?Kr(n):hn(n),t.subtle.name){case"ECDH":{let{epk:c}=o;if(!g(c)||["d","k","p","q","dp","dq","qi","oth","priv"].some(l=>Object.hasOwn(c,l)))throw new p('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');Ir(r);let d=await q(t,c),m=wt(o,"apu"),y=wt(o,"apv");Tr(m,y);let h=await Pr(d,r,u?e.alg:a,u?e.cekBits:parseInt(a.slice(-5,-2),10),m,y);if(u)return h;r=h;break}case"RSA-OAEP":return dt(r),Wr(a,r,"decrypt"),new Uint8Array(await crypto.subtle.decrypt("RSA-OAEP",r,n));case"PBKDF2":{if(typeof o.p2c!="number")throw new p('JOSE Header "p2c" (PBES2 Count) missing or invalid');wn(i);let c=i??1e4;if(o.p2c>c)throw new p('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof o.p2s!="string")throw new p('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let d=H(o.p2s,"p2s",p);r=await Cr(d,a,o.p2c,r);break}case"AES-GCM":{if(typeof o.iv!="string")throw new p('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof o.tag!="string")throw new p('JOSE Header "tag" (Authentication Tag) missing or invalid');let c=H(o.iv,"iv",p),d=H(o.tag,"tag",p);if(c.byteLength!==12)throw new p("Invalid Initialization Vector length");if(d.byteLength!==16)throw new p("Invalid Authentication Tag length");return mt(ge(a.slice(0,-2)),r,n,c,d,new Uint8Array)}}return fn(a.slice(-6),r,n)}async function gt(t,e,r,n,o,i={}){let{alg:a,mode:s}=t,u=V(t);if(o!==void 0&&!u)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${a}`);let c=await M(s==="direct-encryption"?e:t,r,"encrypt");if(s==="direct-encryption")return[c,void 0,void 0];let d=u?o??we(e):void 0;d&&ut(d,e.cekBits);let m,y;switch(t.subtle.name){case"ECDH":{Ir(c);let{apu:h,apv:l}=i;h!==void 0&&T(h,'"apu"'),l!==void 0&&T(l,'"apv"');let b=h??wt(n,"apu"),J=l??wt(n,"apv");Tr(b,J);let w;i.epk!==void 0?w=await M(t,i.epk,"decrypt"):w=(await crypto.subtle.generateKey(c.algorithm,!0,["deriveBits"])).privateKey;let v=crypto.subtle,E=w;if(!E.extractable){if(typeof v.getPublicKey!="function")throw new TypeError('CryptoKey for "epk" must be extractable');E=await v.getPublicKey(w,[])}let{x:W,y:I,crv:O,kty:U}=await v.exportKey("jwk",E),k=s==="direct-key-agreement",Y=await Pr(c,w,k?e.alg:a,k?e.cekBits:parseInt(a.slice(-5,-2),10),b,J),D={x:W,crv:O,kty:U};if(U==="EC"&&(D.y=I),y={epk:D},h!==void 0&&(y.apu=K(h)),l!==void 0&&(y.apv=K(l)),k)return[Y,void 0,y];c=Y;break}case"RSA-OAEP":{dt(c),Wr(a,c,"encrypt"),m=new Uint8Array(await crypto.subtle.encrypt("RSA-OAEP",c,d));break}case"PBKDF2":{let{p2c:h=2048,p2s:l=crypto.getRandomValues(new Uint8Array(16))}=i;c=await Cr(l,a,h,c),y={p2c:h,p2s:K(l)};break}case"AES-GCM":{let h=i.iv===void 0?crypto.getRandomValues(new Uint8Array(12)):i.iv;if(!(h instanceof Uint8Array))throw new TypeError('"iv" must be an instance of Uint8Array');let l=await yt(ge(a.slice(0,-2)),d,c,h,new Uint8Array);m=l.ciphertext,y={iv:K(l.iv),tag:K(l.tag)}}}if(m??=await mn(a.slice(-6),c,d),!(m instanceof Uint8Array)||!m.byteLength)throw new TypeError("JWE key management algorithm did not produce an Encrypted Key");return[d,m,y]}function Et(t,e){if(t.zip!==void 0&&t.zip!=="DEF")throw new S('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(t.zip!==void 0&&!e?.zip)throw new p('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.')}function xr(t){if(typeof globalThis[t]>"u")throw new S(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${t} API.`)}async function Or(t,e,r=1/0){let n=t.writable.getWriter();n.write(e).catch(()=>{}),n.close().catch(()=>{});let o=[],i=0,a=t.readable.getReader();for(;;){let{value:s,done:u}=await a.read();if(u)break;if(o.push(s),i+=s.byteLength,r!==1/0&&i>r)throw new p("Decompressed plaintext exceeded the configured limit")}return R(...o)}async function Hr(t){return xr("CompressionStream"),Or(new CompressionStream("deflate-raw"),t)}async function Ur(t,e){return xr("DecompressionStream"),Or(new DecompressionStream("deflate-raw"),t,e)}function bt(t){let{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a}=t;if(n!==void 0&&(typeof n!="string"||!n))throw new p("JWE Initialization Vector incorrect type");if(typeof r!="string")throw new p("JWE Ciphertext missing or incorrect type");if(i!==void 0&&(typeof i!="string"||!i))throw new p("JWE Authentication Tag incorrect type");if(o!==void 0&&typeof o!="string")throw new p("JWE Protected Header incorrect type");if(e!==void 0&&(typeof e!="string"||!e))throw new p("JWE AAD incorrect type");if(a!==void 0&&!g(a))throw new p("JWE Shared Unprotected Header incorrect type");return{aad:e,ciphertext:r,iv:n,protected:o,tag:i,unprotected:a===void 0?void 0:{...a}}}function vt(t){let e,r;try{let{header:n}=t;if(g(n)){r=n.alg;let i=Object.keys(n);i.includes("alg")||(r=void 0),e=Object.fromEntries(i.map(a=>[a,a==="alg"?r:n[a]]))}else e=n;let{encrypted_key:o}=t;return[{encrypted_key:o,header:e},r]}catch(n){return[void 0,r,n]}}function St(t){let{encrypted_key:e,header:r}=t;if(e!==void 0&&typeof e!="string")throw new p("JWE Encrypted Key incorrect type");if(r!==void 0&&!g(r))throw new p("JWE Per-Recipient Unprotected Header incorrect type");if(t.protected===void 0&&r===void 0&&t.unprotected===void 0)throw new p("JOSE Header missing")}function Bt(t){let{protected:e,ciphertext:r,iv:n,tag:o,aad:i}=t,a;return e!==void 0&&(a=se(e,p,"JWE Protected Header is invalid")),[a,H(r,"ciphertext",p),n!==void 0?H(n,"iv",p):void 0,o!==void 0?H(o,"tag",p):void 0,at((e??"")+(i!==void 0?`.${i}`:""),"aad",p)]}function pe(t){return[t&&Me("keyManagementAlgorithms",t.keyManagementAlgorithms),t&&Me("contentEncryptionAlgorithms",t.contentEncryptionAlgorithms),t?.crit,t?.maxPBES2Count,t?.maxDecompressedLength]}async function Ve(t,e,r,n=Bt(t)){let[o,i,a,s,u]=n,{header:c,unprotected:d,aad:m}=t,y;if(c!==void 0||d!==void 0){if(!ae(o,c,d))throw new p("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");y={...o,...c,...d}}else y=o??{};let[h,l,b,J,w]=e,{encrypted_key:v}=t;F(p,st,b,o,y),Et(y,o);let{alg:E,enc:W}=y;if(typeof E!="string"||!E)throw new p("missing JWE Algorithm (alg) in JWE Header");let I=ee[E];if(v===""&&(!I||!V(I)))throw new p("JWE Encrypted Key incorrect type");let O=I?.mode==="integrated-encryption";if(!O&&(typeof W!="string"||!W))throw new p("missing JWE Encryption Algorithm (enc) in JWE Header");if(h&&!h.has(E)||!h&&E.startsWith("PBES2"))throw new oe('"alg" (Algorithm) Header Parameter value not allowed');let U;if(O){if(W!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(a?.byteLength)throw new p("JWE Initialization Vector must be empty for integrated encryption");if(s?.byteLength)throw new p("JWE Authentication Tag must be empty for integrated encryption")}else{if(l&&!l.has(W))throw new oe('"enc" (Encryption Algorithm) Header Parameter value not allowed');U=ge(W)}let k;if(v!==void 0)try{k=H(v,"encrypted_key",p)}catch(_){if(!I||!V(I))throw _;k=new Uint8Array}let Y=!1;typeof r=="function"&&(r=await r(o,t),Y=!0);let D=I??$(E);V(D)&&k===void 0&&(k=new Uint8Array);let fe=await M(D.mode==="direct-encryption"?U:D,r,"decrypt"),N;if(D.mode==="integrated-encryption")N=await D.decrypt(fe,k,i,u,o,y);else{let _=U,z;try{z=await kr(D,_,fe,k,y,J),V(D)&&z instanceof Uint8Array&&z.byteLength<<3!==_.cekBits&&(z=we(_))}catch(Qe){if(Qe instanceof TypeError||Qe instanceof p||Qe instanceof S)throw Qe;z=we(_)}N=await mt(_,z,i,a,s,u)}if(y.zip==="DEF"){let _=w??25e4;if(_===0)throw new S('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');if(_!==1/0&&(!Number.isSafeInteger(_)||_<1))throw new TypeError("maxDecompressedLength must be 0, a positive safe integer, or Infinity");N=await Ur(N,_).catch(z=>{throw z instanceof p?z:new p("Failed to decompress plaintext",{cause:z})})}return{plaintext:N,...o&&{protectedHeader:o},...m!==void 0&&{additionalAuthenticatedData:H(m,"aad",p)},...d&&{sharedUnprotectedHeader:d},...c&&{unprotectedHeader:c},...Y&&{key:fe}}}async function At(t,e,r){if(t instanceof Uint8Array&&(t=ve.decode(t)),typeof t!="string")throw new p("Compact JWE must be a string or Uint8Array");let{0:n,1:o,2:i,3:a,4:s,length:u}=t.split(".");if(u!==5)throw new p("Invalid Compact JWE");return Ve({ciphertext:a,iv:i||void 0,protected:n,tag:s||void 0,encrypted_key:o||void 0},e,r)}async function gn(t,e,r){return At(t,pe(r),e)}async function En(t,e,r){if(!g(t))throw new p("Flattened JWE must be an object");let n=bt(t),[o,,i]=vt(t);if(!o)throw i;let a={...n,...o};return St(a),Ve(a,pe(r),e)}async function bn(t,e,r){if(!g(t))throw new p("General JWE must be an object");let n=t.recipients;if(!Array.isArray(n))throw new p("JWE Recipients missing or incorrect type");let o=Array.from(n);if(!o.every(g))throw new p("JWE Recipients missing or incorrect type");if(!o.length)throw new p("JWE Recipients has no members");let i,a,s;try{i=pe(r),a=bt(t),s=Bt(a)}catch{throw new Q}let u=o.map(c=>vt(c));if(o.length>1)for(let[,c]of u){let d=s[0]?.alg??c??a.unprotected?.alg,m=typeof d=="string"?ee[d]:void 0;if(m&&!V(m))throw new p(`"${d}" alg may only have a single recipient`)}for(let[c]of u)if(c)try{let d={...a,...c};return St(d),await Ve(d,i,e,s)}catch{}throw new Q}function Jt(t,e,r){if(!ae(t,e,r))throw new p("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint")}function Lt(t,e,r=!1){if(!t[1]&&!t[2]&&!t[3])throw new p("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");e!==void 0&&(t[8]=e?.crit);let[,n,o,i,a,s,u,c,d]=t;if(a!==void 0&&T(a,"JWE Additional Authenticated Data"),s!==void 0&&T(s,"JWE Content Encryption Key"),u!==void 0&&T(u,"JWE Initialization Vector"),!r&&n!==void 0&&(n=he(p,n)[0],t[1]=n),o!==void 0&&(o=he(p,o)[0],t[2]=o),!r&&i!==void 0&&(i=he(p,i)[0],t[3]=i),c!==void 0&&!g(c))throw new TypeError("JWE Key Management Parameters must be an object");Jt(n,o,i);let m={...n,...o,...i};ct(p,n),F(p,st,d,n,m),Et(m,n);let{alg:y,enc:h}=m;if(typeof y!="string"||!y)throw new p('JWE "alg" (Algorithm) Header Parameter missing or invalid');let l=ee[y];if(l?.mode==="integrated-encryption"){if(h!==void 0)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must not be present for integrated encryption');if(s!==void 0)throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${y}`);if(u!==void 0)throw new TypeError(`setInitializationVector cannot be called with JWE "alg" (Algorithm) Header ${y}`);return[m,void 0,l]}if(typeof h!="string"||!h)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');return[m,ge(h),l]}async function $t(t,e,r){let[n,o,i]=e,[a,s,u,c,d,m,y,h,,l]=t,b=s,J=u,w=i??$(n.alg),v,E,W;w.mode==="integrated-encryption"?W=await M(w,r,"encrypt"):[W,v,E]=await gt(w,o,r,n,m,h),E&&(l?J=J?{...J,...E}:E:b=b?{...b,...E}:E,Jt(b,J,c));let I=b?K(JSON.stringify(b)):"",O=d?.byteLength?K(d):void 0,U=x(O?`${I}.${O}`:I),k=a;n.zip==="DEF"&&(k=await Hr(k).catch(_=>{throw new p("Failed to compress plaintext",{cause:_})}));let Y,D,fe;w.mode==="integrated-encryption"?[v,Y]=await w.encrypt(W,k,U,b,n,h):{ciphertext:Y,tag:D,iv:fe}=await yt(o,k,W,y,U);let N={ciphertext:K(Y)};return fe&&(N.iv=K(fe)),D&&(N.tag=K(D)),v?.byteLength&&(N.encrypted_key=K(v)),O&&(N.aad=O),b&&(N.protected=I),c&&(N.unprotected=c),J&&(N.header=J),N}async function xe(t,e,r){return $t(t,Lt(t,r),e)}function Kt(t){return[t.protected,t.encrypted_key,t.iv,t.ciphertext,t.tag].join(".")}var Vt=class{#e;state;constructor(e,r,n){this.#e=e,this.state=[void 0,void 0,r,n]}setUnprotectedHeader(e){return A(this.state[0],"setUnprotectedHeader"),this.state[0]=e,this}setKeyManagementParameters(e){return A(this.state[1],"setKeyManagementParameters"),this.state[1]=e,this}addRecipient(...e){return this.#e.addRecipient(...e)}encrypt(...e){return this.#e.encrypt(...e)}done(){return this.#e}},zt=class{#e;#t=[];#r;#n;#o;constructor(e){this.#e=e}addRecipient(e,r){let n=new Vt(this,e,r?.crit);return this.#t.push(n),n}setProtectedHeader(e){return A(this.#r,"setProtectedHeader"),this.#r=e,this}setSharedUnprotectedHeader(e){return A(this.#n,"setSharedUnprotectedHeader"),this.#n=e,this}setAdditionalAuthenticatedData(e){return this.#o=e,this}async encrypt(){if(!this.#t.length)throw new p("at least one recipient must be added");T(this.#e,"plaintext");let e=this.#t.length>1,r,n=this.#r,o=this.#n,i=[];for(let l of this.#t){let[b,J,w,v]=l.state,E=[this.#e,n,b,o,this.#o,void 0,void 0,J,v,e],W=Lt(E,void 0,i.length>0);i.length||(n=E[1],o=E[3]),i.push([E,W,w]);let[{alg:I,enc:O},,U]=W;if(e&&U&&!V(U))throw new p(`"${I}" alg may only have a single recipient`);if(!r)r=O;else if(r!==O)throw new p('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}for(let[,l]of i)l[2]??=$(l[0].alg);let[a,s,u]=i[0],c=e?we(s[1]):void 0;a[5]=c;let{encrypted_key:d,header:m,...y}=await $t(a,s,u),h={...y,recipients:[{}]};d&&(h.recipients[0].encrypted_key=d),m&&(h.recipients[0].header=m);for(let l=1;l<i.length;l++){let[b,[J,w,v],E]=i[l],W=b[2],[,I,O]=await gt(v,w,E,J,c,b[7]),U={encrypted_key:K(I)};if(W||O){let k={...W,...O};O&&Jt(b[1],k,b[3]),U.header=k}h.recipients.push(U)}return h}};var ze=[["verify"],["sign"]];function Gt(t){let e={name:"HMAC",hash:`SHA-${t}`};return{kty:["oct"],secret:!0,subtle:e,signing:e,usages:ze}}function Oe(t,e){let r={name:e?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${t}`};return{kty:["RSA"],subtle:r,signing:e?{...r,saltLength:e}:r,usages:ze,minRsaBits:2048}}function Ft(t,e){return{kty:["EC"],crv:t,subtle:{name:"ECDSA",namedCurve:t},signing:{name:"ECDSA",hash:`SHA-${e}`},usages:ze}}function _r(){let t={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:t,signing:t,usages:ze}}function Xt(t){let e={name:`ML-DSA-${t}`};return{kty:["AKP"],subtle:e,signing:e,usages:ze}}var Ge=$e({HS256:Gt(256),HS384:Gt(384),HS512:Gt(512),RS256:Oe(256),RS384:Oe(384),RS512:Oe(512),PS256:Oe(256,32),PS384:Oe(384,48),PS512:Oe(512,64),ES256:Ft("P-256",256),ES384:Ft("P-384",384),ES512:Ft("P-521",512),EdDSA:_r(),Ed25519:_r(),"ML-DSA-44":Xt(44),"ML-DSA-65":Xt(65),"ML-DSA-87":Xt(87)});function He(t){let e=typeof t=="string"?Ge[t]:void 0;if(!e)throw new S(`alg ${t} is not supported either by JOSE or your javascript runtime`);return e}function Wt(t,e){let r=t.protected,n=t.header,o=g(n)?{...n}:n,i=e?e[0]:t.payload;!e&&i instanceof Uint8Array&&(i=new Uint8Array(i));let a=t.signature,s={payload:i,signature:a};if(r!==void 0&&(s.protected=r),n!==void 0&&(s.header=o),r===void 0&&o===void 0)throw new f('Flattened JWS must have either of the "protected" or "header" members');if(r!==void 0&&typeof r!="string")throw new f("JWS Protected Header incorrect type");if(i===void 0)throw new f("JWS Payload missing");if(typeof a!="string")throw new f("JWS Signature missing or incorrect type");if(o!==void 0&&!g(o))throw new f("JWS Unprotected Header incorrect type");return s}function de(t){return[t&&Me("algorithms",t.algorithms),t?.crit]}function qt(t){return t===void 0?{}:se(t,f,"JWS Protected Header is invalid")}function Ct(t){let e=/[\p{Cs}\p{Cn}]/u.exec(t)?.[0];if(e!==void 0)throw new f(/\p{Cs}/u.test(e)?"JWS Payload must be a well-formed Unicode string":"JWS Payload must not contain unassigned Unicode code points");return Z.encode(t)}function vn(t){try{return x(t)}catch{throw new f("JWS Compact Serialization payload must use only ASCII characters")}}async function Fe(t,e,r,n,o){let{protected:i,header:a,payload:s}=t,u=o??qt(i);if(!ae(u,a))throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let c={...u,...a},d=Ce(u,F(f,We,e[1],u,c)),{alg:m}=c;if(typeof m!="string"||!m)throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(e[0]&&!e[0].has(m))throw new oe('"alg" (Algorithm) Header Parameter value not allowed');if(d){if(typeof s!="string")throw new f("JWS Payload must be a string")}else if(typeof s!="string"&&!(s instanceof Uint8Array))throw new f("JWS Payload must be a string or an Uint8Array instance");let y=d||typeof s!="string"?s:n(s),h=!1;typeof r=="function"&&(r=await r(u,t),h=!0);let l=He(m),b=R(i!==void 0?x(i):new Uint8Array,x("."),typeof y=="string"?e[2]??=at(y,"payload",f):y),J=H(t.signature,"signature",f),w=await M(l,r,"verify"),v=await L(w,l.subtle,"verify");l.minRsaBits&&Pe(l.alg,v);let E=!1;try{E=await crypto.subtle.verify(l.signing,v,J,b)}catch{}if(!E)throw new ie;let W={payload:typeof y=="string"?H(y,"payload",f):y};return i!==void 0&&(W.protectedHeader=u),a!==void 0&&(W.unprotectedHeader=a),h?[{...W,key:w},d]:[W,d]}async function Pt(t,e,r){if(t instanceof Uint8Array&&(t=ve.decode(t)),typeof t!="string")throw new f("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:i,length:a}=t.split(".");if(a!==3)throw new f("Invalid Compact JWS");return Fe({payload:o,protected:n,signature:i},e,r,vn)}async function Sn(t,e,r){let[n]=await Pt(t,de(r),e);return n}async function An(t,e,r){if(!g(t))throw new f("Flattened JWS must be an object");let n=Wt(t),[o]=await Fe(n,de(r),e,Ct);return o}function Jn(t,e){try{let r=Wt(t,[e]),n=qt(r.protected),{b64:o,crit:i}=n;return[r,n,Array.isArray(i)&&i.includes("b64")?typeof o=="boolean"?o?1:2:0:1]}catch{return}}async function Kn(t,e,r){if(!g(t))throw new f("General JWS must be an object");let{signatures:n,payload:o}=t;if(!Array.isArray(n))throw new f("JWS Signatures missing or incorrect type");let i=Array.from(n);if(!i.every(g))throw new f("JWS Signatures missing or incorrect type");let a;try{if(o===void 0)throw new Error;a=de(r)}catch{throw new ie}let s=o instanceof Uint8Array?new Uint8Array(o):o,u=i.map(d=>Jn(d,s)).filter(d=>d!==void 0),c=0;for(let[,,d]of u)if(c|=d,c===3)throw new f("inconsistent use of JWS Unencoded Payload (RFC7797)");for(let d of u)try{let[m]=await Fe(d[0],a,e,Ct,d[1]);return m}catch{}throw new ie}var Xe=t=>Math.floor(t.getTime()/1e3),Wn={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Cn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Ue="check_failed";function Yt(){throw new TypeError("Invalid time period format")}function It(t){typeof t!="string"&&Yt();let e=Cn.exec(t);(!e||e[4]&&e[1])&&Yt();let r=parseFloat(e[2]),n=Math.round(r*Wn[e[3][0].toLowerCase()]);return Number.isFinite(n)||Yt(),e[1]==="-"||e[4]==="ago"?-n:n}function _e(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}function Zt(t,e){if(typeof e!="string")throw new TypeError(`"${t}" claim must be a string`)}function Pn(t){if(typeof t!="string"&&(!Array.isArray(t)||Array.from(t).some(e=>typeof e!="string")))throw new TypeError('"aud" claim must be a string or an array of strings')}function Qt(t,e){return typeof t=="number"?_e(e,t):t instanceof Date?_e(e,Xe(t)):Xe(new Date)+It(t)}var Rr=t=>{let e=t.toLowerCase();return t.includes("/")?e:`application/${e}`},In=(t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(r=>t.includes(r)):!1;function er(t,e,r=!1){let n=t[e];if(!(n===void 0&&!r)){if(typeof n!="number")throw new j(`"${e}" claim must be a number`,t,e,"invalid");return n}}function tr(t,e){throw new j(`unexpected "${e}" claim value`,t,e,Ue)}function Re(t,e,r={}){let n;try{n=JSON.parse(Se.decode(e))}catch{}if(!g(n))throw new C("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o!==void 0&&(typeof t.typ!="string"||Rr(t.typ)!==Rr(o)))throw new j('unexpected "typ" JWT header value',n,"typ",Ue);let{requiredClaims:i=[],issuer:a,subject:s,audience:u,maxTokenAge:c}=r,d=[...i];c!==void 0&&d.push("iat"),u!==void 0&&d.push("aud"),s!==void 0&&d.push("sub"),a!==void 0&&d.push("iss");for(let v of new Set(d.reverse()))if(!Object.hasOwn(n,v))throw new j(`missing required "${v}" claim`,n,v,"missing");a!==void 0&&!(Array.isArray(a)?a:[a]).includes(n.iss)&&tr(n,"iss"),s!==void 0&&n.sub!==s&&tr(n,"sub"),u!==void 0&&!In(n.aud,typeof u=="string"?[u]:u)&&tr(n,"aud");let{clockTolerance:m}=r,y=0;if(typeof m=="string")y=It(m);else if(m!==void 0){if(typeof m!="number")throw new TypeError("Invalid clockTolerance option type");y=m}_e("clockTolerance option",y);let{currentDate:h}=r,l=_e("currentDate option",Xe(h===void 0?new Date:h)),b=er(n,"iat",c!==void 0),J=er(n,"nbf");if(J!==void 0&&J>l+y)throw new j('"nbf" claim timestamp check failed',n,"nbf",Ue);let w=er(n,"exp");if(w!==void 0&&w<=l-y)throw new Ae('"exp" claim timestamp check failed',n,"exp",Ue);if(c!==void 0){let v=l-b,E=_e("maxTokenAge option",typeof c=="number"?c:It(c));if(v-y>E)throw new Ae('"iat" claim timestamp check failed (too far in the past)',n,"iat",Ue);if(v<-y)throw new j('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Ue)}return n}var Dr;function te(t){return Dr.get(t)}function De(t){let e=te(t);for(let r of["iat","nbf","exp"]){let n=e[r];if(typeof n=="number"&&!Number.isFinite(n))throw new TypeError(`"${r}" claim must be a finite number`)}return Z.encode(JSON.stringify(e))}function Tt(t,e){return te(t)[e]}var ue=class{constructor(e={}){if(!g(e))throw new TypeError("JWT Claims Set MUST be an object");(Dr||=new WeakMap).set(this,structuredClone(e))}setIssuer(e){return Zt("iss",e),te(this).iss=e,this}setSubject(e){return Zt("sub",e),te(this).sub=e,this}setAudience(e){return Pn(e),te(this).aud=e,this}setJti(e){return Zt("jti",e),te(this).jti=e,this}setNotBefore(e){return te(this).nbf=Qt(e,"setNotBefore"),this}setExpirationTime(e){return te(this).exp=Qt(e,"setExpirationTime"),this}setIssuedAt(e){let r=te(this);return e===void 0?r.iat=Xe(new Date):typeof e=="string"?r.iat=_e("setIssuedAt",Xe(new Date)+It(e)):r.iat=Qt(e,"setIssuedAt"),this}};async function Tn(t,e,r){let[n,o]=await Pt(t,de(r),e);if(!o)throw new C("JWTs MUST NOT use unencoded payload");let i=Re(n.protectedHeader,n.payload,r);return{...n,payload:i}}async function kn(t,e,r){let{plaintext:n,...o}=await At(t,pe(r),e),{protectedHeader:i}=o,a=Re(i,n,r);for(let s of["iss","sub","aud"])if(i[s]!==void 0&&(s==="aud"?JSON.stringify(i.aud)!==JSON.stringify(a.aud):i[s]!==a[s]))throw new j(`replicated "${s}" claim header parameter mismatch`,a,s,"mismatch");return{payload:a,...o}}var rr=class{#e;constructor(e){T(e,"plaintext"),this.#e=[e]}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}async encrypt(e,r){return Kt(await xe([...this.#e],e,r))}};var nr=class{#e;constructor(e){T(e,"plaintext"),this.#e=[e]}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setSharedUnprotectedHeader(e){return A(this.#e[3],"setSharedUnprotectedHeader"),this.#e[3]=e,this}setUnprotectedHeader(e){return A(this.#e[2],"setUnprotectedHeader"),this.#e[2]=e,this}setAdditionalAuthenticatedData(e){return this.#e[4]=e,this}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}async encrypt(e,r){return xe([...this.#e],e,r)}};async function qe(t,e,r){let[n,o,i,a]=t,s="";if(o!==void 0){let w=he(f,o);o=w[0],s=K(w[1])}if(i!==void 0&&(i=he(f,i)[0]),!o&&!i)throw new f("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ae(o,i))throw new f("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let u={...o,...i};ct(f,o);let c=Ce(o,F(f,We,a,o,u));c||r?.();let{alg:d}=u;if(typeof d!="string"||!d)throw new f('JWS "alg" (Algorithm) Header Parameter missing or invalid');let m=He(d),y="",h=n,l;if(c){let w=t[4];w?(y=w[0]??=K(n),h=w[1]??=x(y)):(y=K(n),l=Z.encode(`${s}.${y}`))}l??=R(x(s),x("."),h);let b=await L(await M(m,e,"sign"),m.subtle,"sign");m.minRsaBits&&Pe(m.alg,b);let J={signature:K(new Uint8Array(await crypto.subtle.sign(m.signing,b,l))),payload:y};return o&&(J.protected=s),i&&(J.header=i),[J,c]}async function kt(t,e,r,n,o){let[i]=await qe([t,e,void 0,r],n,o);return`${i.protected}.${i.payload}.${i.signature}`}var or=class{#e;#t;constructor(e){T(e,"payload"),this.#e=e}setProtectedHeader(e){return A(this.#t,"setProtectedHeader"),this.#t=e,this}async sign(e,r){return kt(this.#e,this.#t,r?.crit,e,()=>{throw new TypeError("use the flattened module for creating JWS with b64: false")})}};var ir=class{#e;constructor(e){T(e,"payload"),this.#e=[e]}setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setUnprotectedHeader(e){return A(this.#e[2],"setUnprotectedHeader"),this.#e[2]=e,this}async sign(e,r){let n=[...this.#e];n[3]=r?.crit;let[o]=await qe(n,e);return o}};var ar=class{#e;state;constructor(e,r,n){this.#e=e,this.state=[void 0,void 0,r,n?.crit]}setProtectedHeader(e){return A(this.state[0],"setProtectedHeader"),this.state[0]=e,this}setUnprotectedHeader(e){return A(this.state[1],"setUnprotectedHeader"),this.state[1]=e,this}addSignature(...e){return this.#e.addSignature(...e)}sign(...e){return this.#e.sign(...e)}done(){return this.#e}},sr=class{#e;#t=[];constructor(e){this.#e=e}addSignature(e,r){let n=new ar(this,e,r);return this.#t.push(n),n}async sign(){if(!this.#t.length)throw new f("at least one signature must be added");T(this.#e,"payload");let e={signatures:[],payload:""},r=[],n;for(let o of this.#t){let[i,a,s,u]=o.state,[{payload:c,...d},m]=await qe([this.#e,i,a,u,r],s);if(n===void 0)n=m,e.payload=c;else if(n!==m)throw new f("inconsistent use of JWS Unencoded Payload (RFC7797)");e.signatures.push(d)}return e}};var xn=ue,cr=class extends xn{#e;setProtectedHeader(e){return A(this.#e,"setProtectedHeader"),this.#e=e,this}async sign(e,r){return kt(De(this),this.#e,r?.crit,e,()=>{throw new C("JWTs MUST NOT use unencoded payload")})}};var On=ue,pr=class extends On{#e=[void 0];#t;#r;#n;setProtectedHeader(e){return A(this.#e[1],"setProtectedHeader"),this.#e[1]=e,this}setKeyManagementParameters(e){return A(this.#e[7],"setKeyManagementParameters"),this.#e[7]=e,this}setContentEncryptionKey(e){return A(this.#e[5],"setContentEncryptionKey"),this.#e[5]=e,this}setInitializationVector(e){return A(this.#e[6],"setInitializationVector"),this.#e[6]=e,this}replicateIssuerAsHeader(){return this.#t=!0,this}replicateSubjectAsHeader(){return this.#r=!0,this}replicateAudienceAsHeader(){return this.#n=!0,this}async encrypt(e,r){let n=De(this);this.#e[1]&&(this.#t||this.#r||this.#n)&&(this.#e[1]={...this.#e[1],iss:this.#t?Tt(this,"iss"):void 0,sub:this.#r?Tt(this,"sub"):void 0,aud:this.#n?Tt(this,"aud"):void 0});let o=[...this.#e];return o[0]=n,Kt(await xe(o,e,r))}};var ye='"alg" (Algorithm)';function Ee(t='JWK "alg" (Algorithm) Parameter'){throw new S(`Invalid or unsupported ${t} value`)}function be(t,e){return(typeof t=="string"?Ge[t]??ee[t]:void 0)??Ee(e)}var Hn=(t,e)=>{let r=(t.match(/.{1,64}/g)||[]).join(`
|
|
3
3
|
`);return`-----BEGIN ${e}-----
|
|
4
4
|
${r}
|
|
5
5
|
-----END ${e}-----`},jr=async(t,e,r)=>{if(Be(r)){if(r.type!==t)throw new TypeError(`key is not a ${t} key`);return r.export({format:"pem",type:e})}if(!X(r))throw new TypeError(B(r,"CryptoKey","KeyObject"));if(!r.extractable)throw new TypeError("CryptoKey is not extractable");if(r.type!==t)throw new TypeError(`key is not a ${t} key`);return Hn(rt(new Uint8Array(await crypto.subtle.exportKey(e,r))),`${t.toUpperCase()} KEY`)},Mr=t=>jr("public","spki",t),Br=t=>jr("private","pkcs8",t),Ye=(t,e)=>{if(t.byteLength!==e.length)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},Lr=t=>({data:t,pos:0}),dr=t=>{let e=t.data[t.pos++];if(e===void 0)throw new Error("Unexpected end of ASN.1 input");return e},re=t=>{let e=dr(t);if(e&128){let r=e&127,n=0;for(let o=0;o<r;o++)n=n<<8|dr(t);return n}return e},Nr=(t,e=1)=>{for(;e-- >0;){t.pos++;let r=re(t);t.pos+=r}},me=(t,e,r)=>{if(dr(t)!==e)throw new Error(r)},$r=(t,e)=>{if(e<0||t.pos+e>t.data.length)throw new Error("Unexpected end of ASN.1 input");let r=t.data.subarray(t.pos,t.pos+e);return t.pos+=e,r},Un=t=>{me(t,6,"Expected algorithm OID");let e=re(t);return $r(t,e)};function _n(t,e){if(me(t,48,`Invalid ${e==="spki"?"SPKI":"PKCS#8"} structure`),re(t),e==="pkcs8"){me(t,2,"Expected version field");let r=re(t);t.pos+=r}me(t,48,"Expected algorithm identifier"),re(t)}var Rn=t=>{let e=Un(t);if(Ye(e,[43,101,110]))return"X25519";if(!Ye(e,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");me(t,6,"Expected curve OID");let r=re(t),n=$r(t,r);if(Ye(n,[42,134,72,206,61,3,1,7]))return"P-256";if(Ye(n,[43,129,4,0,34]))return"P-384";if(Ye(n,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},ur=async(t,e,r,n)=>{let o=ce(n?.extractable),i=be(r,ye);i.secret&&Ee(ye);let a=t==="spki",s;if(i.resolve)try{let u=Lr(e);_n(u,t),s=i.resolve({crv:Rn(u)})}catch{throw new S("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(t,e,s,o??a,i.usages[a?0:1])},yr=(t,e)=>nt(t.replace(e,"")),Vr=(t,e,r)=>{let n=yr(t,/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g);return ur("pkcs8",n,e,r)},zr=(t,e,r)=>{let n=yr(t,/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g);return ur("spki",n,e,r)};function Dn(t){let e=Lr(t);me(e,48,"Invalid certificate structure");let r=re(e);if(r<0||e.pos+r>e.data.length)throw new Error("Unexpected end of ASN.1 input");me(e,48,"Invalid tbsCertificate structure"),re(e),t[e.pos]===160?Nr(e,6):Nr(e,5);let n=e.pos;me(e,48,"Invalid SPKI structure");let o=re(e);return t.subarray(n,n+o+(e.pos-n))}var Gr=(t,e,r)=>{let n;try{let o=yr(t,/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g);n=Dn(o)}catch(o){throw new TypeError("Failed to parse the X.509 certificate",{cause:o})}return ur("spki",n,e,r)};function Nn(t){return Mr(t)}function jn(t){return Br(t)}async function mr(t){if(Be(t))if(t.type==="secret")t=t.export();else return t.export({format:"jwk"});if(t instanceof Uint8Array)return{kty:"oct",k:K(t)};if(!X(t))throw new TypeError(B(t,"CryptoKey","KeyObject","Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let e=await crypto.subtle.exportKey("jwk",t);delete e.ext,delete e.key_ops,delete e.use,e.kty!=="AKP"&&delete e.alg;for(let r of Object.keys(e))e[r]===void 0&&delete e[r];return e}var ne=(t,e)=>{if(typeof t!="string"||!t)throw new Je(`${e} missing or invalid`)};async function Fr(t,e){let r;if(g(t)){if(r=Ie(t),typeof r.kty!="string")throw new TypeError(B(t,"CryptoKey","KeyObject","JSON Web Key"))}else if(Rt(t))r=Ie(await mr(t));else throw new TypeError(B(t,"CryptoKey","KeyObject","JSON Web Key"));if(e??="sha256",e!=="sha256"&&e!=="sha384"&&e!=="sha512")throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(r.kty){case"AKP":ne(r.alg,'"alg" (Algorithm) Parameter'),ne(r.pub,'"pub" (Public key) Parameter'),n={alg:r.alg,kty:r.kty,pub:r.pub};break;case"EC":ne(r.crv,'"crv" (Curve) Parameter'),ne(r.x,'"x" (X Coordinate) Parameter'),ne(r.y,'"y" (Y Coordinate) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x,y:r.y};break;case"OKP":ne(r.crv,'"crv" (Subtype of Key Pair) Parameter'),ne(r.x,'"x" (Public Key) Parameter'),n={crv:r.crv,kty:r.kty,x:r.x};break;case"RSA":ne(r.e,'"e" (Exponent) Parameter'),ne(r.n,'"n" (Modulus) Parameter'),n={e:r.e,kty:r.kty,n:r.n};break;case"oct":if(typeof r.k!="string")throw new Je('"k" (Key Value) Parameter missing or invalid');n={k:r.k,kty:r.kty};break;default:throw new S('"kty" (Key Type) Parameter missing or unsupported')}let o=x(JSON.stringify(n));return K(await ot(e,o))}async function Mn(t,e){e??="sha256";let r=await Fr(t,e);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${r}`}async function Bn(t,e){let r={...t,...e?.header};if(!g(r.jwk))throw new f('"jwk" (JSON Web Key) Header Parameter must be a JSON object');let n;try{n=Le(r.jwk)}catch(a){throw new f("Invalid Embedded JWK",{cause:a})}let o=He(r.alg);if(n.use!==void 0&&n.use!=="sig")throw new f('Invalid Embedded JWK, its "use" must be "sig" when present');if(n.alg!==void 0&&n.alg!==o.alg)throw new f(`Invalid Embedded JWK, its "alg" must be "${o.alg}" when present`);let i=await q(o,n,!0);if(i.type!=="public")throw new f('"jwk" (JSON Web Key) Header Parameter must be a public key');return i}function Ln(t,e,r,n){let{kty:o,key_ops:i,ext:a,kid:s,alg:u,use:c,crv:d}=t;return(a===void 0||typeof a=="boolean")&&(i===void 0||Array.isArray(i)&&i.every((m,y)=>typeof m=="string"&&i.indexOf(m)===y)&&i.includes("verify"))&&e.kty.includes(o)&&(n===void 0||typeof n=="string"&&n===s)&&(u===void 0?o!=="AKP":r===u)&&(c===void 0||c==="sig")&&(!e.crv||d===e.crv)}async function Xr(t,e,r){let n=t.get(e)||t.set(e,{}).get(e),{alg:o}=r;if(n[o]===void 0){let i=q(r,e,!0).then(a=>{if(a.type!=="public")throw new Ke("JSON Web Key Set members must be public keys");return n[o]=a,a}).catch(a=>{throw n[o]===i&&delete n[o],a});n[o]=i}return n[o]}function xt(t){let e;try{e=structuredClone(t)}catch{}if(!it(e))throw new Ke("JSON Web Key Set malformed");let r=e.keys.map(o=>{let i=Ie(o);return Array.isArray(i.key_ops)&&(i.key_ops=[...i.key_ops]),i}),n=new WeakMap;return Object.defineProperty(async(o,i)=>{let{alg:a,kid:s}={...o,...i?.header},u=typeof a=="string"?Ge[a]:void 0;if(!u||u.secret)throw new S('Unsupported "alg" value for a JSON Web Key Set');let c=e.keys.filter((y,h)=>Ln(r[h],u,a,s)),{0:d,length:m}=c;if(!m)throw new le;if(m!==1){let y=new Ne;throw y[Symbol.asyncIterator]=async function*(){for(let h of c)try{yield await Xr(n,h,u)}catch{}},y}return Xr(n,d,u)},"jwks",{value:()=>structuredClone(e)})}function $n(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var fr;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(fr="jose/v6.2.12");var Yr=Symbol();async function Vn(t,e,r,n=fetch){let o=await n(t,{method:"GET",signal:r,redirect:"manual",headers:e}).catch(i=>{throw i.name==="TimeoutError"?new je:i});if(o.status!==200)throw new P("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new P("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var Zr=Symbol();function Ze(t,e){return Number.isFinite(t)&&Date.now()<t+e}function qr(t,e,r){if(Number.isNaN(t))throw new TypeError(`"${r}" option must not be NaN`);return typeof t=="number"?t:e}function zn(t,e){if(!(t instanceof URL))throw new TypeError("url must be an instance of URL");let r=new URL(t.href).href,n=e??{},o=n.timeoutDuration;if(typeof o=="number"&&(!Number.isInteger(o)||o<0))throw new TypeError('"timeoutDuration" option must be a non-negative integer');let i=typeof o=="number"?o:5e3,a=qr(n.cooldownDuration,3e4,"cooldownDuration"),s=qr(n.cacheMaxAge,6e5,"cacheMaxAge"),u=new Headers(n.headers);fr&&!u.has("User-Agent")&&u.set("User-Agent",fr),u.has("accept")||u.set("accept","application/json, application/jwk-set+json");let c=n[Yr],d=n[Zr],m,y,h=0,l=0,b;if(d&&typeof d=="object"){let{uat:w,jwks:v}=d;Ze(w,s)&&it(v)&&(m=w,b=xt(v))}let J=async()=>{if(y&&$n()&&(y=void 0),!y){let w=++h,v=y=Vn(r,u,AbortSignal.timeout(i),c).then(E=>{let W=xt(E);if(w<=l)return;b=W;let I=Date.now();d&&(d.uat=I,d.jwks=E),m=I,l=w}).finally(()=>{y===v&&(y=void 0)})}await y};return Object.defineProperties(async(w,v)=>{(!b||!Ze(m,s))&&await J();try{return await b(w,v)}catch(E){if(E instanceof le&&!Ze(m,a))return await J(),b(w,v);throw E}},{coolingDown:{get:()=>Ze(m,a),enumerable:!0},fresh:{get:()=>Ze(m,s),enumerable:!0},reload:{value:J,enumerable:!0},reloading:{get:()=>!!y,enumerable:!0},jwks:{value:()=>b?.jwks(),enumerable:!0}})}var Gn=ue,lr=class extends Gn{encode(){let e=K(JSON.stringify({alg:"none"})),r=K(De(this));return`${e}.${r}.`}static decode(e,r){if(typeof e!="string")throw new C("Unsecured JWT must be a string");let{0:n,1:o,2:i,length:a}=e.split(".");if(a!==3||i!=="")throw new C("Invalid Unsecured JWT");let s,u;try{s=se(n,f,"JWS Protected Header is invalid");let c=F(f,We,void 0,s,s);u=Ce(s,c)}catch(c){throw c instanceof f?new C("Invalid Unsecured JWT",{cause:c}):c}if(s.alg!=="none")throw new C("Invalid Unsecured JWT");if(!u)throw new C("JWTs MUST NOT use unencoded payload");return{payload:Re(s,H(o,"payload",C),r),header:s}}};async function Fn(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN PUBLIC KEY-----")!==0)throw new TypeError('"spki" must be SPKI formatted string');return zr(t,e,r)}async function Xn(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw new TypeError('"x509" must be X.509 formatted string');return Gr(t,e,r)}async function qn(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN PRIVATE KEY-----")!==0)throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Vr(t,e,r)}async function Yn(t,e,r){if(!g(t))throw new TypeError("JWK must be an object");let n=Le(t),o=ce(r?.extractable),{alg:i}=n;if(e??=i,n.kty!=="oct"&&!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(n.kty){case"oct":if(typeof n.k!="string")throw new TypeError('missing "k" (Key Value) Parameter value');return G(n.k);case"AKP":{if(typeof i!="string"||!i)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(e!==i)throw new TypeError("JWK alg and alg option value mismatch");return q(be(e),n,o)}case"RSA":case"EC":case"OKP":return q(be(e),n,o);default:throw new S('Unsupported "kty" (Key Type) Parameter value')}}function Zn(t){let e;if(typeof t=="string"){let n=t.split(".");(n.length===3||n.length===5)&&([e]=n)}else if(typeof t=="object"&&t)if("protected"in t)e=t.protected;else throw new TypeError("Token does not contain a Protected Header");let r="Invalid Token or Protected Header formatting";if(typeof e!="string"||!e)throw new TypeError(r);return se(e,TypeError,r)}function Qn(t){if(typeof t!="string")throw new C("JWTs must use Compact JWS serialization, JWT must be a string");let{1:e,length:r}=t.split(".");if(r===5)throw new C("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new C("Invalid JWT");if(!e)throw new C("JWTs must contain a payload");let n;try{n=G(e)}catch{throw new C("Failed to base64url decode the payload")}let o;try{o=JSON.parse(Se.decode(n))}catch{throw new C("Failed to parse the decoded payload as JSON")}if(!g(o))throw new C("Invalid JWT Claims Set");return o}function eo(t){let e=t?.modulusLength??2048;if(typeof e!="number"||!Number.isInteger(e)||e<2048)throw new S("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return e}async function to(t,e){let r=ce(e?.extractable),n=be(t,ye);n.secret&&Ee(ye);let o;if(n.resolve){let i=e?.crv??"P-256";if(!["P-256","P-384","P-521","X25519"].includes(i))throw new S("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, and X25519");o=n.resolve({crv:i})}else{if(n.crv!==void 0&&e?.crv!==void 0&&e.crv!==n.crv)throw new S(`Invalid or unsupported crv option provided, the only supported value for ${t} is ${n.crv}`);o=n.kty[0]==="RSA"?{...n.subtle,publicExponent:Uint8Array.of(1,0,1),modulusLength:eo(e)}:n.subtle}return crypto.subtle.generateKey(o,r??!1,[...n.usages[1],...n.usages[0]])}async function ro(t,e){let r=ce(e?.extractable),n,o,i;switch(t){case"HS256":case"HS384":case"HS512":n=+t.slice(-3),o={name:"HMAC",hash:`SHA-${n}`,length:n},i=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return crypto.getRandomValues(new Uint8Array(+t.slice(-3)>>3));case"A128KW":case"A192KW":case"A256KW":n=+t.slice(1,4),o={name:"AES-KW",length:n},i=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":n=+t.slice(1,4),o={name:"AES-GCM",length:n},i=["encrypt","decrypt"];break;default:Ee(ye)}return crypto.subtle.generateKey(o,r??!1,i)}var oc="WebCryptoAPI";export{rr as CompactEncrypt,or as CompactSign,Bn as EmbeddedJWK,pr as EncryptJWT,nr as FlattenedEncrypt,ir as FlattenedSign,zt as GeneralEncrypt,sr as GeneralSign,cr as SignJWT,lr as UnsecuredJWT,Ut as base64url,Fr as calculateJwkThumbprint,Mn as calculateJwkThumbprintUri,gn as compactDecrypt,Sn as compactVerify,xt as createLocalJWKSet,zn as createRemoteJWKSet,oc as cryptoRuntime,Yr as customFetch,Qn as decodeJwt,Zn as decodeProtectedHeader,wr as errors,mr as exportJWK,jn as exportPKCS8,Nn as exportSPKI,En as flattenedDecrypt,An as flattenedVerify,bn as generalDecrypt,Kn as generalVerify,to as generateKeyPair,ro as generateSecret,Yn as importJWK,qn as importPKCS8,Fn as importSPKI,Xn as importX509,Zr as jwksCache,kn as jwtDecrypt,Tn as jwtVerify};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* COPYRIGHT Esri - https://js.arcgis.com/
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
var l=(s,t)=>{let e=s;for(;e;){if(e===t)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},g=(s,t,e)=>{let n=d(t).subscribe;return n(o=>{o.some(r=>l(s,r.target))&&e()})},c={},d=s=>{let t=s.join(","),e=c[t];if(e!==void 0)return e;let n=new Set,o=new MutationObserver(r=>n.forEach(i=>i(r)));globalThis.document&&o.observe(document.documentElement,{attributes:!0,attributeFilter:s,subtree:!0});let a={subscribe:r=>(n.add(r),()=>{n.delete(r),n.size===0&&(o.disconnect(),c[t]=void 0)})};return c[t]=a,a},u=(s,t)=>{let e=s;for(;e;){let n=e.closest?.(t);if(n)return n;let o=e.getRootNode?.();if(o===globalThis.document)return;e=o?.host}};var h=(s,t,e)=>u(s,`[${t}]`)?.getAttribute(t)??e;export{g as a,u as b,h as c};
|