diff --git a/Tools/Controller/go.mod b/Tools/Controller/go.mod index e3fdd519..83489d93 100644 --- a/Tools/Controller/go.mod +++ b/Tools/Controller/go.mod @@ -38,7 +38,7 @@ require ( github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/xo/terminfo v1.2.0 // indirect + github.com/xo/terminfo v1.3.0 // indirect golang.org/x/text v0.43.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/Tools/Controller/go.sum b/Tools/Controller/go.sum index 5dcf7ed7..351ccc9d 100644 --- a/Tools/Controller/go.sum +++ b/Tools/Controller/go.sum @@ -68,8 +68,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/xo/terminfo v1.2.0 h1:d0ZTOCpuGE0lwSAOs0zcJjwz3jWQyqcRt9XbGJpCOl4= -github.com/xo/terminfo v1.2.0/go.mod h1:lGzkSo8Fe7IRh/w+Gqz7n5mDog4FVXCj3gy/DYTBqio= +github.com/xo/terminfo v1.3.0 h1:KstyePbNW6UaLq9y12+544VK4aTP3Eku/sym3a9+UgQ= +github.com/xo/terminfo v1.3.0/go.mod h1:lGzkSo8Fe7IRh/w+Gqz7n5mDog4FVXCj3gy/DYTBqio= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= diff --git a/Tools/Controller/internal/programmer/toolchain_policy_gen.go b/Tools/Controller/internal/programmer/toolchain_policy_gen.go index 027144f5..c0434d2c 100644 --- a/Tools/Controller/internal/programmer/toolchain_policy_gen.go +++ b/Tools/Controller/internal/programmer/toolchain_policy_gen.go @@ -4,7 +4,7 @@ package programmer const generatedToolchainPolicyJSON = "{\n \"name\": \"controllerboardmini-atmega328p\",\n \"fqbn\": \"MiniCore:avr:328:bootloader=uart0,eeprom=keep,baudrate=115200,variant=modelP,BOD=2v7,LTO=Os_flto,clock=16MHz_external\",\n \"target\": {\n \"mcu\": \"atmega328p\",\n \"clock_hz\": 16000000,\n \"bootloader\": \"UART0 Urboot/urclock\",\n \"baud\": 115200,\n \"application_limit_bytes\": 32384,\n \"flash_bytes\": 32768,\n \"eeprom_bytes\": 1024\n },\n \"library_index\": \"https://downloads.arduino.cc/libraries/library_index.json.gz\",\n \"cli\": {\n \"dependency\": \"arduino-cli\",\n \"repository\": \"arduino/arduino-cli\",\n \"release_api\": \"https://api.github.com/repos/arduino/arduino-cli/releases?per_page=100\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"1.5.1\"\n },\n \"assets\": [\n {\n \"goos\": \"windows\",\n \"goarch\": \"amd64\",\n \"suffix\": \"_Windows_64bit.zip\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"windows\",\n \"goarch\": \"386\",\n \"suffix\": \"_Windows_32bit.zip\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"amd64\",\n \"suffix\": \"_Linux_64bit.tar.gz\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"arm64\",\n \"suffix\": \"_Linux_ARM64.tar.gz\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"amd64\",\n \"suffix\": \"_macOS_64bit.tar.gz\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"arm64\",\n \"suffix\": \"_macOS_ARM64.tar.gz\",\n \"archive\": \"tar.gz\"\n }\n ]\n },\n \"core\": {\n \"id\": \"MiniCore:avr\",\n \"index_url\": \"https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"3.1.2\"\n }\n },\n \"libraries\": [\n {\n \"name\": \"Adafruit PWM Servo Driver Library\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"3.0.3\"\n }\n },\n {\n \"name\": \"Adafruit INA219\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"1.2.3\"\n }\n },\n {\n \"name\": \"rc-switch\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"2.6.4\"\n }\n },\n {\n \"name\": \"TM1637TinyDisplay\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"1.12.2\"\n }\n },\n {\n \"name\": \"DallasTemperature\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"4.0.6\"\n }\n },\n {\n \"name\": \"OneWire\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"2.3.8\"\n }\n }\n ],\n \"bootloader\": {\n \"repository\": \"stefanrueger/urboot\",\n \"tag_prefix\": \"u\",\n \"tags_api\": \"https://api.github.com/repos/stefanrueger/urboot/tags?per_page=100\",\n \"commits_api\": \"https://api.github.com/repos/stefanrueger/urboot/commits\",\n \"canary_ref\": \"main\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"8.0\"\n }\n },\n \"go\": {\n \"version_url\": \"https://go.dev/VERSION?m=text\",\n \"constraint\": {\n \"channel\": \"stable\",\n \"minimum_version\": \"1.25.0\"\n }\n }\n}\n" -const generatedToolchainLockJSON = "{\n \"policy_name\": \"controllerboardmini-atmega328p\",\n \"resolved_at_utc\": \"2026-10-30T01:24:36.917Z\",\n \"firmware\": {\n \"name\": \"controllerboardmini-atmega328p\",\n \"fqbn\": \"MiniCore:avr:328:bootloader=uart0,eeprom=keep,baudrate=115200,variant=modelP,BOD=2v7,LTO=Os_flto,clock=16MHz_external\",\n \"package_indexes\": [\n \"https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json\"\n ],\n \"cli\": {\n \"dependency\": \"arduino-cli\",\n \"version\": \"1.5.1\",\n \"assets\": [\n {\n \"goos\": \"windows\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Windows_64bit.zip\",\n \"sha256\": \"fabe42e0eb04d00e776a66178299ff95a46c623dbc260f997e58fd514853dd40\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"windows\",\n \"goarch\": \"386\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Windows_32bit.zip\",\n \"sha256\": \"885e491c7c7fb8b396151c09daa5c4c56d8b60697d172a5cfe72c939eed50fe3\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Linux_64bit.tar.gz\",\n \"sha256\": \"28a8e119c498a25607821c36cb2dc49e8463941b261a0d99091baa7bc692dd2b\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"arm64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Linux_ARM64.tar.gz\",\n \"sha256\": \"1e69e077479f300614d4551334e0a33f08ee40b04315d83b8e7e0e94f0d0ee62\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_macOS_64bit.tar.gz\",\n \"sha256\": \"c982e940027996bea9901050e95fae99c59c1dcfee54beedecaf28141e7bf2e7\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"arm64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_macOS_ARM64.tar.gz\",\n \"sha256\": \"cb952e8c1621c95ef5f1d17831c945e3d0ec5973f89c557a7ec8feb9c4f7d4c9\",\n \"archive\": \"tar.gz\"\n }\n ]\n },\n \"core_id\": \"MiniCore:avr\",\n \"core_version\": \"3.1.3\",\n \"libraries\": [\n {\n \"name\": \"Adafruit PWM Servo Driver Library\",\n \"version\": \"3.0.3\"\n },\n {\n \"name\": \"Adafruit INA219\",\n \"version\": \"1.2.3\"\n },\n {\n \"name\": \"rc-switch\",\n \"version\": \"2.6.4\"\n },\n {\n \"name\": \"TM1637TinyDisplay\",\n \"version\": \"1.12.2\"\n },\n {\n \"name\": \"DallasTemperature\",\n \"version\": \"4.0.6\"\n },\n {\n \"name\": \"OneWire\",\n \"version\": \"2.3.8\"\n }\n ],\n \"provided_tools\": [\n \"AVR compiler/programmer tools supplied by the resolved MiniCore package\",\n \"Urboot/Urclock UART programmer metadata supplied by the resolved MiniCore package\"\n ]\n },\n \"core_source\": {\n \"url\": \"https://MCUdude.github.io/MiniCore/MiniCore-3.1.3.tar.bz2\",\n \"sha256\": \"385387b09f451e0e6bd45f3852e4c47e070643167be336a742c1a1d2a4c70935\"\n },\n \"libraries\": [\n {\n \"name\": \"Adafruit PWM Servo Driver Library\",\n \"version\": \"3.0.3\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/adafruit/Adafruit_PWM_Servo_Driver_Library-3.0.3.zip\",\n \"sha256\": \"320902ab529a1cfcf4df35212fa0c30293956a6a456b198820df58de3504dbc6\"\n },\n {\n \"name\": \"Adafruit INA219\",\n \"version\": \"1.2.3\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/adafruit/Adafruit_INA219-1.2.3.zip\",\n \"sha256\": \"7187663dc53a87c2d4d83216ccd66f680453c9e9b48416d4632d6f00632e631e\"\n },\n {\n \"name\": \"rc-switch\",\n \"version\": \"2.6.4\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/sui77/rc_switch-2.6.4.zip\",\n \"sha256\": \"ed53920db3a38debe53e43b3bf8849ec3583aa419ef1f421a45662bcf056e014\"\n },\n {\n \"name\": \"TM1637TinyDisplay\",\n \"version\": \"1.12.2\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/jasonacox/TM1637TinyDisplay-1.12.2.zip\",\n \"sha256\": \"50cda70a5cae3ed1b3949ce9db417e9918330716b4d286a7dcb3b1f12ad6dba1\"\n },\n {\n \"name\": \"DallasTemperature\",\n \"version\": \"4.0.6\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/milesburton/DallasTemperature-4.0.6.zip\",\n \"sha256\": \"fb90dffd2bbd10b8eb5943968e8300ada5e4af17793b0f80c10359702d9de4e4\"\n },\n {\n \"name\": \"OneWire\",\n \"version\": \"2.3.8\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/PaulStoffregen/OneWire-2.3.8.zip\",\n \"sha256\": \"dd76d1480a2f4c94348e8c8307ea74206d2936d9c80c73be67783fd200f2be17\"\n }\n ],\n \"bootloader\": {\n \"repository\": \"stefanrueger/urboot\",\n \"tag\": \"u8.0.1\",\n \"version\": \"8.0.1\",\n \"source_commit\": \"bd52751acaa5923163e938a6e35051c22317da68\",\n \"tree_hash\": \"45f53abdb3c6164df0ff853232ba58b62fa1409b\"\n },\n \"go\": {\n \"version\": \"1.27.3\",\n \"go_mod_sha256\": \"59a2cdac2bbb5146db8bc6f6419f0e5077d8b7a375ffb23b8839811b04dadbd8\",\n \"go_sum_sha256\": \"12b3c9489dfcc0a34010eb558aef19853274ef42d84d4d448d51292416be1380\"\n }\n}\n" +const generatedToolchainLockJSON = "{\n \"policy_name\": \"controllerboardmini-atmega328p\",\n \"resolved_at_utc\": \"2026-11-03T01:20:06.147Z\",\n \"firmware\": {\n \"name\": \"controllerboardmini-atmega328p\",\n \"fqbn\": \"MiniCore:avr:328:bootloader=uart0,eeprom=keep,baudrate=115200,variant=modelP,BOD=2v7,LTO=Os_flto,clock=16MHz_external\",\n \"package_indexes\": [\n \"https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json\"\n ],\n \"cli\": {\n \"dependency\": \"arduino-cli\",\n \"version\": \"1.5.1\",\n \"assets\": [\n {\n \"goos\": \"windows\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Windows_64bit.zip\",\n \"sha256\": \"fabe42e0eb04d00e776a66178299ff95a46c623dbc260f997e58fd514853dd40\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"windows\",\n \"goarch\": \"386\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Windows_32bit.zip\",\n \"sha256\": \"885e491c7c7fb8b396151c09daa5c4c56d8b60697d172a5cfe72c939eed50fe3\",\n \"archive\": \"zip\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Linux_64bit.tar.gz\",\n \"sha256\": \"28a8e119c498a25607821c36cb2dc49e8463941b261a0d99091baa7bc692dd2b\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"linux\",\n \"goarch\": \"arm64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_Linux_ARM64.tar.gz\",\n \"sha256\": \"1e69e077479f300614d4551334e0a33f08ee40b04315d83b8e7e0e94f0d0ee62\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"amd64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_macOS_64bit.tar.gz\",\n \"sha256\": \"c982e940027996bea9901050e95fae99c59c1dcfee54beedecaf28141e7bf2e7\",\n \"archive\": \"tar.gz\"\n },\n {\n \"goos\": \"darwin\",\n \"goarch\": \"arm64\",\n \"url\": \"https://github.com/arduino/arduino-cli/releases/download/v1.5.1/arduino-cli_1.5.1_macOS_ARM64.tar.gz\",\n \"sha256\": \"cb952e8c1621c95ef5f1d17831c945e3d0ec5973f89c557a7ec8feb9c4f7d4c9\",\n \"archive\": \"tar.gz\"\n }\n ]\n },\n \"core_id\": \"MiniCore:avr\",\n \"core_version\": \"3.1.3\",\n \"libraries\": [\n {\n \"name\": \"Adafruit PWM Servo Driver Library\",\n \"version\": \"3.0.3\"\n },\n {\n \"name\": \"Adafruit INA219\",\n \"version\": \"1.2.3\"\n },\n {\n \"name\": \"rc-switch\",\n \"version\": \"2.6.4\"\n },\n {\n \"name\": \"TM1637TinyDisplay\",\n \"version\": \"1.12.2\"\n },\n {\n \"name\": \"DallasTemperature\",\n \"version\": \"4.0.6\"\n },\n {\n \"name\": \"OneWire\",\n \"version\": \"2.3.8\"\n }\n ],\n \"provided_tools\": [\n \"AVR compiler/programmer tools supplied by the resolved MiniCore package\",\n \"Urboot/Urclock UART programmer metadata supplied by the resolved MiniCore package\"\n ]\n },\n \"core_source\": {\n \"url\": \"https://MCUdude.github.io/MiniCore/MiniCore-3.1.3.tar.bz2\",\n \"sha256\": \"385387b09f451e0e6bd45f3852e4c47e070643167be336a742c1a1d2a4c70935\"\n },\n \"libraries\": [\n {\n \"name\": \"Adafruit PWM Servo Driver Library\",\n \"version\": \"3.0.3\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/adafruit/Adafruit_PWM_Servo_Driver_Library-3.0.3.zip\",\n \"sha256\": \"320902ab529a1cfcf4df35212fa0c30293956a6a456b198820df58de3504dbc6\"\n },\n {\n \"name\": \"Adafruit INA219\",\n \"version\": \"1.2.3\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/adafruit/Adafruit_INA219-1.2.3.zip\",\n \"sha256\": \"7187663dc53a87c2d4d83216ccd66f680453c9e9b48416d4632d6f00632e631e\"\n },\n {\n \"name\": \"rc-switch\",\n \"version\": \"2.6.4\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/sui77/rc_switch-2.6.4.zip\",\n \"sha256\": \"ed53920db3a38debe53e43b3bf8849ec3583aa419ef1f421a45662bcf056e014\"\n },\n {\n \"name\": \"TM1637TinyDisplay\",\n \"version\": \"1.12.2\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/jasonacox/TM1637TinyDisplay-1.12.2.zip\",\n \"sha256\": \"50cda70a5cae3ed1b3949ce9db417e9918330716b4d286a7dcb3b1f12ad6dba1\"\n },\n {\n \"name\": \"DallasTemperature\",\n \"version\": \"4.0.6\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/milesburton/DallasTemperature-4.0.6.zip\",\n \"sha256\": \"fb90dffd2bbd10b8eb5943968e8300ada5e4af17793b0f80c10359702d9de4e4\"\n },\n {\n \"name\": \"OneWire\",\n \"version\": \"2.3.8\",\n \"url\": \"https://downloads.arduino.cc/libraries/github.com/PaulStoffregen/OneWire-2.3.8.zip\",\n \"sha256\": \"dd76d1480a2f4c94348e8c8307ea74206d2936d9c80c73be67783fd200f2be17\"\n }\n ],\n \"bootloader\": {\n \"repository\": \"stefanrueger/urboot\",\n \"tag\": \"u8.0.1\",\n \"version\": \"8.0.1\",\n \"source_commit\": \"bd52751acaa5923163e938a6e35051c22317da68\",\n \"tree_hash\": \"45f53abdb3c6164df0ff853232ba58b62fa1409b\"\n },\n \"go\": {\n \"version\": \"1.27.3\",\n \"go_mod_sha256\": \"007c676538e2254b040b7808161626694420cda59f7d6030c16dad2268d848bd\",\n \"go_sum_sha256\": \"debaacbc938cf35920da474d62d99f5bd3e0daafb79e1b315f45e8a7daefb23c\"\n }\n}\n" const ( generatedBoardProfile = "controllerboardmini-atmega328p" diff --git a/Tools/Controller/internal/webui/dist/assets/app-DHmIY1mo.js b/Tools/Controller/internal/webui/dist/assets/app-DeBWQZ2a.js similarity index 62% rename from Tools/Controller/internal/webui/dist/assets/app-DHmIY1mo.js rename to Tools/Controller/internal/webui/dist/assets/app-DeBWQZ2a.js index f0f8cac7..c61b9373 100644 --- a/Tools/Controller/internal/webui/dist/assets/app-DHmIY1mo.js +++ b/Tools/Controller/internal/webui/dist/assets/app-DeBWQZ2a.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunk-CQk5ARdV.js","assets/chunk-COZaly3R.js","assets/chunk-BepNkYer.js","assets/chunk-CWMYvVMg.js","assets/chunk-Co4i84v0.js","assets/chunk-F-tPTz9z.js","assets/chunk-Bi9TV8AN.js","assets/chunk-eKoA1lB1.js","assets/chunk-DzUGOX3N.js","assets/chunk-DQyIR_Rr.js","assets/workbench-D1U8nUNX.css","assets/chunk-ByLILXol.js","assets/chunk-BLxVMrn3.js","assets/chunk-BHa6AuNE.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunk-BEQPqDaE.js","assets/chunk-CNKgOZEf.js","assets/chunk-CaV14yNF.js","assets/chunk-CWQLWOOn.js","assets/chunk-B6TQ82AF.js","assets/chunk-B3YpOg3Z.js","assets/chunk-BVsUkuBT.js","assets/chunk-BZ_h0xog.js","assets/chunk--9VB0-2-.js","assets/chunk-BndaF2VU.js","assets/workbench-D1U8nUNX.css","assets/chunk-BzMnsFp-.js","assets/chunk-BcFfnhtq.js","assets/chunk-DyKkUGk4.js"])))=>i.map(i=>d[i]); var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function ee(){}var w={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function T(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function E(e,t){return T(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function O(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ee,ee):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ae(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ae(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+O(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),ae(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=E(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,E());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,ee=5,w=-1;function te(){return g?!0:!(e.unstable_now()-wt&&te());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(T)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=T,E=function(){D.postMessage(null)}}else E=function(){_(T,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,E()))),r},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1we||(e.current=Ce[we],Ce[we]=null,we--)}function j(e,t){we++,Ce[we]=e.current,e.current=t}var De=Te(null),Oe=Te(null),ke=Te(null),Ae=Te(null);function je(e,t){switch(j(ke,t),j(Oe,e),j(De,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Ee(De),j(De,e)}function Me(){Ee(De),Ee(Oe),Ee(ke)}function Ne(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,j(Ae,e)),t=De.current;var n=dp(t,e.type);t!==n&&(j(Oe,e),j(De,n))}function Pe(e){Oe.current===e&&(Ee(De),Ee(Oe)),Ae.current===e&&(Ee(Ae),sh._currentValue=Se)}var Fe,Ie;function Le(e){if(Fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||``,Ie=-1)`:-1`)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Re=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Le(n):``}function Be(e,t){switch(e.tag){case 26:case 27:case 5:return Le(e.type);case 16:return Le(`Lazy`);case 13:return e.child!==t&&t!==null?Le(`Suspense Fallback`):Le(`Suspense`);case 19:return Le(`SuspenseList`);case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return Le(`Activity`);case 30:return Le(`ViewTransition`);default:return``}}function Ve(e){try{var t=``,n=null;do t+=Be(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var He=Object.prototype.hasOwnProperty,Ue=t.unstable_scheduleCallback,We=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Ke=t.unstable_requestPaint,qe=t.unstable_now,Je=t.unstable_getCurrentPriorityLevel,Ye=t.unstable_ImmediatePriority,Xe=t.unstable_UserBlockingPriority,Ze=t.unstable_NormalPriority,Qe=t.unstable_LowPriority,$e=t.unstable_IdlePriority,et=t.log,tt=t.unstable_setDisableYieldValue,nt=null,rt=null;function it(e){if(typeof et==`function`&&tt(e),rt&&typeof rt.setStrictMode==`function`)try{rt.setStrictMode(nt,e)}catch{}}var at=Math.clz32?Math.clz32:ct,ot=Math.log,st=Math.LN2;function ct(e){return e>>>=0,e===0?32:31-(ot(e)/st|0)|0}var lt=256,ut=262144,dt=4194304;function ft(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ft(n))):i=ft(o):i=ft(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ft(n))):i=ft(o)):i=ft(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function mt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ht(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function M(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0=fr),hr=` `,gr=!1;function _r(e,t){switch(e){case`keyup`:return dr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function vr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var yr=!1;function br(e,t){switch(e){case`compositionend`:return vr(t);case`keypress`:return t.which===32?(gr=!0,hr):null;case`textInput`:return e=t.data,e===hr&&gr?null:e;default:return null}}function xr(e,t){if(yr)return e===`compositionend`||!z&&_r(e,t)?(e=Fn(),Pn=Nn=Mn=null,yr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Wr(n)}}function Kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ur(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ur(e.document)}return t}function Jr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Yr=kn&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Ur(r)||(r=Xr,`selectionStart`in r&&Jr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qr&&Hr(Qr,r)||(Qr=r,r=Jf(Zr,`onSelect`),0>=o,i-=o,Xi=1<<32-at(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),B&&Qi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),B&&Qi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return B&&Qi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),B&&Qi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===re&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case ne:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===re){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),co(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===de&&to(l)===r.type){n(e,r.sibling),c=a(r,o.props),co(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===re?(c=Li(o.props.children,e.mode,c,o.key),co(c,o),c.return=e,e=c):(c=Ii(o.type,o.key,o.props,null,e.mode,c),co(c,o),c.return=e,e=c)}return s(e);case D:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Bi(o,e.mode,c),c.return=e,e=c}return s(e);case de:return o=to(o),_(e,r,o,c)}if(xe(o))return h(e,r,o,c);if(ve(o)){if(l=ve(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,so(o),c);if(o.$$typeof===oe)return _(e,r,Ea(e,o),c);lo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ri(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{oo=0;var i=_(e,t,n,r);return ao=null,i}catch(t){if(t===Ya||t===Za)throw t;var a=Mi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var fo=uo(!0),po=uo(!1),mo=!1;function ho(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function go(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function _o(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ki(e),Oi(e,null,n),t}return Ti(e,r,t,n),ki(e)}function yo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function bo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var xo=!1;function So(){if(xo){var e=Ba;if(e!==null)throw e}}function Co(e,t,n,r){xo=!1;var i=e.updateQueue;mo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(J&f)===f:(r&f)===f){f!==0&&f===za&&(xo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:mo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function wo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function To(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=k.T,s={};s.types=o===null?null:o.types,k.T=s,uc(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?lc(e,t,Ua(c,r),jd(e)):lc(e,t,r,jd(e))}catch(n){lc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function $s(){}function ec(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=tc(e).queue;Qs(e,a,t,Se,n===null?$s:function(){return nc(e),n(r)})}function tc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Se,baseState:Se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:Se},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nc(e){var t=tc(e);t.next===null&&(t=e.alternate.memoizedState),lc(e,t.next.queue,{},jd())}function rc(){return Ta(sh)}function ic(){return os().memoizedState}function ac(){return os().memoizedState}function oc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=_o(n);var r=vo(t,e,n);r!==null&&(Pd(r,t,n),yo(r,t,n)),t={cache:Ma()},e.payload=t;return}t=t.return}}function sc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},dc(e)?fc(t,n):(n=Ei(e,t,n,r),n!==null&&(Pd(n,e,r),pc(n,t,r)))}function cc(e,t,n){lc(e,t,n,jd())}function lc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(dc(e))fc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Vr(s,o))return Ti(e,t,i,0),ed===null&&wi(),!1}catch{}if(n=Ei(e,t,i,r),n!==null)return Pd(n,e,r),pc(n,t,r),!0}return!1}function uc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},dc(e)){if(t)throw Error(i(479))}else t=Ei(e,n,r,2),t!==null&&Pd(t,e,2)}function dc(e){var t=e.alternate;return e===H||t!==null&&t===H}function fc(e,t){Wo=Uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function pc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var mc={readContext:Ta,use:ls,useCallback:Xo,useContext:Xo,useEffect:Xo,useImperativeHandle:Xo,useLayoutEffect:Xo,useInsertionEffect:Xo,useMemo:Xo,useReducer:Xo,useRef:Xo,useState:Xo,useDebugValue:Xo,useDeferredValue:Xo,useTransition:Xo,useSyncExternalStore:Xo,useId:Xo,useHostTransitionStatus:Xo,useFormState:Xo,useActionState:Xo,useOptimistic:Xo,useMemoCache:Xo,useCacheRefresh:Xo,useEffectEvent:Xo},hc={readContext:Ta,use:ls,useCallback:function(e,t){return as().memoizedState=[e,t===void 0?null:t],e},useContext:Ta,useEffect:zs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ls(4194308,4,Gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ls(4194308,4,e,t)},useInsertionEffect:function(e,t){Ls(4,2,e,t)},useMemo:function(e,t){var n=as();t=t===void 0?null:t;var r=e();if(Go){it(!0);try{e()}finally{it(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=as();if(n!==void 0){var i=n(t);if(Go){it(!0);try{n(t)}finally{it(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=sc.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=as();return e={current:e},t.memoizedState=e},useState:function(e){e=xs(e);var t=e.queue,n=cc.bind(null,H,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:qs,useDeferredValue:function(e,t){return Xs(as(),e,t)},useTransition:function(){var e=xs(!1);return e=Qs.bind(null,H,e.queue,!0,!1),as().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=H,a=as();if(B){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),ed===null)throw Error(i(349));J&127||gs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,zs(vs.bind(null,r,o,e),[e]),r.flags|=2048,Fs(9,{destroy:void 0},_s.bind(null,r,o,n,t),null),n},useId:function(){var e=as(),t=ed.identifierPrefix;if(B){var n=Zi,r=Xi;n=(r&~(1<<32-at(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Ko++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[N]=t,o[Ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&pl(t)}}return W(t),t.subtreeFlags&=-33554433,ml(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&pl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ke.current,da(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ra,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[N]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||ca(t,!0)}else e=lp(e).createTextNode(r),e[N]=t,t.stateNode=e}return W(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=da(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[N]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;W(t),e=!1}else n=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Io(t),t):(Io(t),null);if(t.flags&128)throw Error(i(558))}return W(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=da(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[N]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;W(t),a=!1}else a=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Io(t),t):(Io(t),null)}return Io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),gl(t,t.updateQueue),W(t),null);case 4:return Me(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,W(t),null;case 10:return ya(t.type),W(t),null;case 19:if(zo(t),r=t.memoizedState,r===null)return W(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)_l(r,!1);else{if(od!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Bo(e),o!==null){for(t.flags|=128,_l(r,!1),e=o.updateQueue,t.updateQueue=e,gl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Fi(n,e),n=n.sibling;return Ro(t,Lo.current&1|2),B&&Qi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&qe()>gd&&(t.flags|=128,a=!0,_l(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Bo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,gl(t,e),_l(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!B)return W(t),null}else 2*qe()-r.renderingStartTime>gd&&n!==536870912&&(t.flags|=128,a=!0,_l(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=qe(),e.sibling=null,o=Lo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||B?Ro(t,o):(n=o,j(jo,t),j(Lo,n),V===null&&(V=t)),B&&Qi(t,r.treeForkCount),e}return W(t),null;case 22:case 23:return Io(t),Ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(W(t),t.subtreeFlags&6&&(t.flags|=8192)):W(t),n=t.updateQueue,n!==null&&gl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Ee(Ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ya(ja),W(t),null;case 25:return null;case 30:return t.flags|=33554432,W(t),null}throw Error(i(156,t.tag))}function yl(e,t){switch(ta(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ya(ja),Me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Pe(t),null;case 31:if(t.memoizedState!==null){if(Io(t),t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Me(),null;case 10:return ya(t.type),null;case 22:case 23:return Io(t),Ao(),e!==null&&Ee(Ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ya(ja),null;case 25:return null;default:return null}}function bl(e,t){switch(ta(t),t.tag){case 3:ya(ja),Me();break;case 26:case 27:case 5:Pe(t);break;case 4:Me();break;case 31:t.memoizedState!==null&&Io(t);break;case 13:Io(t);break;case 19:zo(t);break;case 10:ya(t.type);break;case 22:case 23:Io(t),Ao(),e!==null&&Ee(Ga);break;case 24:ya(ja)}}function xl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Sl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Cl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{To(t,n)}catch(t){Z(e,e.return,t)}}}function wl(e,t,n){n.props=Sc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Tl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=_i(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);m(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function El(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Dl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title`))),np(r,t,n),r[N]=e,Bt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;sg&&(o=g,g=h,h=o);var _=Gr(s,h),v=Gr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,k.T=null,n=wd,wd=null;var o=bd,s=Sd;if(yd=0,xd=bd=null,Sd=0,K&6)throw Error(i(331));var c=K;if(K|=4,Yu(o.current),Vu(o,o.current,s,n),K=c,Df(0,!1),rt&&typeof rt.onPostCommitFiberRoot==`function`)try{rt.onPostCommitFiberRoot(nt,o)}catch{}return!0}finally{A.p=a,k.T=r,uf(e,t)}}function pf(e,t,n){t=Hi(n,t),t=Oc(e.stateNode,t,2),e=vo(e,t,2),e!==null&&(M(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(vd===null||!vd.has(r))){e=Hi(n,e),n=kc(2),r=vo(t,n,2),r!==null&&(Ac(n,r,t,e),M(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $u;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(id=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ed===e&&(J&n)===n&&(od===4||od===3&&(J&62914560)===J&&300>qe()-md?K&2?ld|=n:Vd(e,0):ld|=n,dd===J&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=_t()),e=Di(e,t),e!==null&&(M(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return Ue(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-at(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=J,a=pt(r,r===ed?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||mt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=qe(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}yd!==0&&yd!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=on(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Bt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+on(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+on(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+on(n.imageSizes)+`"]`)):i+=`[href="`+on(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Ft]=!0,o.onload=o.onerror=function(){Vt(o)}),Bt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+on(r)+`"][href="`+on(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Bt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=zt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Bt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=zt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Bt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=zt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Bt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=ke.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=zt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=zt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=zt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+on(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ft]){r.loading=1;return}}else t=e.createElement(`link`),t[Ft]=!0,t.onload=t.onerror=Vt.bind(null,t),np(t,`link`,n),Bt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+on(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+on(n.href)+`"]`);if(r)return t.instance=r,Bt(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Bt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Bt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Bt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Bt(a),a):(r=n,(a=vm.get(o))&&(r=T({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Bt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Bt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Bt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function y(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:v(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var b=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},x=e=>{let t=b(e);return t.charAt(0).toUpperCase()+t.slice(1)},S=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),C={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function ee(e){return e!=null}function w(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??C.width,a=e.size??e.height??C.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?S(...c):S(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??C[`stroke-width`])*Number(e.size??e.width??C.width)/Number(t.size??t.width??C.width):t.strokeWidth??C[`stroke-width`];return[`svg`,{...Object.entries(C).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&ee(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&ee(t.width)&&{[r(`width`)]:t.width},...`height`in t&&ee(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function te(e,t={}){return w(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=l(d(),1),ne=(0,E.createContext)({}),D=()=>(0,E.useContext)(ne),re=(0,E.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=D()??{},y=!!c||T(d),[b,x,C=[]]=te(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:S(v,s),hasA11yProp:y,attributes:d});return(0,E.createElement)(b,{ref:f,...x},[...C.map(([e,t])=>(0,E.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function O(e,t=[],n=[]){let r=typeof e==`string`?y(e,t,n):e,i=(0,E.forwardRef)(({className:e,...t},n)=>(0,E.createElement)(re,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=x(r.name)),i}var ie={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};ie.node;var ae=O(ie),oe={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};oe.node;var se=O(oe),ce={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};ce.node;var le=O(ce),ue={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};ue.node;var de=O(ue),fe={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};fe.node;var pe=O(fe),me={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};me.node;var he=O(me),ge={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ge.node;var _e=O(ge),ve={name:`command`,size:24,node:[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]};ve.node;var ye=O(ve),be={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};be.node;var xe=O(be),k={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};k.node;var A=O(k),Se={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};Se.node;var Ce=O(Se),we={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};we.node;var Te=O(we),Ee={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ee.node;var j=O(Ee),De={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};De.node;var Oe=O(De),ke={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};ke.node;var Ae=O(ke),je={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};je.node;var Me=O(je),Ne={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Ne.node;var Pe=O(Ne),Fe={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Fe.node;var Ie=O(Fe),Le={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};Le.node;var Re=O(Le),ze={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};ze.node;var Be=O(ze),Ve={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Ve.node;var He=O(Ve),Ue={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ue.node;var We=O(Ue),Ge={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ge.node;var Ke=O(Ge),qe={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};qe.node;var Je=O(qe),Ye={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};Ye.node;var Xe=O(Ye),Ze={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Ze.node;var Qe=O(Ze),$e={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};$e.node;var et=O($e),tt={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};tt.node;var nt=O(tt),rt={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};rt.node;var it=O(rt),at={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};at.node;var ot=O(at),st={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};st.node;var ct=O(st),lt=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ut=o(((e,t)=>{t.exports=lt()})),dt=(0,E.createContext)({});function ft(e){let t=(0,E.useRef)(null);return t.current===null&&(t.current=e()),t.current}var pt=typeof window<`u`?E.useLayoutEffect:E.useEffect,mt=(0,E.createContext)(null);function ht(e,t){e.indexOf(t)===-1&&e.push(t)}function gt(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var _t=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),yt=e=>typeof e==`object`&&!!e,bt=e=>/^0[^.\s]+$/u.test(e);function xt(e){let t;return()=>(t===void 0&&(t=e()),t)}var St=e=>e,Ct=(...e)=>e.reduce((e,t)=>n=>t(e(n))),wt=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},Tt=class{constructor(){this.subscriptions=[]}add(e){return ht(this.subscriptions,e),()=>this.remove(e)}remove(e){gt(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Dt=e=>e/1e3,N=(e,t)=>t?1e3/t*e:0,Ot=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function kt(e,t,n,r){return e===t&&n===r?St:i=>{let a=0,o=1,s=i;for(let t=0;;t++){s>=a&&s<=o||(s=(a+o)/2);let r=Ot(s,e,n)-i;if(r*r<1e-28||t===40)break;r>0?o=s:a=s,s-=r*1e-7/(Ot(s+1e-7,e,n)-i-r)}return Ot(s,t,r)}}var At=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jt=e=>t=>1-e(1-t),Mt=kt(.33,1.53,.69,.99),Nt=jt(Mt),Pt=At(Nt),Ft=e=>e>=1?1:(e*=2)<1?.5*Nt(e):.5*(2-2**(-10*(e-1))),It=e=>1-Math.sin(Math.acos(e)),Lt=jt(It),Rt=At(It),P=kt(.42,0,1,1),zt=kt(0,0,.58,1),Bt=kt(.42,0,.58,1),Vt=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ht=e=>Array.isArray(e)&&typeof e[0]==`number`,Ut={linear:St,easeIn:P,easeInOut:Bt,easeOut:zt,circIn:It,circInOut:Rt,circOut:Lt,backIn:Nt,backInOut:Pt,backOut:Mt,anticipate:Ft},Wt=e=>typeof e==`string`,Gt=e=>{if(Ht(e)){let[t,n,r,i]=e;return kt(t,n,r,i)}return Wt(e)?Ut[e]:e},Kt={delta:0,timestamp:0,isProcessing:!1},qt;function Jt(){qt=void 0}var F={now:()=>(qt===void 0&&F.set(Kt.isProcessing||vt.useManualTiming?Kt.timestamp:performance.now()),qt),set:e=>{qt=e,queueMicrotask(Jt)}},I=e=>Math.round(e*1e5)/1e5,Yt=e=>t=>typeof t==`string`&&t.startsWith(e),Xt=Yt(`--`),Zt=Yt(`var(--`),Qt=e=>Zt(e)?$t.test(e.split(`/*`)[0].trim()):!1,$t=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function en(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var tn={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},nn={...tn,transform:e=>_t(0,1,e)},rn={...tn,default:1},an=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function on(e){return e==null}var sn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,cn=(e,t)=>n=>!!(typeof n==`string`&&sn.test(n)&&n.startsWith(e)||t&&!on(n)&&Object.prototype.hasOwnProperty.call(n,t)),ln=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(an);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},un=e=>_t(0,255,e),dn={...tn,transform:e=>Math.round(un(e))},fn={test:cn(`rgb`,`red`),parse:ln(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+dn.transform(e)+`, `+dn.transform(t)+`, `+dn.transform(n)+`, `+I(nn.transform(r))+`)`},pn=(e,t,n)=>{let r=e.substring(1+t*n,1+(t+1)*n);return n>1?r:r+r};function mn(e){let t=e.length>5?2:1,n=pn(e,3,t);return{red:parseInt(pn(e,0,t),16),green:parseInt(pn(e,1,t),16),blue:parseInt(pn(e,2,t),16),alpha:n?parseInt(n,16)/255:1}}var hn={test:cn(`#`),parse:mn,transform:fn.transform},gn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),_n=gn(`deg`),vn=gn(`%`),L=gn(`px`),yn=gn(`vh`),bn=gn(`vw`),xn={...vn,parse:e=>vn.parse(e)/100,transform:e=>vn.transform(e*100)},Sn={test:cn(`hsl`,`hue`),parse:ln(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+vn.transform(I(t))+`, `+vn.transform(I(n))+`, `+I(nn.transform(r))+`)`},Cn={test:e=>fn.test(e)||hn.test(e)||Sn.test(e),parse:e=>fn.test(e)?fn.parse(e):Sn.test(e)?Sn.parse(e):hn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?fn.transform(e):Sn.transform(e),getAnimatableNone:e=>{let t=Cn.parse(e);return t.alpha=0,Cn.transform(t)}},wn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Tn=new RegExp(an.source),En=new RegExp(wn.source,`i`);function Dn(e){return isNaN(e)&&typeof e==`string`&&(Tn.test(e)||En.test(e))}var On=`number`,kn=`color`,An=`var`,jn=`var(`,Mn="${}",Nn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function Pn(e){let t=e.toString();return Tn.test(t)||En.test(t)}function Fn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Nn,e=>(Cn.test(e)?(r.color.push(a),i.push(kn),n.push(Cn.parse(e))):e.startsWith(jn)?(r.var.push(a),i.push(An),n.push(e)):(r.number.push(a),i.push(On),n.push(parseFloat(e))),++a,Mn)).split(Mn),indexes:r,types:i}}function In(e){return Fn(e).values}function Ln({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;atypeof e==`number`?0:Cn.test(e)?Cn.getAnimatableNone(e):e,Bn=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:zn(e);function Vn(e){let t=Fn(e);return Ln(t)(t.values.map((e,n)=>Bn(e,t.split[n])))}var Hn={test:Dn,parse:In,createTransformer:Rn,getAnimatableNone:Vn};function Un(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Wn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Un(s,r,e+1/3),a=Un(s,r,e),o=Un(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Gn(e,t){return n=>n>0?t:e}var R=(e,t,n)=>e+(t-e)*n,Kn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},qn=[hn,fn,Sn],Jn=e=>qn.find(t=>t.test(e));function Yn(e){let t=Jn(e);if(!t)return!1;let n=t.parse(e);return t===Sn&&(n=Wn(n)),n}var Xn=(e,t)=>{let n=Yn(e),r=Yn(t);if(!n||!r)return Gn(e,t);let i={...n};return e=>(i.red=Kn(n.red,r.red,e),i.green=Kn(n.green,r.green,e),i.blue=Kn(n.blue,r.blue,e),i.alpha=R(n.alpha,r.alpha,e),fn.transform(i))},Zn=new Set([`none`,`hidden`]);function Qn(e,t){return Zn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function $n(e,t){return n=>R(e,t,n)}function er(e){return typeof e==`number`?$n:typeof e==`string`?Qt(e)?Gn:Cn.test(e)?Xn:ir:Array.isArray(e)?tr:typeof e==`object`?Cn.test(e)?Xn:nr:Gn}function tr(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>er(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function rr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=Fn(e),r=Fn(t);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?Zn.has(e)&&!r.values.length||Zn.has(t)&&!n.values.length?Qn(e,t):Ct(tr(rr(n,r),r.values),Ln(r)):Gn(e,t)},ar=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function or(e,t){let n=ar.exec(e);if(!n)return;let r=ar.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>I(R(a,o,e))+i}function sr(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return R(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=or(e,t);if(n)return n}return er(e)(e,t)}var cr=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function lr(e){let t=new Set,n=new Set,r=!1,i=!1,a,o=new Set,s={delta:0,timestamp:0,isProcessing:!1};function c(t){o.has(t)&&(n.add(t),e()),(a=t)(s)}let l={schedule:(e,i=!1,s=!1)=>{let c=s&&r,l=c?t:n;return i&&o.add(e),c&&e!==a&&l.delete(e),l.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(s=e,r){i=!0;return}r=!0;let o=t;t=n,n=o,t.forEach(c),t.clear(),a=void 0,r=!1,i&&(i=!1,l.process(e))}};return l}var ur=40;function dr(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=cr.reduce((e,t)=>(e[t]=lr(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=vt.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,ur),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:cr.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>z.update(t,e),stop:()=>fr(t),now:()=>Kt.isProcessing?Kt.timestamp:F.now()}},hr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=n?1/0:i}function vr(e,t=100,n){let{keyframes:r,velocity:i}=e,a=r&&r[r.length-1]-r[0],o=n({...e,velocity:i&&a?i*t/a:i,keyframes:[0,t]}),s=Math.min(_r(o),gr);return{type:`keyframes`,ease:e=>o.next(s*e).value/t,duration:Dt(s)}}var yr=100,br=10,xr=1,Sr=800,Cr=.3,wr=.3,Tr=.01,Er=2,Dr=.005,Or=.5,kr=.01,Ar=10,jr=.05,Mr=e=>e<0?1/Math.max(1+e,jr):Math.max(1-e,jr);function Nr(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Ir(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function Pr(e,t){return e*Math.sqrt(1-t*t)}var Fr=12;function Ir(e,t,n){let r=n;for(let n=1;n{let n=t*i,r=n*e,a=Pr(t,i),o=Math.exp(-r);return Lr-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=Pr(t*t,i);return(-n(t)+Lr>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Ir(n,r,a),s=o*Nr(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:Et(e)}}var zr=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Br(e,t){if(zr(e,t))return e}function Vr(e){let t=Br(e.stiffness),n=Br(e.damping,!0),r=Br(e.mass),i={...e,stiffness:t??yr,damping:n??br,mass:r??xr,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=Mr(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*Nr(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Rr(i)),i.isResolvedFromDuration=!0;zr(i.stiffness)&&zr(i.damping,!0)||(i.stiffness=yr,i.damping=br)}return i}function Hr(e=wr,t=Cr){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=Vr({...n}),f=e=>d?0:-Dt(e),p=s/(2*Math.sqrt(o*c)),m=Dt(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?Tr:Er),g.restDelta=n.restDelta||(e?Dr:Or)};_();let v,y,b;if(p<1){let e=Pr(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=e<1||d?1/0:300/e,i=(e,t)=>Math.exp(t>r?(h-e)*r-h*t:-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>Et(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=Et(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(_r(S),gr),t=hr(t=>S.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return S}var Ur=Object.assign(Hr,{applyToOptions:e=>{let t=vr(e,100,Hr);return e.ease=t.ease,e.duration=Et(t.duration),e.type=`keyframes`,e}});function Wr({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:e?_+t:d},b,x,S=e=>{p(f.value)&&(b=e,x=Ur({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Gr(e,t,n){let r=[],i=vt.mix||sr,a=e.length-1;for(let o=0;ot[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Gr(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(_t(e[0],e[a-1],t)):l}function qr(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=wt(0,t,r);e.push(R(n,1,i))}}function Jr(e){let t=[0];return qr(t,e.length-1),t}function Yr(e,t){return e.map(e=>e*t)}function Xr(e,t){return e.map(()=>t||Bt).splice(0,e.length-1)}function Zr({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`,mixer:i}){let a=typeof t[0]==`number`?void 0:i,o=Vt(r)?r.map(Gt):Gt(r)||Bt,s={done:!1,value:t[0]};if(!a&&t.length===2&&!Array.isArray(o)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,i=n===r?void 0:(vt.mix||sr)(n,r);return{calculatedDuration:e,next:t=>(s.value=i?i(o(e>0?_t(0,1,t/e):1)):r,s.done=t>=e,s)}}let c=Kr(Yr(n&&n.length===t.length?n:Jr(t),e),t,{ease:Array.isArray(o)?o:Xr(t,o),mixer:a});return{calculatedDuration:e,next:t=>(s.value=c(t),s.done=t>=e,s)}}var Qr=5;function $r(e,t,n){let r=Math.max(t-Qr,0);return N(n-e(r),t-r)}function ei(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):$r(t=>e.next(t).value,t,e.next(t).value)}var ti=e=>e!==null;function ni(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ti),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ri={decay:Wr,inertia:Wr,tween:Zr,keyframes:Zr,spring:Ur};function ii(e){typeof e.type==`string`&&(e.type=ri[e.type])}var ai=40,oi=(e,t)=>t-e>ai&&!vt.useManualTiming?t:e;function si(e,t){return{kind:e,animation:t,timestamp:F.now(),frameTimestamp:Kt.timestamp,frameIsProcessing:Kt.isProcessing}}function ci(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...si(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function li(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...si(`layout-animation-start`,e),node:t})}catch{}}var ui=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},di=e=>e/100,fi=e=>Math.round(e*1e4)/1e4,pi=class extends ui{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==F.now()&&this.tick(F.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),ci(this,this.options)}initAnimation(){let{options:e}=this;ii(e);let{type:t=Zr,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Zr;this.mixKeyframes=void 0,s!==Zr&&typeof o[0]!=`number`&&(this.mixKeyframes=Ct(di,e.mixer?.(o[0],o[1])||sr(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=_r(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){this.currentTime=this.holdTime??Math.round(e-this.startTime)*this.playbackSpeed}tick(e,t=!1){let{generator:n,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return n.next(0);let{delay:a=0,keyframes:o,type:s,onUpdate:c,finalKeyframe:l}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=oi(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let u=this.currentTime-a*(this.playbackSpeed>=0?1:-1),d=this.playbackSpeed>=0?u<0:u>r;this.currentTime=Math.max(u,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let f=this.generate(this.currentTime,d),{done:p}=f;d||(p=this.playbackSpeed>=0?i<1/0?this.currentTime>=r:p:this.currentTime<=0);let m=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&p);return m&&s!==Wr&&(f.value=ni(o,this.options,l,this.speed)),c&&c(f.value),m&&this.finish(),f}at(e){return this.holdTime??fi((e-this.startTime)*this.playbackSpeed)}sampleAt(e,t){let{options:n,totalDuration:r}=this,i=this.at(e)-(n.delay||0);return i>=r&&n.type!==Wr?ni(n.keyframes,n,t?void 0:n.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(e,t){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o}=this,{keyframes:s,repeat:c,repeatType:l,repeatDelay:u}=this.options,d=e,f=n;if(c){let t=Math.min(e,r)/o,n=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),i===1&&n--,n=Math.min(n,c+1),n%2&&(l===`reverse`?(i=1-i,u&&(i-=u/o)):l===`mirror`&&(f=a)),d=_t(0,1,i)*o}let p;return t?(this.delayState.value=s[0],p=this.delayState):p=f.next(d),i&&!t&&(p.value=i(p.value)),p}get duration(){return Dt(this.calculatedDuration)}get iterationDuration(){return this.duration+Dt(this.options.delay??0)}get time(){return Dt(this.currentTime)}set time(e){e=Et(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return ei(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(F.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Dt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=mr,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(F.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},mi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function hi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(an)||[];if(!r)return e;let i=n.replace(r,``),a=+!!mi.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var gi=/\b([a-z-]*)\(.*?\)/gu,_i={...Hn,getAnimatableNone:e=>{let t=e.match(gi);return t?t.map(hi).join(` `):e}},vi={...Hn,getAnimatableNone:e=>{let t=Hn.parse(e);return Hn.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},yi={...tn,transform:Math.round},bi={rotate:_n,pathRotation:_n,rotateX:_n,rotateY:_n,rotateZ:_n,scale:rn,scaleX:rn,scaleY:rn,scaleZ:rn,skew:_n,skewX:_n,skewY:_n,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,transformPerspective:L,opacity:nn,originX:xn,originY:xn,originZ:L},xi={borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,top:L,right:L,bottom:L,left:L,inset:L,insetBlock:L,insetBlockStart:L,insetBlockEnd:L,insetInline:L,insetInlineStart:L,insetInlineEnd:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,paddingBlock:L,paddingBlockStart:L,paddingBlockEnd:L,paddingInline:L,paddingInlineStart:L,paddingInlineEnd:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,marginBlock:L,marginBlockStart:L,marginBlockEnd:L,marginInline:L,marginInlineStart:L,marginInlineEnd:L,fontSize:L,backgroundPositionX:L,backgroundPositionY:L,...bi,zIndex:yi,fillOpacity:nn,strokeOpacity:nn,numOctaves:yi},Si={...xi,color:Cn,backgroundColor:Cn,outlineColor:Cn,fill:Cn,stroke:Cn,borderColor:Cn,borderTopColor:Cn,borderRightColor:Cn,borderBottomColor:Cn,borderLeftColor:Cn,filter:_i,WebkitFilter:_i,mask:vi,WebkitMask:vi},Ci=e=>Si[e],wi=new Set([_i,vi]);function Ti(e,t){let n=Ci(e);return wi.has(n)||(n=Hn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function Ei(e){for(let t=1;te*180/Math.PI,Oi=e=>Ai(Di(Math.atan2(e[1],e[0]))),ki={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Oi,rotateZ:Oi,skewX:e=>Di(Math.atan(e[1])),skewY:e=>Di(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ai=e=>(e%=360,e<0&&(e+=360),e),ji=Oi,Mi=e=>Math.hypot(e[0],e[1]),Ni=e=>Math.hypot(e[4],e[5]),Pi={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Mi,scaleY:Ni,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(Mi(e)+Ni(e))/2,rotateX:e=>Ai(Di(Math.atan2(e[6],e[5]))),rotateY:e=>Ai(Di(Math.atan2(-e[2],e[0]))),rotateZ:ji,rotate:ji,skewX:e=>Di(Math.atan(e[4])),skewY:e=>Di(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Fi(e){return+!!e.includes(`scale`)}function Ii(e,t){if(!e||e===`none`)return Fi(t);let n=e.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!n)return Fi(t);let r=(n[1]?Pi:ki)[t],i=n[2].split(`,`).map(e=>parseFloat(e));return typeof r==`function`?r(i):i[r]}var Li=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Ii(n,t)},Ri=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],zi=new Set([...Ri,`pathRotation`]),Bi=e=>e===tn||e===L,Vi=new Set([`x`,`y`,`z`]),Hi=Ri.filter(e=>!Vi.has(e));function Ui(e){let t=[];return Hi.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var Wi=new Set([`bottom`,`right`]);function Gi(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var Ki=({transform:e})=>Ii(e,`x`),qi=({transform:e})=>Ii(e,`y`),Ji={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>Gi(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>Gi(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:Ki,y:qi,translateX:Ki,translateY:qi},Yi=new Set,Xi=!1,Zi=!1,Qi=!1;function $i(){if(Zi){let e=[],t=new Set,n=new Set;Yi.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),Wi.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=Ui(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Zi=!1,Xi=!1,Yi.forEach(e=>e.complete(Qi)),Yi.clear()}function ea(){Yi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zi=!0)})}function ta(){Qi=!0,ea(),$i(),Qi=!1}function na(e,t,n){if(typeof e==`string`){if(M(e)||bt(e))return parseFloat(e);if(!Hn.test(e)&&Hn.test(n))return Ti(t,n)}return e??void 0}var ra=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Yi.add(this),Xi||(Xi=!0,z.read(ea),z.resolveKeyframes($i))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=na(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ei(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Yi.delete(this)}cancel(){this.state===`scheduled`&&(Yi.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},ia=e=>e.startsWith(`--`);function B(e,t,n){ia(t)?e.style.setProperty(t,n):e.style[t]=n}var aa={};function oa(e,t){let n=xt(e);return()=>aa[t]??n()}var sa=oa(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),ca=oa(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),la=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,ua={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:la([0,.65,.55,1]),circOut:la([.55,0,1,.45]),backIn:la([.31,.01,.66,-.59]),backOut:la([.33,1.53,.69,.99])};function da(e,t){if(e)return typeof e==`function`?ca()?hr(e,t):`ease-out`:Ht(e)?la(e):Array.isArray(e)?e.map(e=>da(e,t)||ua.easeOut):ua[e]}function fa(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=da(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function pa(e){return typeof e==`function`&&`applyToOptions`in e}function ma({type:e,...t}){return pa(e)&&ca()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ha=class extends ui{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e;let c=ma(e);this.animation=fa(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ni(r,this.options,o,this.speed);this.updateMotionValue?.(e),B(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},ci(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){this.isStopped||(this.isStopped=!0,this.state!==`idle`&&this.finishedTime===null&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||(this.animation.onfinish=null,this.cancel())))}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Dt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Dt(e)}get time(){return Dt(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Et(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&sa()?(this.animation.timeline=e,t?.(this.animation),St):n(this)}},ga={anticipate:Ft,backInOut:Pt,circInOut:Rt};function _a(e){return e in ga}function va(e){typeof e.ease==`string`&&_a(e.ease)&&(e.ease=ga[e.ease])}var ya=class extends ha{constructor(e){va(e),ii(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}elapsed(){return this.state===`running`?(F.now()-this.startTime)*this.speed:this.time*1e3}sample(e){if(!this.sampler){let{motionValue:e,onUpdate:t,onComplete:n,onPlay:r,onStop:i,element:a,...o}=this.options;this.sampler=new pi({...o,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,e)).value}liveValue(){let{state:e}=this;if(e===`running`||e===`paused`)return this.sample(this.elapsed())}updateMotionValue(e){let{motionValue:t,element:n,name:r}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let{speed:i}=this,a=this.elapsed(),o=this.state===`running`&&i?_t(0,10,a):0,s=this.sample(a);n&&r&&B(n,r,s),t.setWithVelocity(this.sample(a-o*Math.sign(i)),s,o/Math.abs(i||1))}},ba=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Hn.test(e)||e===`0`)&&!e.startsWith(`url(`));function xa(e){let t=e[0];if(e.length===1)return!0;for(let n=0;ne&&typeof t[0]!=`number`&&t.some((n,r)=>r&&e(t[r-1],n)),Oa=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),ka=()=>!vt.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,`animate`);function Aa(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(wa.has(n)||Oa.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return ka()&&(wa.has(n)||Oa.has(n)&&Ea(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`&&!Da(e)}var ja=(e,t)=>t&&typeof e==`number`?t.transform(e):e,Ma={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Na=Ri.length,Pa={},Fa=(e,t,n=ja(t,bi[e]))=>(Pa[e]||(Pa[e]=(Ma[e]||e)+`(`))+n+`)`,Ia=(e,t)=>(typeof t==`number`?t:parseFloat(t))===+!!e.startsWith(`scale`);function La(e,t,n){let r=``;for(let i=0;i/^(linear|ease(In|Out|InOut))$/.test(e),Ga=(e,t)=>Math.abs(e-t)<=Ba,Ka=(e,t)=>e-t,qa=(e,t,n)=>Jr(Array(n+1)).map(n=>R(e,t,n)),Ja=e=>e.motionValue.owner,Ya=e=>Ra.get(e),Xa=({state:e})=>e===`idle`||e===`finished`,Za=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),Qa=({name:e,motionValue:t})=>e&&Ri.includes(e)&&t?.owner?.current instanceof HTMLElement&&ka()&&ca();function $a(e){let t=Ja(e),{onUpdate:n,transformTemplate:r}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!r&&e.type!==`inertia`&&(Za(t,`transform`)||`none`)===`none`&&!Za(t,`pathRotation`)&&!t.projection?.isProjecting()&&!Da(e)}var eo=class extends pi{constructor(e){let t=Ja(e).current,{driver:n=mr}=e,r,i=$a(e);e.driver=e=>{let i=n(e);return{js:i,now:i.now,start:(e=!0)=>{let n=Ya(t);!n||n.isJS?i.start(e):n.schedule(!1,!e)},stop:()=>{i.stop();let e=Ya(t);e&&!e.isFinishing&&e.release(r)}}},super(e),r=this,this.canAccelerate=i;let{stop:a}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),a()}}get group(){return Ya(Ja(this.options).current)}get js(){return this.driver?.js}get name(){return this.options.name}timing(){let{startTime:e,speed:t,totalDuration:n}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime===null?n===1/0?[e+r/t,this.resolvedDuration*(i===`loop`?1:2)/t||1]:[e+(r+n)/t,0]:[1/0,0]}isAccelerated(){let{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&(t===`running`||t===`paused`)}liveValue(){return this.isAccelerated()?this.sampleAt(F.now()):void 0}tween(){let{keyframes:e,type:t,ease:n,times:r,repeat:i,delay:a=0}=this.options,o=Ht(n)?la(n):Wa(n)&&ua[n];if(o&&!i&&!r&&e.length===2&&t===Zr&&this.holdTime===null){let e=this.startTime+a/this.speed;return[e,e+this.resolvedDuration/this.speed,o]}}boundaries(e,t){let{startTime:n,speed:r,resolvedDuration:i,options:a}=this,{delay:o=0,repeat:s=0,repeatDelay:c=0,repeatType:l,times:u,keyframes:d,type:f}=a,p=(f||Zr)===Zr?u||Jr(d):[0,1],m=n+o/r,h=[];if(this.holdTime!==null||!(i>0))return h;for(let n=Math.max(0,Math.floor((e-m)*r/i));n<=s;n++){let a=m+n*i/r;if(a>t)break;for(let o of p){let s=a+(n%2&&l&&l!==`loop`?1-o:o)*(i-c)/r;s>e&&s{for(let t of n)if(t.name===e)return!0},m=(t,n)=>{let o={};for(let s of t===void 0?Ri:a){let a=r.get(s),c=t===void 0?Za(e,s):a?a.sampleAt(n>t&&!a.timing()[1]?n:t):i[s];c!==void 0&&(o[s]=c)}return o},h=(e,t)=>{let n=``;for(let r in e){let i=e[r];t&&Ia(r,i)||(n+=Fa(r,i)+` `)}return(t?n.trim():n)||`none`},g=(e,t)=>h(m(e,t)),_=(e=m())=>{t.style.transform=h(e,!0)},v=(e=!0)=>{e&&_(),s.forEach(({animation:e})=>e.cancel()),s=[]},y=(e,n)=>new Animation(new KeyframeEffect(t,e,n)),b=(e,t,n=1/0)=>{let r={animation:e,offset:t,end:n};e.startTime=F.now()+t,n<1/0&&(e.onfinish=()=>{r.isDone=!0,s.some(e=>e.end===1/0)&&(e.cancel(),s=s.filter(e=>e!==r)),D.schedule(!1)}),e.oncancel=()=>s.includes(r)&&D.demote(),s.push(r)},x=(e,t,n)=>{let r=(t,n)=>Math.abs(e(n)-e(t)),i=r(t,n);for(;n-t>.01;){let e=(t+n)/2;r(t,e)>r(e,n)?n=e:t=e}return r(t,n)>i/2?[t,n]:[]},S=(e,t,n,r)=>{let i=Math.min(za,Math.max(2,Math.ceil((n-t)/10)));if(r.length*4>i)return;let a=qa(t,n,i).concat(r).sort(Ka),o=e=>wt(t,n,e),s,c;for(let n of e){let e=n.numberAt(t),r=a.map(t=>n.numberAt(t)-e),i=r[r.length-1],o=r.some(e=>Math.abs(e)*Ba>Math.abs(i))?0:i,l=r.map(e=>o?e/o:e);if(o&&!s)s=l,c=t=>(n.numberAt(t)-e)/o;else if(l.some((e,t)=>!Ga(e,o&&s[t])))return}if(!s||s.every((e,t)=>Ga(e,o(a[t]))))return`linear`;let l=[],u=(e,t=c(e))=>l.push(fi(t)+` `+fi(o(e)*100)+`%`);return s.forEach((e,t)=>{t&&Math.abs(e-s[t-1])>.2&&x(c,a[t-1],a[t]).forEach(e=>u(e)),u(a[t],e)}),`linear(`+l+`)`},C=(e,t,n,r)=>{let i=[t],a=(t,n)=>e.every(e=>!(Math.abs(e.numberAt((t+n)/2)-(e.numberAt(t)+e.numberAt(n))/2)>(e.name.startsWith(`scale`)?Ha:Va))),o=(t,n,r)=>{if(n-t<1||a(t,n))i.push(n);else if(r<4)o(t,(t+n)/2,r+1),o((t+n)/2,n,r+1);else{for(let r of e)i.push(...x(e=>r.numberAt(e),t,n));i.push(n)}},s=qa(t,n,Math.ceil((n-t)/100));for(let e of r)s.push(e,Math.min(e+.01,n));let c=t;for(let e of s.sort(Ka))e>c&&o(c,e,0),c=e;return i.sort(Ka)},ee=e=>{let t;for(let n of e){let e=n.tween();if(!e||t?.some((t,n)=>n<2?Math.abs(e[n]-t)>1:e[n]!==t))return;t=e}return t},w=(e,t,n,r,i={fill:`both`},a)=>{let o=e.flatMap(e=>e.boundaries(t,n)),s=r||S(e,t,n,o),c=s?[t,n]:C(e,t,n,o),l=c.map(e=>g(e,a)),u={transform:l};return s||(u.offset=c.map(e=>wt(t,n,e))),l.every(e=>e===l[0])&&(_(m(t,a)),u=null),y(u,{...i,duration:n-t,easing:s||`linear`})},te=t=>{let c=t,l=0,u=0,d=[],f=[],p=new Set;r.clear(),o=new Map;for(let e of n){r.set(e.name,e);let[n,i]=e.timing(),a=n===1/0;if(o.set(e,[e.at(t),e.speed,a]),a)e.sync();else{if(e.speed<0)return;if(i){if(l){let e=(n-u)/i;if(Math.abs(i-l)>1||Math.abs(e-Math.round(e))*l>1)return}else l=i,u=n;f.push(e)}else p.add(n);d.push(e),c=Math.max(c,n)}}i={},a=Ri.filter(t=>{if(r.has(t))return!0;let n=i[t]=Za(e,t);return n!==void 0&&!Ia(t,n)}),v(!1);let m=!l&&ee(d);try{if(m&&m[1]>t){let[e,n,r]=m;b(w(d,e,n,r),e-t,n-e)}else c>t&&(b(w(d,t,c),0,c-t),p.forEach(e=>e{let t,r=0;for(let i of n){let n=o.get(i);if(!n)return!1;let[a,s,c]=n,l=i.at(e),u=i.timing()[0]===1/0;if(c){if(u&&l===a)continue;return!1}let d=(l-a)/s,f=u?0:i.speed/s;if(t===void 0)t=d,r=f;else if(Math.abs(d-t)>1||f!==r)return!1}if(t===void 0)return!0;if(!s.length)return!1;for(let{offset:e,end:n,isDone:r}of s){let i=t-e;if(n<1/0&&(r?i=n))return!1}for(let{animation:n,offset:i,isDone:a}of s){if(a)continue;let o=t-i;r&&n.updatePlaybackRate&&n.playState===`running`&&Math.abs(Number(n.currentTime)-o)<20?n.playbackRate!==r&&n.updatePlaybackRate(r):r?(n.playbackRate=r,n.startTime=e-o/r):(n.startTime=null,n.currentTime=o)}return!0},E=()=>!n.size&&(u=!0,Ya(t)===D&&Ra.delete(t),D.isJS||v(),!0),ne=()=>{let t=F.now();if(D.isJS||(D.isFinishing=!0,n.forEach(n=>{let[r,a]=n.timing();n.state===`running`&&n.speed>0&&!a&&r<=t+1&&(n.complete(),i[n.name]=Za(e,n.name),o.has(n)||(c=!0))}),D.isFinishing=!1),l=!1,u||(n.forEach(e=>Xa(e)&&n.delete(e)),E()))return;for(let e of n)if(!e.canAccelerate)return D.demote(!0);D.isJS&&(D.isJS=!1,c=!0,n.forEach(e=>e.js?.stop()));let r=c,a=d;if(c=d=!1,r||!T(t)){if(a){if(t-f{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),D.isJS=!0,o=new Map,v(),n.forEach(e=>e.state===`running`&&e.js?.start()),!0}};return Ra.set(t,D),D}var no=class extends ui{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=F.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||ra;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=F.now();let u=Sa(e,i,a,o);u||((vt.instantAnimations||!s)&&l?.(ni(e,n,t)),e[0]=e[e.length-1],Ca(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let f=u&&!c&&Aa(n),p=!f&&Qa(n);r&&(f||p||this.resolvedAt!==this.createdAt)&&(n.startTime??=oi(this.createdAt,this.resolvedAt));let m;if(f){n.element=n.motionValue?.owner?.current;try{m=new ya(n)}catch{m=new pi(n)}}else m=p?new eo(n):new pi(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),ta()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}};function ro(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var io=30,ao=e=>!isNaN(parseFloat(e)),oo={current:void 0},so=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=F.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.dirty(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=F.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ao(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new Tt)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new Tt,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){z.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){t&&(this.updatedAt=F.now(),this.stop()),this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){(this.dependents||=new Set).add(e)}removeDependent(e){this.dependents?.delete(e)}get(){oo.current?.push(this);let e=this.animation?.liveValue?.();return e===void 0?this.current:e}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){let e=F.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>io)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,io);return N(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&(this.animation=void 0),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}};function co(e,t){return new so(e,t)}function lo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function uo(e,t){let n=e?.[t]??e?.default??e;return n===e?n:lo(n,e)}var fo={type:`spring`,stiffness:500,damping:25,restSpeed:10},po=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mo={type:`keyframes`,duration:.8},ho={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},go=(e,{keyframes:t})=>t.length>2?mo:zi.has(e)?e.startsWith(`scale`)?po(t[1]):fo:ho,_o=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`,`out`,`mixer`]);function vo(e){for(let t in e)if(!_o.has(t))return!0;return!1}var yo=(e,t,n,r={},i,a)=>o=>{let s=uo(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Et(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i,hasOnUpdate:!!s.onUpdate};vo(s)||Object.assign(u,go(e,u)),u.duration&&=Et(u.duration),u.repeatDelay&&=Et(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Ca(u),u.delay===0&&(d=!0)),(vt.instantAnimations||vt.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Ca(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=ni(u.keyframes,s);if(e!==void 0){z.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new pi(u):new no(u)},bo=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xo(e){let t=bo.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function So(e,t,n=1){let[r,i]=xo(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return M(e)?parseFloat(e):e}return Qt(i)?So(i,t,n+1):i}function Co(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function wo(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...Co(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function To(e,t,n){return wo(e.getProps(),t,n,e)}var Eo=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,Do=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Ri]),Oo=e=>Array.isArray(e);function ko(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,co(n))}function Ao(e){return Oo(e)?e[e.length-1]||0:e}function jo(e,t){let{transitionEnd:n={},transition:r={},...i}=To(e,t)||{};i={...i,...n};for(let t in i)ko(e,t,Ao(i[t]))}var V=e=>!!(e&&e.getVelocity);function Mo(e){return!!(V(e)&&e.add)}function No(e,t){let n=e.getValue(`willChange`);if(Mo(n))return n.add(t);if(!n&&vt.WillChange){let n=new vt.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}var Po=`data-framer-appear-id`;function Fo(e){return e.props[Po]}var Io=typeof window<`u`;function Lo({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function Ro(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?lo(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&(p.animateValues?p.animateValues(t=>e.getValue(t,e.latestValues[t]??0),s,a,n,d):p.animateVisualElement?.(e,s,a,n,d));for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Lo(f,t))continue;let o={delay:n,...uo(f?.out[t]||a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){z.update(()=>r.set(i));continue}let p=!1;if(Io&&window.MotionHandoffAnimation){let n=Fo(e);if(n){let e=window.MotionHandoffAnimation(n,t,z);e!==null&&(o.startTime=e,p=!0)}}No(e,t);let m=l??e.shouldReduceMotion;r.start(yo(t,r,i,m&&Do.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>z.update(()=>{o&&jo(e,o)});d.length?Promise.all(d).then(t):t()}return d}function zo(e,t,n={}){let r=To(e,t,Eo(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?Ro(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(zo(e,t,{...n,delay:r+(typeof o==`function`?0:o)+ro(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function Bo(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>zo(e,t,n))):typeof t==`string`?zo(e,t,n):Promise.all(Ro(e,To(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var Vo={test:e=>e===`auto`,parse:e=>e},H=e=>t=>t.test(e),U=[tn,L,vn,_n,bn,yn,Vo],Ho=e=>U.find(H(e));function Uo(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||bt(e)}var Wo=new Set([`auto`,`none`,`0`]);function Go(e,t,n){let r=0,i;for(;re.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e?.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.resolveNoneKeyframes()}},qo=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Jo(e){return yt(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function Yo(e){return yt(e)&&`ownerSVGElement`in e}var Xo={};function Zo(e){return Xo.current?.add(e),e}var Qo=e=>Xo.current?Xo.current.bind(e):e;function $o(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=t?t.current:Xo.current?.root||document,i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}function es(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}function ts(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(zi.has(e))o=!0;else if(Xt(e))i[e]=n;else{let t=ja(n,xi[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=La(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var ns={offset:`stroke-dashoffset`,array:`stroke-dasharray`},rs={offset:`strokeDashoffset`,array:`strokeDasharray`};function is(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?ns:rs;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var as=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function os(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(ts(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of as)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&is(d,i,a,o,!1)}function ss({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function cs({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ls(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function us(e){return e===void 0||e===1}function ds({scale:e,scaleX:t,scaleY:n}){return!us(e)||!us(t)||!us(n)}var fs=[`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skewX`,`skewY`];function ps(e){return ds(e)||hs(e)||ms(e)}function ms(e){return e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function hs(e){return gs(e.x)||gs(e.y)}function gs(e){return e&&e!==`0%`}function _s(e,t,n){return n+t*(e-n)}function vs(e,t,n,r,i){return i!==void 0&&(e=_s(e,i,r)),_s(e,n,r)+t}function ys(e,t=0,n=1,r,i){e.min=vs(e.min,t,n,r,i),e.max=vs(e.max,t,n,r,i)}function bs(e,{x:t,y:n}){ys(e.x,t.translate,t.scale,t.originPoint),ys(e.y,n.translate,n.scale,n.originPoint)}var xs=.999999999999,Ss=1.0000000000001;function Cs(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;sxs&&(t.x=1),t.yxs&&(t.y=1)}function ws(e,t){e.min+=t,e.max+=t}function Ts(e,t,n,r,i=.5){ys(e,t,n,R(e.min,e.max,i),r)}function Es(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Ds(e,t,n){let r=n??e;Ts(e.x,Es(t.x,r.x),t.scaleX,t.scale,t.originX),Ts(e.y,Es(t.y,r.y),t.scaleY,t.scale,t.originY)}function Os(e,t){return ss(ls(e.getBoundingClientRect(),t))}function ks(e,t,n){let r=Os(e,n),{scroll:i}=t;return i&&(ws(r.x,i.offset.x),ws(r.y,i.offset.y)),r}var As=()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),{schedule:js,cancel:Ms}=dr(queueMicrotask,!1);function Ns(e,t,n){let r=V(e)?e:co(e);return r.start(yo(``,r,t,n)),r.animation}var Ps={},Fs={value:null,addProjectionMetrics:null,countProjection:void 0};function Is(e,t){let n=F.now();e=Qo(e);let r=({timestamp:i})=>{let a=i-n;a>=t&&(fr(r),e(a-t))};return z.setup(r,!0),Zo(()=>fr(r))}function Ls(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Rs(e){return Yo(e)&&e.tagName===`svg`}function zs(e){return V(e)?e.get():e}var Bs=e=>typeof e==`number`?e:parseFloat(e),Vs=qo.length,Hs=e=>typeof e==`number`||L.test(e);function Us(e,t,n,r,i,a){i?(e.opacity=R(0,n.opacity??1,Gs(r)),e.opacityExit=R(t.opacity??1,0,Ks(r))):a&&(e.opacity=R(t.opacity??1,n.opacity??1,r));for(let i=0;irt?1:n(wt(e,t,r))}function Js(e,t){e.min=t.min,e.max=t.max}function Ys(e,t){Js(e.x,t.x),Js(e.y,t.y)}function Xs(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Zs=.9999,Qs=1.0001,$s=-.01,ec=.01;function tc(e){return e.max-e.min}function nc(e,t,n){return Math.abs(e-t)<=n}function rc(e,t,n,r=.5){e.origin=r,e.originPoint=R(t.min,t.max,e.origin),e.scale=tc(n)/tc(t),e.translate=R(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Zs&&e.scale<=Qs||isNaN(e.scale))&&(e.scale=1),(e.translate>=$s&&e.translate<=ec||isNaN(e.translate))&&(e.translate=0)}function ic(e,t,n,r){rc(e.x,t.x,n.x,r?.originX),rc(e.y,t.y,n.y,r?.originY)}function ac(e,t,n,r=0){e.min=(r?R(n.min,n.max,r):n.min)+t.min,e.max=e.min+tc(t)}function oc(e,t,n,r){ac(e.x,t.x,n.x,r?.x),ac(e.y,t.y,n.y,r?.y)}function sc(e,t,n,r=0){let i=r?R(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+tc(t)}function cc(e,t,n,r){sc(e.x,t.x,n.x,r?.x),sc(e.y,t.y,n.y,r?.y)}function lc(e,t,n,r,i){return e-=t,e=_s(e,1/n,r),i!==void 0&&(e=_s(e,1/i,r)),e}function uc(e,t=0,n=1,r=.5,i,a=e,o=e){if(vn.test(t)&&(t=parseFloat(t),t=R(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=R(a.min,a.max,r);e===a&&(s-=t),e.min=lc(e.min,t,n,s,i),e.max=lc(e.max,t,n,s,i)}function dc(e,t,[n,r,i],a,o){uc(e,t[n],t[r],t[i],t.scale,a,o)}var fc=[`x`,`scaleX`,`originX`],pc=[`y`,`scaleY`,`originY`];function mc(e,t,n,r){dc(e.x,t,fc,n?.x,r?.x),dc(e.y,t,pc,n?.y,r?.y)}var hc=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gc=hc(`applewebkit/`)&&!hc(`chrome/`)?Math.round:St;function _c(e){e.min=gc(e.min),e.max=gc(e.max)}function vc(e){_c(e.x),_c(e.y)}var yc=()=>({translate:0,scale:1,origin:0,originPoint:0}),bc=()=>({x:yc(),y:yc()}),xc=()=>({min:0,max:0}),Sc=()=>({x:xc(),y:xc()});function Cc(e){return e.translate===0&&e.scale===1}function wc(e){return Cc(e.x)&&Cc(e.y)}function Tc(e,t){return e.min===t.min&&e.max===t.max}function Ec(e,t){return Tc(e.x,t.x)&&Tc(e.y,t.y)}function Dc(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Oc(e,t){return Dc(e.x,t.x)&&Dc(e.y,t.y)}function kc(e){return tc(e.x)/tc(e.y)}function Ac(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var jc=class{constructor(){this.members=[]}add(e){ht(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;r&&r.isConnected!==!1||n.snapshot||(gt(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(gt(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};function Mc(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Nc={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(L.test(e))e=parseFloat(e);else return e}return`${Mc(e,t.target.x)}% ${Mc(e,t.target.y)}%`}},Pc={borderRadius:Object.assign({},Nc,{applyTo:qo.slice()}),borderTopLeftRadius:Nc,borderTopRightRadius:Nc,borderBottomLeftRadius:Nc,borderBottomRightRadius:Nc,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Hn.parse(e);if(i.length>5)return r;let a=Hn.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=R(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}}};function Fc(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e}=n;e&&(r=`perspective(${e}px) ${r}`);for(let e=0;ee.depth-t.depth,Rc=class{constructor(){this.children=[],this.isDirty=!1}add(e){ht(this.children,e),this.isDirty=!0}remove(e){gt(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Lc),this.isDirty=!1,this.children.forEach(e)}},zc={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Bc=[`z`,`skew`,`skewZ`],Vc=1e3,Hc=0;function Uc(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}var Wc=e=>e.instance&&Ra.get(e.instance)?.demote()&&e.resetSkewAndRotation();function Gc(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Fo(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,z,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Gc(r)}function Kc(e){if(e)return e.options.allowProjection===!1?Kc(e.parent):e.projection}function qc({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return Object.assign(Ps,{...Pc,...Ps}),class{static create(e,t,n){let{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:s,layoutRoot:c,layoutAnchor:l,layoutCrossfade:u}=t,d=e.projection=new this(e.latestValues,t[`data-framer-portal-id`]?void 0:Kc(e.parent));d.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&Ls(o),visualElement:e,animationType:typeof i==`string`?i:`both`,initialPromotionConfig:n,crossfade:u,layoutScroll:s,layoutRoot:c,layoutAnchor:l});let f=d.getStack()?.lead;f&&!d.root.isUpdateBlocked()&&(f.willUpdate(),f.scheduleCheckAfterUnmount())}constructor(e={},n=t?.()){this.id=Hc++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Xc),this.nodes.forEach(sl),this.nodes.forEach(cl),this.nodes.forEach(Zc),Fs.countProjection?.()},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;z.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n?.(),n=Is(i,250),zc.hasAnimatedSinceResize&&(zc.hasAnimatedSinceResize=!1,this.nodes.forEach(ol)))})}n&&this.root.registerSharedNode(n,this),this.addLayoutListener()}addLayoutListener(){let{layoutId:e,layout:t,visualElement:n,animate:r}=this.options;this.instance&&!this.hasLayoutListener&&r!==!1&&n&&(e||t)&&(this.hasLayoutListener=!0,this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:i})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||n.getDefaultTransition()||ml,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=n.getProps(),c=!this.targetLayout||!Oc(this.targetLayout,i),l=!t&&r;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...uo(a,`layout`),onPlay:o,onComplete:s};(n.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||ol(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,fr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(ll),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete?.();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Gc(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;Wc(this),this.isLayoutDirty=!0;for(let e=0;ee.members.length?e.removeLeadSnapshot():this.sharedNodes.delete(t))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,z.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){z.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!tc(this.snapshot.measuredBox.x)&&!tc(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let n=t/1e3,r=p?.(n);ul(o.x,e.x,n),ul(o.y,e.y,n),r&&(o.x.translate=r.x,o.y.translate=r.y),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(cc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),fl(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Ec(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Sc(),Ys(f,this.relativeTarget)),c&&(this.animationValues=a,Us(a,i,this.latestValues,n,d,u)),r?.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(fr(this.pendingAnimation),void 0),this.pendingAnimation=z.update(()=>{zc.hasAnimatedSinceResize=!0,this.motionValue||=co(0),this.motionValue.jump(0,!1),this.currentAnimation=Ns(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),li(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta?.(Vc),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&gl(this.options.animationType,this.layout.layoutBox,n.layoutBox)){let{layoutBox:e}=this.layout,t=i;i=this.target||Sc(),hl(i.x,t.x,e.x),hl(i.y,t.y,e.y)}Ys(t,i),Ds(t,r),ic(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new jc),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?.transition,preserveFollowOpacity:n?.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){this.getStack()?.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let{latestValues:t}=e;if(!ms(t))return;let n={};for(let t=0;te.currentAnimation?.stop()),this.root.nodes.forEach($c),this.root.sharedNodes.clear()}}}function Jc(e){e.updateLayout(),nl(e)}function Yc(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source,o=(r,a)=>{if(i===`size`)Ic(e=>{let t=tc(r[e]);r[e].min=a[e].min,r[e].max=r[e].min+t});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Js(r[e],a[e])}else gl(i,t.layoutBox,n)&&Ic(t=>{let n=tc(a[t]);r[t].max=r[t].min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[t].max=e.relativeTarget[t].min+n)})},s=a?t.measuredBox:t.layoutBox;o(s,n);let c=bc();ic(c,n,t.layoutBox);let l=bc();ic(l,a?e.applyTransform(r,!0):n,s);let u=!wc(c),d=!1,f=e.getClosestProjectingParent();if((!e.resumeFrom||f?.options.layoutRoot&&e.resumeFrom.path.includes(f))&&f&&!f.resumeFrom){let{snapshot:r,layout:i}=f;if(r&&i){let s=e.options.layoutAnchor||void 0,c=Sc();cc(c,a?e.resumeFrom.applyTransform(t.layoutBox,!0,void 0,!0,f.depth+1):t.layoutBox,r.layoutBox,s);let l=Sc();cc(l,n,i.layoutBox,s),a&&o(c,l),Oc(c,l)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=c,e.relativeParent=f)}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:l,layoutDelta:c,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else e.isLead()&&e.options.onExitComplete?.();e.options.transition=void 0}function Xc(e){Fs.countProjection?.(0),e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Zc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Qc(e){e.clearSnapshot()}function $c(e){e.clearMeasurements()}function el(e){e.isLayoutDirty=!0,e.updateLayout()}function tl(e){e.isLayoutDirty=!1}function nl(e){let{snapshot:t,dragAncestor:n}=e,r=n?.isAnimationBlocked&&n.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;Ic(e=>ws(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function rl(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function il(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function al(e){let{visualElement:t}=e.options;t?.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ol(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function sl(e){e.resolveTargetDelta()}function cl(e){e.calcProjection()}function ll(e){e.resetSkewAndRotation()}function ul(e,t,n){e.translate=R(t.translate,0,n),e.scale=R(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function dl(e,t,n,r){e.min=R(t.min,n.min,r),e.max=R(t.max,n.max,r)}function fl(e,t,n,r){dl(e.x,t.x,n.x,r),dl(e.y,t.y,n.y,r)}function pl(e){return e.animationValues?.opacityExit!==void 0}var ml={duration:.45,ease:[.4,0,.1,1]};function hl(e,t,n){e.max=tc(n)+(e.min=t.min)}function gl(e,t,n){return e===`position`||e===`preserve-aspect`&&!nc(kc(t),kc(n),.2)}function _l(e){return e!==e.root&&e.scroll?.wasRoot}function W(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var vl=qc({attachResizeListener:(e,t)=>W(e,`resize`,t),measureScroll:As,checkIsScrollRoot:()=>!0}),yl={current:void 0},bl=qc({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yl.current){let e=new vl({});e.mount(window),e.setOptions({layoutScroll:!0}),yl.current=e}return yl.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xl=new WeakMap;function Sl(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Cl(e){return typeof e==`string`||Array.isArray(e)}var wl=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Tl=[`initial`].concat(wl);function El(e){if(Sl(e.animate))return!0;for(let t=0;tkl.current=e.matches;e.addEventListener(`change`,t),t()}else kl.current=!1}}var Nl=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Pl={};function Fl(e){Pl=e}function Il(){return Pl}var Ll=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ra,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=F.now();this.renderScheduledAtt.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Al.current||Ml(),this.shouldReduceMotion=kl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),fr(this.notifyUpdate),fr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),(this.enteringChildren||=new Set).add(e)}removeChild(e){this.children.delete(e),this.enteringChildren?.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.get(e)?.(),t.accelerate&&wa.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new ha({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Et(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=zi.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&z.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),Ra.get(this.current)?.check()),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i?.()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Pl){let t=Pl[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Sc()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){let{transformTemplate:n,onUpdate:r}=this.props;(e.transformTemplate||n)&&this.scheduleRender(),(e.transformTemplate&&!n||e.onUpdate&&!r)&&Ra.get(this.current)?.demote(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t{this.current&&(this.current.textContent=`${e}`)}))}};function zl(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Bl(e,{layout:t,layoutId:n}){return zi.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ps[e]||e===`opacity`)}function Vl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(V(r[t])||i&&V(i[t])||Bl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Hl(e){return window.getComputedStyle(e)}var Ul=class extends Rl{constructor(){super(...arguments),this.type=`html`,this.renderInstance=zl}mount(e){super.mount(e)}readValueFromInstance(e,t){if(zi.has(t))return this.projection?.isProjecting?Fi(t):Li(e,t);{let n=Hl(e),r=(Xt(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Os(e,t)}build(e,t,n){ts(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Vl(e,t,n)}},Wl=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function Gl(e){return{point:{x:e.pageX,y:e.pageY}}}var Kl=e=>t=>Wl(t)&&e(t,Gl(t));function ql(e,t,n,r){return W(e,t,Kl(n),r)}var Jl=new WeakMap,Yl,Xl=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Yo(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Zl=Xl(`inline`,`width`,`offsetWidth`),Ql=Xl(`block`,`height`,`offsetHeight`);function $l({target:e,borderBoxSize:t}){Jl.get(e)?.forEach(n=>{n(e,{get width(){return Zl(e,t)},get height(){return Ql(e,t)}})})}function eu(e){e.forEach($l)}function tu(){typeof ResizeObserver<`u`&&(Yl=new ResizeObserver(eu))}function nu(e,t){Yl||tu();let n=$o(e);return n.forEach(e=>{let n=Jl.get(e);n||(n=new Set,Jl.set(e,n)),n.add(t),Yl?.observe(e)}),()=>{n.forEach(e=>{let n=Jl.get(e);n?.delete(t),n?.size||Yl?.unobserve(e)})}}var ru=new Set,iu;function G(){iu=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ru.forEach(t=>t(e))},window.addEventListener(`resize`,iu)}function au(e){return ru.add(e),iu||G(),()=>{ru.delete(e),!ru.size&&typeof iu==`function`&&(window.removeEventListener(`resize`,iu),iu=void 0)}}function ou(e,t){return Zo(typeof e==`function`?au(e):nu(e,t))}var su=(e,t)=>Math.abs(e-t);function cu(e,t){let n=su(e.x,t.x),r=su(e.y,t.y);return Math.sqrt(n**2+r**2)}var lu=new Set([`auto`,`scroll`]),uu=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=fu(this.lastRawMoveEventInfo,this.transformPagePoint));let e=mu(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=cu(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:F.now()});let{onStart:i,onMove:a}=this.handlers;t||(i?.(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a?.(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.handleScroll(window),this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=fu(t,this.transformPagePoint),this.hasPendingMove=!0,z.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i?.(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=mu(e.type===`pointercancel`?this.lastMoveEventInfo:fu(t,this.transformPagePoint),this.history);this.startEvent&&n?.(e,a),r?.(e,a)},!Wl(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=fu(Gl(e),this.transformPagePoint),{point:c}=s;this.history=[{...c,timestamp:F.now()}];let{onSessionStart:l}=t;l&&l(e,mu(s,this.history));let u={passive:!0,capture:!0};this.removeListeners=Ct(ql(this.contextWindow,`pointermove`,this.handlePointerMove,u),ql(this.contextWindow,`pointerup`,this.handlePointerUp,u),ql(this.contextWindow,`pointercancel`,this.handlePointerUp,u)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(lu.has(e.overflowX)||lu.has(e.overflowY))&&this.scrollPositions.set(t,du(t)),t=t.parentElement}this.scrollPositions.set(window,du(window)),this.removeScrollListeners=Ct(W(window,`scroll`,this.onElementScroll,{capture:!0}),W(window,`scroll`,this.onWindowScroll,{}))}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=du(e),i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),z.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),fr(this.updatePoint)}},du=e=>e===window?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop};function fu(e,t){return t?{point:t(e.point)}:e}function pu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mu({point:e},t){return{point:e,delta:pu(e,gu(t)),offset:pu(e,hu(t)),velocity:_u(t,.1)}}function hu(e){return e[0]}function gu(e){return e[e.length-1]}function _u(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=gu(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Et(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Et(t)*2&&(r=e[1]);let a=Dt(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var vu=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function yu(e){return vu.has(e.tagName)||e.isContentEditable===!0}var bu=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function xu(e){return bu.has(e.tagName)||e.isContentEditable===!0}var Su={x:!1,y:!1};function Cu(){return Su.x||Su.y}function wu(e){return e===`x`||e===`y`?Su[e]?null:(Su[e]=!0,()=>{Su[e]=!1}):Su.x||Su.y?null:(Su.x=Su.y=!0,()=>{Su.x=Su.y=!1})}function Tu(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?R(n,e,r.max):Math.min(e,n)),e}function Eu(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Du(e,{top:t,left:n,bottom:r,right:i}){return{x:Eu(e.x,n,i),y:Eu(e.y,t,r)}}function Ou(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=wt(t.min,t.max-r,e.min):r>i&&(n=wt(e.min,e.max-i,t.min)),_t(0,1,n)}function ju(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Mu=.35;function Nu(e=Mu){return e===!1?e=0:e===!0&&(e=Mu),{x:Pu(e,`left`,`right`),y:Pu(e,`top`,`bottom`)}}function Pu(e,t,n){return{min:Fu(e,t),max:Fu(e,n)}}function Fu(e,t){return typeof e==`number`?e:e[t]||0}function Iu(e){let t=``;for(let n of e.path){n.scroll=void 0,n.updateScroll();let{scroll:r}=n;n!==e.root&&r&&(t+=r.offset.x+`,`+r.offset.y+`,`)}return t}var Lu=new WeakMap,Ru=class{constructor(e,t=()=>e.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Sc(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e,this.readProps=t}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){if(this.visualElement.presenceContext?.isPresent===!1)return;let r=e=>{t&&this.snapToCursor(e),this.stopAnimation()},i=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock?.(),this.openDragLock=wu(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();let{projection:a}=this.visualElement;a&&(a.isAnimationBlocked=!0,a.target=void 0),Ic(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Qt(t)&&(t=So(t,this.visualElement.current)||0),L.test(t))t=parseFloat(t);else if(vn.test(t)){let n=a?.layout?.layoutBox[e];n&&(t=tc(n)*(parseFloat(t)/100))}this.originPoint[e]=t}),i&&z.update(()=>i(e,t),!1,!0),No(this.visualElement,`transform`),this.visualElement.animationState?.setActive(`whileDrag`,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){if(this.currentDirection=Wu(o),this.currentDirection===null)return;i&&i(this.currentDirection)}this.updateAxis(`x`,o),this.updateAxis(`y`,o),this.visualElement.render(),a&&z.update(()=>a(e,t),!1,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},s=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new uu(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:n,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(e,t,n){let r=e||this.latestPointerEvent,i=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;let{velocity:o}=i;this.startAnimation(o,n);let{onDragEnd:s}=this.getProps();s&&z.postRender(()=>s(r,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t?.setActive(`whileDrag`,!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(e,t){let{drag:n}=this.readProps();if(!t||!Uu(e,n,this.currentDirection))return;let r=this.getAxisMotionValue(e),i=this.originPoint[e]+t[e],a=this.constraints&&this.constraints[e];a&&(i=Tu(i,a,this.elastic[e])),r.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),{projection:n}=this.visualElement,r=n&&(n.layout||n.measure(!1)),i=this.constraints;zu(e)?this.constraints&&this.scroll===Iu(n)||(this.constraints=this.resolveRefConstraints()):this.constraints=e&&r?Du(r.layoutBox,e):!1,this.elastic=Nu(t),i!==this.constraints&&!zu(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ic(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=ju(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!zu(e))return!1;let n=Bu(e),{projection:r}=this.visualElement;if(!r||!r.layout)return!1;this.scroll=Iu(r);let i=ks(n,r.root,this.visualElement.getTransformPagePoint()),a=ku(r.layout.layoutBox,r.removeElementScroll(i));if(t){let e=t(cs(a));this.hasMutatedConstraints=!!e,e&&(a=ss(e))}return a}startAnimation(e,t){let{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c=this.constraints||{},l=Ic(s=>{if(!Uu(s,t||n,this.currentDirection))return;let l=c[s]||{};(o===!0||o===s)&&(l={min:0,max:0});let u=i?200:1e6,d=i?40:1e7,f={type:`inertia`,velocity:r?e[s]:0,bounceStiffness:u,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(s,f)});return Promise.all(l).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return No(this.visualElement,e),n.start(yo(e,n,0,t,this.visualElement,!1))}stopAnimation(){Ic(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.readProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();Ic(e=>{if(!Uu(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-R(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!zu(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};Ic(e=>{let t=this.getAxisMotionValue(e).get();i[e]=Au({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root?.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ic(t=>{let n=this.getAxisMotionValue(t);if(!Uu(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(R(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Lu.set(this.visualElement,this);let e=this.visualElement.current,t=ql(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&xu(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps(),r=zu(t)&&Bu(t);r&&(this.constraints=this.resolveRefConstraints(),n||=Hu(e,r,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i.layout||(i.root?.updateScroll(),i.updateLayout()),z.read(r);let o=W(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Ic(t=>{if(!Uu(t,this.getProps().drag,this.currentDirection))return;let n=this.getAxisMotionValue(t);this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate)}),this.visualElement.render())}));return()=>{o(),t(),a(),s(),n?.()}}getProps(){let e=this.readProps(),{dragElastic:t=Mu,dragMomentum:n=!0}=e;return{...e,dragElastic:t,dragMomentum:n}}};function zu(e){return!!e&&typeof e==`object`&&(`current`in e||`nodeType`in e)}var Bu=e=>`current`in e?e.current:e;function Vu(e){let t=!0;return()=>{t?t=!1:e()}}function Hu(e,t,n){let r=ou(e,Vu(n)),i=ou(t,Vu(n));return()=>{r(),i()}}function Uu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Wu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}function Gu(e,t){let n=$o(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},Zo(()=>r.abort())]}function Ku(e){return!(e.pointerType===`touch`||Cu())}function qu(e,t,n={}){t=Qo(t);let[r,i,a]=Gu(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{e.pointerType!==`touch`&&(n?r=!0:s(e))};e.addEventListener(`pointerenter`,n=>{if(!Ku(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Ju=(e,t)=>t?e===t||Ju(e,t.parentElement):!1,Yu=new WeakSet;function Xu(e){return t=>{t.key===`Enter`&&e(t)}}function Zu(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Qu=(e,t)=>{let n=!1,r=Xu(()=>{Yu.has(e)||(n=!0,Zu(e,`down`))}),i=Xu(()=>{n&&(n=!1,Zu(e,`up`))});e.addEventListener(`keydown`,r,t),e.addEventListener(`keyup`,i,t),e.addEventListener(`blur`,()=>{e.removeEventListener(`keydown`,r),e.removeEventListener(`keyup`,i),n&&Zu(e,`cancel`)},{...t,once:!0})};function $u(e){return Wl(e)&&!Cu()}var K=new WeakSet;function ed(e,t,n={}){t=Qo(t);let[r,i,a]=Gu(e,n),o=e=>{let r=e.currentTarget;if(!$u(e)||K.has(e))return;Yu.add(r),n.stopPropagation&&K.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),Yu.has(r)&&Yu.delete(r),$u(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Ju(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Jo(e)&&(e.addEventListener(`focus`,()=>Qu(e,i),i),!yu(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}var q=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},J=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Y=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function td(e,t,n,r){zl(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(J.has(n)?n:es(n),t.attrs[n])}function nd(e,t,n){let r=Vl(e,t,n);for(let n in e)if(n!==`children`&&(V(e[n])||V(t[n]))){let t=Ri.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var rd=class extends Rl{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Sc}getBaseTargetFromProps(e,t){return zi.has(t)?super.getBaseTargetFromProps(e,t)??Fi(t):e[t]}getDefaultValue(e){return zi.has(e)?this.latestValues[e]??Fi(e):void 0}readValueFromInstance(e,t){if(zi.has(t)){let e=Ci(t);return e&&e.default||0}if(as.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=J.has(t)?t:es(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return nd(e,t,n)}build(e,t,n){os(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){td(e,t,n,r)}mount(e){this.isSVGTag=Y(e.tagName),super.mount(e)}};function id(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;re?.out===!0?e:e?.out;function sd(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>Bo(e,t,n))),n=ld(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,{initial:l}=o,u=r||i,d=[],f=(t=l)=>typeof t!=`boolean`&&To(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom)||void 0,p=new Map,m={},h=1/0,g=e;do g=g.props.inherit!==!1&&g.parent;while(g&&!g.isControllingVariants);let _=u&&od(f(l??(g&&g.props.initial))?.transition);if(ad.forEach((t,r)=>{let i=n[t],l=o[t],f=g&&g.props[t],v=l===void 0?Cl(f)||f===!1?f:void 0:l,y=Cl(v),b=t===a?i.isActive:null,x=y&&l===void 0&&!(u&&c);if(i.protectedKeys={...m},!i.isActive&&b===null||!v&&!i.prevProp||Sl(v)||typeof v==`boolean`)return;if(b===!1&&(h=r),t===`exit`&&i.isActive&&b!==!0){m={...m,...i.prevResolvedValues};return}let S=cd(i.prevProp,v),C=S||y&&(b&&!x||r>h),ee=!1,w=Array.isArray(v)?v:[v],te={},T;if(b!==!1)for(let n of w){let{transition:r,transitionEnd:i,...a}=To(e,n,Eo(e,t))||{};te={...te,...a,...i},T=od(r)||T}let{prevResolvedValues:E}=i;for(let t in{...E,...te}){if(t in m)continue;let n=te[t],r=E[t],a=Array.isArray(n)&&Array.isArray(r)?!id(n,r)||S:n!==r,o;if(a&&n==null)p.has(t)||p.set(t,i.prevOut);else if(a||n!==void 0&&p.has(t)){C=!0,o=p.get(t)||_,p.delete(t)&&(ee=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0;i.out[t]=o}if(i.prevProp=v,i.prevResolvedValues=te,i.prevOut=T,i.isActive&&(m={...m,...te}),C&&(!(x&&S)||ee))for(let n of w){let r={type:t};if(typeof n==`string`&&u&&c&&s?.enteringChildren){let t=To(s,n)?.transition?.delayChildren;r.delay=ro(s.enteringChildren,e,t)}d.push({animation:n,options:r})}}),p.size){let t={},n=f(),r=n?.transition;p.forEach((i,a)=>{i&&(r={...r||e.getDefaultTransition(),[a]:i});let s=e.getValue(a);s&&(s.liveStyle=!0);let c=n&&!Array.isArray(l)?n[a]:void 0,u=e.getBaseTargetFromProps(o,a);t[a]=(c===void 0?u!==void 0&&!V(u)?u:e.initialValues[a]===void 0?e.baseTarget[a]:void 0:c)??null}),r&&(t.transition=r),d.push({animation:t})}let v=u&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!v&&d.length?t(d):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=ld(),i=!0}}}function cd(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!id(t,e):!1}function ld(){let e={};for(let t of wl)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return e}var ud=(0,E.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function dd(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function fd(...e){return t=>{let n=!1,r=e.map(e=>{let r=dd(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:t,height:n}=e?.getBoundingClientRect()||{};return[t/e?.offsetWidth||1,n/e?.offsetHeight||1]},hd=e=>{let{left:t,top:n}=e.getBoundingClientRect(),r=e;for(;r=r.parentElement||r.parentNode?.host;){let{scrollLeft:e,scrollTop:i}=r;if(e||i){let[a,o]=md(r);t+=e*a,n+=i*o}if(getComputedStyle(r).position===`fixed`)break}let[i,a]=md(e.offsetParent);return[t/i,n/a]},gd=class extends E.Component{getSnapshotBeforeUpdate(e){let t=this.props.getElement();if(Jo(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Jo(e)&&e.offsetWidth||0,r=Jo(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction,a.point=hd(t)}return null}componentDidUpdate(){}render(){return this.props.children}};function _d({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a,popNode:o}){let s=(0,E.useId)(),c=(0,E.useRef)(null),l=(0,E.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:u}=(0,E.useContext)(ud),d=pd(c,a===!1?void 0:e.props?.ref??e?.ref),f=()=>c.current||o?.current?.current,p=e=>{let{width:t,height:i,top:a,left:o,right:c,bottom:u,direction:d}=l.current,f=d===`rtl`,p=n===`left`?f?`right:${c}`:`left:${o}`:f?`left:${o}`:`right:${c}`,m=r===`bottom`?`bottom:${u}`:`top:${a}`;e?.insertRule(`[data-motion-pop-id="${s}"]{position:absolute!important;width:${t}px!important;height:${i}px!important;${p}px!important;${m}px!important}`)};return(0,E.useInsertionEffect)(()=>{let{width:e,height:n}=l.current,r=f();if(t||a===!1||!r||!e||!n)return;r.dataset.motionPopId=s;let o=r.ownerDocument,c=o.createElement(`style`);u&&(c.nonce=u);let d=i??o.head;d.appendChild(c),p(c.sheet);let m=0,h=0;return js.setup(()=>{let[e,t]=hd(r);m=l.current.point[0]-e,h=l.current.point[1]-t}),js.read(()=>{let{sheet:e}=c;if(!e||!m&&!h)return;let t=l.current;t.left+=m,t.right-=m,t.top+=h,t.bottom-=h,e.deleteRule(0),p(e)}),()=>{r.removeAttribute(`data-motion-pop-id`),d.contains(c)&&d.removeChild(c)}},[t]),(0,X.jsx)(gd,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:E.cloneElement(e,{ref:d})})}var vd=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=ft(yd),d=(0,E.useId)(),f=(0,E.useRef)(),p=(0,E.useRef)(n),m=(0,E.useRef)(r);pt(()=>{p.current=n,m.current=r});let h=!0,g=(0,E.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,E.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),E.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,X.jsx)(_d,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,X.jsx)(mt.Provider,{value:g,children:e})};function yd(){return new Map}function bd(e=!0){let t=(0,E.useContext)(mt);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,E.useId)();(0,E.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,E.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}function xd(){return Sd((0,E.useContext)(mt))}function Sd(e){return e===null||e.isPresent}var Cd=e=>e.key||``;function wd(e){let t=[];return E.Children.forEach(e,e=>{(0,E.isValidElement)(e)&&t.push(e)}),t}var Td=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=bd(o),f=(0,E.useMemo)(()=>wd(e),[e]),p=o&&!u?[]:f.map(Cd),m=(0,E.useRef)(!0),h=ft(()=>new Map),g=(0,E.useRef)(new Set),[_,v]=(0,E.useState)(f),[y,b]=(0,E.useState)(f);pt(()=>{o&&!u&&!y.length&&d?.()},[u,o,y.length,d]);let x=(0,E.useRef)();(0,E.useEffect)(()=>()=>{let e=x.current;x.current=void 0,e?.()},[y]),pt(()=>{m.current=!1;for(let e=0;eh.get(Cd(e)))?e=f:a===`wait`&&(e=S),b(wd(e)),v(f),null}let{forceRender:C}=(0,E.useContext)(dt);return(0,X.jsx)(X.Fragment,{children:y.map(e=>{let _=Cd(e),b=o&&!u?!1:f===y||p.includes(_);return(0,X.jsx)(vd,{isPresent:b,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:b?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(C?.(),v([]),o&&d?.(),x.current=r)},anchorX:s,anchorY:c,children:e},_)})})},Ed=(0,E.createContext)({strict:!1}),Dd={animation:[`variants`,...wl],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Od=!1;function kd(){if(Od)return;let e={};for(let t in Dd)e[t]={isEnabled:e=>Dd[t].some(t=>!!e[t])};Fl(e),Od=!0}function Ad(){return kd(),Il()}function jd(e){let t=Ad();for(let n in e)t[n]={...t[n],...e[n]};Fl(t)}function Md({children:e,...t}){let n=(0,E.useContext)(ud);t={...n,...t},t.transition=lo(t.transition,n.transition),t.isStatic=ft(()=>t.isStatic);let r=(0,E.useMemo)(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return(0,X.jsx)(ud.Provider,{value:r,children:e})}var Nd=(0,E.createContext)({});function Pd(e,t){if(El(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Cl(t)?t:void 0,animate:Cl(n)?n:void 0}}return e.inherit===!1?{}:t}function Fd(e){let{initial:t,animate:n}=Pd(e,(0,E.useContext)(Nd));return(0,E.useMemo)(()=>({initial:t,animate:n}),[Id(t),Id(n)])}function Id(e){return Array.isArray(e)?e.join(` `):e}var Ld=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Rd(e,t,n){for(let r in t)!V(t[r])&&!Bl(r,n)&&(e[r]=t[r])}function zd({transformTemplate:e},t){return(0,E.useMemo)(()=>{let n=Ld();return ts(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Bd(e,t){let n=e.style||{},r={};return Rd(r,n,e),Object.assign(r,zd(e,t)),r}function Vd(e,t){let n={},r=Bd(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Hd=()=>({...Ld(),attrs:{}});function Ud(e,t,n,r){let i=(0,E.useMemo)(()=>{let n=Hd();return os(n,t,Y(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};return Rd(t,e.style,e),{...i,style:{...t,...i.style}}}return i}var Wd=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Gd(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Wd.has(e)}function Kd(e,t){return e.startsWith(`on`)?!Gd(e):t?.(e)??!Gd(e)}function qd(e,t,n,r){let i={};for(let a in e)a===`values`&&typeof e.values==`object`||V(e[a])||(Kd(a,r)||n===!0&&Gd(a)||!t&&!Gd(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]);return i}var Jd=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Yd(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Jd.indexOf(e)>-1||/[A-Z]/u.test(e))}function Xd(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??Yd(e)?Ud:Vd)(t,r,i,e),l=qd(t,typeof e==`string`,a,s),u=e===E.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,E.useMemo)(()=>V(d)?d.get():d,[d]);return(0,E.createElement)(e,{...u,children:f})}function Zd({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Qd(n,r,i,e),renderState:t()}}function Qd(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=zs(a[e]);let{initial:o,animate:s}=e,c=El(e),l=Dl(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Sl(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{let r=(0,E.useContext)(Nd),i=(0,E.useContext)(mt),a=()=>Zd(e,t,r,i);return n?a():ft(a)},ef=$d({scrapeMotionValuesFromProps:Vl,createRenderState:Ld}),tf=$d({scrapeMotionValuesFromProps:nd,createRenderState:Hd}),nf=Symbol.for(`motionComponentSymbol`);function rf(e,t,n){let r=(0,E.useRef)(n);(0,E.useInsertionEffect)(()=>{r.current=n});let i=(0,E.useRef)(null);return(0,E.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var af=(0,E.createContext)({});function of(e,t,n,r,i,a){let{visualElement:o}=(0,E.useContext)(Nd),s=(0,E.useContext)(Ed),c=(0,E.useContext)(mt),l=(0,E.useContext)(ud),u=l.reducedMotion,d=l.skipAnimations,f=(0,E.useRef)(null),p=(0,E.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,E.useContext)(af);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&i.create(m,n,h),(0,E.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[Po],_=(0,E.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return pt(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),pt(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,E.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function sf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&jd(r);let a=n?n===`svg`:Yd(e),o=a?tf:ef;function s(n,s){let c,l=cf(n);ft(()=>!!yl.current?.sharedNodes.get(l)?.lead&&n.initial)&&(n={...n,initial:!1});let u={...(0,E.useContext)(ud),...n,layoutId:l},{isStatic:d,isValidProp:f}=u,p=Fd(n),m=o(n,d);if(!d&&typeof window<`u`){lf(u,r);let t=uf(u);p.visualElement=of(e,m,u,i,t.ProjectionNode,a),(t.isEnabled||p.visualElement?.projection?.options.layoutId)&&(c=t.MeasureLayout)}return(0,X.jsxs)(Nd.Provider,{value:p,children:[c&&p.visualElement?(0,X.jsx)(c,{visualElement:p.visualElement,...u}):null,Xd(e,n,rf(m,p.visualElement,s),m,d,t,a,f)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,E.forwardRef)(s);return c[nf]=e,c}function cf({layoutId:e}){let t=(0,E.useContext)(dt).id;return t&&e!==void 0?t+`-`+e:e}function lf(e,t){(0,E.useContext)(Ed).strict}function uf(e){let{drag:t,layout:n}=Ad();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:r.MeasureLayout,isEnabled:t?.isEnabled(e)||n?.isEnabled(e),ProjectionNode:r.ProjectionNode}}function df(e,t){if(typeof Proxy>`u`)return sf;let n=new Map,r=(n,r)=>sf(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,sf(a,void 0,e,t)),n.get(a))})}var ff=(e,t)=>t.isSVG??Yd(e)?new rd(t):new Ul(t,{allowProjection:e!==E.Fragment}),pf=class extends q{constructor(e){super(e),e.animationState||=sd(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Sl(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Z=0,mf={animation:{Feature:pf},exit:{Feature:class extends q{constructor(){super(...arguments),this.id=Z++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=To(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id,this.node))}unmount(){}}}},hf=class extends q{constructor(e){super(e),this.removeGroupControls=St,this.removeListeners=St,this.controls=new Ru(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||St}update(){let{dragControls:e,drag:t}=this.node.getProps(),{dragControls:n,drag:r}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls))),r&&!t&&this.controls.stop(void 0,void 0,r)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},gf=e=>(t,n)=>{e&&z.update(()=>e(t,n),!1,!0)},_f=class extends q{constructor(){super(...arguments),this.removePointerDownListener=St}onPointerDown(e){this.session=new uu(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:gf(e),onStart:gf(t),onMove:gf(n),onEnd:(e,t)=>{delete this.session,r&&z.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=ql(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}},vf=!1,yf=({layout:e,layoutDependency:t,layoutAnchor:n})=>({layout:e,layoutDependency:t,layoutAnchor:n,animationType:typeof e==`string`?e:`both`}),bf=(e,t)=>{let{snapshot:n}=e,r=e.getStack();r?.remove(e);let i=r?.lead;if(r?.prevLead===e&&i.resumeFrom===e&&(i.resumeFrom=i.currentAnimation=e.resumingFrom=void 0),e.options.layoutId=t,!t)e.needsShow=!0;else return e.root.registerSharedNode(t,e),()=>{let{resumeFrom:t}=e;t?.isPresent!==!1&&e.getStack().members.includes(t)&&(t.hide(),e.resumeFrom=void 0,e.snapshot=n)}},xf=class extends E.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group?.add(i),r&&n?.register?.(i),vf&&i.root.didUpdate(),i.options.layoutId!==r&&bf(i,r)?.(),i.addEventListener(`animationComplete`,()=>this.safeToRemove()),i.setOptions({...i.options,...yf(this.props),onExitComplete:()=>this.safeToRemove()})),zc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,layoutId:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,this.takeOver=e.layoutId===n?void 0:(o.willUpdate(),bf(o,n)),o.setOptions({...o.options,...yf(this.props)}),vf=!0,i||e.layoutDependency!==t||t===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||z.postRender(()=>{o.getStack()?.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(this.takeOver?.(),e.root.didUpdate(),js.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;vf=!0,r&&(r.scheduleCheckAfterUnmount(),t.group?.remove(r),n?.deregister?.(r))}safeToRemove(){this.props.safeToRemove?.()}render(){return null}};function Sf(e){let[t,n]=bd(),r=(0,E.useContext)(dt);return(0,X.jsx)(xf,{...e,layoutGroup:r,switchLayoutGroup:(0,E.useContext)(af),isPresent:t,safeToRemove:n})}var Cf={pan:{Feature:_f},drag:{Feature:hf,ProjectionNode:bl,MeasureLayout:Sf}};function wf(e,t,n,r){let{props:i}=e,a=`while`+n;e.animationState&&i[a]&&e.animationState.setActive(a,r===`Start`);let o=i[`on`+n+r];o&&z.postRender(()=>o(t,Gl(t)))}var Tf=class extends q{mount(){let{current:e}=this.node;e&&(this.unmount=qu(e,(e,t)=>(wf(this.node,t,`Hover`,`Start`),e=>wf(this.node,e,`Hover`,`End`))))}unmount(){}},Ef=class extends q{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Ct(W(this.node.current,`focus`,()=>this.onFocus()),W(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Df(e,t,n){e.current instanceof HTMLButtonElement&&e.current.disabled||wf(e,t,`Tap`,n)}var Of=class extends q{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=ed(e,(e,t)=>(Df(this.node,t,`Start`),(e,{success:t})=>Df(this.node,e,t?``:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},kf=new WeakMap,Af=new WeakMap,jf=e=>{let t=kf.get(e.target);t&&t(e)},Mf=e=>{e.forEach(jf)};function Nf({root:e,...t}){let n=e||document;Af.has(n)||Af.set(n,{});let r=Af.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Mf,{root:e,...t})),r[i]}function Pf(e,t,n){let r=Nf(t);return kf.set(e,n),r.observe(e),()=>{kf.delete(e),r.unobserve(e)}}var Ff={some:0,all:1},If=class extends q{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Ff[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Pf(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Lf(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Lf({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Rf=df(Object.assign({},mf,{inView:{Feature:If},tap:{Feature:Of},focus:{Feature:Ef},hover:{Feature:Tf}},Cf,{layout:{ProjectionNode:bl,MeasureLayout:Sf}}),ff),zf=h(),Bf=_(),Vf=Rf,Q=1e-4;function Hf(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function Uf(e){switch(e){case`navigation`:return .065;case`focus`:return .11;case`select`:return .16;case`success`:return .24;case`warning`:return .3;case`error`:return .34;case`connect`:case`disconnect`:return .5}}function Wf(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Gf(){return Wf()!==null}var Kf=class{context=null;master=null;state=`idle`;isMuted;masterVolume;pauseWhenHidden;manuallySuspended=!1;hiddenSuspended=!1;listenerAttached=!1;startPromise=null;sources=new Set;toneSources=new Map;lastCueAt=new Map;constructor(e={}){this.isMuted=e.muted??!1,this.masterVolume=Hf(e.volume??.42),this.pauseWhenHidden=e.pauseWhenHidden??!0}get supported(){return this.context!==null||Gf()}get muted(){return this.isMuted}get status(){return this.state}get volume(){return this.masterVolume}start(e){return e?.muted!==void 0&&this.setMuted(e.muted),this.state===`disposed`?Promise.resolve(!1):this.context?this.resume():(this.startPromise||=this.initialize().finally(()=>{this.startPromise=null}),this.startPromise)}setMuted(e){this.state!==`disposed`&&(this.isMuted=e,this.applyMasterGain(.055))}toggleMuted(){return this.setMuted(!this.isMuted),this.isMuted}setVolume(e){this.state!==`disposed`&&(this.masterVolume=Hf(e),this.applyMasterGain(.07))}cue(e,t=`neutral`){let n=this.playableContext(e);if(!n||!this.master)return!1;Jf(e);let r=n.currentTime+.005;switch(e){case`focus`:this.tone(n,r,.16,523.25,587.33,.022,0,`sine`);break;case`select`:[392,523.25,659.25].forEach((e,t)=>{this.tone(n,r+t*.027,.3+t*.04,e,e*1.006,.018-t*.002,(t-1)*.14,t===1?`triangle`:`sine`)});break;case`navigation`:{let e=Yf(t);this.tone(n,r,.11,e.start,e.end,.02,e.pan,`sine`);break}case`warning`:this.tone(n,r,.21,246.94,196,.027,-.08,`triangle`),this.tone(n,r+.09,.25,220,174.61,.022,.08,`sine`);break;case`success`:this.tone(n,r,.26,329.63,493.88,.021,-.08,`sine`),this.tone(n,r+.06,.32,493.88,659.25,.017,.08,`triangle`);break;case`error`:this.tone(n,r,.28,196,146.83,.026,-.08,`triangle`),this.tone(n,r+.075,.3,164.81,123.47,.02,.08,`sine`);break;case`connect`:this.tone(n,r,.24,293.66,392,.018,-.08,`sine`),this.tone(n,r+.055,.3,440,587.33,.014,.08,`triangle`);break;case`disconnect`:this.tone(n,r,.24,392,293.66,.018,-.08,`triangle`),this.tone(n,r+.055,.3,261.63,196,.014,.08,`sine`)}return!0}playTone(e,t,n,r){let i=this.context;if(!i||!this.master||this.state!==`running`||this.isMuted||this.masterVolume<=0||!Number.isFinite(e)||e<20||e>2e4||!Number.isFinite(t)||t<1||t>6e4||n!==void 0&&(!Number.isFinite(n)||n<0))return!1;let a=n===void 0?.003:n/1e3;return this.tone(i,i.currentTime+a,t/1e3,e,e,.024,0,`square`,r),!0}stopTone(e,t=0){let n=this.context,r=e.trim();if(!n||n.state===`closed`||this.state===`disposed`||!r||!Number.isFinite(t)||t<0)return!1;let i=this.toneSources.get(r);if(!i?.size)return!1;let a=n.currentTime+t/1e3;for(let e of i)try{e.stop(a)}catch{}return this.toneSources.delete(r),!0}async suspend(){let e=this.context;if(e&&this.state!==`disposed`){if(this.manuallySuspended=!0,this.hiddenSuspended=!1,e.state===`running`)try{await e.suspend()}catch{}e===this.context&&(this.state=`paused`)}}async resume(){let e=this.context;if(!e||e.state===`closed`||this.state===`disposed`)return!1;if(typeof document<`u`&&document.hidden)return this.state=`paused`,!1;this.manuallySuspended=!1,this.hiddenSuspended=!1;try{e.state!==`running`&&await e.resume()}catch{return this.state=`paused`,!1}let t=e.state===`running`;return this.state=t?`running`:`paused`,t&&this.applyMasterGain(.12),t}async dispose(){if(this.state===`disposed`)return;this.state=`disposed`,this.detachVisibilityListener();for(let e of this.sources){try{e.stop()}catch{}try{e.disconnect()}catch{}}this.sources.clear(),this.toneSources.clear();let e=this.context;if(this.context=null,this.master=null,e&&e.state!==`closed`)try{await e.close()}catch{}}async initialize(){let e=Wf();if(!e)return this.state=`unsupported`,!1;this.state=`starting`;let t;try{t=new e({latencyHint:`interactive`})}catch{try{t=new e}catch{return this.state=`unsupported`,!1}}this.context=t;let n=t.createGain(),r=t.createDynamicsCompressor();n.gain.setValueAtTime(0,t.currentTime),r.threshold.setValueAtTime(-22,t.currentTime),r.knee.setValueAtTime(16,t.currentTime),r.ratio.setValueAtTime(4,t.currentTime),r.attack.setValueAtTime(.012,t.currentTime),r.release.setValueAtTime(.24,t.currentTime),n.connect(r),r.connect(t.destination),this.master=n,this.attachVisibilityListener(),t.onstatechange=()=>{t===this.context&&this.state!==`disposed`&&(this.state=t.state===`running`?`running`:`paused`)};try{t.state!==`running`&&await t.resume()}catch{return this.state=`paused`,!1}let i=t.state===`running`;return this.state=i?`running`:`paused`,i&&this.applyMasterGain(.32),i}playableContext(e){let t=this.context;if(!t||this.state!==`running`||this.isMuted||this.masterVolume<=0)return null;let n=Uf(e),r=this.lastCueAt.get(e)??-1/0;return t.currentTime-r{if(this.sources.delete(l),m){let e=this.toneSources.get(m);e?.delete(l),e?.size===0&&this.toneSources.delete(m)}l.disconnect(),u.disconnect(),d?.disconnect()},{once:!0}),l.start(t),l.stop(p+.025)}applyMasterGain(e){let t=this.context,n=this.master;if(!t||!n||t.state===`closed`)return;let r=t.currentTime,i=this.isMuted?0:this.masterVolume;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(i,r+Math.max(.005,e))}attachVisibilityListener(){this.pauseWhenHidden&&!this.listenerAttached&&typeof document<`u`&&(document.addEventListener(`visibilitychange`,this.onVisibilityChange),this.listenerAttached=!0)}detachVisibilityListener(){this.listenerAttached&&typeof document<`u`&&(document.removeEventListener(`visibilitychange`,this.onVisibilityChange),this.listenerAttached=!1)}onVisibilityChange=()=>{let e=this.context;e&&this.state!==`disposed`&&(document.hidden?e.state===`running`&&!this.manuallySuspended&&(this.hiddenSuspended=!0,e.suspend().then(()=>{this.state!==`disposed`&&(this.state=`paused`)}).catch(()=>void 0)):this.hiddenSuspended&&!this.manuallySuspended&&(this.hiddenSuspended=!1,e.resume().then(()=>{e.state===`running`&&this.state!==`disposed`&&(this.state=`running`,this.applyMasterGain(.18))}).catch(()=>{this.state=`paused`})))}};function qf(e){return e===`select`?8:e===`success`?[10,22,14]:e===`warning`?[18,32,18]:e===`error`?[22,28,22]:e===`connect`?10:e===`disconnect`?[12,24,10]:null}function Jf(e){if(typeof navigator>`u`||typeof navigator.vibrate!=`function`||typeof document<`u`&&document.visibilityState!==`visible`)return;let t=qf(e);t!==null&&navigator.vibrate(t)}function Yf(e){switch(e){case`forward`:return{start:349.23,end:415.3,pan:0};case`backward`:return{start:349.23,end:293.66,pan:0};case`left`:return{start:329.63,end:369.99,pan:-.32};case`right`:return{start:329.63,end:369.99,pan:.32};case`up`:return{start:392,end:466.16,pan:0};case`down`:return{start:329.63,end:261.63,pan:0};default:return{start:329.63,end:369.99,pan:0}}}function Xf(e){return new Kf(e)}function Zf(e){return[e.port.instance_id||e.port.serial_number||e.port.name||`controller`,e.hello.build_hash??``,e.hello.build_timestamp||``].join(`|`)}var Qf=class{requestedGeneration=``;shouldRead(e,t){if(!e.connected||e.have_settings)return this.requestedGeneration=``,!1;if(!t)return!1;let n=Zf(e);return n!==this.requestedGeneration&&(this.requestedGeneration=n,!0)}},$f=class{start;stop;onError;onHoldingChange;active=!1;stopIssued=!1;startPromise=Promise.resolve();constructor(e,t,n,r){this.start=e,this.stop=t,this.onError=n,this.onHoldingChange=r}begin(){if(this.active)return!1;this.active=!0,this.stopIssued=!1,this.onHoldingChange(!0);let e=Promise.resolve().then(this.start);return this.startPromise=e,e.catch(e=>{this.onError(e),this.release()}),!0}release(e=!0){return!this.active||this.stopIssued?!1:(this.active=!1,this.stopIssued=!0,e&&this.onHoldingChange(!1),this.startPromise.catch(()=>void 0).then(this.stop).catch(this.onError),!0)}isHolding(){return this.active}};function ep(e){return e.filter(Number.isFinite)}function $(e,t){let n=ep(e);if(!n.length)return t===`temperature`?[20,60]:t===`supply`?[0,13]:[0,1];let r=Math.min(...n),i=Math.max(...n);if(t===`supply`)return[0,Math.max(13,Math.ceil(i*1.05*2)/2)];if(t===`temperature`)return[Math.min(20,Math.floor(r-5)),Math.max(60,Math.ceil(i+3))];if(t===`current`)return[0,Math.max(100,Math.ceil(Math.max(0,i)*1.2/50)*50)];if(i>r)return[r,i];let a=Math.max(1,Math.abs(r)*.05);return[r-a,i+a]}function tp(e,t=`auto`,n=300,r=92){let i=ep(e),a=i.length>1?i:i.length===1?[i[0],i[0]]:[0,0],[o,s]=$(a,t),c=Math.max(2**-52,s-o);return a.map((e,t)=>({x:t/Math.max(1,a.length-1)*n,y:r-8-Math.max(0,Math.min(1,(e-o)/c))*(r-20)}))}function np(e){let t=typeof navigator>`u`?void 0:navigator,n=e??`${t?.userAgentData?.platform??``} ${t?.platform??``} ${t?.userAgent??``}`;return/mac|iphone|ipad|ipod/i.test(n)?`⌘`:`Ctrl`}function rp(e){return np(e)===`⌘`?`Meta+K`:`Control+K`}function ip(e,t){return typeof document<`u`&&document.documentElement.lang.toLowerCase().startsWith(`fa`)?t:e}function ap({icon:e,size:t=18}){return(0,X.jsx)(e,{"aria-hidden":`true`,size:t,strokeWidth:1.8})}function op({fallback:e}){let[t,n]=(0,E.useState)(!1);return t?(0,X.jsx)(`span`,{"aria-hidden":`true`,children:e}):(0,X.jsx)(`img`,{src:`/favicon.svg`,alt:``,onError:()=>n(!0)})}function sp({active:e,disabled:t,label:n,onToggle:r}){return(0,X.jsx)(`button`,{type:`button`,className:`relay-switch__toggle`,"aria-label":n,"aria-pressed":e,disabled:t,onClick:r,children:(0,X.jsx)(`i`,{"aria-hidden":`true`,children:(0,X.jsx)(`b`,{})})})}function cp({keys:e,separator:t=`+`}){let n=e.map(e=>Array.isArray(e)?e.join(ip(` or `,` یا `)):e).join(t===`+`?ip(` plus `,` به‌علاوهٔ `):` ${t} `);return(0,X.jsx)(`span`,{className:`key-combo`,dir:`ltr`,"aria-label":n,children:e.map((e,n)=>(0,X.jsxs)(`span`,{className:`key-combo__group`,children:[n>0&&(0,X.jsx)(`span`,{className:`key-combo__separator`,"aria-hidden":`true`,children:t}),(Array.isArray(e)?e:[e]).map((e,t)=>(0,X.jsxs)(`span`,{className:`key-combo__key`,children:[t>0&&(0,X.jsx)(`span`,{className:`key-combo__alternative`,"aria-hidden":`true`,children:`/`}),(0,X.jsx)(`kbd`,{children:e})]},e))]},`${n}-${Array.isArray(e)?e.join(`-`):e}`))})}var lp=(0,E.forwardRef)(function({icon:e,tone:t=`secondary`,busy:n,compact:r,children:i,className:a=``,disabled:o,...s},c){return(0,X.jsxs)(`button`,{className:`button button--${t}${r?` button--compact`:``} ${a}`,disabled:o||n,ref:c,...s,children:[(0,X.jsx)(`span`,{className:`button__wash`,"aria-hidden":`true`}),n?(0,X.jsx)(Me,{className:`spin`,"aria-hidden":`true`,size:17}):e?(0,X.jsx)(ap,{icon:e,size:17}):null,i?(0,X.jsx)(`span`,{children:i}):null]})});function up({onHoldStart:e,onHoldStop:t,onHoldError:n,disabled:r,className:i=``,children:a,...o}){let[s,c]=(0,E.useState)(!1),l=(0,E.useRef)(e),u=(0,E.useRef)(t),d=(0,E.useRef)(n);l.current=e,u.current=t,d.current=n;let f=(0,E.useRef)(null);f.current||=new $f(()=>l.current(),()=>u.current(),e=>d.current?.(e),c);let p=f.current;return(0,E.useEffect)(()=>{let e=()=>p.release(),t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),p.release(!1)}},[p]),(0,X.jsx)(lp,{...o,disabled:r,className:`${i} hold-action${s?` is-holding`:``}`,"aria-pressed":s,onPointerDown:e=>{e.button!==0||r||(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),p.begin())},onPointerUp:e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),p.release()},onPointerCancel:()=>p.release(),onPointerLeave:()=>p.release(),onLostPointerCapture:()=>p.release(),onKeyDown:e=>{e.key!==` `&&e.key!==`Enter`||e.repeat||r||(e.preventDefault(),p.begin())},onKeyUp:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),p.release())},"data-touch-mode":`hold`,onBlur:()=>p.release(),children:a})}function dp({icon:e,iconTone:t=`accent`,title:n,eyebrow:r,action:i,menu:a=[],children:o,className:s=``,id:c}){let l=`card-menu-${(0,E.useId)().replace(/:/g,``)}`,[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)({left:0,top:0}),m=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(null),_=(0,E.useRef)(null),v=(e=!0)=>{d(!1),e&&window.requestAnimationFrame(()=>_.current?.focus())},y=(e,t,n)=>{_.current=n,p({left:e,top:t}),d(!0)};return(0,E.useLayoutEffect)(()=>{if(!u||!g.current)return;let e=g.current.getBoundingClientRect();p(t=>({left:Math.max(10,Math.min(t.left,window.innerWidth-e.width-10)),top:Math.max(10,Math.min(t.top,window.innerHeight-e.height-10))}))},[u]),(0,E.useEffect)(()=>{if(!u)return;let e=window.requestAnimationFrame(()=>g.current?.querySelector(`button:not(:disabled)`)?.focus()),t=e=>{!g.current?.contains(e.target)&&!h.current?.contains(e.target)&&v(!1)},n=()=>v(!1),r=e=>{let t=e.target;!g.current?.contains(t)&&!h.current?.contains(t)&&v(!1)},i=()=>{document.visibilityState!==`visible`&&v(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,r),document.addEventListener(`visibilitychange`,i),window.addEventListener(`resize`,n),window.addEventListener(`scroll`,n,!0),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,r),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`resize`,n),window.removeEventListener(`scroll`,n,!0)}},[u]),(0,X.jsxs)(`section`,{id:c,className:`card ${s}`,ref:m,tabIndex:a.length?0:void 0,onKeyDown:e=>{if(!a.length||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault();let t=m.current?.getBoundingClientRect();t&&y(t.right-12,t.top+44,m.current)},onContextMenu:a.length?e=>{e.preventDefault(),y(e.clientX,e.clientY,m.current)}:void 0,children:[(n||r||i||a.length>0)&&(0,X.jsxs)(`header`,{className:`card__header`,children:[(0,X.jsxs)(`div`,{className:`card__heading`,children:[e&&(0,X.jsx)(`span`,{className:`card__icon card__icon--${t}`,children:(0,X.jsx)(ap,{icon:e,size:18})}),(0,X.jsxs)(`div`,{className:`card__heading-copy`,children:[r&&(0,X.jsx)(`div`,{className:`eyebrow`,children:r}),n&&(0,X.jsx)(`h2`,{children:n})]})]}),(i||a.length>0)&&(0,X.jsxs)(`div`,{className:`card__action`,children:[i,a.length>0&&(0,X.jsx)(`button`,{ref:h,type:`button`,className:`card__menu-trigger`,"aria-label":ip(`Card actions`,`عملیات کارت`),"aria-haspopup":`menu`,"aria-controls":l,"aria-expanded":u,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();y(t.right,t.bottom+7,e.currentTarget)},children:(0,X.jsx)(ap,{icon:A,size:18})})]})]}),o,typeof document<`u`&&(0,zf.createPortal)((0,X.jsx)(Td,{children:u&&(0,X.jsx)(Vf.div,{id:l,ref:g,className:`card-menu`,role:`menu`,"aria-label":ip(`Card actions`,`عملیات کارت`),style:f,initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.14,ease:[.22,1,.36,1]},onKeyDown:e=>{let t=[...g.current?.querySelectorAll(`button:not(:disabled)`)??[]];if(!t.length)return;let n=t.indexOf(document.activeElement),r=n<0?0:n;e.key===`Escape`?(e.preventDefault(),v()):e.key===`Tab`?v(!1):[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(r+1)%t.length:(r-1+t.length)%t.length]?.focus())},children:a.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,"data-tone":e.tone??`normal`,onClick:()=>{v(),e.onSelect()},children:[e.icon&&(0,X.jsx)(ap,{icon:e.icon,size:17}),(0,X.jsx)(`span`,{children:e.label})]},e.label))})}),document.body)]})}function fp({eyebrow:e,title:t,detail:n,action:r}){return(0,X.jsxs)(`header`,{className:`section-title`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`eyebrow`,children:e}),(0,X.jsx)(`h1`,{children:t}),n&&(0,X.jsx)(`p`,{children:n})]}),r&&(0,X.jsx)(`div`,{className:`section-title__action`,children:r})]})}function pp({tone:e,children:t,pulse:n}){return(0,X.jsxs)(`span`,{className:`status-badge status-badge--${e}${n?` status-badge--pulse`:``}`,children:[(0,X.jsx)(`span`,{className:`status-badge__line`,"aria-hidden":`true`}),t]})}function mp({values:e,tone:t=`accent`,label:n,scale:r=`auto`}){let i=(0,E.useId)().replace(/:/g,``),a=tp(e,r,300,92).map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(` `),o=`${a} L300,92 L0,92 Z`;return(0,X.jsxs)(`svg`,{className:`sparkline sparkline--${t}`,viewBox:`0 0 300 92`,role:`img`,"aria-label":n,preserveAspectRatio:`none`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsxs)(`linearGradient`,{id:`fill-${i}`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`currentColor`,stopOpacity:`.28`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`,stopOpacity:`0`})]}),(0,X.jsxs)(`linearGradient`,{id:`line-${i}`,x1:`0`,x2:`1`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`currentColor`,stopOpacity:`.4`}),(0,X.jsx)(`stop`,{offset:`.55`,stopColor:`currentColor`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`,stopOpacity:`.65`})]})]}),(0,X.jsx)(`path`,{className:`sparkline__grid`,d:`M0 24H300 M0 48H300 M0 72H300`}),(0,X.jsx)(Vf.path,{className:`sparkline__area`,d:o,fill:`url(#fill-${i})`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.7}}),(0,X.jsx)(Vf.path,{className:`sparkline__line`,d:a,fill:`none`,stroke:`url(#line-${i})`,initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{duration:.8,ease:[.22,1,.36,1]}})]})}function hp({icon:e,label:t,value:n,unit:r,values:i,tone:a,detail:o,scale:s=`auto`}){return(0,X.jsxs)(`article`,{className:`metric metric--${a}`,children:[(0,X.jsxs)(`div`,{className:`metric__top`,children:[(0,X.jsx)(`span`,{className:`metric__icon`,children:(0,X.jsx)(ap,{icon:e,size:19})}),(0,X.jsx)(`span`,{className:`metric__label`,children:t})]}),(0,X.jsxs)(`div`,{className:`metric__value`,dir:`ltr`,children:[(0,X.jsx)(`strong`,{children:n}),(0,X.jsx)(`span`,{children:r})]}),o&&(0,X.jsx)(`div`,{className:`metric__detail`,children:o}),(0,X.jsx)(mp,{values:i,tone:a,scale:s,label:ip(`${t} trend`,`روند ${t}`)})]})}function gp({checked:e,onChange:t,label:n,detail:r,disabled:i}){return(0,X.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:`toggle-row${i?` is-disabled`:``}`,disabled:i,onClick:()=>t(!e),children:[(0,X.jsxs)(`span`,{className:`toggle-row__copy`,children:[(0,X.jsx)(`strong`,{children:n}),r&&(0,X.jsx)(`small`,{children:r})]}),(0,X.jsx)(`span`,{className:`toggle`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{})})]})}function _p({label:e,value:t,min:n,max:r,step:i=1,unit:a,onChange:o,disabled:s,onEditStart:c,onEditEnd:l}){let u=(0,E.useId)(),[d,f]=(0,E.useState)(String(t));(0,E.useEffect)(()=>f(String(t)),[t]);let p=(t-n)/Math.max(1,r-n)*100,m=()=>{let e=Number(d);if(!Number.isFinite(e)){f(String(t));return}let i=Math.min(r,Math.max(n,e));f(String(i)),o(i)};return(0,X.jsxs)(`div`,{className:`range-field${s?` is-disabled`:``}`,children:[(0,X.jsxs)(`span`,{className:`range-field__label`,children:[(0,X.jsx)(`label`,{htmlFor:u,children:(0,X.jsx)(`strong`,{children:e})}),(0,X.jsxs)(`span`,{className:`range-field__value`,dir:`ltr`,children:[(0,X.jsx)(`input`,{className:`range-field__number`,type:`number`,value:d,min:n,max:r,step:i,disabled:s,"aria-label":typeof e==`string`?ip(`${e} exact value`,`مقدار دقیق ${e}`):ip(`Exact value`,`مقدار دقیق`),onInput:e=>f(e.currentTarget.value),onFocus:c,onBlur:()=>{m(),l?.()},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}}),a&&(0,X.jsx)(`span`,{children:a})]})]}),(0,X.jsx)(`input`,{id:u,type:`range`,value:t,min:n,max:r,step:i,disabled:s,style:{"--range":`${p}%`},onPointerDown:c,onPointerUp:l,onPointerCancel:l,onLostPointerCapture:l,onBlur:l,onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&c?.()},onKeyUp:l,onChange:e=>o(Number(e.target.value))})]})}function vp({value:e,options:t,onChange:n,label:r}){return(0,X.jsx)(`div`,{className:`segmented`,role:`radiogroup`,"aria-label":r,children:t.map(t=>(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t.value===e,className:t.value===e?`is-active`:``,onClick:()=>n(t.value),children:[t.icon&&(0,X.jsx)(ap,{icon:t.icon,size:16}),(0,X.jsx)(`span`,{children:t.label})]},t.value))})}function yp({label:e,hint:t,error:n,success:r,action:i,id:a,"aria-describedby":o,...s}){let c=(0,E.useId)(),l=a||`field-${c.replace(/:/g,``)}`,u=`${l}-message`,d=n||r||t,f=!!t&&!n&&!r;return(0,X.jsxs)(`div`,{className:`text-field${n?` is-invalid`:r?` is-valid`:``}`,children:[(0,X.jsx)(`label`,{htmlFor:l,children:e}),(0,X.jsxs)(`div`,{className:`text-field__control`,children:[(0,X.jsx)(`input`,{id:l,"aria-describedby":[o,d?u:``].filter(Boolean).join(` `)||void 0,"aria-invalid":n?!0:void 0,...s}),i&&(0,X.jsx)(`div`,{className:`text-field__action`,children:i})]}),d&&(0,X.jsx)(`small`,{id:u,className:`text-field__message${f?` text-field__message--contextual`:``}`,role:n?`alert`:`status`,children:d})]})}function bp({icon:e,title:t,detail:n,action:r}){return(0,X.jsxs)(`div`,{className:`empty-state`,children:[(0,X.jsx)(`span`,{className:`empty-state__icon`,children:(0,X.jsx)(ap,{icon:e,size:25})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:t}),(0,X.jsx)(`p`,{children:n})]}),r]})}function xp({label:e,value:t,mono:n,tone:r}){return(0,X.jsxs)(`div`,{className:`data-row`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(`strong`,{className:`${n?`mono`:``}${r?` text-${r}`:``}`,children:t})]})}function Sp({icon:e,label:t,active:n,badge:r,onClick:i}){return(0,X.jsxs)(`button`,{className:`nav-button${n?` is-active`:``}`,onClick:i,"aria-label":t,"aria-current":n?`page`:void 0,children:[(0,X.jsx)(`span`,{className:`nav-button__icon`,children:(0,X.jsx)(ap,{icon:e,size:20})}),(0,X.jsx)(`span`,{className:`nav-button__label`,children:t}),r&&(0,X.jsx)(`span`,{className:`nav-button__badge`,children:r}),(0,X.jsx)(_e,{className:`nav-button__chevron`,"aria-hidden":`true`,size:15})]})}function Cp(e){if(!e?.isConnected)return!1;let t=e.querySelector(`h1`)??e;return t.dataset.routeFocusTarget=``,t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus({preventScroll:!0}),!0}function wp({focusOnEnter:e,children:t}){let n=(0,E.useRef)(null),r=xd(),i=(0,E.useRef)(e);return(0,X.jsx)(Vf.div,{ref:n,className:`page`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18,ease:`easeOut`},onAnimationComplete:()=>{r&&i.current&&Cp(n.current)},children:t})}function Tp({pageKey:e,children:t}){let n=(0,E.useRef)(!1);return(0,E.useEffect)(()=>{n.current=!0},[]),(0,X.jsx)(Td,{mode:`wait`,initial:!1,children:(0,X.jsx)(wp,{focusOnEnter:n.current,children:t},e)})}function Ep({open:e,progress:t,locale:n,productTitle:r,productShortName:i,productTagline:a,onEnter:o}){let s=t>=100,c=t<34?n===`fa`?`بارگذاری هویت سامانه`:`Loading system identity`:t<68?n===`fa`?`برقراری مسیر کنترل`:`Establishing control route`:t<96?n===`fa`?`همگام‌سازی وضعیت میزبان`:`Synchronizing host state`:n===`fa`?`مرکز کنترل آماده است`:`Control center is ready`;return(0,X.jsx)(Td,{children:e&&(0,X.jsxs)(Vf.section,{className:`boot-gate`,role:`dialog`,"aria-modal":`true`,"aria-busy":!s,"aria-labelledby":`boot-title`,initial:{opacity:1},exit:{opacity:0},transition:{duration:.28,ease:`easeOut`},children:[(0,X.jsxs)(`div`,{className:`boot-fuji`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`boot-fuji__rear`}),(0,X.jsx)(`span`,{className:`boot-fuji__face`}),(0,X.jsx)(`span`,{className:`boot-fuji__snow`}),(0,X.jsx)(`span`,{className:`boot-fuji__trace`})]}),(0,X.jsxs)(`div`,{className:`boot-identity`,children:[(0,X.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,X.jsx)(op,{fallback:i})}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`span`,{children:[r.toUpperCase(),` / `,a]}),(0,X.jsx)(`h1`,{id:`boot-title`,children:n===`fa`?`مرکز کنترل یکپارچه`:r})]})]}),(0,X.jsxs)(`div`,{className:`boot-status`,"aria-live":`polite`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:c}),(0,X.jsxs)(`b`,{dir:`ltr`,children:[Math.round(t).toString().padStart(2,`0`),`%`]})]}),(0,X.jsx)(`div`,{className:`boot-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(t),children:(0,X.jsx)(`span`,{style:{inlineSize:`${t}%`}})})]}),(0,X.jsxs)(`div`,{className:`boot-entry${s?` is-ready`:``}`,inert:!s||void 0,children:[(0,X.jsx)(lp,{tone:`primary`,icon:se,disabled:!s,onClick:()=>o(!0),children:n===`fa`?`ورود با نشانه‌های صوتی`:`Enter with audio cues`}),(0,X.jsx)(lp,{icon:it,disabled:!s,onClick:()=>o(!1),children:n===`fa`?`ورود بی‌صدا`:`Enter quietly`})]})]})})}function Dp({open:e,locale:t,onClose:n}){let r=t===`fa`?`میانبرهای مرکز کنترل`:`Control center shortcuts`,i=np(),a=t===`fa`?[{keys:[i,`K`],detail:`فرمان‌ها و صفحه‌ها`},{keys:[`Alt`,`1…8`],detail:`رفتن مستقیم به صفحه`},{keys:[`G`,[`D`,`C`,`B`,`V`,`W`,`E`,`S`]],separator:`سپس`,detail:`رفتن به داشبورد، کنترلر، میزکار تجهیزات، دستگاه، فضای داده، رویدادها یا تنظیمات`},{keys:[i,`Shift`,[`←`,`→`]],detail:`صفحهٔ کناری در جهت دیداری`},{keys:[`?`],detail:`نمایش یا بستن این راهنما`},{keys:[`M`],detail:`قطع یا وصل نشانه‌های صوتی`},{keys:[`Esc`],detail:`بستن لایهٔ فعال`}]:[{keys:[i,`K`],detail:`Commands and pages`},{keys:[`Alt`,`1…8`],detail:`Open a page directly`},{keys:[`G`,[`D`,`C`,`B`,`V`,`W`,`E`,`S`]],separator:`then`,detail:`Go to dashboard, controls, peripheral workbench, device, data workspace, events, or settings`},{keys:[i,`Shift`,[`←`,`→`]],detail:`Adjacent page in the visual direction`},{keys:[`?`],detail:`Show or close this guide`},{keys:[`M`],detail:`Mute or enable interaction cues`},{keys:[`Esc`],detail:`Close the active layer`}];return(0,X.jsx)(Td,{children:e&&(0,X.jsxs)(Vf.div,{className:`hotkey-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`modal-backdrop`,"aria-label":t===`fa`?`بستن راهنمای صفحه‌کلید`:`Close keyboard guide`,onClick:n}),(0,X.jsxs)(Vf.section,{className:`hotkey-help`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`hotkey-help-title`,initial:{opacity:0,scale:.985},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.99},transition:{duration:.2,ease:`easeOut`},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Te,{size:19}),(0,X.jsx)(`i`,{children:t===`fa`?`راهنمای کلیدها`:`KEY MAP`})]}),(0,X.jsx)(`button`,{className:`modal__close`,onClick:n,"aria-label":t===`fa`?`بستن`:`Close`,children:(0,X.jsx)(ct,{size:18})})]}),(0,X.jsx)(`h2`,{id:`hotkey-help-title`,children:r}),(0,X.jsx)(`div`,{className:`hotkey-list`,children:a.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(cp,{keys:e.keys,separator:e.separator}),(0,X.jsx)(`span`,{children:e.detail})]},`${e.keys.flat().join(`-`)}-${e.detail}`))})]})]})})}function Op({state:e,onClose:t,busy:n}){let r=(0,E.useRef)(null),i=(0,E.useRef)(null),a=(0,E.useRef)(null),o=(0,E.useRef)(t),s=(0,E.useRef)(!!n);return o.current=t,s.current=!!n,(0,E.useEffect)(()=>{if(!e.open)return;let t=document.activeElement,n=window.requestAnimationFrame(()=>{((e.tone===`danger`?i.current:r.current)??a.current)?.focus()}),c=e=>{if(e.key===`Escape`&&!s.current){e.preventDefault(),o.current();return}if(e.key!==`Tab`||!a.current)return;let t=[...a.current.querySelectorAll(`button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.offsetParent!==null);if(!t.length){e.preventDefault(),a.current.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,c),()=>{window.cancelAnimationFrame(n),document.removeEventListener(`keydown`,c),t?.isConnected&&t.focus()}},[e.open,e.tone]),(0,X.jsx)(Td,{children:e.open&&(0,X.jsxs)(Vf.div,{className:`modal-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(Vf.button,{className:`modal-backdrop`,"aria-label":ip(`Close dialog`,`بستن گفت‌وگو`),onClick:t,disabled:n}),(0,X.jsxs)(Vf.div,{ref:a,className:`modal modal--${e.tone??`normal`}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`active-dialog-title`,tabIndex:-1,initial:{opacity:0,scale:.985,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:5},transition:{duration:.2,ease:[.22,1,.36,1]},children:[(0,X.jsx)(`button`,{className:`modal__close`,"aria-label":ip(`Close`,`بستن`),onClick:t,disabled:n,children:(0,X.jsx)(ct,{size:18})}),(0,X.jsx)(`div`,{className:`modal__signal`,"aria-hidden":`true`,children:e.tone===`danger`?(0,X.jsx)(et,{size:25}):(0,X.jsx)(he,{size:25})}),(0,X.jsx)(`h2`,{id:`active-dialog-title`,children:e.title}),(0,X.jsx)(`p`,{children:e.body}),(0,X.jsxs)(`div`,{className:`modal__actions`,children:[(0,X.jsx)(lp,{ref:i,tone:`ghost`,onClick:t,disabled:n,children:ip(`Cancel`,`انصراف`)}),(0,X.jsx)(lp,{ref:r,tone:e.tone===`danger`?`danger`:`primary`,busy:n,onClick:()=>e.action?.(),children:e.confirmLabel})]})]})]})})}function kp({messages:e,dismiss:t}){return(0,X.jsx)(`div`,{className:`toast-stack`,"aria-live":`polite`,"aria-atomic":`false`,children:(0,X.jsx)(Td,{initial:!1,children:e.map(e=>(0,X.jsxs)(Vf.article,{className:`toast toast--${e.tone}`,initial:{opacity:0,x:18},animate:{opacity:1,x:0},exit:{opacity:0,x:12},transition:{duration:.32,ease:[.22,1,.36,1]},children:[(0,X.jsx)(`span`,{className:`toast__rail`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`toast__body`,children:[(0,X.jsx)(`strong`,{children:e.title}),e.detail&&(0,X.jsx)(`p`,{children:e.detail}),e.updateOperationID&&(0,X.jsxs)(`div`,{className:`toast__progress${e.progressKnown?``:` is-indeterminate`}`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:ip(`Transfer`,`انتقال`)}),(0,X.jsx)(`bdi`,{title:e.bytesTotal?`${e.bytesDone??0} / ${e.bytesTotal} bytes`:void 0,children:e.progressLabel})]}),(0,X.jsx)(`div`,{className:`update-progress${e.progressKnown?``:` is-indeterminate`}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progressKnown?e.progressPercent:void 0,"aria-valuetext":e.progressLabel,children:(0,X.jsx)(`i`,{style:e.progressKnown?{width:`${e.progressPercent??0}%`}:void 0})})]}),e.correlation&&(0,X.jsxs)(`code`,{className:`toast__correlation`,children:[(0,X.jsx)(`span`,{children:ip(`Reference`,`شناسه`)}),(0,X.jsxs)(`bdi`,{children:[`#`,e.correlation]})]}),e.action&&(0,X.jsxs)(`div`,{className:`toast__action-context`,children:[(0,X.jsx)(`span`,{children:e.actionLabel||ip(`Suggested action`,`عملیات پیشنهادی`)}),(0,X.jsx)(`code`,{dir:`ltr`,children:e.action})]})]}),(0,X.jsx)(`button`,{className:`toast__dismiss`,"aria-label":ip(`Dismiss`,`بستن اعلان`),onClick:()=>t(e.id),children:(0,X.jsx)(ct,{size:16})})]},e.id))})})}var Ap=/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,jp=/\s+/g;function Mp(e,t=``){return{normalized:e,error:t,valid:!t}}function Np(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,` `).slice(0,64)}function Pp(e){let t=Np(e),n=t.trim();return n?n.length>64?Mp(t,`Application title must be 64 characters or fewer.`):/[\p{L}\p{N}]/u.test(n)?Mp(n):Mp(t,`Application title must include a letter or number.`):Mp(t,`Application title is required.`)}function Fp(e){let t=e.normalize(`NFKC`).replace(Ap,``).replace(jp,` `);return Array.from(t).slice(0,64).join(``)}function Ip(e){let t=Fp(e).trim();return Array.from(t).length>64?Mp(t,`Peripheral name must be 64 characters or fewer.`):Mp(t)}function Lp(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,``).slice(0,4096)}function Rp(e){return e.normalize(`NFKC`).replace(/[\s,]+/g,` `).replace(Ap,``).trimStart().toLowerCase()}function zp(e){let t=Rp(e).trim().split(` `).filter(Boolean),n=t.join(` `),r=t.some(e=>!/^[\x21-\x7e]+$/.test(e)),i=new Set(t).size!==t.length,a=``;return t.length>14?a=`Use no more than 14 page keys or IDs.`:r?a=`Page keys or IDs must use printable ASCII characters.`:i&&(a=`Page keys or IDs must be unique.`),{normalized:n,pages:t,error:a,valid:!a}}function Bp(e){return e.normalize(`NFKC`).replace(/[\t\r\n\f\v]+/g,` `).replace(Ap,``)}function Vp(e,t){let n=Bp(e),r=new TextEncoder().encode(n).length,i=Math.max(0,40-t),a=``;return/^[\x20-\x7e]*$/.test(n)?r<5?a=`Text must contain at least 5 printable ASCII bytes.`:r+t>40&&(a=`Text and repeat gap must fit within 40 bytes.`):a=`Text must use printable ASCII characters.`,{normalized:n,byteLength:r,availableBytes:i,error:a,valid:!a}}function Hp(e,t){let n=zp(e.pages.join(` `)).pages,r=zp(t.pages.join(` `)).pages;return e.enabled===t.enabled&&e.speed_ms===t.speed_ms&&e.gap_cells===t.gap_cells&&Bp(e.door_open_text)===Bp(t.door_open_text)&&Bp(e.door_closed_text)===Bp(t.door_closed_text)&&n.length===r.length&&n.every((e,t)=>e===r[t])}function Up(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,``).replace(/\\/g,`/`).replace(/^([a-z][a-z\d+.-]*):\/(?!\/)/i,`$1://`).slice(0,2048)}function Wp(e,t){let n=Up(e);if(!n)return t?{normalized:n,error:`A root URL is required while this integration is enabled.`}:{normalized:n};let r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`,i;try{i=new URL(r)}catch{return{normalized:n,error:`Enter a valid HTTP or HTTPS root URL.`}}return i.protocol!==`http:`&&i.protocol!==`https:`?{normalized:n,error:`Only HTTP and HTTPS are supported.`}:i.username||i.password?{normalized:n,error:`Credentials are not allowed in the URL.`}:i.search||i.hash?{normalized:n,error:`Query strings and fragments are not allowed.`}:i.pathname!==`/`&&i.pathname!==``?{normalized:n,error:`Use the service root without a path.`}:(i.pathname=`/`,{normalized:i.toString().replace(/\/$/,``),url:i})}function Gp(e){let t=e.split(`.`).map(Number);return t.length!==4||t.some(e=>!Number.isInteger(e)||e<0||e>255)?!1:t[0]===10||t[0]===127||t[0]===169&&t[1]===254||t[0]===172&&t[1]>=16&&t[1]<=31||t[0]===192&&t[1]===168}function Kp(e){return!e||e.length>253?!1:e.split(`.`).every(e=>e.length>=1&&e.length<=63&&!e.startsWith(`-`)&&!e.endsWith(`-`)&&/^[a-z\d-]+$/i.test(e))}function qp(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return t.includes(`:`)?t===`::1`||/^(?:fc|fd)[0-9a-f]{2}:/i.test(t)||/^fe[89ab][0-9a-f]:/i.test(t):Gp(t)?!0:Kp(t)?t===`localhost`||!t.includes(`.`)||[`.local`,`.lan`,`.home.arpa`,`.localdomain`].some(e=>t.endsWith(e)&&t.length>e.length):!1}function Jp(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``),n=t.split(`.`).map(Number),r=n.length===4&&n[0]===127&&n.every(e=>Number.isInteger(e)&&e>=0&&e<=255);return t===`localhost`||t===`::1`||r}function Yp(e,t){let n=Wp(e,t);return n.error||!n.url?Mp(n.normalized,n.error??``):qp(n.url.hostname)?Mp(n.normalized):Mp(n.normalized,`Use a private, loopback, link-local, or local-DNS host.`)}function Xp(e,t){let n=Wp(e,t);return n.error||!n.url?Mp(n.normalized,n.error??``):Jp(n.url.hostname)?Mp(n.normalized):Mp(n.normalized,`The data service must use localhost or a loopback address.`)}function Zp(e,t){return e.local_device.enabled===t.local_device.enabled&&Up(e.local_device.base_url??``)===Up(t.local_device.base_url??``)&&e.data_hub.enabled===t.data_hub.enabled&&Up(e.data_hub.base_url??``)===Up(t.data_hub.base_url??``)&&e.lifecycle_safety.session_lock===t.lifecycle_safety.session_lock&&e.lifecycle_safety.suspend===t.lifecycle_safety.suspend&&e.lifecycle_safety.refresh_on_resume===t.lifecycle_safety.refresh_on_resume}var Qp=`controller`,$p=`pccontroller.controller-origin`;function em(){let e=``,t=``,n=null;try{e=globalThis.location?.href??``,t=globalThis.location?.origin??``}catch{}try{n=globalThis.localStorage}catch{}return{href:e,origin:t,localStorage:n,generatedConfig:globalThis.PCControllerWebConfig}}function tm(e){let t=Up(e);if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{return null}return![`http:`,`https:`,`ws:`,`wss:`].includes(r.protocol)||r.username||r.password||r.search||r.hash||r.pathname!==``&&r.pathname!==`/`?null:(r.pathname=``,r)}function nm(e){let t=tm(e);return t?t.origin.toLowerCase():``}function rm(e){let t=new Set;for(let n of e?.trusted_controller_origins??[]){if(typeof n!=`string`)continue;let e=tm(n);!e||e.protocol!==`https:`&&e.protocol!==`wss:`||t.add(e.origin.toLowerCase())}return t}function im(e,t=new Set){let n=tm(e);if(!n)return{valid:!1,normalized:``,error:`Use an HTTP(S) or WS(S) service root without credentials, a path, query, or fragment.`};let r=qp(n.hostname),i=(n.protocol===`https:`||n.protocol===`wss:`)&&t.has(n.origin.toLowerCase());return!r&&!i?{valid:!1,normalized:n.origin,error:`Use a local/private target or an explicitly trusted HTTPS/WSS origin.`}:{valid:!0,normalized:n.origin,error:``}}function am(e,t){let n=new URL(t),r=n.protocol===`https:`||n.protocol===`wss:`;n.protocol=r?`https:`:`http:`;let i=n.origin;return n.protocol=r?`wss:`:`ws:`,{source:e,controllerOrigin:t,httpOrigin:i,websocketOrigin:n.origin,external:!0}}function om(e){let t=nm(e);if(!t)return{source:`same-origin`,controllerOrigin:``,httpOrigin:``,websocketOrigin:``,external:!1};let n=new URL(t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,{source:`same-origin`,controllerOrigin:t,httpOrigin:t,websocketOrigin:n.origin,external:!1}}function sm(e=em()){let t=e.generatedConfig,n=rm(t),r=typeof t?.controller_origin==`string`?t.controller_origin.trim():``;if(r){let e=im(r,n);if(!e.valid)throw TypeError(`Invalid generated controller origin: ${e.error}`);return am(`generated-config`,e.normalized)}let i=null;if(e.href)try{i=new URL(e.href).searchParams.get(Qp)}catch{}if(i!==null){let t=im(i,n);if(!t.valid)throw TypeError(`Invalid controller query target: ${t.error}`);try{e.localStorage?.setItem($p,t.normalized)}catch{}return am(`query`,t.normalized)}let a=``;try{a=e.localStorage?.getItem(`pccontroller.controller-origin`)?.trim()??``}catch{}if(a){let t=im(a,n);if(t.valid)return am(`local-setting`,t.normalized);try{e.localStorage?.removeItem($p)}catch{}}return om(e.origin??``)}function cm(e){let t=e.trim();if(!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`\\`)||/[\u0000-\u001f\u007f]/.test(t))throw TypeError(`controller transport path must be an absolute local path`);return t}function lm(e){let t=cm(e),n=sm();return n.external?new URL(t,`${n.httpOrigin}/`).toString():t}function um(e){let t=cm(e),n=sm();if(n.websocketOrigin)return new URL(t,`${n.websocketOrigin}/`).toString();let r=globalThis.location?.protocol===`https:`?`wss:`:`ws:`;return new URL(t,`${r}//${globalThis.location?.host??``}`).toString()}function dm(){return sm().httpOrigin||void 0}var fm=`pccontroller.session-token`,pm=`pccontroller.ticket.`,mm=1,hm=null,gm=0,_m=new Map,vm=class extends Error{code;constructor(e,t){super(t),this.name=`ControllerRPCError`,this.code=e}};function ym(){return sessionStorage.getItem(fm)??``}function bm(e){let t=e.trim();t?sessionStorage.setItem(fm,t):sessionStorage.removeItem(fm)}function xm(e=!1){let t={};e&&(t[`Content-Type`]=`application/json`);let n=ym();return n&&(t.Authorization=`Bearer ${n}`),t}function Sm(e,t,n){if(typeof e==`object`&&e&&`error`in e){let t=e.error;return typeof t==`object`&&t&&`message`in t?String(t.message):String(t)}return typeof e==`string`?e:t||`HTTP ${n}`}async function Cm(e){let t=await e.text(),n=null;if(t)try{n=JSON.parse(t)}catch{n=t}return n}async function wm(e){let t=await Cm(e);if(!e.ok){let n=Sm(t,e.statusText,e.status);throw Error(n||`HTTP ${e.status}`)}return t}function Tm(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Controller returned an invalid JSON-RPC response`);let n=e;if(n.jsonrpc!==`2.0`||n.id!==t)throw Error(`Controller returned a mismatched JSON-RPC response`);let r=Object.prototype.hasOwnProperty.call(n,`result`),i=Object.prototype.hasOwnProperty.call(n,`error`);if(r===i)throw Error(`Controller returned an invalid JSON-RPC response`);if(i){let e=n.error;if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Controller returned an invalid JSON-RPC error`);let t=e;if(!Number.isInteger(t.code)||typeof t.message!=`string`)throw Error(`Controller returned an invalid JSON-RPC error`);return{error:new vm(t.code,t.message)}}return{result:n.result}}async function Em(e){let t=await wm(await fetch(lm(`/api/ui-config`),{signal:e,cache:`no-store`}));if(typeof t?.setup_complete!=`boolean`)throw Error(`UI configuration is missing required setup_complete state`);if(!t.appearance||typeof t.appearance!=`object`||typeof t.appearance_etag!=`string`||!/^[a-f0-9]{64}$/.test(t.appearance_etag))throw Error(`UI configuration is missing host-authoritative appearance state`);if(typeof t.session_ticket_path!=`string`||t.session_ticket_path.startsWith(`//`)||!/^\/[A-Za-z0-9._~!$&'()*+,;=:@%/-]+$/.test(t.session_ticket_path))throw Error(`UI configuration is missing a safe session-ticket path`);if(!Number.isSafeInteger(t.status_interval_ms)||t.status_interval_ms<50||t.status_interval_ms>6e4||!Number.isSafeInteger(t.measurement_freshness_ms)||t.measurement_freshness_ms12e4)throw Error(`UI configuration is missing valid live-measurement timing`);return t}async function Dm(e){return wm(await fetch(lm(`/api/snapshot`),{headers:xm(),signal:e,cache:`no-store`}))}async function Om(e,t){let n=await fetch(lm(`/api/rpc`),{method:`POST`,headers:xm(!0),body:JSON.stringify(e),signal:t}),r=await Cm(n),i=Tm(r,e.id);if(i.error)throw i.error;if(!n.ok){let e=Sm(r,n.statusText,n.status);throw Error(e||`HTTP ${n.status}`)}return i.result}function km(e,t){for(let[n,r]of _m)r.socket===e&&(_m.delete(n),r.cleanup(),r.reject(Error(t)))}function Am(e,t,n){return n?.aborted?Promise.reject(n.reason instanceof Error?n.reason:new DOMException(`Aborted`,`AbortError`)):new Promise((r,i)=>{let a=()=>{_m.delete(t.id),i(n?.reason instanceof Error?n.reason:new DOMException(`Aborted`,`AbortError`))},o=()=>n?.removeEventListener(`abort`,a);_m.set(t.id,{socket:e,resolve:e=>r(e),reject:i,cleanup:o}),n?.addEventListener(`abort`,a,{once:!0});try{e.send(JSON.stringify(t))}catch(e){_m.delete(t.id),o(),i(e instanceof Error?e:Error(String(e)))}})}function jm(e,t={},n){let r={jsonrpc:`2.0`,id:mm++,method:e,params:t},i=hm;return i&&i.readyState===WebSocket.OPEN?Am(i,r,n):Om(r,n)}function Mm(e,t){return jm(`controller.command.execute`,{command:e},t)}async function Nm(e,t){if(ym(),!e.auth_required)return[];let n=await wm(await fetch(lm(e.session_ticket_path),{method:`POST`,headers:xm(!0),body:JSON.stringify({transport:`websocket`}),signal:t,cache:`no-store`}));if(!/^[a-f0-9]{64}$/.test(n.ticket)||n.protocol!==`pccontroller`||!Number.isFinite(n.expires_in_ms)||n.expires_in_ms<=0||n.expires_in_ms>15e3||Number.isNaN(Date.parse(n.expires_at))||typeof n.principal!=`string`||!n.principal.trim())throw Error(`Controller returned an invalid WebSocket session ticket`);return[n.protocol,`${pm}${n.ticket}`]}function Pm(e,t=Math.random){let n=500*2**Math.min(Math.max(0,e),5);return Math.min(12e3,n+Math.floor(Math.max(0,Math.min(.999,t()))*250))}function Fm(e,t){let n=null,r=!1,i=0,a=0,o=0,s=null,c=e.status_interval_ms,l=(e,t=!1)=>{let n=mm++;return e.send(JSON.stringify({jsonrpc:`2.0`,id:n,method:`controller.subscribe`,params:t?{topics:[`status`],interval_ms:c,preserve:!0}:{topics:[`events`,`state`,`status`],interval_ms:c,after_id:0}})),n},u=(e,n)=>{if(r)return;i+=1;let o=Pm(i);t.state(`waiting`,e||`retrying in ${Math.ceil(o/1e3)}s`,n),window.clearTimeout(a),a=window.setTimeout(()=>{d()},o)},d=async()=>{if(r)return;let a=++o,c=++gm;t.state(`connecting`,void 0,{generation:c}),s?.abort();let d=new AbortController;s=d;let f;try{f=await Nm(e,d.signal)}catch(e){if(r||a!==o||d.signal.aborted)return;u(e instanceof Error?e.message:String(e),{generation:c});return}finally{s===d&&(s=null)}if(r||a!==o)return;let p;try{let t=um(e.websocket_path);p=f.length>0?new WebSocket(t,f):new WebSocket(t)}catch(e){if(r||a!==o)return;u(e instanceof Error?e.message:String(e),{generation:c});return}n=p;let m=()=>!r&&a===o&&n===p,h=0,g=``,_=!1,v=[],y=null,b=null,x=null,S=()=>({generation:c,...g?{instanceID:g}:{}}),C=e=>{m()&&t.event(e,S())},ee=e=>{m()&&t.snapshot?.(e,S())};p.addEventListener(`open`,()=>{m()&&(i=0,hm=p,h=l(p))}),p.addEventListener(`message`,e=>{if(m())try{let n=JSON.parse(String(e.data));if(typeof n.id==`number`){let e=_m.get(n.id);if(e&&e.socket===p){_m.delete(n.id),e.cleanup();try{let t=Tm(n,n.id);t.error?e.reject(t.error):e.resolve(t.result)}catch(t){e.reject(t instanceof Error?t:Error(String(t)))}}if(!m())return;if(n.id===h){if(n.error){p.close();return}let e=n.result;if(e?.subscribed!==!0){p.close();return}g=e.instance_id?.trim()??``,_=!0,t.state(`open`,void 0,S());for(let e of v.splice(0))C(e);y&&=(ee(y),null),b&&=(t.pwm?.(b,S()),null),x&&=(t.status(x,S()),null)}}if(n.method===`controller.status`&&(_?t.status(n.params,S()):x=n.params),n.method===`controller.pwm.values`&&(_?t.pwm?.(n.params,S()):(!b||Number(n.params.revision)>Number(b.revision))&&(b=n.params)),n.method===`controller.event`&&C(n.params),n.method===`controller.state`){let e=n.params;_?C(e):(v.length>=256&&v.shift(),v.push(e))}if(n.method===`controller.snapshot`){let e=n.params;_?ee(e):y=e}if(n.method===`controller.error`){let e=n.params?.error;t.state(_?`open`:`connecting`,e,S())}}catch{}}),p.addEventListener(`close`,e=>{m()&&(n===p&&(n=null),hm===p&&(hm=null),km(p,e.reason||`WebSocket RPC connection closed`),r?t.state(`closed`,void 0,S()):u(e.reason||`WebSocket connection closed`,S()))}),p.addEventListener(`error`,()=>{m()&&p.close()})};d();let f=(()=>{r=!0,o+=1,s?.abort(),window.clearTimeout(a);let e=n;n?.close(1e3,`view closed`),e&&(hm===e&&(hm=null),km(e,`WebSocket RPC view closed`)),n=null});return f.updateStatusInterval=e=>{if(!Number.isSafeInteger(e)||e<50||e>6e4)throw RangeError(`status interval must be 50..60000 ms`);if(c===e)return;c=e;let t=n;t&&t.readyState===WebSocket.OPEN&&l(t,!0)},f}async function Im(e,t,n={}){let r=t.startsWith(`/`)?t.slice(1):t;return wm(await fetch(lm(`/api/integrations/${e}/${r}`),{...n,headers:{...xm(!!n.body),...n.headers??{}}}))}function Lm(e,t){let n=e.headers.get(`Content-Disposition`)??``,r=n.match(/filename\*=UTF-8''([^;]+)/i)?.[1],i=n.match(/filename="([^"]+)"/i)?.[1],a=``;if(r)try{a=decodeURIComponent(r)}catch{a=``}let o=a||i||t.split(`/`).filter(Boolean).at(-1)||`controller-data.bin`;return o=o.replace(/[\\/:*?"<>|\u0000-\u001f\u007f]/g,`_`).trim().slice(0,180),o||`controller-data.bin`}async function Rm(e,t,n){let r=t.startsWith(`/`)?t.slice(1):t,i=lm(`/api/integrations/${e}/${r}`),a=await fetch(i,{headers:xm(),signal:n});a.ok||await wm(a);let o=await a.blob(),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=Lm(a,r),c.rel=`noopener`,document.body.append(c),c.click(),c.remove(),URL.revokeObjectURL(s)}var zm=[`dashboard`,`controls`,`workbench`,`device`,`data`,`updates`,`events`,`settings`],Bm=`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="combobox"]`;function Vm(e){if(!e)return!1;let t=e;return t.isContentEditable?!0:typeof t.closest==`function`&&!!t.closest(Bm)}function Hm(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||Vm(e.target)}function Um(e){let t=(e??``).trim().toLowerCase().replace(/[\s_]+/g,`-`);return t?{0:`controls`,1:`dashboard`,2:`controls`,3:`controls`,4:`controls`,5:`settings`,6:`controls`,7:`controls`,8:`controls`,9:`events`,app:`settings`,automate:`workbench`,automation:`workbench`,automations:`workbench`,board:`workbench`,catalog:`data`,console:`workbench`,control:`controls`,controls:`controls`,dashboard:`dashboard`,event:`events`,events:`events`,data:`data`,"data-hub":`data`,datahub:`data`,device:`device`,devices:`device`,export:`data`,firmware:`updates`,flash:`updates`,history:`events`,home:`dashboard`,"local-device":`device`,live:`dashboard`,i2c:`workbench`,macros:`workbench`,menus:`workbench`,output:`controls`,outputs:`controls`,records:`data`,recovery:`updates`,program:`updates`,programming:`updates`,peripherals:`workbench`,rf:`workbench`,settings:`settings`,timeline:`events`,terminal:`workbench`,workbench:`workbench`,update:`updates`,updates:`updates`}[t]??null:null}function Wm(e,t=Date.now(),n=1e4){let r=Date.parse(e??``);return Number.isFinite(r)&&r<=t+1e3&&t-r<=n}function Gm(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||e.repeat)return null;let t=Number(e.key)-1;return Number.isInteger(t)&&t>=0&&tXm[e][t]??Xm.en[t]}function Qm(e,t,n=1){return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en-US`,{minimumFractionDigits:n,maximumFractionDigits:n}).format(Number.isFinite(t)?t:0)}function $m(e,t){return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en-US`,{notation:`compact`,maximumFractionDigits:1}).format(t)}function eh(e,t){return(e===`fa`?Jm:Ym).format(t)}function th(e,t){if(!Number.isFinite(t)||t<0)return`—`;let n=Math.floor(t/1e3),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60),o=n%60,s=(r>0?[`${r}d`,`${i}h`,`${a}m`,`${o}s`]:i>0?[`${i}h`,`${a}m`,`${o}s`]:a>0?[`${a}m`,`${o}s`]:[`${o}s`]).join(` `);return e===`fa`?s.replace(/\d+/g,t=>eh(e,Number(t))).replace(`d`,`ر`).replace(`h`,`س`).replace(`m`,`د`).replace(`s`,`ث`):s}function nh(e,t,n,r=Date.now()){if(t===void 0)return e===`fa`?`در انتظار دستگاه`:`Waiting for device`;let i=t instanceof Date?t.getTime():typeof t==`number`?t:Date.parse(t);if(!Number.isFinite(i))return e===`fa`?`در انتظار دستگاه`:`Waiting for device`;let a=Math.max(0,r-i);if(a0&&!/[\s'"\\]/.test(e)?e:`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function ah(e){let t=e.match(/^(\s*os\s+power\s+\S+)(\s+[\s\S]+)$/i);return t?`${t[1].trim()} [REDACTED]`:e}function oh(e,t,n,r,i,a,o=e.output_persistence,s=e.relay_restore_mask){let c=e.extended_flags&1?1:0,l=e=>e===0?2:e-1,u=e.extended_flags>>1&7,d=l(e.extended_flags>>4&3),f=l(e.extended_flags>>6&3);return[`settings`,`set`,e.flags,e.light_mode,e.on_brightness,e.off_brightness,t,n,r,o,i,e.default_page,c,u,d,f,a,s].join(` `)}function sh(e){return e.reset_lines_available===!0}function ch(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function lh(e,t){let n=Math.max(0,t)/1e3;return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en`,{maximumFractionDigits:+(n<10)}).format(n)+(e===`fa`?` ثانیه`:`s`)}function uh(e){return e.connection_phase?e.connection_phase:e.connected?`connected`:e.paused?`paused`:e.connection_state===`reconnecting`||e.connection_state===`connecting`?`queued`:`disconnected`}function dh(e,t,n=Date.now()){let r=(e,n)=>t===`fa`?n:e,i=uh(e),a=e.connection_candidate,o=a?.friendly_name||a?.product||a?.name||e.port.friendly_name||e.port.product||e.port.name||``,s=e.connection_attempt??0,c=s>0?r(`Attempt ${s}`,`تلاش ${new Intl.NumberFormat(`fa-IR`).format(s)}`):``,l=ch(e.connection_attempt_started),u=ch(e.connection_next_retry),d=e.connection_reason?.trim()||``;return i===`connected`?{phase:i,title:r(`Board connected`,`برد متصل است`),detail:o,candidate:o,timing:``,attempt:``,action:r(`Reconnect`,`اتصال دوباره`),retryDisabled:!1,tone:`good`,animated:!1}:i===`attempting`?{phase:i,title:r(`Contacting controller board`,`در حال تماس با برد کنترلر`),detail:o?r(`Authenticating the application protocol on ${o}.`,`در حال احراز پروتکل برنامه روی ${o}.`):r(`Discovering a compatible controller and authenticating its application protocol.`,`در حال یافتن کنترلر سازگار و احراز پروتکل برنامهٔ آن.`),candidate:o,timing:l===void 0?``:r(`Elapsed ${lh(t,n-l)}`,`گذشته ${lh(t,n-l)}`),attempt:c,action:r(`Attempt in progress`,`تلاش در حال انجام است`),retryDisabled:!0,tone:`info`,animated:!0}:i===`waiting_retry`?{phase:i,title:r(`Board did not answer`,`برد پاسخ نداد`),detail:d||r(`The serial device is present, but the application handshake did not complete.`,`دستگاه سریال حاضر است، اما دست‌دهی برنامه کامل نشد.`),candidate:o,timing:u===void 0?``:u>n?r(`Next automatic attempt in ${lh(t,u-n)}`,`تلاش خودکار بعدی تا ${lh(t,u-n)}`):r(`Next automatic attempt is due now`,`زمان تلاش خودکار بعدی رسیده است`),attempt:c,action:r(`Try now`,`اکنون تلاش کن`),retryDisabled:!1,tone:`warn`,animated:!1}:i===`queued`?{phase:i,title:r(`Reconnect queued`,`اتصال دوباره در صف است`),detail:d||r(`The host is preparing a bounded connection attempt.`,`میزبان در حال آماده‌سازی یک تلاش اتصال محدود است.`),candidate:o,timing:``,attempt:c,action:r(`Try now`,`اکنون تلاش کن`),retryDisabled:!1,tone:`info`,animated:!1}:i===`paused`?{phase:i,title:r(`Board connection is closed`,`اتصال برد بسته است`),detail:d||r(`Automatic reconnect is paused by the operator.`,`اتصال خودکار توسط کاربر متوقف شده است.`),candidate:o,timing:``,attempt:``,action:r(`Resume connection`,`ازسرگیری اتصال`),retryDisabled:!1,tone:`neutral`,animated:!1}:i===`blocked`?{phase:i,title:r(`Serial cleanup needs attention`,`پاک‌سازی درگاه سریال نیاز به بررسی دارد`),detail:d||r(`The previous serial handle could not be released safely.`,`درگاه سریال قبلی با اطمینان آزاد نشد.`),candidate:o,timing:``,attempt:c,action:r(`Retry cleanup`,`تلاش دوباره برای پاک‌سازی`),retryDisabled:!1,tone:`bad`,animated:!1}:{phase:i,title:r(`Controller board disconnected`,`برد کنترلر قطع است`),detail:d||r(`No authenticated controller application is connected.`,`هیچ برنامهٔ کنترلر احرازشده‌ای متصل نیست.`),candidate:o,timing:``,attempt:c,action:r(`Connect`,`اتصال`),retryDisabled:!1,tone:`bad`,animated:!1}}function fh(e,t){return e?.trim()||t.trim()}function ph(e,t){let n=e.trim().split(/\s+/).filter(Boolean);return n.length>1?n.slice(0,2).map(e=>e[0]).join(``).toUpperCase():Array.from(n[0]||t).slice(0,2).join(``).toUpperCase()}var mh={connected:{color:`#43a86f`,label:`Board connected`},connecting:{color:`#d19345`,label:`Controller reconnecting`},fault:{color:`#d96369`,label:`Controller alert`},offline:{color:`#77717f`,label:`Board offline`}};function hh(e){let t=e.connection_state.trim().toLowerCase(),n=(e.connection_reason??``).trim().toLowerCase();return(e.hardware_problems?.length??0)>0||e.have_status&&e.status.hot||/^(error|fault|failed|rejected)$/.test(t)||/authentication|permission|protocol mismatch|unsupported firmware/.test(n)?`fault`:e.connected?`connected`:t===`connecting`||t===`reconnecting`?`connecting`:`offline`}function gh(e){let t=mh[e],n=`${t.label}`;return`data:image/svg+xml,${encodeURIComponent(n)}`}function _h(e,t=document){let n=t.querySelector(`link[data-controller-state-icon]`);n||(n=t.createElement(`link`),n.rel=`icon`,n.type=`image/svg+xml`,n.sizes=`any`,n.dataset.controllerStateIcon=``,t.head.append(n)),n.dataset.state!==e&&(n.dataset.state=e,n.href=gh(e))}var vh=new Set([`telemetry`,`rx`,`tx`,`front_panel.segment`,`status_led.changed`,`buzzer.note`]);function yh(e){return e.stream?e.stream===`activity`:!vh.has(e.kind.trim().toLowerCase())}function bh(e){return e.filter(yh)}function xh(e,t,n=500){let r=bh(e);return yh(t)?[t,...r.filter(e=>e.id!==t.id)].slice(0,n):r.slice(0,n)}function Sh(e,t=``){let n=e.kind.trim().toLowerCase(),r=e.source?.trim().toLowerCase()??``,i=e.metadata?.source?.trim().toLowerCase()??``,a=r&&r!==`board`?r:i||r,o=e.text?.trim().toLowerCase()??``;if(/^(hello|status|telemetry|rx|tx)(?:[._-]|$)/.test(n)||/^(hello|status)\b/.test(o))return!1;if(/^peer-update\.(queued|artifact-verified|reconnecting|health-checking|completed|failed|outcome-uncertain)$/.test(n)||n===`hardware.problem`)return!0;if(n===`message`){let n=t.trim().toLowerCase();return(e.targets?.map(e=>e.trim().toLowerCase())??[]).some(e=>e===`all`||e===`*`||e===`webui`||e===`surface:webui`||e===`capability:messages`||!!(n&&e===n))}return/(^|[._-])(relay|output)([._-]|$)/.test(n)?a===`physical`||a===`rf`:/error|warning|fault|hot|door/.test(n)}function Ch(e){return typeof e==`string`?e.trim():``}function wh(){let e=typeof document>`u`?null:document.querySelector(`script[type="module"][src*="/assets/app-"]`),t=``;if(e?.src)try{t=new URL(e.src,document.baseURI).pathname}catch{}return{hostVersion:`0.0.0-development`,resourcePath:t}}function Th(e){return`${Ch(e.host_version)}|${Ch(e.web_resource_path)}`}function Eh(e,t=wh()){let n=Ch(e.host_version),r=Ch(e.web_resource_path),i=Ch(t.hostVersion),a=Ch(t.resourcePath);return!n||!r||!i||!a?!1:n!==i||r!==a}function Dh(e,t,n={}){let r=n.signal?.aborted===!0,i=!1,a=0,o=null,s,c=()=>{a+=1,s!==void 0&&clearTimeout(s),s=void 0,o&&=(clearTimeout(o.timeout),o.abort.abort(),null)},l=e=>!r&&i&&a===e,u=(r,i)=>{if(!l(r))return;let a=new AbortController,c={abort:a,timeout:setTimeout(()=>a.abort(Error(`Host resource identity check timed out`)),5e3)};o=c,e(a.signal).then(e=>{l(r)&&!a.signal.aborted&&t(e)}).catch(e=>{l(r)&&(i===0?s=setTimeout(()=>{s=void 0,u(r,1)},250):n.onError?.(e))}).finally(()=>{clearTimeout(c.timeout),o===c&&(o=null)})},d=()=>{r=!0,i=!1,c(),n.signal?.removeEventListener(`abort`,d)};return n.signal?.addEventListener(`abort`,d,{once:!0}),{state(e){r||(e===`open`?i||(i=!0,c(),u(a,0)):(i=!1,c()))},dispose:d}}var Oh=`background:#7656d6;border-radius:7px;color:#fff;font:600 12px/1.8 ui-sans-serif,system-ui,sans-serif;padding:2px 8px`,kh=`color:#9b7ce8;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,Ah=`color:#2f9e67;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,jh=`color:#d8793f;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,Mh=`color:inherit;font:inherit`;function Nh(e,t,n=96){let r=String(e??``).normalize(`NFKC`).replace(/[\u0000-\u001f\u007f-\u009f]/g,` `).replace(/\s+/g,` `).trim();return r?r.slice(0,n):t}function Ph(e){switch(e){case`open`:return`Host event stream connected`;case`connecting`:return`Host event stream connecting`;case`waiting`:return`Host event stream waiting to reconnect`;case`closed`:return`Host event stream closed`}}function Fh(e,t=console){let n=Nh(e.productTitle,`Controller`),r=e.demonstration?`demonstration`:Nh(e.config?.host_version,`not reported`),i=e.boardConnected?Nh(e.port,`authenticated port`):``;t.groupCollapsed(`%c%s%c · browser control center`,Oh,n,Mh),t.info(`%cHost%c version %s · living API`,kh,Mh,r),e.boardConnected?t.info(`%cController%c connected · %s`,Ah,Mh,i):t.info(`%cController%c offline · no authenticated board`,jh,Mh),t.debug(`%cTransport%c %s`,kh,Mh,Ph(e.streamState)),t.groupEnd()}var Ih=`pccontroller.tab-sync`,Lh=`pccontroller://local`,Rh=3e4,zh=3e5,Bh=32768,Vh=8192,Hh=4096,Uh=32,Wh=512,Gh=0,Kh=/(?:authorization|cookie|password|passwd|secret|session(?:[_-]?id)?|(?:access|refresh)?[_-]?token|api[_-]?key)/i,qh=[/\b(?:authorization|access[_-]?token|refresh[_-]?token|api[_-]?key|password|passwd|secret|session[_-]?id)\s*[:=]\s*\S+/i,/\b(?:bearer|basic)\s+[a-z0-9._~+/=-]{8,}/i,/\beyJ[a-z0-9_-]{8,}\.[a-z0-9_-]{8,}\.[a-z0-9_-]{8,}\b/i,/-----BEGIN [A-Z ]*PRIVATE KEY-----/i],Jh=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\u202a-\u202e\u2066-\u2069\ufeff]/g,Yh=/^[a-z0-9._:-]{1,180}$/i,Xh=/^[a-z0-9._/-]{1,96}$/i;function Zh(){try{let e=globalThis.location?.origin;if(e&&e!==`null`)return e}catch{}return Lh}function Qh(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=Math.random().toString(36).slice(2);return`${Date.now().toString(36)}-${t}-${(++Gh).toString(36)}`}function $h(e){let t=e.trim();if(!t||t.length>256||Jh.test(t))throw Jh.lastIndex=0,TypeError(`tab channel origin is invalid`);if(Jh.lastIndex=0,t.toLowerCase()===Lh)return Lh;try{let e=new URL(t);if(e.username||e.password||e.origin===`null`)throw TypeError(`tab channel origin cannot contain credentials`);return e.origin.toLowerCase()}catch(e){throw e instanceof TypeError&&e.message.includes(`credentials`)?e:TypeError(`tab channel origin is invalid`)}}function eg(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function tg(e,t,n){let r=e.trim();return r.length<=n&&Yh.test(r)?r:t}function ng(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rg(e){return new TextEncoder().encode(e).byteLength}function ig(e){return qh.some(t=>t.test(e))}function ag(e){let t=[e],n=new Set;for(;t.length>0;){let e=t.pop();if(typeof e==`string`){if(ig(e))return!0}else if(typeof e==`object`&&e){if(n.has(e))return!0;if(n.add(e),Array.isArray(e))t.push(...e);else for(let[n,r]of Object.entries(e)){if(Kh.test(n))return!0;t.push(r)}}}return!1}function og(e,t,n=!1){if(typeof e!=`string`||rg(e)>t)return null;let r=e.replace(Jh,``);return ig(r)||!n&&r.length===0?null:r}function sg(e,t){if(e!==void 0)return og(e,t,!0)}function cg(e,t,n){if(e!==void 0)return typeof e!=`number`||!Number.isSafeInteger(e)||en?null:e}function lg(e){return e.state!==`active`&&e.state!==`hidden`&&e.state!==`leaving`||e.page!==void 0&&(typeof e.page!=`string`||!Xh.test(e.page))?null:{type:`presence`,state:e.state,...e.page===void 0?{}:{page:e.page}}}function ug(e){if(!ng(e.appearance)||e.etag!==void 0&&(typeof e.etag!=`string`||!/^[a-f0-9]{64}$/.test(e.etag)))return null;let t=e.appearance,n={};if(t.theme!==void 0){if(t.theme!==`system`&&t.theme!==`light`&&t.theme!==`dark`)return null;n.theme=t.theme}if(t.locale!==void 0){if(t.locale!==`en`&&t.locale!==`fa`)return null;n.locale=t.locale}if(t.direction!==void 0){if(t.direction!==`auto`&&t.direction!==`ltr`&&t.direction!==`rtl`)return null;n.direction=t.direction}for(let e of[`reduceMotion`,`compactNumbers`,`audioMuted`])if(t[e]!==void 0){if(typeof t[e]!=`boolean`)return null;n[e]=t[e]}if(t.audioVolume!==void 0){if(typeof t.audioVolume!=`number`||!Number.isFinite(t.audioVolume)||t.audioVolume<0||t.audioVolume>1)return null;n.audioVolume=t.audioVolume}return Object.keys(n).length===0?null:{type:`appearance`,appearance:n,...e.etag===void 0?{}:{etag:e.etag}}}function dg(e){if(!ng(e.entry))return null;let t=e.entry;if(t.kind!==`command`&&t.kind!==`output`&&t.kind!==`error`&&t.kind!==`system`)return null;let n=og(t.text,Vh),r=cg(t.at,0,2**53-1);return n===null||r===null?null:{type:`terminal`,entry:{kind:t.kind,text:n,...r===void 0?{}:{at:r}}}}function fg(e){if(e===void 0)return;if(!ng(e)||Object.keys(e).length>Uh)return null;let t={};for(let[n,r]of Object.entries(e)){if(!n||n.length>64||Kh.test(n))return null;let e=og(r,1024,!0);if(e===null)return null;t[n]=e}return t}function pg(e){if(!ng(e.event))return null;let t=e.event,n=cg(t.id,0,2**53-1),r=og(t.time,80),i=og(t.kind,128),a=og(t.text,Hh,!0);if(n==null||r===null||i===null||a===null)return null;let o=[`state`,`lifecycle`,`reason`,`source`,`target`,`message_type`,`action`,`severity`,`correlation`,`delivery`,`gesture`],s={};for(let e of o){let n=sg(t[e],e===`reason`?1024:256);if(n===null)return null;n!==void 0&&(s[e]=n)}let c;if(t.targets!==void 0){if(!Array.isArray(t.targets)||t.targets.length>32)return null;c=[];for(let e of t.targets){let t=og(e,180);if(t===null)return null;c.push(t)}}let l=[`key`,`rf_id`,`rf_code`,`rf_bits`,`rf_protocol`],u={};for(let e of l){let n=e===`rf_code`?4294967295:2**53-1,r=cg(t[e],0,n);if(r===null)return null;r!==void 0&&(u[e]=r)}let d=fg(t.metadata);return d===null?null:{type:`controller-event`,event:{id:n,time:r,kind:i,text:a,...s,...u,...c===void 0?{}:{targets:c},...d===void 0?{}:{metadata:d}}}}function mg(e){if(!ng(e)||!hg(e)||ag(e)||typeof e.type!=`string`)return null;switch(e.type){case`presence`:return lg(e);case`appearance`:return ug(e);case`terminal`:return dg(e);case`controller-event`:return pg(e);default:return null}}function hg(e){try{return rg(JSON.stringify(e))<=Bh}catch{return!1}}function gg(e={}){let t=$h(e.origin??Zh()),n=e.now??Date.now,r=e.idFactory??(()=>Qh()),i=e.ttlMS??Rh;if(!Number.isSafeInteger(i)||i<1||i>zh)throw RangeError(`tab channel ttlMS must be 1..${zh}`);let a=typeof globalThis.BroadcastChannel==`function`?globalThis.BroadcastChannel:null,o=e.BroadcastChannel===void 0?a:e.BroadcastChannel,s=++Gh,c=`tab:${tg(r(`tab`),`fallback-${s.toString(36)}`,64)}:${s.toString(36)}`,l=`${Ih}:${eg(t)}`,u=new Set,d=new Map,f=0,p=!1,m=null,h=e=>{for(let[t,n]of d)n<=e&&d.delete(t);for(;d.size>Wh;){let e=d.keys().next().value;if(e===void 0)break;d.delete(e)}},g=e=>{if(!ng(e)||!hg(e)||ag(e)||e.protocol!==`pccontroller.tab-sync`||e.origin!==t||typeof e.messageId!=`string`||!Yh.test(e.messageId)||typeof e.tabId!=`string`||!Yh.test(e.tabId)||e.tabId===c||typeof e.sentAt!=`number`||!Number.isSafeInteger(e.sentAt)||e.sentAt<0||typeof e.expiresAt!=`number`||!Number.isSafeInteger(e.expiresAt)||e.expiresAt<=e.sentAt||e.expiresAt-e.sentAt>zh)return null;let r=n();if(e.expiresAt<=r||e.sentAt>r+zh||(h(r),d.has(e.messageId)))return null;let i=mg(e.payload);return i===null?null:(d.set(e.messageId,e.expiresAt),{protocol:Ih,origin:t,messageId:e.messageId,tabId:e.tabId,sentAt:e.sentAt,expiresAt:e.expiresAt,payload:i})},_=e=>{if(p)return;let t=g(e.data);if(t!==null)for(let e of[...u])try{e(t)}catch{}};if(o!==null)try{m=new o(l),m.addEventListener(`message`,_)}catch{m=null}let v=(e,a=i)=>{if(p||m===null||!Number.isSafeInteger(a)||a<1||a>zh)return null;let o=mg(e);if(o===null)return null;let s=n();if(!Number.isSafeInteger(s)||s<0||s>2**53-1-a)return null;f+=1;let l=tg(r(`message`),`message-${f.toString(36)}`,64),u=`${c}:${f.toString(36)}:${l}`,g={protocol:Ih,origin:t,messageId:u,tabId:c,sentAt:s,expiresAt:s+a,payload:o};if(!hg(g))return null;try{return m.postMessage(g),d.set(u,g.expiresAt),h(s),u}catch{return null}};return{channelName:l,origin:t,supported:m!==null,tabId:c,publish:v,publishPresence:(e,t)=>v({type:`presence`,state:e,...t===void 0?{}:{page:t}}),publishAppearance:(e,t)=>v({type:`appearance`,appearance:e,...t===void 0?{}:{etag:t}}),publishTerminal:e=>v({type:`terminal`,entry:e}),publishControllerEvent:e=>v({type:`controller-event`,event:e}),subscribe(e){if(p)return()=>void 0;u.add(e);let t=!0;return()=>{t&&(t=!1,u.delete(e))}},close(){p||(p=!0,u.clear(),d.clear(),m!==null&&(m.removeEventListener(`message`,_),m.close(),m=null))}}}function _g(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>!e.hidden&&/^(pwm\.\d+|relay\.\d+|seat\.[ab])$/.test(e.key)&&`${e.name} ${e.key} ${e.group??``} ${e.kind}`.toLocaleLowerCase().includes(n)):[]}function vg(e,t,n){let r=(e??``).trim().toLowerCase();return r===``||r===`*`||r===t.trim().toLowerCase()||r===n.trim().toLowerCase()}var yg=`default`,bg={sync:`navigation_sync`,group:`navigation_group`,epoch:`navigation_epoch`,revision:`navigation_revision`,source:`navigation_source`,catchUp:`navigation_catch_up`,operation:`navigation_operation_id`,targetEpoch:`navigation_target_epoch`,targetRevision:`navigation_target_revision`},xg=/^[A-Za-z0-9._-]{1,64}$/,Sg=/^[A-Za-z0-9._:-]{1,180}$/,Cg=/^[a-f0-9]{32}$/;function wg(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function Tg(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function Eg(e){if(!e||!/^\d{1,20}$/.test(e))return null;let t=Number(e);return Tg(t)?t:null}function Dg(e){return[`dashboard`,`controls`,`workbench`,`device`,`data`,`updates`,`events`,`settings`].includes(e)}var Og=class{epoch;group;reportSequence=0;operationSequence=0;coordinatorEpoch=``;coordinatorRevision=0;constructor(e=wg(),t=yg){let n=e.trim().toLowerCase(),r=t.trim().toLowerCase()||`default`;if(!Cg.test(n))throw TypeError(`navigation epoch is invalid`);if(!xg.test(r))throw TypeError(`navigation group is invalid`);this.epoch=n,this.group=r}nextValues(e,t=!1){return this.reportSequence+=1,{[bg.sync]:e?`follow`:`independent`,[bg.group]:this.group,[bg.epoch]:this.epoch,[bg.revision]:String(this.reportSequence),...e&&t?{[bg.catchUp]:`true`}:{}}}nextCommit(e,t){if(!Sg.test(e.trim()))throw TypeError(`navigation source is invalid`);return this.operationSequence+=1,{group:this.group,source:e.trim(),page:t,operation_id:`${this.epoch}-${this.operationSequence}`}}acceptAction(e,t){if(!e||e[bg.sync]?.toLowerCase()!==`group`||e[bg.group]?.toLowerCase()!==this.group||!Dg(t))return null;let n=e[bg.epoch]?.trim().toLowerCase()??``,r=Eg(e[bg.revision]),i=e[bg.source]?.trim()??``;if(!Cg.test(n)||r===null||!Sg.test(i))return null;let a=e[bg.targetEpoch]?.trim().toLowerCase()??``,o=e[bg.targetRevision];if(a||o){let e=Eg(o);if(a!==this.epoch||e===null||e=t&&e<=n}function Yg(e){let{status:t}=e,n=e.hello.capabilities??0,r=e.connected&&e.have_status,i=r&&!!(n&Ig)&&!!(t.ina219_available||t.flags&Mg),a=r&&!!(n&Lg)&&!!(t.temperature_led_available||t.flags&Pg),o=r&&!!(n&Lg)&&!!(t.temperature_bt_audio_available||t.flags&Fg),s=Jg(t.supply_mv,0,1e5)&&Jg(t.bus_mv,0,1e5)&&Jg(t.current_ma,-1e5,1e5)&&Jg(t.power_mw,-1e7,1e7),c=Jg(t.temperature_led_centi_c,-5500,12500),l=Jg(t.temperature_bt_audio_centi_c,-5500,12500);return{ina219:i&&s,pwm:r&&!!(n&Rg)&&!!(t.pwm_available||t.flags&Ng),temperatureLED:a&&c,temperatureBTAudio:o&&l,lcd:r&&!!(n&Hg)&&!!(e.front_panel?.lcd_available||e.front_panel?.lcd_address||t.lcd_address),bluetoothAudio:r&&!!(n&Kg),relays:r&&!!(n&zg),rf:r&&!!(n&Bg),segments:r&&!!(n&Vg),statusLED:r&&!!(n&Ug),settings:r&&!!(n&Wg),menus:r&&!!(n&Gg),buzzer:r&&!!(n&qg),invalidINA219:i&&!s,invalidTemperatureLED:a&&!c,invalidTemperatureBTAudio:o&&!l}}var Xg={request:e=>window.requestAnimationFrame(e),cancel:e=>window.cancelAnimationFrame(e)},Zg=class{deliver;clock;generation=0;pending=[];frame=null;disposed=!1;constructor(e,t=Xg){this.deliver=e,this.clock=t}adoptGeneration(e){return this.disposed||!Number.isSafeInteger(e)||e<=0||e{if(this.frame=null,this.disposed||n!==this.generation||this.pending.length===0)return;let e=this.pending;this.pending=[],this.deliver(e,n)}),!0}cancelPending(e){this.disposed||e!==this.generation||(this.pending=[],this.frame!==null&&(this.clock.cancel(this.frame),this.frame=null))}dispose(){this.disposed||(this.disposed=!0,this.pending=[],this.frame!==null&&(this.clock.cancel(this.frame),this.frame=null))}};function Qg(e,t=Date.now()){let n=e.status,r=Yg(e);return{at:t,...r.ina219?{supply:n.supply_mv/1e3,bus:n.bus_mv/1e3,current:n.current_ma,power:n.power_mw/1e3}:{},...r.temperatureLED?{ledTemp:n.temperature_led_centi_c/100}:{},...r.temperatureBTAudio?{btTemp:n.temperature_bt_audio_centi_c/100}:{}}}function $g(e){return e.connected?JSON.stringify([e.port.instance_id||``,e.port.serial_number||``,e.port.name||``,e.hello.board_kind??null,e.hello.name||``,e.hello.build_hash??null,e.hello.build_timestamp||``,e.hello.capabilities??null]):``}function e_(e,t,n,r=Date.now()){if(!n.connected||!n.have_status)return[];let i=Qg(n,r);return $g(t)===$g(n)?[...e.slice(-71),i]:[i]}function t_(e,t,n){let r=e,i=t,a=``,o=0;for(let e of n){if(e.error){a=e.error;continue}a=``;let t={...r,connected:!0,have_status:!0,status:e.status,status_updated:e.time};i=e_(i,r,t,new Date(e.time).getTime()),r=t,o+=1}return{snapshot:r,samples:i,detail:a,applied:o}}function n_(e,t){return e.epoch===t.epoch&&(e.instanceID?.trim()??``)===(t.instanceID?.trim()??``)}function r_(e,t){if(t.epoche.epoch?{epoch:t.epoch,...n?{instanceID:n}:{}}:n?{epoch:e.epoch,instanceID:n}:e}function i_(e,t){let n=e.host_instance_id?.trim()??``,r=t.instanceID?.trim()??``;return n===``||r===``||n===r}var a_=e=>{if(e===void 0||e.trim()===``)return null;let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255?t:null};function o_(e){if(e.kind.toLowerCase()!==`status_led.changed`)return null;let t=a_(e.metadata?.red),n=a_(e.metadata?.green),r=a_(e.metadata?.blue),i=a_(e.metadata?.brightness),a=a_(e.metadata?.effect),o=a_(e.metadata?.condition);return[t,n,r,i,a,o].some(e=>e===null)?null:{red:t,green:n,blue:r,brightness:i,effect:a,condition:o}}var s_=e=>{let t=Number(e.metadata?.revision);return Number.isSafeInteger(t)&&t>0?t:0};function c_(e=0,t=0,n=0,r=0){return e===0&&n===0?`unknown`:e===0?`newer`:n===0||ne?`newer`:t===0&&r===0?`unknown`:t===0?`newer`:r===0||r(e.status_led_epoch??0);return o===`older`||e.have_status_led&&(o===`equal`||!t.have_status_led&&!s)?{...r,host_instance_id:e.host_instance_id,status_led:e.status_led,have_status_led:!0,status_led_updated:e.status_led_updated,status_led_revision:e.status_led_revision,status_led_epoch:e.status_led_epoch}:e.have_status_led&&!t.have_status_led?{...r,status_led:e.status_led,have_status_led:!0,status_led_updated:e.status_led_updated}:r}function d_(e){if(e.kind.toLowerCase()!==`front_panel.segment`)return null;let t=e.metadata?.raw_segments?.trim(),n=a_(e.metadata?.brightness);return!t||!/^[0-9a-f]{8}$/i.test(t)||n===null?null:{raw_segments:[0,2,4,6].map(e=>Number.parseInt(t.slice(e,e+2),16)),brightness:n}}function f_(e){let t=e.kind.trim().toLowerCase();return t===`status_led.changed`||t===`front_panel.segment`}function p_(e,t,n={epoch:0}){let r=t.metadata?.connection_generation;if(r!==void 0&&Number(r)!==e.connection_generation)return e;if(o_(t))return l_(e,t,n);let i=d_(t);if(!i)return e;let a=e.front_panel??{schema:0,raw_segments:[0,0,0,0],brightness:0,blink:!1,segments_active:!1,category_selector:!1,lcd_address:0,lcd_available:!1,lcd_backlight:!1,lcd_line_1:``,lcd_line_2:``,pressed_keys:0,menu_page:0,program_mode:0,host_captured:!1,host_state:0,host_editable_value:0};return{...e,front_panel:{...a,...i,segments_active:!0},have_front_panel_segments:!0,front_panel_updated:t.time}}var m_=Object.freeze(Array.from({length:11},(e,t)=>t));function h_(e){return Number.isFinite(e)?Math.max(0,Math.min(4095,Math.round(e))):0}function g_(e,t){let n=h_(e)/4095;return t?.curve===`gamma`&&(n=y_(n,t.gamma)),Math.round(n*1e3)/10}function __(e,t){if(!Number.isFinite(e))return 0;let n=Math.max(0,Math.min(100,e))/100;t?.curve===`gamma`&&(n=v_(n,t.gamma));let r=h_(n*4095);return e>0&&r===0?1:r}function v_(e,t){let n=.04,r=(t-1)*n,i=(t*n/(1+r))**t;return e<=n?e*i/n:((e+r)/(1+r))**+t}function y_(e,t){let n=.04,r=(t-1)*n,i=(t*n/(1+r))**t;return e<=i?e*n/i:e**(1/t)*(1+r)-r}function b_(e){if(typeof e?.available!=`boolean`||!Number.isInteger(e?.selected_channel)||e.selected_channel<0||e.selected_channel>15||!Array.isArray(e?.values)||e.values.length!==16)throw Error(`Controller returned an invalid PWM snapshot`);let t=e.values.map(e=>{if(!Number.isInteger(e)||e<0||e>4095)throw Error(`Controller returned an out-of-range PWM value`);return e}),n=e.channels?.map(e=>({...e,config:{...e.config}}));return{...e,available:e.available,selected_channel:e.selected_channel,values:t,channels:n}}var x_=class{queued=[];active=!1;run(e){return new Promise((t,n)=>{this.queued.push(()=>{let r;try{r=e()}catch(e){n(e),this.advance();return}r.then(e=>{t(e),this.advance()},e=>{n(e),this.advance()})}),this.drain()})}drain(){if(this.active)return;let e=this.queued.shift();e&&(this.active=!0,e())}advance(){this.active=!1,this.drain()}},S_=class{intervalMS;options;timer=null;readAbort=null;generation=0;running=!1;constructor(e){this.options=e,this.intervalMS=Math.max(250,Math.min(3e4,Math.round(e.intervalMS??1500)))}start(){if(this.running)return;this.running=!0;let e=++this.generation;this.schedule(0,e)}stop(){this.running=!1,this.generation++,this.timer!==null&&clearTimeout(this.timer),this.timer=null,this.readAbort?.abort(),this.readAbort=null}schedule(e,t){this.running&&t===this.generation&&(this.timer=setTimeout(()=>{this.timer=null,this.tick(t)},e))}async tick(e){if(!this.running||e!==this.generation)return;if(!this.options.canRead()){this.schedule(this.intervalMS,e);return}let t=new AbortController;this.readAbort=t;try{let n=b_(await this.options.operations.run(()=>this.options.read(t.signal)));this.running&&e===this.generation&&this.options.onAuthoritative(n)}catch(t){this.running&&e===this.generation&&this.options.onError(t instanceof Error?t:Error(String(t)))}finally{this.readAbort===t&&(this.readAbort=null),this.options.eventDriven||this.schedule(this.intervalMS,e)}}},C_=class{delayMS;options;operations;desired=new Map;inFlight=new Set;timers=new Map;editing=new Set;revision=0;disposed=!1;constructor(e){this.options=e,this.operations=e.operations??new x_,this.delayMS=Math.max(0,Math.round(e.delayMS??140))}schedule(e,t,n=!1){if(this.disposed)return;if(!m_.includes(e)){this.options.onError(e,Error(`Generic PWM controls are limited to user channels 0..10`),!0);return}let r=h_(t);this.desired.set(e,{value:r,revision:++this.revision}),this.options.onDraft(e,r);let i=this.timers.get(e);i&&clearTimeout(i),this.timers.delete(e),this.notifyPending(),n?this.flush(e):this.timers.set(e,setTimeout(()=>{this.timers.delete(e),this.flush(e)},this.delayMS))}pendingChannels(){return[...new Set([...this.desired.keys(),...this.inFlight,...this.editing])].sort((e,t)=>e-t)}beginEdit(e){!this.disposed&&m_.includes(e)&&(this.editing.add(e),this.notifyPending())}isEditing(e){return this.editing.has(e)}endEdit(e){this.editing.delete(e);let t=this.timers.get(e);t&&clearTimeout(t),this.timers.delete(e),this.desired.has(e)&&this.flush(e),this.notifyPending()}dispose(){this.disposed=!0;for(let e of this.timers.values())clearTimeout(e);this.timers.clear(),this.desired.clear(),this.editing.clear()}async flush(e){if(this.disposed||this.inFlight.has(e))return;let t=this.desired.get(e);if(t){this.inFlight.add(e),this.notifyPending();try{let n=b_(await this.operations.run(()=>this.options.commit(e,t.value)));if(this.disposed)return;let r=this.desired.get(e)?.revision===t.revision;r&&this.desired.delete(e),this.options.onAuthoritative(n,r?e:null)}catch(n){if(this.disposed)return;let r=this.desired.get(e);r?.revision===t.revision&&this.desired.delete(e),this.options.onError(e,n instanceof Error?n:Error(String(n)),r?.revision===t.revision)}finally{this.inFlight.delete(e),!this.disposed&&this.desired.has(e)&&this.flush(e),this.notifyPending()}}}notifyPending(){this.disposed||this.options.onPending(this.pendingChannels())}};function w_(e,t,n){if(!e.connected||!n||n!==e.host_instance_id||t.host_instance_id!==n||t.connection_generation!==e.connection_generation||!Number.isSafeInteger(t.revision)||t.revision<=(e.pwm_revision??0)||!t.time||!Number.isFinite(Date.parse(t.time))||!Array.isArray(t.channels)||t.channels.length!==16||new Set(t.channels.map(e=>e.channel)).size!==16||t.channels.some(e=>!Number.isInteger(e.channel)||e.channel<0||e.channel>15||!Number.isInteger(e.raw_value)||e.raw_value<0||e.raw_value>4095||!Number.isFinite(e.logical_percent)||e.logical_percent<0||e.logical_percent>100))return e;try{let n=b_(t);return{...e,pwm_values:n,pwm_revision:t.revision,pwm_updated:t.time}}catch{return e}}function T_(e,t){return t.connected&&e.host_instance_id===t.host_instance_id&&e.connection_generation===t.connection_generation&&(e.pwm_revision??0)>(t.pwm_revision??0)?{...t,pwm_values:e.pwm_values,pwm_revision:e.pwm_revision,pwm_updated:e.pwm_updated}:t}var E_=3e8,D_=250,O_=8,k_=class{anchors=new Map;plan(e,t){if(!Number.isFinite(t)||!Number.isFinite(e.frequencyHz)||e.frequencyHz<0||!Number.isFinite(e.durationMS)||e.durationMS<0||e.durationMS>6e4||e.durationMS===0&&e.frequencyHz!==0)return null;let n=t+O_;if(e.deviceMicros!==void 0){if(!Number.isInteger(e.deviceMicros)||e.deviceMicros<0||e.deviceMicros>4294967295)return null;let r=e.deviceMicros>>>0,i=e.generation?.trim()??``,a=this.anchors.get(e.source);if(a){let e=r-a.deviceMicros>>>0,o=a.startMS+e/1e3,s=o>=t-D_&&o<=t+D_;a.generation===i&&e<=E_&&s&&(n=o)}this.anchors.set(e.source,{deviceMicros:r,startMS:n,generation:i})}let r=n+e.durationMS,i=Math.max(0,r-Math.max(n,t));return{delayMS:Math.max(0,n-t),durationMS:i,audible:e.frequencyHz>=20&&e.frequencyHz<=2e4&&i>=1,stop:e.frequencyHz===0}}};function A_(e,t){return!e&&!t?`both`:e?t?`none`:`host`:`board`}var j_=new Set([`cancelled`,`completed`,`failed`,`local-cancelled`,`local-completed`,`local-failed`]),M_=new Set([`saved`,`saved-truncated`,`discarded`,`failed`,`cleared`]);function N_(e,t,n){let r=Number(e.metadata?.[t]);return Number.isFinite(r)?r:n}function P_(e,t){return{id:N_(e,`macro_id`,t.id??0),name:e.metadata?.macro_name||t.name}}function F_(e){let t=e.kind.trim().toLowerCase();return t===`macro`||t.startsWith(`macro.`)}function I_(e,t,n=80){return F_(t)?[t,...e.filter(e=>e.id!==t.id)].slice(0,n):e.slice(0,n)}function L_(e){let t=e.kind.trim().toLowerCase();return t===`macro.library`||t===`macro.recording`||t===`macro.recovery`}function R_(e,t){if(!F_(t))return e;let n=t.kind.trim().toLowerCase(),r=(t.lifecycle||t.state||``).trim().toLowerCase(),i={...e,latest_event_id:Math.max(e.latest_event_id??0,t.id),playback:{...e.playback},recording:{...e.recording},library:e.library};if(n===`macro.recording.step`){let e=P_(t,i.recording);return i.recording={...i.recording,...e,active:!0,steps:N_(t,`step`,i.recording.steps),last_at_us:N_(t,`at_us`,i.recording.last_at_us??0),last_delta_us:N_(t,`delta_us`,i.recording.last_delta_us??0),last_opcode:N_(t,`opcode`,i.recording.last_opcode??0),last_source:N_(t,`source`,i.recording.last_source??0)},i}if(n===`macro.recording`){let e=!M_.has(r)&&!r.startsWith(`saved`)&&r!==`idle`;return i.recording={...i.recording,active:e,last_error:r===`failed`?t.reason||t.text:i.recording.last_error},i}if(n===`macro`||n===`macro.playback`||n===`macro.step`){let e=P_(t,i.playback),a=j_.has(r);i.playback={...i.playback,...e,category:t.metadata?.category??i.playback.category,color:t.metadata?.color??i.playback.color,running:n===`macro.step`||!a&&r!==`idle`,lifecycle:r||i.playback.lifecycle,step:N_(t,`step`,i.playback.step),step_count:N_(t,`steps`,i.playback.step_count),last_timing_delta_us:N_(t,`mcu_delta_us`,i.playback.last_timing_delta_us??0),maximum_timing_error_us:N_(t,`timing_error_us`,i.playback.maximum_timing_error_us),underruns:N_(t,`underruns`,i.playback.underruns??0),dispatch_errors:N_(t,`dispatch_errors`,i.playback.dispatch_errors??0),faithful:t.metadata?.faithful===void 0?i.playback.faithful:t.metadata.faithful===`true`,last_error:r===`failed`?t.reason||t.text:i.playback.last_error}}return i}var z_={connected:!1,paused:!1,port:{},hello:{},status:{uptime_ms:0,supply_mv:0,bus_mv:0,current_ma:0,power_mw:0,temperature_led_centi_c:0,temperature_bt_audio_centi_c:0,flags:0,ina219_available:!1,temperature_led_available:!1,temperature_bt_audio_available:!1,program_running:!1,host_offline:!1,hot:!1,raw_inputs:0,active_keys:0,active_relays:0,menu_page:0,program_mode:0,door_open:!1,bluetooth_audio_state:0,pwm_available:!1,pwm_channel:0,pwm_value:0,lcd_address:0,pwm_errors:0,framing_errors:0,crc_errors:0,reset_cause:0,reset_count:0},settings:{flags:0,light_mode:0,on_brightness:0,off_brightness:0,display_brightness:0,display_closed_brightness:0,motion_exit_hold_seconds:2,status_brightness:0,output_persistence:0,relay_restore_mask:0,stream_period_ms:200,default_page:0,extended_flags:0,motion_break_ms:1,persisted:!1},have_status:!1,have_settings:!1,emergency_stop:{active:!1,revision:0},hardware_problems:[],illumination:{available:!1,mode:0,on_brightness:0,off_brightness:0,door_open:!1,target_brightness:0,target_pwm:0,applied_brightness:0,applied_pwm:0,at_target:!1,persisted:!1},front_panel:{schema:0,raw_segments:[0,0,0,0],brightness:0,blink:!1,segments_active:!1,category_selector:!1,lcd_address:0,lcd_available:!1,lcd_backlight:!1,lcd_line_1:``,lcd_line_2:``,pressed_keys:0,menu_page:0,program_mode:0,host_captured:!1,host_state:0,host_editable_value:0},have_front_panel:!1,connection_state:`offline`},B_=/\b(?:http\s*)?401\b|unauthori[sz]ed|authentication (?:required|rejected|failed)|invalid (?:session )?token|token (?:is )?(?:missing|invalid|rejected|required|expired)/i;function V_(e){return e.streamState===`open`?!1:B_.test(`${e.streamDetail??``} ${e.connectionReason??``}`)?!0:e.hostRequiresAuthentication?!e.token.trim():!1}function H_(e,t){let n=t===`fa`,r=n?`خرابی سخت‌افزار کنترلر`:`Controller hardware failure`,i=n?`کابل داده، برق و درگاه USB کنترلر را بررسی کنید.`:`Check the controller data cable, power, and USB port.`;switch(e.code){case`usb_descriptor_failure`:r=n?`خرابی اتصال USB کنترلر`:`Controller USB connection failed`,i=n?`دریافت شناسهٔ دستگاه USB ناموفق بود. کابل داده، برق و درگاه USB کنترلر را بررسی کنید.`:`The USB device descriptor failed. Check the controller data cable, power, or try another USB port.`;break;case`device_cannot_start`:case`device_reported_problem`:r=n?`دستگاه USB کنترلر راه‌اندازی نشد`:`Controller USB device could not start`,i=n?`کنترلر را دوباره متصل کنید یا از کابل و درگاه USB دیگری استفاده کنید.`:`Reconnect the controller or use another data cable and USB port.`;break;case`device_disabled`:r=n?`دستگاه کنترلر غیرفعال است`:`Controller device is disabled`,i=n?`دستگاه را در «مدیریت دستگاه‌ها» فعال کنید و سپس دوباره متصل شوید.`:`Enable the device in Device Manager, then reconnect.`;break;case`device_driver_missing`:case`device_driver_failure`:r=n?`درایور USB کنترلر خراب است`:`Controller USB driver problem`,i=n?`درایور USB کنترلر را نصب یا تعمیر کنید و سپس دستگاه را دوباره متصل کنید.`:`Install or repair the controller USB driver, then reconnect the device.`;break;case`device_removal_pending`:r=n?`جداسازی کنترلر در انتظار است`:`Controller removal is pending`,i=n?`کنترلر را جدا کنید و دوباره وصل کنید.`:`Unplug the controller and reconnect it.`}let a=e.impact===`active_operation_outcome_unknown`?n?`ارتباط هنگام یک عملیات فعال قطع شد و نتیجهٔ آن نامشخص است. پیش از ادامه، وضعیت سخت‌افزار را بررسی کنید.`:`Communication was lost during an active operation and its outcome is unknown. Verify the hardware state before continuing.`:void 0;return{title:r,guidance:i,impact:a}}var U_=new Set([`app.page`,`app.title`,`app.progress`]);function W_(e,t,n=Date.now()){let r=e.metadata?.operation_id?.trim()??``,i=e.metadata?.operation_delivery_id?.trim()??``,a=e.metadata?.operation_expires_at?.trim()??``,o=e.kind.trim().toLowerCase();if(!r||!i||!a||!U_.has(o)||!vg(e.metadata?.target_instance,t,`webui`))return null;let s=Date.parse(a);return!Number.isFinite(s)||s<=n?null:{operationID:r,deliveryID:i,receiptKey:`${r}\u0000${i}`,kind:o,value:(o===`app.page`?e.metadata?.page:e.metadata?.value)?.trim()??``}}function G_(e){switch(e.kind){case`app.page`:{let t=Um(e.value);return t?{outcome:`applied`,page:t}:{outcome:`rejected`,reason:`unknown_page`}}case`app.title`:return e.value.toLowerCase()===`auto`?{outcome:`applied`,title:null}:!e.value||[...e.value].length>120||/[\u0000-\u001f\u007f]/u.test(e.value)?{outcome:`rejected`,reason:`invalid_title`}:{outcome:`applied`,title:e.value};case`app.progress`:{let t=q_(e.value);return t===void 0?{outcome:`rejected`,reason:`invalid_progress`}:{outcome:`applied`,progress:t}}}}function K_(e,t){return e.outcome===`applied`&&(`page`in e?t.replacePage(e.page):`title`in e?t.setTitle(e.title):t.setProgress(e.progress),!0)}function q_(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean);if(t.length===0||t.length>2)return;let n={0:`clear`,clear:`clear`,1:`normal`,normal:`normal`,2:`error`,error:`error`,3:`indeterminate`,indeterminate:`indeterminate`,4:`warning`,warning:`warning`}[t[0]];if(!n)return;if(n===`clear`)return t.length===1?null:void 0;if(n===`indeterminate`)return t.length===1?{state:n}:void 0;if(t.length!==2||!/^\d{1,3}$/u.test(t[1]))return;let r=Number(t[1]);if(!(!Number.isInteger(r)||r<0||r>100))return{state:n,percent:r}}var J_=class{maximum;values=new Map;constructor(e=256){this.maximum=e}get(e){return this.values.get(e)}remember(e,t){if(!this.values.has(e)&&this.values.size>=this.maximum){let e=this.values.keys().next().value;e&&this.values.delete(e)}this.values.set(e,t)}};function Y_(e,t,n,r=Date.now()){let i=W_(e,t,r);if(!i)return null;let a=n.get(i.receiptKey);if(a)return{action:i,acknowledgement:a,duplicate:!0};let o=G_(i),s={operation_id:i.operationID,delivery_id:i.deliveryID,instance_id:t,state:o.outcome,...o.outcome===`rejected`?{reason:o.reason}:{}};return n.remember(i.receiptKey,s),{action:i,effect:o,acknowledgement:s,duplicate:!1}}var X_=3,Z_=100;function Q_(e){return new Promise(t=>globalThis.setTimeout(t,e))}async function $_(e,t,n=Q_){let r;for(let i=1;i<=X_;i+=1)try{await t(e);return}catch(e){r=e,it===`fa`?n:e;if((0,E.useEffect)(()=>{e&&c(`appearance`)},[e]),(0,E.useEffect)(()=>{if(e)return u.current=document.activeElement,()=>{let e=u.current;u.current=null,window.requestAnimationFrame(()=>e?.focus())}},[e]),(0,E.useEffect)(()=>{if(!e)return;let t=window.requestAnimationFrame(()=>l.current?.querySelector(`button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex]:not([tabindex="-1"])`)?.focus()),n=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopImmediatePropagation(),o();return}if(e.key!==`Tab`||!l.current)return;let t=[...l.current.querySelectorAll(`button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex]:not([tabindex="-1"])`)];if(!t.length)return;let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,n,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener(`keydown`,n,!0)}},[o,e]),!e)return null;let f=(e,t)=>{a({...r,[e]:t})},p=e=>c(e);return(0,X.jsxs)(`div`,{className:`app-preferences-layer`,role:`presentation`,children:[(0,X.jsx)(`button`,{type:`button`,className:`app-preferences-backdrop`,"aria-label":d(`Close application preferences`,`بستن ترجیحات برنامه`),onClick:o}),(0,X.jsxs)(`section`,{ref:l,className:`app-preferences-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`app-preferences-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Xe,{size:19}),(0,X.jsx)(`strong`,{id:`app-preferences-title`,children:d(`Application preferences`,`ترجیحات برنامه`)})]}),(0,X.jsx)(lp,{compact:!0,"aria-label":d(`Close application preferences`,`بستن ترجیحات برنامه`),icon:ct,onClick:o,children:d(`Close`,`بستن`)})]}),(0,X.jsxs)(`div`,{className:`app-preferences-tabs`,role:`tablist`,"aria-label":d(`Preference category`,`دستهٔ ترجیحات`),children:[(0,X.jsxs)(`button`,{id:`app-preferences-tab-appearance`,type:`button`,role:`tab`,"aria-selected":s===`appearance`,"aria-controls":`app-preferences-panel-appearance`,tabIndex:s===`appearance`?0:-1,className:s===`appearance`?`is-active`:``,onClick:()=>p(`appearance`),children:[(0,X.jsx)(We,{size:16}),d(`Appearance`,`ظاهر`)]}),(0,X.jsxs)(`button`,{id:`app-preferences-tab-header`,type:`button`,role:`tab`,"aria-selected":s===`header`,"aria-controls":`app-preferences-panel-header`,tabIndex:s===`header`?0:-1,className:s===`header`?`is-active`:``,onClick:()=>p(`header`),children:[(0,X.jsx)(Xe,{size:16}),d(`Quick header`,`نوار سریع`)]})]}),s===`appearance`?(0,X.jsxs)(`div`,{id:`app-preferences-panel-appearance`,className:`app-preferences-content`,role:`tabpanel`,"aria-labelledby":`app-preferences-tab-appearance`,children:[(0,X.jsxs)(`div`,{className:`setting-group`,children:[(0,X.jsx)(`label`,{children:d(`Theme`,`پوسته`)}),(0,X.jsx)(vp,{value:n.theme,label:d(`Theme`,`پوسته`),options:[{value:`system`,label:d(`System`,`سیستم`),icon:We},{value:`dark`,label:d(`Dark`,`تیره`)},{value:`light`,label:d(`Light`,`روشن`)}],onChange:e=>i({...n,theme:e})})]}),(0,X.jsxs)(`label`,{className:`app-preferences-select`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(j,{size:16}),d(`Language`,`زبان`)]}),(0,X.jsxs)(`select`,{value:n.locale,onChange:e=>i({...n,locale:e.target.value}),children:[(0,X.jsx)(`option`,{value:`en`,children:`English`}),(0,X.jsx)(`option`,{value:`fa`,children:`فارسی`})]})]}),(0,X.jsxs)(`div`,{className:`setting-group`,children:[(0,X.jsx)(`label`,{children:d(`Direction`,`جهت`)}),(0,X.jsx)(vp,{value:n.direction,label:d(`Direction`,`جهت`),options:[{value:`auto`,label:d(`Auto`,`خودکار`)},{value:`ltr`,label:d(`Left to right`,`چپ به راست`)},{value:`rtl`,label:d(`Right to left`,`راست به چپ`)}],onChange:e=>i({...n,direction:e})})]}),(0,X.jsx)(gp,{checked:n.reduceMotion,onChange:e=>i({...n,reduceMotion:e}),label:d(`Reduce interface motion`,`کاهش حرکت رابط`),detail:d(`Applies to this browser and is synchronized by the host.`,`در همین مرورگر اعمال می‌شود و میزبان آن را همگام نگه می‌دارد.`)}),(0,X.jsx)(gp,{checked:n.compactNumbers,onChange:e=>i({...n,compactNumbers:e}),label:d(`Compact large numbers`,`فشرده‌سازی اعداد بزرگ`)}),(0,X.jsx)(gp,{checked:!n.audioMuted,onChange:e=>i({...n,audioMuted:!e}),label:(0,X.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,X.jsx)(nt,{size:16}),d(`Interaction audio`,`صدای تعامل`)]})}),!n.audioMuted&&(0,X.jsx)(_p,{label:(0,X.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,X.jsx)(Ce,{size:16}),d(`Interaction volume`,`بلندی صدای تعامل`)]}),value:Math.round(n.audioVolume*100),min:0,max:100,unit:`%`,onChange:e=>i({...n,audioVolume:e/100})})]}):(0,X.jsxs)(`div`,{id:`app-preferences-panel-header`,className:`app-preferences-content`,role:`tabpanel`,"aria-labelledby":`app-preferences-tab-header`,children:[(0,X.jsx)(`p`,{children:d(`Choose which optional controls appear in the quick header. The preferences button remains visible so every choice is reversible.`,`انتخاب کنید کدام کنترل‌های اختیاری در نوار سریع نمایش داده شوند. دکمهٔ ترجیحات همیشه دیده می‌شود تا همهٔ انتخاب‌ها برگشت‌پذیر باشند.`)}),(0,X.jsx)(gp,{checked:r.theme,onChange:e=>f(`theme`,e),label:d(`Theme switch`,`تغییر پوسته`)}),(0,X.jsx)(gp,{checked:r.language,onChange:e=>f(`language`,e),label:d(`Language switch`,`تغییر زبان`)}),(0,X.jsx)(gp,{checked:r.audio,onChange:e=>f(`audio`,e),label:d(`Interaction audio`,`صدای تعامل`)}),(0,X.jsx)(gp,{checked:r.hotkeys,onChange:e=>f(`hotkeys`,e),label:d(`Keyboard guide`,`راهنمای صفحه‌کلید`)}),(0,X.jsx)(gp,{checked:r.notifications,onChange:e=>f(`notifications`,e),label:d(`Event notifications`,`اعلان رویدادها`)})]}),(0,X.jsx)(`footer`,{children:d(`These preferences affect the host interface only. Controller settings remain on the Settings page.`,`این ترجیحات فقط روی رابط میزبان اثر می‌گذارند. تنظیمات کنترلر در صفحهٔ تنظیمات باقی می‌مانند.`)})]})]})}var tv=`pccontroller:state`;function nv(e){if(typeof window>`u`)return()=>void 0;let t=window.PCController;return Object.defineProperty(window,"PCController",{configurable:!0,value:Object.freeze(e)}),()=>{window.PCController===e&&(t===void 0?delete window.PCController:Object.defineProperty(window,"PCController",{configurable:!0,value:t}))}}function rv(e){typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(tv,{detail:Object.freeze({...e})}))}var iv=[`theme`,`language`,`audio`,`hotkeys`,`notifications`],av={theme:!0,language:!0,audio:!0,hotkeys:!0,notifications:!0},ov=`pccontroller.quick-header-controls`;function sv(e){let t=e&&typeof e==`object`?e:{};return Object.fromEntries(iv.map(e=>[e,typeof t[e]==`boolean`?t[e]:av[e]]))}function cv(){try{return sv(JSON.parse(window.localStorage.getItem(ov)??`null`))}catch{return{...av}}}function lv(e){try{window.localStorage.setItem(ov,JSON.stringify(sv(e)))}catch{}}function uv(e){switch(e.severity?.trim().toLowerCase()){case`success`:return`success`;case`warning`:return`warning`;case`error`:return`danger`;default:return`info`}}function dv(e,t,n){return e===`fa`?n:t}function fv(e,t){if(e.kind.trim().toLowerCase()!==`message`||!Number.isSafeInteger(e.id)||e.id<=0)return null;let n=e.action?.trim()||void 0,r=e.correlation?.trim()||void 0;return{tone:uv(e),title:e.metadata?.title?.trim()||e.message_type?.trim()||dv(t,`Message`,`پیام`),detail:e.text,messageEventID:e.id,correlation:r,action:n,actionLabel:n?e.metadata?.action_label?.trim()||dv(t,`Suggested action`,`عملیات پیشنهادی`):void 0,persistent:!!(n||r)}}function pv(e,t=`unknown`){if(!Number.isFinite(e)||e==null||e<0)return t;if(e===0)return`0 B`;let n=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],r=Math.min(n.length-1,Math.floor(Math.log(e)/Math.log(1024))),i=e/1024**r,a=r===0||i>=100?0:i>=10?1:2;return`${i.toFixed(a)} ${n[r]}`}function mv(e,t,n=`unknown`){return`${pv(e,n)} / ${pv(t,n)}`}var hv=new Set([`completed`,`failed`,`cancelled`,`downloaded`,`staged`,`outcome-uncertain`]);function gv(e,t){return{host:[`Host update`,`به‌روزرسانی میزبان`],firmware:[`Firmware update`,`به‌روزرسانی میان‌افزار`],eeprom:[`EEPROM update`,`به‌روزرسانی EEPROM`],"artifact-fetch":[`Artifact download`,`دریافت فایل`],"artifact-upload":[`Artifact upload`,`ارسال فایل`],"peer-artifact-upload":[`Incoming host update`,`دریافت به‌روزرسانی میزبان`],"device-capture":[`Board readback`,`بازخوانی برد`]}[e]?.[+(t===`fa`)]??e.replaceAll(`-`,` `)}function _v(e,t){let n=e.kind.trim().toLowerCase();if(!/^(update|peer-update)\./.test(n))return null;let r=e.metadata,i=r?.operation_id?.trim();if(!i)return null;let a=(r?.state||n.split(`.`).slice(1).join(`.`)).trim().toLowerCase(),o=(r?.kind||(n.startsWith(`peer-update.`)?`host`:`update`)).trim().toLowerCase(),s=(r?.stage||a).replaceAll(`-`,` `),c=Number(r?.progress_percent),l=r?.progress_known===`true`&&Number.isFinite(c),u=l?Math.max(0,Math.min(100,c)):void 0,d=Number(r?.bytes_done),f=Number(r?.bytes_total),p=Number.isFinite(d)&&d>=0?d:void 0,m=Number.isFinite(f)&&f>0?f:void 0,h=hv.has(a);return{tone:a===`failed`?`danger`:a===`cancelled`||a===`outcome-uncertain`?`warning`:h?`success`:`info`,title:`${gv(o,t)} · ${s}`,detail:e.text||r?.detail,persistent:!h,updateOperationID:i,progressKnown:l,progressPercent:u,bytesDone:p,bytesTotal:m,progressLabel:m===void 0?l?`${u}%`:t===`fa`?`در حال انتقال`:`Transfer in progress`:mv(p??0,m)}}var vv=`modulepreload`,yv=function(e){return`/`+e},bv={},xv=function(e){return e.pathname.endsWith(`.css`)},Sv=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Cv=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=yv(t,n);let r=s(t),i=xv(r);return Sv(bv,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:vv,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},wv=(0,E.lazy)(()=>Cv(async()=>{let{DashboardView:e}=await import(`./chunk-CQk5ARdV.js`);return{DashboardView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({DashboardView:e})=>({default:e}))),Tv=(0,E.lazy)(()=>Cv(async()=>{let{ControlsView:e}=await import(`./chunk-CQk5ARdV.js`);return{ControlsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({ControlsView:e})=>({default:e}))),Ev=(0,E.lazy)(()=>Cv(async()=>{let{LocalDeviceView:e}=await import(`./chunk-CQk5ARdV.js`);return{LocalDeviceView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({LocalDeviceView:e})=>({default:e}))),Dv=(0,E.lazy)(()=>Cv(async()=>{let{EventsView:e}=await import(`./chunk-CQk5ARdV.js`);return{EventsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({EventsView:e})=>({default:e}))),Ov=(0,E.lazy)(()=>Cv(async()=>{let{SettingsView:e}=await import(`./chunk-CQk5ARdV.js`);return{SettingsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({SettingsView:e})=>({default:e}))),kv=(0,E.lazy)(()=>Cv(async()=>{let{WorkbenchView:e}=await import(`./chunk-DzUGOX3N.js`);return{WorkbenchView:e}},__vite__mapDeps([8,1,2,3,4,9,10])).then(({WorkbenchView:e})=>({default:e}))),Av=(0,E.lazy)(()=>Cv(async()=>{let{DataWorkspaceView:e}=await import(`./chunk-ByLILXol.js`);return{DataWorkspaceView:e}},__vite__mapDeps([11,12,6,3,4,5])).then(({DataWorkspaceView:e})=>({default:e}))),jv=(0,E.lazy)(()=>Cv(async()=>{let{UpdatesView:e}=await import(`./chunk-BHa6AuNE.js`);return{UpdatesView:e}},__vite__mapDeps([13,12,1,7,6,9,4])).then(({UpdatesView:e})=>({default:e}))),Mv=[{id:`dashboard`,label:`dashboard`,icon:Oe,view:wv,group:`core`},{id:`controls`,label:`controls`,icon:Ce,view:Tv,group:`core`},{id:`workbench`,label:`workbench`,icon:ot,view:kv,group:`core`},{id:`device`,label:`device`,icon:Ae,view:Ev,group:`integrations`},{id:`data`,label:`data`,icon:pe,view:Av,group:`integrations`},{id:`updates`,label:`updates`,icon:Re,view:jv,group:`system`},{id:`events`,label:`events`,icon:ae,view:Dv,group:`system`},{id:`settings`,label:`settings`,icon:Je,view:Ov,group:`system`}];function Nv(e){return Mv.find(t=>t.id===e)?.view??wv}function Pv(e,t=!1){return t||e!==null&&!e.setup_complete}var Fv={theme:`system`,locale:`en`,direction:`auto`,reduceMotion:!1,compactNumbers:!1,audioMuted:!1,audioVolume:.42},Iv=`pccontroller.appearance`,Lv=`pccontroller.resource-reload`;function Rv(e){let t=Th(e);if(!Eh(e)){try{sessionStorage.removeItem(Lv)}catch{}return!1}try{if(sessionStorage.getItem(Lv)===t)return!1;sessionStorage.setItem(Lv,t)}catch{return!1}return window.location.reload(),!0}function zv(){try{return Bv(JSON.parse(localStorage.getItem(Iv)??`{}`))}catch{return Fv}}function Bv(e,t=Fv){return{theme:e.theme===`light`||e.theme===`dark`||e.theme===`system`?e.theme:t.theme,locale:e.locale===`fa`||e.locale===`en`?e.locale:t.locale,direction:e.direction===`ltr`||e.direction===`rtl`||e.direction===`auto`?e.direction:t.direction,reduceMotion:typeof e.reduceMotion==`boolean`?e.reduceMotion:t.reduceMotion,compactNumbers:typeof e.compactNumbers==`boolean`?e.compactNumbers:t.compactNumbers,audioMuted:typeof e.audioMuted==`boolean`?e.audioMuted:t.audioMuted,audioVolume:Number.isFinite(e.audioVolume)?Math.max(0,Math.min(1,Number(e.audioVolume))):t.audioVolume}}function Vv(e,t){return e.theme===t.theme&&e.locale===t.locale&&e.direction===t.direction&&e.reduceMotion===t.reduceMotion&&e.compactNumbers===t.compactNumbers&&e.audioMuted===t.audioMuted&&e.audioVolume===t.audioVolume}function Hv(e){let t=e.theme===`system`?matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:e.theme,n=e.direction===`auto`?e.locale===`fa`?`rtl`:`ltr`:e.direction;document.documentElement.dataset.theme=t,document.documentElement.lang=e.locale===`fa`?`fa-IR`:`en`,document.documentElement.dir=n,document.documentElement.classList.toggle(`reduce-motion`,e.reduceMotion),document.documentElement.classList.toggle(`compact-numbers`,e.compactNumbers),document.querySelector(`meta[data-runtime-theme]`)?.setAttribute(`content`,t===`dark`?`#0b0a0e`:`#f5f3f6`)}function Uv(e){let t=e.replace(/^#\/?/,``).split(/[/?#]/)[0];return Mv.some(e=>e.id===t)?t:`dashboard`}function Wv(e){return`#/${e}`}function Gv(e,t=location.pathname,n=location.search){return`${t}${n}${Wv(e)}`}function Kv(e,t){return e!==t}function qv(){return Uv(location.hash)}function Jv(e,t){return e.filter(e=>!!e.status).map(e=>Qg({...z_,connected:!0,have_status:!0,hello:t,status:e.status},e.time?new Date(e.time).getTime():Date.now())).filter(e=>Number.isFinite(e.at)).slice(-360)}function Yv(e,t){let n=e.trim().toLowerCase().replace(/\s+/g,` `),r=t===`fa`,i=(e,t,n)=>({title:e,body:t,confirmLabel:n});return/^(reset|boot|program|programmer|firmware|flash|upload|restore|query|write)(?: |$)/.test(n)?r?i(`ورود به مسیر بازیابی یا برنامه‌ریزی؟`,`این فرمان ممکن است درگاه سریال را آزاد کند، خطوط کنترل را تغییر دهد یا وارد مسیر محافظت‌شدهٔ برنامه‌ریزی شود. فرمان را یک‌بار دیگر بررسی کنید.`,`تأیید و ارسال`):i(`Enter a recovery or programming path?`,`This command may release the serial port, pulse control lines, or enter the guarded programming workflow. Review the exact command before dispatch.`,`Confirm and dispatch`):/^rf send(?: |$)/.test(n)?r?i(`فرمان رادیویی ارسال شود؟`,`این ارسال می‌تواند یک وسیلهٔ خارجی را فعال کند. کد، پروتکل و تعداد تکرار را پیش از ارسال کنترل کنید.`,`ارسال آگاهانه`):i(`Transmit the radio command?`,`This transmission can actuate an external device. Verify the code, protocol, and repeat count before dispatch.`,`Transmit explicitly`):/^(macro play|automation run|bridge call)(?: |$)/.test(n)?r?i(`اجرای گردش‌کار تأیید شود؟`,`تعریف انتخاب‌شده می‌تواند خروجی‌های برد، فرمان‌های میزبان یا یک میزبان راه‌دور را فعال کند. ابتدا نام و مقصد را بررسی کنید.`,`تأیید اجرا`):i(`Confirm workflow execution?`,`The selected definition can operate board outputs, host actions, or a remote peer. Verify its name and destination first.`,`Confirm run`):/^(os (power|sleep|suspend|hibernate|restart|shutdown|lock)|quit|exit)(?: |$)/.test(n)?r?i(`عملیات میزبان اجرا شود؟`,`این فرمان می‌تواند نشست یا رایانه را متوقف کند. سیاست و توکن تأیید میزبان همچنان در سمت سرویس اعمال می‌شود.`,`تأیید عملیات`):i(`Run the host operation?`,`This command can end the session or affect the computer. Host-side policy and confirmation-token checks still apply.`,`Confirm operation`):null}function Xv(e,t,n=``){return{...e}}function Zv(e){return typeof e!=`number`||!Number.isFinite(e)?1e3:Math.min(5e3,Math.max(750,Math.round(e*4)))}function Qv(e,t,n,r){let i=(e,t)=>r===`fa`?t:e;if(t===`connecting`)return i(`Connecting`,`در حال اتصال`);if(t!==`open`)return i(`Reconnecting`,`در حال اتصال دوباره`);if(n===`loading`)return i(`Synchronizing`,`در حال همگام‌سازی`);if(e.connected)return i(`Board connected`,`برد متصل`);let a=e.connection_state.trim().toLowerCase();return a===`paused`?i(`Paused`,`متوقف`):[`connecting`,`discovering`,`scanning`,`searching`].includes(a)?i(`Searching`,`در حال جستجو`):i(`No board`,`بدون برد`)}function $v(e){return e.kind.toLowerCase()===`update.completed`&&e.metadata?.kind===`host`}function ey(e,t,n=Date.now()){let r=e.kind.toLowerCase();return t!==`updates`&&(r.startsWith(`update.`)||r.startsWith(`peer-update.`))&&Wm(e.time,n)}function ty(e,t,n=!0,r=!1){return r||!n||e===null||e===t?null:t?`connect`:`disconnect`}function ny(e,t=!1){return!t&&(e===`waiting`||e===`closed`)}function ry(){let[e,t]=(0,E.useState)(zv),[n,r]=(0,E.useState)(qv),[i,a]=(0,E.useState)(!0),[o,s]=(0,E.useState)(!1),[c,l]=(0,E.useState)(z_),[u,d]=(0,E.useState)(()=>[]),[f,p]=(0,E.useState)(()=>[]),[m,h]=(0,E.useState)([]),[g,_]=(0,E.useState)(`idle`),[v,y]=(0,E.useState)(null),[b,x]=(0,E.useState)(`connecting`),[S,C]=(0,E.useState)(``),[ee,w]=(0,E.useState)(0),[te,T]=(0,E.useState)([]),[ne,D]=(0,E.useState)({open:!1,title:``,body:``,confirmLabel:``}),[re,O]=(0,E.useState)(!1),[ie,ae]=(0,E.useState)(!1),[oe,se]=(0,E.useState)(``),[ce,ue]=(0,E.useState)(0),[fe,pe]=(0,E.useState)([]),[me,ge]=(0,E.useState)(),[_e,ve]=(0,E.useState)(!1),[be,k]=(0,E.useState)(!1),[A,Se]=(0,E.useState)(cv),[Ce,we]=(0,E.useState)(!1),[Ee,De]=(0,E.useState)({left:0,top:0}),[Oe,ke]=(0,E.useState)(!1),[Ae,je]=(0,E.useState)(!1),[Me,Ne]=(0,E.useState)(12),[Fe,Le]=(0,E.useState)(24),[Re,ze]=(0,E.useState)(!1),[Ve,Ue]=(0,E.useState)(ym),[We,Ge]=(0,E.useState)(!1),[qe,Je]=(0,E.useState)(0),[Ye,Ze]=(0,E.useState)(``),[$e,tt]=(0,E.useState)([]),[rt,at]=(0,E.useState)(Ag),[ot,st]=(0,E.useState)({state:`idle`,detail:``}),[lt]=(0,E.useState)(()=>new Og),[ut,dt]=(0,E.useState)(null),[ft,pt]=(0,E.useState)(null),[mt,ht]=(0,E.useState)([]),gt=(0,E.useRef)(0),_t=(0,E.useRef)(new Map),vt=(0,E.useRef)(0),M=(0,E.useRef)(null),yt=(0,E.useRef)(new k_),bt=(0,E.useRef)(null),xt=(0,E.useRef)(null),St=(0,E.useRef)(null),Ct=(0,E.useRef)(``),wt=(0,E.useRef)(e),Tt=(0,E.useRef)(Promise.resolve()),Et=(0,E.useRef)(!1),Dt=(0,E.useRef)(!1),N=(0,E.useRef)(n),Ot=(0,E.useRef)(null),kt=(0,E.useRef)(null),At=(0,E.useRef)(rt),jt=(0,E.useRef)(()=>void 0),Mt=(0,E.useRef)(()=>void 0),Nt=(0,E.useRef)(new Qf),Pt=(0,E.useRef)(``),Ft=(0,E.useRef)(c),It=(0,E.useRef)(0),Lt=(0,E.useRef)(``),Rt=(0,E.useRef)(new J_),P=(0,E.useMemo)(()=>Zm(e.locale),[e.locale]),zt=fh(v?.name,`PCController`),Bt=ph(zt,`PC`),Vt=v?.tagline?.trim()||`One host. Every board surface.`,Ht=e.direction===`auto`?e.locale===`fa`?`rtl`:`ltr`:e.direction,Ut=Ht===`rtl`?`18px`:`-18px`;At.current=rt;let Wt=(0,E.useCallback)(e=>{t(e);try{localStorage.setItem(Iv,JSON.stringify(e))}catch{}Hv(e),M.current?.setVolume(e.audioVolume),M.current?.setMuted(e.audioMuted)},[]),Gt=(0,E.useCallback)(e=>{let t=sv(e);Se(t),lv(t)},[]),Kt=(0,E.useCallback)((e,t)=>{let n=Bv(e);Ct.current=t,wt.current=n,Wt(n)},[Wt]),qt=(0,E.useCallback)(async()=>{let e=await Em();return y(e),St.current?.updateStatusInterval(e.status_interval_ms),Kt(e.appearance,e.appearance_etag),e},[Kt]),Jt=(0,E.useCallback)((e,t)=>{y(n=>n&&{...n,status_interval_ms:e,measurement_freshness_ms:t}),St.current?.updateStatusInterval(e)},[]);(0,E.useEffect)(()=>{let e=P(Mv.find(e=>e.id===n)?.label??`dashboard`);document.title=ut??`${zt} — ${e}`},[n,zt,ut,P]),(0,E.useEffect)(()=>{_h(hh(c))},[!1,c.connected,c.connection_reason,c.connection_state,c.have_status,c.status.hot]),(0,E.useEffect)(()=>{Re&&!Dt.current&&(Dt.current=!0,Fh({productTitle:zt,config:v,boardConnected:c.connected,port:c.port.name,streamState:b,demonstration:!1}))},[!1,zt,c.connected,c.port.name,Re,b,v]),(0,E.useEffect)(()=>{N.current=n},[n]);let F=(0,E.useCallback)((e,t)=>{let n=Ot.current?.getBoundingClientRect();De({left:e??(i?n?.left??10:(n?.right??84)+7),top:t??(n?.bottom??10)+7}),we(!0)},[i]);(0,E.useLayoutEffect)(()=>{if(!Ce||!kt.current)return;let e=kt.current.getBoundingClientRect();De(t=>({left:Math.max(10,Math.min(t.left,window.innerWidth-e.width-10)),top:Math.max(10,Math.min(t.top,window.innerHeight-e.height-10))}))},[Ce]),(0,E.useEffect)(()=>{if(!Ce)return;let e=e=>{let t=e.target;!Ot.current?.contains(t)&&!kt.current?.contains(t)&&we(!1)},t=e=>{e.key===`Escape`&&(we(!1),Ot.current?.focus())},n=()=>we(!1),r=window.requestAnimationFrame(()=>kt.current?.querySelector(`button`)?.focus());return window.addEventListener(`pointerdown`,e),window.addEventListener(`focusin`,e),window.addEventListener(`keydown`,t),window.addEventListener(`blur`,n),window.addEventListener(`hashchange`,n),()=>{window.cancelAnimationFrame(r),window.removeEventListener(`pointerdown`,e),window.removeEventListener(`focusin`,e),window.removeEventListener(`keydown`,t),window.removeEventListener(`blur`,n),window.removeEventListener(`hashchange`,n)}},[Ce]),(0,E.useEffect)(()=>{c.connected||we(!1)},[c.connected]),(0,E.useEffect)(()=>{let t=Xf({muted:e.audioMuted,volume:e.audioVolume,pauseWhenHidden:!0});M.current=t;let n=()=>{t.start()};return window.addEventListener(`pointerdown`,n,{capture:!0,once:!0}),window.addEventListener(`keydown`,n,{capture:!0,once:!0}),()=>{window.removeEventListener(`pointerdown`,n,{capture:!0}),window.removeEventListener(`keydown`,n,{capture:!0}),M.current===t&&(M.current=null),t.dispose()}},[]),(0,E.useEffect)(()=>{if(!Re)return;let e=bt.current;bt.current=c.connected;let t=ty(e,c.connected,Re,!1);t&&M.current?.cue(t)},[!1,c.connected,Re]),(0,E.useEffect)(()=>{let e=gg({origin:dm()}),t=new Map;xt.current=e,Ze(e.tabId),Ge(e.supported);let n=()=>{let e=Date.now()-4e4;for(let[n,r]of t)r{let r=e.payload;if(r.type===`presence`)r.state===`leaving`?t.delete(e.tabId):t.set(e.tabId,e.sentAt),n();else if(t.set(e.tabId,e.sentAt),n(),r.type===`appearance`&&(r.etag&&r.etag===Ct.current||qt().catch(()=>void 0)),r.type===`terminal`&&ht(t=>[...t.filter(t=>t.id!==e.messageId).slice(-119),{id:e.messageId,tabId:e.tabId,...r.entry}]),r.type===`controller-event`){let e=r.event;F_(e)&&h(t=>I_(t,e)),f_(e)&&l(t=>{let n=p_(t,e);return Ft.current=n,n}),p(t=>xh(t,e))}}),i=()=>e.publishPresence(document.hidden?`hidden`:`active`,N.current),a=()=>i();i(),document.addEventListener(`visibilitychange`,a);let o=window.setInterval(()=>{i(),n()},12e3);return()=>{document.removeEventListener(`visibilitychange`,a),window.clearInterval(o),e.publishPresence(`leaving`,N.current),r(),e.close(),xt.current===e&&(xt.current=null),Ze(t=>t===e.tabId?``:t)}},[qt]);let I=(0,E.useCallback)((t=document.hidden?`hidden`:`active`,n=!1)=>!Re||!Ye?Promise.resolve():jm(`controller.app.instance.report`,{id:Ye,surface:`webui`,page:N.current,state:t,lease_seconds:45,self:{kind:`browser`,vars:{origin:window.location.origin,platform:navigator.platform||`unknown`,language:navigator.language||`unknown`,user_agent:navigator.userAgent}},values:{color_mode:e.theme,locale:e.locale,direction:Ht,app_actions:`app.page,app.progress,app.title`,...lt.nextValues(rt,n)}}),[Ye,e.locale,e.theme,!1,lt,rt,Ht,Re]);jt.current=(e=!1)=>{e&&At.current&&st({state:`pending`,detail:``}),I(void 0,e).catch(t=>{e&&At.current&&st({state:`error`,detail:t instanceof Error?t.message:String(t)})})},(0,E.useEffect)(()=>{if(!Re||!Ye)return;let e=(e=document.hidden?`hidden`:`active`)=>{I(e).catch(()=>void 0)},t=()=>e();e(),document.addEventListener(`visibilitychange`,t);let n=window.setInterval(()=>e(),3e4);return()=>{document.removeEventListener(`visibilitychange`,t),window.clearInterval(n)}},[Ye,!1,I,Re,Ve]),(0,E.useEffect)(()=>()=>{Ye&&jm(`controller.app.instance.report`,{id:Ye,surface:`webui`,page:N.current,state:`leaving`,lease_seconds:45}).catch(()=>void 0)},[Ye]),(0,E.useEffect)(()=>{if(!Re)return;let e=!0,t=()=>jm(`controller.app.instances`).then(t=>{e&&tt(t)}).catch(()=>{e&&tt([])});t();let n=window.setInterval(t,3e4);return()=>{e=!1,window.clearInterval(n)}},[!1,Re,Ve]),(0,E.useEffect)(()=>{if(Me>=Fe)return;let e=window.setInterval(()=>{Ne(e=>{let t=Fe-e;return t<=0?e:t<.8?Fe:Math.min(Fe,e+Math.max(.75,t*.14))})},72);return()=>window.clearInterval(e)},[Me,Fe]);let Yt=(0,E.useCallback)(e=>{gt.current+=1;let t=gt.current;return T(n=>[...n.slice(-3),{id:t,...e}]),e.tone===`danger`&&M.current?.cue(`error`),e.tone===`warning`&&M.current?.cue(`warning`),e.tone===`success`&&M.current?.cue(`success`),e.persistent||window.setTimeout(()=>T(e=>e.filter(e=>e.id!==t)),5200),t},[]),Xt=(0,E.useCallback)((e,t,n)=>{Yt({tone:e,title:t,detail:n})},[Yt]),Zt=(0,E.useCallback)(e=>{let t=_v(e,wt.current.locale);if(!t?.updateOperationID)return!1;let n=t.updateOperationID,r=_t.current.get(n);r===void 0&&(gt.current+=1,r=gt.current,_t.current.set(n,r));let i={id:r,...t};return T(e=>{let t=e.findIndex(e=>e.updateOperationID===n);return t<0?[...e.slice(-3),i]:e.map((e,n)=>n===t?i:e)}),t.persistent||(_t.current.delete(n),window.setTimeout(()=>T(e=>e.filter(e=>e.id!==r)),5200)),!0},[]);(0,E.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.id||!t.state)return;let n={operation_id:t.id,kind:t.kind,state:t.state,stage:t.stage||t.state,detail:t.detail||``,progress_known:String(t.progress_known===!0),progress_percent:String(t.progress_percent??0),updated_at:t.updated_at||new Date().toISOString()};t.bytes_done!==void 0&&(n.bytes_done=String(t.bytes_done)),t.bytes_total!==void 0&&(n.bytes_total=String(t.bytes_total)),Zt({id:0,time:n.updated_at,kind:`update.${t.state}`,text:t.detail||``,metadata:n})};return window.addEventListener(`pccontroller:update-transfer-progress`,e),()=>window.removeEventListener(`pccontroller:update-transfer-progress`,e)},[Zt]),(0,E.useEffect)(()=>{let t=()=>{let t=M.current;Xt(`success`,e.locale===`fa`?`اعلان آزمایشی`:`Test notification`,e.locale===`fa`?`صدا، لرزش و اعلان آماده‌اند.`:`Audio, haptics, and notifications are ready.`),t&&t.start().then(e=>{e&&t.cue(`success`)})};return window.addEventListener(`pccontroller:test-feedback`,t),()=>window.removeEventListener(`pccontroller:test-feedback`,t)},[e.locale,Xt]);let Qt=(0,E.useCallback)(async()=>{try{let e={epoch:It.current,instanceID:Lt.current},t=await Dm();if(!n_(e,{epoch:It.current,instanceID:Lt.current})||!i_(t,e))return;let n=Ft.current,r=u_(n,t,{epoch:e.epoch,instanceID:t.host_instance_id,authoritativeInstanceID:e.instanceID});Ft.current=r,l(r),d(e=>e_(e,n,r))}catch(e){Xt(`warning`,`Snapshot unavailable`,e instanceof Error?e.message:String(e))}},[!1,Xt]);(0,E.useEffect)(()=>{let e=Nt.current.shouldRead(c,n===`settings`);if(b!==`open`||!c.connected||!c.have_status){Pt.current=``,_(`idle`);return}if(c.have_settings){_(`ready`);return}if(!e)return;_(`loading`);let t=Zf(c);Pt.current=t,Mm(`settings`).then(()=>Qt()).then(()=>{Pt.current===t&&_(`unavailable`)}).catch(()=>{Pt.current===t&&_(`unavailable`)})},[n,Qt,c.connected,c.have_status,c.have_settings,c.hello.build_hash,c.hello.build_timestamp,c.port.instance_id,c.port.name,c.port.serial_number,b]);let $t=(0,E.useCallback)(async(e,t,n=!1)=>{let r=ah(e);xt.current?.publishTerminal({kind:`command`,text:`pc› ${r}`,at:Date.now()});try{let i=(await Mm(e)).output??``;return xt.current?.publishTerminal({kind:`output`,text:i||`✓ accepted`,at:Date.now()}),Xt(`success`,t||`Command completed`,i||r),n&&Qt(),i}catch(e){let t=e instanceof Error?e.message:String(e);throw xt.current?.publishTerminal({kind:`error`,text:`! ${t}`,at:Date.now()}),Xt(`danger`,`Command failed`,t),e}},[!1,Xt,Qt]),en=(0,E.useCallback)((t,n,r=!1)=>{let i=Yv(t,e.locale);return i?new Promise((a,o)=>{let s=!1;D({open:!0,tone:`danger`,title:i.title,body:`${i.body}\n\n${ah(t)}`,confirmLabel:i.confirmLabel,cancel:()=>{s||(s=!0,a(e.locale===`fa`?`پیش از ارسال لغو شد.`:`Cancelled before dispatch.`))},action:async()=>{try{let e=await $t(t,n,r);s=!0,a(e)}catch(e){throw s=!0,o(e),e}}})}):$t(t,n,r)},[e.locale,!1,$t]),tn=(0,E.useCallback)(e=>{D({...e,open:!0})},[]),nn=(0,E.useCallback)((t,n=`push`)=>{let i=Kv(N.current,t),a=Wv(t);n===`push`&&(N.current!==t||location.hash!==a)?history.pushState({page:t},``,Gv(t)):n===`replace`&&(N.current!==t||location.hash!==a)&&history.replaceState({page:t},``,Gv(t)),N.current=t,r(t),s(!1),xt.current?.publishPresence(document.hidden?`hidden`:`active`,t),i&&jt.current(),i&&document.querySelector(`.app-main`)?.scrollTo({top:0,behavior:e.reduceMotion?`auto`:`smooth`})},[e.reduceMotion]),rn=(0,E.useCallback)((t,n=`push`)=>{if(nn(t,n),!rt||!Re||!Ye)return;st({state:`pending`,detail:``});let r;try{r=lt.nextCommit(Ye,t)}catch(e){st({state:`error`,detail:e instanceof Error?e.message:String(e)});return}jm(`controller.app.navigation.commit`,r).then(t=>{let n=lt.settle(t,r.operation_id);if(n)nn(n,`replace`),st({state:`idle`,detail:``});else throw Error(e.locale===`fa`?`پاسخ هماهنگ‌کننده با درخواست فعلی مطابقت ندارد.`:`The coordinator response did not match this request.`)}).catch(e=>{jt.current(!0),st({state:`error`,detail:e instanceof Error?e.message:String(e)})})},[Ye,e.locale,nn,!1,lt,rt,Re]),an=(0,E.useMemo)(()=>({title:zt,hostVersion:v?.host_version||``,page:n,hostOnline:b===`open`,boardConnected:c.connected,port:c.port.name||``,transport:b,eventCount:f.length}),[!1,f.length,n,zt,c.connected,c.port.name,b,v?.host_version]);(0,E.useEffect)(()=>nv({api:`PCController.browser`,inspect:()=>an,command:e=>{let t=e.trim();return t?en(t):Promise.reject(Error(`PCController.command requires a non-empty command`))},refresh:Qt,navigate:e=>{let t=Mv.find(t=>t.id===e)?.id;if(!t)throw Error(`Unknown PCController page: ${e}`);rn(t)}}),[an,rn,Qt,en]),(0,E.useEffect)(()=>{rv(an)},[an]),(0,E.useEffect)(()=>(Mt.current=e=>rn(e,`none`),()=>{Mt.current=()=>void 0}),[rn]);let on=(0,E.useCallback)(e=>{jg(e),lt.resetCoordinator(),st(e?{state:`pending`,detail:``}:{state:`idle`,detail:``}),at(e)},[lt]),sn=(0,E.useCallback)(t=>{let n=Bv(t,wt.current);wt.current=n,Wt(n);let r=M.current;!n.audioMuted&&r&&r.start({muted:!1}).then(e=>{e&&r.cue(`select`)}),Tt.current=Tt.current.then(async()=>{let e=await jm(`controller.ui.config.set`,{appearance:n,if_match:Ct.current});Ct.current=e.appearance_etag,y(t=>t&&{...t,appearance:e.appearance,appearance_etag:e.appearance_etag}),Vv(wt.current,n)&&Kt(e.appearance,e.appearance_etag),xt.current?.publishAppearance(e.appearance,e.appearance_etag)}).catch(async t=>{try{await qt()}catch{}Xt(`warning`,e.locale===`fa`?`تنظیم ظاهر ذخیره نشد`:`Appearance was not saved`,t instanceof Error?t.message:String(t))})},[Kt,e.locale,Wt,!1,Xt,qt]),cn=(0,E.useCallback)(t=>{let n={...e,audioMuted:!t};sn(n);let r=M.current;r?.setVolume(n.audioVolume),r&&r.start({muted:!t}).then(e=>{e&&t&&r.cue(`success`)}),v?.setup_complete?ke(!1):v?jm(`controller.ui.config.set`,{setup_complete:!0}).then(e=>{y(t=>t&&{...t,name:e.app_title,tagline:e.tagline,setup_complete:e.setup_complete,welcome_melody:e.welcome_melody})}).catch(e=>Xt(`warning`,`Setup state was not saved`,e instanceof Error?e.message:String(e))).finally(()=>ke(!1)):Xt(`warning`,`Setup state is unavailable`,`The current host configuration has not loaded yet.`)},[e,!1,Xt,sn,v?.setup_complete]),ln=(0,E.useCallback)(async e=>{let t=await jm(`controller.ui.config.set`,{app_title:e.trim()});return y(e=>e&&{...e,name:t.app_title,tagline:t.tagline,setup_complete:t.setup_complete,welcome_melody:t.welcome_melody}),Xt(`success`,`Application title saved`,t.app_title),t.app_title},[Xt]),un=(0,E.useCallback)(async e=>{await en(`buzzer path ${e}`,`Buzzer routing updated`),await qt()},[qt,en]),dn=(0,E.useCallback)(()=>{sn({...e,audioMuted:!e.audioMuted})},[e,sn]),fn=(0,E.useCallback)(e=>{bm(e),Ue(e.trim()),Xt(`success`,e.trim()?`Session token applied`:`Session token cleared`),window.setTimeout(()=>location.reload(),180)},[Xt]);(0,E.useEffect)(()=>{Hv(e);let t=matchMedia(`(prefers-color-scheme: light)`),n=()=>e.theme===`system`&&Hv(e);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),(0,E.useEffect)(()=>{let e=qv();location.hash!==Wv(e)&&history.replaceState(history.state,``,Gv(e));let t=()=>{let e=qv();Mt.current(e)};return window.addEventListener(`hashchange`,t),window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`hashchange`,t),window.removeEventListener(`popstate`,t)}},[]);let pn=Mv.filter(e=>P(e.label).toLowerCase().includes(oe.toLowerCase())),mn=_g(fe,oe),hn=f.find(e=>e.kind===`peripherals.changed`||e.kind===`config`)?.id;(0,E.useEffect)(()=>{if(!ie||!c.connected){c.connected||pe([]);return}let e=new AbortController;return jm(`controller.peripherals.get`,{},e.signal).then(t=>{e.signal.aborted||pe(t.controls)}).catch(t=>{e.signal.aborted||Xt(`warning`,`Channel search unavailable`,t instanceof Error?t.message:String(t))}),()=>e.abort()},[ie,c.connected,c.port.name,hn]);let gn=e=>{ge(t=>({key:e,revision:(t?.revision??0)+1})),rn(`controls`),ae(!1),se(``)};(0,E.useEffect)(()=>{let e=e=>{if(Oe||be)return;let t=e.isComposing||e.keyCode===229;if(ie){if(t)return;let n=[...pn.map(e=>()=>rn(e.id)),...mn.map(e=>()=>gn(e.key))];if(e.key===`Escape`){e.preventDefault(),ae(!1),se(``);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`){e.preventDefault(),ue(t=>!n.length||e.key===`Home`?0:e.key===`End`?n.length-1:(t+(e.key===`ArrowDown`?1:-1)+n.length)%n.length),M.current?.cue(`navigation`,e.key===`ArrowUp`?`up`:`down`);return}if(e.key===`Enter`&&n.length){e.preventDefault(),n[Math.min(ce,n.length-1)](),ae(!1),se(``),M.current?.cue(`select`);return}(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),ae(!1));return}if(_e){(e.key===`Escape`||e.key===`?`)&&(e.preventDefault(),ve(!1));return}if(ne.open)return;if(e.key===`Escape`&&o){e.preventDefault(),s(!1);return}if(Hm(e))return;if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()===`k`){e.preventDefault(),ue(0),ae(!0);return}if(!e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`?`){e.preventDefault(),ve(!0);return}if(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.key.toLowerCase()===`m`&&!e.repeat){e.preventDefault(),dn();return}let r=Gm(e),i=Km(e,n,document.documentElement.dir===`rtl`?`rtl`:`ltr`);if(r||i){e.preventDefault(),rn(r??i),M.current?.cue(`navigation`,e.key.includes(`Left`)?`left`:e.key.includes(`Right`)?`right`:`forward`);return}let a=!e.altKey&&!e.ctrlKey&&!e.metaKey;if(a&&performance.now()<=vt.current){vt.current=0;let t=qm(e.key);if(t){e.preventDefault(),rn(t),M.current?.cue(`navigation`,`forward`);return}}a&&!e.shiftKey&&e.key.toLowerCase()===`g`&&!e.repeat&&(e.preventDefault(),vt.current=performance.now()+1400,M.current?.cue(`focus`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[be,Oe,ne.open,_e,o,rn,n,ie,ce,oe,fe,P,dn]),(0,E.useEffect)(()=>{ue(0)},[oe]),(0,E.useEffect)(()=>{if(Oe)return;let e=null,t=e=>e instanceof Element?e.closest(`button:not(:disabled), a[href], [role="button"]:not([aria-disabled="true"])`):null,n=n=>{let r=t(n.target);r&&r!==e&&(e=r,M.current?.cue(`focus`))},r=t=>{e&&!e.contains(t.relatedTarget)&&(e=null)},i=e=>{t(e.target)&&M.current?.cue(`select`)};return document.addEventListener(`focusin`,n),document.addEventListener(`pointerover`,n),document.addEventListener(`pointerout`,r),document.addEventListener(`click`,i),()=>{document.removeEventListener(`focusin`,n),document.removeEventListener(`pointerover`,n),document.removeEventListener(`pointerout`,r),document.removeEventListener(`click`,i)}},[Oe]),(0,E.useEffect)(()=>{let e=new AbortController,t=Dh(Em,Rv,{signal:e.signal,onError:e=>C(`Host resource check: ${e instanceof Error?e.message:String(e)}`)}),n=Object.assign(()=>{},{updateStatusInterval:e=>void 0}),r=null;return(async()=>{try{Le(42);let i=await Em(e.signal);if(Rv(i))return;y(i),Kt(i.appearance,i.appearance_etag);let a=Pv(i);ke(a),je(!0),Le(70);let o=await Dm(e.signal);Ft.current=o,l(o),ze(!0),o.have_status&&d([Qg(o)]);let s=new Date(Date.now()-36e5).toISOString(),[c,u]=await Promise.allSettled([jm(`controller.history.status`,{since:s},e.signal),jm(`controller.history.timeline`,{since:s,limit:500},e.signal)]);if(c.status===`fulfilled`){let e=Jv(c.value,o.hello);d(t=>[...e,...t].slice(-360))}if(u.status===`fulfilled`&&(p(bh(u.value).slice(-500).reverse()),h(u.value.filter(F_).slice(-80).reverse())),Le(92),a&&o.connected&&i.welcome_melody?.trim())try{await Mm(`melody wait ${ih(i.welcome_melody.trim())}`,e.signal)}catch(e){C(`Welcome melody unavailable: ${e instanceof Error?e.message:String(e)}`)}r=new Zg(e=>{let t=Ft.current,n=t_(t,[],e);C(n.detail),n.applied!==0&&(Ft.current=n.snapshot,l(n.snapshot),d(n=>t_(t,n,e).samples))}),n=Fm(i,{pwm:(e,t)=>{let n=w_(Ft.current,e,t.instanceID);n!==Ft.current&&(Ft.current=n,l(n))},status:(e,t)=>{(e.host_instance_id===void 0||e.host_instance_id===Ft.current.host_instance_id)&&(e.connection_generation!==void 0&&e.connection_generation!==Ft.current.connection_generation?Qt():r?.enqueue(t.generation,e))},snapshot:(e,t)=>{let n=Ft.current,r=T_(n,u_(n,e,{epoch:t.generation,instanceID:e.host_instance_id,authoritativeInstanceID:t.instanceID}));Ft.current=r,l(r),d(e=>e_(e,n,r))},event:(e,t)=>{let n=r_({epoch:It.current,instanceID:Lt.current},{epoch:t.generation,instanceID:t.instanceID});if(!n)return;It.current=n.epoch,Lt.current=n.instanceID??``;let r=e.kind.toLowerCase();r===`app.instance.changed`&&jm(`controller.app.instances`).then(tt).catch(()=>void 0);let a=F_(e);if(a&&h(t=>I_(t,e)),f_(e)&&l(n=>{let r=p_(n,e,{epoch:t.generation,instanceID:t.instanceID});return Ft.current=r,r}),i.integrations?.buzzer_web_audio&&r===`buzzer.note`){let t=Number(e.metadata?.frequency_hz),n=Number(e.metadata?.duration_ms),r=e.metadata?.device_micros,i=r===void 0?void 0:Number(r),a=e.metadata?.[`bridge.ingress`]?`bridge:${e.metadata[`bridge.ingress`]}`:`local-board`,o=yt.current.plan({source:a,frequencyHz:t,durationMS:n,deviceMicros:i,generation:e.metadata?.connection_generation},performance.now());o?.stop?M.current?.stopTone(a,o.delayMS):o?.audible&&(M.current?.stopTone(a,o.delayMS),M.current?.playTone(t,o.durationMS,o.delayMS,a))}let o=yh(e);o&&p(t=>xh(t,e));let s=Y_(e,Ye,Rt.current);if(s){let{acknowledgement:e}=s;if(!s.duplicate){let{effect:e}=s;K_(e,{replacePage:e=>{nn(e,`replace`),M.current?.cue(`navigation`,`forward`)},setTitle:dt,setProgress:pt})}$_(e,e=>jm(`controller.app.action.ack`,e)).catch(e=>{let t=wt.current.locale;Xt(`warning`,t===`fa`?`تأیید فرمان ارسال نشد`:`Action not confirmed`,e instanceof Error?e.message:String(e))})}if((o||f_(e)||a)&&xt.current?.publishControllerEvent(e),!e.metadata?.operation_id&&e.kind.toLowerCase()===`app.page`&&Wm(e.time)&&vg(e.metadata?.target_instance,Ye,`webui`)){let t=Um(e.metadata?.page??e.metadata?.value??e.text);if(t){let n=e.metadata?.navigation_sync?.toLowerCase()===`group`,r=n?At.current?lt.acceptAction(e.metadata,t):null:t;r&&(nn(r,`replace`),n&&st({state:`idle`,detail:``}),M.current?.cue(`navigation`,`forward`))}}if(ey(e,N.current)&&(nn(`updates`,`replace`),M.current?.cue(`navigation`,`forward`)),!Zt(e)&&Sh(e,Ye)){let t=fv(e,wt.current.locale);t?Yt(t):Xt(iy(e),e.kind,e.text)}$v(e)&&(Et.current=!0),/config/i.test(e.kind)&&qt().catch(()=>void 0),/device|connection|settings|illumination|^macro/i.test(e.kind)&&Qt()},state:(e,n,i)=>{if(i?.generation){if(!r?.adoptGeneration(i.generation))return;let e=r_({epoch:It.current,instanceID:Lt.current},{epoch:i.generation,instanceID:i.instanceID});if(!e)return;It.current=e.epoch,Lt.current=e.instanceID??``}if(t.state(e),x(e),C(n??``),e===`open`){if(lt.resetCoordinator(),jt.current(!0),Et.current){Et.current=!1,window.location.reload();return}Qt()}else i?.generation&&r?.cancelPending(i.generation),l(t=>{let r=Xv(t,e,n);return Ft.current=r,r})}}),St.current=n,Le(100)}catch(e){ze(!0),ke(!1),je(!0),x(`waiting`),C(e instanceof Error?e.message:String(e)),l(t=>{let n=Xv(t,`waiting`,e instanceof Error?e.message:String(e));return Ft.current=n,n}),Le(100)}})(),()=>{e.abort(),t.dispose(),r?.dispose(),St.current===n&&(St.current=null),n()}},[Kt,Ye,nn,!1,Yt,rn,lt,Xt,Zt,Qt,qt,ee,Ve]),(0,E.useEffect)(()=>{if(!Re||b===`open`)return;let e=!0,t=async()=>{try{let t=await Dm();if(!e)return;let n=Ft.current;Ft.current=t,l(t),d(e=>e_(e,n,t))}catch{}};t();let n=window.setInterval(t,Zv(v?.status_interval_ms));return()=>{e=!1,window.clearInterval(n)}},[!1,Re,b,v?.status_interval_ms]);let _n=V_({hostRequiresAuthentication:v?.auth_required===!0,streamState:b,token:Ve,streamDetail:S,connectionReason:c.connection_reason}),vn=b===`open`&&c.connected&&c.have_status?`ready`:!Re||b===`connecting`?`loading`:`unavailable`,L={focusControl:me,reduceMotion:e.reduceMotion,appTitle:zt,snapshot:c,samples:u,events:f,macroEvents:m,locale:e.locale,t:P,command:en,refresh:Qt,openDialog:tn,boardSettingsReadState:g,transport:{streamState:b,authenticationRequired:_n,boardState:vn,tabBusSupported:We,tabPeers:qe,statusIntervalMS:v?.status_interval_ms,measurementFreshnessMS:v?.measurement_freshness_ms},relayedTerminal:mt,broadcastTerminal:e=>{xt.current?.publishTerminal(e)}},yn=Nv(n),bn=c.hardware_problems?.[0],xn=bn?H_(bn,e.locale):void 0,Sn=(0,X.jsx)(E.Suspense,{fallback:(0,X.jsxs)(`section`,{className:`page-loading`,role:`status`,"aria-live":`polite`,children:[(0,X.jsx)(`span`,{className:`spinner`}),e.locale===`fa`?`در حال بارگیری…`:`Loading page…`]}),children:n===`settings`?(0,X.jsx)(yn,{...L,appearance:e,onAppearance:sn,token:Ve,onToken:fn,onAppTitle:ln,uiConfig:v,onMeasurementTiming:Jt,onBuzzerPath:un,navigationSync:rt,navigationSyncStatus:ot,onNavigationSync:on,appInstances:$e}):(0,X.jsx)(yn,{...L})}),Cn=Mv.find(e=>e.id===n)??Mv[0],wn=()=>{re||(ne.cancel?.(),D(e=>({...e,open:!1})))},Tn=async()=>{if(!ne.action)D(e=>({...e,open:!1}));else{O(!0);try{await ne.action(),D(e=>({...e,open:!1}))}catch{}finally{O(!1)}}},En=c.connected&&b===`open`?`good`:b===`connecting`?`info`:b===`open`?`neutral`:`warn`,Dn=Qv(c,b,vn,e.locale),On=dh(c,e.locale),kn=sh(c),An=c.connected?[[`status`,`${c.port.name||(e.locale===`fa`?`کنترلر`:`Controller`)} · ${c.status_updated?rh(e.locale,c.status_updated):P(`online`)}`],[`relay off`,c.status.active_relays?e.locale===`fa`?`${c.status.active_relays.toString(2).replace(/0/g,``).length} خروجی فعال`:`${c.status.active_relays.toString(2).replace(/0/g,``).length} active outputs`:e.locale===`fa`?`همهٔ خروجی‌ها آزادند`:`All outputs released`],[`rf list`,e.locale===`fa`?`فهرست رادیویی کنترلر`:`Controller radio inventory`],[`macro list`,e.locale===`fa`?`فهرست ماکروهای کنترلر`:`Controller macro inventory`]]:[[`ports`,c.connection_reason||(e.locale===`fa`?`جستجوی درگاه‌های سریال موجود`:`Discover available serial ports`)],[`hotkeys status`,e.locale===`fa`?`سرویس میان‌برهای سراسری`:`Global shortcut service`],[`os status`,e.locale===`fa`?`وضعیت سیستم‌عامل میزبان`:`Host operating-system state`]],jn=e.locale===`fa`?`WS ${b===`open`?`باز`:b===`connecting`?`در حال اتصال`:b===`closed`?`بسته`:b} · ${eh(`fa`,qe+1)} زبانه`:`WS ${b} · ${qe+1} ${qe===0?`tab`:`tabs`}`,Mn=ny(b,!1);return(0,X.jsxs)(Md,{reducedMotion:e.reduceMotion?`always`:`user`,children:[(0,X.jsxs)(`div`,{className:`app-shell${i?``:` is-sidebar-compact`}${Ae?``:` is-bootstrap-pending`}`,inert:!Ae||Oe||_e||be?!0:void 0,"aria-hidden":!Ae||Oe||_e||be?!0:void 0,children:[ft&&(0,X.jsx)(`div`,{className:`app-action-progress app-action-progress--${ft.state}`,role:`progressbar`,"aria-label":e.locale===`fa`?`پیشرفت فرمان راه دور`:`Remote action progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ft.percent,children:(0,X.jsx)(`span`,{style:ft.percent===void 0?void 0:{width:`${ft.percent}%`}})}),(0,X.jsxs)(`aside`,{className:`sidebar`,"aria-label":P(`primaryNavigation`),children:[(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`a`,{className:`brand__mark`,href:`#/dashboard`,"aria-label":`${zt} ${P(`dashboardLink`)}`,children:(0,X.jsx)(op,{fallback:Bt})}),(0,X.jsxs)(`a`,{className:`brand__copy`,href:`#/dashboard`,children:[(0,X.jsx)(`strong`,{children:zt}),(0,X.jsx)(`span`,{children:Vt})]}),(0,X.jsx)(`button`,{className:`sidebar-toggle`,"aria-label":P(i?`collapseNavigation`:`expandNavigation`),title:P(i?`collapseNavigation`:`expandNavigation`),"aria-expanded":i,"aria-controls":`primary-navigation`,onClick:()=>a(e=>!e),children:i?(0,X.jsx)(Be,{size:18}):(0,X.jsx)(He,{size:18})})]}),(0,X.jsxs)(`button`,{ref:Ot,type:`button`,className:`sidebar__status`,"aria-haspopup":`menu`,"aria-expanded":Ce,"aria-disabled":!c.connected&&On.retryDisabled,"aria-label":c.connected?e.locale===`fa`?`منوی اتصال برد`:`Board connection menu`:e.locale===`fa`?`اتصال مجدد برد`:`Reconnect board`,title:`${c.connected?e.locale===`fa`?`برد آنلاین`:`Board online`:On.title} · ${On.candidate||c.connection_state}`,onClick:()=>{if(c.connected)Ce?we(!1):F();else{if(we(!1),On.retryDisabled)return;en(`reconnect`)}},onContextMenu:e=>{e.preventDefault(),F(e.clientX,e.clientY)},onKeyDown:e=>{(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),F())},children:[(0,X.jsx)(`span`,{className:`status-rail status-rail--${c.connected?`good`:On.tone}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:c.connected?e.locale===`fa`?`برد آنلاین`:`Board online`:On.title}),(0,X.jsx)(`small`,{children:c.connected?c.port.name:On.timing||On.candidate||c.connection_state})]}),(0,X.jsx)(xe,{size:18,"aria-hidden":`true`})]}),Ce&&typeof document<`u`&&(0,zf.createPortal)((0,X.jsxs)(`div`,{ref:kt,className:`sidebar__status-menu`,role:`menu`,"aria-label":e.locale===`fa`?`عملیات اتصال برد`:`Board connection actions`,style:Ee,children:[(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!c.connected&&On.retryDisabled,onClick:()=>{we(!1),en(`reconnect`)},children:c.connected?e.locale===`fa`?`اتصال مجدد`:`Reconnect`:On.action}),kn&&(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),en(`reset lines`)},children:e.locale===`fa`?`بازنشانی سخت‌افزاری (DTR)`:`Hardware reset (DTR)`}),c.connected&&(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),en(`close`)},children:e.locale===`fa`?`بستن درگاه`:`Close port`}),(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),se(`ports`),ue(0),ae(!0)},children:e.locale===`fa`?`انتخاب درگاه USB`:`Choose USB port`}),(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),rn(`device`)},children:e.locale===`fa`?`جزئیات دستگاه`:`Device details`})]}),document.body),(0,X.jsx)(`nav`,{className:`sidebar__nav`,id:`primary-navigation`,children:[`core`,`integrations`,`system`].map(e=>(0,X.jsxs)(`div`,{className:`nav-group`,children:[(0,X.jsx)(`span`,{className:`nav-group__label`,children:P(e===`core`?`system`:e===`integrations`?`integrations`:`operations`).toUpperCase()}),Mv.filter(t=>t.group===e).map(e=>(0,X.jsx)(Sp,{icon:e.icon,label:P(e.label),active:n===e.id,badge:e.id===`events`&&f.length?String(Math.min(f.length,99)):void 0,onClick:()=>rn(e.id)},e.id))]},e))}),(0,X.jsxs)(`div`,{className:`sidebar__footer`,children:[(0,X.jsx)(xe,{size:17}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:Dn}),(0,X.jsx)(`span`,{children:jn})]})]})]}),(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsx)(`button`,{className:`mobile-menu`,"aria-label":P(`openNavigation`),onClick:()=>s(!0),children:(0,X.jsx)(Pe,{size:20})}),(0,X.jsxs)(`div`,{className:`breadcrumbs`,children:[(0,X.jsx)(`span`,{children:Bt}),(0,X.jsx)(`i`,{children:`/`}),(0,X.jsx)(`strong`,{children:P(Cn.label)})]}),(0,X.jsxs)(`button`,{className:`command-trigger`,"aria-keyshortcuts":rp(),onClick:()=>{ue(0),ae(!0)},children:[(0,X.jsx)(Ke,{size:16}),(0,X.jsx)(`span`,{children:P(`searchCommands`)}),(0,X.jsx)(cp,{keys:[np(),`K`]})]}),(0,X.jsxs)(`div`,{className:`topbar__actions`,children:[!1,Mn?(0,X.jsx)(`button`,{className:`transport-reconnect`,title:S||void 0,"aria-label":e.locale===`fa`?`اتصال مجدد فوری میزبان`:`Reconnect host now`,onClick:()=>{Mn&&(C(``),x(`connecting`),w(e=>e+1))},children:(0,X.jsx)(pp,{tone:En,children:Dn})}):(0,X.jsx)(`span`,{title:S||void 0,children:(0,X.jsx)(pp,{tone:En,pulse:b===`connecting`,children:Dn})}),(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":e.locale===`fa`?`ترجیحات برنامه`:`Application preferences`,"aria-haspopup":`dialog`,"aria-expanded":be,onClick:()=>k(!0),children:(0,X.jsx)(Xe,{size:18})}),A.theme&&(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":P(`toggleTheme`),onClick:()=>sn({...e,theme:document.documentElement.dataset.theme===`dark`?`light`:`dark`}),children:document.documentElement.dataset.theme===`dark`?(0,X.jsx)(Qe,{size:18}):(0,X.jsx)(Ie,{size:18})}),A.language&&(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":P(`switchLanguage`),onClick:()=>sn({...e,locale:e.locale===`en`?`fa`:`en`}),children:(0,X.jsx)(j,{size:18})}),A.audio&&(0,X.jsx)(`button`,{className:`topbar-icon topbar-audio`,"aria-label":P(e.audioMuted?`enableAudio`:`muteAudio`),"aria-pressed":e.audioMuted,"aria-keyshortcuts":`M`,onClick:dn,children:e.audioMuted?(0,X.jsx)(it,{size:18}):(0,X.jsx)(nt,{size:18})}),A.hotkeys&&(0,X.jsx)(`button`,{className:`topbar-icon topbar-hotkeys`,"aria-label":P(`keyboardShortcuts`),"aria-keyshortcuts":`?`,onClick:()=>ve(!0),children:(0,X.jsx)(Te,{size:18})}),A.notifications&&(0,X.jsxs)(`button`,{className:`topbar-icon`,"aria-label":P(`notifications`),onClick:()=>rn(`events`),children:[(0,X.jsx)(le,{size:18}),f.length>0&&(0,X.jsx)(`i`,{})]})]})]}),(0,X.jsxs)(`main`,{className:`app-main`,children:[n!==`dashboard`&&bn&&xn&&(0,X.jsxs)(`section`,{className:`hardware-alert app-hardware-alert is-${bn.severity}`,role:`alert`,"aria-live":`assertive`,children:[(0,X.jsx)(`div`,{className:`hardware-alert__icon`,children:(0,X.jsx)(et,{size:24,"aria-hidden":`true`})}),(0,X.jsxs)(`div`,{className:`hardware-alert__copy`,children:[(0,X.jsx)(`strong`,{children:xn.title}),(0,X.jsx)(`p`,{children:xn.guidance}),xn.impact&&(0,X.jsx)(`p`,{className:`hardware-alert__impact`,children:xn.impact})]})]}),(0,X.jsx)(Tp,{pageKey:n,children:Sn})]}),(0,X.jsx)(`nav`,{className:`mobile-bottom-nav`,"aria-label":P(`mobileNavigation`),children:Mv.slice(0,5).map(e=>(0,X.jsxs)(`button`,{className:n===e.id?`is-active`:``,onClick:()=>rn(e.id),children:[(0,X.jsx)(ap,{icon:e.icon,size:20}),(0,X.jsx)(`span`,{children:P(e.label)})]},e.id))}),(0,X.jsx)(Td,{children:o&&(0,X.jsxs)(Vf.div,{className:`mobile-drawer-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`mobile-drawer-backdrop`,"aria-label":P(`dismissNavigation`),onClick:()=>s(!1)}),(0,X.jsxs)(Vf.aside,{className:`mobile-drawer`,initial:{x:Ut,opacity:0},animate:{x:0,opacity:1},exit:{x:Ut,opacity:0},transition:{duration:.32,ease:[.22,1,.36,1]},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`div`,{className:`brand__mark`,children:(0,X.jsx)(op,{fallback:Bt})}),(0,X.jsx)(`strong`,{children:zt}),(0,X.jsx)(`button`,{type:`button`,"aria-label":P(`closeNavigation`),onClick:()=>s(!1),children:(0,X.jsx)(ct,{size:19})})]}),Mv.map(e=>(0,X.jsx)(Sp,{icon:e.icon,label:P(e.label),active:n===e.id,onClick:()=>rn(e.id)},e.id))]})]})}),(0,X.jsx)(Td,{children:ie&&(0,X.jsxs)(Vf.div,{className:`palette-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`palette-backdrop`,"aria-label":P(`closeCommandPalette`),onClick:()=>{ae(!1),se(``)}}),(0,X.jsxs)(Vf.section,{className:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":P(`commandPalette`),initial:{opacity:0,scale:.985},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.99},transition:{duration:.2,ease:`easeOut`},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(ye,{size:19}),(0,X.jsx)(`input`,{autoFocus:!0,value:oe,placeholder:P(`commandPalettePlaceholder`),"aria-controls":`palette-results`,"aria-activedescendant":pn[ce]?`palette-page-${pn[ce].id}`:mn[ce-pn.length]?`palette-channel-${mn[ce-pn.length].key}`:void 0,onChange:e=>se(e.target.value)}),(0,X.jsx)(cp,{keys:[`Esc`]})]}),(0,X.jsxs)(`div`,{className:`palette__results`,id:`palette-results`,role:`listbox`,"aria-label":P(`matchingPages`),children:[(0,X.jsx)(`span`,{className:`palette__label`,children:P(`pagesLabel`).toUpperCase()}),pn.map((t,r)=>(0,X.jsxs)(`button`,{id:`palette-page-${t.id}`,role:`option`,"aria-selected":r===ce,className:r===ce?`is-highlighted`:``,onPointerMove:()=>ue(r),onClick:()=>{rn(t.id),ae(!1),se(``)},children:[(0,X.jsx)(ap,{icon:t.icon,size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:P(t.label)}),(0,X.jsx)(`small`,{children:n===t.id?e.locale===`fa`?`صفحه فعلی`:`Current page`:e.locale===`fa`?`باز کردن`:`Open`})]}),(0,X.jsx)(he,{className:n===t.id?`is-visible`:``,size:16})]},t.id)),(0,X.jsx)(`span`,{className:`palette__label`,children:P(`quickCommandsLabel`).toUpperCase()}),mn.map((e,t)=>(0,X.jsxs)(`button`,{id:`palette-channel-${e.key}`,role:`option`,"aria-selected":ce===pn.length+t,className:ce===pn.length+t?`is-highlighted`:``,onPointerMove:()=>ue(pn.length+t),onClick:()=>gn(e.key),children:[(0,X.jsx)(de,{size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`small`,{children:e.key})]})]},e.key)),An.filter(([e,t])=>`${e} ${t}`.toLowerCase().includes(oe.toLowerCase())).map(([e,t])=>(0,X.jsxs)(`button`,{role:`option`,"aria-selected":`false`,onClick:()=>{en(e),ae(!1)},children:[(0,X.jsx)(de,{size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{dir:`ltr`,children:e}),(0,X.jsx)(`small`,{children:t})]})]},e))]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(cp,{keys:[[`↑`,`↓`]]}),` `,P(`navigate`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(cp,{keys:[`Enter`]}),` `,P(`select`)]}),(0,X.jsxs)(`span`,{children:[pn.length+mn.length+An.filter(([e,t])=>`${e} ${t}`.toLowerCase().includes(oe.toLowerCase())).length,` `,P(`actions`),` · WS `,b]})]})]})]})}),(0,X.jsx)(Op,{state:{...ne,action:Tn},onClose:wn,busy:re}),(0,X.jsx)(kp,{messages:te,dismiss:e=>T(t=>t.filter(t=>t.id!==e))})]}),(0,X.jsx)(ev,{open:be,locale:e.locale,appearance:e,quickHeader:A,onAppearance:sn,onQuickHeader:Gt,onClose:()=>k(!1)}),(0,X.jsx)(Ep,{open:Ae&&Oe,progress:Me,locale:e.locale,productTitle:zt,productShortName:Bt,productTagline:Vt,onEnter:cn}),(0,X.jsx)(Dp,{open:_e,locale:e.locale,onClose:()=>ve(!1)})]})}function iy(e){let t=e.kind.toLowerCase();return/error|fault|hot/.test(t)?`danger`:/warning|door|disconnect/.test(t)?`warning`:/connect|ready|complete/.test(t)?`success`:`info`}var ay=class{suppressUntil=new WeakMap;begin(e,t,n,r=Date.now()){return t!==`touch`||!n?!1:(this.suppressUntil.set(e,r+800),!0)}shouldSuppressNativeClick(e,t,n=Date.now()){return t===0||n>(this.suppressUntil.get(e)??0)?!1:(this.suppressUntil.delete(e),!0)}};function oy(e){return e instanceof Element?e.closest(`button, [role="button"], [role="switch"], input[type="checkbox"]`)||(e.closest(`label`)?.querySelector(`input[type="checkbox"]`)??null):null}function sy(e){return!e.matches(`:disabled, [aria-disabled="true"]`)&&!e.closest(`[data-touch-mode="hold"], [data-touch-mode="deferred"]`)}function cy(e=document){let t=new ay,n=new WeakSet,r=e=>{let r=oy(e.target);if(r&&sy(r)&&t.begin(r,e.pointerType,e.isPrimary)){e.preventDefault();try{r.focus({preventScroll:!0})}catch{r.focus()}n.add(r),r.click(),n.delete(r)}},i=e=>{let r=oy(e.target);r&&!n.has(r)&&t.shouldSuppressNativeClick(r,e.detail)&&(e.preventDefault(),e.stopImmediatePropagation())};return e.addEventListener(`pointerdown`,r,!0),e.addEventListener(`click`,i,!0),()=>{e.removeEventListener(`pointerdown`,r,!0),e.removeEventListener(`click`,i,!0)}}var ly=document.getElementById(`root`);if(!ly)throw Error(`Controller UI root is missing`);(0,Bf.createRoot)(ly).render((0,X.jsx)(E.StrictMode,{children:(0,X.jsx)(ry,{})}));var uy=cy();window.addEventListener(`pagehide`,uy,{once:!0}),window.requestAnimationFrame(()=>document.getElementById(`startup-preloader`)?.remove()),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>void 0)},{once:!0});export{ap as $,Im as A,he as At,Lp as B,th as C,Oe as Ct,vm as D,A as Dt,eh as E,Ce as Et,Np as F,h as Ft,Ip as G,Pp as H,Fp as I,d as It,lp as J,zp as K,Up as L,o as Lt,jm as M,se as Mt,lm as N,ae as Nt,Rm as O,xe as Ot,Zp as P,O as Pt,up as Q,Rp as R,s as Rt,$m as S,Ae as St,Qm as T,Te as Tt,Xp as U,Hp as V,Yp as W,xp as X,dp as Y,bp as Z,sh as _,Xe as _t,R_ as a,vp as at,ih as b,Ie as bt,C_ as c,gp as ct,m_ as d,ut as dt,cp as et,b_ as f,ct as ft,dh as g,Qe as gt,Yg as h,et as ht,H_ as i,fp as it,Sm as j,de as jt,ym as k,_e as kt,x_ as l,Vf as lt,__ as m,nt as mt,mv as n,_p as nt,L_ as o,pp as ot,g_ as p,it as pt,Vp as q,pv as r,sp as rt,A_ as s,yp as st,Cv as t,hp as tt,S_ as u,Td as ut,ah as v,Ke as vt,nh as w,j as wt,rh as x,Me as xt,oh as y,We as yt,Bp as z,l as zt}; \ No newline at end of file +`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&pn(e,``+r);else return;break;case`className`:Zt(e,`class`,r);break;case`tabIndex`:Zt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Zt(e,n,r);break;case`style`:gn(e,r,o);return;case`data`:if(t!==`object`){Zt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=yn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=yn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=bn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=yn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Xt(e,`popover`,r);break;case`xlinkActuate`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Qt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Qt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Xt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=on(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Bt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+on(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+on(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+on(n.imageSizes)+`"]`)):i+=`[href="`+on(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Ft]=!0,o.onload=o.onerror=function(){Vt(o)}),Bt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+on(r)+`"][href="`+on(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Bt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=zt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Bt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=zt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Bt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=zt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Bt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=ke.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=zt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=zt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=zt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+on(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ft]){r.loading=1;return}}else t=e.createElement(`link`),t[Ft]=!0,t.onload=t.onerror=Vt.bind(null,t),np(t,`link`,n),Bt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+on(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+on(n.href)+`"]`);if(r)return t.instance=r,Bt(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Bt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Bt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Bt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Bt(a),a):(r=n,(a=vm.get(o))&&(r=T({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Bt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Bt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Bt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function y(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:v(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var b=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},x=e=>{let t=b(e);return t.charAt(0).toUpperCase()+t.slice(1)},S=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),C={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function ee(e){return e!=null}function w(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??C.width,a=e.size??e.height??C.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?S(...c):S(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??C[`stroke-width`])*Number(e.size??e.width??C.width)/Number(t.size??t.width??C.width):t.strokeWidth??C[`stroke-width`];return[`svg`,{...Object.entries(C).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&ee(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&ee(t.width)&&{[r(`width`)]:t.width},...`height`in t&&ee(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function te(e,t={}){return w(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=l(d(),1),ne=(0,E.createContext)({}),D=()=>(0,E.useContext)(ne),re=(0,E.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=D()??{},y=!!c||T(d),[b,x,C=[]]=te(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:S(v,s),hasA11yProp:y,attributes:d});return(0,E.createElement)(b,{ref:f,...x},[...C.map(([e,t])=>(0,E.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function O(e,t=[],n=[]){let r=typeof e==`string`?y(e,t,n):e,i=(0,E.forwardRef)(({className:e,...t},n)=>(0,E.createElement)(re,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=x(r.name)),i}var ie={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};ie.node;var ae=O(ie),oe={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};oe.node;var se=O(oe),ce={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};ce.node;var le=O(ce),ue={name:`box`,size:24,node:[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]};ue.node;var de=O(ue),fe={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};fe.node;var pe=O(fe),me={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};me.node;var he=O(me),ge={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};ge.node;var _e=O(ge),ve={name:`command`,size:24,node:[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]};ve.node;var ye=O(ve),be={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};be.node;var xe=O(be),k={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};k.node;var A=O(k),Se={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};Se.node;var Ce=O(Se),we={name:`keyboard`,size:24,node:[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]};we.node;var Te=O(we),Ee={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Ee.node;var j=O(Ee),De={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};De.node;var Oe=O(De),ke={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};ke.node;var Ae=O(ke),je={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};je.node;var Me=O(je),Ne={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Ne.node;var Pe=O(Ne),Fe={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};Fe.node;var Ie=O(Fe),Le={name:`package-open`,size:24,node:[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]};Le.node;var Re=O(Le),ze={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};ze.node;var Be=O(ze),Ve={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Ve.node;var He=O(Ve),Ue={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ue.node;var We=O(Ue),Ge={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ge.node;var Ke=O(Ge),qe={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};qe.node;var Je=O(qe),Ye={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ye.node;var Xe=O(Ye),Ze={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};Ze.node;var Qe=O(Ze),$e={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};$e.node;var et=O($e),tt={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};tt.node;var nt=O(tt),rt={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};rt.node;var it=O(rt),at={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};at.node;var ot=O(at),st={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};st.node;var ct=O(st),lt=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ut=o(((e,t)=>{t.exports=lt()})),dt=(0,E.createContext)({});function ft(e){let t=(0,E.useRef)(null);return t.current===null&&(t.current=e()),t.current}var pt=typeof window<`u`?E.useLayoutEffect:E.useEffect,mt=(0,E.createContext)(null);function ht(e,t){e.indexOf(t)===-1&&e.push(t)}function gt(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var _t=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),yt=e=>typeof e==`object`&&!!e,bt=e=>/^0[^.\s]+$/u.test(e);function xt(e){let t;return()=>(t===void 0&&(t=e()),t)}var St=e=>e,Ct=(...e)=>e.reduce((e,t)=>n=>t(e(n))),wt=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},Tt=class{constructor(){this.subscriptions=[]}add(e){return ht(this.subscriptions,e),()=>this.remove(e)}remove(e){gt(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r){if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;ie*1e3,Dt=e=>e/1e3,N=(e,t)=>t?1e3/t*e:0,Ot=(e,t,n)=>e*(3*(1-e)*((1-e)*t+e*n)+e*e);function kt(e,t,n,r){return e===t&&n===r?St:i=>{let a=0,o=1,s=i;for(let t=0;;t++){s>=a&&s<=o||(s=(a+o)/2);let r=Ot(s,e,n)-i;if(r*r<1e-28||t===40)break;r>0?o=s:a=s,s-=r*1e-7/(Ot(s+1e-7,e,n)-i-r)}return Ot(s,t,r)}}var At=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jt=e=>t=>1-e(1-t),Mt=kt(.33,1.53,.69,.99),Nt=jt(Mt),Pt=At(Nt),Ft=e=>e>=1?1:(e*=2)<1?.5*Nt(e):.5*(2-2**(-10*(e-1))),It=e=>1-Math.sin(Math.acos(e)),Lt=jt(It),Rt=At(It),P=kt(.42,0,1,1),zt=kt(0,0,.58,1),Bt=kt(.42,0,.58,1),Vt=e=>Array.isArray(e)&&typeof e[0]!=`number`,Ht=e=>Array.isArray(e)&&typeof e[0]==`number`,Ut={linear:St,easeIn:P,easeInOut:Bt,easeOut:zt,circIn:It,circInOut:Rt,circOut:Lt,backIn:Nt,backInOut:Pt,backOut:Mt,anticipate:Ft},Wt=e=>typeof e==`string`,Gt=e=>{if(Ht(e)){let[t,n,r,i]=e;return kt(t,n,r,i)}return Wt(e)?Ut[e]:e},Kt={delta:0,timestamp:0,isProcessing:!1},qt;function Jt(){qt=void 0}var F={now:()=>(qt===void 0&&F.set(Kt.isProcessing||vt.useManualTiming?Kt.timestamp:performance.now()),qt),set:e=>{qt=e,queueMicrotask(Jt)}},I=e=>Math.round(e*1e5)/1e5,Yt=e=>t=>typeof t==`string`&&t.startsWith(e),Xt=Yt(`--`),Zt=Yt(`var(--`),Qt=e=>Zt(e)?$t.test(e.split(`/*`)[0].trim()):!1,$t=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function en(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var tn={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},nn={...tn,transform:e=>_t(0,1,e)},rn={...tn,default:1},an=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function on(e){return e==null}var sn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,cn=(e,t)=>n=>!!(typeof n==`string`&&sn.test(n)&&n.startsWith(e)||t&&!on(n)&&Object.prototype.hasOwnProperty.call(n,t)),ln=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(an);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},un=e=>_t(0,255,e),dn={...tn,transform:e=>Math.round(un(e))},fn={test:cn(`rgb`,`red`),parse:ln(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+dn.transform(e)+`, `+dn.transform(t)+`, `+dn.transform(n)+`, `+I(nn.transform(r))+`)`},pn=(e,t,n)=>{let r=e.substring(1+t*n,1+(t+1)*n);return n>1?r:r+r};function mn(e){let t=e.length>5?2:1,n=pn(e,3,t);return{red:parseInt(pn(e,0,t),16),green:parseInt(pn(e,1,t),16),blue:parseInt(pn(e,2,t),16),alpha:n?parseInt(n,16)/255:1}}var hn={test:cn(`#`),parse:mn,transform:fn.transform},gn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),_n=gn(`deg`),vn=gn(`%`),L=gn(`px`),yn=gn(`vh`),bn=gn(`vw`),xn={...vn,parse:e=>vn.parse(e)/100,transform:e=>vn.transform(e*100)},Sn={test:cn(`hsl`,`hue`),parse:ln(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+vn.transform(I(t))+`, `+vn.transform(I(n))+`, `+I(nn.transform(r))+`)`},Cn={test:e=>fn.test(e)||hn.test(e)||Sn.test(e),parse:e=>fn.test(e)?fn.parse(e):Sn.test(e)?Sn.parse(e):hn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?fn.transform(e):Sn.transform(e),getAnimatableNone:e=>{let t=Cn.parse(e);return t.alpha=0,Cn.transform(t)}},wn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Tn=new RegExp(an.source),En=new RegExp(wn.source,`i`);function Dn(e){return isNaN(e)&&typeof e==`string`&&(Tn.test(e)||En.test(e))}var On=`number`,kn=`color`,An=`var`,jn=`var(`,Mn="${}",Nn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)(?![a-z]*\()/giu;function Pn(e){let t=e.toString();return Tn.test(t)||En.test(t)}function Fn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Nn,e=>(Cn.test(e)?(r.color.push(a),i.push(kn),n.push(Cn.parse(e))):e.startsWith(jn)?(r.var.push(a),i.push(An),n.push(e)):(r.number.push(a),i.push(On),n.push(parseFloat(e))),++a,Mn)).split(Mn),indexes:r,types:i}}function In(e){return Fn(e).values}function Ln({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;atypeof e==`number`?0:Cn.test(e)?Cn.getAnimatableNone(e):e,Bn=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:zn(e);function Vn(e){let t=Fn(e);return Ln(t)(t.values.map((e,n)=>Bn(e,t.split[n])))}var Hn={test:Dn,parse:In,createTransformer:Rn,getAnimatableNone:Vn};function Un(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Wn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Un(s,r,e+1/3),a=Un(s,r,e),o=Un(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Gn(e,t){return n=>n>0?t:e}var R=(e,t,n)=>e+(t-e)*n,Kn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},qn=[hn,fn,Sn],Jn=e=>qn.find(t=>t.test(e));function Yn(e){let t=Jn(e);if(!t)return!1;let n=t.parse(e);return t===Sn&&(n=Wn(n)),n}var Xn=(e,t)=>{let n=Yn(e),r=Yn(t);if(!n||!r)return Gn(e,t);let i={...n};return e=>(i.red=Kn(n.red,r.red,e),i.green=Kn(n.green,r.green,e),i.blue=Kn(n.blue,r.blue,e),i.alpha=R(n.alpha,r.alpha,e),fn.transform(i))},Zn=new Set([`none`,`hidden`]);function Qn(e,t){return Zn.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function $n(e,t){return n=>R(e,t,n)}function er(e){return typeof e==`number`?$n:typeof e==`string`?Qt(e)?Gn:Cn.test(e)?Xn:ir:Array.isArray(e)?tr:typeof e==`object`?Cn.test(e)?Xn:nr:Gn}function tr(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>er(e)(e,t[n]));return e=>{for(let t=0;t{for(let t in r)n[t]=r[t](e);return n}}function rr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i{let n=Fn(e),r=Fn(t);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?Zn.has(e)&&!r.values.length||Zn.has(t)&&!n.values.length?Qn(e,t):Ct(tr(rr(n,r),r.values),Ln(r)):Gn(e,t)},ar=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function or(e,t){let n=ar.exec(e);if(!n)return;let r=ar.exec(t);if(!r||n[2]!==r[2])return;let i=n[2],a=parseFloat(n[1]),o=parseFloat(r[1]);return e=>I(R(a,o,e))+i}function sr(e,t,n){if(typeof e==`number`&&typeof t==`number`&&typeof n==`number`)return R(e,t,n);if(typeof e==`string`&&typeof t==`string`){let n=or(e,t);if(n)return n}return er(e)(e,t)}var cr=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function lr(e){let t=new Set,n=new Set,r=!1,i=!1,a,o=new Set,s={delta:0,timestamp:0,isProcessing:!1};function c(t){o.has(t)&&(n.add(t),e()),(a=t)(s)}let l={schedule:(e,i=!1,s=!1)=>{let c=s&&r,l=c?t:n;return i&&o.add(e),c&&e!==a&&l.delete(e),l.add(e),e},cancel:e=>{n.delete(e),o.delete(e)},process:e=>{if(s=e,r){i=!0;return}r=!0;let o=t;t=n,n=o,t.forEach(c),t.clear(),a=void 0,r=!1,i&&(i=!1,l.process(e))}};return l}var ur=40;function dr(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0,a=()=>r=!0,o=cr.reduce((e,t)=>(e[t]=lr(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=vt.useManualTiming,o=a?n.timestamp:performance.now();r=!1,a||(n.delta=i?1e3/60:Math.max(Math.min(o-n.timestamp,ur),1)),n.timestamp=o,n.isProcessing=!0,s.process(n),c.process(n),l.process(n),u.process(n),d.process(n),f.process(n),p.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(h))},g=()=>{r=!0,i=!0,n.isProcessing||e(h)};return{schedule:cr.reduce((e,t)=>{let n=o[t];return e[t]=(e,t=!1,i=!1)=>(r||g(),n.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>z.update(t,e),stop:()=>fr(t),now:()=>Kt.isProcessing?Kt.timestamp:F.now()}},hr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t=n?1/0:i}function vr(e,t=100,n){let{keyframes:r,velocity:i}=e,a=r&&r[r.length-1]-r[0],o=n({...e,velocity:i&&a?i*t/a:i,keyframes:[0,t]}),s=Math.min(_r(o),gr);return{type:`keyframes`,ease:e=>o.next(s*e).value/t,duration:Dt(s)}}var yr=100,br=10,xr=1,Sr=800,Cr=.3,wr=.3,Tr=.01,Er=2,Dr=.005,Or=.5,kr=.01,Ar=10,jr=.05,Mr=e=>e<0?1/Math.max(1+e,jr):Math.max(1-e,jr);function Nr(e,t){if(!(e>1))return 1;let n=Math.sqrt(e*e-1),r=e-n,i=e+n,a=2*n*Math.exp(-t)*(1+t);return Ir(e=>i*Math.exp(-r*e)-r*Math.exp(-i*e)-a,e=>Math.exp(-i*e)-Math.exp(-r*e),t)/t}function Pr(e,t){return e*Math.sqrt(1-t*t)}var Fr=12;function Ir(e,t,n){let r=n;for(let n=1;n{let n=t*i,r=n*e,a=Pr(t,i),o=Math.exp(-r);return Lr-n/a*o},r=t=>{let r=t*i*e,a=i*i*t*t*e,o=Math.exp(-r),s=Pr(t*t,i);return(-n(t)+Lr>0?-1:1)*-a*o/s}):(n=t=>-.001+Math.exp(-t*e)*(t*e+1),r=t=>Math.exp(-t*e)*(-t*(e*e)));let a=5/e,o=Ir(n,r,a),s=o*Nr(i,o*e),c=s*s;return{stiffness:c,damping:i*2*Math.sqrt(c),duration:Et(e)}}var zr=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Br(e,t){if(zr(e,t))return e}function Vr(e){let t=Br(e.stiffness),n=Br(e.damping,!0),r=Br(e.mass),i={...e,stiffness:t??yr,damping:n??br,mass:r??xr,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){let t=Mr(e.bounce||0),n=2*Math.PI/(e.visualDuration*1.2)*Nr(t,2*Math.PI/1.2);i.stiffness=n*n,i.damping=2*t*Math.sqrt(i.stiffness)}else Object.assign(i,Rr(i)),i.isResolvedFromDuration=!0;zr(i.stiffness)&&zr(i.damping,!0)||(i.stiffness=yr,i.damping=br)}return i}function Hr(e=wr,t=Cr){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:o,damping:s,mass:c,duration:l,isResolvedFromDuration:u,isTimeDefined:d}=Vr({...n}),f=e=>d?0:-Dt(e),p=s/(2*Math.sqrt(o*c)),m=Dt(Math.sqrt(o/c)),h=p*m,g={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},_=()=>{let e=Math.abs(g.delta)<5;g.restSpeed=n.restSpeed||(e?Tr:Er),g.restDelta=n.restDelta||(e?Dr:Or)};_();let v,y,b;if(p<1){let e=Pr(m,p),t={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};b=()=>{t.A=(g.velocity+h*g.delta)/e,t.sinC=h*t.A+g.delta*e,t.cosC=h*g.delta-t.A*e};let n=n=>{n!==t.t&&(t.t=n,t.env=Math.exp(-h*n),t.sin=Math.sin(e*n),t.cos=Math.cos(e*n))};v=e=>(n(e),g.target-t.env*(t.A*t.sin+g.delta*t.cos)),y=e=>(n(e),t.env*(t.sinC*t.sin+t.cosC*t.cos))}else if(p===1){v=e=>g.target-Math.exp(-m*e)*(g.delta+(g.velocity+m*g.delta)*e);let e={C:0};b=()=>{e.C=g.velocity+m*g.delta},y=t=>Math.exp(-m*t)*(m*e.C*t-g.velocity)}else{let e=m*Math.sqrt(p*p-1),t=h-e,n=h+e,r=e<1||d?1/0:300/e,i=(e,t)=>Math.exp(t>r?(h-e)*r-h*t:-e*t),a={S:0,F:0};b=()=>{let t=(g.velocity+h*g.delta)/e;a.S=(g.delta+t)/2,a.F=(g.delta-t)/2},v=e=>g.target-a.S*i(t,e)-a.F*i(n,e),y=e=>t*a.S*i(t,e)+n*a.F*i(n,e)}b();let x=u&&l||null,S={calculatedDuration:x,retarget:(e,t)=>{g.target=e[e.length-1],g.delta=g.target-e[0],g.velocity=f(t),n.restSpeed&&n.restDelta||_(),S.calculatedDuration=x,a.done=!1,b()},velocity:e=>Et(y(e)),next:e=>{let t=v(e);if(u)a.done=e>=l;else{let n=Et(y(e));a.done=Math.abs(n)<=g.restSpeed&&Math.abs(g.target-t)<=g.restDelta}return a.value=a.done?g.target:t,a},toString:()=>{let e=Math.min(_r(S),gr),t=hr(t=>S.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return S}var Ur=Object.assign(Hr,{applyToOptions:e=>{let t=vr(e,100,Hr);return e.ease=t.ease,e.duration=Et(t.duration),e.type=`keyframes`,e}});function Wr({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>ec,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)-h*Math.exp(-e/r),y=e=>{let t=v(e);f.done=Math.abs(t)<=l,f.value=f.done?_:e?_+t:d},b,x,S=e=>{p(f.value)&&(b=e,x=Ur({keyframes:[f.value,m(f.value)],velocity:-v(e)/r*1e3,damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return S(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&b===void 0&&(t=!0,y(e),S(e)),b!==void 0&&e>=b?x.next(e-b):(!t&&y(e),f)}}}function Gr(e,t,n){let r=[],i=vt.mix||sr,a=e.length-1;for(let o=0;ot[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Gr(t,r,i),c=s.length,l=n=>{if(o&&n1)for(;rl(_t(e[0],e[a-1],t)):l}function qr(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=wt(0,t,r);e.push(R(n,1,i))}}function Jr(e){let t=[0];return qr(t,e.length-1),t}function Yr(e,t){return e.map(e=>e*t)}function Xr(e,t){return e.map(()=>t||Bt).splice(0,e.length-1)}function Zr({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`,mixer:i}){let a=typeof t[0]==`number`?void 0:i,o=Vt(r)?r.map(Gt):Gt(r)||Bt,s={done:!1,value:t[0]};if(!a&&t.length===2&&!Array.isArray(o)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){let[n,r]=t,i=n===r?void 0:(vt.mix||sr)(n,r);return{calculatedDuration:e,next:t=>(s.value=i?i(o(e>0?_t(0,1,t/e):1)):r,s.done=t>=e,s)}}let c=Kr(Yr(n&&n.length===t.length?n:Jr(t),e),t,{ease:Array.isArray(o)?o:Xr(t,o),mixer:a});return{calculatedDuration:e,next:t=>(s.value=c(t),s.done=t>=e,s)}}var Qr=5;function $r(e,t,n){let r=Math.max(t-Qr,0);return N(n-e(r),t-r)}function ei(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):$r(t=>e.next(t).value,t,e.next(t).value)}var ti=e=>e!==null;function ni(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ti),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ri={decay:Wr,inertia:Wr,tween:Zr,keyframes:Zr,spring:Ur};function ii(e){typeof e.type==`string`&&(e.type=ri[e.type])}var ai=40,oi=(e,t)=>t-e>ai&&!vt.useManualTiming?t:e;function si(e,t){return{kind:e,animation:t,timestamp:F.now(),frameTimestamp:Kt.timestamp,frameIsProcessing:Kt.isProcessing}}function ci(e,t,n){let r=globalThis.__MOTION_INSPECT__;if(r)try{r({...si(`animation-start`,e),options:n?{...t,...n}:t})}catch{}}function li(e,t){let n=globalThis.__MOTION_INSPECT__;if(n)try{n({...si(`layout-animation-start`,e),node:t})}catch{}}var ui=class{constructor(){this.isResolved=!1}get finished(){return this._finished||=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e}),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},di=e=>e/100,fi=e=>Math.round(e*1e4)/1e4,pi=class extends ui{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==F.now()&&this.tick(F.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),ci(this,this.options)}initAnimation(){let{options:e}=this;ii(e);let{type:t=Zr,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Zr;this.mixKeyframes=void 0,s!==Zr&&typeof o[0]!=`number`&&(this.mixKeyframes=Ct(di,e.mixer?.(o[0],o[1])||sr(o[0],o[1])),o=[0,100]);let c=s(o===e.keyframes?e:{...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=_r(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){this.currentTime=this.holdTime??Math.round(e-this.startTime)*this.playbackSpeed}tick(e,t=!1){let{generator:n,totalDuration:r,calculatedDuration:i}=this;if(this.startTime===null)return n.next(0);let{delay:a=0,keyframes:o,type:s,onUpdate:c,finalKeyframe:l}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=oi(this.startTime,e)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let u=this.currentTime-a*(this.playbackSpeed>=0?1:-1),d=this.playbackSpeed>=0?u<0:u>r;this.currentTime=Math.max(u,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let f=this.generate(this.currentTime,d),{done:p}=f;d||(p=this.playbackSpeed>=0?i<1/0?this.currentTime>=r:p:this.currentTime<=0);let m=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&p);return m&&s!==Wr&&(f.value=ni(o,this.options,l,this.speed)),c&&c(f.value),m&&this.finish(),f}at(e){return this.holdTime??fi((e-this.startTime)*this.playbackSpeed)}sampleAt(e,t){let{options:n,totalDuration:r}=this,i=this.at(e)-(n.delay||0);return i>=r&&n.type!==Wr?ni(n.keyframes,n,t?void 0:n.finalKeyframe):this.generate(Math.max(i,0),i<0).value}generate(e,t){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o}=this,{keyframes:s,repeat:c,repeatType:l,repeatDelay:u}=this.options,d=e,f=n;if(c){let t=Math.min(e,r)/o,n=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),i===1&&n--,n=Math.min(n,c+1),n%2&&(l===`reverse`?(i=1-i,u&&(i-=u/o)):l===`mirror`&&(f=a)),d=_t(0,1,i)*o}let p;return t?(this.delayState.value=s[0],p=this.delayState):p=f.next(d),i&&!t&&(p.value=i(p.value)),p}get duration(){return Dt(this.calculatedDuration)}get iterationDuration(){return this.duration+Dt(this.options.delay??0)}get time(){return Dt(this.currentTime)}set time(e){e=Et(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return ei(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(F.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Dt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=mr,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??(this.pendingStartTime=n):this.startTime=n-this.holdTime/(this.playbackSpeed||1),this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(F.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}},mi=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function hi(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(an)||[];if(!r)return e;let i=n.replace(r,``),a=+!!mi.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var gi=/\b([a-z-]*)\(.*?\)/gu,_i={...Hn,getAnimatableNone:e=>{let t=e.match(gi);return t?t.map(hi).join(` `):e}},vi={...Hn,getAnimatableNone:e=>{let t=Hn.parse(e);return Hn.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},yi={...tn,transform:Math.round},bi={rotate:_n,pathRotation:_n,rotateX:_n,rotateY:_n,rotateZ:_n,scale:rn,scaleX:rn,scaleY:rn,scaleZ:rn,skew:_n,skewX:_n,skewY:_n,distance:L,translateX:L,translateY:L,translateZ:L,x:L,y:L,z:L,perspective:L,transformPerspective:L,opacity:nn,originX:xn,originY:xn,originZ:L},xi={borderWidth:L,borderTopWidth:L,borderRightWidth:L,borderBottomWidth:L,borderLeftWidth:L,borderRadius:L,borderTopLeftRadius:L,borderTopRightRadius:L,borderBottomRightRadius:L,borderBottomLeftRadius:L,width:L,maxWidth:L,height:L,maxHeight:L,top:L,right:L,bottom:L,left:L,inset:L,insetBlock:L,insetBlockStart:L,insetBlockEnd:L,insetInline:L,insetInlineStart:L,insetInlineEnd:L,padding:L,paddingTop:L,paddingRight:L,paddingBottom:L,paddingLeft:L,paddingBlock:L,paddingBlockStart:L,paddingBlockEnd:L,paddingInline:L,paddingInlineStart:L,paddingInlineEnd:L,margin:L,marginTop:L,marginRight:L,marginBottom:L,marginLeft:L,marginBlock:L,marginBlockStart:L,marginBlockEnd:L,marginInline:L,marginInlineStart:L,marginInlineEnd:L,fontSize:L,backgroundPositionX:L,backgroundPositionY:L,...bi,zIndex:yi,fillOpacity:nn,strokeOpacity:nn,numOctaves:yi},Si={...xi,color:Cn,backgroundColor:Cn,outlineColor:Cn,fill:Cn,stroke:Cn,borderColor:Cn,borderTopColor:Cn,borderRightColor:Cn,borderBottomColor:Cn,borderLeftColor:Cn,filter:_i,WebkitFilter:_i,mask:vi,WebkitMask:vi},Ci=e=>Si[e],wi=new Set([_i,vi]);function Ti(e,t){let n=Ci(e);return wi.has(n)||(n=Hn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function Ei(e){for(let t=1;te*180/Math.PI,Oi=e=>Ai(Di(Math.atan2(e[1],e[0]))),ki={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Oi,rotateZ:Oi,skewX:e=>Di(Math.atan(e[1])),skewY:e=>Di(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ai=e=>(e%=360,e<0&&(e+=360),e),ji=Oi,Mi=e=>Math.hypot(e[0],e[1]),Ni=e=>Math.hypot(e[4],e[5]),Pi={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Mi,scaleY:Ni,scaleZ:e=>Math.hypot(e[8],e[9],e[10]),scale:e=>(Mi(e)+Ni(e))/2,rotateX:e=>Ai(Di(Math.atan2(e[6],e[5]))),rotateY:e=>Ai(Di(Math.atan2(-e[2],e[0]))),rotateZ:ji,rotate:ji,skewX:e=>Di(Math.atan(e[4])),skewY:e=>Di(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Fi(e){return+!!e.includes(`scale`)}function Ii(e,t){if(!e||e===`none`)return Fi(t);let n=e.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!n)return Fi(t);let r=(n[1]?Pi:ki)[t],i=n[2].split(`,`).map(e=>parseFloat(e));return typeof r==`function`?r(i):i[r]}var Li=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Ii(n,t)},Ri=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],zi=new Set([...Ri,`pathRotation`]),Bi=e=>e===tn||e===L,Vi=new Set([`x`,`y`,`z`]),Hi=Ri.filter(e=>!Vi.has(e));function Ui(e){let t=[];return Hi.forEach(n=>{let r=e.getValue(n);if(r!==void 0){let e=r.get(),i=+!!n.startsWith(`scale`);if(e===i)return;t.push([n,e]),r.set(i)}}),t}var Wi=new Set([`bottom`,`right`]);function Gi(e,t,n,r,i,a){let o=parseFloat(e);if(!isNaN(o))return o;let{min:s,max:c}=t()[n],l=c-s;return a===`border-box`?l:l-parseFloat(r)-parseFloat(i)}var Ki=({transform:e})=>Ii(e,`x`),qi=({transform:e})=>Ii(e,`y`),Ji={width:({width:e,paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r},i)=>Gi(e,i,`x`,t,n,r),height:({height:e,paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r},i)=>Gi(e,i,`y`,t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{let{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{let{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:Ki,y:qi,translateX:Ki,translateY:qi},Yi=new Set,Xi=!1,Zi=!1,Qi=!1;function $i(){if(Zi){let e=[],t=new Set,n=new Set;Yi.forEach(r=>{r.needsMeasurement&&(e.push(r),t.add(r.element),Wi.has(r.name)&&n.add(r.element))});let r=new Map;n.forEach(e=>{let t=Ui(e);t.length&&(r.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Zi=!1,Xi=!1,Yi.forEach(e=>e.complete(Qi)),Yi.clear()}function ea(){Yi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Zi=!0)})}function ta(){Qi=!0,ea(),$i(),Qi=!1}function na(e,t,n){if(typeof e==`string`){if(M(e)||bt(e))return parseFloat(e);if(!Hn.test(e)&&Hn.test(n))return Ti(t,n)}return e??void 0}var ra=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Yi.add(this),Xi||(Xi=!0,z.read(ea),z.resolveKeyframes($i))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=na(n.readValue(t,a),t,a);r!==void 0&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ei(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Yi.delete(this)}cancel(){this.state===`scheduled`&&(Yi.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},ia=e=>e.startsWith(`--`);function B(e,t,n){ia(t)?e.style.setProperty(t,n):e.style[t]=n}var aa={};function oa(e,t){let n=xt(e);return()=>aa[t]??n()}var sa=oa(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),ca=oa(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),la=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,ua={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:la([0,.65,.55,1]),circOut:la([.55,0,1,.45]),backIn:la([.31,.01,.66,-.59]),backOut:la([.33,1.53,.69,.99])};function da(e,t){if(e)return typeof e==`function`?ca()?hr(e,t):`ease-out`:Ht(e)?la(e):Array.isArray(e)?e.map(e=>da(e,t)||ua.easeOut):ua[e]}function fa(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=da(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function pa(e){return typeof e==`function`&&`applyToOptions`in e}function ma({type:e,...t}){return pa(e)&&ca()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ha=class extends ui{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e;let c=ma(e);this.animation=fa(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=ni(r,this.options,o,this.speed);this.updateMotionValue?.(e),B(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()},ci(this,e,c)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){this.isStopped||(this.isStopped=!0,this.state!==`idle`&&this.finishedTime===null&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||(this.animation.onfinish=null,this.cancel())))}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Dt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Dt(e)}get time(){return Dt(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Et(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&sa()?(this.animation.timeline=e,t?.(this.animation),St):n(this)}},ga={anticipate:Ft,backInOut:Pt,circInOut:Rt};function _a(e){return e in ga}function va(e){typeof e.ease==`string`&&_a(e.ease)&&(e.ease=ga[e.ease])}var ya=class extends ha{constructor(e){va(e),ii(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}elapsed(){return this.state===`running`?(F.now()-this.startTime)*this.speed:this.time*1e3}sample(e){if(!this.sampler){let{motionValue:e,onUpdate:t,onComplete:n,onPlay:r,onStop:i,element:a,...o}=this.options;this.sampler=new pi({...o,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,e)).value}liveValue(){let{state:e}=this;if(e===`running`||e===`paused`)return this.sample(this.elapsed())}updateMotionValue(e){let{motionValue:t,element:n,name:r}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let{speed:i}=this,a=this.elapsed(),o=this.state===`running`&&i?_t(0,10,a):0,s=this.sample(a);n&&r&&B(n,r,s),t.setWithVelocity(this.sample(a-o*Math.sign(i)),s,o/Math.abs(i||1))}},ba=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Hn.test(e)||e===`0`)&&!e.startsWith(`url(`));function xa(e){let t=e[0];if(e.length===1)return!0;for(let n=0;ne&&typeof t[0]!=`number`&&t.some((n,r)=>r&&e(t[r-1],n)),Oa=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),ka=()=>!vt.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,`animate`);function Aa(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!n||!(wa.has(n)||Oa.has(n)))return!1;let c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return ka()&&(wa.has(n)||Oa.has(n)&&Ea(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`&&!Da(e)}var ja=(e,t)=>t&&typeof e==`number`?t.transform(e):e,Ma={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Na=Ri.length,Pa={},Fa=(e,t,n=ja(t,bi[e]))=>(Pa[e]||(Pa[e]=(Ma[e]||e)+`(`))+n+`)`,Ia=(e,t)=>(typeof t==`number`?t:parseFloat(t))===+!!e.startsWith(`scale`);function La(e,t,n){let r=``;for(let i=0;i/^(linear|ease(In|Out|InOut))$/.test(e),Ga=(e,t)=>Math.abs(e-t)<=Ba,Ka=(e,t)=>e-t,qa=(e,t,n)=>Jr(Array(n+1)).map(n=>R(e,t,n)),Ja=e=>e.motionValue.owner,Ya=e=>Ra.get(e),Xa=({state:e})=>e===`idle`||e===`finished`,Za=(e,t)=>e.latestValues?e.latestValues[t]:e.getValue(t)?.get(),Qa=({name:e,motionValue:t})=>e&&Ri.includes(e)&&t?.owner?.current instanceof HTMLElement&&ka()&&ca();function $a(e){let t=Ja(e),{onUpdate:n,transformTemplate:r}=t.getProps();return!e.isHandoff&&!n&&!e.hasOnUpdate&&!r&&e.type!==`inertia`&&(Za(t,`transform`)||`none`)===`none`&&!Za(t,`pathRotation`)&&!t.projection?.isProjecting()&&!Da(e)}var eo=class extends pi{constructor(e){let t=Ja(e).current,{driver:n=mr}=e,r,i=$a(e);e.driver=e=>{let i=n(e);return{js:i,now:i.now,start:(e=!0)=>{let n=Ya(t);!n||n.isJS?i.start(e):n.schedule(!1,!e)},stop:()=>{i.stop();let e=Ya(t);e&&!e.isFinishing&&e.release(r)}}},super(e),r=this,this.canAccelerate=i;let{stop:a}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),a()}}get group(){return Ya(Ja(this.options).current)}get js(){return this.driver?.js}get name(){return this.options.name}timing(){let{startTime:e,speed:t,totalDuration:n}=this,{delay:r=0,repeatType:i}=this.options;return this.holdTime===null?n===1/0?[e+r/t,this.resolvedDuration*(i===`loop`?1:2)/t||1]:[e+(r+n)/t,0]:[1/0,0]}isAccelerated(){let{group:e,state:t}=this;return e?.tracks.has(this)&&!e.isJS&&this.canAccelerate&&(t===`running`||t===`paused`)}liveValue(){return this.isAccelerated()?this.sampleAt(F.now()):void 0}tween(){let{keyframes:e,type:t,ease:n,times:r,repeat:i,delay:a=0}=this.options,o=Ht(n)?la(n):Wa(n)&&ua[n];if(o&&!i&&!r&&e.length===2&&t===Zr&&this.holdTime===null){let e=this.startTime+a/this.speed;return[e,e+this.resolvedDuration/this.speed,o]}}boundaries(e,t){let{startTime:n,speed:r,resolvedDuration:i,options:a}=this,{delay:o=0,repeat:s=0,repeatDelay:c=0,repeatType:l,times:u,keyframes:d,type:f}=a,p=(f||Zr)===Zr?u||Jr(d):[0,1],m=n+o/r,h=[];if(this.holdTime!==null||!(i>0))return h;for(let n=Math.max(0,Math.floor((e-m)*r/i));n<=s;n++){let a=m+n*i/r;if(a>t)break;for(let o of p){let s=a+(n%2&&l&&l!==`loop`?1-o:o)*(i-c)/r;s>e&&s{for(let t of n)if(t.name===e)return!0},m=(t,n)=>{let o={};for(let s of t===void 0?Ri:a){let a=r.get(s),c=t===void 0?Za(e,s):a?a.sampleAt(n>t&&!a.timing()[1]?n:t):i[s];c!==void 0&&(o[s]=c)}return o},h=(e,t)=>{let n=``;for(let r in e){let i=e[r];t&&Ia(r,i)||(n+=Fa(r,i)+` `)}return(t?n.trim():n)||`none`},g=(e,t)=>h(m(e,t)),_=(e=m())=>{t.style.transform=h(e,!0)},v=(e=!0)=>{e&&_(),s.forEach(({animation:e})=>e.cancel()),s=[]},y=(e,n)=>new Animation(new KeyframeEffect(t,e,n)),b=(e,t,n=1/0)=>{let r={animation:e,offset:t,end:n};e.startTime=F.now()+t,n<1/0&&(e.onfinish=()=>{r.isDone=!0,s.some(e=>e.end===1/0)&&(e.cancel(),s=s.filter(e=>e!==r)),D.schedule(!1)}),e.oncancel=()=>s.includes(r)&&D.demote(),s.push(r)},x=(e,t,n)=>{let r=(t,n)=>Math.abs(e(n)-e(t)),i=r(t,n);for(;n-t>.01;){let e=(t+n)/2;r(t,e)>r(e,n)?n=e:t=e}return r(t,n)>i/2?[t,n]:[]},S=(e,t,n,r)=>{let i=Math.min(za,Math.max(2,Math.ceil((n-t)/10)));if(r.length*4>i)return;let a=qa(t,n,i).concat(r).sort(Ka),o=e=>wt(t,n,e),s,c;for(let n of e){let e=n.numberAt(t),r=a.map(t=>n.numberAt(t)-e),i=r[r.length-1],o=r.some(e=>Math.abs(e)*Ba>Math.abs(i))?0:i,l=r.map(e=>o?e/o:e);if(o&&!s)s=l,c=t=>(n.numberAt(t)-e)/o;else if(l.some((e,t)=>!Ga(e,o&&s[t])))return}if(!s||s.every((e,t)=>Ga(e,o(a[t]))))return`linear`;let l=[],u=(e,t=c(e))=>l.push(fi(t)+` `+fi(o(e)*100)+`%`);return s.forEach((e,t)=>{t&&Math.abs(e-s[t-1])>.2&&x(c,a[t-1],a[t]).forEach(e=>u(e)),u(a[t],e)}),`linear(`+l+`)`},C=(e,t,n,r)=>{let i=[t],a=(t,n)=>e.every(e=>!(Math.abs(e.numberAt((t+n)/2)-(e.numberAt(t)+e.numberAt(n))/2)>(e.name.startsWith(`scale`)?Ha:Va))),o=(t,n,r)=>{if(n-t<1||a(t,n))i.push(n);else if(r<4)o(t,(t+n)/2,r+1),o((t+n)/2,n,r+1);else{for(let r of e)i.push(...x(e=>r.numberAt(e),t,n));i.push(n)}},s=qa(t,n,Math.ceil((n-t)/100));for(let e of r)s.push(e,Math.min(e+.01,n));let c=t;for(let e of s.sort(Ka))e>c&&o(c,e,0),c=e;return i.sort(Ka)},ee=e=>{let t;for(let n of e){let e=n.tween();if(!e||t?.some((t,n)=>n<2?Math.abs(e[n]-t)>1:e[n]!==t))return;t=e}return t},w=(e,t,n,r,i={fill:`both`},a)=>{let o=e.flatMap(e=>e.boundaries(t,n)),s=r||S(e,t,n,o),c=s?[t,n]:C(e,t,n,o),l=c.map(e=>g(e,a)),u={transform:l};return s||(u.offset=c.map(e=>wt(t,n,e))),l.every(e=>e===l[0])&&(_(m(t,a)),u=null),y(u,{...i,duration:n-t,easing:s||`linear`})},te=t=>{let c=t,l=0,u=0,d=[],f=[],p=new Set;r.clear(),o=new Map;for(let e of n){r.set(e.name,e);let[n,i]=e.timing(),a=n===1/0;if(o.set(e,[e.at(t),e.speed,a]),a)e.sync();else{if(e.speed<0)return;if(i){if(l){let e=(n-u)/i;if(Math.abs(i-l)>1||Math.abs(e-Math.round(e))*l>1)return}else l=i,u=n;f.push(e)}else p.add(n);d.push(e),c=Math.max(c,n)}}i={},a=Ri.filter(t=>{if(r.has(t))return!0;let n=i[t]=Za(e,t);return n!==void 0&&!Ia(t,n)}),v(!1);let m=!l&&ee(d);try{if(m&&m[1]>t){let[e,n,r]=m;b(w(d,e,n,r),e-t,n-e)}else c>t&&(b(w(d,t,c),0,c-t),p.forEach(e=>e{let t,r=0;for(let i of n){let n=o.get(i);if(!n)return!1;let[a,s,c]=n,l=i.at(e),u=i.timing()[0]===1/0;if(c){if(u&&l===a)continue;return!1}let d=(l-a)/s,f=u?0:i.speed/s;if(t===void 0)t=d,r=f;else if(Math.abs(d-t)>1||f!==r)return!1}if(t===void 0)return!0;if(!s.length)return!1;for(let{offset:e,end:n,isDone:r}of s){let i=t-e;if(n<1/0&&(r?i=n))return!1}for(let{animation:n,offset:i,isDone:a}of s){if(a)continue;let o=t-i;r&&n.updatePlaybackRate&&n.playState===`running`&&Math.abs(Number(n.currentTime)-o)<20?n.playbackRate!==r&&n.updatePlaybackRate(r):r?(n.playbackRate=r,n.startTime=e-o/r):(n.startTime=null,n.currentTime=o)}return!0},E=()=>!n.size&&(u=!0,Ya(t)===D&&Ra.delete(t),D.isJS||v(),!0),ne=()=>{let t=F.now();if(D.isJS||(D.isFinishing=!0,n.forEach(n=>{let[r,a]=n.timing();n.state===`running`&&n.speed>0&&!a&&r<=t+1&&(n.complete(),i[n.name]=Za(e,n.name),o.has(n)||(c=!0))}),D.isFinishing=!1),l=!1,u||(n.forEach(e=>Xa(e)&&n.delete(e)),E()))return;for(let e of n)if(!e.canAccelerate)return D.demote(!0);D.isJS&&(D.isJS=!1,c=!0,n.forEach(e=>e.js?.stop()));let r=c,a=d;if(c=d=!1,r||!T(t)){if(a){if(t-f{t.isAccelerated()&&t.sync(),e||(t.canAccelerate=!1)}),D.isJS=!0,o=new Map,v(),n.forEach(e=>e.state===`running`&&e.js?.start()),!0}};return Ra.set(t,D),D}var no=class extends ui{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=F.now();let{keyframes:t,name:n,motionValue:r,element:i}=e,a=e;a.autoplay??=!0,a.delay??=0,a.type??=`keyframes`,a.repeat??=0,a.repeatDelay??=0,a.repeatType??=`loop`;let o=i?.KeyframeResolver||ra;this.keyframeResolver=new o(t,(e,t,n)=>this.onKeyframesResolved(e,t,a,!n),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=F.now();let u=Sa(e,i,a,o);u||((vt.instantAnimations||!s)&&l?.(ni(e,n,t)),e[0]=e[e.length-1],Ca(n),n.repeat=0);let{onComplete:d}=n;n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{d?.(),this.notifyFinished()};let f=u&&!c&&Aa(n),p=!f&&Qa(n);r&&(f||p||this.resolvedAt!==this.createdAt)&&(n.startTime??=oi(this.createdAt,this.resolvedAt));let m;if(f){n.element=n.motionValue?.owner?.current;try{m=new ya(n)}catch{m=new pi(n)}}else m=p?new eo(n):new pi(n);this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),ta()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}};function ro(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var io=30,ao=e=>!isNaN(parseFloat(e)),oo={current:void 0},so=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=F.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.dirty(),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=F.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ao(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){var n;return e===`change`?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new Tt)).add(t)}onChangeSubscribe(e){let{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new Tt,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){z.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){t&&(this.updatedAt=F.now(),this.stop()),this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){let{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){(this.dependents||=new Set).add(e)}removeDependent(e){this.dependents?.delete(e)}get(){oo.current?.push(this);let e=this.animation?.liveValue?.();return e===void 0?this.current:e}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){let e=F.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>io)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,io);return N(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&(this.animation=void 0),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}};function co(e,t){return new so(e,t)}function lo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function uo(e,t){let n=e?.[t]??e?.default??e;return n===e?n:lo(n,e)}var fo={type:`spring`,stiffness:500,damping:25,restSpeed:10},po=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mo={type:`keyframes`,duration:.8},ho={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},go=(e,{keyframes:t})=>t.length>2?mo:zi.has(e)?e.startsWith(`scale`)?po(t[1]):fo:ho,_o=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`,`out`,`mixer`]);function vo(e){for(let t in e)if(!_o.has(t))return!0;return!1}var yo=(e,t,n,r={},i,a)=>o=>{let s=uo(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Et(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i,hasOnUpdate:!!s.onUpdate};vo(s)||Object.assign(u,go(e,u)),u.duration&&=Et(u.duration),u.repeatDelay&&=Et(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Ca(u),u.delay===0&&(d=!0)),(vt.instantAnimations||vt.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Ca(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=ni(u.keyframes,s);if(e!==void 0){z.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new pi(u):new no(u)},bo=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function xo(e){let t=bo.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function So(e,t,n=1){let[r,i]=xo(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return M(e)?parseFloat(e):e}return Qt(i)?So(i,t,n+1):i}function Co(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function wo(e,t,n,r){let i=t=>typeof t==`function`?t(n===void 0?e.custom:n,...Co(r)):t;return t=i(t),typeof t==`string`&&(t=e.variants&&e.variants[t]),i(t)}function To(e,t,n){return wo(e.getProps(),t,n,e)}var Eo=(e,t)=>t===`exit`?e.presenceContext?.custom:void 0,Do=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Ri]),Oo=e=>Array.isArray(e);function ko(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,co(n))}function Ao(e){return Oo(e)?e[e.length-1]||0:e}function jo(e,t){let{transitionEnd:n={},transition:r={},...i}=To(e,t)||{};i={...i,...n};for(let t in i)ko(e,t,Ao(i[t]))}var V=e=>!!(e&&e.getVelocity);function Mo(e){return!!(V(e)&&e.add)}function No(e,t){let n=e.getValue(`willChange`);if(Mo(n))return n.add(t);if(!n&&vt.WillChange){let n=new vt.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}var Po=`data-framer-appear-id`;function Fo(e){return e.props[Po]}var Io=typeof window<`u`;function Lo({protectedKeys:e,needsAnimating:t},n){let r=n in e&&!t[n];return t[n]=!1,r}function Ro(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?lo(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState?.getState()[i],p=a?.path;p&&(p.animateValues?p.animateValues(t=>e.getValue(t,e.latestValues[t]??0),s,a,n,d):p.animateVisualElement?.(e,s,a,n,d));for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Lo(f,t))continue;let o={delay:n,...uo(f?.out[t]||a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){z.update(()=>r.set(i));continue}let p=!1;if(Io&&window.MotionHandoffAnimation){let n=Fo(e);if(n){let e=window.MotionHandoffAnimation(n,t,z);e!==null&&(o.startTime=e,p=!0)}}No(e,t);let m=l??e.shouldReduceMotion;r.start(yo(t,r,i,m&&Do.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>z.update(()=>{o&&jo(e,o)});d.length?Promise.all(d).then(t):t()}return d}function zo(e,t,n={}){let r=To(e,t,Eo(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),a=()=>Promise.all(r?Ro(e,r,n):[]),o=(r=0)=>{let{variantChildren:a}=e,{delayChildren:o=0,staggerChildren:s,staggerDirection:c}=i,l=[];return a?.forEach(e=>{e.notify(`AnimationStart`,t),l.push(zo(e,t,{...n,delay:r+(typeof o==`function`?0:o)+ro(a,e,o,s,c)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(l)},{when:s}=i;return s?s===`beforeChildren`?a().then(()=>o()):o().then(a):Promise.all([a(),o(n.delay)])}function Bo(e,t,n={}){return e.notify(`AnimationStart`,t),(Array.isArray(t)?Promise.all(t.map(t=>zo(e,t,n))):typeof t==`string`?zo(e,t,n):Promise.all(Ro(e,To(e,t,n.custom),n))).then(()=>{e.notify(`AnimationComplete`,t)})}var Vo={test:e=>e===`auto`,parse:e=>e},H=e=>t=>t.test(e),U=[tn,L,vn,_n,bn,yn,Vo],Ho=e=>U.find(H(e));function Uo(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||bt(e)}var Wo=new Set([`auto`,`none`,`0`]);function Go(e,t,n){let r=0,i;for(;re.measureViewportBox())}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e?.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){let{element:e,unresolvedKeyframes:t}=this;if(!e?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);let n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.resolveNoneKeyframes()}},qo=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Jo(e){return yt(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}function Yo(e){return yt(e)&&`ownerSVGElement`in e}var Xo={};function Zo(e){return Xo.current?.add(e),e}var Qo=e=>Xo.current?Xo.current.bind(e):e;function $o(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=t?t.current:Xo.current?.root||document,i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}function es(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}function ts(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(zi.has(e))o=!0;else if(Xt(e))i[e]=n;else{let t=ja(n,xi[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=La(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}var ns={offset:`stroke-dashoffset`,array:`stroke-dasharray`},rs={offset:`strokeDashoffset`,array:`strokeDasharray`};function is(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?ns:rs;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var as=[`transform`,`opacity`,`clipPath`,`filter`,`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function os(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(ts(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;for(let e of as)d[e]!==void 0&&(f[e]=d[e],delete d[e]);(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox),t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&is(d,i,a,o,!1)}function ss({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function cs({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ls(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function us(e){return e===void 0||e===1}function ds({scale:e,scaleX:t,scaleY:n}){return!us(e)||!us(t)||!us(n)}var fs=[`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skewX`,`skewY`];function ps(e){return ds(e)||hs(e)||ms(e)}function ms(e){return e.z||e.rotate||e.rotateX||e.rotateY||e.rotateZ||e.skewX||e.skewY}function hs(e){return gs(e.x)||gs(e.y)}function gs(e){return e&&e!==`0%`}function _s(e,t,n){return n+t*(e-n)}function vs(e,t,n,r,i){return i!==void 0&&(e=_s(e,i,r)),_s(e,n,r)+t}function ys(e,t=0,n=1,r,i){e.min=vs(e.min,t,n,r,i),e.max=vs(e.max,t,n,r,i)}function bs(e,{x:t,y:n}){ys(e.x,t.translate,t.scale,t.originPoint),ys(e.y,n.translate,n.scale,n.originPoint)}var xs=.999999999999,Ss=1.0000000000001;function Cs(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;sxs&&(t.x=1),t.yxs&&(t.y=1)}function ws(e,t){e.min+=t,e.max+=t}function Ts(e,t,n,r,i=.5){ys(e,t,n,R(e.min,e.max,i),r)}function Es(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Ds(e,t,n){let r=n??e;Ts(e.x,Es(t.x,r.x),t.scaleX,t.scale,t.originX),Ts(e.y,Es(t.y,r.y),t.scaleY,t.scale,t.originY)}function Os(e,t){return ss(ls(e.getBoundingClientRect(),t))}function ks(e,t,n){let r=Os(e,n),{scroll:i}=t;return i&&(ws(r.x,i.offset.x),ws(r.y,i.offset.y)),r}var As=()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),{schedule:js,cancel:Ms}=dr(queueMicrotask,!1);function Ns(e,t,n){let r=V(e)?e:co(e);return r.start(yo(``,r,t,n)),r.animation}var Ps={},Fs={value:null,addProjectionMetrics:null,countProjection:void 0};function Is(e,t){let n=F.now();e=Qo(e);let r=({timestamp:i})=>{let a=i-n;a>=t&&(fr(r),e(a-t))};return z.setup(r,!0),Zo(()=>fr(r))}function Ls(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Rs(e){return Yo(e)&&e.tagName===`svg`}function zs(e){return V(e)?e.get():e}var Bs=e=>typeof e==`number`?e:parseFloat(e),Vs=qo.length,Hs=e=>typeof e==`number`||L.test(e);function Us(e,t,n,r,i,a){i?(e.opacity=R(0,n.opacity??1,Gs(r)),e.opacityExit=R(t.opacity??1,0,Ks(r))):a&&(e.opacity=R(t.opacity??1,n.opacity??1,r));for(let i=0;irt?1:n(wt(e,t,r))}function Js(e,t){e.min=t.min,e.max=t.max}function Ys(e,t){Js(e.x,t.x),Js(e.y,t.y)}function Xs(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Zs=.9999,Qs=1.0001,$s=-.01,ec=.01;function tc(e){return e.max-e.min}function nc(e,t,n){return Math.abs(e-t)<=n}function rc(e,t,n,r=.5){e.origin=r,e.originPoint=R(t.min,t.max,e.origin),e.scale=tc(n)/tc(t),e.translate=R(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Zs&&e.scale<=Qs||isNaN(e.scale))&&(e.scale=1),(e.translate>=$s&&e.translate<=ec||isNaN(e.translate))&&(e.translate=0)}function ic(e,t,n,r){rc(e.x,t.x,n.x,r?.originX),rc(e.y,t.y,n.y,r?.originY)}function ac(e,t,n,r=0){e.min=(r?R(n.min,n.max,r):n.min)+t.min,e.max=e.min+tc(t)}function oc(e,t,n,r){ac(e.x,t.x,n.x,r?.x),ac(e.y,t.y,n.y,r?.y)}function sc(e,t,n,r=0){let i=r?R(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+tc(t)}function cc(e,t,n,r){sc(e.x,t.x,n.x,r?.x),sc(e.y,t.y,n.y,r?.y)}function lc(e,t,n,r,i){return e-=t,e=_s(e,1/n,r),i!==void 0&&(e=_s(e,1/i,r)),e}function uc(e,t=0,n=1,r=.5,i,a=e,o=e){if(vn.test(t)&&(t=parseFloat(t),t=R(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=R(a.min,a.max,r);e===a&&(s-=t),e.min=lc(e.min,t,n,s,i),e.max=lc(e.max,t,n,s,i)}function dc(e,t,[n,r,i],a,o){uc(e,t[n],t[r],t[i],t.scale,a,o)}var fc=[`x`,`scaleX`,`originX`],pc=[`y`,`scaleY`,`originY`];function mc(e,t,n,r){dc(e.x,t,fc,n?.x,r?.x),dc(e.y,t,pc,n?.y,r?.y)}var hc=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gc=hc(`applewebkit/`)&&!hc(`chrome/`)?Math.round:St;function _c(e){e.min=gc(e.min),e.max=gc(e.max)}function vc(e){_c(e.x),_c(e.y)}var yc=()=>({translate:0,scale:1,origin:0,originPoint:0}),bc=()=>({x:yc(),y:yc()}),xc=()=>({min:0,max:0}),Sc=()=>({x:xc(),y:xc()});function Cc(e){return e.translate===0&&e.scale===1}function wc(e){return Cc(e.x)&&Cc(e.y)}function Tc(e,t){return e.min===t.min&&e.max===t.max}function Ec(e,t){return Tc(e.x,t.x)&&Tc(e.y,t.y)}function Dc(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Oc(e,t){return Dc(e.x,t.x)&&Dc(e.y,t.y)}function kc(e){return tc(e.x)/tc(e.y)}function Ac(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}var jc=class{constructor(){this.members=[]}add(e){ht(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;r&&r.isConnected!==!1||n.snapshot||(gt(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(gt(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}};function Mc(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Nc={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(L.test(e))e=parseFloat(e);else return e}return`${Mc(e,t.target.x)}% ${Mc(e,t.target.y)}%`}},Pc={borderRadius:Object.assign({},Nc,{applyTo:qo.slice()}),borderTopLeftRadius:Nc,borderTopRightRadius:Nc,borderBottomLeftRadius:Nc,borderBottomRightRadius:Nc,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Hn.parse(e);if(i.length>5)return r;let a=Hn.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=R(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}}};function Fc(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e}=n;e&&(r=`perspective(${e}px) ${r}`);for(let e=0;ee.depth-t.depth,Rc=class{constructor(){this.children=[],this.isDirty=!1}add(e){ht(this.children,e),this.isDirty=!0}remove(e){gt(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Lc),this.isDirty=!1,this.children.forEach(e)}},zc={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Bc=[`z`,`skew`,`skewZ`],Vc=1e3,Hc=0;function Uc(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}var Wc=e=>e.instance&&Ra.get(e.instance)?.demote()&&e.resetSkewAndRotation();function Gc(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Fo(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,z,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Gc(r)}function Kc(e){if(e)return e.options.allowProjection===!1?Kc(e.parent):e.projection}function qc({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return Object.assign(Ps,{...Pc,...Ps}),class{static create(e,t,n){let{layoutId:r,layout:i,drag:a,dragConstraints:o,layoutScroll:s,layoutRoot:c,layoutAnchor:l,layoutCrossfade:u}=t,d=e.projection=new this(e.latestValues,t[`data-framer-portal-id`]?void 0:Kc(e.parent));d.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!a||o&&Ls(o),visualElement:e,animationType:typeof i==`string`?i:`both`,initialPromotionConfig:n,crossfade:u,layoutScroll:s,layoutRoot:c,layoutAnchor:l});let f=d.getStack()?.lead;f&&!d.root.isUpdateBlocked()&&(f.willUpdate(),f.scheduleCheckAfterUnmount())}constructor(e={},n=t?.()){this.id=Hc++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Xc),this.nodes.forEach(sl),this.nodes.forEach(cl),this.nodes.forEach(Zc),Fs.countProjection?.()},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;z.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n?.(),n=Is(i,250),zc.hasAnimatedSinceResize&&(zc.hasAnimatedSinceResize=!1,this.nodes.forEach(ol)))})}n&&this.root.registerSharedNode(n,this),this.addLayoutListener()}addLayoutListener(){let{layoutId:e,layout:t,visualElement:n,animate:r}=this.options;this.instance&&!this.hasLayoutListener&&r!==!1&&n&&(e||t)&&(this.hasLayoutListener=!0,this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:i})=>{if(this.isAnimationBlocked){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||n.getDefaultTransition()||ml,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=n.getProps(),c=!this.targetLayout||!Oc(this.targetLayout,i),l=!t&&r;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...uo(a,`layout`),onPlay:o,onComplete:s};(n.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||ol(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,fr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(ll),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete?.();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Gc(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;Wc(this),this.isLayoutDirty=!0;for(let e=0;ee.members.length?e.removeLeadSnapshot():this.sharedNodes.delete(t))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,z.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){z.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),this.snapshot&&!tc(this.snapshot.measuredBox.x)&&!tc(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let n=t/1e3,r=p?.(n);ul(o.x,e.x,n),ul(o.y,e.y,n),r&&(o.x.translate=r.x,o.y.translate=r.y),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(cc(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),fl(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Ec(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Sc(),Ys(f,this.relativeTarget)),c&&(this.animationValues=a,Us(a,i,this.latestValues,n,d,u)),r?.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(fr(this.pendingAnimation),void 0),this.pendingAnimation=z.update(()=>{zc.hasAnimatedSinceResize=!0,this.motionValue||=co(0),this.motionValue.jump(0,!1),this.currentAnimation=Ns(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),li(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta?.(Vc),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,layout:n,latestValues:r}=e,{target:i}=e;if(t&&i&&n){if(this!==e&&this.layout&&n&&gl(this.options.animationType,this.layout.layoutBox,n.layoutBox)){let{layoutBox:e}=this.layout,t=i;i=this.target||Sc(),hl(i.x,t.x,e.x),hl(i.y,t.y,e.y)}Ys(t,i),Ds(t,r),ic(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new jc),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?.transition,preserveFollowOpacity:n?.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){this.getStack()?.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let{latestValues:t}=e;if(!ms(t))return;let n={};for(let t=0;te.currentAnimation?.stop()),this.root.nodes.forEach($c),this.root.sharedNodes.clear()}}}function Jc(e){e.updateLayout(),nl(e)}function Yc(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source,o=(r,a)=>{if(i===`size`)Ic(e=>{let t=tc(r[e]);r[e].min=a[e].min,r[e].max=r[e].min+t});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Js(r[e],a[e])}else gl(i,t.layoutBox,n)&&Ic(t=>{let n=tc(a[t]);r[t].max=r[t].min+n,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[t].max=e.relativeTarget[t].min+n)})},s=a?t.measuredBox:t.layoutBox;o(s,n);let c=bc();ic(c,n,t.layoutBox);let l=bc();ic(l,a?e.applyTransform(r,!0):n,s);let u=!wc(c),d=!1,f=e.getClosestProjectingParent();if((!e.resumeFrom||f?.options.layoutRoot&&e.resumeFrom.path.includes(f))&&f&&!f.resumeFrom){let{snapshot:r,layout:i}=f;if(r&&i){let s=e.options.layoutAnchor||void 0,c=Sc();cc(c,a?e.resumeFrom.applyTransform(t.layoutBox,!0,void 0,!0,f.depth+1):t.layoutBox,r.layoutBox,s);let l=Sc();cc(l,n,i.layoutBox,s),a&&o(c,l),Oc(c,l)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=l,e.relativeTargetOrigin=c,e.relativeParent=f)}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:l,layoutDelta:c,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else e.isLead()&&e.options.onExitComplete?.();e.options.transition=void 0}function Xc(e){Fs.countProjection?.(0),e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Zc(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Qc(e){e.clearSnapshot()}function $c(e){e.clearMeasurements()}function el(e){e.isLayoutDirty=!0,e.updateLayout()}function tl(e){e.isLayoutDirty=!1}function nl(e){let{snapshot:t,dragAncestor:n}=e,r=n?.isAnimationBlocked&&n.layout;if(!t||!r||e.resumeFrom||e.isAnimationBlocked)return;let i=n.dragSnapshot;Ic(e=>ws(t.layoutBox[e],r.layoutBox[e].min-i.layoutBox[e].min))}function rl(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.dragSnapshot||e.layout,e.isLayoutDirty=!0)}function il(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function al(e){let{visualElement:t}=e.options;t?.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ol(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function sl(e){e.resolveTargetDelta()}function cl(e){e.calcProjection()}function ll(e){e.resetSkewAndRotation()}function ul(e,t,n){e.translate=R(t.translate,0,n),e.scale=R(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function dl(e,t,n,r){e.min=R(t.min,n.min,r),e.max=R(t.max,n.max,r)}function fl(e,t,n,r){dl(e.x,t.x,n.x,r),dl(e.y,t.y,n.y,r)}function pl(e){return e.animationValues?.opacityExit!==void 0}var ml={duration:.45,ease:[.4,0,.1,1]};function hl(e,t,n){e.max=tc(n)+(e.min=t.min)}function gl(e,t,n){return e===`position`||e===`preserve-aspect`&&!nc(kc(t),kc(n),.2)}function _l(e){return e!==e.root&&e.scroll?.wasRoot}function W(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var vl=qc({attachResizeListener:(e,t)=>W(e,`resize`,t),measureScroll:As,checkIsScrollRoot:()=>!0}),yl={current:void 0},bl=qc({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!yl.current){let e=new vl({});e.mount(window),e.setOptions({layoutScroll:!0}),yl.current=e}return yl.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),xl=new WeakMap;function Sl(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Cl(e){return typeof e==`string`||Array.isArray(e)}var wl=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Tl=[`initial`].concat(wl);function El(e){if(Sl(e.animate))return!0;for(let t=0;tkl.current=e.matches;e.addEventListener(`change`,t),t()}else kl.current=!1}}var Nl=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Pl={};function Fl(e){Pl=e}function Il(){return Pl}var Ll=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ra,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=F.now();this.renderScheduledAtt.delete(this)}}this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Al.current||Ml(),this.shouldReduceMotion=kl.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),fr(this.notifyUpdate),fr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),(this.enteringChildren||=new Set).add(e)}removeChild(e){this.children.delete(e),this.enteringChildren?.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.get(e)?.(),t.accelerate&&wa.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new ha({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Et(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=zi.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&z.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),Ra.get(this.current)?.check()),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i?.()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Pl){let t=Pl[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Sc()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){let{transformTemplate:n,onUpdate:r}=this.props;(e.transformTemplate||n)&&this.scheduleRender(),(e.transformTemplate&&!n||e.onUpdate&&!r)&&Ra.get(this.current)?.demote(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t{this.current&&(this.current.textContent=`${e}`)}))}};function zl(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Bl(e,{layout:t,layoutId:n}){return zi.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ps[e]||e===`opacity`)}function Vl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(V(r[t])||i&&V(i[t])||Bl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Hl(e){return window.getComputedStyle(e)}var Ul=class extends Rl{constructor(){super(...arguments),this.type=`html`,this.renderInstance=zl}mount(e){super.mount(e)}readValueFromInstance(e,t){if(zi.has(t))return this.projection?.isProjecting?Fi(t):Li(e,t);{let n=Hl(e),r=(Xt(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Os(e,t)}build(e,t,n){ts(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Vl(e,t,n)}},Wl=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function Gl(e){return{point:{x:e.pageX,y:e.pageY}}}var Kl=e=>t=>Wl(t)&&e(t,Gl(t));function ql(e,t,n,r){return W(e,t,Kl(n),r)}var Jl=new WeakMap,Yl,Xl=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Yo(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Zl=Xl(`inline`,`width`,`offsetWidth`),Ql=Xl(`block`,`height`,`offsetHeight`);function $l({target:e,borderBoxSize:t}){Jl.get(e)?.forEach(n=>{n(e,{get width(){return Zl(e,t)},get height(){return Ql(e,t)}})})}function eu(e){e.forEach($l)}function tu(){typeof ResizeObserver<`u`&&(Yl=new ResizeObserver(eu))}function nu(e,t){Yl||tu();let n=$o(e);return n.forEach(e=>{let n=Jl.get(e);n||(n=new Set,Jl.set(e,n)),n.add(t),Yl?.observe(e)}),()=>{n.forEach(e=>{let n=Jl.get(e);n?.delete(t),n?.size||Yl?.unobserve(e)})}}var ru=new Set,iu;function G(){iu=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};ru.forEach(t=>t(e))},window.addEventListener(`resize`,iu)}function au(e){return ru.add(e),iu||G(),()=>{ru.delete(e),!ru.size&&typeof iu==`function`&&(window.removeEventListener(`resize`,iu),iu=void 0)}}function ou(e,t){return Zo(typeof e==`function`?au(e):nu(e,t))}var su=(e,t)=>Math.abs(e-t);function cu(e,t){let n=su(e.x,t.x),r=su(e.y,t.y);return Math.sqrt(n**2+r**2)}var lu=new Set([`auto`,`scroll`]),uu=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=fu(this.lastRawMoveEventInfo,this.transformPagePoint));let e=mu(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=cu(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e;this.history.push({...r,timestamp:F.now()});let{onStart:i,onMove:a}=this.handlers;t||(i?.(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a?.(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.handleScroll(window),this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=fu(t,this.transformPagePoint),this.hasPendingMove=!0,z.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.hasPendingMove&&this.updatePoint(),this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i?.(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=mu(e.type===`pointercancel`?this.lastMoveEventInfo:fu(t,this.transformPagePoint),this.history);this.startEvent&&n?.(e,a),r?.(e,a)},!Wl(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=fu(Gl(e),this.transformPagePoint),{point:c}=s;this.history=[{...c,timestamp:F.now()}];let{onSessionStart:l}=t;l&&l(e,mu(s,this.history));let u={passive:!0,capture:!0};this.removeListeners=Ct(ql(this.contextWindow,`pointermove`,this.handlePointerMove,u),ql(this.contextWindow,`pointerup`,this.handlePointerUp,u),ql(this.contextWindow,`pointercancel`,this.handlePointerUp,u)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(lu.has(e.overflowX)||lu.has(e.overflowY))&&this.scrollPositions.set(t,du(t)),t=t.parentElement}this.scrollPositions.set(window,du(window)),this.removeScrollListeners=Ct(W(window,`scroll`,this.onElementScroll,{capture:!0}),W(window,`scroll`,this.onWindowScroll,{}))}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=du(e),i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),z.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),fr(this.updatePoint)}},du=e=>e===window?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop};function fu(e,t){return t?{point:t(e.point)}:e}function pu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mu({point:e},t){return{point:e,delta:pu(e,gu(t)),offset:pu(e,hu(t)),velocity:_u(t,.1)}}function hu(e){return e[0]}function gu(e){return e[e.length-1]}function _u(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=gu(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Et(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Et(t)*2&&(r=e[1]);let a=Dt(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}var vu=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function yu(e){return vu.has(e.tagName)||e.isContentEditable===!0}var bu=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function xu(e){return bu.has(e.tagName)||e.isContentEditable===!0}var Su={x:!1,y:!1};function Cu(){return Su.x||Su.y}function wu(e){return e===`x`||e===`y`?Su[e]?null:(Su[e]=!0,()=>{Su[e]=!1}):Su.x||Su.y?null:(Su.x=Su.y=!0,()=>{Su.x=Su.y=!1})}function Tu(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?R(n,e,r.max):Math.min(e,n)),e}function Eu(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Du(e,{top:t,left:n,bottom:r,right:i}){return{x:Eu(e.x,n,i),y:Eu(e.y,t,r)}}function Ou(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=wt(t.min,t.max-r,e.min):r>i&&(n=wt(e.min,e.max-i,t.min)),_t(0,1,n)}function ju(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Mu=.35;function Nu(e=Mu){return e===!1?e=0:e===!0&&(e=Mu),{x:Pu(e,`left`,`right`),y:Pu(e,`top`,`bottom`)}}function Pu(e,t,n){return{min:Fu(e,t),max:Fu(e,n)}}function Fu(e,t){return typeof e==`number`?e:e[t]||0}function Iu(e){let t=``;for(let n of e.path){n.scroll=void 0,n.updateScroll();let{scroll:r}=n;n!==e.root&&r&&(t+=r.offset.x+`,`+r.offset.y+`,`)}return t}var Lu=new WeakMap,Ru=class{constructor(e,t=()=>e.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Sc(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e,this.readProps=t}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){if(this.visualElement.presenceContext?.isPresent===!1)return;let r=e=>{t&&this.snapToCursor(e),this.stopAnimation()},i=(e,t)=>{let{drag:n,dragConstraints:r,dragPropagation:i,onDragStart:a}=this.getProps();if(n&&!i&&(this.openDragLock?.(),this.openDragLock=wu(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();let{projection:o}=this.visualElement;o&&(o.isAnimationBlocked=!0,o.target=void 0),Ic(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Qt(t)&&(t=So(t,this.visualElement.current)||0),L.test(t))t=parseFloat(t);else if(vn.test(t)){let n=o?.layout?.layoutBox[e];n&&(t=tc(n)*(parseFloat(t)/100))}this.originPoint[e]=t}),this.point=typeof r==`function`&&r(this),a&&z.update(()=>a(e,t),!1,!0),No(this.visualElement,`transform`),this.visualElement.animationState?.setActive(`whileDrag`,!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){if(this.currentDirection=Wu(o),this.currentDirection===null)return;i&&i(this.currentDirection)}this.updateAxis(`x`,o),this.updateAxis(`y`,o),this.point&&this.point.move(),this.visualElement.render(),a&&z.update(()=>a(e,t),!1,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},s=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints||this.point)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new uu(e,{onSessionStart:r,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:s},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:n,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(e,t,n){let r=e||this.latestPointerEvent,i=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;let{velocity:o}=i;this.startAnimation(o,n);let{onDragEnd:s}=this.getProps();s&&z.postRender(()=>s(r,i))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t?.setActive(`whileDrag`,!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(e,t){let{drag:n}=this.readProps();if(!t||!Uu(e,n,this.currentDirection))return;let r=this.getAxisMotionValue(e),i=this.originPoint[e]+t[e],a=this.constraints&&this.constraints[e];a&&(i=Tu(i,a,this.elastic[e])),this.point?this.point[e]=i:r.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),{projection:n}=this.visualElement,r=n&&(n.layout||n.measure(!1)),i=this.constraints;zu(e)?this.constraints&&this.scroll===Iu(n)||(this.constraints=this.resolveRefConstraints()):this.constraints=e&&r&&typeof e==`object`?Du(r.layoutBox,e):!1,this.elastic=Nu(t),i!==this.constraints&&!zu(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&Ic(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=ju(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!zu(e))return!1;let n=Bu(e),{projection:r}=this.visualElement;if(!r||!r.layout)return!1;this.scroll=Iu(r);let i=ks(n,r.root,this.visualElement.getTransformPagePoint()),a=ku(r.layout.layoutBox,r.removeElementScroll(i));if(t){let e=t(cs(a));this.hasMutatedConstraints=!!e,e&&(a=ss(e))}return a}startAnimation(e,t){let{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c={bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a},l=i=>r&&!(this.point&&o)&&Uu(i,t||n,this.currentDirection)?e[i]:0;if(this.point&&!o)return this.point.release({x:l(`x`),y:l(`y`)},c).then(s);let u=this.constraints||{},d=Ic(e=>{if(!Uu(e,t||n,this.currentDirection))return;let r=u[e]||{};(o===!0||o===e)&&(r={min:0,max:0});let i={type:`inertia`,velocity:l(e),...c,...r};return this.startAxisValueAnimation(e,i)});return Promise.all(d).then(s)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return No(this.visualElement,e),n.start(yo(e,n,0,t,this.visualElement,!1))}stopAnimation(){Ic(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.readProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){let{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,a=this.visualElement.measureViewportBox();Ic(e=>{if(!Uu(e,n,this.currentDirection))return;let t=this.getAxisMotionValue(e),{min:r,max:o}=a[e];t.set((t.get()||0)+i[e]-R(r,o,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!zu(t)||!n||!this.constraints)return;this.stopAnimation();let r=this.constraints,i={x:0,y:0};Ic(e=>{let t=this.getAxisMotionValue(e).get();i[e]=Au({min:t,max:t},r[e])});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},``):`none`,n.root?.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Ic(t=>{let n=this.getAxisMotionValue(t);if(!Uu(t,e,null)||!n.get())return;let{min:r,max:a}=this.constraints[t];n.set(R(r,a,i[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Lu.set(this.visualElement,this);let e=this.visualElement.current,t=ql(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&xu(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps(),r=zu(t)&&Bu(t);r&&(this.constraints=this.resolveRefConstraints(),n||=Hu(e,r,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i.layout||(i.root?.updateScroll(),i.updateLayout()),z.read(r);let o=W(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Ic(t=>{if(!Uu(t,this.getProps().drag,this.currentDirection))return;let n=this.getAxisMotionValue(t);this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate)}),this.visualElement.render())}));return()=>{o(),t(),a(),s(),n?.()}}getProps(){let e=this.readProps(),{dragElastic:t=Mu,dragMomentum:n=!0}=e;return{...e,dragElastic:t,dragMomentum:n}}};function zu(e){return!!e&&typeof e==`object`&&(`current`in e||`nodeType`in e)}var Bu=e=>`current`in e?e.current:e;function Vu(e){let t=!0;return()=>{t?t=!1:e()}}function Hu(e,t,n){let r=ou(e,Vu(n)),i=ou(t,Vu(n));return()=>{r(),i()}}function Uu(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Wu(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}function Gu(e,t){let n=$o(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},Zo(()=>r.abort())]}function Ku(e){return!(e.pointerType===`touch`||Cu())}function qu(e,t,n={}){t=Qo(t);let[r,i,a]=Gu(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{e.pointerType!==`touch`&&(n?r=!0:s(e))};e.addEventListener(`pointerenter`,n=>{if(!Ku(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Ju=(e,t)=>t?e===t||Ju(e,t.parentElement):!1,Yu=new WeakSet;function Xu(e){return t=>{t.key===`Enter`&&e(t)}}function Zu(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Qu=(e,t)=>{let n=!1,r=Xu(()=>{Yu.has(e)||(n=!0,Zu(e,`down`))}),i=Xu(()=>{n&&(n=!1,Zu(e,`up`))});e.addEventListener(`keydown`,r,t),e.addEventListener(`keyup`,i,t),e.addEventListener(`blur`,()=>{e.removeEventListener(`keydown`,r),e.removeEventListener(`keyup`,i),n&&Zu(e,`cancel`)},{...t,once:!0})};function $u(e){return Wl(e)&&!Cu()}var K=new WeakSet;function ed(e,t,n={}){t=Qo(t);let[r,i,a]=Gu(e,n),o=e=>{let r=e.currentTarget;if(!$u(e)||K.has(e))return;Yu.add(r),n.stopPropagation&&K.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),Yu.has(r)&&Yu.delete(r),$u(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||Ju(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Jo(e)&&(e.addEventListener(`focus`,()=>Qu(e,i),i),!yu(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}var q=class{constructor(e){this.isMounted=!1,this.node=e}update(){}},J=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Y=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function td(e,t,n,r){zl(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(J.has(n)?n:es(n),t.attrs[n])}function nd(e,t,n){let r=Vl(e,t,n);for(let n in e)if(n!==`children`&&(V(e[n])||V(t[n]))){let t=Ri.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var rd=class extends Rl{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Sc}getBaseTargetFromProps(e,t){return zi.has(t)?super.getBaseTargetFromProps(e,t)??Fi(t):e[t]}getDefaultValue(e){return zi.has(e)?this.latestValues[e]??Fi(e):void 0}readValueFromInstance(e,t){if(zi.has(t)){let e=Ci(t);return e&&e.default||0}if(as.includes(t)){let n=getComputedStyle(e)[t];if(typeof n==`string`&&n)return n.trim()}return t=J.has(t)?t:es(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return nd(e,t,n)}build(e,t,n){os(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){td(e,t,n,r)}mount(e){this.isSVGTag=Y(e.tagName),super.mount(e)}};function id(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;re?.out===!0?e:e?.out;function sd(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>Bo(e,t,n))),n=ld(),r=!0,i=!1;function a(a){let{props:o,parent:s,manuallyAnimateOnMount:c}=e,{initial:l}=o,u=r||i,d=[],f=(t=l)=>typeof t!=`boolean`&&To(e,Array.isArray(t)?t[0]:t,e.presenceContext?.custom)||void 0,p=new Map,m={},h=1/0,g=e;do g=g.props.inherit!==!1&&g.parent;while(g&&!g.isControllingVariants);let _=u&&od(f(l??(g&&g.props.initial))?.transition);if(ad.forEach((t,r)=>{let i=n[t],l=o[t],f=g&&g.props[t],v=l===void 0?Cl(f)||f===!1?f:void 0:l,y=Cl(v),b=t===a?i.isActive:null,x=y&&l===void 0&&!(u&&c);if(i.protectedKeys={...m},!i.isActive&&b===null||!v&&!i.prevProp||Sl(v)||typeof v==`boolean`)return;if(b===!1&&(h=r),t===`exit`&&i.isActive&&b!==!0){m={...m,...i.prevResolvedValues};return}let S=cd(i.prevProp,v),C=S||y&&(b&&!x||r>h),ee=!1,w=Array.isArray(v)?v:[v],te={},T;if(b!==!1)for(let n of w){let{transition:r,transitionEnd:i,...a}=To(e,n,Eo(e,t))||{};te={...te,...a,...i},T=od(r)||T}let{prevResolvedValues:E}=i;for(let t in{...E,...te}){if(t in m)continue;let n=te[t],r=E[t],a=Array.isArray(n)&&Array.isArray(r)?!id(n,r)||S:n!==r,o;if(a&&n==null)p.has(t)||p.set(t,i.prevOut);else if(a||n!==void 0&&p.has(t)){C=!0,o=p.get(t)||_,p.delete(t)&&(ee=!0),i.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)}else i.protectedKeys[t]=!0;i.out[t]=o}if(i.prevProp=v,i.prevResolvedValues=te,i.prevOut=T,i.isActive&&(m={...m,...te}),C&&(!(x&&S)||ee))for(let n of w){let r={type:t};if(typeof n==`string`&&u&&c&&s?.enteringChildren){let t=To(s,n)?.transition?.delayChildren;r.delay=ro(s.enteringChildren,e,t)}d.push({animation:n,options:r})}}),p.size){let t={},n=f(),r=n?.transition;p.forEach((i,a)=>{i&&(r={...r||e.getDefaultTransition(),[a]:i});let s=e.getValue(a);s&&(s.liveStyle=!0);let c=n&&!Array.isArray(l)?n[a]:void 0,u=e.getBaseTargetFromProps(o,a);t[a]=(c===void 0?u!==void 0&&!V(u)?u:e.initialValues[a]===void 0?e.baseTarget[a]:void 0:c)??null}),r&&(t.transition=r),d.push({animation:t})}let v=u&&e.blockInitialAnimation||r&&!c&&(o.initial===!1||o.initial===o.animate);return r=i=!1,!v&&d.length?t(d):Promise.resolve()}function o(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=a(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:a,setActive:o,setAnimateFunction:n=>{t=n(e)},getState:()=>n,reset:()=>{n=ld(),i=!0}}}function cd(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!id(t,e):!1}function ld(){let e={};for(let t of wl)e[t]={isActive:t===`animate`,protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return e}var ud=(0,E.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function dd(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function fd(...e){return t=>{let n=!1,r=e.map(e=>{let r=dd(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{width:t,height:n}=e?.getBoundingClientRect()||{};return[t/e?.offsetWidth||1,n/e?.offsetHeight||1]},hd=e=>{let{left:t,top:n}=e.getBoundingClientRect(),r=e;for(;r=r.parentElement||r.parentNode?.host;){let{scrollLeft:e,scrollTop:i}=r;if(e||i){let[a,o]=md(r);t+=e*a,n+=i*o}if(getComputedStyle(r).position===`fixed`)break}let[i,a]=md(e.offsetParent);return[t/i,n/a]},gd=class extends E.Component{getSnapshotBeforeUpdate(e){let t=this.props.getElement();if(Jo(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Jo(e)&&e.offsetWidth||0,r=Jo(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction,a.point=hd(t)}return null}componentDidUpdate(){}render(){return this.props.children}};function _d({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a,popNode:o}){let s=(0,E.useId)(),c=(0,E.useRef)(null),l=(0,E.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:u}=(0,E.useContext)(ud),d=pd(c,a===!1?void 0:e.props?.ref??e?.ref),f=()=>c.current||o?.current?.current,p=e=>{let{width:t,height:i,top:a,left:o,right:c,bottom:u,direction:d}=l.current,f=d===`rtl`,p=n===`left`?f?`right:${c}`:`left:${o}`:f?`left:${o}`:`right:${c}`,m=r===`bottom`?`bottom:${u}`:`top:${a}`;e?.insertRule(`[data-motion-pop-id="${s}"]{position:absolute!important;width:${t}px!important;height:${i}px!important;${p}px!important;${m}px!important}`)};return(0,E.useInsertionEffect)(()=>{let{width:e,height:n}=l.current,r=f();if(t||a===!1||!r||!e||!n)return;r.dataset.motionPopId=s;let o=r.ownerDocument,c=o.createElement(`style`);u&&(c.nonce=u);let d=i??o.head;d.appendChild(c),p(c.sheet);let m=0,h=0;return js.setup(()=>{let[e,t]=hd(r);m=l.current.point[0]-e,h=l.current.point[1]-t}),js.read(()=>{let{sheet:e}=c;if(!e||!m&&!h)return;let t=l.current;t.left+=m,t.right-=m,t.top+=h,t.bottom-=h,e.deleteRule(0),p(e)}),()=>{r.removeAttribute(`data-motion-pop-id`),d.contains(c)&&d.removeChild(c)}},[t]),(0,X.jsx)(gd,{isPresent:t,getElement:f,sizeRef:l,pop:a,children:a===!1?e:E.cloneElement(e,{ref:d})})}var vd=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=ft(yd),d=(0,E.useId)(),f=(0,E.useRef)(),p=(0,E.useRef)(n),m=(0,E.useRef)(r);pt(()=>{p.current=n,m.current=r});let h=!0,g=(0,E.useMemo)(()=>(h=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:(e,t)=>(u.set(e,!1),t&&t.parent?.presenceContext?.id!==d&&(f.current=t),()=>{u.delete(e),!p.current&&!u.size&&m.current?.()})}),[n,u,r]);return a&&h&&(g={...g}),(0,E.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),E.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,X.jsx)(_d,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,popNode:f,children:e}),(0,X.jsx)(mt.Provider,{value:g,children:e})};function yd(){return new Map}function bd(e=!0){let t=(0,E.useContext)(mt);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,E.useId)();(0,E.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,E.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}function xd(){return Sd((0,E.useContext)(mt))}function Sd(e){return e===null||e.isPresent}var Cd=e=>e.key||``;function wd(e){let t=[];return E.Children.forEach(e,e=>{(0,E.isValidElement)(e)&&t.push(e)}),t}var Td=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=bd(o),f=(0,E.useMemo)(()=>wd(e),[e]),p=o&&!u?[]:f.map(Cd),m=(0,E.useRef)(!0),h=ft(()=>new Map),g=(0,E.useRef)(new Set),[_,v]=(0,E.useState)(f),[y,b]=(0,E.useState)(f);pt(()=>{o&&!u&&!y.length&&d?.()},[u,o,y.length,d]);let x=(0,E.useRef)();(0,E.useEffect)(()=>()=>{let e=x.current;x.current=void 0,e?.()},[y]),pt(()=>{m.current=!1;for(let e=0;eh.get(Cd(e)))?e=f:a===`wait`&&(e=S),b(wd(e)),v(f),null}let{forceRender:C}=(0,E.useContext)(dt);return(0,X.jsx)(X.Fragment,{children:y.map(e=>{let _=Cd(e),b=o&&!u?!1:f===y||p.includes(_);return(0,X.jsx)(vd,{isPresent:b,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:b?void 0:()=>{if(g.current.has(_))return;if(h.has(_))g.current.add(_),h.set(_,!0);else return;let e=!0;h.forEach(t=>{t||(e=!1)}),e&&(C?.(),v([]),o&&d?.(),x.current=r)},anchorX:s,anchorY:c,children:e},_)})})},Ed=(0,E.createContext)({strict:!1}),Dd={animation:[`variants`,...wl],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Od=!1;function kd(){if(Od)return;let e={};for(let t in Dd)e[t]={isEnabled:e=>Dd[t].some(t=>!!e[t])};Fl(e),Od=!0}function Ad(){return kd(),Il()}function jd(e){let t=Ad();for(let n in e)t[n]={...t[n],...e[n]};Fl(t)}function Md({children:e,...t}){let n=(0,E.useContext)(ud);t={...n,...t},t.transition=lo(t.transition,n.transition),t.isStatic=ft(()=>t.isStatic);let r=(0,E.useMemo)(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations,t.isValidProp]);return(0,X.jsx)(ud.Provider,{value:r,children:e})}var Nd=(0,E.createContext)({});function Pd(e,t){if(El(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Cl(t)?t:void 0,animate:Cl(n)?n:void 0}}return e.inherit===!1?{}:t}function Fd(e){let{initial:t,animate:n}=Pd(e,(0,E.useContext)(Nd));return(0,E.useMemo)(()=>({initial:t,animate:n}),[Id(t),Id(n)])}function Id(e){return Array.isArray(e)?e.join(` `):e}var Ld=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Rd(e,t,n){for(let r in t)!V(t[r])&&!Bl(r,n)&&(e[r]=t[r])}function zd({transformTemplate:e},t){return(0,E.useMemo)(()=>{let n=Ld();return ts(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Bd(e,t){let n=e.style||{},r={};return Rd(r,n,e),Object.assign(r,zd(e,t)),r}function Vd(e,t){let n={},r=Bd(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Hd=()=>({...Ld(),attrs:{}});function Ud(e,t,n,r){let i=(0,E.useMemo)(()=>{let n=Hd();return os(n,t,Y(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};return Rd(t,e.style,e),{...i,style:{...t,...i.style}}}return i}var Wd=new Set(`animate.exit.variants.initial.style.values.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Gd(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Wd.has(e)}function Kd(e,t){return e.startsWith(`on`)?!Gd(e):t?.(e)??!Gd(e)}function qd(e,t,n,r){let i={};for(let a in e)a===`values`&&typeof e.values==`object`||V(e[a])||(Kd(a,r)||n===!0&&Gd(a)||!t&&!Gd(a)||e.draggable&&a.startsWith(`onDrag`))&&(i[a]=e[a]);return i}var Jd=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Yd(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Jd.indexOf(e)>-1||/[A-Z]/u.test(e))}function Xd(e,t,n,{latestValues:r},i,a=!1,o,s){let c=(o??Yd(e)?Ud:Vd)(t,r,i,e),l=qd(t,typeof e==`string`,a,s),u=e===E.Fragment?{}:{...l,...c,ref:n},{children:d}=t,f=(0,E.useMemo)(()=>V(d)?d.get():d,[d]);return(0,E.createElement)(e,{...u,children:f})}function Zd({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Qd(n,r,i,e),renderState:t()}}function Qd(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=zs(a[e]);let{initial:o,animate:s}=e,c=El(e),l=Dl(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Sl(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{let r=(0,E.useContext)(Nd),i=(0,E.useContext)(mt),a=()=>Zd(e,t,r,i);return n?a():ft(a)},ef=$d({scrapeMotionValuesFromProps:Vl,createRenderState:Ld}),tf=$d({scrapeMotionValuesFromProps:nd,createRenderState:Hd}),nf=Symbol.for(`motionComponentSymbol`);function rf(e,t,n){let r=(0,E.useRef)(n);(0,E.useInsertionEffect)(()=>{r.current=n});let i=(0,E.useRef)(null);return(0,E.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}var af=(0,E.createContext)({});function of(e,t,n,r,i,a){let{visualElement:o}=(0,E.useContext)(Nd),s=(0,E.useContext)(Ed),c=(0,E.useContext)(mt),l=(0,E.useContext)(ud),u=l.reducedMotion,d=l.skipAnimations,f=(0,E.useRef)(null),p=(0,E.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,E.useContext)(af);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&i.create(m,n,h),(0,E.useInsertionEffect)(()=>{m&&m.props!==n&&m.update(n,c)});let g=n[Po],_=(0,E.useRef)(!!g&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return pt(()=>{p.current&&m&&(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),pt(()=>{p.current=!0,m&&(window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),_.current&&m.animationState&&m.animationState.animateChanges())}),(0,E.useEffect)(()=>{m&&(!_.current&&m.animationState&&m.animationState.animateChanges(),_.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),!1),m.enteringChildren=void 0)}),m}function sf(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&jd(r);let a=n?n===`svg`:Yd(e),o=a?tf:ef;function s(n,s){let c,l=cf(n);ft(()=>!!yl.current?.sharedNodes.get(l)?.lead&&n.initial)&&(n={...n,initial:!1});let u={...(0,E.useContext)(ud),...n,layoutId:l},{isStatic:d,isValidProp:f}=u,p=Fd(n),m=o(n,d);if(!d&&typeof window<`u`){lf(u,r);let t=uf(u);p.visualElement=of(e,m,u,i,t.ProjectionNode,a),(t.isEnabled||p.visualElement?.projection?.options.layoutId)&&(c=t.MeasureLayout)}return(0,X.jsxs)(Nd.Provider,{value:p,children:[c&&p.visualElement?(0,X.jsx)(c,{visualElement:p.visualElement,...u}):null,Xd(e,n,rf(m,p.visualElement,s),m,d,t,a,f)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,E.forwardRef)(s);return c[nf]=e,c}function cf({layoutId:e}){let t=(0,E.useContext)(dt).id;return t&&e!==void 0?t+`-`+e:e}function lf(e,t){(0,E.useContext)(Ed).strict}function uf(e){let{drag:t,layout:n}=Ad();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:r.MeasureLayout,isEnabled:t?.isEnabled(e)||n?.isEnabled(e),ProjectionNode:r.ProjectionNode}}function df(e,t){if(typeof Proxy>`u`)return sf;let n=new Map,r=(n,r)=>sf(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,sf(a,void 0,e,t)),n.get(a))})}var ff=(e,t)=>t.isSVG??Yd(e)?new rd(t):new Ul(t,{allowProjection:e!==E.Fragment}),pf=class extends q{constructor(e){super(e),e.animationState||=sd(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Sl(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Z=0,mf={animation:{Feature:pf},exit:{Feature:class extends q{constructor(){super(...arguments),this.id=Z++}update(){let{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;let{isPresent:r,onExitComplete:i}=e,a=t?.isPresent;if(r===a)return;if(r&&a===!1){if(this.exit===!0){let{initial:e}=this.node.getProps();if(e&&!Array.isArray(e)){let{transition:t,transitionEnd:n,...r}=To(this.node,e)||{};for(let e in r)this.node.getValue(e)?.jump(r[e])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive(`exit`,!1);this.exit=void 0;return}let o=this.exit=n.setActive(`exit`,!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id,this.node))}unmount(){}}}},hf=class extends q{constructor(e){super(e),this.removeGroupControls=St,this.removeListeners=St,this.controls=new Ru(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||St}update(){let{dragControls:e,drag:t}=this.node.getProps(),{dragControls:n,drag:r}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls))),r&&!t&&this.controls.stop(void 0,void 0,r)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},gf=e=>(t,n)=>{e&&z.update(()=>e(t,n),!1,!0)},_f=class extends q{constructor(){super(...arguments),this.removePointerDownListener=St}onPointerDown(e){this.session=new uu(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:gf(e),onStart:gf(t),onMove:gf(n),onEnd:(e,t)=>{delete this.session,r&&z.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=ql(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}},vf=!1,yf=({layout:e,layoutDependency:t,layoutAnchor:n})=>({layout:e,layoutDependency:t,layoutAnchor:n,animationType:typeof e==`string`?e:`both`}),bf=(e,t)=>{let{snapshot:n}=e,r=e.getStack();r?.remove(e);let i=r?.lead;if(r?.prevLead===e&&i.resumeFrom===e&&(i.resumeFrom=i.currentAnimation=e.resumingFrom=void 0),e.options.layoutId=t,!t)e.needsShow=!0;else return e.root.registerSharedNode(t,e),()=>{let{resumeFrom:t}=e;t?.isPresent!==!1&&e.getStack().members.includes(t)&&(t.hide(),e.resumeFrom=void 0,e.snapshot=n)}},xf=class extends E.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group?.add(i),r&&n?.register?.(i),vf&&i.root.didUpdate(),i.options.layoutId!==r&&bf(i,r)?.(),i.addEventListener(`animationComplete`,()=>this.safeToRemove()),i.setOptions({...i.options,...yf(this.props),onExitComplete:()=>this.safeToRemove()})),zc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,layoutId:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:o}=r;return o&&(o.isPresent=a,this.takeOver=e.layoutId===n?void 0:(o.willUpdate(),bf(o,n)),o.setOptions({...o.options,...yf(this.props)}),vf=!0,i||e.layoutDependency!==t||t===void 0||e.isPresent!==a?o.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?o.promote():o.relegate()||z.postRender(()=>{o.getStack()?.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(this.takeOver?.(),e.root.didUpdate(),js.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;vf=!0,r&&(r.scheduleCheckAfterUnmount(),t.group?.remove(r),n?.deregister?.(r))}safeToRemove(){this.props.safeToRemove?.()}render(){return null}};function Sf(e){let[t,n]=bd(),r=(0,E.useContext)(dt);return(0,X.jsx)(xf,{...e,layoutGroup:r,switchLayoutGroup:(0,E.useContext)(af),isPresent:t,safeToRemove:n})}var Cf={pan:{Feature:_f},drag:{Feature:hf,ProjectionNode:bl,MeasureLayout:Sf}};function wf(e,t,n,r){let{props:i}=e,a=`while`+n;e.animationState&&i[a]&&e.animationState.setActive(a,r===`Start`);let o=i[`on`+n+r];o&&z.postRender(()=>o(t,Gl(t)))}var Tf=class extends q{mount(){let{current:e}=this.node;e&&(this.unmount=qu(e,(e,t)=>(wf(this.node,t,`Hover`,`Start`),e=>wf(this.node,e,`Hover`,`End`))))}unmount(){}},Ef=class extends q{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}e&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Ct(W(this.node.current,`focus`,()=>this.onFocus()),W(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Df(e,t,n){e.current instanceof HTMLButtonElement&&e.current.disabled||wf(e,t,`Tap`,n)}var Of=class extends q{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=ed(e,(e,t)=>(Df(this.node,t,`Start`),(e,{success:t})=>Df(this.node,e,t?``:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},kf=new WeakMap,Af=new WeakMap,jf=e=>{let t=kf.get(e.target);t&&t(e)},Mf=e=>{e.forEach(jf)};function Nf({root:e,...t}){let n=e||document;Af.has(n)||Af.set(n,{});let r=Af.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Mf,{root:e,...t})),r[i]}function Pf(e,t,n){let r=Nf(t);return kf.set(e,n),r.observe(e),()=>{kf.delete(e),r.unobserve(e)}}var Ff={some:0,all:1},If=class extends q{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Ff[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Pf(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Lf(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Lf({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Rf=df(Object.assign({},mf,{inView:{Feature:If},tap:{Feature:Of},focus:{Feature:Ef},hover:{Feature:Tf}},Cf,{layout:{ProjectionNode:bl,MeasureLayout:Sf}}),ff),zf=h(),Bf=_(),Vf=Rf,Q=1e-4;function Hf(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):0}function Uf(e){switch(e){case`navigation`:return .065;case`focus`:return .11;case`select`:return .16;case`success`:return .24;case`warning`:return .3;case`error`:return .34;case`connect`:case`disconnect`:return .5}}function Wf(){if(typeof window>`u`)return null;let e=window;return e.AudioContext??e.webkitAudioContext??null}function Gf(){return Wf()!==null}var Kf=class{context=null;master=null;state=`idle`;isMuted;masterVolume;pauseWhenHidden;manuallySuspended=!1;hiddenSuspended=!1;listenerAttached=!1;startPromise=null;sources=new Set;toneSources=new Map;lastCueAt=new Map;constructor(e={}){this.isMuted=e.muted??!1,this.masterVolume=Hf(e.volume??.42),this.pauseWhenHidden=e.pauseWhenHidden??!0}get supported(){return this.context!==null||Gf()}get muted(){return this.isMuted}get status(){return this.state}get volume(){return this.masterVolume}start(e){return e?.muted!==void 0&&this.setMuted(e.muted),this.state===`disposed`?Promise.resolve(!1):this.context?this.resume():(this.startPromise||=this.initialize().finally(()=>{this.startPromise=null}),this.startPromise)}setMuted(e){this.state!==`disposed`&&(this.isMuted=e,this.applyMasterGain(.055))}toggleMuted(){return this.setMuted(!this.isMuted),this.isMuted}setVolume(e){this.state!==`disposed`&&(this.masterVolume=Hf(e),this.applyMasterGain(.07))}cue(e,t=`neutral`){let n=this.playableContext(e);if(!n||!this.master)return!1;Jf(e);let r=n.currentTime+.005;switch(e){case`focus`:this.tone(n,r,.16,523.25,587.33,.022,0,`sine`);break;case`select`:[392,523.25,659.25].forEach((e,t)=>{this.tone(n,r+t*.027,.3+t*.04,e,e*1.006,.018-t*.002,(t-1)*.14,t===1?`triangle`:`sine`)});break;case`navigation`:{let e=Yf(t);this.tone(n,r,.11,e.start,e.end,.02,e.pan,`sine`);break}case`warning`:this.tone(n,r,.21,246.94,196,.027,-.08,`triangle`),this.tone(n,r+.09,.25,220,174.61,.022,.08,`sine`);break;case`success`:this.tone(n,r,.26,329.63,493.88,.021,-.08,`sine`),this.tone(n,r+.06,.32,493.88,659.25,.017,.08,`triangle`);break;case`error`:this.tone(n,r,.28,196,146.83,.026,-.08,`triangle`),this.tone(n,r+.075,.3,164.81,123.47,.02,.08,`sine`);break;case`connect`:this.tone(n,r,.24,293.66,392,.018,-.08,`sine`),this.tone(n,r+.055,.3,440,587.33,.014,.08,`triangle`);break;case`disconnect`:this.tone(n,r,.24,392,293.66,.018,-.08,`triangle`),this.tone(n,r+.055,.3,261.63,196,.014,.08,`sine`)}return!0}playTone(e,t,n,r){let i=this.context;if(!i||!this.master||this.state!==`running`||this.isMuted||this.masterVolume<=0||!Number.isFinite(e)||e<20||e>2e4||!Number.isFinite(t)||t<1||t>6e4||n!==void 0&&(!Number.isFinite(n)||n<0))return!1;let a=n===void 0?.003:n/1e3;return this.tone(i,i.currentTime+a,t/1e3,e,e,.024,0,`square`,r),!0}stopTone(e,t=0){let n=this.context,r=e.trim();if(!n||n.state===`closed`||this.state===`disposed`||!r||!Number.isFinite(t)||t<0)return!1;let i=this.toneSources.get(r);if(!i?.size)return!1;let a=n.currentTime+t/1e3;for(let e of i)try{e.stop(a)}catch{}return this.toneSources.delete(r),!0}async suspend(){let e=this.context;if(e&&this.state!==`disposed`){if(this.manuallySuspended=!0,this.hiddenSuspended=!1,e.state===`running`)try{await e.suspend()}catch{}e===this.context&&(this.state=`paused`)}}async resume(){let e=this.context;if(!e||e.state===`closed`||this.state===`disposed`)return!1;if(typeof document<`u`&&document.hidden)return this.state=`paused`,!1;this.manuallySuspended=!1,this.hiddenSuspended=!1;try{e.state!==`running`&&await e.resume()}catch{return this.state=`paused`,!1}let t=e.state===`running`;return this.state=t?`running`:`paused`,t&&this.applyMasterGain(.12),t}async dispose(){if(this.state===`disposed`)return;this.state=`disposed`,this.detachVisibilityListener();for(let e of this.sources){try{e.stop()}catch{}try{e.disconnect()}catch{}}this.sources.clear(),this.toneSources.clear();let e=this.context;if(this.context=null,this.master=null,e&&e.state!==`closed`)try{await e.close()}catch{}}async initialize(){let e=Wf();if(!e)return this.state=`unsupported`,!1;this.state=`starting`;let t;try{t=new e({latencyHint:`interactive`})}catch{try{t=new e}catch{return this.state=`unsupported`,!1}}this.context=t;let n=t.createGain(),r=t.createDynamicsCompressor();n.gain.setValueAtTime(0,t.currentTime),r.threshold.setValueAtTime(-22,t.currentTime),r.knee.setValueAtTime(16,t.currentTime),r.ratio.setValueAtTime(4,t.currentTime),r.attack.setValueAtTime(.012,t.currentTime),r.release.setValueAtTime(.24,t.currentTime),n.connect(r),r.connect(t.destination),this.master=n,this.attachVisibilityListener(),t.onstatechange=()=>{t===this.context&&this.state!==`disposed`&&(this.state=t.state===`running`?`running`:`paused`)};try{t.state!==`running`&&await t.resume()}catch{return this.state=`paused`,!1}let i=t.state===`running`;return this.state=i?`running`:`paused`,i&&this.applyMasterGain(.32),i}playableContext(e){let t=this.context;if(!t||this.state!==`running`||this.isMuted||this.masterVolume<=0)return null;let n=Uf(e),r=this.lastCueAt.get(e)??-1/0;return t.currentTime-r{if(this.sources.delete(l),m){let e=this.toneSources.get(m);e?.delete(l),e?.size===0&&this.toneSources.delete(m)}l.disconnect(),u.disconnect(),d?.disconnect()},{once:!0}),l.start(t),l.stop(p+.025)}applyMasterGain(e){let t=this.context,n=this.master;if(!t||!n||t.state===`closed`)return;let r=t.currentTime,i=this.isMuted?0:this.masterVolume;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(i,r+Math.max(.005,e))}attachVisibilityListener(){this.pauseWhenHidden&&!this.listenerAttached&&typeof document<`u`&&(document.addEventListener(`visibilitychange`,this.onVisibilityChange),this.listenerAttached=!0)}detachVisibilityListener(){this.listenerAttached&&typeof document<`u`&&(document.removeEventListener(`visibilitychange`,this.onVisibilityChange),this.listenerAttached=!1)}onVisibilityChange=()=>{let e=this.context;e&&this.state!==`disposed`&&(document.hidden?e.state===`running`&&!this.manuallySuspended&&(this.hiddenSuspended=!0,e.suspend().then(()=>{this.state!==`disposed`&&(this.state=`paused`)}).catch(()=>void 0)):this.hiddenSuspended&&!this.manuallySuspended&&(this.hiddenSuspended=!1,e.resume().then(()=>{e.state===`running`&&this.state!==`disposed`&&(this.state=`running`,this.applyMasterGain(.18))}).catch(()=>{this.state=`paused`})))}};function qf(e){return e===`select`?8:e===`success`?[10,22,14]:e===`warning`?[18,32,18]:e===`error`?[22,28,22]:e===`connect`?10:e===`disconnect`?[12,24,10]:null}function Jf(e){if(typeof navigator>`u`||typeof navigator.vibrate!=`function`||typeof document<`u`&&document.visibilityState!==`visible`)return;let t=qf(e);t!==null&&navigator.vibrate(t)}function Yf(e){switch(e){case`forward`:return{start:349.23,end:415.3,pan:0};case`backward`:return{start:349.23,end:293.66,pan:0};case`left`:return{start:329.63,end:369.99,pan:-.32};case`right`:return{start:329.63,end:369.99,pan:.32};case`up`:return{start:392,end:466.16,pan:0};case`down`:return{start:329.63,end:261.63,pan:0};default:return{start:329.63,end:369.99,pan:0}}}function Xf(e){return new Kf(e)}function Zf(e){return[e.port.instance_id||e.port.serial_number||e.port.name||`controller`,e.hello.build_hash??``,e.hello.build_timestamp||``].join(`|`)}var Qf=class{requestedGeneration=``;shouldRead(e,t){if(!e.connected||e.have_settings)return this.requestedGeneration=``,!1;if(!t)return!1;let n=Zf(e);return n!==this.requestedGeneration&&(this.requestedGeneration=n,!0)}},$f=class{start;stop;onError;onHoldingChange;active=!1;stopIssued=!1;startPromise=Promise.resolve();constructor(e,t,n,r){this.start=e,this.stop=t,this.onError=n,this.onHoldingChange=r}begin(){if(this.active)return!1;this.active=!0,this.stopIssued=!1,this.onHoldingChange(!0);let e=Promise.resolve().then(this.start);return this.startPromise=e,e.catch(e=>{this.onError(e),this.release()}),!0}release(e=!0){return!this.active||this.stopIssued?!1:(this.active=!1,this.stopIssued=!0,e&&this.onHoldingChange(!1),this.startPromise.catch(()=>void 0).then(this.stop).catch(this.onError),!0)}isHolding(){return this.active}};function ep(e){return e.filter(Number.isFinite)}function $(e,t){let n=ep(e);if(!n.length)return t===`temperature`?[20,60]:t===`supply`?[0,13]:[0,1];let r=Math.min(...n),i=Math.max(...n);if(t===`supply`)return[0,Math.max(13,Math.ceil(i*1.05*2)/2)];if(t===`temperature`)return[Math.min(20,Math.floor(r-5)),Math.max(60,Math.ceil(i+3))];if(t===`current`)return[0,Math.max(100,Math.ceil(Math.max(0,i)*1.2/50)*50)];if(i>r)return[r,i];let a=Math.max(1,Math.abs(r)*.05);return[r-a,i+a]}function tp(e,t=`auto`,n=300,r=92){let i=ep(e),a=i.length>1?i:i.length===1?[i[0],i[0]]:[0,0],[o,s]=$(a,t),c=Math.max(2**-52,s-o);return a.map((e,t)=>({x:t/Math.max(1,a.length-1)*n,y:r-8-Math.max(0,Math.min(1,(e-o)/c))*(r-20)}))}function np(e){let t=typeof navigator>`u`?void 0:navigator,n=e??`${t?.userAgentData?.platform??``} ${t?.platform??``} ${t?.userAgent??``}`;return/mac|iphone|ipad|ipod/i.test(n)?`⌘`:`Ctrl`}function rp(e){return np(e)===`⌘`?`Meta+K`:`Control+K`}function ip(e,t){return typeof document<`u`&&document.documentElement.lang.toLowerCase().startsWith(`fa`)?t:e}function ap({icon:e,size:t=18}){return(0,X.jsx)(e,{"aria-hidden":`true`,size:t,strokeWidth:1.8})}function op({fallback:e}){let[t,n]=(0,E.useState)(!1);return t?(0,X.jsx)(`span`,{"aria-hidden":`true`,children:e}):(0,X.jsx)(`img`,{src:`/favicon.svg`,alt:``,onError:()=>n(!0)})}function sp({active:e,disabled:t,label:n,onToggle:r}){return(0,X.jsx)(`button`,{type:`button`,className:`relay-switch__toggle`,"aria-label":n,"aria-pressed":e,disabled:t,onClick:r,children:(0,X.jsx)(`i`,{"aria-hidden":`true`,children:(0,X.jsx)(`b`,{})})})}function cp({keys:e,separator:t=`+`}){let n=e.map(e=>Array.isArray(e)?e.join(ip(` or `,` یا `)):e).join(t===`+`?ip(` plus `,` به‌علاوهٔ `):` ${t} `);return(0,X.jsx)(`span`,{className:`key-combo`,dir:`ltr`,"aria-label":n,children:e.map((e,n)=>(0,X.jsxs)(`span`,{className:`key-combo__group`,children:[n>0&&(0,X.jsx)(`span`,{className:`key-combo__separator`,"aria-hidden":`true`,children:t}),(Array.isArray(e)?e:[e]).map((e,t)=>(0,X.jsxs)(`span`,{className:`key-combo__key`,children:[t>0&&(0,X.jsx)(`span`,{className:`key-combo__alternative`,"aria-hidden":`true`,children:`/`}),(0,X.jsx)(`kbd`,{children:e})]},e))]},`${n}-${Array.isArray(e)?e.join(`-`):e}`))})}var lp=(0,E.forwardRef)(function({icon:e,tone:t=`secondary`,busy:n,compact:r,children:i,className:a=``,disabled:o,...s},c){return(0,X.jsxs)(`button`,{className:`button button--${t}${r?` button--compact`:``} ${a}`,disabled:o||n,ref:c,...s,children:[(0,X.jsx)(`span`,{className:`button__wash`,"aria-hidden":`true`}),n?(0,X.jsx)(Me,{className:`spin`,"aria-hidden":`true`,size:17}):e?(0,X.jsx)(ap,{icon:e,size:17}):null,i?(0,X.jsx)(`span`,{children:i}):null]})});function up({onHoldStart:e,onHoldStop:t,onHoldError:n,disabled:r,className:i=``,children:a,...o}){let[s,c]=(0,E.useState)(!1),l=(0,E.useRef)(e),u=(0,E.useRef)(t),d=(0,E.useRef)(n);l.current=e,u.current=t,d.current=n;let f=(0,E.useRef)(null);f.current||=new $f(()=>l.current(),()=>u.current(),e=>d.current?.(e),c);let p=f.current;return(0,E.useEffect)(()=>{let e=()=>p.release(),t=()=>{document.visibilityState!==`visible`&&e()};return window.addEventListener(`blur`,e),window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),p.release(!1)}},[p]),(0,X.jsx)(lp,{...o,disabled:r,className:`${i} hold-action${s?` is-holding`:``}`,"aria-pressed":s,onPointerDown:e=>{e.button!==0||r||(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),p.begin())},onPointerUp:e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),p.release()},onPointerCancel:()=>p.release(),onPointerLeave:()=>p.release(),onLostPointerCapture:()=>p.release(),onKeyDown:e=>{e.key!==` `&&e.key!==`Enter`||e.repeat||r||(e.preventDefault(),p.begin())},onKeyUp:e=>{(e.key===` `||e.key===`Enter`)&&(e.preventDefault(),p.release())},"data-touch-mode":`hold`,onBlur:()=>p.release(),children:a})}function dp({icon:e,iconTone:t=`accent`,title:n,eyebrow:r,action:i,menu:a=[],children:o,className:s=``,id:c}){let l=`card-menu-${(0,E.useId)().replace(/:/g,``)}`,[u,d]=(0,E.useState)(!1),[f,p]=(0,E.useState)({left:0,top:0}),m=(0,E.useRef)(null),h=(0,E.useRef)(null),g=(0,E.useRef)(null),_=(0,E.useRef)(null),v=(e=!0)=>{d(!1),e&&window.requestAnimationFrame(()=>_.current?.focus())},y=(e,t,n)=>{_.current=n,p({left:e,top:t}),d(!0)};return(0,E.useLayoutEffect)(()=>{if(!u||!g.current)return;let e=g.current.getBoundingClientRect();p(t=>({left:Math.max(10,Math.min(t.left,window.innerWidth-e.width-10)),top:Math.max(10,Math.min(t.top,window.innerHeight-e.height-10))}))},[u]),(0,E.useEffect)(()=>{if(!u)return;let e=window.requestAnimationFrame(()=>g.current?.querySelector(`button:not(:disabled)`)?.focus()),t=e=>{!g.current?.contains(e.target)&&!h.current?.contains(e.target)&&v(!1)},n=()=>v(!1),r=e=>{let t=e.target;!g.current?.contains(t)&&!h.current?.contains(t)&&v(!1)},i=()=>{document.visibilityState!==`visible`&&v(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,r),document.addEventListener(`visibilitychange`,i),window.addEventListener(`resize`,n),window.addEventListener(`scroll`,n,!0),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,r),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`resize`,n),window.removeEventListener(`scroll`,n,!0)}},[u]),(0,X.jsxs)(`section`,{id:c,className:`card ${s}`,ref:m,tabIndex:a.length?0:void 0,onKeyDown:e=>{if(!a.length||!(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`))return;e.preventDefault();let t=m.current?.getBoundingClientRect();t&&y(t.right-12,t.top+44,m.current)},onContextMenu:a.length?e=>{e.preventDefault(),y(e.clientX,e.clientY,m.current)}:void 0,children:[(n||r||i||a.length>0)&&(0,X.jsxs)(`header`,{className:`card__header`,children:[(0,X.jsxs)(`div`,{className:`card__heading`,children:[e&&(0,X.jsx)(`span`,{className:`card__icon card__icon--${t}`,children:(0,X.jsx)(ap,{icon:e,size:18})}),(0,X.jsxs)(`div`,{className:`card__heading-copy`,children:[r&&(0,X.jsx)(`div`,{className:`eyebrow`,children:r}),n&&(0,X.jsx)(`h2`,{children:n})]})]}),(i||a.length>0)&&(0,X.jsxs)(`div`,{className:`card__action`,children:[i,a.length>0&&(0,X.jsx)(`button`,{ref:h,type:`button`,className:`card__menu-trigger`,"aria-label":ip(`Card actions`,`عملیات کارت`),"aria-haspopup":`menu`,"aria-controls":l,"aria-expanded":u,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();y(t.right,t.bottom+7,e.currentTarget)},children:(0,X.jsx)(ap,{icon:A,size:18})})]})]}),o,typeof document<`u`&&(0,zf.createPortal)((0,X.jsx)(Td,{children:u&&(0,X.jsx)(Vf.div,{id:l,ref:g,className:`card-menu`,role:`menu`,"aria-label":ip(`Card actions`,`عملیات کارت`),style:f,initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.14,ease:[.22,1,.36,1]},onKeyDown:e=>{let t=[...g.current?.querySelectorAll(`button:not(:disabled)`)??[]];if(!t.length)return;let n=t.indexOf(document.activeElement),r=n<0?0:n;e.key===`Escape`?(e.preventDefault(),v()):e.key===`Tab`?v(!1):[`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowDown`?(r+1)%t.length:(r-1+t.length)%t.length]?.focus())},children:a.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,"data-tone":e.tone??`normal`,onClick:()=>{v(),e.onSelect()},children:[e.icon&&(0,X.jsx)(ap,{icon:e.icon,size:17}),(0,X.jsx)(`span`,{children:e.label})]},e.label))})}),document.body)]})}function fp({eyebrow:e,title:t,detail:n,action:r}){return(0,X.jsxs)(`header`,{className:`section-title`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`eyebrow`,children:e}),(0,X.jsx)(`h1`,{children:t}),n&&(0,X.jsx)(`p`,{children:n})]}),r&&(0,X.jsx)(`div`,{className:`section-title__action`,children:r})]})}function pp({tone:e,children:t,pulse:n}){return(0,X.jsxs)(`span`,{className:`status-badge status-badge--${e}${n?` status-badge--pulse`:``}`,children:[(0,X.jsx)(`span`,{className:`status-badge__line`,"aria-hidden":`true`}),t]})}function mp({values:e,tone:t=`accent`,label:n,scale:r=`auto`}){let i=(0,E.useId)().replace(/:/g,``),a=tp(e,r,300,92).map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)},${e.y.toFixed(2)}`).join(` `),o=`${a} L300,92 L0,92 Z`;return(0,X.jsxs)(`svg`,{className:`sparkline sparkline--${t}`,viewBox:`0 0 300 92`,role:`img`,"aria-label":n,preserveAspectRatio:`none`,children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsxs)(`linearGradient`,{id:`fill-${i}`,x1:`0`,x2:`0`,y1:`0`,y2:`1`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`currentColor`,stopOpacity:`.28`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`,stopOpacity:`0`})]}),(0,X.jsxs)(`linearGradient`,{id:`line-${i}`,x1:`0`,x2:`1`,children:[(0,X.jsx)(`stop`,{offset:`0`,stopColor:`currentColor`,stopOpacity:`.4`}),(0,X.jsx)(`stop`,{offset:`.55`,stopColor:`currentColor`}),(0,X.jsx)(`stop`,{offset:`1`,stopColor:`currentColor`,stopOpacity:`.65`})]})]}),(0,X.jsx)(`path`,{className:`sparkline__grid`,d:`M0 24H300 M0 48H300 M0 72H300`}),(0,X.jsx)(Vf.path,{className:`sparkline__area`,d:o,fill:`url(#fill-${i})`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.7}}),(0,X.jsx)(Vf.path,{className:`sparkline__line`,d:a,fill:`none`,stroke:`url(#line-${i})`,initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{duration:.8,ease:[.22,1,.36,1]}})]})}function hp({icon:e,label:t,value:n,unit:r,values:i,tone:a,detail:o,scale:s=`auto`}){return(0,X.jsxs)(`article`,{className:`metric metric--${a}`,children:[(0,X.jsxs)(`div`,{className:`metric__top`,children:[(0,X.jsx)(`span`,{className:`metric__icon`,children:(0,X.jsx)(ap,{icon:e,size:19})}),(0,X.jsx)(`span`,{className:`metric__label`,children:t})]}),(0,X.jsxs)(`div`,{className:`metric__value`,dir:`ltr`,children:[(0,X.jsx)(`strong`,{children:n}),(0,X.jsx)(`span`,{children:r})]}),o&&(0,X.jsx)(`div`,{className:`metric__detail`,children:o}),(0,X.jsx)(mp,{values:i,tone:a,scale:s,label:ip(`${t} trend`,`روند ${t}`)})]})}function gp({checked:e,onChange:t,label:n,detail:r,disabled:i}){return(0,X.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:`toggle-row${i?` is-disabled`:``}`,disabled:i,onClick:()=>t(!e),children:[(0,X.jsxs)(`span`,{className:`toggle-row__copy`,children:[(0,X.jsx)(`strong`,{children:n}),r&&(0,X.jsx)(`small`,{children:r})]}),(0,X.jsx)(`span`,{className:`toggle`,"aria-hidden":`true`,children:(0,X.jsx)(`span`,{})})]})}function _p({label:e,value:t,min:n,max:r,step:i=1,unit:a,onChange:o,disabled:s,onEditStart:c,onEditEnd:l}){let u=(0,E.useId)(),[d,f]=(0,E.useState)(String(t));(0,E.useEffect)(()=>f(String(t)),[t]);let p=(t-n)/Math.max(1,r-n)*100,m=()=>{let e=Number(d);if(!Number.isFinite(e)){f(String(t));return}let i=Math.min(r,Math.max(n,e));f(String(i)),o(i)};return(0,X.jsxs)(`div`,{className:`range-field${s?` is-disabled`:``}`,children:[(0,X.jsxs)(`span`,{className:`range-field__label`,children:[(0,X.jsx)(`label`,{htmlFor:u,children:(0,X.jsx)(`strong`,{children:e})}),(0,X.jsxs)(`span`,{className:`range-field__value`,dir:`ltr`,children:[(0,X.jsx)(`input`,{className:`range-field__number`,type:`number`,value:d,min:n,max:r,step:i,disabled:s,"aria-label":typeof e==`string`?ip(`${e} exact value`,`مقدار دقیق ${e}`):ip(`Exact value`,`مقدار دقیق`),onInput:e=>f(e.currentTarget.value),onFocus:c,onBlur:()=>{m(),l?.()},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}}),a&&(0,X.jsx)(`span`,{children:a})]})]}),(0,X.jsx)(`input`,{id:u,type:`range`,value:t,min:n,max:r,step:i,disabled:s,style:{"--range":`${p}%`},onPointerDown:c,onPointerUp:l,onPointerCancel:l,onLostPointerCapture:l,onBlur:l,onKeyDown:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&c?.()},onKeyUp:l,onChange:e=>o(Number(e.target.value))})]})}function vp({value:e,options:t,onChange:n,label:r}){return(0,X.jsx)(`div`,{className:`segmented`,role:`radiogroup`,"aria-label":r,children:t.map(t=>(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t.value===e,className:t.value===e?`is-active`:``,onClick:()=>n(t.value),children:[t.icon&&(0,X.jsx)(ap,{icon:t.icon,size:16}),(0,X.jsx)(`span`,{children:t.label})]},t.value))})}function yp({label:e,hint:t,error:n,success:r,action:i,id:a,"aria-describedby":o,...s}){let c=(0,E.useId)(),l=a||`field-${c.replace(/:/g,``)}`,u=`${l}-message`,d=n||r||t,f=!!t&&!n&&!r;return(0,X.jsxs)(`div`,{className:`text-field${n?` is-invalid`:r?` is-valid`:``}`,children:[(0,X.jsx)(`label`,{htmlFor:l,children:e}),(0,X.jsxs)(`div`,{className:`text-field__control`,children:[(0,X.jsx)(`input`,{id:l,"aria-describedby":[o,d?u:``].filter(Boolean).join(` `)||void 0,"aria-invalid":n?!0:void 0,...s}),i&&(0,X.jsx)(`div`,{className:`text-field__action`,children:i})]}),d&&(0,X.jsx)(`small`,{id:u,className:`text-field__message${f?` text-field__message--contextual`:``}`,role:n?`alert`:`status`,children:d})]})}function bp({icon:e,title:t,detail:n,action:r}){return(0,X.jsxs)(`div`,{className:`empty-state`,children:[(0,X.jsx)(`span`,{className:`empty-state__icon`,children:(0,X.jsx)(ap,{icon:e,size:25})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:t}),(0,X.jsx)(`p`,{children:n})]}),r]})}function xp({label:e,value:t,mono:n,tone:r}){return(0,X.jsxs)(`div`,{className:`data-row`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(`strong`,{className:`${n?`mono`:``}${r?` text-${r}`:``}`,children:t})]})}function Sp({icon:e,label:t,active:n,badge:r,onClick:i}){return(0,X.jsxs)(`button`,{className:`nav-button${n?` is-active`:``}`,onClick:i,"aria-label":t,"aria-current":n?`page`:void 0,children:[(0,X.jsx)(`span`,{className:`nav-button__icon`,children:(0,X.jsx)(ap,{icon:e,size:20})}),(0,X.jsx)(`span`,{className:`nav-button__label`,children:t}),r&&(0,X.jsx)(`span`,{className:`nav-button__badge`,children:r}),(0,X.jsx)(_e,{className:`nav-button__chevron`,"aria-hidden":`true`,size:15})]})}function Cp(e){if(!e?.isConnected)return!1;let t=e.querySelector(`h1`)??e;return t.dataset.routeFocusTarget=``,t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus({preventScroll:!0}),!0}function wp({focusOnEnter:e,children:t}){let n=(0,E.useRef)(null),r=xd(),i=(0,E.useRef)(e);return(0,X.jsx)(Vf.div,{ref:n,className:`page`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.18,ease:`easeOut`},onAnimationComplete:()=>{r&&i.current&&Cp(n.current)},children:t})}function Tp({pageKey:e,children:t}){let n=(0,E.useRef)(!1);return(0,E.useEffect)(()=>{n.current=!0},[]),(0,X.jsx)(Td,{mode:`wait`,initial:!1,children:(0,X.jsx)(wp,{focusOnEnter:n.current,children:t},e)})}function Ep({open:e,progress:t,locale:n,productTitle:r,productShortName:i,productTagline:a,onEnter:o}){let s=t>=100,c=t<34?n===`fa`?`بارگذاری هویت سامانه`:`Loading system identity`:t<68?n===`fa`?`برقراری مسیر کنترل`:`Establishing control route`:t<96?n===`fa`?`همگام‌سازی وضعیت میزبان`:`Synchronizing host state`:n===`fa`?`مرکز کنترل آماده است`:`Control center is ready`;return(0,X.jsx)(Td,{children:e&&(0,X.jsxs)(Vf.section,{className:`boot-gate`,role:`dialog`,"aria-modal":`true`,"aria-busy":!s,"aria-labelledby":`boot-title`,initial:{opacity:1},exit:{opacity:0},transition:{duration:.28,ease:`easeOut`},children:[(0,X.jsxs)(`div`,{className:`boot-fuji`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`boot-fuji__rear`}),(0,X.jsx)(`span`,{className:`boot-fuji__face`}),(0,X.jsx)(`span`,{className:`boot-fuji__snow`}),(0,X.jsx)(`span`,{className:`boot-fuji__trace`})]}),(0,X.jsxs)(`div`,{className:`boot-identity`,children:[(0,X.jsx)(`div`,{className:`brand__mark`,"aria-hidden":`true`,children:(0,X.jsx)(op,{fallback:i})}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`span`,{children:[r.toUpperCase(),` / `,a]}),(0,X.jsx)(`h1`,{id:`boot-title`,children:n===`fa`?`مرکز کنترل یکپارچه`:r})]})]}),(0,X.jsxs)(`div`,{className:`boot-status`,"aria-live":`polite`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:c}),(0,X.jsxs)(`b`,{dir:`ltr`,children:[Math.round(t).toString().padStart(2,`0`),`%`]})]}),(0,X.jsx)(`div`,{className:`boot-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(t),children:(0,X.jsx)(`span`,{style:{inlineSize:`${t}%`}})})]}),(0,X.jsxs)(`div`,{className:`boot-entry${s?` is-ready`:``}`,inert:!s||void 0,children:[(0,X.jsx)(lp,{tone:`primary`,icon:se,disabled:!s,onClick:()=>o(!0),children:n===`fa`?`ورود با نشانه‌های صوتی`:`Enter with audio cues`}),(0,X.jsx)(lp,{icon:it,disabled:!s,onClick:()=>o(!1),children:n===`fa`?`ورود بی‌صدا`:`Enter quietly`})]})]})})}function Dp({open:e,locale:t,onClose:n}){let r=t===`fa`?`میانبرهای مرکز کنترل`:`Control center shortcuts`,i=np(),a=t===`fa`?[{keys:[i,`K`],detail:`فرمان‌ها و صفحه‌ها`},{keys:[`Alt`,`1…8`],detail:`رفتن مستقیم به صفحه`},{keys:[`G`,[`D`,`C`,`B`,`V`,`W`,`E`,`S`]],separator:`سپس`,detail:`رفتن به داشبورد، کنترلر، میزکار تجهیزات، دستگاه، فضای داده، رویدادها یا تنظیمات`},{keys:[i,`Shift`,[`←`,`→`]],detail:`صفحهٔ کناری در جهت دیداری`},{keys:[`?`],detail:`نمایش یا بستن این راهنما`},{keys:[`M`],detail:`قطع یا وصل نشانه‌های صوتی`},{keys:[`Esc`],detail:`بستن لایهٔ فعال`}]:[{keys:[i,`K`],detail:`Commands and pages`},{keys:[`Alt`,`1…8`],detail:`Open a page directly`},{keys:[`G`,[`D`,`C`,`B`,`V`,`W`,`E`,`S`]],separator:`then`,detail:`Go to dashboard, controls, peripheral workbench, device, data workspace, events, or settings`},{keys:[i,`Shift`,[`←`,`→`]],detail:`Adjacent page in the visual direction`},{keys:[`?`],detail:`Show or close this guide`},{keys:[`M`],detail:`Mute or enable interaction cues`},{keys:[`Esc`],detail:`Close the active layer`}];return(0,X.jsx)(Td,{children:e&&(0,X.jsxs)(Vf.div,{className:`hotkey-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`modal-backdrop`,"aria-label":t===`fa`?`بستن راهنمای صفحه‌کلید`:`Close keyboard guide`,onClick:n}),(0,X.jsxs)(Vf.section,{className:`hotkey-help`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`hotkey-help-title`,initial:{opacity:0,scale:.985},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.99},transition:{duration:.2,ease:`easeOut`},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Te,{size:19}),(0,X.jsx)(`i`,{children:t===`fa`?`راهنمای کلیدها`:`KEY MAP`})]}),(0,X.jsx)(`button`,{className:`modal__close`,onClick:n,"aria-label":t===`fa`?`بستن`:`Close`,children:(0,X.jsx)(ct,{size:18})})]}),(0,X.jsx)(`h2`,{id:`hotkey-help-title`,children:r}),(0,X.jsx)(`div`,{className:`hotkey-list`,children:a.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(cp,{keys:e.keys,separator:e.separator}),(0,X.jsx)(`span`,{children:e.detail})]},`${e.keys.flat().join(`-`)}-${e.detail}`))})]})]})})}function Op({state:e,onClose:t,busy:n}){let r=(0,E.useRef)(null),i=(0,E.useRef)(null),a=(0,E.useRef)(null),o=(0,E.useRef)(t),s=(0,E.useRef)(!!n);return o.current=t,s.current=!!n,(0,E.useEffect)(()=>{if(!e.open)return;let t=document.activeElement,n=window.requestAnimationFrame(()=>{((e.tone===`danger`?i.current:r.current)??a.current)?.focus()}),c=e=>{if(e.key===`Escape`&&!s.current){e.preventDefault(),o.current();return}if(e.key!==`Tab`||!a.current)return;let t=[...a.current.querySelectorAll(`button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [href], [tabindex]:not([tabindex="-1"])`)].filter(e=>e.offsetParent!==null);if(!t.length){e.preventDefault(),a.current.focus();return}let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,c),()=>{window.cancelAnimationFrame(n),document.removeEventListener(`keydown`,c),t?.isConnected&&t.focus()}},[e.open,e.tone]),(0,X.jsx)(Td,{children:e.open&&(0,X.jsxs)(Vf.div,{className:`modal-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(Vf.button,{className:`modal-backdrop`,"aria-label":ip(`Close dialog`,`بستن گفت‌وگو`),onClick:t,disabled:n}),(0,X.jsxs)(Vf.div,{ref:a,className:`modal modal--${e.tone??`normal`}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`active-dialog-title`,tabIndex:-1,initial:{opacity:0,scale:.985,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:5},transition:{duration:.2,ease:[.22,1,.36,1]},children:[(0,X.jsx)(`button`,{className:`modal__close`,"aria-label":ip(`Close`,`بستن`),onClick:t,disabled:n,children:(0,X.jsx)(ct,{size:18})}),(0,X.jsx)(`div`,{className:`modal__signal`,"aria-hidden":`true`,children:e.tone===`danger`?(0,X.jsx)(et,{size:25}):(0,X.jsx)(he,{size:25})}),(0,X.jsx)(`h2`,{id:`active-dialog-title`,children:e.title}),(0,X.jsx)(`p`,{children:e.body}),(0,X.jsxs)(`div`,{className:`modal__actions`,children:[(0,X.jsx)(lp,{ref:i,tone:`ghost`,onClick:t,disabled:n,children:ip(`Cancel`,`انصراف`)}),(0,X.jsx)(lp,{ref:r,tone:e.tone===`danger`?`danger`:`primary`,busy:n,onClick:()=>e.action?.(),children:e.confirmLabel})]})]})]})})}function kp({messages:e,dismiss:t}){return(0,X.jsx)(`div`,{className:`toast-stack`,"aria-live":`polite`,"aria-atomic":`false`,children:(0,X.jsx)(Td,{initial:!1,children:e.map(e=>(0,X.jsxs)(Vf.article,{className:`toast toast--${e.tone}`,initial:{opacity:0,x:18},animate:{opacity:1,x:0},exit:{opacity:0,x:12},transition:{duration:.32,ease:[.22,1,.36,1]},children:[(0,X.jsx)(`span`,{className:`toast__rail`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`toast__body`,children:[(0,X.jsx)(`strong`,{children:e.title}),e.detail&&(0,X.jsx)(`p`,{children:e.detail}),e.updateOperationID&&(0,X.jsxs)(`div`,{className:`toast__progress${e.progressKnown?``:` is-indeterminate`}`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:ip(`Transfer`,`انتقال`)}),(0,X.jsx)(`bdi`,{title:e.bytesTotal?`${e.bytesDone??0} / ${e.bytesTotal} bytes`:void 0,children:e.progressLabel})]}),(0,X.jsx)(`div`,{className:`update-progress${e.progressKnown?``:` is-indeterminate`}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progressKnown?e.progressPercent:void 0,"aria-valuetext":e.progressLabel,children:(0,X.jsx)(`i`,{style:e.progressKnown?{width:`${e.progressPercent??0}%`}:void 0})})]}),e.correlation&&(0,X.jsxs)(`code`,{className:`toast__correlation`,children:[(0,X.jsx)(`span`,{children:ip(`Reference`,`شناسه`)}),(0,X.jsxs)(`bdi`,{children:[`#`,e.correlation]})]}),e.action&&(0,X.jsxs)(`div`,{className:`toast__action-context`,children:[(0,X.jsx)(`span`,{children:e.actionLabel||ip(`Suggested action`,`عملیات پیشنهادی`)}),(0,X.jsx)(`code`,{dir:`ltr`,children:e.action})]})]}),(0,X.jsx)(`button`,{className:`toast__dismiss`,"aria-label":ip(`Dismiss`,`بستن اعلان`),onClick:()=>t(e.id),children:(0,X.jsx)(ct,{size:16})})]},e.id))})})}var Ap=/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,jp=/\s+/g;function Mp(e,t=``){return{normalized:e,error:t,valid:!t}}function Np(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,` `).slice(0,64)}function Pp(e){let t=Np(e),n=t.trim();return n?n.length>64?Mp(t,`Application title must be 64 characters or fewer.`):/[\p{L}\p{N}]/u.test(n)?Mp(n):Mp(t,`Application title must include a letter or number.`):Mp(t,`Application title is required.`)}function Fp(e){let t=e.normalize(`NFKC`).replace(Ap,``).replace(jp,` `);return Array.from(t).slice(0,64).join(``)}function Ip(e){let t=Fp(e).trim();return Array.from(t).length>64?Mp(t,`Peripheral name must be 64 characters or fewer.`):Mp(t)}function Lp(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,``).slice(0,4096)}function Rp(e){return e.normalize(`NFKC`).replace(/[\s,]+/g,` `).replace(Ap,``).trimStart().toLowerCase()}function zp(e){let t=Rp(e).trim().split(` `).filter(Boolean),n=t.join(` `),r=t.some(e=>!/^[\x21-\x7e]+$/.test(e)),i=new Set(t).size!==t.length,a=``;return t.length>14?a=`Use no more than 14 page keys or IDs.`:r?a=`Page keys or IDs must use printable ASCII characters.`:i&&(a=`Page keys or IDs must be unique.`),{normalized:n,pages:t,error:a,valid:!a}}function Bp(e){return e.normalize(`NFKC`).replace(/[\t\r\n\f\v]+/g,` `).replace(Ap,``)}function Vp(e,t){let n=Bp(e),r=new TextEncoder().encode(n).length,i=Math.max(0,40-t),a=``;return/^[\x20-\x7e]*$/.test(n)?r<5?a=`Text must contain at least 5 printable ASCII bytes.`:r+t>40&&(a=`Text and repeat gap must fit within 40 bytes.`):a=`Text must use printable ASCII characters.`,{normalized:n,byteLength:r,availableBytes:i,error:a,valid:!a}}function Hp(e,t){let n=zp(e.pages.join(` `)).pages,r=zp(t.pages.join(` `)).pages;return e.enabled===t.enabled&&e.speed_ms===t.speed_ms&&e.gap_cells===t.gap_cells&&Bp(e.door_open_text)===Bp(t.door_open_text)&&Bp(e.door_closed_text)===Bp(t.door_closed_text)&&n.length===r.length&&n.every((e,t)=>e===r[t])}function Up(e){return e.normalize(`NFKC`).replace(Ap,``).replace(jp,``).replace(/\\/g,`/`).replace(/^([a-z][a-z\d+.-]*):\/(?!\/)/i,`$1://`).slice(0,2048)}function Wp(e,t){let n=Up(e);if(!n)return t?{normalized:n,error:`A root URL is required while this integration is enabled.`}:{normalized:n};let r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`,i;try{i=new URL(r)}catch{return{normalized:n,error:`Enter a valid HTTP or HTTPS root URL.`}}return i.protocol!==`http:`&&i.protocol!==`https:`?{normalized:n,error:`Only HTTP and HTTPS are supported.`}:i.username||i.password?{normalized:n,error:`Credentials are not allowed in the URL.`}:i.search||i.hash?{normalized:n,error:`Query strings and fragments are not allowed.`}:i.pathname!==`/`&&i.pathname!==``?{normalized:n,error:`Use the service root without a path.`}:(i.pathname=`/`,{normalized:i.toString().replace(/\/$/,``),url:i})}function Gp(e){let t=e.split(`.`).map(Number);return t.length!==4||t.some(e=>!Number.isInteger(e)||e<0||e>255)?!1:t[0]===10||t[0]===127||t[0]===169&&t[1]===254||t[0]===172&&t[1]>=16&&t[1]<=31||t[0]===192&&t[1]===168}function Kp(e){return!e||e.length>253?!1:e.split(`.`).every(e=>e.length>=1&&e.length<=63&&!e.startsWith(`-`)&&!e.endsWith(`-`)&&/^[a-z\d-]+$/i.test(e))}function qp(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``);return t.includes(`:`)?t===`::1`||/^(?:fc|fd)[0-9a-f]{2}:/i.test(t)||/^fe[89ab][0-9a-f]:/i.test(t):Gp(t)?!0:Kp(t)?t===`localhost`||!t.includes(`.`)||[`.local`,`.lan`,`.home.arpa`,`.localdomain`].some(e=>t.endsWith(e)&&t.length>e.length):!1}function Jp(e){let t=e.toLowerCase().replace(/^\[|\]$/g,``),n=t.split(`.`).map(Number),r=n.length===4&&n[0]===127&&n.every(e=>Number.isInteger(e)&&e>=0&&e<=255);return t===`localhost`||t===`::1`||r}function Yp(e,t){let n=Wp(e,t);return n.error||!n.url?Mp(n.normalized,n.error??``):qp(n.url.hostname)?Mp(n.normalized):Mp(n.normalized,`Use a private, loopback, link-local, or local-DNS host.`)}function Xp(e,t){let n=Wp(e,t);return n.error||!n.url?Mp(n.normalized,n.error??``):Jp(n.url.hostname)?Mp(n.normalized):Mp(n.normalized,`The data service must use localhost or a loopback address.`)}function Zp(e,t){return e.local_device.enabled===t.local_device.enabled&&Up(e.local_device.base_url??``)===Up(t.local_device.base_url??``)&&e.data_hub.enabled===t.data_hub.enabled&&Up(e.data_hub.base_url??``)===Up(t.data_hub.base_url??``)&&e.lifecycle_safety.session_lock===t.lifecycle_safety.session_lock&&e.lifecycle_safety.suspend===t.lifecycle_safety.suspend&&e.lifecycle_safety.refresh_on_resume===t.lifecycle_safety.refresh_on_resume}var Qp=`controller`,$p=`pccontroller.controller-origin`;function em(){let e=``,t=``,n=null;try{e=globalThis.location?.href??``,t=globalThis.location?.origin??``}catch{}try{n=globalThis.localStorage}catch{}return{href:e,origin:t,localStorage:n,generatedConfig:globalThis.PCControllerWebConfig}}function tm(e){let t=Up(e);if(!t)return null;let n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`,r;try{r=new URL(n)}catch{return null}return![`http:`,`https:`,`ws:`,`wss:`].includes(r.protocol)||r.username||r.password||r.search||r.hash||r.pathname!==``&&r.pathname!==`/`?null:(r.pathname=``,r)}function nm(e){let t=tm(e);return t?t.origin.toLowerCase():``}function rm(e){let t=new Set;for(let n of e?.trusted_controller_origins??[]){if(typeof n!=`string`)continue;let e=tm(n);!e||e.protocol!==`https:`&&e.protocol!==`wss:`||t.add(e.origin.toLowerCase())}return t}function im(e,t=new Set){let n=tm(e);if(!n)return{valid:!1,normalized:``,error:`Use an HTTP(S) or WS(S) service root without credentials, a path, query, or fragment.`};let r=qp(n.hostname),i=(n.protocol===`https:`||n.protocol===`wss:`)&&t.has(n.origin.toLowerCase());return!r&&!i?{valid:!1,normalized:n.origin,error:`Use a local/private target or an explicitly trusted HTTPS/WSS origin.`}:{valid:!0,normalized:n.origin,error:``}}function am(e,t){let n=new URL(t),r=n.protocol===`https:`||n.protocol===`wss:`;n.protocol=r?`https:`:`http:`;let i=n.origin;return n.protocol=r?`wss:`:`ws:`,{source:e,controllerOrigin:t,httpOrigin:i,websocketOrigin:n.origin,external:!0}}function om(e){let t=nm(e);if(!t)return{source:`same-origin`,controllerOrigin:``,httpOrigin:``,websocketOrigin:``,external:!1};let n=new URL(t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,{source:`same-origin`,controllerOrigin:t,httpOrigin:t,websocketOrigin:n.origin,external:!1}}function sm(e=em()){let t=e.generatedConfig,n=rm(t),r=typeof t?.controller_origin==`string`?t.controller_origin.trim():``;if(r){let e=im(r,n);if(!e.valid)throw TypeError(`Invalid generated controller origin: ${e.error}`);return am(`generated-config`,e.normalized)}let i=null;if(e.href)try{i=new URL(e.href).searchParams.get(Qp)}catch{}if(i!==null){let t=im(i,n);if(!t.valid)throw TypeError(`Invalid controller query target: ${t.error}`);try{e.localStorage?.setItem($p,t.normalized)}catch{}return am(`query`,t.normalized)}let a=``;try{a=e.localStorage?.getItem(`pccontroller.controller-origin`)?.trim()??``}catch{}if(a){let t=im(a,n);if(t.valid)return am(`local-setting`,t.normalized);try{e.localStorage?.removeItem($p)}catch{}}return om(e.origin??``)}function cm(e){let t=e.trim();if(!t.startsWith(`/`)||t.startsWith(`//`)||t.includes(`\\`)||/[\u0000-\u001f\u007f]/.test(t))throw TypeError(`controller transport path must be an absolute local path`);return t}function lm(e){let t=cm(e),n=sm();return n.external?new URL(t,`${n.httpOrigin}/`).toString():t}function um(e){let t=cm(e),n=sm();if(n.websocketOrigin)return new URL(t,`${n.websocketOrigin}/`).toString();let r=globalThis.location?.protocol===`https:`?`wss:`:`ws:`;return new URL(t,`${r}//${globalThis.location?.host??``}`).toString()}function dm(){return sm().httpOrigin||void 0}var fm=`pccontroller.session-token`,pm=`pccontroller.ticket.`,mm=1,hm=null,gm=0,_m=new Map,vm=class extends Error{code;constructor(e,t){super(t),this.name=`ControllerRPCError`,this.code=e}};function ym(){return sessionStorage.getItem(fm)??``}function bm(e){let t=e.trim();t?sessionStorage.setItem(fm,t):sessionStorage.removeItem(fm)}function xm(e=!1){let t={};e&&(t[`Content-Type`]=`application/json`);let n=ym();return n&&(t.Authorization=`Bearer ${n}`),t}function Sm(e,t,n){if(typeof e==`object`&&e&&`error`in e){let t=e.error;return typeof t==`object`&&t&&`message`in t?String(t.message):String(t)}return typeof e==`string`?e:t||`HTTP ${n}`}async function Cm(e){let t=await e.text(),n=null;if(t)try{n=JSON.parse(t)}catch{n=t}return n}async function wm(e){let t=await Cm(e);if(!e.ok){let n=Sm(t,e.statusText,e.status);throw Error(n||`HTTP ${e.status}`)}return t}function Tm(e,t){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Controller returned an invalid JSON-RPC response`);let n=e;if(n.jsonrpc!==`2.0`||n.id!==t)throw Error(`Controller returned a mismatched JSON-RPC response`);let r=Object.prototype.hasOwnProperty.call(n,`result`),i=Object.prototype.hasOwnProperty.call(n,`error`);if(r===i)throw Error(`Controller returned an invalid JSON-RPC response`);if(i){let e=n.error;if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Controller returned an invalid JSON-RPC error`);let t=e;if(!Number.isInteger(t.code)||typeof t.message!=`string`)throw Error(`Controller returned an invalid JSON-RPC error`);return{error:new vm(t.code,t.message)}}return{result:n.result}}async function Em(e){let t=await wm(await fetch(lm(`/api/ui-config`),{signal:e,cache:`no-store`}));if(typeof t?.setup_complete!=`boolean`)throw Error(`UI configuration is missing required setup_complete state`);if(!t.appearance||typeof t.appearance!=`object`||typeof t.appearance_etag!=`string`||!/^[a-f0-9]{64}$/.test(t.appearance_etag))throw Error(`UI configuration is missing host-authoritative appearance state`);if(typeof t.session_ticket_path!=`string`||t.session_ticket_path.startsWith(`//`)||!/^\/[A-Za-z0-9._~!$&'()*+,;=:@%/-]+$/.test(t.session_ticket_path))throw Error(`UI configuration is missing a safe session-ticket path`);if(!Number.isSafeInteger(t.status_interval_ms)||t.status_interval_ms<50||t.status_interval_ms>6e4||!Number.isSafeInteger(t.measurement_freshness_ms)||t.measurement_freshness_ms12e4)throw Error(`UI configuration is missing valid live-measurement timing`);return t}async function Dm(e){return wm(await fetch(lm(`/api/snapshot`),{headers:xm(),signal:e,cache:`no-store`}))}async function Om(e,t){let n=await fetch(lm(`/api/rpc`),{method:`POST`,headers:xm(!0),body:JSON.stringify(e),signal:t}),r=await Cm(n),i=Tm(r,e.id);if(i.error)throw i.error;if(!n.ok){let e=Sm(r,n.statusText,n.status);throw Error(e||`HTTP ${n.status}`)}return i.result}function km(e,t){for(let[n,r]of _m)r.socket===e&&(_m.delete(n),r.cleanup(),r.reject(Error(t)))}function Am(e,t,n){return n?.aborted?Promise.reject(n.reason instanceof Error?n.reason:new DOMException(`Aborted`,`AbortError`)):new Promise((r,i)=>{let a=()=>{_m.delete(t.id),i(n?.reason instanceof Error?n.reason:new DOMException(`Aborted`,`AbortError`))},o=()=>n?.removeEventListener(`abort`,a);_m.set(t.id,{socket:e,resolve:e=>r(e),reject:i,cleanup:o}),n?.addEventListener(`abort`,a,{once:!0});try{e.send(JSON.stringify(t))}catch(e){_m.delete(t.id),o(),i(e instanceof Error?e:Error(String(e)))}})}function jm(e,t={},n){let r={jsonrpc:`2.0`,id:mm++,method:e,params:t},i=hm;return i&&i.readyState===WebSocket.OPEN?Am(i,r,n):Om(r,n)}function Mm(e,t){return jm(`controller.command.execute`,{command:e},t)}async function Nm(e,t){if(ym(),!e.auth_required)return[];let n=await wm(await fetch(lm(e.session_ticket_path),{method:`POST`,headers:xm(!0),body:JSON.stringify({transport:`websocket`}),signal:t,cache:`no-store`}));if(!/^[a-f0-9]{64}$/.test(n.ticket)||n.protocol!==`pccontroller`||!Number.isFinite(n.expires_in_ms)||n.expires_in_ms<=0||n.expires_in_ms>15e3||Number.isNaN(Date.parse(n.expires_at))||typeof n.principal!=`string`||!n.principal.trim())throw Error(`Controller returned an invalid WebSocket session ticket`);return[n.protocol,`${pm}${n.ticket}`]}function Pm(e,t=Math.random){let n=500*2**Math.min(Math.max(0,e),5);return Math.min(12e3,n+Math.floor(Math.max(0,Math.min(.999,t()))*250))}function Fm(e,t){let n=null,r=!1,i=0,a=0,o=0,s=null,c=e.status_interval_ms,l=(e,t=!1)=>{let n=mm++;return e.send(JSON.stringify({jsonrpc:`2.0`,id:n,method:`controller.subscribe`,params:t?{topics:[`status`],interval_ms:c,preserve:!0}:{topics:[`events`,`state`,`status`],interval_ms:c,after_id:0}})),n},u=(e,n)=>{if(r)return;i+=1;let o=Pm(i);t.state(`waiting`,e||`retrying in ${Math.ceil(o/1e3)}s`,n),window.clearTimeout(a),a=window.setTimeout(()=>{d()},o)},d=async()=>{if(r)return;let a=++o,c=++gm;t.state(`connecting`,void 0,{generation:c}),s?.abort();let d=new AbortController;s=d;let f;try{f=await Nm(e,d.signal)}catch(e){if(r||a!==o||d.signal.aborted)return;u(e instanceof Error?e.message:String(e),{generation:c});return}finally{s===d&&(s=null)}if(r||a!==o)return;let p;try{let t=um(e.websocket_path);p=f.length>0?new WebSocket(t,f):new WebSocket(t)}catch(e){if(r||a!==o)return;u(e instanceof Error?e.message:String(e),{generation:c});return}n=p;let m=()=>!r&&a===o&&n===p,h=0,g=``,_=!1,v=[],y=null,b=null,x=null,S=()=>({generation:c,...g?{instanceID:g}:{}}),C=e=>{m()&&t.event(e,S())},ee=e=>{m()&&t.snapshot?.(e,S())};p.addEventListener(`open`,()=>{m()&&(i=0,hm=p,h=l(p))}),p.addEventListener(`message`,e=>{if(m())try{let n=JSON.parse(String(e.data));if(typeof n.id==`number`){let e=_m.get(n.id);if(e&&e.socket===p){_m.delete(n.id),e.cleanup();try{let t=Tm(n,n.id);t.error?e.reject(t.error):e.resolve(t.result)}catch(t){e.reject(t instanceof Error?t:Error(String(t)))}}if(!m())return;if(n.id===h){if(n.error){p.close();return}let e=n.result;if(e?.subscribed!==!0){p.close();return}g=e.instance_id?.trim()??``,_=!0,t.state(`open`,void 0,S());for(let e of v.splice(0))C(e);y&&=(ee(y),null),b&&=(t.pwm?.(b,S()),null),x&&=(t.status(x,S()),null)}}if(n.method===`controller.status`&&(_?t.status(n.params,S()):x=n.params),n.method===`controller.pwm.values`&&(_?t.pwm?.(n.params,S()):(!b||Number(n.params.revision)>Number(b.revision))&&(b=n.params)),n.method===`controller.event`&&C(n.params),n.method===`controller.state`){let e=n.params;_?C(e):(v.length>=256&&v.shift(),v.push(e))}if(n.method===`controller.snapshot`){let e=n.params;_?ee(e):y=e}if(n.method===`controller.error`){let e=n.params?.error;t.state(_?`open`:`connecting`,e,S())}}catch{}}),p.addEventListener(`close`,e=>{m()&&(n===p&&(n=null),hm===p&&(hm=null),km(p,e.reason||`WebSocket RPC connection closed`),r?t.state(`closed`,void 0,S()):u(e.reason||`WebSocket connection closed`,S()))}),p.addEventListener(`error`,()=>{m()&&p.close()})};d();let f=(()=>{r=!0,o+=1,s?.abort(),window.clearTimeout(a);let e=n;n?.close(1e3,`view closed`),e&&(hm===e&&(hm=null),km(e,`WebSocket RPC view closed`)),n=null});return f.updateStatusInterval=e=>{if(!Number.isSafeInteger(e)||e<50||e>6e4)throw RangeError(`status interval must be 50..60000 ms`);if(c===e)return;c=e;let t=n;t&&t.readyState===WebSocket.OPEN&&l(t,!0)},f}async function Im(e,t,n={}){let r=t.startsWith(`/`)?t.slice(1):t;return wm(await fetch(lm(`/api/integrations/${e}/${r}`),{...n,headers:{...xm(!!n.body),...n.headers??{}}}))}function Lm(e,t){let n=e.headers.get(`Content-Disposition`)??``,r=n.match(/filename\*=UTF-8''([^;]+)/i)?.[1],i=n.match(/filename="([^"]+)"/i)?.[1],a=``;if(r)try{a=decodeURIComponent(r)}catch{a=``}let o=a||i||t.split(`/`).filter(Boolean).at(-1)||`controller-data.bin`;return o=o.replace(/[\\/:*?"<>|\u0000-\u001f\u007f]/g,`_`).trim().slice(0,180),o||`controller-data.bin`}async function Rm(e,t,n){let r=t.startsWith(`/`)?t.slice(1):t,i=lm(`/api/integrations/${e}/${r}`),a=await fetch(i,{headers:xm(),signal:n});a.ok||await wm(a);let o=await a.blob(),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=Lm(a,r),c.rel=`noopener`,document.body.append(c),c.click(),c.remove(),URL.revokeObjectURL(s)}var zm=[`dashboard`,`controls`,`workbench`,`device`,`data`,`updates`,`events`,`settings`],Bm=`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="combobox"]`;function Vm(e){if(!e)return!1;let t=e;return t.isContentEditable?!0:typeof t.closest==`function`&&!!t.closest(Bm)}function Hm(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||Vm(e.target)}function Um(e){let t=(e??``).trim().toLowerCase().replace(/[\s_]+/g,`-`);return t?{0:`controls`,1:`dashboard`,2:`controls`,3:`controls`,4:`controls`,5:`settings`,6:`controls`,7:`controls`,8:`controls`,9:`events`,app:`settings`,automate:`workbench`,automation:`workbench`,automations:`workbench`,board:`workbench`,catalog:`data`,console:`workbench`,control:`controls`,controls:`controls`,dashboard:`dashboard`,event:`events`,events:`events`,data:`data`,"data-hub":`data`,datahub:`data`,device:`device`,devices:`device`,export:`data`,firmware:`updates`,flash:`updates`,history:`events`,home:`dashboard`,"local-device":`device`,live:`dashboard`,i2c:`workbench`,macros:`workbench`,menus:`workbench`,output:`controls`,outputs:`controls`,records:`data`,recovery:`updates`,program:`updates`,programming:`updates`,peripherals:`workbench`,rf:`workbench`,settings:`settings`,timeline:`events`,terminal:`workbench`,workbench:`workbench`,update:`updates`,updates:`updates`}[t]??null:null}function Wm(e,t=Date.now(),n=1e4){let r=Date.parse(e??``);return Number.isFinite(r)&&r<=t+1e3&&t-r<=n}function Gm(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||e.repeat)return null;let t=Number(e.key)-1;return Number.isInteger(t)&&t>=0&&tXm[e][t]??Xm.en[t]}function Qm(e,t,n=1){return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en-US`,{minimumFractionDigits:n,maximumFractionDigits:n}).format(Number.isFinite(t)?t:0)}function $m(e,t){return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en-US`,{notation:`compact`,maximumFractionDigits:1}).format(t)}function eh(e,t){return(e===`fa`?Jm:Ym).format(t)}function th(e,t){if(!Number.isFinite(t)||t<0)return`—`;let n=Math.floor(t/1e3),r=Math.floor(n/86400),i=Math.floor(n%86400/3600),a=Math.floor(n%3600/60),o=n%60,s=(r>0?[`${r}d`,`${i}h`,`${a}m`,`${o}s`]:i>0?[`${i}h`,`${a}m`,`${o}s`]:a>0?[`${a}m`,`${o}s`]:[`${o}s`]).join(` `);return e===`fa`?s.replace(/\d+/g,t=>eh(e,Number(t))).replace(`d`,`ر`).replace(`h`,`س`).replace(`m`,`د`).replace(`s`,`ث`):s}function nh(e,t,n,r=Date.now()){if(t===void 0)return e===`fa`?`در انتظار دستگاه`:`Waiting for device`;let i=t instanceof Date?t.getTime():typeof t==`number`?t:Date.parse(t);if(!Number.isFinite(i))return e===`fa`?`در انتظار دستگاه`:`Waiting for device`;let a=Math.max(0,r-i);if(a0&&!/[\s'"\\]/.test(e)?e:`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function ah(e){let t=e.match(/^(\s*os\s+power\s+\S+)(\s+[\s\S]+)$/i);return t?`${t[1].trim()} [REDACTED]`:e}function oh(e,t,n,r,i,a,o=e.output_persistence,s=e.relay_restore_mask){let c=e.extended_flags&1?1:0,l=e=>e===0?2:e-1,u=e.extended_flags>>1&7,d=l(e.extended_flags>>4&3),f=l(e.extended_flags>>6&3);return[`settings`,`set`,e.flags,e.light_mode,e.on_brightness,e.off_brightness,t,n,r,o,i,e.default_page,c,u,d,f,a,s].join(` `)}function sh(e){return e.reset_lines_available===!0}function ch(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function lh(e,t){let n=Math.max(0,t)/1e3;return new Intl.NumberFormat(e===`fa`?`fa-IR`:`en`,{maximumFractionDigits:+(n<10)}).format(n)+(e===`fa`?` ثانیه`:`s`)}function uh(e){return e.connection_phase?e.connection_phase:e.connected?`connected`:e.paused?`paused`:e.connection_state===`reconnecting`||e.connection_state===`connecting`?`queued`:`disconnected`}function dh(e,t,n=Date.now()){let r=(e,n)=>t===`fa`?n:e,i=uh(e),a=e.connection_candidate,o=a?.friendly_name||a?.product||a?.name||e.port.friendly_name||e.port.product||e.port.name||``,s=e.connection_attempt??0,c=s>0?r(`Attempt ${s}`,`تلاش ${new Intl.NumberFormat(`fa-IR`).format(s)}`):``,l=ch(e.connection_attempt_started),u=ch(e.connection_next_retry),d=e.connection_reason?.trim()||``;return i===`connected`?{phase:i,title:r(`Board connected`,`برد متصل است`),detail:o,candidate:o,timing:``,attempt:``,action:r(`Reconnect`,`اتصال دوباره`),retryDisabled:!1,tone:`good`,animated:!1}:i===`attempting`?{phase:i,title:r(`Contacting controller board`,`در حال تماس با برد کنترلر`),detail:o?r(`Authenticating the application protocol on ${o}.`,`در حال احراز پروتکل برنامه روی ${o}.`):r(`Discovering a compatible controller and authenticating its application protocol.`,`در حال یافتن کنترلر سازگار و احراز پروتکل برنامهٔ آن.`),candidate:o,timing:l===void 0?``:r(`Elapsed ${lh(t,n-l)}`,`گذشته ${lh(t,n-l)}`),attempt:c,action:r(`Attempt in progress`,`تلاش در حال انجام است`),retryDisabled:!0,tone:`info`,animated:!0}:i===`waiting_retry`?{phase:i,title:r(`Board did not answer`,`برد پاسخ نداد`),detail:d||r(`The serial device is present, but the application handshake did not complete.`,`دستگاه سریال حاضر است، اما دست‌دهی برنامه کامل نشد.`),candidate:o,timing:u===void 0?``:u>n?r(`Next automatic attempt in ${lh(t,u-n)}`,`تلاش خودکار بعدی تا ${lh(t,u-n)}`):r(`Next automatic attempt is due now`,`زمان تلاش خودکار بعدی رسیده است`),attempt:c,action:r(`Try now`,`اکنون تلاش کن`),retryDisabled:!1,tone:`warn`,animated:!1}:i===`queued`?{phase:i,title:r(`Reconnect queued`,`اتصال دوباره در صف است`),detail:d||r(`The host is preparing a bounded connection attempt.`,`میزبان در حال آماده‌سازی یک تلاش اتصال محدود است.`),candidate:o,timing:``,attempt:c,action:r(`Try now`,`اکنون تلاش کن`),retryDisabled:!1,tone:`info`,animated:!1}:i===`paused`?{phase:i,title:r(`Board connection is closed`,`اتصال برد بسته است`),detail:d||r(`Automatic reconnect is paused by the operator.`,`اتصال خودکار توسط کاربر متوقف شده است.`),candidate:o,timing:``,attempt:``,action:r(`Resume connection`,`ازسرگیری اتصال`),retryDisabled:!1,tone:`neutral`,animated:!1}:i===`blocked`?{phase:i,title:r(`Serial cleanup needs attention`,`پاک‌سازی درگاه سریال نیاز به بررسی دارد`),detail:d||r(`The previous serial handle could not be released safely.`,`درگاه سریال قبلی با اطمینان آزاد نشد.`),candidate:o,timing:``,attempt:c,action:r(`Retry cleanup`,`تلاش دوباره برای پاک‌سازی`),retryDisabled:!1,tone:`bad`,animated:!1}:{phase:i,title:r(`Controller board disconnected`,`برد کنترلر قطع است`),detail:d||r(`No authenticated controller application is connected.`,`هیچ برنامهٔ کنترلر احرازشده‌ای متصل نیست.`),candidate:o,timing:``,attempt:c,action:r(`Connect`,`اتصال`),retryDisabled:!1,tone:`bad`,animated:!1}}function fh(e,t){return e?.trim()||t.trim()}function ph(e,t){let n=e.trim().split(/\s+/).filter(Boolean);return n.length>1?n.slice(0,2).map(e=>e[0]).join(``).toUpperCase():Array.from(n[0]||t).slice(0,2).join(``).toUpperCase()}var mh={connected:{color:`#43a86f`,label:`Board connected`},connecting:{color:`#d19345`,label:`Controller reconnecting`},fault:{color:`#d96369`,label:`Controller alert`},offline:{color:`#77717f`,label:`Board offline`}};function hh(e){let t=e.connection_state.trim().toLowerCase(),n=(e.connection_reason??``).trim().toLowerCase();return(e.hardware_problems?.length??0)>0||e.have_status&&e.status.hot||/^(error|fault|failed|rejected)$/.test(t)||/authentication|permission|protocol mismatch|unsupported firmware/.test(n)?`fault`:e.connected?`connected`:t===`connecting`||t===`reconnecting`?`connecting`:`offline`}function gh(e){let t=mh[e],n=`${t.label}`;return`data:image/svg+xml,${encodeURIComponent(n)}`}function _h(e,t=document){let n=t.querySelector(`link[data-controller-state-icon]`);n||(n=t.createElement(`link`),n.rel=`icon`,n.type=`image/svg+xml`,n.sizes=`any`,n.dataset.controllerStateIcon=``,t.head.append(n)),n.dataset.state!==e&&(n.dataset.state=e,n.href=gh(e))}var vh=new Set([`telemetry`,`rx`,`tx`,`front_panel.segment`,`status_led.changed`,`buzzer.note`]);function yh(e){return e.stream?e.stream===`activity`:!vh.has(e.kind.trim().toLowerCase())}function bh(e){return e.filter(yh)}function xh(e,t,n=500){let r=bh(e);return yh(t)?[t,...r.filter(e=>e.id!==t.id)].slice(0,n):r.slice(0,n)}function Sh(e,t=``){let n=e.kind.trim().toLowerCase(),r=e.source?.trim().toLowerCase()??``,i=e.metadata?.source?.trim().toLowerCase()??``,a=r&&r!==`board`?r:i||r,o=e.text?.trim().toLowerCase()??``;if(/^(hello|status|telemetry|rx|tx)(?:[._-]|$)/.test(n)||/^(hello|status)\b/.test(o))return!1;if(/^peer-update\.(queued|artifact-verified|reconnecting|health-checking|completed|failed|outcome-uncertain)$/.test(n)||n===`hardware.problem`)return!0;if(n===`message`){let n=t.trim().toLowerCase();return(e.targets?.map(e=>e.trim().toLowerCase())??[]).some(e=>e===`all`||e===`*`||e===`webui`||e===`surface:webui`||e===`capability:messages`||!!(n&&e===n))}return/(^|[._-])(relay|output)([._-]|$)/.test(n)?a===`physical`||a===`rf`:/error|warning|fault|hot|door/.test(n)}function Ch(e){return typeof e==`string`?e.trim():``}function wh(){let e=typeof document>`u`?null:document.querySelector(`script[type="module"][src*="/assets/app-"]`),t=``;if(e?.src)try{t=new URL(e.src,document.baseURI).pathname}catch{}return{hostVersion:`0.0.0-development`,resourcePath:t}}function Th(e){return`${Ch(e.host_version)}|${Ch(e.web_resource_path)}`}function Eh(e,t=wh()){let n=Ch(e.host_version),r=Ch(e.web_resource_path),i=Ch(t.hostVersion),a=Ch(t.resourcePath);return!n||!r||!i||!a?!1:n!==i||r!==a}function Dh(e,t,n={}){let r=n.signal?.aborted===!0,i=!1,a=0,o=null,s,c=()=>{a+=1,s!==void 0&&clearTimeout(s),s=void 0,o&&=(clearTimeout(o.timeout),o.abort.abort(),null)},l=e=>!r&&i&&a===e,u=(r,i)=>{if(!l(r))return;let a=new AbortController,c={abort:a,timeout:setTimeout(()=>a.abort(Error(`Host resource identity check timed out`)),5e3)};o=c,e(a.signal).then(e=>{l(r)&&!a.signal.aborted&&t(e)}).catch(e=>{l(r)&&(i===0?s=setTimeout(()=>{s=void 0,u(r,1)},250):n.onError?.(e))}).finally(()=>{clearTimeout(c.timeout),o===c&&(o=null)})},d=()=>{r=!0,i=!1,c(),n.signal?.removeEventListener(`abort`,d)};return n.signal?.addEventListener(`abort`,d,{once:!0}),{state(e){r||(e===`open`?i||(i=!0,c(),u(a,0)):(i=!1,c()))},dispose:d}}var Oh=`background:#7656d6;border-radius:7px;color:#fff;font:600 12px/1.8 ui-sans-serif,system-ui,sans-serif;padding:2px 8px`,kh=`color:#9b7ce8;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,Ah=`color:#2f9e67;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,jh=`color:#d8793f;font:600 11px/1.6 ui-sans-serif,system-ui,sans-serif`,Mh=`color:inherit;font:inherit`;function Nh(e,t,n=96){let r=String(e??``).normalize(`NFKC`).replace(/[\u0000-\u001f\u007f-\u009f]/g,` `).replace(/\s+/g,` `).trim();return r?r.slice(0,n):t}function Ph(e){switch(e){case`open`:return`Host event stream connected`;case`connecting`:return`Host event stream connecting`;case`waiting`:return`Host event stream waiting to reconnect`;case`closed`:return`Host event stream closed`}}function Fh(e,t=console){let n=Nh(e.productTitle,`Controller`),r=e.demonstration?`demonstration`:Nh(e.config?.host_version,`not reported`),i=e.boardConnected?Nh(e.port,`authenticated port`):``;t.groupCollapsed(`%c%s%c · browser control center`,Oh,n,Mh),t.info(`%cHost%c version %s · living API`,kh,Mh,r),e.boardConnected?t.info(`%cController%c connected · %s`,Ah,Mh,i):t.info(`%cController%c offline · no authenticated board`,jh,Mh),t.debug(`%cTransport%c %s`,kh,Mh,Ph(e.streamState)),t.groupEnd()}var Ih=`pccontroller.tab-sync`,Lh=`pccontroller://local`,Rh=3e4,zh=3e5,Bh=32768,Vh=8192,Hh=4096,Uh=32,Wh=512,Gh=0,Kh=/(?:authorization|cookie|password|passwd|secret|session(?:[_-]?id)?|(?:access|refresh)?[_-]?token|api[_-]?key)/i,qh=[/\b(?:authorization|access[_-]?token|refresh[_-]?token|api[_-]?key|password|passwd|secret|session[_-]?id)\s*[:=]\s*\S+/i,/\b(?:bearer|basic)\s+[a-z0-9._~+/=-]{8,}/i,/\beyJ[a-z0-9_-]{8,}\.[a-z0-9_-]{8,}\.[a-z0-9_-]{8,}\b/i,/-----BEGIN [A-Z ]*PRIVATE KEY-----/i],Jh=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f\u202a-\u202e\u2066-\u2069\ufeff]/g,Yh=/^[a-z0-9._:-]{1,180}$/i,Xh=/^[a-z0-9._/-]{1,96}$/i;function Zh(){try{let e=globalThis.location?.origin;if(e&&e!==`null`)return e}catch{}return Lh}function Qh(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=Math.random().toString(36).slice(2);return`${Date.now().toString(36)}-${t}-${(++Gh).toString(36)}`}function $h(e){let t=e.trim();if(!t||t.length>256||Jh.test(t))throw Jh.lastIndex=0,TypeError(`tab channel origin is invalid`);if(Jh.lastIndex=0,t.toLowerCase()===Lh)return Lh;try{let e=new URL(t);if(e.username||e.password||e.origin===`null`)throw TypeError(`tab channel origin cannot contain credentials`);return e.origin.toLowerCase()}catch(e){throw e instanceof TypeError&&e.message.includes(`credentials`)?e:TypeError(`tab channel origin is invalid`)}}function eg(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function tg(e,t,n){let r=e.trim();return r.length<=n&&Yh.test(r)?r:t}function ng(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rg(e){return new TextEncoder().encode(e).byteLength}function ig(e){return qh.some(t=>t.test(e))}function ag(e){let t=[e],n=new Set;for(;t.length>0;){let e=t.pop();if(typeof e==`string`){if(ig(e))return!0}else if(typeof e==`object`&&e){if(n.has(e))return!0;if(n.add(e),Array.isArray(e))t.push(...e);else for(let[n,r]of Object.entries(e)){if(Kh.test(n))return!0;t.push(r)}}}return!1}function og(e,t,n=!1){if(typeof e!=`string`||rg(e)>t)return null;let r=e.replace(Jh,``);return ig(r)||!n&&r.length===0?null:r}function sg(e,t){if(e!==void 0)return og(e,t,!0)}function cg(e,t,n){if(e!==void 0)return typeof e!=`number`||!Number.isSafeInteger(e)||en?null:e}function lg(e){return e.state!==`active`&&e.state!==`hidden`&&e.state!==`leaving`||e.page!==void 0&&(typeof e.page!=`string`||!Xh.test(e.page))?null:{type:`presence`,state:e.state,...e.page===void 0?{}:{page:e.page}}}function ug(e){if(!ng(e.appearance)||e.etag!==void 0&&(typeof e.etag!=`string`||!/^[a-f0-9]{64}$/.test(e.etag)))return null;let t=e.appearance,n={};if(t.theme!==void 0){if(t.theme!==`system`&&t.theme!==`light`&&t.theme!==`dark`)return null;n.theme=t.theme}if(t.locale!==void 0){if(t.locale!==`en`&&t.locale!==`fa`)return null;n.locale=t.locale}if(t.direction!==void 0){if(t.direction!==`auto`&&t.direction!==`ltr`&&t.direction!==`rtl`)return null;n.direction=t.direction}for(let e of[`reduceMotion`,`compactNumbers`,`audioMuted`])if(t[e]!==void 0){if(typeof t[e]!=`boolean`)return null;n[e]=t[e]}if(t.audioVolume!==void 0){if(typeof t.audioVolume!=`number`||!Number.isFinite(t.audioVolume)||t.audioVolume<0||t.audioVolume>1)return null;n.audioVolume=t.audioVolume}return Object.keys(n).length===0?null:{type:`appearance`,appearance:n,...e.etag===void 0?{}:{etag:e.etag}}}function dg(e){if(!ng(e.entry))return null;let t=e.entry;if(t.kind!==`command`&&t.kind!==`output`&&t.kind!==`error`&&t.kind!==`system`)return null;let n=og(t.text,Vh),r=cg(t.at,0,2**53-1);return n===null||r===null?null:{type:`terminal`,entry:{kind:t.kind,text:n,...r===void 0?{}:{at:r}}}}function fg(e){if(e===void 0)return;if(!ng(e)||Object.keys(e).length>Uh)return null;let t={};for(let[n,r]of Object.entries(e)){if(!n||n.length>64||Kh.test(n))return null;let e=og(r,1024,!0);if(e===null)return null;t[n]=e}return t}function pg(e){if(!ng(e.event))return null;let t=e.event,n=cg(t.id,0,2**53-1),r=og(t.time,80),i=og(t.kind,128),a=og(t.text,Hh,!0);if(n==null||r===null||i===null||a===null)return null;let o=[`state`,`lifecycle`,`reason`,`source`,`target`,`message_type`,`action`,`severity`,`correlation`,`delivery`,`gesture`],s={};for(let e of o){let n=sg(t[e],e===`reason`?1024:256);if(n===null)return null;n!==void 0&&(s[e]=n)}let c;if(t.targets!==void 0){if(!Array.isArray(t.targets)||t.targets.length>32)return null;c=[];for(let e of t.targets){let t=og(e,180);if(t===null)return null;c.push(t)}}let l=[`key`,`rf_id`,`rf_code`,`rf_bits`,`rf_protocol`],u={};for(let e of l){let n=e===`rf_code`?4294967295:2**53-1,r=cg(t[e],0,n);if(r===null)return null;r!==void 0&&(u[e]=r)}let d=fg(t.metadata);return d===null?null:{type:`controller-event`,event:{id:n,time:r,kind:i,text:a,...s,...u,...c===void 0?{}:{targets:c},...d===void 0?{}:{metadata:d}}}}function mg(e){if(!ng(e)||!hg(e)||ag(e)||typeof e.type!=`string`)return null;switch(e.type){case`presence`:return lg(e);case`appearance`:return ug(e);case`terminal`:return dg(e);case`controller-event`:return pg(e);default:return null}}function hg(e){try{return rg(JSON.stringify(e))<=Bh}catch{return!1}}function gg(e={}){let t=$h(e.origin??Zh()),n=e.now??Date.now,r=e.idFactory??(()=>Qh()),i=e.ttlMS??Rh;if(!Number.isSafeInteger(i)||i<1||i>zh)throw RangeError(`tab channel ttlMS must be 1..${zh}`);let a=typeof globalThis.BroadcastChannel==`function`?globalThis.BroadcastChannel:null,o=e.BroadcastChannel===void 0?a:e.BroadcastChannel,s=++Gh,c=`tab:${tg(r(`tab`),`fallback-${s.toString(36)}`,64)}:${s.toString(36)}`,l=`${Ih}:${eg(t)}`,u=new Set,d=new Map,f=0,p=!1,m=null,h=e=>{for(let[t,n]of d)n<=e&&d.delete(t);for(;d.size>Wh;){let e=d.keys().next().value;if(e===void 0)break;d.delete(e)}},g=e=>{if(!ng(e)||!hg(e)||ag(e)||e.protocol!==`pccontroller.tab-sync`||e.origin!==t||typeof e.messageId!=`string`||!Yh.test(e.messageId)||typeof e.tabId!=`string`||!Yh.test(e.tabId)||e.tabId===c||typeof e.sentAt!=`number`||!Number.isSafeInteger(e.sentAt)||e.sentAt<0||typeof e.expiresAt!=`number`||!Number.isSafeInteger(e.expiresAt)||e.expiresAt<=e.sentAt||e.expiresAt-e.sentAt>zh)return null;let r=n();if(e.expiresAt<=r||e.sentAt>r+zh||(h(r),d.has(e.messageId)))return null;let i=mg(e.payload);return i===null?null:(d.set(e.messageId,e.expiresAt),{protocol:Ih,origin:t,messageId:e.messageId,tabId:e.tabId,sentAt:e.sentAt,expiresAt:e.expiresAt,payload:i})},_=e=>{if(p)return;let t=g(e.data);if(t!==null)for(let e of[...u])try{e(t)}catch{}};if(o!==null)try{m=new o(l),m.addEventListener(`message`,_)}catch{m=null}let v=(e,a=i)=>{if(p||m===null||!Number.isSafeInteger(a)||a<1||a>zh)return null;let o=mg(e);if(o===null)return null;let s=n();if(!Number.isSafeInteger(s)||s<0||s>2**53-1-a)return null;f+=1;let l=tg(r(`message`),`message-${f.toString(36)}`,64),u=`${c}:${f.toString(36)}:${l}`,g={protocol:Ih,origin:t,messageId:u,tabId:c,sentAt:s,expiresAt:s+a,payload:o};if(!hg(g))return null;try{return m.postMessage(g),d.set(u,g.expiresAt),h(s),u}catch{return null}};return{channelName:l,origin:t,supported:m!==null,tabId:c,publish:v,publishPresence:(e,t)=>v({type:`presence`,state:e,...t===void 0?{}:{page:t}}),publishAppearance:(e,t)=>v({type:`appearance`,appearance:e,...t===void 0?{}:{etag:t}}),publishTerminal:e=>v({type:`terminal`,entry:e}),publishControllerEvent:e=>v({type:`controller-event`,event:e}),subscribe(e){if(p)return()=>void 0;u.add(e);let t=!0;return()=>{t&&(t=!1,u.delete(e))}},close(){p||(p=!0,u.clear(),d.clear(),m!==null&&(m.removeEventListener(`message`,_),m.close(),m=null))}}}function _g(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>!e.hidden&&/^(pwm\.\d+|relay\.\d+|seat\.[ab])$/.test(e.key)&&`${e.name} ${e.key} ${e.group??``} ${e.kind}`.toLocaleLowerCase().includes(n)):[]}function vg(e,t,n){let r=(e??``).trim().toLowerCase();return r===``||r===`*`||r===t.trim().toLowerCase()||r===n.trim().toLowerCase()}var yg=`default`,bg={sync:`navigation_sync`,group:`navigation_group`,epoch:`navigation_epoch`,revision:`navigation_revision`,source:`navigation_source`,catchUp:`navigation_catch_up`,operation:`navigation_operation_id`,targetEpoch:`navigation_target_epoch`,targetRevision:`navigation_target_revision`},xg=/^[A-Za-z0-9._-]{1,64}$/,Sg=/^[A-Za-z0-9._:-]{1,180}$/,Cg=/^[a-f0-9]{32}$/;function wg(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function Tg(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function Eg(e){if(!e||!/^\d{1,20}$/.test(e))return null;let t=Number(e);return Tg(t)?t:null}function Dg(e){return[`dashboard`,`controls`,`workbench`,`device`,`data`,`updates`,`events`,`settings`].includes(e)}var Og=class{epoch;group;reportSequence=0;operationSequence=0;coordinatorEpoch=``;coordinatorRevision=0;constructor(e=wg(),t=yg){let n=e.trim().toLowerCase(),r=t.trim().toLowerCase()||`default`;if(!Cg.test(n))throw TypeError(`navigation epoch is invalid`);if(!xg.test(r))throw TypeError(`navigation group is invalid`);this.epoch=n,this.group=r}nextValues(e,t=!1){return this.reportSequence+=1,{[bg.sync]:e?`follow`:`independent`,[bg.group]:this.group,[bg.epoch]:this.epoch,[bg.revision]:String(this.reportSequence),...e&&t?{[bg.catchUp]:`true`}:{}}}nextCommit(e,t){if(!Sg.test(e.trim()))throw TypeError(`navigation source is invalid`);return this.operationSequence+=1,{group:this.group,source:e.trim(),page:t,operation_id:`${this.epoch}-${this.operationSequence}`}}acceptAction(e,t){if(!e||e[bg.sync]?.toLowerCase()!==`group`||e[bg.group]?.toLowerCase()!==this.group||!Dg(t))return null;let n=e[bg.epoch]?.trim().toLowerCase()??``,r=Eg(e[bg.revision]),i=e[bg.source]?.trim()??``;if(!Cg.test(n)||r===null||!Sg.test(i))return null;let a=e[bg.targetEpoch]?.trim().toLowerCase()??``,o=e[bg.targetRevision];if(a||o){let e=Eg(o);if(a!==this.epoch||e===null||e=t&&e<=n}function Yg(e){let{status:t}=e,n=e.hello.capabilities??0,r=e.connected&&e.have_status,i=r&&!!(n&Ig)&&!!(t.ina219_available||t.flags&Mg),a=r&&!!(n&Lg)&&!!(t.temperature_led_available||t.flags&Pg),o=r&&!!(n&Lg)&&!!(t.temperature_bt_audio_available||t.flags&Fg),s=Jg(t.supply_mv,0,1e5)&&Jg(t.bus_mv,0,1e5)&&Jg(t.current_ma,-1e5,1e5)&&Jg(t.power_mw,-1e7,1e7),c=Jg(t.temperature_led_centi_c,-5500,12500),l=Jg(t.temperature_bt_audio_centi_c,-5500,12500);return{ina219:i&&s,pwm:r&&!!(n&Rg)&&!!(t.pwm_available||t.flags&Ng),temperatureLED:a&&c,temperatureBTAudio:o&&l,lcd:r&&!!(n&Hg)&&!!(e.front_panel?.lcd_available||e.front_panel?.lcd_address||t.lcd_address),bluetoothAudio:r&&!!(n&Kg),relays:r&&!!(n&zg),rf:r&&!!(n&Bg),segments:r&&!!(n&Vg),statusLED:r&&!!(n&Ug),settings:r&&!!(n&Wg),menus:r&&!!(n&Gg),buzzer:r&&!!(n&qg),invalidINA219:i&&!s,invalidTemperatureLED:a&&!c,invalidTemperatureBTAudio:o&&!l}}var Xg={request:e=>window.requestAnimationFrame(e),cancel:e=>window.cancelAnimationFrame(e)},Zg=class{deliver;clock;generation=0;pending=[];frame=null;disposed=!1;constructor(e,t=Xg){this.deliver=e,this.clock=t}adoptGeneration(e){return this.disposed||!Number.isSafeInteger(e)||e<=0||e{if(this.frame=null,this.disposed||n!==this.generation||this.pending.length===0)return;let e=this.pending;this.pending=[],this.deliver(e,n)}),!0}cancelPending(e){this.disposed||e!==this.generation||(this.pending=[],this.frame!==null&&(this.clock.cancel(this.frame),this.frame=null))}dispose(){this.disposed||(this.disposed=!0,this.pending=[],this.frame!==null&&(this.clock.cancel(this.frame),this.frame=null))}};function Qg(e,t=Date.now()){let n=e.status,r=Yg(e);return{at:t,...r.ina219?{supply:n.supply_mv/1e3,bus:n.bus_mv/1e3,current:n.current_ma,power:n.power_mw/1e3}:{},...r.temperatureLED?{ledTemp:n.temperature_led_centi_c/100}:{},...r.temperatureBTAudio?{btTemp:n.temperature_bt_audio_centi_c/100}:{}}}function $g(e){return e.connected?JSON.stringify([e.port.instance_id||``,e.port.serial_number||``,e.port.name||``,e.hello.board_kind??null,e.hello.name||``,e.hello.build_hash??null,e.hello.build_timestamp||``,e.hello.capabilities??null]):``}function e_(e,t,n,r=Date.now()){if(!n.connected||!n.have_status)return[];let i=Qg(n,r);return $g(t)===$g(n)?[...e.slice(-71),i]:[i]}function t_(e,t,n){let r=e,i=t,a=``,o=0;for(let e of n){if(e.error){a=e.error;continue}a=``;let t={...r,connected:!0,have_status:!0,status:e.status,status_updated:e.time};i=e_(i,r,t,new Date(e.time).getTime()),r=t,o+=1}return{snapshot:r,samples:i,detail:a,applied:o}}function n_(e,t){return e.epoch===t.epoch&&(e.instanceID?.trim()??``)===(t.instanceID?.trim()??``)}function r_(e,t){if(t.epoche.epoch?{epoch:t.epoch,...n?{instanceID:n}:{}}:n?{epoch:e.epoch,instanceID:n}:e}function i_(e,t){let n=e.host_instance_id?.trim()??``,r=t.instanceID?.trim()??``;return n===``||r===``||n===r}var a_=e=>{if(e===void 0||e.trim()===``)return null;let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255?t:null};function o_(e){if(e.kind.toLowerCase()!==`status_led.changed`)return null;let t=a_(e.metadata?.red),n=a_(e.metadata?.green),r=a_(e.metadata?.blue),i=a_(e.metadata?.brightness),a=a_(e.metadata?.effect),o=a_(e.metadata?.condition);return[t,n,r,i,a,o].some(e=>e===null)?null:{red:t,green:n,blue:r,brightness:i,effect:a,condition:o}}var s_=e=>{let t=Number(e.metadata?.revision);return Number.isSafeInteger(t)&&t>0?t:0};function c_(e=0,t=0,n=0,r=0){return e===0&&n===0?`unknown`:e===0?`newer`:n===0||ne?`newer`:t===0&&r===0?`unknown`:t===0?`newer`:r===0||r(e.status_led_epoch??0);return o===`older`||e.have_status_led&&(o===`equal`||!t.have_status_led&&!s)?{...r,host_instance_id:e.host_instance_id,status_led:e.status_led,have_status_led:!0,status_led_updated:e.status_led_updated,status_led_revision:e.status_led_revision,status_led_epoch:e.status_led_epoch}:e.have_status_led&&!t.have_status_led?{...r,status_led:e.status_led,have_status_led:!0,status_led_updated:e.status_led_updated}:r}function d_(e){if(e.kind.toLowerCase()!==`front_panel.segment`)return null;let t=e.metadata?.raw_segments?.trim(),n=a_(e.metadata?.brightness);return!t||!/^[0-9a-f]{8}$/i.test(t)||n===null?null:{raw_segments:[0,2,4,6].map(e=>Number.parseInt(t.slice(e,e+2),16)),brightness:n}}function f_(e){let t=e.kind.trim().toLowerCase();return t===`status_led.changed`||t===`front_panel.segment`}function p_(e,t,n={epoch:0}){let r=t.metadata?.connection_generation;if(r!==void 0&&Number(r)!==e.connection_generation)return e;if(o_(t))return l_(e,t,n);let i=d_(t);if(!i)return e;let a=e.front_panel??{schema:0,raw_segments:[0,0,0,0],brightness:0,blink:!1,segments_active:!1,category_selector:!1,lcd_address:0,lcd_available:!1,lcd_backlight:!1,lcd_line_1:``,lcd_line_2:``,pressed_keys:0,menu_page:0,program_mode:0,host_captured:!1,host_state:0,host_editable_value:0};return{...e,front_panel:{...a,...i,segments_active:!0},have_front_panel_segments:!0,front_panel_updated:t.time}}var m_=Object.freeze(Array.from({length:11},(e,t)=>t));function h_(e){return Number.isFinite(e)?Math.max(0,Math.min(4095,Math.round(e))):0}function g_(e,t){let n=h_(e)/4095;return t?.curve===`gamma`&&(n=y_(n,t.gamma)),Math.round(n*1e3)/10}function __(e,t){if(!Number.isFinite(e))return 0;let n=Math.max(0,Math.min(100,e))/100;t?.curve===`gamma`&&(n=v_(n,t.gamma));let r=h_(n*4095);return e>0&&r===0?1:r}function v_(e,t){let n=.04,r=(t-1)*n,i=(t*n/(1+r))**t;return e<=n?e*i/n:((e+r)/(1+r))**+t}function y_(e,t){let n=.04,r=(t-1)*n,i=(t*n/(1+r))**t;return e<=i?e*n/i:e**(1/t)*(1+r)-r}function b_(e){if(typeof e?.available!=`boolean`||!Number.isInteger(e?.selected_channel)||e.selected_channel<0||e.selected_channel>15||!Array.isArray(e?.values)||e.values.length!==16)throw Error(`Controller returned an invalid PWM snapshot`);let t=e.values.map(e=>{if(!Number.isInteger(e)||e<0||e>4095)throw Error(`Controller returned an out-of-range PWM value`);return e}),n=e.channels?.map(e=>({...e,config:{...e.config}}));return{...e,available:e.available,selected_channel:e.selected_channel,values:t,channels:n}}var x_=class{queued=[];active=!1;run(e){return new Promise((t,n)=>{this.queued.push(()=>{let r;try{r=e()}catch(e){n(e),this.advance();return}r.then(e=>{t(e),this.advance()},e=>{n(e),this.advance()})}),this.drain()})}drain(){if(this.active)return;let e=this.queued.shift();e&&(this.active=!0,e())}advance(){this.active=!1,this.drain()}},S_=class{intervalMS;options;timer=null;readAbort=null;generation=0;running=!1;constructor(e){this.options=e,this.intervalMS=Math.max(250,Math.min(3e4,Math.round(e.intervalMS??1500)))}start(){if(this.running)return;this.running=!0;let e=++this.generation;this.schedule(0,e)}stop(){this.running=!1,this.generation++,this.timer!==null&&clearTimeout(this.timer),this.timer=null,this.readAbort?.abort(),this.readAbort=null}schedule(e,t){this.running&&t===this.generation&&(this.timer=setTimeout(()=>{this.timer=null,this.tick(t)},e))}async tick(e){if(!this.running||e!==this.generation)return;if(!this.options.canRead()){this.schedule(this.intervalMS,e);return}let t=new AbortController;this.readAbort=t;try{let n=b_(await this.options.operations.run(()=>this.options.read(t.signal)));this.running&&e===this.generation&&this.options.onAuthoritative(n)}catch(t){this.running&&e===this.generation&&this.options.onError(t instanceof Error?t:Error(String(t)))}finally{this.readAbort===t&&(this.readAbort=null),this.options.eventDriven||this.schedule(this.intervalMS,e)}}},C_=class{delayMS;options;operations;desired=new Map;inFlight=new Set;timers=new Map;editing=new Set;revision=0;disposed=!1;constructor(e){this.options=e,this.operations=e.operations??new x_,this.delayMS=Math.max(0,Math.round(e.delayMS??140))}schedule(e,t,n=!1){if(this.disposed)return;if(!m_.includes(e)){this.options.onError(e,Error(`Generic PWM controls are limited to user channels 0..10`),!0);return}let r=h_(t);this.desired.set(e,{value:r,revision:++this.revision}),this.options.onDraft(e,r);let i=this.timers.get(e);i&&clearTimeout(i),this.timers.delete(e),this.notifyPending(),n?this.flush(e):this.timers.set(e,setTimeout(()=>{this.timers.delete(e),this.flush(e)},this.delayMS))}pendingChannels(){return[...new Set([...this.desired.keys(),...this.inFlight,...this.editing])].sort((e,t)=>e-t)}beginEdit(e){!this.disposed&&m_.includes(e)&&(this.editing.add(e),this.notifyPending())}isEditing(e){return this.editing.has(e)}endEdit(e){this.editing.delete(e);let t=this.timers.get(e);t&&clearTimeout(t),this.timers.delete(e),this.desired.has(e)&&this.flush(e),this.notifyPending()}dispose(){this.disposed=!0;for(let e of this.timers.values())clearTimeout(e);this.timers.clear(),this.desired.clear(),this.editing.clear()}async flush(e){if(this.disposed||this.inFlight.has(e))return;let t=this.desired.get(e);if(t){this.inFlight.add(e),this.notifyPending();try{let n=b_(await this.operations.run(()=>this.options.commit(e,t.value)));if(this.disposed)return;let r=this.desired.get(e)?.revision===t.revision;r&&this.desired.delete(e),this.options.onAuthoritative(n,r?e:null)}catch(n){if(this.disposed)return;let r=this.desired.get(e);r?.revision===t.revision&&this.desired.delete(e),this.options.onError(e,n instanceof Error?n:Error(String(n)),r?.revision===t.revision)}finally{this.inFlight.delete(e),!this.disposed&&this.desired.has(e)&&this.flush(e),this.notifyPending()}}}notifyPending(){this.disposed||this.options.onPending(this.pendingChannels())}};function w_(e,t,n){if(!e.connected||!n||n!==e.host_instance_id||t.host_instance_id!==n||t.connection_generation!==e.connection_generation||!Number.isSafeInteger(t.revision)||t.revision<=(e.pwm_revision??0)||!t.time||!Number.isFinite(Date.parse(t.time))||!Array.isArray(t.channels)||t.channels.length!==16||new Set(t.channels.map(e=>e.channel)).size!==16||t.channels.some(e=>!Number.isInteger(e.channel)||e.channel<0||e.channel>15||!Number.isInteger(e.raw_value)||e.raw_value<0||e.raw_value>4095||!Number.isFinite(e.logical_percent)||e.logical_percent<0||e.logical_percent>100))return e;try{let n=b_(t);return{...e,pwm_values:n,pwm_revision:t.revision,pwm_updated:t.time}}catch{return e}}function T_(e,t){return t.connected&&e.host_instance_id===t.host_instance_id&&e.connection_generation===t.connection_generation&&(e.pwm_revision??0)>(t.pwm_revision??0)?{...t,pwm_values:e.pwm_values,pwm_revision:e.pwm_revision,pwm_updated:e.pwm_updated}:t}var E_=3e8,D_=250,O_=8,k_=class{anchors=new Map;plan(e,t){if(!Number.isFinite(t)||!Number.isFinite(e.frequencyHz)||e.frequencyHz<0||!Number.isFinite(e.durationMS)||e.durationMS<0||e.durationMS>6e4||e.durationMS===0&&e.frequencyHz!==0)return null;let n=t+O_;if(e.deviceMicros!==void 0){if(!Number.isInteger(e.deviceMicros)||e.deviceMicros<0||e.deviceMicros>4294967295)return null;let r=e.deviceMicros>>>0,i=e.generation?.trim()??``,a=this.anchors.get(e.source);if(a){let e=r-a.deviceMicros>>>0,o=a.startMS+e/1e3,s=o>=t-D_&&o<=t+D_;a.generation===i&&e<=E_&&s&&(n=o)}this.anchors.set(e.source,{deviceMicros:r,startMS:n,generation:i})}let r=n+e.durationMS,i=Math.max(0,r-Math.max(n,t));return{delayMS:Math.max(0,n-t),durationMS:i,audible:e.frequencyHz>=20&&e.frequencyHz<=2e4&&i>=1,stop:e.frequencyHz===0}}};function A_(e,t){return!e&&!t?`both`:e?t?`none`:`host`:`board`}var j_=new Set([`cancelled`,`completed`,`failed`,`local-cancelled`,`local-completed`,`local-failed`]),M_=new Set([`saved`,`saved-truncated`,`discarded`,`failed`,`cleared`]);function N_(e,t,n){let r=Number(e.metadata?.[t]);return Number.isFinite(r)?r:n}function P_(e,t){return{id:N_(e,`macro_id`,t.id??0),name:e.metadata?.macro_name||t.name}}function F_(e){let t=e.kind.trim().toLowerCase();return t===`macro`||t.startsWith(`macro.`)}function I_(e,t,n=80){return F_(t)?[t,...e.filter(e=>e.id!==t.id)].slice(0,n):e.slice(0,n)}function L_(e){let t=e.kind.trim().toLowerCase();return t===`macro.library`||t===`macro.recording`||t===`macro.recovery`}function R_(e,t){if(!F_(t))return e;let n=t.kind.trim().toLowerCase(),r=(t.lifecycle||t.state||``).trim().toLowerCase(),i={...e,latest_event_id:Math.max(e.latest_event_id??0,t.id),playback:{...e.playback},recording:{...e.recording},library:e.library};if(n===`macro.recording.step`){let e=P_(t,i.recording);return i.recording={...i.recording,...e,active:!0,steps:N_(t,`step`,i.recording.steps),last_at_us:N_(t,`at_us`,i.recording.last_at_us??0),last_delta_us:N_(t,`delta_us`,i.recording.last_delta_us??0),last_opcode:N_(t,`opcode`,i.recording.last_opcode??0),last_source:N_(t,`source`,i.recording.last_source??0)},i}if(n===`macro.recording`){let e=!M_.has(r)&&!r.startsWith(`saved`)&&r!==`idle`;return i.recording={...i.recording,active:e,last_error:r===`failed`?t.reason||t.text:i.recording.last_error},i}if(n===`macro`||n===`macro.playback`||n===`macro.step`){let e=P_(t,i.playback),a=j_.has(r);i.playback={...i.playback,...e,category:t.metadata?.category??i.playback.category,color:t.metadata?.color??i.playback.color,running:n===`macro.step`||!a&&r!==`idle`,lifecycle:r||i.playback.lifecycle,step:N_(t,`step`,i.playback.step),step_count:N_(t,`steps`,i.playback.step_count),last_timing_delta_us:N_(t,`mcu_delta_us`,i.playback.last_timing_delta_us??0),maximum_timing_error_us:N_(t,`timing_error_us`,i.playback.maximum_timing_error_us),underruns:N_(t,`underruns`,i.playback.underruns??0),dispatch_errors:N_(t,`dispatch_errors`,i.playback.dispatch_errors??0),faithful:t.metadata?.faithful===void 0?i.playback.faithful:t.metadata.faithful===`true`,last_error:r===`failed`?t.reason||t.text:i.playback.last_error}}return i}var z_={connected:!1,paused:!1,port:{},hello:{},status:{uptime_ms:0,supply_mv:0,bus_mv:0,current_ma:0,power_mw:0,temperature_led_centi_c:0,temperature_bt_audio_centi_c:0,flags:0,ina219_available:!1,temperature_led_available:!1,temperature_bt_audio_available:!1,program_running:!1,host_offline:!1,hot:!1,raw_inputs:0,active_keys:0,active_relays:0,menu_page:0,program_mode:0,door_open:!1,bluetooth_audio_state:0,pwm_available:!1,pwm_channel:0,pwm_value:0,lcd_address:0,pwm_errors:0,framing_errors:0,crc_errors:0,reset_cause:0,reset_count:0},settings:{flags:0,light_mode:0,on_brightness:0,off_brightness:0,display_brightness:0,display_closed_brightness:0,motion_exit_hold_seconds:2,status_brightness:0,output_persistence:0,relay_restore_mask:0,stream_period_ms:200,default_page:0,extended_flags:0,motion_break_ms:1,persisted:!1},have_status:!1,have_settings:!1,emergency_stop:{active:!1,revision:0},hardware_problems:[],illumination:{available:!1,mode:0,on_brightness:0,off_brightness:0,door_open:!1,target_brightness:0,target_pwm:0,applied_brightness:0,applied_pwm:0,at_target:!1,persisted:!1},front_panel:{schema:0,raw_segments:[0,0,0,0],brightness:0,blink:!1,segments_active:!1,category_selector:!1,lcd_address:0,lcd_available:!1,lcd_backlight:!1,lcd_line_1:``,lcd_line_2:``,pressed_keys:0,menu_page:0,program_mode:0,host_captured:!1,host_state:0,host_editable_value:0},have_front_panel:!1,connection_state:`offline`},B_=/\b(?:http\s*)?401\b|unauthori[sz]ed|authentication (?:required|rejected|failed)|invalid (?:session )?token|token (?:is )?(?:missing|invalid|rejected|required|expired)/i;function V_(e){return e.streamState===`open`?!1:B_.test(`${e.streamDetail??``} ${e.connectionReason??``}`)?!0:e.hostRequiresAuthentication?!e.token.trim():!1}function H_(e,t){let n=t===`fa`,r=n?`خرابی سخت‌افزار کنترلر`:`Controller hardware failure`,i=n?`کابل داده، برق و درگاه USB کنترلر را بررسی کنید.`:`Check the controller data cable, power, and USB port.`;switch(e.code){case`usb_descriptor_failure`:r=n?`خرابی اتصال USB کنترلر`:`Controller USB connection failed`,i=n?`دریافت شناسهٔ دستگاه USB ناموفق بود. کابل داده، برق و درگاه USB کنترلر را بررسی کنید.`:`The USB device descriptor failed. Check the controller data cable, power, or try another USB port.`;break;case`device_cannot_start`:case`device_reported_problem`:r=n?`دستگاه USB کنترلر راه‌اندازی نشد`:`Controller USB device could not start`,i=n?`کنترلر را دوباره متصل کنید یا از کابل و درگاه USB دیگری استفاده کنید.`:`Reconnect the controller or use another data cable and USB port.`;break;case`device_disabled`:r=n?`دستگاه کنترلر غیرفعال است`:`Controller device is disabled`,i=n?`دستگاه را در «مدیریت دستگاه‌ها» فعال کنید و سپس دوباره متصل شوید.`:`Enable the device in Device Manager, then reconnect.`;break;case`device_driver_missing`:case`device_driver_failure`:r=n?`درایور USB کنترلر خراب است`:`Controller USB driver problem`,i=n?`درایور USB کنترلر را نصب یا تعمیر کنید و سپس دستگاه را دوباره متصل کنید.`:`Install or repair the controller USB driver, then reconnect the device.`;break;case`device_removal_pending`:r=n?`جداسازی کنترلر در انتظار است`:`Controller removal is pending`,i=n?`کنترلر را جدا کنید و دوباره وصل کنید.`:`Unplug the controller and reconnect it.`}let a=e.impact===`active_operation_outcome_unknown`?n?`ارتباط هنگام یک عملیات فعال قطع شد و نتیجهٔ آن نامشخص است. پیش از ادامه، وضعیت سخت‌افزار را بررسی کنید.`:`Communication was lost during an active operation and its outcome is unknown. Verify the hardware state before continuing.`:void 0;return{title:r,guidance:i,impact:a}}var U_=new Set([`app.page`,`app.title`,`app.progress`]);function W_(e,t,n=Date.now()){let r=e.metadata?.operation_id?.trim()??``,i=e.metadata?.operation_delivery_id?.trim()??``,a=e.metadata?.operation_expires_at?.trim()??``,o=e.kind.trim().toLowerCase();if(!r||!i||!a||!U_.has(o)||!vg(e.metadata?.target_instance,t,`webui`))return null;let s=Date.parse(a);return!Number.isFinite(s)||s<=n?null:{operationID:r,deliveryID:i,receiptKey:`${r}\u0000${i}`,kind:o,value:(o===`app.page`?e.metadata?.page:e.metadata?.value)?.trim()??``}}function G_(e){switch(e.kind){case`app.page`:{let t=Um(e.value);return t?{outcome:`applied`,page:t}:{outcome:`rejected`,reason:`unknown_page`}}case`app.title`:return e.value.toLowerCase()===`auto`?{outcome:`applied`,title:null}:!e.value||[...e.value].length>120||/[\u0000-\u001f\u007f]/u.test(e.value)?{outcome:`rejected`,reason:`invalid_title`}:{outcome:`applied`,title:e.value};case`app.progress`:{let t=q_(e.value);return t===void 0?{outcome:`rejected`,reason:`invalid_progress`}:{outcome:`applied`,progress:t}}}}function K_(e,t){return e.outcome===`applied`&&(`page`in e?t.replacePage(e.page):`title`in e?t.setTitle(e.title):t.setProgress(e.progress),!0)}function q_(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean);if(t.length===0||t.length>2)return;let n={0:`clear`,clear:`clear`,1:`normal`,normal:`normal`,2:`error`,error:`error`,3:`indeterminate`,indeterminate:`indeterminate`,4:`warning`,warning:`warning`}[t[0]];if(!n)return;if(n===`clear`)return t.length===1?null:void 0;if(n===`indeterminate`)return t.length===1?{state:n}:void 0;if(t.length!==2||!/^\d{1,3}$/u.test(t[1]))return;let r=Number(t[1]);if(!(!Number.isInteger(r)||r<0||r>100))return{state:n,percent:r}}var J_=class{maximum;values=new Map;constructor(e=256){this.maximum=e}get(e){return this.values.get(e)}remember(e,t){if(!this.values.has(e)&&this.values.size>=this.maximum){let e=this.values.keys().next().value;e&&this.values.delete(e)}this.values.set(e,t)}};function Y_(e,t,n,r=Date.now()){let i=W_(e,t,r);if(!i)return null;let a=n.get(i.receiptKey);if(a)return{action:i,acknowledgement:a,duplicate:!0};let o=G_(i),s={operation_id:i.operationID,delivery_id:i.deliveryID,instance_id:t,state:o.outcome,...o.outcome===`rejected`?{reason:o.reason}:{}};return n.remember(i.receiptKey,s),{action:i,effect:o,acknowledgement:s,duplicate:!1}}var X_=3,Z_=100;function Q_(e){return new Promise(t=>globalThis.setTimeout(t,e))}async function $_(e,t,n=Q_){let r;for(let i=1;i<=X_;i+=1)try{await t(e);return}catch(e){r=e,it===`fa`?n:e;if((0,E.useEffect)(()=>{e&&c(`appearance`)},[e]),(0,E.useEffect)(()=>{if(e)return u.current=document.activeElement,()=>{let e=u.current;u.current=null,window.requestAnimationFrame(()=>e?.focus())}},[e]),(0,E.useEffect)(()=>{if(!e)return;let t=window.requestAnimationFrame(()=>l.current?.querySelector(`button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex]:not([tabindex="-1"])`)?.focus()),n=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopImmediatePropagation(),o();return}if(e.key!==`Tab`||!l.current)return;let t=[...l.current.querySelectorAll(`button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex]:not([tabindex="-1"])`)];if(!t.length)return;let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,n,!0),()=>{window.cancelAnimationFrame(t),document.removeEventListener(`keydown`,n,!0)}},[o,e]),!e)return null;let f=(e,t)=>{a({...r,[e]:t})},p=e=>c(e);return(0,X.jsxs)(`div`,{className:`app-preferences-layer`,role:`presentation`,children:[(0,X.jsx)(`button`,{type:`button`,className:`app-preferences-backdrop`,"aria-label":d(`Close application preferences`,`بستن ترجیحات برنامه`),onClick:o}),(0,X.jsxs)(`section`,{ref:l,className:`app-preferences-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`app-preferences-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Je,{size:19}),(0,X.jsx)(`strong`,{id:`app-preferences-title`,children:d(`Application preferences`,`ترجیحات برنامه`)})]}),(0,X.jsx)(lp,{compact:!0,"aria-label":d(`Close application preferences`,`بستن ترجیحات برنامه`),icon:ct,onClick:o,children:d(`Close`,`بستن`)})]}),(0,X.jsxs)(`div`,{className:`app-preferences-tabs`,role:`tablist`,"aria-label":d(`Preference category`,`دستهٔ ترجیحات`),children:[(0,X.jsxs)(`button`,{id:`app-preferences-tab-appearance`,type:`button`,role:`tab`,"aria-selected":s===`appearance`,"aria-controls":`app-preferences-panel-appearance`,tabIndex:s===`appearance`?0:-1,className:s===`appearance`?`is-active`:``,onClick:()=>p(`appearance`),children:[(0,X.jsx)(We,{size:16}),d(`Appearance`,`ظاهر`)]}),(0,X.jsxs)(`button`,{id:`app-preferences-tab-header`,type:`button`,role:`tab`,"aria-selected":s===`header`,"aria-controls":`app-preferences-panel-header`,tabIndex:s===`header`?0:-1,className:s===`header`?`is-active`:``,onClick:()=>p(`header`),children:[(0,X.jsx)(Je,{size:16}),d(`Quick header`,`نوار سریع`)]})]}),s===`appearance`?(0,X.jsxs)(`div`,{id:`app-preferences-panel-appearance`,className:`app-preferences-content`,role:`tabpanel`,"aria-labelledby":`app-preferences-tab-appearance`,children:[(0,X.jsxs)(`div`,{className:`setting-group`,children:[(0,X.jsx)(`label`,{children:d(`Theme`,`پوسته`)}),(0,X.jsx)(vp,{value:n.theme,label:d(`Theme`,`پوسته`),options:[{value:`system`,label:d(`System`,`سیستم`),icon:We},{value:`dark`,label:d(`Dark`,`تیره`)},{value:`light`,label:d(`Light`,`روشن`)}],onChange:e=>i({...n,theme:e})})]}),(0,X.jsxs)(`label`,{className:`app-preferences-select`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(j,{size:16}),d(`Language`,`زبان`)]}),(0,X.jsxs)(`select`,{value:n.locale,onChange:e=>i({...n,locale:e.target.value}),children:[(0,X.jsx)(`option`,{value:`en`,children:`English`}),(0,X.jsx)(`option`,{value:`fa`,children:`فارسی`})]})]}),(0,X.jsxs)(`div`,{className:`setting-group`,children:[(0,X.jsx)(`label`,{children:d(`Direction`,`جهت`)}),(0,X.jsx)(vp,{value:n.direction,label:d(`Direction`,`جهت`),options:[{value:`auto`,label:d(`Auto`,`خودکار`)},{value:`ltr`,label:d(`Left to right`,`چپ به راست`)},{value:`rtl`,label:d(`Right to left`,`راست به چپ`)}],onChange:e=>i({...n,direction:e})})]}),(0,X.jsx)(gp,{checked:n.reduceMotion,onChange:e=>i({...n,reduceMotion:e}),label:d(`Reduce interface motion`,`کاهش حرکت رابط`),detail:d(`Applies to this browser and is synchronized by the host.`,`در همین مرورگر اعمال می‌شود و میزبان آن را همگام نگه می‌دارد.`)}),(0,X.jsx)(gp,{checked:n.compactNumbers,onChange:e=>i({...n,compactNumbers:e}),label:d(`Compact large numbers`,`فشرده‌سازی اعداد بزرگ`)}),(0,X.jsx)(gp,{checked:!n.audioMuted,onChange:e=>i({...n,audioMuted:!e}),label:(0,X.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,X.jsx)(nt,{size:16}),d(`Interaction audio`,`صدای تعامل`)]})}),!n.audioMuted&&(0,X.jsx)(_p,{label:(0,X.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,X.jsx)(Ce,{size:16}),d(`Interaction volume`,`بلندی صدای تعامل`)]}),value:Math.round(n.audioVolume*100),min:0,max:100,unit:`%`,onChange:e=>i({...n,audioVolume:e/100})})]}):(0,X.jsxs)(`div`,{id:`app-preferences-panel-header`,className:`app-preferences-content`,role:`tabpanel`,"aria-labelledby":`app-preferences-tab-header`,children:[(0,X.jsx)(`p`,{children:d(`Choose which optional controls appear in the quick header. The preferences button remains visible so every choice is reversible.`,`انتخاب کنید کدام کنترل‌های اختیاری در نوار سریع نمایش داده شوند. دکمهٔ ترجیحات همیشه دیده می‌شود تا همهٔ انتخاب‌ها برگشت‌پذیر باشند.`)}),(0,X.jsx)(gp,{checked:r.theme,onChange:e=>f(`theme`,e),label:d(`Theme switch`,`تغییر پوسته`)}),(0,X.jsx)(gp,{checked:r.language,onChange:e=>f(`language`,e),label:d(`Language switch`,`تغییر زبان`)}),(0,X.jsx)(gp,{checked:r.audio,onChange:e=>f(`audio`,e),label:d(`Interaction audio`,`صدای تعامل`)}),(0,X.jsx)(gp,{checked:r.hotkeys,onChange:e=>f(`hotkeys`,e),label:d(`Keyboard guide`,`راهنمای صفحه‌کلید`)}),(0,X.jsx)(gp,{checked:r.notifications,onChange:e=>f(`notifications`,e),label:d(`Event notifications`,`اعلان رویدادها`)})]}),(0,X.jsx)(`footer`,{children:d(`These preferences affect the host interface only. Controller settings remain on the Settings page.`,`این ترجیحات فقط روی رابط میزبان اثر می‌گذارند. تنظیمات کنترلر در صفحهٔ تنظیمات باقی می‌مانند.`)})]})]})}var tv=`pccontroller:state`;function nv(e){if(typeof window>`u`)return()=>void 0;let t=window.PCController;return Object.defineProperty(window,"PCController",{configurable:!0,value:Object.freeze(e)}),()=>{window.PCController===e&&(t===void 0?delete window.PCController:Object.defineProperty(window,"PCController",{configurable:!0,value:t}))}}function rv(e){typeof window<`u`&&typeof CustomEvent<`u`&&window.dispatchEvent(new CustomEvent(tv,{detail:Object.freeze({...e})}))}var iv=[`theme`,`language`,`audio`,`hotkeys`,`notifications`],av={theme:!0,language:!0,audio:!0,hotkeys:!0,notifications:!0},ov=`pccontroller.quick-header-controls`;function sv(e){let t=e&&typeof e==`object`?e:{};return Object.fromEntries(iv.map(e=>[e,typeof t[e]==`boolean`?t[e]:av[e]]))}function cv(){try{return sv(JSON.parse(window.localStorage.getItem(ov)??`null`))}catch{return{...av}}}function lv(e){try{window.localStorage.setItem(ov,JSON.stringify(sv(e)))}catch{}}function uv(e){switch(e.severity?.trim().toLowerCase()){case`success`:return`success`;case`warning`:return`warning`;case`error`:return`danger`;default:return`info`}}function dv(e,t,n){return e===`fa`?n:t}function fv(e,t){if(e.kind.trim().toLowerCase()!==`message`||!Number.isSafeInteger(e.id)||e.id<=0)return null;let n=e.action?.trim()||void 0,r=e.correlation?.trim()||void 0;return{tone:uv(e),title:e.metadata?.title?.trim()||e.message_type?.trim()||dv(t,`Message`,`پیام`),detail:e.text,messageEventID:e.id,correlation:r,action:n,actionLabel:n?e.metadata?.action_label?.trim()||dv(t,`Suggested action`,`عملیات پیشنهادی`):void 0,persistent:!!(n||r)}}function pv(e,t=`unknown`){if(!Number.isFinite(e)||e==null||e<0)return t;if(e===0)return`0 B`;let n=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],r=Math.min(n.length-1,Math.floor(Math.log(e)/Math.log(1024))),i=e/1024**r,a=r===0||i>=100?0:i>=10?1:2;return`${i.toFixed(a)} ${n[r]}`}function mv(e,t,n=`unknown`){return`${pv(e,n)} / ${pv(t,n)}`}var hv=new Set([`completed`,`failed`,`cancelled`,`downloaded`,`staged`,`outcome-uncertain`]);function gv(e,t){return{host:[`Host update`,`به‌روزرسانی میزبان`],firmware:[`Firmware update`,`به‌روزرسانی میان‌افزار`],eeprom:[`EEPROM update`,`به‌روزرسانی EEPROM`],"artifact-fetch":[`Artifact download`,`دریافت فایل`],"artifact-upload":[`Artifact upload`,`ارسال فایل`],"peer-artifact-upload":[`Incoming host update`,`دریافت به‌روزرسانی میزبان`],"device-capture":[`Board readback`,`بازخوانی برد`]}[e]?.[+(t===`fa`)]??e.replaceAll(`-`,` `)}function _v(e,t){let n=e.kind.trim().toLowerCase();if(!/^(update|peer-update)\./.test(n))return null;let r=e.metadata,i=r?.operation_id?.trim();if(!i)return null;let a=(r?.state||n.split(`.`).slice(1).join(`.`)).trim().toLowerCase(),o=(r?.kind||(n.startsWith(`peer-update.`)?`host`:`update`)).trim().toLowerCase(),s=(r?.stage||a).replaceAll(`-`,` `),c=Number(r?.progress_percent),l=r?.progress_known===`true`&&Number.isFinite(c),u=l?Math.max(0,Math.min(100,c)):void 0,d=Number(r?.bytes_done),f=Number(r?.bytes_total),p=Number.isFinite(d)&&d>=0?d:void 0,m=Number.isFinite(f)&&f>0?f:void 0,h=hv.has(a);return{tone:a===`failed`?`danger`:a===`cancelled`||a===`outcome-uncertain`?`warning`:h?`success`:`info`,title:`${gv(o,t)} · ${s}`,detail:e.text||r?.detail,persistent:!h,updateOperationID:i,progressKnown:l,progressPercent:u,bytesDone:p,bytesTotal:m,progressLabel:m===void 0?l?`${u}%`:t===`fa`?`در حال انتقال`:`Transfer in progress`:mv(p??0,m)}}var vv=`modulepreload`,yv=function(e){return`/`+e},bv={},xv=function(e){return e.pathname.endsWith(`.css`)},Sv=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Cv=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=yv(t,n);let r=s(t),i=xv(r);return Sv(bv,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:vv,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},wv=(0,E.lazy)(()=>Cv(async()=>{let{DashboardView:e}=await import(`./chunk-BEQPqDaE.js`);return{DashboardView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({DashboardView:e})=>({default:e}))),Tv=(0,E.lazy)(()=>Cv(async()=>{let{ControlsView:e}=await import(`./chunk-BEQPqDaE.js`);return{ControlsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({ControlsView:e})=>({default:e}))),Ev=(0,E.lazy)(()=>Cv(async()=>{let{LocalDeviceView:e}=await import(`./chunk-BEQPqDaE.js`);return{LocalDeviceView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({LocalDeviceView:e})=>({default:e}))),Dv=(0,E.lazy)(()=>Cv(async()=>{let{EventsView:e}=await import(`./chunk-BEQPqDaE.js`);return{EventsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({EventsView:e})=>({default:e}))),Ov=(0,E.lazy)(()=>Cv(async()=>{let{SettingsView:e}=await import(`./chunk-BEQPqDaE.js`);return{SettingsView:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({SettingsView:e})=>({default:e}))),kv=(0,E.lazy)(()=>Cv(async()=>{let{WorkbenchView:e}=await import(`./chunk--9VB0-2-.js`);return{WorkbenchView:e}},__vite__mapDeps([8,1,2,3,4,9,10])).then(({WorkbenchView:e})=>({default:e}))),Av=(0,E.lazy)(()=>Cv(async()=>{let{DataWorkspaceView:e}=await import(`./chunk-BzMnsFp-.js`);return{DataWorkspaceView:e}},__vite__mapDeps([11,12,6,3,4,5])).then(({DataWorkspaceView:e})=>({default:e}))),jv=(0,E.lazy)(()=>Cv(async()=>{let{UpdatesView:e}=await import(`./chunk-DyKkUGk4.js`);return{UpdatesView:e}},__vite__mapDeps([13,12,1,7,6,9,4])).then(({UpdatesView:e})=>({default:e}))),Mv=[{id:`dashboard`,label:`dashboard`,icon:Oe,view:wv,group:`core`},{id:`controls`,label:`controls`,icon:Ce,view:Tv,group:`core`},{id:`workbench`,label:`workbench`,icon:ot,view:kv,group:`core`},{id:`device`,label:`device`,icon:Ae,view:Ev,group:`integrations`},{id:`data`,label:`data`,icon:pe,view:Av,group:`integrations`},{id:`updates`,label:`updates`,icon:Re,view:jv,group:`system`},{id:`events`,label:`events`,icon:ae,view:Dv,group:`system`},{id:`settings`,label:`settings`,icon:Xe,view:Ov,group:`system`}];function Nv(e){return Mv.find(t=>t.id===e)?.view??wv}function Pv(e,t=!1){return t||e!==null&&!e.setup_complete}var Fv={theme:`system`,locale:`en`,direction:`auto`,reduceMotion:!1,compactNumbers:!1,audioMuted:!1,audioVolume:.42},Iv=`pccontroller.appearance`,Lv=`pccontroller.resource-reload`;function Rv(e){let t=Th(e);if(!Eh(e)){try{sessionStorage.removeItem(Lv)}catch{}return!1}try{if(sessionStorage.getItem(Lv)===t)return!1;sessionStorage.setItem(Lv,t)}catch{return!1}return window.location.reload(),!0}function zv(){try{return Bv(JSON.parse(localStorage.getItem(Iv)??`{}`))}catch{return Fv}}function Bv(e,t=Fv){return{theme:e.theme===`light`||e.theme===`dark`||e.theme===`system`?e.theme:t.theme,locale:e.locale===`fa`||e.locale===`en`?e.locale:t.locale,direction:e.direction===`ltr`||e.direction===`rtl`||e.direction===`auto`?e.direction:t.direction,reduceMotion:typeof e.reduceMotion==`boolean`?e.reduceMotion:t.reduceMotion,compactNumbers:typeof e.compactNumbers==`boolean`?e.compactNumbers:t.compactNumbers,audioMuted:typeof e.audioMuted==`boolean`?e.audioMuted:t.audioMuted,audioVolume:Number.isFinite(e.audioVolume)?Math.max(0,Math.min(1,Number(e.audioVolume))):t.audioVolume}}function Vv(e,t){return e.theme===t.theme&&e.locale===t.locale&&e.direction===t.direction&&e.reduceMotion===t.reduceMotion&&e.compactNumbers===t.compactNumbers&&e.audioMuted===t.audioMuted&&e.audioVolume===t.audioVolume}function Hv(e){let t=e.theme===`system`?matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:e.theme,n=e.direction===`auto`?e.locale===`fa`?`rtl`:`ltr`:e.direction;document.documentElement.dataset.theme=t,document.documentElement.lang=e.locale===`fa`?`fa-IR`:`en`,document.documentElement.dir=n,document.documentElement.classList.toggle(`reduce-motion`,e.reduceMotion),document.documentElement.classList.toggle(`compact-numbers`,e.compactNumbers),document.querySelector(`meta[data-runtime-theme]`)?.setAttribute(`content`,t===`dark`?`#0b0a0e`:`#f5f3f6`)}function Uv(e){let t=e.replace(/^#\/?/,``).split(/[/?#]/)[0];return Mv.some(e=>e.id===t)?t:`dashboard`}function Wv(e){return`#/${e}`}function Gv(e,t=location.pathname,n=location.search){return`${t}${n}${Wv(e)}`}function Kv(e,t){return e!==t}function qv(){return Uv(location.hash)}function Jv(e,t){return e.filter(e=>!!e.status).map(e=>Qg({...z_,connected:!0,have_status:!0,hello:t,status:e.status},e.time?new Date(e.time).getTime():Date.now())).filter(e=>Number.isFinite(e.at)).slice(-360)}function Yv(e,t){let n=e.trim().toLowerCase().replace(/\s+/g,` `),r=t===`fa`,i=(e,t,n)=>({title:e,body:t,confirmLabel:n});return/^(reset|boot|program|programmer|firmware|flash|upload|restore|query|write)(?: |$)/.test(n)?r?i(`ورود به مسیر بازیابی یا برنامه‌ریزی؟`,`این فرمان ممکن است درگاه سریال را آزاد کند، خطوط کنترل را تغییر دهد یا وارد مسیر محافظت‌شدهٔ برنامه‌ریزی شود. فرمان را یک‌بار دیگر بررسی کنید.`,`تأیید و ارسال`):i(`Enter a recovery or programming path?`,`This command may release the serial port, pulse control lines, or enter the guarded programming workflow. Review the exact command before dispatch.`,`Confirm and dispatch`):/^rf send(?: |$)/.test(n)?r?i(`فرمان رادیویی ارسال شود؟`,`این ارسال می‌تواند یک وسیلهٔ خارجی را فعال کند. کد، پروتکل و تعداد تکرار را پیش از ارسال کنترل کنید.`,`ارسال آگاهانه`):i(`Transmit the radio command?`,`This transmission can actuate an external device. Verify the code, protocol, and repeat count before dispatch.`,`Transmit explicitly`):/^(macro play|automation run|bridge call)(?: |$)/.test(n)?r?i(`اجرای گردش‌کار تأیید شود؟`,`تعریف انتخاب‌شده می‌تواند خروجی‌های برد، فرمان‌های میزبان یا یک میزبان راه‌دور را فعال کند. ابتدا نام و مقصد را بررسی کنید.`,`تأیید اجرا`):i(`Confirm workflow execution?`,`The selected definition can operate board outputs, host actions, or a remote peer. Verify its name and destination first.`,`Confirm run`):/^(os (power|sleep|suspend|hibernate|restart|shutdown|lock)|quit|exit)(?: |$)/.test(n)?r?i(`عملیات میزبان اجرا شود؟`,`این فرمان می‌تواند نشست یا رایانه را متوقف کند. سیاست و توکن تأیید میزبان همچنان در سمت سرویس اعمال می‌شود.`,`تأیید عملیات`):i(`Run the host operation?`,`This command can end the session or affect the computer. Host-side policy and confirmation-token checks still apply.`,`Confirm operation`):null}function Xv(e,t,n=``){return{...e}}function Zv(e){return typeof e!=`number`||!Number.isFinite(e)?1e3:Math.min(5e3,Math.max(750,Math.round(e*4)))}function Qv(e,t,n,r){let i=(e,t)=>r===`fa`?t:e;if(t===`connecting`)return i(`Connecting`,`در حال اتصال`);if(t!==`open`)return i(`Reconnecting`,`در حال اتصال دوباره`);if(n===`loading`)return i(`Synchronizing`,`در حال همگام‌سازی`);if(e.connected)return i(`Board connected`,`برد متصل`);let a=e.connection_state.trim().toLowerCase();return a===`paused`?i(`Paused`,`متوقف`):[`connecting`,`discovering`,`scanning`,`searching`].includes(a)?i(`Searching`,`در حال جستجو`):i(`No board`,`بدون برد`)}function $v(e){return e.kind.toLowerCase()===`update.completed`&&e.metadata?.kind===`host`}function ey(e,t,n=Date.now()){let r=e.kind.toLowerCase();return t!==`updates`&&(r.startsWith(`update.`)||r.startsWith(`peer-update.`))&&Wm(e.time,n)}function ty(e,t,n=!0,r=!1){return r||!n||e===null||e===t?null:t?`connect`:`disconnect`}function ny(e,t=!1){return!t&&(e===`waiting`||e===`closed`)}function ry(){let[e,t]=(0,E.useState)(zv),[n,r]=(0,E.useState)(qv),[i,a]=(0,E.useState)(!0),[o,s]=(0,E.useState)(!1),[c,l]=(0,E.useState)(z_),[u,d]=(0,E.useState)(()=>[]),[f,p]=(0,E.useState)(()=>[]),[m,h]=(0,E.useState)([]),[g,_]=(0,E.useState)(`idle`),[v,y]=(0,E.useState)(null),[b,x]=(0,E.useState)(`connecting`),[S,C]=(0,E.useState)(``),[ee,w]=(0,E.useState)(0),[te,T]=(0,E.useState)([]),[ne,D]=(0,E.useState)({open:!1,title:``,body:``,confirmLabel:``}),[re,O]=(0,E.useState)(!1),[ie,ae]=(0,E.useState)(!1),[oe,se]=(0,E.useState)(``),[ce,ue]=(0,E.useState)(0),[fe,pe]=(0,E.useState)([]),[me,ge]=(0,E.useState)(),[_e,ve]=(0,E.useState)(!1),[be,k]=(0,E.useState)(!1),[A,Se]=(0,E.useState)(cv),[Ce,we]=(0,E.useState)(!1),[Ee,De]=(0,E.useState)({left:0,top:0}),[Oe,ke]=(0,E.useState)(!1),[Ae,je]=(0,E.useState)(!1),[Me,Ne]=(0,E.useState)(12),[Fe,Le]=(0,E.useState)(24),[Re,ze]=(0,E.useState)(!1),[Ve,Ue]=(0,E.useState)(ym),[We,Ge]=(0,E.useState)(!1),[qe,Ye]=(0,E.useState)(0),[Xe,Ze]=(0,E.useState)(``),[$e,tt]=(0,E.useState)([]),[rt,at]=(0,E.useState)(Ag),[ot,st]=(0,E.useState)({state:`idle`,detail:``}),[lt]=(0,E.useState)(()=>new Og),[ut,dt]=(0,E.useState)(null),[ft,pt]=(0,E.useState)(null),[mt,ht]=(0,E.useState)([]),gt=(0,E.useRef)(0),_t=(0,E.useRef)(new Map),vt=(0,E.useRef)(0),M=(0,E.useRef)(null),yt=(0,E.useRef)(new k_),bt=(0,E.useRef)(null),xt=(0,E.useRef)(null),St=(0,E.useRef)(null),Ct=(0,E.useRef)(``),wt=(0,E.useRef)(e),Tt=(0,E.useRef)(Promise.resolve()),Et=(0,E.useRef)(!1),Dt=(0,E.useRef)(!1),N=(0,E.useRef)(n),Ot=(0,E.useRef)(null),kt=(0,E.useRef)(null),At=(0,E.useRef)(rt),jt=(0,E.useRef)(()=>void 0),Mt=(0,E.useRef)(()=>void 0),Nt=(0,E.useRef)(new Qf),Pt=(0,E.useRef)(``),Ft=(0,E.useRef)(c),It=(0,E.useRef)(0),Lt=(0,E.useRef)(``),Rt=(0,E.useRef)(new J_),P=(0,E.useMemo)(()=>Zm(e.locale),[e.locale]),zt=fh(v?.name,`PCController`),Bt=ph(zt,`PC`),Vt=v?.tagline?.trim()||`One host. Every board surface.`,Ht=e.direction===`auto`?e.locale===`fa`?`rtl`:`ltr`:e.direction,Ut=Ht===`rtl`?`18px`:`-18px`;At.current=rt;let Wt=(0,E.useCallback)(e=>{t(e);try{localStorage.setItem(Iv,JSON.stringify(e))}catch{}Hv(e),M.current?.setVolume(e.audioVolume),M.current?.setMuted(e.audioMuted)},[]),Gt=(0,E.useCallback)(e=>{let t=sv(e);Se(t),lv(t)},[]),Kt=(0,E.useCallback)((e,t)=>{let n=Bv(e);Ct.current=t,wt.current=n,Wt(n)},[Wt]),qt=(0,E.useCallback)(async()=>{let e=await Em();return y(e),St.current?.updateStatusInterval(e.status_interval_ms),Kt(e.appearance,e.appearance_etag),e},[Kt]),Jt=(0,E.useCallback)((e,t)=>{y(n=>n&&{...n,status_interval_ms:e,measurement_freshness_ms:t}),St.current?.updateStatusInterval(e)},[]);(0,E.useEffect)(()=>{let e=P(Mv.find(e=>e.id===n)?.label??`dashboard`);document.title=ut??`${zt} — ${e}`},[n,zt,ut,P]),(0,E.useEffect)(()=>{_h(hh(c))},[!1,c.connected,c.connection_reason,c.connection_state,c.have_status,c.status.hot]),(0,E.useEffect)(()=>{Re&&!Dt.current&&(Dt.current=!0,Fh({productTitle:zt,config:v,boardConnected:c.connected,port:c.port.name,streamState:b,demonstration:!1}))},[!1,zt,c.connected,c.port.name,Re,b,v]),(0,E.useEffect)(()=>{N.current=n},[n]);let F=(0,E.useCallback)((e,t)=>{let n=Ot.current?.getBoundingClientRect();De({left:e??(i?n?.left??10:(n?.right??84)+7),top:t??(n?.bottom??10)+7}),we(!0)},[i]);(0,E.useLayoutEffect)(()=>{if(!Ce||!kt.current)return;let e=kt.current.getBoundingClientRect();De(t=>({left:Math.max(10,Math.min(t.left,window.innerWidth-e.width-10)),top:Math.max(10,Math.min(t.top,window.innerHeight-e.height-10))}))},[Ce]),(0,E.useEffect)(()=>{if(!Ce)return;let e=e=>{let t=e.target;!Ot.current?.contains(t)&&!kt.current?.contains(t)&&we(!1)},t=e=>{e.key===`Escape`&&(we(!1),Ot.current?.focus())},n=()=>we(!1),r=window.requestAnimationFrame(()=>kt.current?.querySelector(`button`)?.focus());return window.addEventListener(`pointerdown`,e),window.addEventListener(`focusin`,e),window.addEventListener(`keydown`,t),window.addEventListener(`blur`,n),window.addEventListener(`hashchange`,n),()=>{window.cancelAnimationFrame(r),window.removeEventListener(`pointerdown`,e),window.removeEventListener(`focusin`,e),window.removeEventListener(`keydown`,t),window.removeEventListener(`blur`,n),window.removeEventListener(`hashchange`,n)}},[Ce]),(0,E.useEffect)(()=>{c.connected||we(!1)},[c.connected]),(0,E.useEffect)(()=>{let t=Xf({muted:e.audioMuted,volume:e.audioVolume,pauseWhenHidden:!0});M.current=t;let n=()=>{t.start()};return window.addEventListener(`pointerdown`,n,{capture:!0,once:!0}),window.addEventListener(`keydown`,n,{capture:!0,once:!0}),()=>{window.removeEventListener(`pointerdown`,n,{capture:!0}),window.removeEventListener(`keydown`,n,{capture:!0}),M.current===t&&(M.current=null),t.dispose()}},[]),(0,E.useEffect)(()=>{if(!Re)return;let e=bt.current;bt.current=c.connected;let t=ty(e,c.connected,Re,!1);t&&M.current?.cue(t)},[!1,c.connected,Re]),(0,E.useEffect)(()=>{let e=gg({origin:dm()}),t=new Map;xt.current=e,Ze(e.tabId),Ge(e.supported);let n=()=>{let e=Date.now()-4e4;for(let[n,r]of t)r{let r=e.payload;if(r.type===`presence`)r.state===`leaving`?t.delete(e.tabId):t.set(e.tabId,e.sentAt),n();else if(t.set(e.tabId,e.sentAt),n(),r.type===`appearance`&&(r.etag&&r.etag===Ct.current||qt().catch(()=>void 0)),r.type===`terminal`&&ht(t=>[...t.filter(t=>t.id!==e.messageId).slice(-119),{id:e.messageId,tabId:e.tabId,...r.entry}]),r.type===`controller-event`){let e=r.event;F_(e)&&h(t=>I_(t,e)),f_(e)&&l(t=>{let n=p_(t,e);return Ft.current=n,n}),p(t=>xh(t,e))}}),i=()=>e.publishPresence(document.hidden?`hidden`:`active`,N.current),a=()=>i();i(),document.addEventListener(`visibilitychange`,a);let o=window.setInterval(()=>{i(),n()},12e3);return()=>{document.removeEventListener(`visibilitychange`,a),window.clearInterval(o),e.publishPresence(`leaving`,N.current),r(),e.close(),xt.current===e&&(xt.current=null),Ze(t=>t===e.tabId?``:t)}},[qt]);let I=(0,E.useCallback)((t=document.hidden?`hidden`:`active`,n=!1)=>!Re||!Xe?Promise.resolve():jm(`controller.app.instance.report`,{id:Xe,surface:`webui`,page:N.current,state:t,lease_seconds:45,self:{kind:`browser`,vars:{origin:window.location.origin,platform:navigator.platform||`unknown`,language:navigator.language||`unknown`,user_agent:navigator.userAgent}},values:{color_mode:e.theme,locale:e.locale,direction:Ht,app_actions:`app.page,app.progress,app.title`,...lt.nextValues(rt,n)}}),[Xe,e.locale,e.theme,!1,lt,rt,Ht,Re]);jt.current=(e=!1)=>{e&&At.current&&st({state:`pending`,detail:``}),I(void 0,e).catch(t=>{e&&At.current&&st({state:`error`,detail:t instanceof Error?t.message:String(t)})})},(0,E.useEffect)(()=>{if(!Re||!Xe)return;let e=(e=document.hidden?`hidden`:`active`)=>{I(e).catch(()=>void 0)},t=()=>e();e(),document.addEventListener(`visibilitychange`,t);let n=window.setInterval(()=>e(),3e4);return()=>{document.removeEventListener(`visibilitychange`,t),window.clearInterval(n)}},[Xe,!1,I,Re,Ve]),(0,E.useEffect)(()=>()=>{Xe&&jm(`controller.app.instance.report`,{id:Xe,surface:`webui`,page:N.current,state:`leaving`,lease_seconds:45}).catch(()=>void 0)},[Xe]),(0,E.useEffect)(()=>{if(!Re)return;let e=!0,t=()=>jm(`controller.app.instances`).then(t=>{e&&tt(t)}).catch(()=>{e&&tt([])});t();let n=window.setInterval(t,3e4);return()=>{e=!1,window.clearInterval(n)}},[!1,Re,Ve]),(0,E.useEffect)(()=>{if(Me>=Fe)return;let e=window.setInterval(()=>{Ne(e=>{let t=Fe-e;return t<=0?e:t<.8?Fe:Math.min(Fe,e+Math.max(.75,t*.14))})},72);return()=>window.clearInterval(e)},[Me,Fe]);let Yt=(0,E.useCallback)(e=>{gt.current+=1;let t=gt.current;return T(n=>[...n.slice(-3),{id:t,...e}]),e.tone===`danger`&&M.current?.cue(`error`),e.tone===`warning`&&M.current?.cue(`warning`),e.tone===`success`&&M.current?.cue(`success`),e.persistent||window.setTimeout(()=>T(e=>e.filter(e=>e.id!==t)),5200),t},[]),Xt=(0,E.useCallback)((e,t,n)=>{Yt({tone:e,title:t,detail:n})},[Yt]),Zt=(0,E.useCallback)(e=>{let t=_v(e,wt.current.locale);if(!t?.updateOperationID)return!1;let n=t.updateOperationID,r=_t.current.get(n);r===void 0&&(gt.current+=1,r=gt.current,_t.current.set(n,r));let i={id:r,...t};return T(e=>{let t=e.findIndex(e=>e.updateOperationID===n);return t<0?[...e.slice(-3),i]:e.map((e,n)=>n===t?i:e)}),t.persistent||(_t.current.delete(n),window.setTimeout(()=>T(e=>e.filter(e=>e.id!==r)),5200)),!0},[]);(0,E.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.id||!t.state)return;let n={operation_id:t.id,kind:t.kind,state:t.state,stage:t.stage||t.state,detail:t.detail||``,progress_known:String(t.progress_known===!0),progress_percent:String(t.progress_percent??0),updated_at:t.updated_at||new Date().toISOString()};t.bytes_done!==void 0&&(n.bytes_done=String(t.bytes_done)),t.bytes_total!==void 0&&(n.bytes_total=String(t.bytes_total)),Zt({id:0,time:n.updated_at,kind:`update.${t.state}`,text:t.detail||``,metadata:n})};return window.addEventListener(`pccontroller:update-transfer-progress`,e),()=>window.removeEventListener(`pccontroller:update-transfer-progress`,e)},[Zt]),(0,E.useEffect)(()=>{let t=()=>{let t=M.current;Xt(`success`,e.locale===`fa`?`اعلان آزمایشی`:`Test notification`,e.locale===`fa`?`صدا، لرزش و اعلان آماده‌اند.`:`Audio, haptics, and notifications are ready.`),t&&t.start().then(e=>{e&&t.cue(`success`)})};return window.addEventListener(`pccontroller:test-feedback`,t),()=>window.removeEventListener(`pccontroller:test-feedback`,t)},[e.locale,Xt]);let Qt=(0,E.useCallback)(async()=>{try{let e={epoch:It.current,instanceID:Lt.current},t=await Dm();if(!n_(e,{epoch:It.current,instanceID:Lt.current})||!i_(t,e))return;let n=Ft.current,r=u_(n,t,{epoch:e.epoch,instanceID:t.host_instance_id,authoritativeInstanceID:e.instanceID});Ft.current=r,l(r),d(e=>e_(e,n,r))}catch(e){Xt(`warning`,`Snapshot unavailable`,e instanceof Error?e.message:String(e))}},[!1,Xt]);(0,E.useEffect)(()=>{let e=Nt.current.shouldRead(c,n===`settings`);if(b!==`open`||!c.connected||!c.have_status){Pt.current=``,_(`idle`);return}if(c.have_settings){_(`ready`);return}if(!e)return;_(`loading`);let t=Zf(c);Pt.current=t,Mm(`settings`).then(()=>Qt()).then(()=>{Pt.current===t&&_(`unavailable`)}).catch(()=>{Pt.current===t&&_(`unavailable`)})},[n,Qt,c.connected,c.have_status,c.have_settings,c.hello.build_hash,c.hello.build_timestamp,c.port.instance_id,c.port.name,c.port.serial_number,b]);let $t=(0,E.useCallback)(async(e,t,n=!1)=>{let r=ah(e);xt.current?.publishTerminal({kind:`command`,text:`pc› ${r}`,at:Date.now()});try{let i=(await Mm(e)).output??``;return xt.current?.publishTerminal({kind:`output`,text:i||`✓ accepted`,at:Date.now()}),Xt(`success`,t||`Command completed`,i||r),n&&Qt(),i}catch(e){let t=e instanceof Error?e.message:String(e);throw xt.current?.publishTerminal({kind:`error`,text:`! ${t}`,at:Date.now()}),Xt(`danger`,`Command failed`,t),e}},[!1,Xt,Qt]),en=(0,E.useCallback)((t,n,r=!1)=>{let i=Yv(t,e.locale);return i?new Promise((a,o)=>{let s=!1;D({open:!0,tone:`danger`,title:i.title,body:`${i.body}\n\n${ah(t)}`,confirmLabel:i.confirmLabel,cancel:()=>{s||(s=!0,a(e.locale===`fa`?`پیش از ارسال لغو شد.`:`Cancelled before dispatch.`))},action:async()=>{try{let e=await $t(t,n,r);s=!0,a(e)}catch(e){throw s=!0,o(e),e}}})}):$t(t,n,r)},[e.locale,!1,$t]),tn=(0,E.useCallback)(e=>{D({...e,open:!0})},[]),nn=(0,E.useCallback)((t,n=`push`)=>{let i=Kv(N.current,t),a=Wv(t);n===`push`&&(N.current!==t||location.hash!==a)?history.pushState({page:t},``,Gv(t)):n===`replace`&&(N.current!==t||location.hash!==a)&&history.replaceState({page:t},``,Gv(t)),N.current=t,r(t),s(!1),xt.current?.publishPresence(document.hidden?`hidden`:`active`,t),i&&jt.current(),i&&document.querySelector(`.app-main`)?.scrollTo({top:0,behavior:e.reduceMotion?`auto`:`smooth`})},[e.reduceMotion]),rn=(0,E.useCallback)((t,n=`push`)=>{if(nn(t,n),!rt||!Re||!Xe)return;st({state:`pending`,detail:``});let r;try{r=lt.nextCommit(Xe,t)}catch(e){st({state:`error`,detail:e instanceof Error?e.message:String(e)});return}jm(`controller.app.navigation.commit`,r).then(t=>{let n=lt.settle(t,r.operation_id);if(n)nn(n,`replace`),st({state:`idle`,detail:``});else throw Error(e.locale===`fa`?`پاسخ هماهنگ‌کننده با درخواست فعلی مطابقت ندارد.`:`The coordinator response did not match this request.`)}).catch(e=>{jt.current(!0),st({state:`error`,detail:e instanceof Error?e.message:String(e)})})},[Xe,e.locale,nn,!1,lt,rt,Re]),an=(0,E.useMemo)(()=>({title:zt,hostVersion:v?.host_version||``,page:n,hostOnline:b===`open`,boardConnected:c.connected,port:c.port.name||``,transport:b,eventCount:f.length}),[!1,f.length,n,zt,c.connected,c.port.name,b,v?.host_version]);(0,E.useEffect)(()=>nv({api:`PCController.browser`,inspect:()=>an,command:e=>{let t=e.trim();return t?en(t):Promise.reject(Error(`PCController.command requires a non-empty command`))},refresh:Qt,navigate:e=>{let t=Mv.find(t=>t.id===e)?.id;if(!t)throw Error(`Unknown PCController page: ${e}`);rn(t)}}),[an,rn,Qt,en]),(0,E.useEffect)(()=>{rv(an)},[an]),(0,E.useEffect)(()=>(Mt.current=e=>rn(e,`none`),()=>{Mt.current=()=>void 0}),[rn]);let on=(0,E.useCallback)(e=>{jg(e),lt.resetCoordinator(),st(e?{state:`pending`,detail:``}:{state:`idle`,detail:``}),at(e)},[lt]),sn=(0,E.useCallback)(t=>{let n=Bv(t,wt.current);wt.current=n,Wt(n);let r=M.current;!n.audioMuted&&r&&r.start({muted:!1}).then(e=>{e&&r.cue(`select`)}),Tt.current=Tt.current.then(async()=>{let e=await jm(`controller.ui.config.set`,{appearance:n,if_match:Ct.current});Ct.current=e.appearance_etag,y(t=>t&&{...t,appearance:e.appearance,appearance_etag:e.appearance_etag}),Vv(wt.current,n)&&Kt(e.appearance,e.appearance_etag),xt.current?.publishAppearance(e.appearance,e.appearance_etag)}).catch(async t=>{try{await qt()}catch{}Xt(`warning`,e.locale===`fa`?`تنظیم ظاهر ذخیره نشد`:`Appearance was not saved`,t instanceof Error?t.message:String(t))})},[Kt,e.locale,Wt,!1,Xt,qt]),cn=(0,E.useCallback)(t=>{let n={...e,audioMuted:!t};sn(n);let r=M.current;r?.setVolume(n.audioVolume),r&&r.start({muted:!t}).then(e=>{e&&t&&r.cue(`success`)}),v?.setup_complete?ke(!1):v?jm(`controller.ui.config.set`,{setup_complete:!0}).then(e=>{y(t=>t&&{...t,name:e.app_title,tagline:e.tagline,setup_complete:e.setup_complete,welcome_melody:e.welcome_melody})}).catch(e=>Xt(`warning`,`Setup state was not saved`,e instanceof Error?e.message:String(e))).finally(()=>ke(!1)):Xt(`warning`,`Setup state is unavailable`,`The current host configuration has not loaded yet.`)},[e,!1,Xt,sn,v?.setup_complete]),ln=(0,E.useCallback)(async e=>{let t=await jm(`controller.ui.config.set`,{app_title:e.trim()});return y(e=>e&&{...e,name:t.app_title,tagline:t.tagline,setup_complete:t.setup_complete,welcome_melody:t.welcome_melody}),Xt(`success`,`Application title saved`,t.app_title),t.app_title},[Xt]),un=(0,E.useCallback)(async e=>{await en(`buzzer path ${e}`,`Buzzer routing updated`),await qt()},[qt,en]),dn=(0,E.useCallback)(()=>{sn({...e,audioMuted:!e.audioMuted})},[e,sn]),fn=(0,E.useCallback)(e=>{bm(e),Ue(e.trim()),Xt(`success`,e.trim()?`Session token applied`:`Session token cleared`),window.setTimeout(()=>location.reload(),180)},[Xt]);(0,E.useEffect)(()=>{Hv(e);let t=matchMedia(`(prefers-color-scheme: light)`),n=()=>e.theme===`system`&&Hv(e);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),(0,E.useEffect)(()=>{let e=qv();location.hash!==Wv(e)&&history.replaceState(history.state,``,Gv(e));let t=()=>{let e=qv();Mt.current(e)};return window.addEventListener(`hashchange`,t),window.addEventListener(`popstate`,t),()=>{window.removeEventListener(`hashchange`,t),window.removeEventListener(`popstate`,t)}},[]);let pn=Mv.filter(e=>P(e.label).toLowerCase().includes(oe.toLowerCase())),mn=_g(fe,oe),hn=f.find(e=>e.kind===`peripherals.changed`||e.kind===`config`)?.id;(0,E.useEffect)(()=>{if(!ie||!c.connected){c.connected||pe([]);return}let e=new AbortController;return jm(`controller.peripherals.get`,{},e.signal).then(t=>{e.signal.aborted||pe(t.controls)}).catch(t=>{e.signal.aborted||Xt(`warning`,`Channel search unavailable`,t instanceof Error?t.message:String(t))}),()=>e.abort()},[ie,c.connected,c.port.name,hn]);let gn=e=>{ge(t=>({key:e,revision:(t?.revision??0)+1})),rn(`controls`),ae(!1),se(``)};(0,E.useEffect)(()=>{let e=e=>{if(Oe||be)return;let t=e.isComposing||e.keyCode===229;if(ie){if(t)return;let n=[...pn.map(e=>()=>rn(e.id)),...mn.map(e=>()=>gn(e.key))];if(e.key===`Escape`){e.preventDefault(),ae(!1),se(``);return}if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`){e.preventDefault(),ue(t=>!n.length||e.key===`Home`?0:e.key===`End`?n.length-1:(t+(e.key===`ArrowDown`?1:-1)+n.length)%n.length),M.current?.cue(`navigation`,e.key===`ArrowUp`?`up`:`down`);return}if(e.key===`Enter`&&n.length){e.preventDefault(),n[Math.min(ce,n.length-1)](),ae(!1),se(``),M.current?.cue(`select`);return}(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),ae(!1));return}if(_e){(e.key===`Escape`||e.key===`?`)&&(e.preventDefault(),ve(!1));return}if(ne.open)return;if(e.key===`Escape`&&o){e.preventDefault(),s(!1);return}if(Hm(e))return;if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.key.toLowerCase()===`k`){e.preventDefault(),ue(0),ae(!0);return}if(!e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key===`?`){e.preventDefault(),ve(!0);return}if(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.key.toLowerCase()===`m`&&!e.repeat){e.preventDefault(),dn();return}let r=Gm(e),i=Km(e,n,document.documentElement.dir===`rtl`?`rtl`:`ltr`);if(r||i){e.preventDefault(),rn(r??i),M.current?.cue(`navigation`,e.key.includes(`Left`)?`left`:e.key.includes(`Right`)?`right`:`forward`);return}let a=!e.altKey&&!e.ctrlKey&&!e.metaKey;if(a&&performance.now()<=vt.current){vt.current=0;let t=qm(e.key);if(t){e.preventDefault(),rn(t),M.current?.cue(`navigation`,`forward`);return}}a&&!e.shiftKey&&e.key.toLowerCase()===`g`&&!e.repeat&&(e.preventDefault(),vt.current=performance.now()+1400,M.current?.cue(`focus`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[be,Oe,ne.open,_e,o,rn,n,ie,ce,oe,fe,P,dn]),(0,E.useEffect)(()=>{ue(0)},[oe]),(0,E.useEffect)(()=>{if(Oe)return;let e=null,t=e=>e instanceof Element?e.closest(`button:not(:disabled), a[href], [role="button"]:not([aria-disabled="true"])`):null,n=n=>{let r=t(n.target);r&&r!==e&&(e=r,M.current?.cue(`focus`))},r=t=>{e&&!e.contains(t.relatedTarget)&&(e=null)},i=e=>{t(e.target)&&M.current?.cue(`select`)};return document.addEventListener(`focusin`,n),document.addEventListener(`pointerover`,n),document.addEventListener(`pointerout`,r),document.addEventListener(`click`,i),()=>{document.removeEventListener(`focusin`,n),document.removeEventListener(`pointerover`,n),document.removeEventListener(`pointerout`,r),document.removeEventListener(`click`,i)}},[Oe]),(0,E.useEffect)(()=>{let e=new AbortController,t=Dh(Em,Rv,{signal:e.signal,onError:e=>C(`Host resource check: ${e instanceof Error?e.message:String(e)}`)}),n=Object.assign(()=>{},{updateStatusInterval:e=>void 0}),r=null;return(async()=>{try{Le(42);let i=await Em(e.signal);if(Rv(i))return;y(i),Kt(i.appearance,i.appearance_etag);let a=Pv(i);ke(a),je(!0),Le(70);let o=await Dm(e.signal);Ft.current=o,l(o),ze(!0),o.have_status&&d([Qg(o)]);let s=new Date(Date.now()-36e5).toISOString(),[c,u]=await Promise.allSettled([jm(`controller.history.status`,{since:s},e.signal),jm(`controller.history.timeline`,{since:s,limit:500},e.signal)]);if(c.status===`fulfilled`){let e=Jv(c.value,o.hello);d(t=>[...e,...t].slice(-360))}if(u.status===`fulfilled`&&(p(bh(u.value).slice(-500).reverse()),h(u.value.filter(F_).slice(-80).reverse())),Le(92),a&&o.connected&&i.welcome_melody?.trim())try{await Mm(`melody wait ${ih(i.welcome_melody.trim())}`,e.signal)}catch(e){C(`Welcome melody unavailable: ${e instanceof Error?e.message:String(e)}`)}r=new Zg(e=>{let t=Ft.current,n=t_(t,[],e);C(n.detail),n.applied!==0&&(Ft.current=n.snapshot,l(n.snapshot),d(n=>t_(t,n,e).samples))}),n=Fm(i,{pwm:(e,t)=>{let n=w_(Ft.current,e,t.instanceID);n!==Ft.current&&(Ft.current=n,l(n))},status:(e,t)=>{(e.host_instance_id===void 0||e.host_instance_id===Ft.current.host_instance_id)&&(e.connection_generation!==void 0&&e.connection_generation!==Ft.current.connection_generation?Qt():r?.enqueue(t.generation,e))},snapshot:(e,t)=>{let n=Ft.current,r=T_(n,u_(n,e,{epoch:t.generation,instanceID:e.host_instance_id,authoritativeInstanceID:t.instanceID}));Ft.current=r,l(r),d(e=>e_(e,n,r))},event:(e,t)=>{let n=r_({epoch:It.current,instanceID:Lt.current},{epoch:t.generation,instanceID:t.instanceID});if(!n)return;It.current=n.epoch,Lt.current=n.instanceID??``;let r=e.kind.toLowerCase();r===`app.instance.changed`&&jm(`controller.app.instances`).then(tt).catch(()=>void 0);let a=F_(e);if(a&&h(t=>I_(t,e)),f_(e)&&l(n=>{let r=p_(n,e,{epoch:t.generation,instanceID:t.instanceID});return Ft.current=r,r}),i.integrations?.buzzer_web_audio&&r===`buzzer.note`){let t=Number(e.metadata?.frequency_hz),n=Number(e.metadata?.duration_ms),r=e.metadata?.device_micros,i=r===void 0?void 0:Number(r),a=e.metadata?.[`bridge.ingress`]?`bridge:${e.metadata[`bridge.ingress`]}`:`local-board`,o=yt.current.plan({source:a,frequencyHz:t,durationMS:n,deviceMicros:i,generation:e.metadata?.connection_generation},performance.now());o?.stop?M.current?.stopTone(a,o.delayMS):o?.audible&&(M.current?.stopTone(a,o.delayMS),M.current?.playTone(t,o.durationMS,o.delayMS,a))}let o=yh(e);o&&p(t=>xh(t,e));let s=Y_(e,Xe,Rt.current);if(s){let{acknowledgement:e}=s;if(!s.duplicate){let{effect:e}=s;K_(e,{replacePage:e=>{nn(e,`replace`),M.current?.cue(`navigation`,`forward`)},setTitle:dt,setProgress:pt})}$_(e,e=>jm(`controller.app.action.ack`,e)).catch(e=>{let t=wt.current.locale;Xt(`warning`,t===`fa`?`تأیید فرمان ارسال نشد`:`Action not confirmed`,e instanceof Error?e.message:String(e))})}if((o||f_(e)||a)&&xt.current?.publishControllerEvent(e),!e.metadata?.operation_id&&e.kind.toLowerCase()===`app.page`&&Wm(e.time)&&vg(e.metadata?.target_instance,Xe,`webui`)){let t=Um(e.metadata?.page??e.metadata?.value??e.text);if(t){let n=e.metadata?.navigation_sync?.toLowerCase()===`group`,r=n?At.current?lt.acceptAction(e.metadata,t):null:t;r&&(nn(r,`replace`),n&&st({state:`idle`,detail:``}),M.current?.cue(`navigation`,`forward`))}}if(ey(e,N.current)&&(nn(`updates`,`replace`),M.current?.cue(`navigation`,`forward`)),!Zt(e)&&Sh(e,Xe)){let t=fv(e,wt.current.locale);t?Yt(t):Xt(iy(e),e.kind,e.text)}$v(e)&&(Et.current=!0),/config/i.test(e.kind)&&qt().catch(()=>void 0),/device|connection|settings|illumination|^macro/i.test(e.kind)&&Qt()},state:(e,n,i)=>{if(i?.generation){if(!r?.adoptGeneration(i.generation))return;let e=r_({epoch:It.current,instanceID:Lt.current},{epoch:i.generation,instanceID:i.instanceID});if(!e)return;It.current=e.epoch,Lt.current=e.instanceID??``}if(t.state(e),x(e),C(n??``),e===`open`){if(lt.resetCoordinator(),jt.current(!0),Et.current){Et.current=!1,window.location.reload();return}Qt()}else i?.generation&&r?.cancelPending(i.generation),l(t=>{let r=Xv(t,e,n);return Ft.current=r,r})}}),St.current=n,Le(100)}catch(e){ze(!0),ke(!1),je(!0),x(`waiting`),C(e instanceof Error?e.message:String(e)),l(t=>{let n=Xv(t,`waiting`,e instanceof Error?e.message:String(e));return Ft.current=n,n}),Le(100)}})(),()=>{e.abort(),t.dispose(),r?.dispose(),St.current===n&&(St.current=null),n()}},[Kt,Xe,nn,!1,Yt,rn,lt,Xt,Zt,Qt,qt,ee,Ve]),(0,E.useEffect)(()=>{if(!Re||b===`open`)return;let e=!0,t=async()=>{try{let t=await Dm();if(!e)return;let n=Ft.current;Ft.current=t,l(t),d(e=>e_(e,n,t))}catch{}};t();let n=window.setInterval(t,Zv(v?.status_interval_ms));return()=>{e=!1,window.clearInterval(n)}},[!1,Re,b,v?.status_interval_ms]);let _n=V_({hostRequiresAuthentication:v?.auth_required===!0,streamState:b,token:Ve,streamDetail:S,connectionReason:c.connection_reason}),vn=b===`open`&&c.connected&&c.have_status?`ready`:!Re||b===`connecting`?`loading`:`unavailable`,L={focusControl:me,reduceMotion:e.reduceMotion,appTitle:zt,snapshot:c,samples:u,events:f,macroEvents:m,locale:e.locale,t:P,command:en,refresh:Qt,openDialog:tn,boardSettingsReadState:g,transport:{streamState:b,authenticationRequired:_n,boardState:vn,tabBusSupported:We,tabPeers:qe,statusIntervalMS:v?.status_interval_ms,measurementFreshnessMS:v?.measurement_freshness_ms},relayedTerminal:mt,broadcastTerminal:e=>{xt.current?.publishTerminal(e)}},yn=Nv(n),bn=c.hardware_problems?.[0],xn=bn?H_(bn,e.locale):void 0,Sn=(0,X.jsx)(E.Suspense,{fallback:(0,X.jsxs)(`section`,{className:`page-loading`,role:`status`,"aria-live":`polite`,children:[(0,X.jsx)(`span`,{className:`spinner`}),e.locale===`fa`?`در حال بارگیری…`:`Loading page…`]}),children:n===`settings`?(0,X.jsx)(yn,{...L,appearance:e,onAppearance:sn,token:Ve,onToken:fn,onAppTitle:ln,uiConfig:v,onMeasurementTiming:Jt,onBuzzerPath:un,navigationSync:rt,navigationSyncStatus:ot,onNavigationSync:on,appInstances:$e}):(0,X.jsx)(yn,{...L})}),Cn=Mv.find(e=>e.id===n)??Mv[0],wn=()=>{re||(ne.cancel?.(),D(e=>({...e,open:!1})))},Tn=async()=>{if(!ne.action)D(e=>({...e,open:!1}));else{O(!0);try{await ne.action(),D(e=>({...e,open:!1}))}catch{}finally{O(!1)}}},En=c.connected&&b===`open`?`good`:b===`connecting`?`info`:b===`open`?`neutral`:`warn`,Dn=Qv(c,b,vn,e.locale),On=dh(c,e.locale),kn=sh(c),An=c.connected?[[`status`,`${c.port.name||(e.locale===`fa`?`کنترلر`:`Controller`)} · ${c.status_updated?rh(e.locale,c.status_updated):P(`online`)}`],[`relay off`,c.status.active_relays?e.locale===`fa`?`${c.status.active_relays.toString(2).replace(/0/g,``).length} خروجی فعال`:`${c.status.active_relays.toString(2).replace(/0/g,``).length} active outputs`:e.locale===`fa`?`همهٔ خروجی‌ها آزادند`:`All outputs released`],[`rf list`,e.locale===`fa`?`فهرست رادیویی کنترلر`:`Controller radio inventory`],[`macro list`,e.locale===`fa`?`فهرست ماکروهای کنترلر`:`Controller macro inventory`]]:[[`ports`,c.connection_reason||(e.locale===`fa`?`جستجوی درگاه‌های سریال موجود`:`Discover available serial ports`)],[`hotkeys status`,e.locale===`fa`?`سرویس میان‌برهای سراسری`:`Global shortcut service`],[`os status`,e.locale===`fa`?`وضعیت سیستم‌عامل میزبان`:`Host operating-system state`]],jn=e.locale===`fa`?`WS ${b===`open`?`باز`:b===`connecting`?`در حال اتصال`:b===`closed`?`بسته`:b} · ${eh(`fa`,qe+1)} زبانه`:`WS ${b} · ${qe+1} ${qe===0?`tab`:`tabs`}`,Mn=ny(b,!1);return(0,X.jsxs)(Md,{reducedMotion:e.reduceMotion?`always`:`user`,children:[(0,X.jsxs)(`div`,{className:`app-shell${i?``:` is-sidebar-compact`}${Ae?``:` is-bootstrap-pending`}`,inert:!Ae||Oe||_e||be?!0:void 0,"aria-hidden":!Ae||Oe||_e||be?!0:void 0,children:[ft&&(0,X.jsx)(`div`,{className:`app-action-progress app-action-progress--${ft.state}`,role:`progressbar`,"aria-label":e.locale===`fa`?`پیشرفت فرمان راه دور`:`Remote action progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ft.percent,children:(0,X.jsx)(`span`,{style:ft.percent===void 0?void 0:{width:`${ft.percent}%`}})}),(0,X.jsxs)(`aside`,{className:`sidebar`,"aria-label":P(`primaryNavigation`),children:[(0,X.jsxs)(`div`,{className:`brand`,children:[(0,X.jsx)(`a`,{className:`brand__mark`,href:`#/dashboard`,"aria-label":`${zt} ${P(`dashboardLink`)}`,children:(0,X.jsx)(op,{fallback:Bt})}),(0,X.jsxs)(`a`,{className:`brand__copy`,href:`#/dashboard`,children:[(0,X.jsx)(`strong`,{children:zt}),(0,X.jsx)(`span`,{children:Vt})]}),(0,X.jsx)(`button`,{className:`sidebar-toggle`,"aria-label":P(i?`collapseNavigation`:`expandNavigation`),title:P(i?`collapseNavigation`:`expandNavigation`),"aria-expanded":i,"aria-controls":`primary-navigation`,onClick:()=>a(e=>!e),children:i?(0,X.jsx)(Be,{size:18}):(0,X.jsx)(He,{size:18})})]}),(0,X.jsxs)(`button`,{ref:Ot,type:`button`,className:`sidebar__status`,"aria-haspopup":`menu`,"aria-expanded":Ce,"aria-disabled":!c.connected&&On.retryDisabled,"aria-label":c.connected?e.locale===`fa`?`منوی اتصال برد`:`Board connection menu`:e.locale===`fa`?`اتصال مجدد برد`:`Reconnect board`,title:`${c.connected?e.locale===`fa`?`برد آنلاین`:`Board online`:On.title} · ${On.candidate||c.connection_state}`,onClick:()=>{if(c.connected)Ce?we(!1):F();else{if(we(!1),On.retryDisabled)return;en(`reconnect`)}},onContextMenu:e=>{e.preventDefault(),F(e.clientX,e.clientY)},onKeyDown:e=>{(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),F())},children:[(0,X.jsx)(`span`,{className:`status-rail status-rail--${c.connected?`good`:On.tone}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:c.connected?e.locale===`fa`?`برد آنلاین`:`Board online`:On.title}),(0,X.jsx)(`small`,{children:c.connected?c.port.name:On.timing||On.candidate||c.connection_state})]}),(0,X.jsx)(xe,{size:18,"aria-hidden":`true`})]}),Ce&&typeof document<`u`&&(0,zf.createPortal)((0,X.jsxs)(`div`,{ref:kt,className:`sidebar__status-menu`,role:`menu`,"aria-label":e.locale===`fa`?`عملیات اتصال برد`:`Board connection actions`,style:Ee,children:[(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!c.connected&&On.retryDisabled,onClick:()=>{we(!1),en(`reconnect`)},children:c.connected?e.locale===`fa`?`اتصال مجدد`:`Reconnect`:On.action}),kn&&(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),en(`reset lines`)},children:e.locale===`fa`?`بازنشانی سخت‌افزاری (DTR)`:`Hardware reset (DTR)`}),c.connected&&(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),en(`close`)},children:e.locale===`fa`?`بستن درگاه`:`Close port`}),(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),se(`ports`),ue(0),ae(!0)},children:e.locale===`fa`?`انتخاب درگاه USB`:`Choose USB port`}),(0,X.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{we(!1),rn(`device`)},children:e.locale===`fa`?`جزئیات دستگاه`:`Device details`})]}),document.body),(0,X.jsx)(`nav`,{className:`sidebar__nav`,id:`primary-navigation`,children:[`core`,`integrations`,`system`].map(e=>(0,X.jsxs)(`div`,{className:`nav-group`,children:[(0,X.jsx)(`span`,{className:`nav-group__label`,children:P(e===`core`?`system`:e===`integrations`?`integrations`:`operations`).toUpperCase()}),Mv.filter(t=>t.group===e).map(e=>(0,X.jsx)(Sp,{icon:e.icon,label:P(e.label),active:n===e.id,badge:e.id===`events`&&f.length?String(Math.min(f.length,99)):void 0,onClick:()=>rn(e.id)},e.id))]},e))}),(0,X.jsxs)(`div`,{className:`sidebar__footer`,children:[(0,X.jsx)(xe,{size:17}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:Dn}),(0,X.jsx)(`span`,{children:jn})]})]})]}),(0,X.jsxs)(`header`,{className:`topbar`,children:[(0,X.jsx)(`button`,{className:`mobile-menu`,"aria-label":P(`openNavigation`),onClick:()=>s(!0),children:(0,X.jsx)(Pe,{size:20})}),(0,X.jsxs)(`div`,{className:`breadcrumbs`,children:[(0,X.jsx)(`span`,{children:Bt}),(0,X.jsx)(`i`,{children:`/`}),(0,X.jsx)(`strong`,{children:P(Cn.label)})]}),(0,X.jsxs)(`button`,{className:`command-trigger`,"aria-keyshortcuts":rp(),onClick:()=>{ue(0),ae(!0)},children:[(0,X.jsx)(Ke,{size:16}),(0,X.jsx)(`span`,{children:P(`searchCommands`)}),(0,X.jsx)(cp,{keys:[np(),`K`]})]}),(0,X.jsxs)(`div`,{className:`topbar__actions`,children:[!1,Mn?(0,X.jsx)(`button`,{className:`transport-reconnect`,title:S||void 0,"aria-label":e.locale===`fa`?`اتصال مجدد فوری میزبان`:`Reconnect host now`,onClick:()=>{Mn&&(C(``),x(`connecting`),w(e=>e+1))},children:(0,X.jsx)(pp,{tone:En,children:Dn})}):(0,X.jsx)(`span`,{title:S||void 0,children:(0,X.jsx)(pp,{tone:En,pulse:b===`connecting`,children:Dn})}),(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":e.locale===`fa`?`ترجیحات برنامه`:`Application preferences`,"aria-haspopup":`dialog`,"aria-expanded":be,onClick:()=>k(!0),children:(0,X.jsx)(Je,{size:18})}),A.theme&&(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":P(`toggleTheme`),onClick:()=>sn({...e,theme:document.documentElement.dataset.theme===`dark`?`light`:`dark`}),children:document.documentElement.dataset.theme===`dark`?(0,X.jsx)(Qe,{size:18}):(0,X.jsx)(Ie,{size:18})}),A.language&&(0,X.jsx)(`button`,{className:`topbar-icon`,"aria-label":P(`switchLanguage`),onClick:()=>sn({...e,locale:e.locale===`en`?`fa`:`en`}),children:(0,X.jsx)(j,{size:18})}),A.audio&&(0,X.jsx)(`button`,{className:`topbar-icon topbar-audio`,"aria-label":P(e.audioMuted?`enableAudio`:`muteAudio`),"aria-pressed":e.audioMuted,"aria-keyshortcuts":`M`,onClick:dn,children:e.audioMuted?(0,X.jsx)(it,{size:18}):(0,X.jsx)(nt,{size:18})}),A.hotkeys&&(0,X.jsx)(`button`,{className:`topbar-icon topbar-hotkeys`,"aria-label":P(`keyboardShortcuts`),"aria-keyshortcuts":`?`,onClick:()=>ve(!0),children:(0,X.jsx)(Te,{size:18})}),A.notifications&&(0,X.jsxs)(`button`,{className:`topbar-icon`,"aria-label":P(`notifications`),onClick:()=>rn(`events`),children:[(0,X.jsx)(le,{size:18}),f.length>0&&(0,X.jsx)(`i`,{})]})]})]}),(0,X.jsxs)(`main`,{className:`app-main`,children:[n!==`dashboard`&&bn&&xn&&(0,X.jsxs)(`section`,{className:`hardware-alert app-hardware-alert is-${bn.severity}`,role:`alert`,"aria-live":`assertive`,children:[(0,X.jsx)(`div`,{className:`hardware-alert__icon`,children:(0,X.jsx)(et,{size:24,"aria-hidden":`true`})}),(0,X.jsxs)(`div`,{className:`hardware-alert__copy`,children:[(0,X.jsx)(`strong`,{children:xn.title}),(0,X.jsx)(`p`,{children:xn.guidance}),xn.impact&&(0,X.jsx)(`p`,{className:`hardware-alert__impact`,children:xn.impact})]})]}),(0,X.jsx)(Tp,{pageKey:n,children:Sn})]}),(0,X.jsx)(`nav`,{className:`mobile-bottom-nav`,"aria-label":P(`mobileNavigation`),children:Mv.slice(0,5).map(e=>(0,X.jsxs)(`button`,{className:n===e.id?`is-active`:``,onClick:()=>rn(e.id),children:[(0,X.jsx)(ap,{icon:e.icon,size:20}),(0,X.jsx)(`span`,{children:P(e.label)})]},e.id))}),(0,X.jsx)(Td,{children:o&&(0,X.jsxs)(Vf.div,{className:`mobile-drawer-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`mobile-drawer-backdrop`,"aria-label":P(`dismissNavigation`),onClick:()=>s(!1)}),(0,X.jsxs)(Vf.aside,{className:`mobile-drawer`,initial:{x:Ut,opacity:0},animate:{x:0,opacity:1},exit:{x:Ut,opacity:0},transition:{duration:.32,ease:[.22,1,.36,1]},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`div`,{className:`brand__mark`,children:(0,X.jsx)(op,{fallback:Bt})}),(0,X.jsx)(`strong`,{children:zt}),(0,X.jsx)(`button`,{type:`button`,"aria-label":P(`closeNavigation`),onClick:()=>s(!1),children:(0,X.jsx)(ct,{size:19})})]}),Mv.map(e=>(0,X.jsx)(Sp,{icon:e.icon,label:P(e.label),active:n===e.id,onClick:()=>rn(e.id)},e.id))]})]})}),(0,X.jsx)(Td,{children:ie&&(0,X.jsxs)(Vf.div,{className:`palette-layer`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[(0,X.jsx)(`button`,{className:`palette-backdrop`,"aria-label":P(`closeCommandPalette`),onClick:()=>{ae(!1),se(``)}}),(0,X.jsxs)(Vf.section,{className:`palette`,role:`dialog`,"aria-modal":`true`,"aria-label":P(`commandPalette`),initial:{opacity:0,scale:.985},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.99},transition:{duration:.2,ease:`easeOut`},children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(ye,{size:19}),(0,X.jsx)(`input`,{autoFocus:!0,value:oe,placeholder:P(`commandPalettePlaceholder`),"aria-controls":`palette-results`,"aria-activedescendant":pn[ce]?`palette-page-${pn[ce].id}`:mn[ce-pn.length]?`palette-channel-${mn[ce-pn.length].key}`:void 0,onChange:e=>se(e.target.value)}),(0,X.jsx)(cp,{keys:[`Esc`]})]}),(0,X.jsxs)(`div`,{className:`palette__results`,id:`palette-results`,role:`listbox`,"aria-label":P(`matchingPages`),children:[(0,X.jsx)(`span`,{className:`palette__label`,children:P(`pagesLabel`).toUpperCase()}),pn.map((t,r)=>(0,X.jsxs)(`button`,{id:`palette-page-${t.id}`,role:`option`,"aria-selected":r===ce,className:r===ce?`is-highlighted`:``,onPointerMove:()=>ue(r),onClick:()=>{rn(t.id),ae(!1),se(``)},children:[(0,X.jsx)(ap,{icon:t.icon,size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:P(t.label)}),(0,X.jsx)(`small`,{children:n===t.id?e.locale===`fa`?`صفحه فعلی`:`Current page`:e.locale===`fa`?`باز کردن`:`Open`})]}),(0,X.jsx)(he,{className:n===t.id?`is-visible`:``,size:16})]},t.id)),(0,X.jsx)(`span`,{className:`palette__label`,children:P(`quickCommandsLabel`).toUpperCase()}),mn.map((e,t)=>(0,X.jsxs)(`button`,{id:`palette-channel-${e.key}`,role:`option`,"aria-selected":ce===pn.length+t,className:ce===pn.length+t?`is-highlighted`:``,onPointerMove:()=>ue(pn.length+t),onClick:()=>gn(e.key),children:[(0,X.jsx)(de,{size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`small`,{children:e.key})]})]},e.key)),An.filter(([e,t])=>`${e} ${t}`.toLowerCase().includes(oe.toLowerCase())).map(([e,t])=>(0,X.jsxs)(`button`,{role:`option`,"aria-selected":`false`,onClick:()=>{en(e),ae(!1)},children:[(0,X.jsx)(de,{size:18}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{dir:`ltr`,children:e}),(0,X.jsx)(`small`,{children:t})]})]},e))]}),(0,X.jsxs)(`footer`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(cp,{keys:[[`↑`,`↓`]]}),` `,P(`navigate`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(cp,{keys:[`Enter`]}),` `,P(`select`)]}),(0,X.jsxs)(`span`,{children:[pn.length+mn.length+An.filter(([e,t])=>`${e} ${t}`.toLowerCase().includes(oe.toLowerCase())).length,` `,P(`actions`),` · WS `,b]})]})]})]})}),(0,X.jsx)(Op,{state:{...ne,action:Tn},onClose:wn,busy:re}),(0,X.jsx)(kp,{messages:te,dismiss:e=>T(t=>t.filter(t=>t.id!==e))})]}),(0,X.jsx)(ev,{open:be,locale:e.locale,appearance:e,quickHeader:A,onAppearance:sn,onQuickHeader:Gt,onClose:()=>k(!1)}),(0,X.jsx)(Ep,{open:Ae&&Oe,progress:Me,locale:e.locale,productTitle:zt,productShortName:Bt,productTagline:Vt,onEnter:cn}),(0,X.jsx)(Dp,{open:_e,locale:e.locale,onClose:()=>ve(!1)})]})}function iy(e){let t=e.kind.toLowerCase();return/error|fault|hot/.test(t)?`danger`:/warning|door|disconnect/.test(t)?`warning`:/connect|ready|complete/.test(t)?`success`:`info`}var ay=class{suppressUntil=new WeakMap;begin(e,t,n,r=Date.now()){return t!==`touch`||!n?!1:(this.suppressUntil.set(e,r+800),!0)}shouldSuppressNativeClick(e,t,n=Date.now()){return t===0||n>(this.suppressUntil.get(e)??0)?!1:(this.suppressUntil.delete(e),!0)}};function oy(e){return e instanceof Element?e.closest(`button, [role="button"], [role="switch"], input[type="checkbox"]`)||(e.closest(`label`)?.querySelector(`input[type="checkbox"]`)??null):null}function sy(e){return!e.matches(`:disabled, [aria-disabled="true"]`)&&!e.closest(`[data-touch-mode="hold"], [data-touch-mode="deferred"]`)}function cy(e=document){let t=new ay,n=new WeakSet,r=e=>{let r=oy(e.target);if(r&&sy(r)&&t.begin(r,e.pointerType,e.isPrimary)){e.preventDefault();try{r.focus({preventScroll:!0})}catch{r.focus()}n.add(r),r.click(),n.delete(r)}},i=e=>{let r=oy(e.target);r&&!n.has(r)&&t.shouldSuppressNativeClick(r,e.detail)&&(e.preventDefault(),e.stopImmediatePropagation())};return e.addEventListener(`pointerdown`,r,!0),e.addEventListener(`click`,i,!0),()=>{e.removeEventListener(`pointerdown`,r,!0),e.removeEventListener(`click`,i,!0)}}var ly=document.getElementById(`root`);if(!ly)throw Error(`Controller UI root is missing`);(0,Bf.createRoot)(ly).render((0,X.jsx)(E.StrictMode,{children:(0,X.jsx)(ry,{})}));var uy=cy();window.addEventListener(`pagehide`,uy,{once:!0}),window.requestAnimationFrame(()=>document.getElementById(`startup-preloader`)?.remove()),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>void 0)},{once:!0});export{ap as $,Im as A,he as At,Lp as B,th as C,Oe as Ct,vm as D,A as Dt,eh as E,Ce as Et,Np as F,h as Ft,Ip as G,Pp as H,Fp as I,d as It,lp as J,zp as K,Up as L,o as Lt,jm as M,se as Mt,lm as N,ae as Nt,Rm as O,xe as Ot,Zp as P,O as Pt,up as Q,Rp as R,s as Rt,$m as S,Ae as St,Qm as T,Te as Tt,Xp as U,Hp as V,Yp as W,xp as X,dp as Y,bp as Z,sh as _,Je as _t,R_ as a,vp as at,ih as b,Ie as bt,C_ as c,gp as ct,m_ as d,ut as dt,cp as et,b_ as f,ct as ft,dh as g,Qe as gt,Yg as h,et as ht,H_ as i,fp as it,Sm as j,de as jt,ym as k,_e as kt,x_ as l,Vf as lt,__ as m,nt as mt,mv as n,_p as nt,L_ as o,pp as ot,g_ as p,it as pt,Vp as q,pv as r,sp as rt,A_ as s,yp as st,Cv as t,hp as tt,S_ as u,Td as ut,ah as v,Ke as vt,nh as w,j as wt,rh as x,Me as xt,oh as y,We as yt,Bp as z,l as zt}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-DzUGOX3N.js b/Tools/Controller/internal/webui/dist/assets/chunk--9VB0-2-.js similarity index 99% rename from Tools/Controller/internal/webui/dist/assets/chunk-DzUGOX3N.js rename to Tools/Controller/internal/webui/dist/assets/chunk--9VB0-2-.js index d77f849d..c13feca7 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-DzUGOX3N.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk--9VB0-2-.js @@ -1,4 +1,4 @@ -import{$ as e,Ct as t,Et as n,It as r,J as i,M as a,Mt as o,Nt as s,Ot as c,Pt as l,St as u,Tt as d,X as f,Y as p,_ as m,_t as h,a as g,at as _,b as v,ct as y,dt as b,ft as x,g as ee,h as te,it as S,mt as ne,nt as C,o as re,ot as ie,pt as w,st as T,v as ae,x as oe,zt as E}from"./app-DHmIY1mo.js";import{i as D,r as O,t as se}from"./chunk-COZaly3R.js";import{_ as k,a as ce,b as A,c as j,d as le,f as M,g as ue,h as de,i as fe,l as N,m as pe,n as me,o as P,p as he,r as ge,s as F,t as I,u as _e,v as ve,x as ye,y as be}from"./chunk-BepNkYer.js";import{i as xe,n as Se,t as Ce}from"./chunk-CWMYvVMg.js";import{n as we,t as Te}from"./chunk-Co4i84v0.js";import{t as Ee}from"./chunk-DQyIR_Rr.js";var L={name:`antenna`,size:24,node:[[`path`,{d:`M2 12 7 2`,key:`117k30`}],[`path`,{d:`m7 12 5-10`,key:`1tvx22`}],[`path`,{d:`m12 12 5-10`,key:`ev1o1a`}],[`path`,{d:`m17 12 5-10`,key:`1e4ti3`}],[`path`,{d:`M4.5 7h15`,key:`vlsxkz`}],[`path`,{d:`M12 16v6`,key:`c8a4gj`}]]};L.node;var De=l(L),Oe={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};Oe.node;var ke=l(Oe),Ae={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Ae.node;var je=l(Ae),Me={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Me.node;var Ne=l(Me),Pe={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};Pe.node;var Fe=l(Pe),Ie={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Ie.node;var Le=l(Ie),Re={name:`door-open`,size:24,node:[[`path`,{d:`M10 21H2`,key:`1sthdo`}],[`path`,{d:`M10 3H7a2 2 0 00-2 2v16`,key:`15gt7x`}],[`path`,{d:`M14 12h.01`,key:`1jfl7z`}],[`path`,{d:`M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z`,key:`tyvg9a`}],[`path`,{d:`M22 21h-3`,key:`1ec3tr`}]]};Re.node;var ze=l(Re),Be={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};Be.node;var Ve=l(Be),He={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};He.node;var Ue=l(He),We={name:`keyboard-off`,size:24,node:[[`path`,{d:`M 20 4 A2 2 0 0 1 22 6`,key:`1g1fkt`}],[`path`,{d:`M 22 6 L 22 16.41`,key:`1qjg3w`}],[`path`,{d:`M 7 16 L 16 16`,key:`n0yqwb`}],[`path`,{d:`M 9.69 4 L 20 4`,key:`kbpcgx`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2`,key:`s23sx2`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}]]};We.node;var Ge=l(We),R={name:`layout-panel-top`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}]]};R.node;var Ke=l(R),qe={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};qe.node;var Je=l(qe),Ye={name:`list-tree`,size:24,node:[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]};Ye.node;var Xe=l(Ye),z={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};z.node;var Ze=l(z),Qe={name:`monitor-cog`,size:24,node:[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]};Qe.node;var $e=l(Qe),et={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};et.node;var tt=l(et),nt={name:`panel-top-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m15 14-3 3-3-3`,key:`g215vf`}]]};nt.node;var rt=l(nt),it={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};it.node;var at=l(it),ot={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};ot.node;var st=l(ot),ct={name:`radio-tower`,size:24,node:[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]};ct.node;var lt=l(ct),ut={name:`scan-search`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]};ut.node;var dt=l(ut),ft={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};ft.node;var pt=l(ft),mt={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};mt.node;var ht=l(mt),gt={name:`sun-medium`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 3v1`,key:`1asbbs`}],[`path`,{d:`M12 20v1`,key:`1wcdkc`}],[`path`,{d:`M3 12h1`,key:`lp3yf2`}],[`path`,{d:`M20 12h1`,key:`1vloll`}],[`path`,{d:`m18.364 5.636-.707.707`,key:`1hakh0`}],[`path`,{d:`m6.343 17.657-.707.707`,key:`18m9nf`}],[`path`,{d:`m5.636 5.636.707.707`,key:`1xv1c5`}],[`path`,{d:`m17.657 17.657.707.707`,key:`vl76zb`}]]};gt.node;var _t=l(gt),vt={name:`workflow`,size:24,node:[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]};vt.node;var yt=l(vt),B=E(r(),1),bt=new Set([`log`,`info`,`warn`,`error`,`debug`,`dir`,`dirxml`,`trace`,`table`,`group`,`groupCollapsed`,`groupEnd`,`clear`,`assert`,`count`,`countReset`,`time`,`timeLog`,`timeEnd`]),xt=new Set(`aliceblue.aqua.black.blue.brown.coral.crimson.cyan.darkblue.darkgray.darkgreen.darkgrey.fuchsia.gold.gray.green.grey.indigo.lime.magenta.maroon.navy.olive.orange.orchid.pink.plum.purple.red.salmon.silver.teal.tomato.transparent.violet.white.yellow.currentcolor`.split(`.`)),V={maxDepth:4,maxObjectKeys:50,maxStringLength:16384,maxEntries:1e3,maxTableRows:100,maxTableColumns:20,now:()=>Date.now(),captureStack:()=>{try{let e=Error(`Trace`).stack;return typeof e==`string`?e:void 0}catch{return}}};function H(e,t,n,r){return Number.isFinite(e)?Math.min(r,Math.max(n,Math.trunc(e))):t}function St(e={}){return{maxDepth:H(e.maxDepth,V.maxDepth,1,12),maxObjectKeys:H(e.maxObjectKeys,V.maxObjectKeys,1,1e3),maxStringLength:H(e.maxStringLength,V.maxStringLength,32,1e6),maxEntries:H(e.maxEntries,V.maxEntries,1,1e5),maxTableRows:H(e.maxTableRows,V.maxTableRows,1,1e4),maxTableColumns:H(e.maxTableColumns,V.maxTableColumns,1,500),now:typeof e.now==`function`?e.now:V.now,captureStack:typeof e.captureStack==`function`?e.captureStack:V.captureStack}}function Ct(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=t.toLowerCase(),r={groupcollapsed:`groupCollapsed`,groupend:`groupEnd`,countreset:`countReset`,timelog:`timeLog`,timeend:`timeEnd`}[n]??n;return bt.has(r)?r:null}function U(e){if(!Array.isArray(e))return null;try{let t=Object.getOwnPropertyDescriptors(e),n=t.length;if(!n||!(`value`in n))return null;let r=n.value;if(typeof r!=`number`||!Number.isSafeInteger(r)||r<0||r>256)return null;let i=Array(r);for(let e=0;e65536||(this.space(),!this.consumeWord(`console`))||(this.space(),!this.consume(`.`)))return null;this.space();let e=Ct(this.identifier());if(!e||(this.space(),!this.consume(`(`)))return null;this.space();let t=[];if(this.peek(`)`))this.index++;else for(;;){if(t.length>=256)return null;let e=this.value(0);if(!e.ok)return null;if(t.push(e.value),this.space(),this.consume(`)`))break;if(!this.consume(`,`))return null;if(this.space(),this.peek(`)`)){this.index++;break}}return this.space(),this.consume(`;`),this.space(),this.index===this.source.length?{method:e,args:t}:null}value(e){if(e>32)return{ok:!1};this.space();let t=this.source[this.index];if(t===`"`||t===`'`)return this.string(t);if(t===`[`)return this.array(e+1);if(t===`{`)return this.object(e+1);for(let[e,t]of[[`undefined`,void 0],[`-Infinity`,-1/0],[`Infinity`,1/0],[`false`,!1],[`true`,!0],[`null`,null],[`NaN`,NaN]])if(this.consumeWord(e))return{ok:!0,value:t};let n=this.source.slice(this.index).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?(this.index+=n[0].length,{ok:!0,value:Number(n[0])}):{ok:!1}}string(e){this.index++;let t=``;for(;this.indexDate.now(),captureStack:()=>{try{let e=Error(`Trace`).stack;return typeof e==`string`?e:void 0}catch{return}}};function H(e,t,n,r){return Number.isFinite(e)?Math.min(r,Math.max(n,Math.trunc(e))):t}function St(e={}){return{maxDepth:H(e.maxDepth,V.maxDepth,1,12),maxObjectKeys:H(e.maxObjectKeys,V.maxObjectKeys,1,1e3),maxStringLength:H(e.maxStringLength,V.maxStringLength,32,1e6),maxEntries:H(e.maxEntries,V.maxEntries,1,1e5),maxTableRows:H(e.maxTableRows,V.maxTableRows,1,1e4),maxTableColumns:H(e.maxTableColumns,V.maxTableColumns,1,500),now:typeof e.now==`function`?e.now:V.now,captureStack:typeof e.captureStack==`function`?e.captureStack:V.captureStack}}function Ct(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=t.toLowerCase(),r={groupcollapsed:`groupCollapsed`,groupend:`groupEnd`,countreset:`countReset`,timelog:`timeLog`,timeend:`timeEnd`}[n]??n;return bt.has(r)?r:null}function U(e){if(!Array.isArray(e))return null;try{let t=Object.getOwnPropertyDescriptors(e),n=t.length;if(!n||!(`value`in n))return null;let r=n.value;if(typeof r!=`number`||!Number.isSafeInteger(r)||r<0||r>256)return null;let i=Array(r);for(let e=0;e65536||(this.space(),!this.consumeWord(`console`))||(this.space(),!this.consume(`.`)))return null;this.space();let e=Ct(this.identifier());if(!e||(this.space(),!this.consume(`(`)))return null;this.space();let t=[];if(this.peek(`)`))this.index++;else for(;;){if(t.length>=256)return null;let e=this.value(0);if(!e.ok)return null;if(t.push(e.value),this.space(),this.consume(`)`))break;if(!this.consume(`,`))return null;if(this.space(),this.peek(`)`)){this.index++;break}}return this.space(),this.consume(`;`),this.space(),this.index===this.source.length?{method:e,args:t}:null}value(e){if(e>32)return{ok:!1};this.space();let t=this.source[this.index];if(t===`"`||t===`'`)return this.string(t);if(t===`[`)return this.array(e+1);if(t===`{`)return this.object(e+1);for(let[e,t]of[[`undefined`,void 0],[`-Infinity`,-1/0],[`Infinity`,1/0],[`false`,!1],[`true`,!0],[`null`,null],[`NaN`,NaN]])if(this.consumeWord(e))return{ok:!0,value:t};let n=this.source.slice(this.index).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);return n?(this.index+=n[0].length,{ok:!0,value:Number(n[0])}):{ok:!1}}string(e){this.index++;let t=``;for(;this.index=this.source.length)return{ok:!1};let r=this.source[this.index++],i={'"':`"`,"'":`'`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:` `,r:`\r`,t:` `};if(r in i){t+=i[r];continue}if(r!==`u`)return{ok:!1};let a=this.source.slice(this.index,this.index+4);if(!/^[0-9a-f]{4}$/i.test(a))return{ok:!1};t+=String.fromCharCode(Number.parseInt(a,16)),this.index+=4}return{ok:!1}}array(e){this.index++,this.space();let t=[];if(this.consume(`]`))return{ok:!0,value:t};for(;;){if(t.length>=1e3)return{ok:!1};let n=this.value(e);if(!n.ok)return n;if(t.push(n.value),this.space(),this.consume(`]`))return{ok:!0,value:t};if(!this.consume(`,`))return{ok:!1};if(this.space(),this.consume(`]`))return{ok:!0,value:t}}}object(e){this.index++,this.space();let t=Object.create(null);if(this.consume(`}`))return{ok:!0,value:t};let n=0;for(;;){if(n++>=1e3)return{ok:!1};let r,i=this.source[this.index];if(i===`"`||i===`'`){let e=this.string(i);if(!e.ok)return e;r=e.value}else if(r=this.identifier(),!r)return{ok:!1};if(this.space(),!this.consume(`:`))return{ok:!1};let a=this.value(e);if(!a.ok)return a;if(Object.defineProperty(t,r,{value:a.value,enumerable:!0,configurable:!0,writable:!0}),this.space(),this.consume(`}`))return{ok:!0,value:t};if(!this.consume(`,`))return{ok:!1};if(this.space(),this.consume(`}`))return{ok:!0,value:t}}}identifier(){let e=this.source.slice(this.index).match(/^[A-Za-z_$][\w$-]*/);return e?(this.index+=e[0].length,e[0]):``}space(){for(;/\s/.test(this.source[this.index]??``);)this.index++}peek(e){return this.source.startsWith(e,this.index)}consume(e){return this.peek(e)?(this.index+=e.length,!0):!1}consumeWord(e){if(!this.peek(e))return!1;let t=this.source[this.index+e.length];return t&&/[\w$-]/.test(t)?!1:(this.index+=e.length,!0)}};function Et(e){return typeof e==`string`?new Tt(e).parse():wt(e)}function W(e){let t=e.trim().toLowerCase();return xt.has(t)||/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(?:rgb|rgba|hsl|hsla)\([\d\s.,%+\-/]+\)$/i.test(t)?t:null}function Dt(e){let t=e.trim().toLowerCase();return/^(?:normal|bold|bolder|lighter|[1-9]00)$/.test(t)?t:null}function Ot(e){let t=e.trim().toLowerCase();return/^(?:normal|italic|oblique)$/.test(t)?t:null}function G(e){let t=e.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!t.length)return null;let n=new Set([`none`,`underline`,`overline`,`line-through`]);return t.some(e=>!n.has(e))||t.includes(`none`)&&t.length!==1?null:[...new Set(t)].join(` `)}function kt(e){if(typeof e!=`string`||e.length>4096)return{};let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e<1)continue;let r=n.slice(0,e).trim().toLowerCase(),i=n.slice(e+1).trim();if(!(!i||/(?:url|expression|var)\s*\(/i.test(i)||/[{}<>]/.test(i)))switch(r){case`color`:{let e=W(i);e&&(t.color=e);break}case`background-color`:{let e=W(i);e&&(t.backgroundColor=e);break}case`font-weight`:{let e=Dt(i);e&&(t.fontWeight=e);break}case`font-style`:{let e=Ot(i);e&&(t.fontStyle=e);break}case`text-decoration`:case`text-decoration-line`:{let e=G(i);e&&(t.textDecorationLine=e);break}}}return t}function K(e){return e&&Object.keys(e).length?{...e}:void 0}function At(e,t){return e?.color===t?.color&&e?.backgroundColor===t?.backgroundColor&&e?.fontWeight===t?.fontWeight&&e?.fontStyle===t?.fontStyle&&e?.textDecorationLine===t?.textDecorationLine}function jt(e,t,n){let r=e[e.length-1];r?.kind===`text`&&At(r.style,n)?e[e.length-1]={...r,text:r.text+t}:e.push({kind:`text`,text:t,style:K(n)})}function q(e,t){return e.length<=t.maxStringLength?e:`${e.slice(0,t.maxStringLength)}…[${e.length-t.maxStringLength} more]`}function Mt(e,t){let n=q(e,t);return JSON.stringify(n)??`""`}function Nt(e){return Number.isNaN(e)?`NaN`:e===1/0?`Infinity`:e===-1/0?`-Infinity`:Object.is(e,-0)?`-0`:String(e)}function Pt(e){if(e===null)return`null`;try{if(Array.isArray(e))return`array`;if(e instanceof Error)return`error`}catch{return`object`}let t=typeof e;return t===`string`||t===`number`||t===`bigint`||t===`boolean`||t===`undefined`||t===`symbol`||t===`function`?t:`object`}function Ft(e,t){try{let n=e;for(let e=0;n&&e<16;e++){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return`value`in e&&typeof e.value==`string`?e.value:void 0;n=Object.getPrototypeOf(n)}}catch{}}function It(e,t){try{let n=Object.getOwnPropertyDescriptor(t,`size`)?.get;if(!n)return null;let r=Reflect.apply(n,e,[]);return typeof r==`number`&&Number.isSafeInteger(r)&&r>=0?r:null}catch{return null}}function Lt(e){try{let t=Object.getOwnPropertyDescriptor(e,`name`);return typeof t?.value==`string`&&t.value?t.value:`anonymous`}catch{return`anonymous`}}function J(e){try{if(Array.isArray(e)){let t=Object.getOwnPropertyDescriptor(e,`length`)?.value;return`Array(${typeof t==`number`?t:`?`})`}if(e instanceof Map)return`Map(${It(e,Map.prototype)??`?`})`;if(e instanceof Set)return`Set(${It(e,Set.prototype)??`?`})`;if(e instanceof Date)return`Date`;if(e instanceof Error)return Ft(e,`name`)||`Error`}catch{return`Object`}return`Object`}function Rt(e,t,n,r,i){if(e===null)return`null`;switch(typeof e){case`string`:return i?Mt(e,t):q(e,t);case`number`:return Nt(e);case`bigint`:return`${e}n`;case`boolean`:return String(e);case`undefined`:return`undefined`;case`symbol`:return String(e);case`function`:return`[Function ${Lt(e)}]`}let a=e;if(r.has(a))return`[Circular]`;if(n>=t.maxDepth)return`[${J(a)}]`;r.add(a);try{if(a instanceof Date){let e=Date.prototype.getTime.call(a);return Number.isNaN(e)?`Invalid Date`:Date.prototype.toISOString.call(a)}if(a instanceof RegExp)return RegExp.prototype.toString.call(a);if(a instanceof Error){let e=Ft(a,`name`),n=Ft(a,`message`);return`${e||`Error`}${n?`: ${q(n,t)}`:``}`}if(a instanceof Map){let e=It(a,Map.prototype),i=[],o=0;for(let[e,s]of Map.prototype.entries.call(a)){if(o++>=t.maxObjectKeys)break;i.push(`${Rt(e,t,n+1,r,!0)} => ${Rt(s,t,n+1,r,!0)}`)}return e!==null&&e>i.length&&i.push(`… ${e-i.length} more`),`Map(${e??`?`}) { ${i.join(`, `)} }`}if(a instanceof Set){let e=It(a,Set.prototype),i=[],o=0;for(let e of Set.prototype.values.call(a)){if(o++>=t.maxObjectKeys)break;i.push(Rt(e,t,n+1,r,!0))}return e!==null&&e>i.length&&i.push(`… ${e-i.length} more`),`Set(${e??`?`}) { ${i.join(`, `)} }`}let e=Object.getOwnPropertyDescriptors(a),i=Reflect.ownKeys(e).filter(t=>e[t]?.enumerable),o=i.slice(0,t.maxObjectKeys),s=o.map(i=>{let a=e[i],o=typeof i==`symbol`?`[${String(i)}]`:/^[A-Za-z_$][\w$]*$/.test(i)?i:Mt(i,t);return!a||!(`value`in a)?`${o}: ${a?.get&&a?.set?`[Getter/Setter]`:a?.get?`[Getter]`:`[Setter]`}`:`${o}: ${Rt(a.value,t,n+1,r,!0)}`});return i.length>o.length&&s.push(`… ${i.length-o.length} more`),Array.isArray(a)?`[${s.map(e=>e.replace(/^\d+: /,``)).join(`, `)}]`:`{ ${s.join(`, `)} }`}catch(e){return`[Uninspectable: ${q(e instanceof Error?e.message:`inspection failed`,t)}]`}finally{r.delete(a)}}function zt(e,t={}){return Rt(e,St(t),0,new Set,!1)}function Bt(e,t,n=`inline`,r){return{kind:`value`,text:Rt(e,n===`compact`?{...t,maxDepth:Math.min(2,t.maxDepth),maxObjectKeys:Math.min(12,t.maxObjectKeys)}:t,0,new Set,!1),valueType:Pt(e),presentation:n,style:K(r)}}function Y(e,t){return typeof e==`string`?q(e,t):Rt(e,{...t,maxDepth:Math.min(t.maxDepth,2)},0,new Set,!1)}function Vt(e,t){if(typeof e==`bigint`)return String(e);let n;try{n=Number(e)}catch{n=NaN}return t&&Number.isFinite(n)&&(n=Math.trunc(n)),Nt(n)}function Ht(e,t={}){let n=St(t);if(!e.length)return[{kind:`text`,text:``}];let r=[],i=0;if(typeof e[0]==`string`){let t=q(e[0],n);i=1;let a={},o=``,s=()=>{o&&=(jt(r,o,a),``)};for(let c=0;c=t.length){o+=l;continue}let u=t[c+1];if(u===`%`){o+=`%`,c++;continue}if(!`sdifoOc`.includes(u)||i>=e.length){o+=`%${u}`,c++;continue}s();let d=e[i++];switch(c++,u){case`s`:jt(r,Y(d,n),a);break;case`d`:case`i`:r.push({kind:`value`,text:Vt(d,!0),valueType:`number`,presentation:`inline`,style:K(a)});break;case`f`:r.push({kind:`value`,text:Vt(d,!1),valueType:`number`,presentation:`inline`,style:K(a)});break;case`o`:r.push(Bt(d,n,`compact`,a));break;case`O`:r.push(Bt(d,n,`expanded`,a));break;case`c`:a=kt(d)}}s()}for(;ie.text).join(``)}function Wt(e){if(!e)return``;let t=[];return e.color&&t.push(`color:${e.color}`),e.backgroundColor&&t.push(`background-color:${e.backgroundColor}`),e.fontWeight&&t.push(`font-weight:${e.fontWeight}`),e.fontStyle&&t.push(`font-style:${e.fontStyle}`),e.textDecorationLine&&t.push(`text-decoration-line:${e.textDecorationLine}`),t.join(`;`)}function Gt(e){let t=``,n=``,r=[],i=e.length?e:[{kind:`text`,text:``}];for(let e of i){let i=Wt(e.style);i!==n&&(t+=`%c`,r.push(i),n=i),t+=`%s`,r.push(e.text)}return n&&(t+=`%c`,r.push(``)),[t,...r]}function Kt(e){try{let t=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(t).filter(e=>t[e]?.enumerable).map(e=>{let n=t[e],r=typeof e==`symbol`?String(e):e;return!n||!(`value`in n)?{key:r,value:n?.get?`[Getter]`:`[Setter]`}:{key:r,value:n.value}})}catch{return[]}}function qt(e){try{if(e instanceof Map)return Array.from(Map.prototype.entries.call(e),([e,t])=>({key:zt(e,{maxDepth:1,maxObjectKeys:4}),value:t}));if(e instanceof Set)return Array.from(Set.prototype.values.call(e),(e,t)=>({key:String(t),value:e}));if(e!==null&&(typeof e==`object`||typeof e==`function`))return Kt(e)}catch{}return[{key:`0`,value:e}]}function Jt(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(typeof r!=`string`&&typeof r!=`number`)continue;let e=q(String(r),t);if(e&&!n.includes(e)&&n.push(e),n.length>=t.maxTableColumns)break}return n}function Yt(e,t,n){let r=qt(e),i=r.slice(0,n.maxTableRows),a=Jt(t,n),o=[],s=!1;for(let e of i){let t=e.value;if(t!==null&&(typeof t==`object`||typeof t==`function`))for(let e of Kt(t))o.includes(e.key)||o.push(e.key);else s=!0}let c=a??[...o,...s||!o.length?[`Value`]:[]],l=c.slice(0,n.maxTableColumns);return{columns:[`(index)`,...l],rows:i.map(e=>{let t={"(index)":[Bt(e.key,n)]},r=e.value!==null&&(typeof e.value==`object`||typeof e.value==`function`)?new Map(Kt(e.value).map(e=>[e.key,e.value])):null;for(let i of l)t[i]=i===`Value`?[Bt(e.value,n,`compact`)]:r?.has(i)?[Bt(r.get(i),n,`compact`)]:[{kind:`text`,text:``}];return{key:e.key,cells:t}}),omittedRows:Math.max(0,r.length-i.length),omittedColumns:Math.max(0,c.length-l.length)}}function Xt(e){switch(e){case`info`:return`info`;case`warn`:return`warn`;case`error`:case`assert`:return`error`;case`debug`:return`debug`;default:return`log`}}function Zt(e){let t=Math.max(0,e),n=t<1e3?t:t/1e3,r=t<1e3?`ms`:`s`;return`${Number(n.toFixed(3))} ${r}`}function Qt(e,t){if(typeof e!=`string`)return;let n=e.replace(/\r\n?/g,` `).replace(/\u001b\[[0-?]*[ -/]*[@-~]/g,``).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``).trim();return n?q(n,t):void 0}var $t=class{options;transcriptValue=[];groups=[];counters=new Map;timers=new Map;nextEntryID=0;nextGroupID=0;revisionValue=0;constructor(e={}){this.options=St(e)}dispatch(e){let t=Et(e);return t?this.invoke(t.method,t.args,t.timestamp,t.stack):this.emitMessage(`warn`,[`Unsupported console invocation payload.`],this.options.now())}invoke(e,t=[],n,r){let i=Ct(e),a=Number.isFinite(n)?Number(n):this.options.now();if(!i)return this.emitMessage(`warn`,[`Unsupported console method: ${String(e)}`],a);switch(i){case`log`:case`info`:case`warn`:case`error`:case`debug`:return this.emitMessage(i,t,a);case`dir`:case`dirxml`:return this.append({...this.base(a),kind:`message`,method:i,level:`log`,tokens:[Bt(t[0],this.options,`expanded`)]});case`trace`:{let e=t.length?[...Ht(t,this.options)]:[{kind:`text`,text:`Trace`}],n=r;if(n===void 0)try{n=this.options.captureStack()}catch{n=void 0}let o=Qt(n,this.options);return o&&e.push({kind:`text`,text:`\n${o}`}),this.append({...this.base(a),kind:`message`,method:i,level:`debug`,tokens:e})}case`assert`:{if(t[0])return this.noop();let e=t.slice(1),n=e.length?[...Ht(e,this.options)]:[],r=[{kind:`text`,text:`Assertion failed`}];return n.length&&r.push({kind:`text`,text:`: `},...n),this.append({...this.base(a),kind:`message`,method:`assert`,level:`error`,tokens:r})}case`group`:case`groupCollapsed`:{let e=i===`groupCollapsed`,n=t.length?Ht(t,this.options):[{kind:`text`,text:`console.group`}],r={...this.base(a),kind:`group`,method:i,level:`log`,collapsed:e,tokens:n},o=this.append(r);return this.groups.push({id:++this.nextGroupID,label:Ut(n),collapsed:e}),this.revisionValue++,{...o,transcript:this.entries()}}case`groupEnd`:return this.groups.length&&(this.groups.pop(),this.revisionValue++),this.noop();case`clear`:return this.transcriptValue=[],this.groups=[],this.revisionValue++,{emitted:[],transcript:[],cleared:!0,ignored:!1};case`count`:{let e=this.label(t[0]),n=(this.counters.get(e)??0)+1;return this.counters.set(e,n),this.emitMessage(`log`,[`${e}: ${n}`],a)}case`countReset`:{let e=this.label(t[0]);return this.counters.has(e)?(this.counters.set(e,0),this.revisionValue++,this.noop()):this.emitMessage(`warn`,[`Count for '${e}' does not exist.`],a)}case`time`:{let e=this.label(t[0]);return this.timers.has(e)?this.emitMessage(`warn`,[`Timer '${e}' already exists.`],a):(this.timers.set(e,a),this.revisionValue++,this.noop())}case`timeLog`:case`timeEnd`:{let e=this.label(t[0]),n=this.timers.get(e);if(n===void 0)return this.emitMessage(`warn`,[`Timer '${e}' does not exist.`],a);let r=`${e}: ${Zt(a-n)}`,o=i===`timeLog`?t.slice(1):[];i===`timeEnd`&&this.timers.delete(e);let s=[{kind:`text`,text:r}];return o.length&&s.push({kind:`text`,text:` `},...Ht(o,this.options)),this.append({...this.base(a),kind:`message`,method:i,level:`log`,tokens:s})}case`table`:{let e=Yt(t[0],t[1],this.options);return this.append({...this.base(a),kind:`table`,method:`table`,level:`log`,...e})}}}snapshot(){let e=Object.create(null);for(let[t,n]of this.counters)Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1});return{entries:this.entries(),depth:this.groups.length,groups:this.groupPath(),counters:e,timers:[...this.timers.keys()],revision:this.revisionValue}}entries(){return this.transcriptValue.slice()}reset(){this.transcriptValue=[],this.groups=[],this.counters.clear(),this.timers.clear(),this.nextEntryID=0,this.nextGroupID=0,this.revisionValue++}label(e){return e===void 0?`default`:Y(e,this.options)}groupPath(){return this.groups.map(e=>({...e}))}base(e){let t=this.groupPath();return{id:++this.nextEntryID,timestamp:e,depth:t.length,groupPath:t,hidden:t.some(e=>e.collapsed)}}emitMessage(e,t,n){return this.append({...this.base(n),kind:`message`,method:e,level:Xt(e),tokens:Ht(t,this.options)})}append(e){return this.transcriptValue.push(e),this.transcriptValue.length>this.options.maxEntries&&this.transcriptValue.splice(0,this.transcriptValue.length-this.options.maxEntries),this.revisionValue++,{emitted:[e],transcript:this.entries(),cleared:!1,ignored:!1}}noop(){return{emitted:[],transcript:this.entries(),cleared:!1,ignored:!0}}},X=b(),en=[[`a`,8,5,28,5],[`b`,31,8,31,27],[`c`,31,32,31,51],[`d`,8,54,28,54],[`e`,5,32,5,51],[`f`,5,8,5,27],[`g`,8,29.5,28,29.5]];function tn(e){return!!(e&&Array.isArray(e.raw_segments)&&e.raw_segments.length===4&&e.raw_segments.every(e=>Number.isInteger(e)&&e>=0&&e<=255))}function nn({panel:e,label:t=`Live four-digit display preview`}){return tn(e)?(0,X.jsx)(`div`,{className:`live-segment-preview${e.segments_active?` is-active`:``}`,dir:`ltr`,"aria-label":t,children:e.raw_segments.map((e,t)=>(0,X.jsxs)(`svg`,{viewBox:`0 0 40 62`,role:`img`,"aria-label":`digit ${t+1} raw 0x${e.toString(16).padStart(2,`0`)}`,children:[en.map(([t,n,r,i,a],o)=>(0,X.jsx)(`line`,{x1:n,y1:r,x2:i,y2:a,className:e&1<e===`fa`?n:t,[n,r]=(0,B.useState)(),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(``),g=async()=>{try{let[e,t]=await Promise.all([a(`controller.udp.config.get`),a(`controller.udp.status`)]);r({...e,listen:e.listen||`127.0.0.1:8787`}),s(t),l(``)}catch(e){l(String(e))}};if((0,B.useEffect)(()=>{g()},[]),!n)return c?(0,X.jsx)(`p`,{role:`alert`,children:c}):null;let _=e=>r({...n,...e}),v=async()=>{d(!0);try{await a(`controller.udp.config.set`,n),l(``),s(void 0)}catch(e){l(String(e))}finally{d(!1)}};return(0,X.jsxs)(`section`,{className:`advanced-fields`,"aria-label":t(`Binary UDP`,`UDP باینری`),children:[(0,X.jsx)(`h3`,{children:t(`Binary UDP`,`UDP باینری`)}),(0,X.jsx)(y,{checked:n.enabled,onChange:e=>_({enabled:e}),label:t(`Enable transport`,`فعال‌سازی ارتباط`)}),(0,X.jsx)(T,{label:t(`Listening address`,`نشانی گوش دادن`),value:n.listen,dir:`ltr`,onChange:e=>_({listen:e.target.value})}),(0,X.jsx)(y,{checked:n.discovery,onChange:e=>_({discovery:e,broadcast_events:e?n.broadcast_events:!1}),label:t(`Discover and announce peers`,`کشف و معرفی همتاها`)}),n.discovery&&(0,X.jsx)(y,{checked:n.broadcast_events,onChange:e=>_({broadcast_events:e}),label:t(`Broadcast events`,`پخش رویدادها`)}),Object.entries(n.peers??{}).map(([e,r])=>(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsxs)(`span`,{children:[e,` · `,(0,X.jsx)(`bdi`,{children:r})]}),(0,X.jsx)(i,{icon:le,onClick:()=>{let t={...n.peers};delete t[e],_({peers:t})},children:t(`Remove`,`حذف`)})]},e)),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsx)(T,{label:t(`Peer name`,`نام همتا`),value:f,onChange:e=>p(e.target.value)}),(0,X.jsx)(T,{label:t(`Peer address`,`نشانی همتا`),value:m,dir:`ltr`,onChange:e=>h(e.target.value)})]}),(0,X.jsx)(i,{disabled:!f.trim()||!m.trim(),onClick:()=>{_({peers:{...n.peers,[f.trim()]:m.trim()}}),p(``),h(``)},children:t(`Add peer`,`افزودن همتا`)}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(i,{icon:de,busy:u,onClick:()=>void v(),children:t(`Save UDP settings`,`ذخیره تنظیمات UDP`)}),(0,X.jsx)(i,{icon:O,onClick:()=>void g(),children:t(`Refresh`,`تازه‌سازی`)})]}),(c||o?.error)&&(0,X.jsx)(`p`,{role:`alert`,children:c||o?.error}),o&&(0,X.jsx)(`span`,{children:o.running?t(`Listening`,`در حال گوش دادن`):t(`Stopped`,`متوقف`)}),o?.peers?.map(e=>(0,X.jsxs)(`div`,{children:[e.identity?.app,` · `,(0,X.jsx)(`bdi`,{children:e.address}),(0,X.jsx)(i,{disabled:Object.values(n.peers??{}).includes(e.address),onClick:()=>{p(e.identity?.app??`peer`),h(e.address)},children:t(`Configure peer`,`پیکربندی همتا`)})]},e.id))]})}function an({icon:t,eyebrow:n,title:r,detail:i,children:a,defaultOpen:o=!1,tone:s=`neutral`,status:c}){let[l,u]=(0,B.useState)(o);return(0,X.jsxs)(`details`,{className:`advanced-panel`,open:l,onToggle:e=>u(e.currentTarget.open),children:[(0,X.jsxs)(`summary`,{className:`advanced-panel__summary`,children:[(0,X.jsx)(`span`,{className:`advanced-panel__icon`,children:(0,X.jsx)(e,{icon:t,size:18})}),(0,X.jsxs)(`span`,{className:`advanced-panel__copy`,children:[(0,X.jsx)(`small`,{children:n}),(0,X.jsx)(`strong`,{children:r}),(0,X.jsx)(`span`,{children:i})]}),c&&(0,X.jsx)(ie,{tone:s,children:c}),(0,X.jsx)(A,{className:`advanced-panel__chevron`,"aria-hidden":`true`,size:17})]}),(0,X.jsx)(`div`,{className:`advanced-panel__body`,children:a})]})}function on(e,t,n,r){let i=Number.parseInt(e,10);return Number.isFinite(i)?Math.min(r,Math.max(n,i)):t}function sn(e){return e.trim().split(/\s+/).filter(Boolean).join(` `)}function cn(e,t){let n=e.trim(),r=t.trim();if(n&&/^[\x20-\x7e]{1,4}$/.test(r))return`host-menu set ${v(n)} label ${v(r)}`}function ln(e,t,n,r=``){return e===`lcd`?{targets:[e],type:t,text:`${n}\n${r}`,line1:n,line2:r}:{targets:[e],type:t,text:n}}function un({snapshot:e,locale:r,run:l,busy:u,transport:p}){let m=te(e),h=r===`fa`,g=(e,t)=>h?t:e,b=p.boardState===`ready`&&e.connected&&e.have_status,S=u.length>0,[re,oe]=(0,B.useState)(``),[E,D]=(0,B.useState)(!0),[k,ce]=(0,B.useState)(500),[A,j]=(0,B.useState)(`running`),[fe,me]=(0,B.useState)(!1),[P,ge]=(0,B.useState)(`web workbench`),[F,I]=(0,B.useState)(!1),[be,we]=(0,B.useState)(!0),[L,Oe]=(0,B.useState)(!0),[Ae,je]=(0,B.useState)(`status`),[Me,Ne]=(0,B.useState)(`0xFFFF`),[Pe,Ie]=(0,B.useState)(`status voltage current temperature`),[Re,Be]=(0,B.useState)(``),[He,We]=(0,B.useState)(``),[R,qe]=(0,B.useState)(m.segments&&(e.have_front_panel||e.have_front_panel_segments)?e.front_panel:void 0),[Je,Ye]=(0,B.useState)(0),[z,Ze]=(0,B.useState)(100),[Qe,et]=(0,B.useState)(20),[nt,it]=(0,B.useState)(``),[ot,ct]=(0,B.useState)(32),[lt,ut]=(0,B.useState)(214),[ft,mt]=(0,B.useState)(220),[ht,gt]=(0,B.useState)(180),[vt,bt]=(0,B.useState)(`attention`),[xt,V]=(0,B.useState)(`1`),[H,St]=(0,B.useState)(`key`),[Ct,U]=(0,B.useState)(`1`),[wt,Tt]=(0,B.useState)(`press`),[Et,W]=(0,B.useState)(`0x27`),[Dt,Ot]=(0,B.useState)(2),[G,kt]=(0,B.useState)(4),[K,At]=(0,B.useState)(`0x00`),[jt,q]=(0,B.useState)(`F13`),[Mt,Nt]=(0,B.useState)(80),[Pt,Ft]=(0,B.useState)(`lock`),[It,Lt]=(0,B.useState)(``),[J,Rt]=(0,B.useState)(`host`),[zt,Bt]=(0,B.useState)(`ui.note`),[Y,Vt]=(0,B.useState)(``),[Ht,Ut]=(0,B.useState)(``),[Wt,Gt]=(0,B.useState)(``),[Kt,qt]=(0,B.useState)(!0),[Jt,Yt]=(0,B.useState)(!0),[Xt,Zt]=(0,B.useState)(!0),[Qt,$t]=(0,B.useState)(!0),[en,tn]=(0,B.useState)(!0),[un,dn]=(0,B.useState)(!0),[Z,fn]=(0,B.useState)(1500),[pn,mn]=(0,B.useState)(``),[hn,gn]=(0,B.useState)(37889),[_n,vn]=(0,B.useState)([]),[yn,bn]=(0,B.useState)(60),[xn,Sn]=(0,B.useState)(100),[Cn,wn]=(0,B.useState)(g(`No service query yet.`,`هنوز پرس‌وجوی سرویسی انجام نشده است.`)),[Tn,En]=(0,B.useState)(``),[Dn,On]=(0,B.useState)(`backup`),[Q,kn]=(0,B.useState)({command:``,reason:``,risk:`normal`,needsDevice:!1}),[An,jn]=(0,B.useState)(``),[Mn,Nn]=(0,B.useState)(!1);(0,B.useEffect)(()=>{e.have_settings&&(I(!!(e.settings.flags&1)),we(!(e.settings.flags&32)),Oe(!(e.settings.flags&64)),D(e.settings.stream_period_ms>0),e.settings.stream_period_ms>0&&ce(e.settings.stream_period_ms))},[e.have_settings,e.settings.flags,e.settings.stream_period_ms]),(0,B.useEffect)(()=>{!re&&e.port.name&&oe(e.port.name)},[re,e.port.name]),(0,B.useEffect)(()=>{!fe&&e.program_state?.mode&&j(e.program_state.mode.toLowerCase()===`running`?`running`:`idle`)},[fe,e.program_state?.mode]),(0,B.useEffect)(()=>{!b&&J===`lcd`&&Rt(`host`)},[J,b]),(0,B.useEffect)(()=>{!b||!m.segments?qe(void 0):(e.have_front_panel||e.have_front_panel_segments)&&e.front_panel&&qe(e.front_panel)},[m.segments,b,e.front_panel_updated,e.have_front_panel,e.have_front_panel_segments,e.front_panel]),(0,B.useEffect)(()=>{b&&m.segments&&!e.have_front_panel&&a(`controller.front_panel`).then(qe).catch(()=>void 0)},[m.segments,b,e.have_front_panel]),(0,B.useEffect)(()=>{wn(g(`No service query yet.`,`هنوز پرس‌وجوی سرویسی انجام نشده است.`))},[r]),(0,B.useEffect)(()=>{let e=!0;return a(`controller.discovery.config.get`).then(t=>{e&&(qt(t.mdns_enabled||t.dns_sd_enabled),Yt(t.ssdp_enabled||t.upnp_enabled),Zt(t.ws_discovery_enabled),$t(t.broadcast_enabled),tn(t.netbios_enabled),dn(t.mndp_enabled??!1),gn(t.broadcast_port||37889),mn(t.instance_name||``))}).catch(()=>{}),()=>{e=!1}},[]);let Pn=(0,B.useMemo)(()=>{let e=xt.trim()||`1`;switch(H){case`none`:return`rf map ${e} none`;case`menu`:return`rf map ${e} menu ${Ct.trim()||`next`}`;case`side`:return`rf map ${e} side ${Ct.trim()||`left`} ${wt.trim()||`stop`}`;case`relay`:return`rf map ${e} relay ${Ct.trim()||`5`} ${wt.trim()||`press`}`;case`pwm`:return`rf map ${e} pwm ${Ct.trim()||`0`} ${wt.trim()||`press`}`;default:return`rf map ${e} key ${Ct.trim()||`1`} ${wt.trim()||`press`}`}},[wt,xt,H,Ct]),Fn=(e,t,n=`caution`,r=!1,i)=>{Mn||(kn({command:e.trim(),reason:t,risk:n,needsDevice:r,execute:i}),jn(``),window.requestAnimationFrame(()=>{document.getElementById(`advanced-command-review`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))},In=async()=>{if(!Q.command)return;let e=Q;jn(``),Nn(!0);try{if(e.execute){let t=await e.execute();wn(JSON.stringify(t,null,2))}else await l(e.command)}catch(e){let t=e instanceof Error?e.message:String(e);wn(`! ${t}`)}finally{jn(``),kn({command:``,reason:``,risk:`normal`,needsDevice:!1}),Nn(!1)}},Ln=async(e,t)=>{En(e);try{let e=await t();wn(JSON.stringify(e,null,2))}catch(e){let t=e instanceof Error?e.message:String(e);wn(`! ${t}`)}finally{En(``)}},Rn=e=>{e.preventDefault();let t=zt.trim();if(!t)return;if(J===`lcd`){if(!Zn)return;Ln(`message`,()=>a(`controller.message.send`,ln(`lcd`,t,Ht,Wt)));return}let n=Y.trim();!n||Xn>4096||Ln(`message`,()=>a(`controller.message.send`,ln(`host`,t,n)))},zn=e=>{let t=new Date(Date.now()-yn*6e4).toISOString(),n=e===`status`?`controller.history.status`:`controller.history.timeline`,r=e===`status`?{since:t}:{since:t,limit:xn};Ln(`history-${e}`,()=>a(n,r))},Bn=async()=>{En(`discovery`);try{let e=await a(`controller.discovery.scan`,{timeout_ms:Z,mdns:Kt,dns_sd:Kt,ssdp:Jt,upnp:Jt,ws_discovery:Xt,broadcast:Qt,netbios:en,mndp:un});vn(e),wn(JSON.stringify(e,null,2))}catch(e){let t=e instanceof Error?e.message:String(e);wn(`! ${t}`)}finally{En(``)}},Vn=()=>{Ln(`discovery-config`,async()=>{let e=await a(`controller.discovery.config.set`,{mdns_enabled:Kt,dns_sd_enabled:Kt,ssdp_enabled:Jt,upnp_enabled:Jt,ws_discovery_enabled:Xt,broadcast_enabled:Qt,netbios_enabled:en,mndp_enabled:un,broadcast_port:hn,instance_name:pn.trim()});return mn(e.instance_name||``),gn(e.broadcast_port||37889),e})},Hn=e=>{let t=e.public?.endpoints.web||`http://${e.host}:${e.port}/`;try{let e=new URL(t);if(e.protocol!==`http:`&&e.protocol!==`https:`)throw Error(`unsupported endpoint protocol`);window.location.assign(e.href)}catch(t){let n=t instanceof Error?t.message:String(t);wn(`! Cannot connect to ${e.name}: ${n}`)}},Un=e=>{switch(St(e),e){case`none`:U(``),Tt(``);break;case`menu`:U(`next`),Tt(``);break;case`relay`:U(`5`),Tt(`toggle`);break;case`side`:U(`left`),Tt(`stop`);break;case`pwm`:U(`0`),Tt(`press`);break;default:U(`1`),Tt(`press`)}},Wn=re.trim()?`open ${v(re.trim())}`:`open`,Gn=`stream ${E?k:0}`,Kn=A===`idle`?`program-state set web idle`:`program-state set web running ${v(P.trim()||`web workbench`)}`,qn=sn(K),Jn=`i2c transfer ${Et.trim()||`0x27`} ${Dt} ${G}${qn?` ${qn}`:``}`,Yn=cn(Re,He),Xn=new TextEncoder().encode(Y.trim()).byteLength,Zn=!!(Ht||Wt)&&Ht.length<=16&&Wt.length<=16&&/^[\x20-\x7e]*$/.test(Ht)&&/^[\x20-\x7e]*$/.test(Wt),Qn=J===`lcd`,$=ee(e,r),$n=!Q.command||S||Mn||Q.needsDevice&&!b||Q.risk===`danger`&&An.trim().toUpperCase()!==`RUN`;return(0,X.jsxs)(`section`,{className:`advanced-surface`,"aria-labelledby":`advanced-workbench-title`,children:[(0,X.jsxs)(`header`,{className:`advanced-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:g(`DEEP CONTROL / PROGRESSIVE DISCLOSURE`,`کنترل عمیق / نمایش مرحله‌ای`)}),(0,X.jsx)(`h2`,{id:`advanced-workbench-title`,children:g(`Advanced capability deck`,`میز قابلیت‌های پیشرفته`)}),(0,X.jsx)(`p`,{children:g(`The common controls stay calm; every specialist path remains reachable here through the same primary dispatcher.`,`کنترل‌های روزمره ساده می‌مانند و تمام مسیرهای تخصصی از همین بخش و هسته فرمان اصلی در دسترس هستند.`)})]}),(0,X.jsx)(ie,{tone:b?`good`:`warn`,pulse:b,children:b?g(`DEVICE ACTIONS READY`,`فرمان‌های برد آماده`):g(`HOST CONTROLS ONLY`,`فقط کنترل میزبان`)})]}),(0,X.jsxs)(`div`,{className:`advanced-grid`,children:[(0,X.jsxs)(an,{icon:se,eyebrow:g(`SERIAL LIFECYCLE`,`چرخه اتصال سریال`),title:g(`Connection, stream & program state`,`اتصال، جریان وضعیت و حالت برنامه`),detail:g(`Port discovery, authenticated open/reconnect, telemetry cadence and shared run state.`,`کشف درگاه، اتصال امن، آهنگ تله‌متری و حالت اجرای مشترک.`),defaultOpen:!0,status:b?e.port.name||g(`connected`,`متصل`):$.title,tone:b?`good`:$.tone===`bad`?`bad`:`warn`,children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:Xe,busy:u===`ports`,onClick:()=>void l(`ports`),children:g(`List ports`,`فهرست درگاه‌ها`)}),b&&(0,X.jsx)(i,{icon:s,busy:u===`status`,onClick:()=>void l(`status`),children:g(`Live status`,`وضعیت زنده`)}),(0,X.jsx)(i,{icon:yt,busy:u===`program-state`,onClick:()=>void l(`program-state`),children:g(`Program state`,`حالت برنامه`)})]}),(0,X.jsx)(`div`,{className:`advanced-fields`,children:(0,X.jsx)(T,{label:g(`Serial port · blank = authenticated auto-detect`,`درگاه سریال · خالی = کشف امن خودکار`),value:re,dir:`ltr`,spellCheck:!1,onChange:e=>oe(e.target.value),action:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(i,{tone:`primary`,icon:st,busy:u===Wn,onClick:()=>void l(Wn),children:g(`Open`,`اتصال`)}),(0,X.jsx)(i,{icon:O,busy:u===`reconnect`||$.animated,disabled:$.retryDisabled,onClick:()=>void l(`reconnect`),children:b?g(`Reconnect`,`اتصال مجدد`):$.action}),b&&(0,X.jsx)(i,{icon:_e,busy:u===`close`,onClick:()=>void l(`close`),children:g(`Close & pause`,`بستن و توقف`)})]})})}),!b&&(0,X.jsxs)(`div`,{className:`data-list connection-details`,children:[(0,X.jsx)(f,{label:g(`Phase`,`مرحله`),value:$.title,tone:$.tone===`bad`?`bad`:$.tone===`warn`?`warn`:void 0}),$.candidate&&(0,X.jsx)(f,{label:g(`Candidate`,`گزینه`),value:$.candidate,mono:!0}),$.attempt&&(0,X.jsx)(f,{label:g(`Attempt`,`تلاش`),value:$.attempt}),$.timing&&(0,X.jsx)(f,{label:g(`Timing`,`زمان‌بندی`),value:$.timing}),$.detail&&(0,X.jsx)(f,{label:g(`Detail`,`جزئیات`),value:$.detail})]}),b&&(0,X.jsxs)(`div`,{className:`advanced-control-row`,children:[(0,X.jsx)(y,{checked:E,onChange:D,label:g(`Status stream`,`جریان وضعیت`),detail:g(`Desired value; Apply sends the EEPROM-safe stream command.`,`مقدار درخواستی؛ اعمال، فرمان امن جریان را می‌فرستد.`)}),E&&(0,X.jsx)(C,{label:g(`Period`,`دوره`),value:k,min:100,max:5e3,step:100,unit:`ms`,onChange:ce}),(0,X.jsx)(i,{icon:N,busy:u===Gn,onClick:()=>void l(Gn),children:g(`Apply stream`,`اعمال جریان`)})]}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--program`,children:[(0,X.jsxs)(`div`,{className:`advanced-field`,children:[(0,X.jsx)(`label`,{children:g(`Desired host program state`,`حالت برنامه در میزبان`)}),(0,X.jsx)(_,{value:A,label:g(`Program mode`,`حالت برنامه`),options:[{value:`idle`,label:g(`Idle`,`آماده`)},{value:`running`,label:g(`Running`,`در حال اجرا`)}],onChange:e=>{j(e),me(!0)}})]}),(0,X.jsx)(T,{label:g(`Reason`,`دلیل`),value:P,disabled:A===`idle`,onChange:e=>ge(e.target.value)}),(0,X.jsx)(i,{icon:Te,onClick:()=>Fn(Kn,g(`Review the shared host/board program-state transition.`,`تغییر حالت برنامه میزبان و برد را بازبینی کنید.`),`caution`),children:g(`Prepare state change`,`آماده‌سازی تغییر حالت`)})]})]}),b&&(0,X.jsxs)(X.Fragment,{children:[(m.temperatureLED||m.temperatureBTAudio)&&(0,X.jsxs)(an,{icon:M,eyebrow:`DS18B20`,title:g(`Temperature identities`,`شناسه‌های دما`),detail:g(`Read assigned channels, inspect ROM identities, or explicitly rescan the OneWire bus.`,`خواندن کانال‌ها، بررسی شناسه ROM یا پویش دوباره گذرگاه OneWire.`),status:b?g(`available`,`آماده`):g(`device required`,`نیازمند برد`),tone:b?`info`:`neutral`,children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:M,disabled:!b,busy:u===`temp`,onClick:()=>void l(`temp`),children:g(`Read values`,`خواندن دما`)}),(0,X.jsx)(i,{icon:Xe,disabled:!b,busy:u===`temp list`,onClick:()=>void l(`temp list`),children:g(`List identities`,`فهرست شناسه‌ها`)}),(0,X.jsx)(i,{icon:dt,disabled:!b,busy:u===`temp scan`,onClick:()=>void l(`temp scan`),children:g(`Rescan bus`,`پویش دوباره`)})]}),(0,X.jsx)(`p`,{className:`advanced-note`,children:g(`A rescan refreshes physical sensor assignment; it does not claim that attached probes have been validated here.`,`پویش دوباره، تخصیص حسگر فیزیکی را به‌روز می‌کند؛ این صفحه به‌تنهایی تأییدکننده سلامت سخت‌افزار متصل نیست.`)})]}),(0,X.jsxs)(an,{icon:o,eyebrow:g(`EEPROM-BACKED`,`ذخیره‌شده در EEPROM`),title:g(`Silent mode & firmware buzzer cues`,`حالت بی‌صدا و اعلان‌های بیزر`),detail:g(`Inspect the authoritative board settings, choose desired audio policy, then apply explicitly.`,`تنظیمات معتبر برد را ببینید، سیاست صوتی دلخواه را انتخاب و صریحاً اعمال کنید.`),status:e.have_settings?g(`settings synced`,`تنظیمات همگام`):g(`not read`,`خوانده نشده`),tone:e.have_settings?`good`:`neutral`,children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:ve,disabled:!b,busy:u===`settings`,onClick:()=>void l(`settings`),children:g(`EEPROM status`,`وضعیت EEPROM`)}),(0,X.jsx)(i,{icon:w,disabled:!b,busy:u===`silent status`,onClick:()=>void l(`silent status`),children:g(`Silent status`,`وضعیت بی‌صدا`)})]}),(0,X.jsxs)(`div`,{className:`advanced-toggle-stack`,children:[(0,X.jsx)(y,{checked:F,disabled:!b,onChange:I,label:g(`Silent mode`,`حالت بی‌صدا`),detail:g(`Desired persisted value.`,`مقدار ذخیره‌شونده درخواستی.`)}),(0,X.jsx)(y,{checked:be,disabled:!b,onChange:we,label:g(`Door cues`,`صدای باز و بسته شدن در`),detail:g(`Desired firmware cue state.`,`وضعیت درخواستی صدای میان‌افزار.`)}),(0,X.jsx)(y,{checked:L,disabled:!b,onChange:Oe,label:g(`Relay cues`,`صدای روشن و خاموش شدن رله`),detail:g(`Desired firmware cue state.`,`وضعیت درخواستی صدای میان‌افزار.`)})]}),(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:F?w:ne,disabled:!b,busy:u===`silent ${F?`on`:`off`}`,onClick:()=>void l(`silent ${F?`on`:`off`}`),children:g(`Apply silent`,`اعمال بی‌صدا`)}),(0,X.jsx)(i,{icon:ze,disabled:!b,busy:u===`settings audio door ${be?`on`:`off`}`,onClick:()=>void l(`settings audio door ${be?`on`:`off`}`),children:g(`Apply door cues`,`اعمال صدای در`)}),(0,X.jsx)(i,{icon:o,disabled:!b,busy:u===`settings audio relay ${L?`on`:`off`}`,onClick:()=>void l(`settings audio relay ${L?`on`:`off`}`),children:g(`Apply relay cues`,`اعمال صدای رله`)})]})]}),(0,X.jsxs)(an,{icon:Ke,eyebrow:g(`FRONT PANEL`,`پنل جلویی`),title:g(`Catalog, layout & navigation`,`کاتالوگ، چیدمان و پیمایش`),detail:g(`Firmware page IDs and HOST-supplied menu overlays remain separately inspectable.`,`شناسه صفحات میان‌افزار و منوهای میزبان به‌صورت مستقل قابل بررسی هستند.`),status:R?.tm1637_detection_known?R.tm1637_detected?g(`TM1637 detected`,`TM1637 شناسایی شد`):g(`TM1637 not detected`,`TM1637 شناسایی نشد`):void 0,tone:R?.tm1637_detection_known?R.tm1637_detected?`good`:`bad`:`neutral`,defaultOpen:!0,children:[m.segments&&(0,X.jsxs)(`div`,{className:`front-panel-live`,children:[(0,X.jsx)(nn,{panel:R,label:g(`Live physical seven-segment display`,`نمایش زندهٔ نمایشگر فیزیکی هفت‌بخشی`)}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:g(`Live physical display`,`نمایش زنده پنل`)}),(0,X.jsx)(`span`,{children:R?e.have_front_panel?`${g(`page`,`صفحه`)} ${R.menu_page} · ${g(`brightness`,`روشنایی`)} ${R.brightness}/7`:`${g(`live segment frame`,`فریم زنده نمایشگر`)} · ${g(`brightness`,`روشنایی`)} ${R.brightness}/7`:g(`Waiting for the next physical display event`,`در انتظار رویداد بعدی نمایشگر فیزیکی`)}),(0,X.jsx)(`small`,{children:g(`Physical changes update every connected client immediately through the state stream.`,`تغییرات فیزیکی از راه جریان وضعیت، همهٔ کارخواه‌های متصل را فوری به‌روز می‌کند.`)})]})]}),(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[m.segments&&!e.have_front_panel_segments&&(0,X.jsx)(i,{icon:O,disabled:!b,onClick:()=>void a(`controller.front_panel`).then(qe).catch(()=>void 0),children:g(`Recover physical state`,`بازیابی وضعیت فیزیکی`)}),(0,X.jsx)(i,{icon:ke,disabled:!b,busy:u===`menu list`,onClick:()=>void l(`menu list`),children:g(`Firmware catalog`,`کاتالوگ میان‌افزار`)}),(0,X.jsx)(i,{icon:t,disabled:!b,busy:u===`menu current`,onClick:()=>void l(`menu current`),children:g(`Current page`,`صفحه فعلی`)}),(0,X.jsx)(i,{icon:Ke,disabled:!b,busy:u===`menu layout`,onClick:()=>void l(`menu layout`),children:g(`Stored layout`,`چیدمان ذخیره‌شده`)}),(0,X.jsx)(i,{icon:Xe,busy:u===`host-menu list`,onClick:()=>void l(`host-menu list`),children:g(`Host catalog`,`کاتالوگ میزبان`)}),(0,X.jsx)(i,{icon:Ue,busy:u===`host-menu directory`,onClick:()=>void l(`host-menu directory`),children:g(`Host directory`,`دایرکتوری میزبان`)}),(0,X.jsx)(i,{icon:xe,busy:u===`host-menu status`,onClick:()=>void l(`host-menu status`),children:g(`Overlay status`,`وضعیت لایه میزبان`)}),(0,X.jsx)(i,{icon:yt,disabled:!b,busy:u===`host-menu open macro-library`,onClick:()=>void l(`host-menu open macro-library`),children:g(`Macro front panel`,`پنل ماکرو`)})]}),(0,X.jsx)(`div`,{className:`advanced-nav-pad`,"aria-label":g(`Firmware menu navigation`,`پیمایش منوی میان‌افزار`),children:[`prev`,`next`,`dec`,`inc`].map(e=>(0,X.jsx)(i,{compact:!0,disabled:!b,busy:u===`menu ${e}`,onClick:()=>void l(`menu ${e}`),children:e},e))}),(0,X.jsx)(`div`,{className:`advanced-nav-pad`,"aria-label":g(`HOST menu navigation`,`پیمایش منوی میزبان`),children:[[`K1`,`Previous`],[`K2`,`Next`],[`K3`,`Decrease`],[`K4`,`Select`]].map(([e,t])=>(0,X.jsx)(i,{compact:!0,disabled:!b,busy:u===`host-menu key ${e} press`,onClick:()=>void l(`host-menu key ${e} press`),children:g(`${e} · ${t}`,`${e} · ${t}`)},e))}),(0,X.jsx)(`p`,{className:`advanced-note advanced-note--safe`,children:g(`The Macro front-panel page uses the shared host library, records host command timing by default, shows playback progress, and offers safe cancel or guarded keep-output cancel.`,`صفحه ماکروی پنل از کتابخانه مشترک میزبان استفاده می‌کند، زمان فرمان‌های میزبان را ضبط می‌کند و پیشرفت اجرا و لغو امن را نشان می‌دهد.`)}),(0,X.jsxs)(`div`,{className:`advanced-fields`,children:[(0,X.jsx)(T,{label:g(`Firmware page ID or key`,`شناسه یا کلید صفحه میان‌افزار`),value:Ae,dir:`ltr`,spellCheck:!1,onChange:e=>je(e.target.value),action:(0,X.jsx)(i,{icon:t,disabled:!b||!Ae.trim(),busy:u===`menu page ${Ae.trim()}`,onClick:()=>void l(`menu page ${v(Ae.trim())}`),children:g(`Go to page`,`رفتن به صفحه`)})}),(0,X.jsx)(T,{label:g(`Host menu ID · optional`,`شناسه منوی میزبان · اختیاری`),value:Re,dir:`ltr`,spellCheck:!1,onChange:e=>Be(e.target.value),action:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(i,{icon:rt,disabled:!b,busy:u===`host-menu open${Re.trim()?` ${v(Re.trim())}`:``}`,onClick:()=>void l(`host-menu open${Re.trim()?` ${v(Re.trim())}`:``}`),children:g(`Open overlay`,`باز کردن لایه`)}),(0,X.jsx)(i,{icon:O,disabled:!b,busy:u===`host-menu refresh`,onClick:()=>void l(`host-menu refresh`),children:g(`Refresh`,`تازه‌سازی`)}),(0,X.jsx)(i,{icon:x,busy:u===`host-menu close`,onClick:()=>void l(`host-menu close`),children:g(`Close`,`بستن`)})]})}),(0,X.jsx)(T,{label:g(`Short 7-segment label`,`برچسب کوتاه نمایشگر`),hint:g(`Select a HOST menu ID above, then enter 1–4 printable ASCII characters.`,`شناسه منوی میزبان را در بالا انتخاب کنید و ۱ تا ۴ نویسه ASCII وارد کنید.`),value:He,dir:`ltr`,maxLength:4,spellCheck:!1,onChange:e=>We(e.target.value),action:(0,X.jsx)(i,{icon:de,disabled:!Yn,busy:u===Yn,onClick:()=>Yn&&void l(Yn),children:g(`Save label`,`ذخیره برچسب`)})})]}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--layout`,children:[(0,X.jsx)(T,{label:g(`Visibility mask`,`ماسک نمایش`),value:Me,dir:`ltr`,spellCheck:!1,onChange:e=>Ne(e.target.value)}),(0,X.jsx)(T,{label:g(`Ordered page references`,`ترتیب شناسه یا کلید صفحات`),value:Pe,dir:`ltr`,spellCheck:!1,onChange:e=>Ie(e.target.value)}),(0,X.jsx)(i,{icon:pt,disabled:!Me.trim()||!sn(Pe),onClick:()=>Fn(`menu layout set ${Me.trim()} ${sn(Pe)}`,g(`Layout writes are schema-sensitive and persistent on supported firmware.`,`نوشتن چیدمان وابسته به ساختار و در میان‌افزارهای پشتیبانی‌شده ماندگار است.`),`caution`,!0),children:g(`Prepare layout write`,`آماده‌سازی نوشتن چیدمان`)})]})]}),(0,X.jsxs)(an,{icon:pe,eyebrow:`WS281X + STATUS RGB`,title:g(`Per-pixel light & effect engine`,`نور هر پیکسل و موتور افکت`),detail:``,children:[(0,X.jsxs)(`div`,{className:`advanced-fields`,children:[(0,X.jsx)(T,{label:g(`LED count`,`تعداد LED`),type:`number`,min:1,max:100,value:z,onChange:e=>{let t=on(e.target.value,100,1,100);Ze(t),Ye(e=>Math.min(e,t-1))}}),(0,X.jsx)(T,{label:g(`Frames per second`,`فریم در ثانیه`),type:`number`,min:1,max:30,value:Qe,onChange:e=>et(on(e.target.value,20,1,30))})]}),(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{disabled:!b,busy:u===`strip config ${z}`,onClick:()=>void l(`strip config ${z}`),children:g(`Set LED count`,`تنظیم تعداد LED`)}),(0,X.jsx)(i,{icon:at,disabled:!b,busy:u===`strip rainbow ${z} ${Qe}`,onClick:()=>void l(`strip rainbow ${z} ${Qe}`),children:g(`Rolling rainbow`,`رنگین‌کمان متحرک`)}),(e.strip_effects??[]).map(e=>{let t=`effect play ${e.id} ${z} ${Qe}`;return(0,X.jsx)(i,{icon:he,disabled:!b,busy:u===t,onClick:()=>void l(t),children:e.name},e.id)}),(0,X.jsx)(i,{icon:Fe,onClick:()=>void l(`effect stop`),children:g(`Stop`,`توقف`)}),(0,X.jsx)(i,{icon:Ve,disabled:!b,onClick:()=>void l(`strip clear`),children:g(`Clear strip`,`خاموش کردن نوار`)}),(0,X.jsx)(i,{icon:s,onClick:()=>void l(`strip status`),children:g(`Stream status`,`وضعیت جریان`)})]}),(0,X.jsx)(T,{label:g(`RGB frame · six hex digits per LED`,`فریم RGB · شش رقم هگز برای هر LED`),value:nt,dir:`ltr`,spellCheck:!1,maxLength:600,onChange:e=>it(e.target.value.replace(/\s/g,``)),action:(0,X.jsx)(i,{disabled:!b||!/^(?:[0-9a-fA-F]{6})+$/.test(nt)||nt.length!==z*6,onClick:()=>void l(`strip frame ${nt}`),children:g(`Send frame`,`ارسال فریم`)})}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--pixel`,children:[(0,X.jsx)(T,{label:g(`Pixel 0..${z-1}`,`پیکسل ۰ تا ${z-1}`),type:`number`,min:0,max:z-1,value:Je,onChange:e=>Ye(on(e.target.value,0,0,z-1))}),(0,X.jsx)(T,{label:`R`,type:`number`,min:0,max:255,value:ot,onChange:e=>ct(on(e.target.value,0,0,255))}),(0,X.jsx)(T,{label:`G`,type:`number`,min:0,max:255,value:lt,onChange:e=>ut(on(e.target.value,0,0,255))}),(0,X.jsx)(T,{label:`B`,type:`number`,min:0,max:255,value:ft,onChange:e=>mt(on(e.target.value,0,0,255))})]}),(0,X.jsx)(C,{label:g(`Pixel brightness`,`روشنایی پیکسل`),value:ht,min:0,max:255,disabled:!b,onChange:gt}),(0,X.jsx)(i,{tone:`primary`,icon:tt,disabled:!b,busy:u===`strip pixel ${Je} ${ot} ${lt} ${ft} ${ht}`,onClick:()=>void l(`strip pixel ${Je} ${ot} ${lt} ${ft} ${ht}`),children:g(`Apply pixel`,`اعمال پیکسل`)}),(0,X.jsx)(`div`,{className:`advanced-divider`}),(0,X.jsx)(T,{label:g(`Configured effect name`,`نام افکت تعریف‌شده`),value:vt,dir:`ltr`,spellCheck:!1,onChange:e=>bt(e.target.value)}),(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:he,busy:u===`rgb effect list`,onClick:()=>void l(`rgb effect list`),children:g(`List effects`,`فهرست افکت‌ها`)}),(0,X.jsx)(i,{icon:s,busy:u===`rgb effect status`,onClick:()=>void l(`rgb effect status`),children:g(`Effect status`,`وضعیت افکت`)}),(0,X.jsx)(i,{icon:at,disabled:!b||!vt.trim(),busy:u===`rgb effect play ${v(vt.trim())}`,onClick:()=>void l(`rgb effect play ${v(vt.trim())}`),children:g(`Play effect`,`اجرای افکت`)}),(0,X.jsx)(i,{icon:Fe,busy:u===`rgb effect stop`,onClick:()=>void l(`rgb effect stop`),children:g(`Stop effect`,`توقف افکت`)})]})]}),(0,X.jsxs)(an,{icon:ue,eyebrow:`433 MHz`,title:g(`RF inspection, removal & mapping`,`بررسی، حذف و نگاشت RF`),detail:g(`Reads execute directly; persistent removal and mapping always enter the review dock first.`,`خواندن مستقیم انجام می‌شود؛ حذف و نگاشت ماندگار ابتدا وارد بخش بازبینی می‌شوند.`),status:b?g(`receiver ready`,`گیرنده آماده`):g(`device required`,`نیازمند برد`),tone:b?`info`:`neutral`,children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:De,busy:u===`rf status`,onClick:()=>void l(`rf status`),children:g(`Learn status`,`وضعیت یادگیری`)}),(0,X.jsx)(i,{icon:Xe,disabled:!b,busy:u===`rf list`,onClick:()=>void l(`rf list`),children:g(`Inspect learned entries`,`بررسی ورودی‌های آموخته‌شده`)})]}),(0,X.jsx)(T,{label:g(`Learned entry ID`,`شناسه ورودی آموخته‌شده`),value:xt,dir:`ltr`,inputMode:`numeric`,onChange:e=>V(e.target.value)}),(0,X.jsx)(`div`,{className:`advanced-actions`,children:(0,X.jsx)(i,{tone:`danger`,icon:le,disabled:!xt.trim(),onClick:()=>Fn(`rf remove ${xt.trim()}`,g(`This permanently removes one learned RF entry from the board.`,`این فرمان یک ورودی RF آموخته‌شده را برای همیشه از برد حذف می‌کند.`),`danger`,!0),children:g(`Prepare removal`,`آماده‌سازی حذف`)})}),(0,X.jsxs)(`div`,{className:`advanced-field`,children:[(0,X.jsx)(`label`,{children:g(`Mapping kind`,`نوع نگاشت`)}),(0,X.jsx)(_,{value:H,label:g(`RF mapping kind`,`نوع نگاشت RF`),options:[{value:`key`,label:g(`Key`,`کلید`)},{value:`menu`,label:g(`Menu`,`منو`)},{value:`relay`,label:g(`Relay`,`رله`)},{value:`side`,label:g(`Motion`,`حرکت`)},...m.pwm?[{value:`pwm`,label:`PWM`}]:[],{value:`none`,label:g(`None`,`بدون نگاشت`)}],onChange:Un})]}),H!==`none`&&(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsx)(T,{label:g(`Target / action`,`مقصد / عمل`),hint:g(`Key 1..4 · menu prev/next/dec/inc · relay 5..8 · side left/right · PWM 0..10`,`کلید ۱..۴ · منو prev/next/dec/inc · رله ۵..۸ · سمت left/right · PWM ۰..۱۰`),value:Ct,dir:`ltr`,spellCheck:!1,onChange:e=>U(e.target.value)}),H!==`menu`&&(0,X.jsx)(T,{label:g(`Behavior`,`رفتار`),hint:H===`side`?`up | down | stop`:`press | toggle | momentary`,value:wt,dir:`ltr`,spellCheck:!1,onChange:e=>Tt(e.target.value)})]}),(0,X.jsx)(`div`,{className:`advanced-command-inline`,dir:`ltr`,children:(0,X.jsx)(`code`,{children:Pn})}),(0,X.jsx)(i,{icon:pt,disabled:!xt.trim(),onClick:()=>Fn(Pn,g(`RF mappings affect physical outputs and must match the registered action schema.`,`نگاشت RF بر خروجی فیزیکی اثر می‌گذارد و باید دقیقاً با ساختار فرمان سازگار باشد.`),`caution`,!0),children:g(`Review mapping`,`بازبینی نگاشت`)})]}),(0,X.jsxs)(an,{icon:ye,eyebrow:`I²C + LCD`,title:g(`Cooperative bus & raw transfer`,`گذرگاه اشتراکی و انتقال خام`),detail:g(`Inspect LCD ownership and scan safely; raw schemas are reviewed before the host lease is acquired.`,`مالکیت LCD را ببینید و امن پویش کنید؛ انتقال خام پیش از گرفتن دسترسی میزبان بازبینی می‌شود.`),status:m.lcd?`LCD 0x${(e.front_panel?.lcd_address||e.status.lcd_address).toString(16).padStart(2,`0`).toUpperCase()}`:g(`LCD not detected`,`LCD شناسایی نشد`),tone:b?`info`:`neutral`,children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:dt,disabled:!b,busy:u===`i2c scan`,onClick:()=>void l(`i2c scan`),children:g(`Scan bus`,`پویش گذرگاه`)}),m.lcd&&(0,X.jsx)(i,{icon:$e,busy:u===`i2c lcd status`,onClick:()=>void l(`i2c lcd status`),children:g(`LCD status`,`وضعیت LCD`)}),(0,X.jsx)(i,{icon:O,disabled:!b,busy:u===`i2c lcd rescan`,onClick:()=>void l(`i2c lcd rescan`),children:g(`Rescan LCD`,`پویش دوباره LCD`)}),(0,X.jsx)(i,{icon:_e,disabled:!b,busy:u===`i2c release`,onClick:()=>void l(`i2c release`),children:g(`Release lease`,`آزادسازی دسترسی`)})]}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--i2c`,children:[(0,X.jsx)(T,{label:g(`7-bit address`,`نشانی ۷ بیتی`),value:Et,dir:`ltr`,spellCheck:!1,onChange:e=>W(e.target.value)}),(0,X.jsx)(T,{label:g(`Lease seconds 0..10`,`مدت دسترسی ۰..۱۰ ثانیه`),type:`number`,min:0,max:10,value:Dt,onChange:e=>Ot(on(e.target.value,2,0,10))}),(0,X.jsx)(T,{label:g(`Read count`,`تعداد بایت خواندن`),type:`number`,min:0,max:16,value:G,onChange:e=>kt(on(e.target.value,0,0,16))}),(0,X.jsx)(T,{label:g(`Write bytes · numeric tokens`,`بایت‌های نوشتن · توکن عددی`),hint:`0x00 0x01 255`,value:K,dir:`ltr`,spellCheck:!1,onChange:e=>At(e.target.value)})]}),(0,X.jsx)(`div`,{className:`advanced-command-inline`,dir:`ltr`,children:(0,X.jsx)(`code`,{children:Jn})}),(0,X.jsx)(i,{icon:pt,onClick:()=>Fn(Jn,g(`Raw I²C transfer parameters are sent exactly as reviewed and acquire a bounded cooperative lease.`,`پارامترهای انتقال خام I²C دقیقاً پس از بازبینی ارسال و دسترسی اشتراکی محدود دریافت می‌شود.`),`caution`,!0),children:g(`Review raw transfer`,`بازبینی انتقال خام`)})]}),(0,X.jsxs)(an,{icon:d,eyebrow:g(`GLOBAL INPUT`,`ورودی سراسری`),title:g(`Keyboard lifecycle & emergency release`,`چرخه صفحه‌کلید و آزادسازی اضطراری`),detail:g(`Inspect bindings, control the primary Windows hook, or release every held and latched output.`,`نگاشت‌ها را ببینید، هوک اصلی ویندوز را کنترل یا همه خروجی‌های نگه‌داشته‌شده را آزاد کنید.`),children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:s,busy:u===`keyboard status`,onClick:()=>void l(`keyboard status`),children:g(`Hook status`,`وضعیت هوک`)}),(0,X.jsx)(i,{icon:Xe,busy:u===`keyboard list`,onClick:()=>void l(`keyboard list`),children:g(`Binding catalog`,`فهرست نگاشت‌ها`)}),(0,X.jsx)(i,{icon:d,onClick:()=>Fn(`keyboard enable`,g(`Enabling the global hook activates the configured bindings; review them first with Keyboard list.`,`فعال‌سازی هوک سراسری، نگاشت‌های پیکربندی‌شده را فعال می‌کند؛ ابتدا فهرست صفحه‌کلید را بازبینی کنید.`),`caution`),children:g(`Review enable`,`بازبینی فعال‌سازی`)}),(0,X.jsx)(i,{icon:Ge,busy:u===`keyboard disable`,onClick:()=>void l(`keyboard disable`),children:g(`Disable & release`,`غیرفعال و آزادسازی`)}),(0,X.jsx)(i,{tone:`danger`,icon:Fe,busy:u===`estop ${e.emergency_stop?.active?`off`:`on`}`,onClick:()=>void l(`estop ${e.emergency_stop?.active?`off`:`on`}`),children:e.emergency_stop?.active?g(`Release E-STOP`,`آزادسازی توقف اضطراری`):g(`Engage E-STOP`,`فعال‌سازی توقف اضطراری`)})]}),(0,X.jsx)(`p`,{className:`advanced-note advanced-note--safe`,children:e.emergency_stop?.active?g(`Locked: effects, seat motion, relay tests, relay-on, and PWM output commands are rejected by PCController.`,`قفل است: افکت‌ها، حرکت صندلی، آزمایش رله، روشن‌کردن رله و فرمان‌های PWM توسط PCController رد می‌شوند.`):g(`Ready. Engaging E-STOP cancels effect playback and locks every motion/output command at PCController.`,`آماده است. توقف اضطراری پخش افکت را لغو و همه فرمان‌های حرکت و خروجی را در PCController قفل می‌کند.`)})]})]}),(0,X.jsxs)(an,{icon:$e,eyebrow:g(`POLICY-GATED OS`,`سیستم‌عامل تحت سیاست امنیتی`),title:g(`Brightness, virtual key & power preparation`,`روشنایی، کلید مجازی و آماده‌سازی توان`),detail:g(`Read host state directly. Virtual-key and power requests are composed visibly before submission.`,`وضعیت میزبان را مستقیم بخوانید؛ کلید مجازی و فرمان توان پیش از ارسال به‌وضوح ساخته می‌شوند.`),children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:n,busy:u===`os status`,onClick:()=>void l(`os status`),children:g(`Host status`,`وضعیت میزبان`)}),(0,X.jsx)(i,{icon:pt,busy:u===`os policy`,onClick:()=>void l(`os policy`),children:g(`Action policy`,`سیاست فرمان‌ها`)}),(0,X.jsx)(i,{icon:_t,busy:u===`os brightness get`,onClick:()=>void l(`os brightness get`),children:g(`Read brightness`,`خواندن روشنایی`)})]}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsx)(T,{label:g(`Virtual key`,`کلید مجازی`),hint:`F13 · MEDIA_PLAY_PAUSE · VOLUME_UP`,value:jt,dir:`ltr`,spellCheck:!1,onChange:e=>q(e.target.value)}),(0,X.jsx)(T,{label:g(`Hold ms`,`مدت نگه‌داری ms`),type:`number`,min:0,max:5e3,value:Mt,onChange:e=>Nt(on(e.target.value,80,0,5e3))})]}),(0,X.jsx)(i,{icon:pt,disabled:!jt.trim(),onClick:()=>Fn(`os key ${v(jt.trim())} ${Mt}`,g(`The configured OS policy still authorizes or rejects this reviewed key request.`,`سیاست سیستم‌عامل همچنان این درخواست کلید بازبینی‌شده را می‌پذیرد یا رد می‌کند.`),`caution`),children:g(`Prepare virtual key`,`آماده‌سازی کلید مجازی`)}),(0,X.jsx)(`div`,{className:`advanced-divider`}),(0,X.jsxs)(`div`,{className:`advanced-field`,children:[(0,X.jsx)(`label`,{children:g(`Power action`,`فرمان توان`)}),(0,X.jsx)(_,{value:Pt,label:g(`Power action`,`فرمان توان`),options:[{value:`lock`,label:g(`Lock`,`قفل`)},{value:`sleep`,label:g(`Sleep`,`خواب`)},{value:`hibernate`,label:g(`Hibernate`,`هایبرنیت`)},{value:`shutdown`,label:g(`Shutdown`,`خاموشی`)},{value:`restart`,label:g(`Restart`,`راه‌اندازی`)},{value:`logoff`,label:g(`Log off`,`خروج`)}],onChange:Ft})]}),(0,X.jsx)(T,{label:g(`Configured confirmation token`,`توکن تأیید تنظیم‌شده`),type:`password`,autoComplete:`off`,value:It,dir:`ltr`,onChange:e=>Lt(e.target.value)}),(0,X.jsx)(i,{tone:`danger`,icon:pt,disabled:!It.trim(),onClick:()=>Fn(`os power ${Pt} [REDACTED]`,g(`This can change the host power session. The secret is sent only through typed RPC, and the review dock requires a second typed RUN confirmation.`,`این فرمان می‌تواند وضعیت توان میزبان را تغییر دهد. توکن محرمانه فقط از RPC تایپ‌شده ارسال می‌شود و بخش بازبینی به تأیید تایپی RUN نیاز دارد.`),`danger`,!1,()=>a(`controller.os.power`,{action:Pt,confirmation:It})),children:g(`Prepare only — do not execute`,`فقط آماده‌سازی — بدون اجرا`)})]}),(0,X.jsxs)(an,{icon:Se,eyebrow:g(`TYPED HOST SERVICES`,`سرویس‌های تایپ‌شده میزبان`),title:g(`Messages, discovery & history`,`پیام‌ها، کشف شبکه و تاریخچه`),detail:g(`Typed RPC is used where the shell intentionally has no alias; results remain visible as protocol data.`,`در عملیات بدون فرمان پوسته، RPC تایپ‌شده استفاده می‌شود و نتیجه به‌صورت داده پروتکل دیده می‌شود.`),children:[(0,X.jsxs)(`form`,{className:`advanced-form`,onSubmit:Rn,children:[(0,X.jsxs)(`div`,{className:`advanced-field`,children:[(0,X.jsx)(`label`,{children:g(`Message target`,`مقصد پیام`)}),(0,X.jsx)(_,{value:J,label:g(`Message target`,`مقصد پیام`),options:b?[{value:`host`,label:g(`Event stream`,`جریان رویداد`)},{value:`lcd`,label:g(`Physical LCD`,`LCD فیزیکی`)}]:[{value:`host`,label:g(`Event stream`,`جریان رویداد`)}],onChange:Rt})]}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--message`,children:[(0,X.jsx)(T,{label:g(`Message type`,`نوع پیام`),hint:`a-z · 0-9 · dot · dash · underscore`,value:zt,dir:`ltr`,spellCheck:!1,maxLength:32,onChange:e=>Bt(e.target.value)}),J===`host`?(0,X.jsx)(T,{label:g(`Event text`,`متن رویداد`),value:Y,maxLength:4096,onChange:e=>Vt(e.target.value),hint:`${Xn} / 4096 UTF-8 bytes`,"aria-invalid":Xn>4096}):(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsx)(T,{label:g(`LCD line 1`,`خط اول LCD`),value:Ht,maxLength:16,dir:`ltr`,spellCheck:!1,onChange:e=>Ut(e.target.value)}),(0,X.jsx)(T,{label:g(`LCD line 2`,`خط دوم LCD`),value:Wt,maxLength:16,dir:`ltr`,spellCheck:!1,onChange:e=>Gt(e.target.value)})]}),(0,X.jsx)(i,{type:`submit`,tone:`primary`,icon:Ce,busy:Tn===`message`,disabled:!zt.trim()||(J===`host`?!Y.trim()||Xn>4096:!Zn)||Qn&&!b,children:g(`Send typed message`,`ارسال پیام تایپ‌شده`)})]}),J===`lcd`&&(0,X.jsx)(`p`,{className:`advanced-note${Zn?` advanced-note--safe`:``}`,children:g(`Up to two 16-character lines; printable ASCII only. Hardware LCD text is intentionally LTR.`,`حداکثر دو خط ۱۶ نویسه‌ای و فقط ASCII قابل چاپ؛ متن LCD سخت‌افزاری عمداً چپ‌به‌راست است.`)})]}),(0,X.jsx)(`div`,{className:`advanced-divider`}),(0,X.jsxs)(`div`,{className:`advanced-toggle-stack advanced-toggle-stack--compact`,children:[(0,X.jsx)(y,{checked:Kt,onChange:qt,label:`mDNS / DNS-SD`}),(0,X.jsx)(y,{checked:Jt,onChange:Yt,label:`SSDP / UPnP + SOAP`}),(0,X.jsx)(y,{checked:Xt,onChange:Zt,label:`WS-Discovery`}),(0,X.jsx)(y,{checked:Qt,onChange:$t,label:`UDP broadcast`}),(0,X.jsx)(y,{checked:en,onChange:tn,label:`NetBIOS`}),(0,X.jsx)(y,{checked:un,onChange:dn,label:`MNDP`})]}),(0,X.jsx)(rn,{locale:r}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,X.jsx)(T,{label:g(`Advertised instance name`,`نام تبلیغ‌شده نمونه`),hint:g(`Blank uses the configured app title`,`خالی یعنی عنوان برنامه`),value:pn,maxLength:63,onChange:e=>mn(e.target.value)}),(0,X.jsx)(T,{label:g(`UDP broadcast port`,`درگاه پخش UDP`),type:`number`,min:1024,max:65535,value:hn,onChange:e=>gn(on(e.target.value,37889,1024,65535))})]}),(0,X.jsx)(i,{icon:de,busy:Tn===`discovery-config`,onClick:Vn,children:g(`Save advertisement settings`,`ذخیره تنظیمات معرفی`)}),(0,X.jsx)(`p`,{className:`advanced-note advanced-note--safe`,children:g(`Advertisement is enabled by default and publishes only bounded public identity, health and telemetry. Remote commands still require an authenticated, remotely enabled IPC policy.`,`معرفی شبکه به‌طور پیش‌فرض فعال است و فقط هویت، سلامت و تله‌متری عمومی محدود را منتشر می‌کند. فرمان‌های راه‌دور همچنان به IPC فعال و احراز هویت‌شده نیاز دارند.`)}),(0,X.jsx)(C,{label:g(`Discovery timeout`,`مهلت کشف`),value:Z,min:100,max:5e3,step:100,unit:`ms`,onChange:fn}),(0,X.jsx)(i,{icon:dt,busy:Tn===`discovery`,disabled:!Kt&&!Jt&&!Xt&&!Qt&&!en&&!un,onClick:()=>void Bn(),children:g(`Discover network hosts`,`کشف میزبان‌های شبکه`)}),_n.length>0&&(0,X.jsx)(`div`,{className:`network-device-directory`,"aria-live":`polite`,children:_n.map(e=>{let t=e.public,n=t?.board.telemetry,r=[];return n?.ina219_available&&(r.push(`${((n.supply_mv??0)/1e3).toFixed(2)} V`),r.push(`${(n.current_ma??0).toFixed(0)} mA`)),n?.temperature_led_available&&r.push(`${((n.temperature_led_centi_c??0)/100).toFixed(1)} °C LED`),n?.temperature_bt_audio_available&&r.push(`${((n.temperature_bt_audio_centi_c??0)/100).toFixed(1)} °C BT`),n?.available&&r.push(n.door_open?g(`door open`,`درب باز`):g(`door closed`,`درب بسته`)),(0,X.jsxs)(`article`,{className:`network-device`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:t?.instance_name||e.name}),(0,X.jsxs)(`small`,{children:[t?.hostname||e.host,`:`,e.port,` · `,(e.protocols||[e.protocol]).join(` + `)]})]}),(0,X.jsx)(ie,{tone:t?.health.ok?t.health.connectable?`good`:`warn`:`bad`,children:t?.health.connectable?g(`CONNECTABLE`,`قابل اتصال`):g(`DISCOVERABLE`,`قابل کشف`)}),(0,X.jsx)(`p`,{children:t?.board.connected?`${t.board.identity.name||`PCController`} · ${t.board.identity.build_hash||`firmware`} · ${t.board.port.name||t.board.port.product||`serial`}`:g(`Host online · board disconnected`,`میزبان آنلاین · برد قطع است`)}),r.length>0&&(0,X.jsx)(`p`,{children:r.join(` · `)}),(0,X.jsx)(i,{tone:`primary`,icon:st,disabled:!t?.health.connectable,onClick:()=>Hn(e),children:g(`Connect to host`,`اتصال به میزبان`)})]},t?.instance_id||`${e.host}:${e.port}`)})}),(0,X.jsx)(`div`,{className:`advanced-divider`}),(0,X.jsxs)(`div`,{className:`advanced-fields advanced-fields--history`,children:[(0,X.jsx)(T,{label:g(`Look back · minutes`,`بازه گذشته · دقیقه`),type:`number`,min:1,max:43200,value:yn,onChange:e=>bn(on(e.target.value,60,1,43200))}),(0,X.jsx)(T,{label:g(`Timeline limit`,`حد رویدادها`),type:`number`,min:1,max:5e3,value:xn,onChange:e=>Sn(on(e.target.value,100,1,5e3))}),(0,X.jsx)(i,{icon:Le,busy:Tn===`history-status`,onClick:()=>zn(`status`),children:g(`Status history`,`تاریخچه وضعیت`)}),(0,X.jsx)(i,{icon:s,busy:Tn===`history-timeline`,onClick:()=>zn(`timeline`),children:g(`Event timeline`,`خط زمانی رویداد`)})]}),(0,X.jsx)(`pre`,{className:`advanced-service-output`,dir:`ltr`,"aria-live":`polite`,children:Cn})]}),(0,X.jsxs)(an,{icon:c,eyebrow:g(`READ-FIRST RECOVERY`,`بازیابی با اولویت خواندن`),title:g(`Firmware, toolchain & boot preparation`,`میان‌افزار، زنجیره‌ابزار و آماده‌سازی بوت`),detail:g(`Identity and toolchain reads are immediate; bootloader probe/read/backup commands are prepared only.`,`خواندن شناسه و زنجیره‌ابزار مستقیم است؛ فرمان‌های پروب، خواندن و پشتیبان بوت فقط آماده می‌شوند.`),children:[(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[b&&(0,X.jsx)(i,{icon:c,busy:u===`hello`,onClick:()=>void l(`hello`),children:g(`Firmware identity`,`شناسه میان‌افزار`)}),(0,X.jsx)(i,{icon:ve,busy:u===`toolchain profile`,onClick:()=>void l(`toolchain profile`),children:g(`Resolved profile`,`پروفایل حل‌شده`)}),(0,X.jsx)(i,{icon:c,busy:u===`toolchain core-info`,onClick:()=>void l(`toolchain core-info`),children:g(`Core info`,`اطلاعات هسته`)})]}),b&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(T,{label:g(`Backup directory or read output file`,`پوشه پشتیبان یا فایل خروجی خواندن`),value:Dn,dir:`ltr`,spellCheck:!1,onChange:e=>On(e.target.value)}),(0,X.jsxs)(`div`,{className:`advanced-actions`,children:[(0,X.jsx)(i,{icon:dt,onClick:()=>Fn(`boot probe`,g(`Prepare a non-write bootloader probe; execution temporarily hands over the serial port.`,`پروب غیرنوشتنی بوت آماده می‌شود؛ اجرا موقتاً درگاه سریال را تحویل می‌دهد.`),`caution`,!0),children:g(`Prepare probe`,`آماده‌سازی پروب`)}),(0,X.jsx)(i,{icon:Te,onClick:()=>Fn(`boot info`,g(`Prepare a metadata read through the guarded programming lifecycle.`,`خواندن فراداده از مسیر امن پروگرام آماده می‌شود.`),`caution`,!0),children:g(`Prepare metadata`,`آماده‌سازی فراداده`)}),(0,X.jsx)(i,{icon:Ee,disabled:!Dn.trim(),onClick:()=>Fn(`boot backup ${v(Dn.trim())}`,g(`Prepare a backup-only operation to the reviewed destination.`,`عملیات فقط پشتیبان‌گیری در مقصد بازبینی‌شده آماده می‌شود.`),`caution`,!0),children:g(`Prepare backup`,`آماده‌سازی پشتیبان`)}),(0,X.jsx)(i,{icon:Ee,disabled:!Dn.trim(),onClick:()=>Fn(`boot read ${v(Dn.trim())}`,g(`Prepare a flash read to the reviewed output file; no flash write command is exposed here.`,`خواندن فلش در فایل بازبینی‌شده آماده می‌شود؛ هیچ فرمان نوشتن فلش در این بخش وجود ندارد.`),`caution`,!0),children:g(`Prepare flash read`,`آماده‌سازی خواندن فلش`)})]})]})]})]}),(0,X.jsxs)(`section`,{id:`advanced-command-review`,className:`advanced-review advanced-review--${Q.risk}`,"aria-live":`polite`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsx)(`span`,{className:`advanced-review__icon`,children:(0,X.jsx)(pt,{size:19,"aria-hidden":`true`})}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`small`,{children:g(`EXPLICIT COMMAND REVIEW`,`بازبینی صریح فرمان`)}),(0,X.jsx)(`h3`,{children:Q.command?g(`Prepared, never implicit`,`آماده، هرگز ضمنی`):g(`No command prepared`,`فرمانی آماده نشده`)})]}),Q.command&&(0,X.jsx)(ie,{tone:Q.risk===`danger`?`bad`:`warn`,children:Q.risk.toUpperCase()})]}),(0,X.jsxs)(`div`,{className:`advanced-review__command`,dir:`ltr`,children:[(0,X.jsx)(`span`,{children:`pc›`}),(0,X.jsx)(`code`,{children:Q.command?ae(Q.command):g(`Choose a prepare action above.`,`یک فرمان آماده‌سازی را از بالا انتخاب کنید.`)})]}),Q.reason&&(0,X.jsx)(`p`,{children:Q.reason}),Q.risk===`danger`&&(0,X.jsx)(T,{label:g(`Type RUN to arm this reviewed high-impact command`,`برای فعال‌سازی فرمان پراثر، RUN را تایپ کنید`),value:An,dir:`ltr`,autoComplete:`off`,spellCheck:!1,onChange:e=>jn(e.target.value)}),(0,X.jsxs)(`div`,{className:`advanced-review__actions`,children:[(0,X.jsx)(i,{tone:Q.risk===`danger`?`danger`:`primary`,icon:Te,disabled:$n,busy:Mn||u===Q.command,onClick:()=>void In(),children:g(`Run reviewed command`,`اجرای فرمان بازبینی‌شده`)}),(0,X.jsx)(i,{icon:Ve,disabled:!Q.command||Mn,onClick:()=>{kn({command:``,reason:``,risk:`normal`,needsDevice:!1}),jn(``)},children:g(`Clear`,`پاک‌کردن`)}),Q.needsDevice&&!b&&(0,X.jsx)(`span`,{className:`advanced-review__blocked`,children:g(`Connect an authenticated board before execution.`,`پیش از اجرا یک برد معتبر متصل کنید.`)})]})]}),(0,X.jsxs)(`footer`,{className:`advanced-footnote`,children:[(0,X.jsx)(pt,{size:15,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:g(`Controls reflect implemented protocol paths. Physical peripherals and external services still require live-device acceptance testing.`,`کنترل‌ها بر اساس مسیرهای پیاده‌سازی‌شده پروتکل هستند؛ تجهیزات فیزیکی و سرویس‌های بیرونی همچنان به آزمون پذیرش زنده نیاز دارند.`)})]})]})}function dn(e){let t=[`display`,e.target,`--speed`,`${e.speedMS}ms`,`--duration`,`${e.durationMS}ms`,`--repeat`,e.repeat];return e.repeat===`interval`&&t.push(`--interval`,`${e.intervalMS}ms`),e.scroll&&e.target!==`lcd`&&t.push(`--scroll`),t.push(`--`,v(e.text)),t.join(` `)}var Z=e=>`${e.code}:${e.bits}:${e.protocol}`,fn=(e,t,n=Date.now())=>t&&!!e&&n-Date.parse(e.last_seen)>=0&&n-Date.parse(e.last_seen)<250,pn=class{baseline=new Map;open(e){this.baseline=new Map(e.map(e=>[Z(e),e.received_count]))}count(e){return e?Math.max(0,e.received_count-(this.baseline.get(Z(e))??0)):0}};function mn({snapshot:e,events:t,locale:n,openDialog:r}){let o=(e,t)=>n===`fa`?t:e,[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(!1),[m,g]=(0,B.useState)(),[_,v]=(0,B.useState)(!1),[b,x]=(0,B.useState)(``),[ee,te]=(0,B.useState)(Date.now()),[S,ne]=(0,B.useState)(),re=(0,B.useRef)(new pn),w=(0,B.useRef)(!1),T=(0,B.useRef)(0),ae=(0,B.useRef)(``),oe=(0,B.useRef)(0),E=async(e=!0)=>{let t=++oe.current;try{let n=await a(`controller.rf.catalog`,{read_board:e});if(t!==oe.current)return;let r=`${n.host_instance_id}:${n.connection_generation}`,i=!w.current||ae.current!==r;i&&(re.current.open(n.receptions),w.current=!0,ae.current=r),c(e=>n.entries_sampled?n:{...n,entries:i?[]:e?.entries??[]}),g(e=>i||!e||JSON.stringify(e)===JSON.stringify(s?.preferences)?n.preferences:e),u(e=>n.receptions.map(t=>{let n=i?void 0:e.find(e=>Z(e)===Z(t));return n&&n.connection_generation===t.connection_generation&&n.received_count>t.received_count?n:t})),x(``)}catch(e){x(String(e))}};(0,B.useEffect)(()=>(w.current=!1,T.current=0,E(),()=>{oe.current++}),[e.connection_generation]),(0,B.useEffect)(()=>{let e=t.filter(e=>e.id>T.current);if(!e.length)return;T.current=Math.max(...e.map(e=>e.id));let n=e.filter(e=>e.kind===`rf.receive`&&e.source===`board`&&e.rf_code);n.length&&(u(e=>{let t=new Map(e.map(e=>[Z(e),e]));for(let e of n){let n={code:e.rf_code,bits:e.rf_bits,protocol:e.rf_protocol,pulse_us:e.rf_pulse_us,received_count:Number(e.metadata?.received_count),last_seen:e.time,connection_generation:Number(e.metadata?.connection_generation)};if(!Number.isFinite(n.received_count))continue;let r=t.get(Z(n));(!r||n.received_count>r.received_count)&&t.set(Z(n),n)}return[...t.values()].sort((e,t)=>Date.parse(t.last_seen)-Date.parse(e.last_seen)).slice(0,256)}),te(Date.now())),e.some(e=>e.kind.startsWith(`rf.learn.`)||e.kind===`rf.preferences.changed`)&&E(e.some(e=>e.kind===`rf.learn.capture`||e.kind===`rf.learn.mapping-required`||e.kind===`rf.learn.ended`||e.kind===`rf.learn.cancelled`))},[t]),(0,B.useEffect)(()=>{let e=l.map(e=>Date.parse(e.last_seen)+250).filter(e=>e>ee);if(!e.length)return;let t=setTimeout(()=>te(Date.now()),Math.max(1,Math.min(...e)-Date.now()));return()=>clearTimeout(t)},[l,ee]);let D=async(e,t={})=>{if(_)return!1;v(!0);try{return await a(`controller.rf.${e}`,t),await E(),!0}catch(e){return x(String(e)),!1}finally{v(!1)}},se=(0,B.useMemo)(()=>{let e=new Map;for(let t of s?.entries??[])e.set(Z(t),t);for(let t of l)e.has(Z(t))||e.set(Z(t),t);for(let t of s?.bindings??[]){let n={code:t.match.rf_code,bits:t.match.rf_bits,protocol:t.match.rf_protocol};e.has(Z(n))||e.set(Z(n),n)}return[...e.values()]},[s,l]),ce=e.rf_learning?.active??s?.learning?.active,A=s?.board_mapping_options.find(e=>e.action===S?.action),j=e=>[...new Set((s?.bindings??[]).filter(t=>t.match.rf_code===e.code&&t.match.rf_bits===e.bits&&t.match.rf_protocol===e.protocol).flatMap(e=>e.actions.map(t=>{if(t.type===`control`)for(let e of s?.peripherals.controls??[]){let n=e.actions?.find(e=>e.id===t.action_id);if(n)return`${e.name} · ${n.name??t.action_id}`}if(t.type===`board`){let e=(t.command??``).split(/\s+/);if(e.length===3&&e[0]===`pwm`&&/^(?:[0-9]|1[0-5])$/.test(e[2])){let t=s?.peripherals.controls.find(t=>t.key===`pwm.${e[2]}`);if(t)return`${t.name} · ${e[1]}`}}return e.name})))];return(0,X.jsxs)(p,{icon:ue,iconTone:`violet`,title:o(`RF controls`,`کنترل RF`),action:(0,X.jsx)(i,{tone:`ghost`,icon:h,"aria-label":o(`RF settings`,`تنظیمات RF`),onClick:()=>f(!d)}),children:[b&&(0,X.jsx)(`div`,{role:`alert`,className:`inline-error`,children:b}),(0,X.jsxs)(`div`,{className:`rf-manager__toolbar`,children:[ce?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ie,{tone:`info`,children:o(`Learning`,`یادگیری`)}),(0,X.jsx)(i,{icon:ht,busy:_,onClick:()=>void D(`learn.cancel`),children:o(`Stop learning`,`توقف یادگیری`)})]}):(0,X.jsx)(i,{icon:k,busy:_,disabled:!e.connected,onClick:()=>void D(`learn.start`),children:o(`Learn buttons`,`یادگیری دکمه‌ها`)}),(0,X.jsx)(i,{tone:`ghost`,icon:O,"aria-label":o(`Refresh learned buttons`,`تازه‌سازی دکمه‌ها`),disabled:_||!e.connected,onClick:()=>void E()})]}),d&&m&&(0,X.jsxs)(`div`,{className:`rf-manager__settings`,children:[(0,X.jsx)(y,{label:o(`Timed learning`,`یادگیری زمان‌دار`),checked:m.timed,disabled:_,onChange:e=>g({...m,timed:e})}),(0,X.jsx)(C,{label:o(`Timeout`,`مهلت`),min:1,max:120,step:1,unit:`s`,value:m.timeout_seconds,disabled:_,onChange:e=>g({...m,timeout_seconds:e})}),(0,X.jsx)(y,{label:o(`Continuously learn buttons`,`یادگیری پیوستهٔ دکمه‌ها`),checked:m.continuous,disabled:_,onChange:e=>g({...m,continuous:e})}),(0,X.jsx)(i,{icon:de,busy:_,disabled:JSON.stringify(m)===JSON.stringify(s?.preferences),onClick:()=>void D(`preferences.set`,m),children:o(`Save settings`,`ذخیرهٔ تنظیمات`)})]}),(0,X.jsx)(`div`,{className:`rf-manager__list`,children:se.map(t=>{let n=l.find(e=>Z(e)===Z(t)),a=fn(n,e.connected,ee),s=t.id!==void 0;return(0,X.jsxs)(`div`,{className:`rf-manager__row`,children:[(0,X.jsx)(`span`,{className:`rf-receive-indicator${a?` is-on`:``}`,role:`img`,"aria-label":a?o(`Receiving`,`در حال دریافت`):o(`Not receiving`,`دریافت نمی‌شود`)}),(0,X.jsxs)(`span`,{className:`rf-receive-count`,title:o(`Receptions since this view opened`,`دریافت‌ها از باز شدن این نما`),children:[`×`,re.current.count(n)]}),(0,X.jsxs)(`div`,{className:`rf-manager__identity${s?``:` is-unlearned`}`,children:[(0,X.jsx)(`strong`,{children:t.name||`0x${t.code.toString(16).toUpperCase()}`}),(0,X.jsxs)(`small`,{children:[t.bits,` bits · `,o(`Protocol`,`پروتکل`),` `,t.protocol,t.board_assignment&&` · ${o(`On board`,`روی برد`)}: ${t.board_assignment.label}`]}),j(t).map(e=>(0,X.jsx)(`small`,{children:e},e))]}),(0,X.jsx)(`div`,{className:`rf-manager__actions`,children:s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(i,{tone:`ghost`,icon:h,disabled:_,"aria-label":o(`Edit board assignment`,`ویرایش نگاشت برد`),onClick:()=>ne({id:t.id,action:t.board_assignment?.action??`none`,target:t.board_assignment?.target,behavior:t.board_assignment?.behavior})}),(0,X.jsx)(i,{tone:`ghost`,icon:le,disabled:_,"aria-label":o(`Remove learned button`,`حذف دکمهٔ آموخته`),onClick:()=>{r({open:!0,tone:`danger`,title:o(`Remove learned RF button?`,`دکمهٔ آموخته حذف شود؟`),body:t.code_display??`0x${t.code.toString(16)}`,confirmLabel:o(`Remove`,`حذف`),action:async()=>{await D(`remove`,{id:t.id})}})}})]}):(0,X.jsx)(i,{icon:k,disabled:_||!n||ce,onClick:()=>void D(`observed.add`,{code:t.code,bits:t.bits,protocol:t.protocol}),children:o(`Add`,`افزودن`)})})]},Z(t))})}),S&&(0,X.jsxs)(`div`,{className:`rf-manager__settings`,children:[(0,X.jsx)(`select`,{"aria-label":o(`Board action`,`عمل برد`),value:S.action,onChange:e=>ne({id:S.id,action:e.target.value}),children:s?.board_mapping_options.map(e=>(0,X.jsx)(`option`,{value:e.action,children:e.action},e.action))}),!!A?.targets.length&&(0,X.jsxs)(`select`,{"aria-label":o(`Target`,`هدف`),value:S.target??``,onChange:e=>ne({...S,target:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:`—`}),A.targets.map(e=>(0,X.jsx)(`option`,{value:e,children:s?.peripherals.controls.find(t=>t.key===`${S.action===`pwm`?`pwm`:S.action===`side`?`seat`:`relay`}.${e}`)?.name??e},e))]}),!!A?.behaviors.length&&(0,X.jsxs)(`select`,{"aria-label":o(`Behavior`,`رفتار`),value:S.behavior??``,onChange:e=>ne({...S,behavior:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:`—`}),A.behaviors.map(e=>(0,X.jsx)(`option`,{value:e,children:A.behavior_labels?.[e]??e},e))]}),(0,X.jsx)(i,{icon:de,busy:_,disabled:!!A?.targets.length&&!S.target||!!A?.behaviors.length&&!S.behavior,onClick:()=>void D(`map`,S).then(e=>{e&&ne(void 0)}),children:o(`Save on board`,`ذخیره روی برد`)}),(0,X.jsx)(i,{tone:`ghost`,onClick:()=>ne(void 0),children:o(`Cancel`,`لغو`)})]})]})}function hn(e){if(/^#[0-9a-f]{6}$/i.test(e?.trim()??``))return e.trim().toUpperCase();switch(e?.trim().toLowerCase()){case`blue`:return`blue`;case`violet`:return`violet`;case`green`:return`green`;case`white`:return`white`;default:return`red`}}function gn(e){let t=e.repeat_count??1,n=0;for(let t of e.steps??[]){let e=t.repeat_count??1,r=t.repeat_interval_ms??0,i=t.duration_ms??0;if(!Number.isInteger(e)||e<1||e>1e3||!Number.isInteger(r)||r<0||r>36e5)return;let a=(t.at_us??0)+i*1e3+(e-1)*(r===0?Math.max(i,1):r)*1e3;n=Math.max(n,a)}let r=e.repeat_interval_ms??0,i=r===0?n:r*1e3,a=n+(t-1)*i;if(!(!Number.isInteger(t)||t<1||t>1e3||!Number.isInteger(r)||r<0||r>36e5||i2147483647||t>1&&i===0||!Number.isInteger(a)||a<0||a>2147483647))return a}function _n(e,t){e??=0;let n=Math.abs(e);return n>=1e6?`${(e/1e6).toLocaleString(t,{maximumFractionDigits:3})} s`:n>=1e3?`${(e/1e3).toLocaleString(t,{maximumFractionDigits:3})} ms`:`${e.toLocaleString(t)} µs`}function vn({macros:e,selectedReference:t,locale:n,onSelect:r}){let i=n===`fa`;return e.length?(0,X.jsx)(`div`,{className:`macro-library__catalog`,role:`listbox`,"aria-label":i?`کتابخانه جلوه‌ها`:`Effect library`,children:e.map(e=>{let a=t===String(e.id),o=gn(e);return(0,X.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,className:a?`is-selected`:``,onClick:()=>r(e),children:[(0,X.jsx)(`span`,{className:`macro-library__color is-${hn(e.color)}`,style:e.color?.startsWith(`#`)?{backgroundColor:hn(e.color)}:void 0,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`macro-library__identity`,children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsxs)(`small`,{children:[`#`,e.id,` · `,e.category||(i?`بدون دسته`:`Uncategorized`),` · `,e.mode||`auto`]})]}),(0,X.jsxs)(`span`,{className:`macro-library__measure`,children:[(0,X.jsx)(`strong`,{children:(e.steps?.length??0).toLocaleString(n)}),(0,X.jsx)(`small`,{children:i?`گام`:`steps`})]}),(0,X.jsxs)(`span`,{className:`macro-library__measure`,children:[(0,X.jsx)(`strong`,{children:o===void 0?i?`زمان‌بندی نامعتبر`:`Invalid timing`:_n(o,n)}),(0,X.jsx)(`small`,{children:i?`مدت`:`duration`})]})]},e.id)})}):(0,X.jsx)(`div`,{className:`macro-library__empty`,children:i?`هنوز جلوهٔ ضبط‌شده‌ای وجود ندارد.`:`No recorded effects yet.`})}function yn({online:e,locale:t,events:n,initialSnapshot:r,stripEffects:o=[],commandSurface:s}){let c=t===`fa`,l=(e,t)=>c?t:e,u=l(`Choose recording channels with effect record start-json in Console. The recording chooser is not available yet.`,`کانال‌های ضبط را با فرمان effect record start-json در کنسول انتخاب کنید. انتخاب‌گر ضبط هنوز آماده نیست.`),[d,f]=(0,B.useState)(r??null),[p,m]=(0,B.useState)(r?`ready`:`loading`),[h,y]=(0,B.useState)(``),[b,x]=(0,B.useState)(``),[ee,te]=(0,B.useState)(``),[S,ne]=(0,B.useState)(0),[C,w]=(0,B.useState)(``),[ae,oe]=(0,B.useState)(`Web`),[E,D]=(0,B.useState)(`green`),[O,se]=(0,B.useState)(`auto`),[ce,A]=(0,B.useState)(``),[j,M]=(0,B.useState)(null),ue=(0,B.useRef)(r?.latest_event_id??0),fe=(0,B.useCallback)(async(e=!1)=>{e||y(`controller.macro.snapshot`);try{let e=(await a(`controller.snapshot`)).macros;return f(e),m(`ready`),x(``),ue.current=Math.max(ue.current,e.latest_event_id||0),e}catch(e){return m(`error`),x(e instanceof Error?e.message:String(e)),null}finally{e||y(``)}},[t]);(0,B.useEffect)(()=>{fe()},[fe]),(0,B.useEffect)(()=>{let e=n.filter(e=>e.id>ue.current).sort((e,t)=>e.id-t.id);if(!e.length||(ue.current=e[e.length-1].id,f(t=>e.reduce((e,t)=>e&&g(e,t),t)),!e.some(re)))return;let t=window.setTimeout(()=>{fe(!0)},60);return()=>window.clearTimeout(t)},[n,fe]);let N=(0,B.useMemo)(()=>d?.library.find(e=>String(e.id)===ee),[ee,d?.library]),pe=(0,B.useMemo)(()=>o.find(e=>e.id===ce),[ce,o]);(0,B.useEffect)(()=>{if(!d)return;!ee&&d.library.length&&te(String(d.library[0].id));let e=new Set(d.library.map(e=>e.id)),t=0;for(;t<255&&e.has(t);)t+=1;ne(n=>e.has(n)?t:n)},[ee,d]),(0,B.useEffect)(()=>{N&&(w(N.name),oe(N.category||``),D(hn(N.color)))},[N?.category,N?.color,N?.id,N?.name]),(0,B.useEffect)(()=>{!ce&&o.length&&A(o[0].id)},[ce,o]),(0,B.useEffect)(()=>{pe&&M({...pe})},[pe]);let me=e=>te(String(e.id)),P=async(e,t,n)=>{y(e),x(``);try{await s(n),await fe(!0)}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(``)}},ge=ee||C.trim(),F=d?.recording,I=d?.playback,_e=n.slice(0,7);return(0,X.jsxs)(`div`,{className:`macro-library`,children:[(0,X.jsxs)(`div`,{className:`macro-library__monitor`,"aria-live":`polite`,children:[(0,X.jsxs)(`div`,{className:F?.active?`is-active`:``,children:[(0,X.jsx)(Ne,{"aria-hidden":`true`,size:17}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:l(`RECORDING`,`ضبط`)}),(0,X.jsx)(`strong`,{children:F?.active?F.name||`#${F.id}`:l(`Idle`,`آماده`)}),(0,X.jsx)(`em`,{children:F?.active?`${F.device_retained?l(`Device-retained take`,`برداشت نگه‌داری‌شده در دستگاه`):l(`Live capture`,`ضبط زنده`)} · ${F.steps} ${l(`steps`,`گام`)} · Δ ${_n(F.last_delta_us,t)}`:F?.name||``})]})]}),(0,X.jsxs)(`div`,{className:I?.running?`is-active`:``,children:[(0,X.jsx)(at,{"aria-hidden":`true`,size:17}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`small`,{children:l(`PLAYBACK`,`اجرا`)}),(0,X.jsx)(`strong`,{children:I?.name||l(`Idle`,`آماده`)}),(0,X.jsx)(`em`,{children:I?.name?`${I.lifecycle||`idle`} · ${I.policy||`auto`} → ${I.mode||`pending`} · ${I.step}/${I.step_count} · Δ ${_n(I.last_timing_delta_us,t)}`:l(`No playback in this session`,`هنوز اجرایی در این نشست انجام نشده`)})]})]}),(0,X.jsx)(ie,{tone:p===`error`?`warn`:p===`ready`?`good`:`info`,children:p===`error`?l(`UNAVAILABLE`,`در دسترس نیست`):p===`ready`?l(`LIVE`,`زنده`):l(`LOADING`,`در حال بارگذاری`)})]}),b&&(0,X.jsx)(`div`,{className:`macro-library__error`,role:`alert`,children:b}),F?.last_error&&(0,X.jsx)(`div`,{className:`macro-library__error`,role:`alert`,children:F.last_error}),!!F?.overwritten&&(0,X.jsx)(`div`,{className:`macro-library__error`,role:`status`,children:l(`Ring wrapped: ${F.overwritten} earlier snapshots overwritten. Saved profile contains the retained tail.`,`حافظه حلقوی پر شد: ${F.overwritten} وضعیت پیشین جایگزین شد. پروفایل شامل بخش پایانی باقی‌مانده است.`)}),(0,X.jsxs)(`div`,{className:`macro-library__workspace`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Le,{size:15}),` `,l(`Library`,`کتابخانه`)]}),(0,X.jsx)(`small`,{children:d?.library.length??0})]}),(0,X.jsx)(vn,{macros:d?.library??[],selectedReference:ee,locale:t,onSelect:me})]}),(0,X.jsxs)(`section`,{className:`macro-library__editor`,children:[(0,X.jsx)(`header`,{children:(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Je,{size:15}),` `,N?l(`Selected timed effect`,`جلوهٔ زمان‌بندی‌شدهٔ انتخابی`):l(`New timed effect`,`جلوهٔ زمان‌بندی‌شدهٔ جدید`)]})}),(0,X.jsxs)(`div`,{className:`macro-library__fields`,children:[(0,X.jsx)(T,{label:l(`ID 0..255`,`شناسه ۰ تا ۲۵۵`),type:`number`,min:0,max:255,value:N?N.id:S,disabled:!!N,onChange:e=>ne(Math.max(0,Math.min(255,Number(e.target.value)||0)))}),(0,X.jsx)(T,{label:l(`Name`,`نام`),value:C,maxLength:64,onChange:e=>w(e.target.value)}),(0,X.jsx)(T,{label:l(`Category`,`دسته‌بندی`),value:ae,maxLength:64,onChange:e=>oe(e.target.value)})]}),(0,X.jsxs)(`div`,{className:`macro-library__color-picker`,children:[(0,X.jsx)(`label`,{children:l(`Color`,`رنگ`)}),(0,X.jsx)(_,{value:E,label:l(`Effect color`,`رنگ جلوه`),options:[{value:`red`,label:l(`Red`,`قرمز`)},{value:`blue`,label:l(`Blue`,`آبی`)},{value:`violet`,label:l(`Violet`,`بنفش`)},{value:`green`,label:l(`Green`,`سبز`)},{value:`white`,label:l(`White`,`سفید`)},{value:E.startsWith(`#`)?E:`#38D27A`,label:l(`Custom`,`سفارشی`)}],onChange:D}),E.startsWith(`#`)&&(0,X.jsx)(`input`,{type:`color`,"aria-label":l(`Custom color`,`رنگ سفارشی`),value:E,onChange:e=>D(e.target.value.toUpperCase())})]}),(0,X.jsxs)(`div`,{className:`macro-library__actions`,children:[!N&&(0,X.jsx)(i,{icon:k,disabled:!C.trim(),busy:h===`controller.macro.create`,onClick:()=>void P(`controller.macro.create`,{id:S,name:C.trim(),category:ae.trim(),color:E},`effect create sequence ${S} ${v(C.trim())} ${v(ae.trim())} ${v(E)}`),children:l(`Create draft`,`ساخت پیش‌نویس`)}),N&&(0,X.jsx)(i,{icon:de,disabled:!C.trim(),busy:h===`controller.macro.update`,onClick:()=>void P(`controller.macro.update`,{reference:ge,name:C.trim(),category:ae.trim(),color:E},`effect update ${v(ge)} ${v(C.trim())} ${v(ae.trim())} ${v(E)}`),children:l(`Save metadata`,`ذخیره مشخصات`)}),N&&(0,X.jsx)(i,{tone:`danger`,icon:le,busy:h===`controller.macro.delete`,onClick:()=>void P(`controller.effect.delete`,{reference:ge},`effect delete ${v(ge)}`),children:l(`Delete`,`حذف`)}),N&&(0,X.jsx)(i,{tone:`ghost`,onClick:()=>{te(``),w(``),oe(`Web`),D(`green`)},children:l(`New`,`جدید`)})]})]})]}),(0,X.jsxs)(`section`,{className:`macro-library__strip-effects`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(he,{size:15}),` `,l(`Lighting effects`,`جلوه‌های نورپردازی`)]}),(0,X.jsx)(`small`,{children:o.length})]}),(0,X.jsxs)(`div`,{className:`macro-library__workspace`,children:[(0,X.jsxs)(`div`,{className:`macro-library__catalog`,role:`listbox`,"aria-label":l(`Lighting effects`,`جلوه‌های نورپردازی`),children:[o.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.id===ce,className:e.id===ce?`is-selected`:``,onClick:()=>A(e.id),children:[(0,X.jsx)(`span`,{className:`macro-library__color is-violet`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`macro-library__identity`,children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsxs)(`small`,{children:[e.category||l(`Uncategorized`,`بدون دسته`),` · `,e.engine]})]}),(0,X.jsxs)(`span`,{className:`macro-library__measure`,children:[(0,X.jsx)(`strong`,{children:e.default_fps}),(0,X.jsx)(`small`,{children:`FPS`})]}),(0,X.jsxs)(`span`,{className:`macro-library__measure`,children:[(0,X.jsx)(`strong`,{children:e.default_pixels}),(0,X.jsx)(`small`,{children:l(`LEDs`,`LED`)})]})]},e.id)),!o.length&&(0,X.jsx)(`div`,{className:`macro-library__empty`,children:l(`No lighting effects.`,`جلوهٔ نورپردازی وجود ندارد.`)})]}),(0,X.jsxs)(`div`,{className:`macro-library__editor`,children:[(0,X.jsx)(`header`,{children:(0,X.jsxs)(`span`,{children:[(0,X.jsx)(Je,{size:15}),` `,j?.id?l(`Effect properties`,`ویژگی‌های جلوه`):l(`New lighting effect`,`جلوه نور جدید`)]})}),j&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`macro-library__fields`,children:[(0,X.jsx)(T,{label:l(`Stable ID`,`شناسه پایدار`),value:j.id,disabled:!!pe,onChange:e=>M({...j,id:e.target.value})}),(0,X.jsx)(T,{label:l(`Name`,`نام`),value:j.name,maxLength:64,onChange:e=>M({...j,name:e.target.value})}),(0,X.jsx)(T,{label:l(`Category`,`دسته‌بندی`),value:j.category||``,maxLength:64,onChange:e=>M({...j,category:e.target.value})}),(0,X.jsx)(T,{label:l(`Description`,`توضیح`),value:j.description||``,maxLength:64,onChange:e=>M({...j,description:e.target.value})}),(0,X.jsx)(T,{label:l(`Frames / second`,`فریم در ثانیه`),type:`number`,min:1,max:30,value:j.default_fps,onChange:e=>M({...j,default_fps:Number(e.target.value)})}),(0,X.jsx)(T,{label:l(`Duration (ms)`,`مدت (میلی‌ثانیه)`),type:`number`,min:100,max:36e5,value:j.default_duration_ms,onChange:e=>M({...j,default_duration_ms:Number(e.target.value)})}),(0,X.jsx)(T,{label:l(`LED count`,`تعداد LED`),type:`number`,min:1,max:100,value:j.default_pixels,onChange:e=>M({...j,default_pixels:Number(e.target.value)})})]}),(0,X.jsx)(_,{value:j.program.primitive,label:l(`Program`,`برنامه`),options:[{value:`alternating-zones`,label:l(`Alternating zones`,`ناحیه‌های متناوب`)},{value:`envelope`,label:l(`Brightness envelope`,`پوش شدت نور`)},{value:`converging-points`,label:l(`Converging points`,`نقاط همگرا`)}],onChange:e=>M({...j,program:{...j.program,primitive:e}})}),(0,X.jsxs)(`div`,{className:`macro-library__actions`,children:[(0,X.jsx)(i,{tone:`primary`,icon:at,disabled:!e||!pe,onClick:()=>void P(`controller.effect.play`,{},`effect play ${v(j.id)}`),children:l(`Run`,`اجرا`)}),pe?(0,X.jsx)(i,{icon:de,disabled:!j.name.trim(),onClick:()=>void P(`controller.effect.update`,{},`effect update ${v(j.id)} ${v(j.name.trim())} ${v((j.category||``).trim())} ${v((j.description||``).trim()||`-`)} ${v(j.program.primitive)} ${j.default_fps} ${j.default_duration_ms} ${j.default_pixels}`),children:l(`Save to PCController`,`ذخیره در PCController`)}):(0,X.jsx)(i,{icon:k,disabled:!j.id.trim()||!j.name.trim(),onClick:()=>void P(`controller.effect.create`,{},`effect create strip ${v(j.id.trim())} ${v(j.name.trim())} ${v(j.program.primitive)} ${v((j.category||``).trim())} ${j.default_fps} ${j.default_duration_ms} ${j.default_pixels}`),children:l(`Create in PCController`,`ساخت در PCController`)}),pe&&(0,X.jsx)(i,{tone:`danger`,icon:le,onClick:()=>void P(`controller.effect.delete`,{},`effect delete ${v(j.id)}`),children:l(`Delete`,`حذف`)}),(0,X.jsx)(i,{tone:`ghost`,onClick:()=>{A(``),M({id:``,name:``,category:`Lighting`,description:``,program:{primitive:`alternating-zones`,primary:{red:255,green:0,blue:0},secondary:{red:0,green:0,blue:255},period_ms:800,step_ms:100,swap_after_steps:4,dim_intensity:36},engine:`host-stream`,editable:!0,default_fps:20,default_duration_ms:5e3,default_pixels:100,min_pixels:1,max_pixels:100,min_fps:1,max_fps:30})},children:l(`New`,`جدید`)})]})]})]})]})]}),N&&(N.steps?.length??0)>0&&(0,X.jsxs)(`details`,{className:`macro-library__steps`,children:[(0,X.jsxs)(`summary`,{children:[l(`Exact step timing`,`زمان‌بندی دقیق گام‌ها`),` · `,N.steps?.length??0]}),(0,X.jsx)(`div`,{role:`table`,children:(N.steps??[]).map((e,n,r)=>{let i=n?r[n-1].at_us??0:0,a=e.at_us??0;return(0,X.jsxs)(`div`,{role:`row`,children:[(0,X.jsxs)(`span`,{children:[`#`,n+1]}),(0,X.jsx)(`strong`,{children:e.kind}),(0,X.jsx)(`span`,{children:_n(a,t)}),(0,X.jsxs)(`span`,{children:[`Δ `,_n(a-i,t)]}),(0,X.jsx)(`code`,{children:e.text||`target=${e.target??0} value=${e.value??0}`})]},`${n}-${a}-${e.kind}`)})})]}),(0,X.jsxs)(`div`,{className:`macro-library__control-grid`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`header`,{children:l(`Host recording`,`ضبط میزبان`)}),(0,X.jsx)(`p`,{role:`status`,children:u}),(0,X.jsxs)(`div`,{className:`macro-library__actions`,children:[(0,X.jsx)(i,{tone:`primary`,icon:Ne,disabled:!0,title:u,"data-capture-selection":`unavailable`,children:l(`Start`,`شروع`)}),(0,X.jsx)(i,{icon:de,disabled:!F?.active||!!F.device_retained,busy:h===`controller.macro.record.stop`,onClick:()=>void P(`controller.macro.record.stop`,{save:!0},`effect record save`),children:l(`Stop + save`,`توقف و ذخیره`)}),(0,X.jsx)(i,{icon:le,disabled:!F?.active||!!F.device_retained,onClick:()=>void P(`controller.macro.record.stop`,{save:!1},`effect record discard`),children:l(`Discard`,`دور انداختن`)})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`header`,{children:l(`Device-retained recording`,`ضبط نگه‌داری‌شده در دستگاه`)}),(0,X.jsx)(`p`,{children:l(`Keeps the latest 25 relay snapshots in RAM. Save before resetting the board. Stop and release retained RAM before strip streaming.`,`۲۵ وضعیت آخر رله در حافظه نگهداری می‌شود. پیش از ریست ذخیره کنید. قبل از پخش نوار، ضبط را متوقف و حافظه را آزاد کنید.`)}),(0,X.jsxs)(`div`,{className:`macro-library__actions`,children:[(0,X.jsx)(i,{icon:lt,disabled:!0,title:u,"data-capture-selection":`unavailable`,children:l(`Start retained take`,`شروع برداشت نگه‌داری‌شده`)}),(0,X.jsx)(i,{icon:Le,disabled:!0,title:u,"data-capture-selection":`unavailable`,children:l(`Import retained capture`,`وارد کردن ضبط باقی‌مانده`)}),(0,X.jsx)(i,{icon:de,disabled:!F?.active||!F.device_retained,busy:h===`controller.macro.board_record.stop`,onClick:()=>void P(`controller.macro.board_record.stop`,{},`effect record save`),children:l(`Stop + import`,`توقف و واردکردن`)}),(0,X.jsx)(i,{tone:`danger`,icon:le,disabled:!F?.active||!F.device_retained,onClick:()=>void P(`controller.macro.board_record.discard`,{},`effect record discard`),children:l(`Discard`,`دور انداختن`)}),(0,X.jsx)(i,{icon:le,disabled:!e||!!F?.active||!!I?.running,onClick:()=>void P(`controller.macro.buffer.clear`,{},`effect buffer clear`),children:l(`Release board RAM for strip`,`آزاد کردن حافظه برد برای نوار`)})]})]})]}),(0,X.jsxs)(`div`,{className:`macro-library__playback-actions`,children:[(0,X.jsx)(_,{value:O,label:l(`Execution`,`اجرا`),options:[{value:`auto`,label:l(`Automatic`,`خودکار`)},{value:`host`,label:l(`Host (forced)`,`میزبان (اجباری)`)},{value:`mcu`,label:l(`Device (forced)`,`دستگاه (اجباری)`)}],onChange:se}),(0,X.jsx)(i,{tone:`primary`,icon:at,disabled:!e||!ge,busy:h===`controller.macro.play`,onClick:()=>void P(`controller.effect.play`,{reference:ge},`effect play ${v(ge)} ${O}`),children:l(`Play selected`,`اجرای انتخاب‌شده`)}),(0,X.jsx)(i,{icon:Fe,disabled:!e||!I?.running,busy:h===`controller.macro.cancel`,onClick:()=>void P(`controller.macro.cancel`,{keep_outputs:!1},`effect cancel`),children:l(`Cancel + turn outputs off`,`لغو و خاموش‌کردن خروجی‌ها`)}),(0,X.jsx)(i,{tone:`danger`,icon:Fe,disabled:!e||!I?.running,onClick:()=>void P(`controller.macro.cancel`,{keep_outputs:!0},`effect cancel keep`),children:l(`Cancel, keep outputs`,`لغو با حفظ خروجی‌ها`)})]}),(0,X.jsxs)(`section`,{className:`macro-library__events`,"aria-label":l(`Live effect monitor`,`پایش زنده جلوه`),children:[(0,X.jsx)(`header`,{children:l(`Live structured monitor`,`پایش زنده ساختاریافته`)}),_e.length?_e.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`time`,{children:new Date(e.time).toLocaleTimeString(t)}),(0,X.jsx)(`strong`,{children:e.kind}),(0,X.jsx)(`span`,{children:e.lifecycle||e.state||e.text}),e.metadata?.delta_us&&(0,X.jsxs)(`code`,{children:[`Δ `,e.metadata.delta_us,` µs`]}),e.metadata?.mcu_delta_us&&(0,X.jsxs)(`code`,{children:[`Δ `,e.metadata.mcu_delta_us,` µs`]})]},e.id)):(0,X.jsx)(`p`,{children:l(`Waiting for effect events.`,`در انتظار رویدادهای جلوه.`)})]})]})}function bn(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e,n=typeof t.name==`string`?t.name.trim():``;if(!n||!Array.isArray(t.notes))return[];let r=t.notes.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e,n=Number(t.frequency_hz),r=Number(t.duration_ms),i=t.gap_ms===void 0?0:Number(t.gap_ms),a=n===0||n>=20&&n<=2e4;return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!a||r<1||r>5e3||i<0||i>5e3?[]:[{frequency_hz:Math.round(n),duration_ms:Math.round(r),gap_ms:Math.round(i)}]});return r.length===t.notes.length?[{name:n,notes:r}]:[]}):[]}function xn(e,t){let n=e.notes.reduce((e,t)=>e+t.duration_ms+(t.gap_ms??0),0);return t===`fa`?`${e.notes.length} نت · ${n} میلی‌ثانیه`:`${e.notes.length} notes · ${n} ms`}function Sn(e){if(!Array.isArray(e))return[];let t=new Set;return e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let n=e,r=typeof n.name==`string`?n.name.trim().toLowerCase():``,i=typeof n.usage==`string`?n.usage.trim():``,a=typeof n.summary==`string`?n.summary.trim():``,o=typeof n.group==`string`?n.group.trim():``;if(!r||!i||!a||!o||t.has(r))return[];let s=Array.isArray(n.aliases)?[...new Set(n.aliases.flatMap(e=>typeof e==`string`&&e.trim()?[e.trim().toLowerCase()]:[]))]:[];return t.add(r),[{name:r,aliases:s,usage:i,summary:a,group:o}]})}function Cn(e){let t=new Set,n=[];for(let r of e.usage.match(/[A-Za-z][A-Za-z0-9_-]*/g)??[]){let i=r.toLowerCase();r!==i||i===e.name||t.has(i)||(t.add(i),n.push(i))}return n}function wn(e,t,n=10){let r=e.match(/^\s*/)?.[0]??``,i=e.slice(r.length);if(!i)return[];let a=i.search(/\s/);if(a<0){let e=i.toLowerCase();return t.filter(t=>[t.name,...t.aliases??[]].some(t=>t.toLowerCase().startsWith(e))).slice(0,n).map(e=>({value:`${r}${e.name} `,label:e.name,detail:`${e.usage} — ${e.summary}`}))}let o=i.slice(0,a).toLowerCase(),s=t.find(e=>[e.name,...e.aliases??[]].some(e=>e.toLowerCase()===o));if(!s)return[];let c=Math.max(e.lastIndexOf(` `),e.lastIndexOf(` `))+1,l=e.slice(c).toLowerCase();return Cn(s).filter(e=>e.startsWith(l)&&e!==l).slice(0,n).map(t=>({value:`${e.slice(0,c)}${t} `,label:t,detail:s.usage}))}var Tn=class{limit;entries=[];cursor=0;draft=``;constructor(e=100){this.limit=e}record(e){let t=e.trim();t&&this.entries[this.entries.length-1]!==t&&(this.entries.push(t),this.entries.length>this.limit&&this.entries.splice(0,this.entries.length-this.limit)),this.cursor=this.entries.length,this.draft=``}edited(e){this.cursor=this.entries.length,this.draft=e}move(e,t){return this.entries.length?(this.cursor===this.entries.length&&(this.draft=t),this.cursor=Math.max(0,Math.min(this.entries.length,this.cursor+e)),this.cursor===this.entries.length?this.draft:this.entries[this.cursor]):t}values(){return[...this.entries]}},En=0,Dn=[`terminal`,`displays`,`status-lighting`,`audio`,`radio`,`macros`,`automations`,`i2c`,`host-control`,`firmware`];function On(e,t=`log`,n){return{id:n??`terminal-${++En}`,kind:`text`,text:e,level:t}}function Q({tokens:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsx)(`span`,{className:`console-token console-token--${e.kind===`value`?e.valueType:`text`}`,style:e.style,children:e.text},`${t}-${e.text}`))})}function kn({entry:e,locale:t}){if(e.hidden)return null;let n={"--console-indent":`${e.depth*16}px`};return e.kind===`table`?(0,X.jsxs)(`div`,{className:`console-record console-record--table`,style:n,"data-level":`log`,children:[(0,X.jsxs)(`table`,{children:[(0,X.jsx)(`thead`,{children:(0,X.jsx)(`tr`,{children:e.columns.map(e=>(0,X.jsx)(`th`,{children:e},e))})}),(0,X.jsx)(`tbody`,{children:e.rows.map(t=>(0,X.jsx)(`tr`,{children:e.columns.map(e=>(0,X.jsx)(`td`,{children:(0,X.jsx)(Q,{tokens:t.cells[e]??[]})},e))},t.key))})]}),(e.omittedRows>0||e.omittedColumns>0)&&(0,X.jsx)(`small`,{children:t===`fa`?`${e.omittedRows} ردیف و ${e.omittedColumns} ستون نمایش داده نشد`:`${e.omittedRows} rows and ${e.omittedColumns} columns omitted`})]}):(0,X.jsxs)(`div`,{className:`console-record console-record--${e.kind}`,style:n,"data-level":e.level,children:[e.kind===`group`&&(0,X.jsx)(`span`,{className:`console-group-mark`,children:e.collapsed?`▸`:`▾`}),(0,X.jsx)(Q,{tokens:e.tokens})]})}function An(e){if(e.kind===`table`){console.table(e.rows.map(t=>Object.fromEntries(e.columns.map(e=>[e,Ut(t.cells[e]??[])]))));return}if(e.kind===`group`){console[e.collapsed?`groupCollapsed`:`group`](...Gt(e.tokens));return}let t=e.level===`error`?`error`:e.level===`warn`?`warn`:e.level===`debug`?`debug`:e.level===`info`?`info`:`log`;console[t](...Gt(e.tokens))}function jn(e){return e.kind===`table`?`console.table: ${e.rows.length} rows × ${e.columns.length} columns`:Ut(e.tokens)}function Mn(e){let{events:r,locale:l,t:f,command:g,snapshot:b,transport:x,relayedTerminal:ee}=e,re=l===`fa`,w=(e,t)=>re?t:e,[E,O]=(0,B.useState)(``),[se,k]=(0,B.useState)([]),[A,le]=(0,B.useState)(!1),[M,ue]=(0,B.useState)(``),[de,N]=(0,B.useState)([]),[pe,he]=(0,B.useState)(!1),[xe,Ee]=(0,B.useState)(0),[L,De]=(0,B.useState)(`both`),[Oe,ke]=(0,B.useState)(220),[Ae,Me]=(0,B.useState)(5e3),[Ne,Pe]=(0,B.useState)(`once`),[Ie,Le]=(0,B.useState)(3e4),[Re,ze]=(0,B.useState)(!1),[Be,He]=(0,B.useState)(`READY`),[Ue,We]=(0,B.useState)(880),[Ge,R]=(0,B.useState)(120),[Ke,qe]=(0,B.useState)(``),[Je,Ye]=(0,B.useState)([]),[Xe,z]=(0,B.useState)(`loading`),[Qe,et]=(0,B.useState)(38),[nt,rt]=(0,B.useState)(210),[it,ot]=(0,B.useState)(220),[st,ct]=(0,B.useState)(180),[lt,ut]=(0,B.useState)(``),[ft,pt]=(0,B.useState)(60),[mt,ht]=(0,B.useState)(!1),[gt,vt]=(0,B.useState)(()=>I(`workbench`,Dn)),[bt,xt]=(0,B.useState)(null),V=(0,B.useRef)(null),H=(0,B.useRef)(r.reduce((e,t)=>Math.max(e,t.id),0)),St=(0,B.useRef)(new Set),Ct=(0,B.useRef)(new $t({maxEntries:240})),U=(0,B.useRef)(new Tn),wt=L===`segments`?40:32,Tt=Be.length>0&&Be.length<=wt&&/^[\x20-\x7e]*$/.test(Be),W=te(b),Dt=!!b.front_panel?.tm1637_detection_known,Ot=!!b.front_panel?.tm1637_detected,G=x.boardState===`ready`&&b.connected&&b.have_status,kt=m(b),K=wn(E,de),At=Math.min(xe,Math.max(0,K.length-1)),jt=[{value:`segments`,label:w(`Segments`,`سون‌سگمنت`)},...W.lcd?[{value:`lcd`,label:`LCD`},{value:`both`,label:w(`Both`,`هر دو`)}]:[]];(0,B.useEffect)(()=>{!W.lcd&&L!==`segments`&&De(`segments`)},[W.lcd,L]),(0,B.useEffect)(()=>{let e=new AbortController;return N([]),a(`controller.command.catalog`,{},e.signal).then(t=>{e.signal.aborted||N(Sn(t))}).catch(()=>{e.signal.aborted||N([])}),()=>e.abort()},[x.authenticationRequired,x.streamState]),(0,B.useEffect)(()=>{let e=new AbortController;return z(`loading`),a(`controller.melodies.list`,{},e.signal).then(t=>{if(e.signal.aborted)return;let n=bn(t);Ye(n),qe(e=>n.some(t=>t.name===e)?e:``),z(`ready`)}).catch(()=>{e.signal.aborted||(Ye([]),qe(``),z(`error`))}),()=>e.abort()},[x.authenticationRequired,x.streamState]),(0,B.useEffect)(()=>{let e=r.filter(e=>e.id>H.current).sort((e,t)=>e.id-t.id);if(!e.length)return;H.current=Math.max(H.current,...e.map(e=>e.id));let t=e.flatMap(e=>[On(`[${oe(l,e.time)}] event/${e.source||`host`} ${e.kind}`,/error|fault|hot/i.test(e.kind)?`error`:/warn|door|disconnect/i.test(e.kind)?`warn`:`info`),On(e.text)]);k(e=>[...e,...t].slice(-120))},[r,l]),(0,B.useEffect)(()=>{let e=ee.filter(e=>!St.current.has(e.id));if(!e.length)return;for(let t of e)St.current.add(t.id);let t=e.map(e=>On(`[tab/${e.tabId.slice(0,7)}] ${e.kind===`error`?`!`:e.kind===`command`?`pc›`:`↳`} ${e.text.replace(/^pc›\s*/,``)}`,e.kind===`error`?`error`:e.kind===`system`?`info`:`log`,`tab-${e.id}`));k(e=>[...e,...t].slice(-120))},[ee]);let q=async t=>{let n=t.trim();if(!n)return``;if(/^console\s*\./i.test(n)){let t=Et(n),r=Ct.current.dispatch(t??n);if(r.cleared)console.clear(),k([]);else if(r.emitted.length){let t=r.emitted.map(e=>({id:`console-${e.id}`,kind:`console`,entry:e}));k(e=>[...e,...t].slice(-120));for(let t of r.emitted)An(t),e.broadcastTerminal({kind:t.level===`error`?`error`:`system`,text:jn(t),at:t.timestamp})}return t?.method===`groupEnd`&&console.groupEnd(),r.emitted.map(jn).join(` diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-F-tPTz9z.js b/Tools/Controller/internal/webui/dist/assets/chunk-B3YpOg3Z.js similarity index 99% rename from Tools/Controller/internal/webui/dist/assets/chunk-F-tPTz9z.js rename to Tools/Controller/internal/webui/dist/assets/chunk-B3YpOg3Z.js index 23ce0d75..a28de9cb 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-F-tPTz9z.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-B3YpOg3Z.js @@ -1,3 +1,3 @@ -import{At as e,Dt as t,It as n,Pt as r,dt as i,ft as a,kt as o,vt as s,zt as c}from"./app-DHmIY1mo.js";import{t as ee}from"./chunk-Bi9TV8AN.js";import{a as te,i as ne,r as re}from"./chunk-CWMYvVMg.js";var l={name:`arrow-down-a-z`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]],aliases:[`arrow-down-az`]};l.node;var ie=r(l),u={name:`arrow-up-a-z`,size:24,node:[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]],aliases:[`arrow-up-az`]};u.node;var ae=r(u),oe={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};oe.node;var se=r(oe),d={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};d.node;var ce=r(d),le={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};le.node;var ue=r(le),f=c(n(),1),de=88,fe=520,pe=8,me=500;function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return e===null?`null`:e===void 0?`Not set`:typeof e==`string`?e:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?Number.isNaN(e)?`NaN`:e===1/0?`+Infinity`:e===-1/0?`-Infinity`:Object.is(e,-0)?`-0`:e.toString():typeof e==`bigint`?`${e.toString()}n`:typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol`:typeof e==`function`?e.name?`Function(${e.name})`:`Function`:null}function h(e){try{return Object.keys(e)}catch{return null}}function g(e,t){try{return Reflect.get(e,t)}catch{return`[unreadable]`}}function _(e){let t=m(e);if(t!==null)return t;if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?e.toISOString():`Invalid date`}if(Array.isArray(e))return`Array · ${e.length} item${e.length===1?``:`s`}`;if(p(e)){let t=h(e);return t===null?`Unreadable object`:`Object · ${t.length} field${t.length===1?``:`s`}`}return`Unsupported value`}function v(e,t,n,r){let i=m(e);if(i!==null)return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)?e:i;if(e instanceof Date)return _(e);if(typeof e!=`object`||!e)return`Unsupported value`;if(t.has(e))return`[circular]`;if(n>=pe)return`[depth limit]`;if(r.remaining<=0)return`[entry limit]`;let a=new Set(t);if(a.add(e),Array.isArray(e)){let t=[];for(let i of e){if(r.remaining<=0){t.push(`[entry limit]`);break}--r.remaining,t.push(v(i,a,n+1,r))}return t}let o=h(e);if(o===null)return`[unreadable object]`;let s=Object.create(null);for(let t of o){if(r.remaining<=0){s[`…`]=`[entry limit]`;break}--r.remaining,s[t]=v(g(e,t),a,n+1,r)}return s}function y(e){return v(e,new Set,0,{remaining:me})}function b(e,t=!1){let n=y(e);try{return JSON.stringify(n,null,t?2:0)??`null`}catch{return`"[unserializable]"`}}function x(e){let t=m(e);return t===null?b(e):t}function S(e,t){try{if(e.get)return e.get(t);if(p(t))return g(t,e.id)}catch{return`[unreadable]`}}function C(e){return/metadata|details|message|description|reason|title/i.test(e)?260:/time|date|updated|created/i.test(e)?190:156}function he(e,t){return Number.isFinite(e)?Math.min(fe,Math.max(de,Math.round(e))):C(t)}function ge(e,t=[]){let n=new Set;for(let t of e){if(!p(t))continue;let e=h(t);if(e!==null)for(let t of e)n.add(t)}return[...t.filter(e=>n.delete(e)),...n].map(e=>({id:e,label:e.replaceAll(`_`,` `)}))}function w(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=new Set;for(let t of e){let e=n.get(t.id);r.push({...t,...e??{},id:t.id,label:e?.label?.trim()||t.label,visible:t.visible,width:t.width,sortable:e?.sortable??t.sortable}),i.add(t.id)}for(let e of t)e.id&&!i.has(e.id)&&(r.push({...e,label:e.label?.trim()||e.id.replaceAll(`_`,` `),visible:e.visible!==!1,width:he(e.width,e.id),sortable:e.sortable!==!1}),i.add(e.id));return r}function _e(e,t,n){return e===t?0:e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?Number.isNaN(e)?+!Number.isNaN(t):Number.isNaN(t)?-1:e-t:typeof e==`boolean`&&typeof t==`boolean`?Number(e)-Number(t):n.compare(x(e),x(t))}function ve(e,t,n,r){if(n===null)return[...e];let i=t.find(e=>e.id===n.field);if(!i||i.sortable===!1)return[...e];let a=new Intl.Collator(r,{numeric:!0,sensitivity:`base`}),o=n.direction===`asc`?1:-1;return e.map((e,t)=>({entry:e,stableIndex:t})).sort((e,t)=>{let n=_e(S(i,e.entry.row),S(i,t.entry.row),a);return n===0?e.stableIndex-t.stableIndex:n*o}).map(({entry:e})=>e)}function ye(e,t,n,r){let i=n.trim().toLocaleLowerCase(r);return i?e.filter(({row:e})=>t.some(t=>x(S(t,e)).toLocaleLowerCase(r).includes(i))):[...e]}function T(e){if(e==null)return``;let t=m(e);return t===null?b(e):t}function E(e){return/[",\r\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e}function be(e,t){return[t.map(e=>E(e.id)).join(`,`),...e.map(e=>t.map(t=>E(T(S(t,e)))).join(`,`))].join(`\r +import{At as e,Dt as t,It as n,Pt as r,dt as i,ft as a,kt as o,vt as s,zt as c}from"./app-DeBWQZ2a.js";import{t as ee}from"./chunk-BVsUkuBT.js";import{a as te,i as ne,r as re}from"./chunk-CWQLWOOn.js";var l={name:`arrow-down-a-z`,size:24,node:[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]],aliases:[`arrow-down-az`]};l.node;var ie=r(l),u={name:`arrow-up-a-z`,size:24,node:[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]],aliases:[`arrow-up-az`]};u.node;var ae=r(u),oe={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};oe.node;var se=r(oe),d={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};d.node;var ce=r(d),le={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};le.node;var ue=r(le),f=c(n(),1),de=88,fe=520,pe=8,me=500;function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return e===null?`null`:e===void 0?`Not set`:typeof e==`string`?e:typeof e==`boolean`?e?`true`:`false`:typeof e==`number`?Number.isNaN(e)?`NaN`:e===1/0?`+Infinity`:e===-1/0?`-Infinity`:Object.is(e,-0)?`-0`:e.toString():typeof e==`bigint`?`${e.toString()}n`:typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol`:typeof e==`function`?e.name?`Function(${e.name})`:`Function`:null}function h(e){try{return Object.keys(e)}catch{return null}}function g(e,t){try{return Reflect.get(e,t)}catch{return`[unreadable]`}}function _(e){let t=m(e);if(t!==null)return t;if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?e.toISOString():`Invalid date`}if(Array.isArray(e))return`Array · ${e.length} item${e.length===1?``:`s`}`;if(p(e)){let t=h(e);return t===null?`Unreadable object`:`Object · ${t.length} field${t.length===1?``:`s`}`}return`Unsupported value`}function v(e,t,n,r){let i=m(e);if(i!==null)return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)?e:i;if(e instanceof Date)return _(e);if(typeof e!=`object`||!e)return`Unsupported value`;if(t.has(e))return`[circular]`;if(n>=pe)return`[depth limit]`;if(r.remaining<=0)return`[entry limit]`;let a=new Set(t);if(a.add(e),Array.isArray(e)){let t=[];for(let i of e){if(r.remaining<=0){t.push(`[entry limit]`);break}--r.remaining,t.push(v(i,a,n+1,r))}return t}let o=h(e);if(o===null)return`[unreadable object]`;let s=Object.create(null);for(let t of o){if(r.remaining<=0){s[`…`]=`[entry limit]`;break}--r.remaining,s[t]=v(g(e,t),a,n+1,r)}return s}function y(e){return v(e,new Set,0,{remaining:me})}function b(e,t=!1){let n=y(e);try{return JSON.stringify(n,null,t?2:0)??`null`}catch{return`"[unserializable]"`}}function x(e){let t=m(e);return t===null?b(e):t}function S(e,t){try{if(e.get)return e.get(t);if(p(t))return g(t,e.id)}catch{return`[unreadable]`}}function C(e){return/metadata|details|message|description|reason|title/i.test(e)?260:/time|date|updated|created/i.test(e)?190:156}function he(e,t){return Number.isFinite(e)?Math.min(fe,Math.max(de,Math.round(e))):C(t)}function ge(e,t=[]){let n=new Set;for(let t of e){if(!p(t))continue;let e=h(t);if(e!==null)for(let t of e)n.add(t)}return[...t.filter(e=>n.delete(e)),...n].map(e=>({id:e,label:e.replaceAll(`_`,` `)}))}function w(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=new Set;for(let t of e){let e=n.get(t.id);r.push({...t,...e??{},id:t.id,label:e?.label?.trim()||t.label,visible:t.visible,width:t.width,sortable:e?.sortable??t.sortable}),i.add(t.id)}for(let e of t)e.id&&!i.has(e.id)&&(r.push({...e,label:e.label?.trim()||e.id.replaceAll(`_`,` `),visible:e.visible!==!1,width:he(e.width,e.id),sortable:e.sortable!==!1}),i.add(e.id));return r}function _e(e,t,n){return e===t?0:e==null?1:t==null?-1:typeof e==`number`&&typeof t==`number`?Number.isNaN(e)?+!Number.isNaN(t):Number.isNaN(t)?-1:e-t:typeof e==`boolean`&&typeof t==`boolean`?Number(e)-Number(t):n.compare(x(e),x(t))}function ve(e,t,n,r){if(n===null)return[...e];let i=t.find(e=>e.id===n.field);if(!i||i.sortable===!1)return[...e];let a=new Intl.Collator(r,{numeric:!0,sensitivity:`base`}),o=n.direction===`asc`?1:-1;return e.map((e,t)=>({entry:e,stableIndex:t})).sort((e,t)=>{let n=_e(S(i,e.entry.row),S(i,t.entry.row),a);return n===0?e.stableIndex-t.stableIndex:n*o}).map(({entry:e})=>e)}function ye(e,t,n,r){let i=n.trim().toLocaleLowerCase(r);return i?e.filter(({row:e})=>t.some(t=>x(S(t,e)).toLocaleLowerCase(r).includes(i))):[...e]}function T(e){if(e==null)return``;let t=m(e);return t===null?b(e):t}function E(e){return/[",\r\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e}function be(e,t){return[t.map(e=>E(e.id)).join(`,`),...e.map(e=>t.map(t=>E(T(S(t,e)))).join(`,`))].join(`\r `)}function xe(e){return b(e,!0)}function Se(e,t,n){return Math.max(0,e+n-t)}function Ce(e,t,n){return Math.max(0,Math.min(e,Math.max(0,t-n)))}function we(e){return e.key===`ContextMenu`||e.key===`Apps`||e.key===`F10`&&e.shiftKey}function Te(e,t,n,r,i,a=!1){let o=Math.max(0,r-1),s=Math.max(0,n-1);if(a&&t===`Home`)return{area:`header`,field:0,row:0};if(a&&t===`End`&&n>0)return{area:`row`,field:o,row:s};if(t===`Home`)return{...e,field:0};if(t===`End`)return{...e,field:o};if(t===`ArrowLeft`||t===`ArrowRight`){let n=t===`ArrowRight`?1:-1,r=i===`rtl`?-n:n;return{...e,field:Math.max(0,Math.min(o,e.field+r))}}if(t===`ArrowDown`)return n===0?e:e.area===`header`?{area:`row`,field:e.field,row:0}:{...e,row:Math.min(s,e.row+1)};if(t===`ArrowUp`){if(e.area===`row`&&e.row===0)return{area:`header`,field:e.field,row:0};if(e.area===`row`)return{...e,row:Math.max(0,e.row-1)}}return e}function Ee(e){return Math.min(fe,Math.max(de,Math.round(e)))}var D=i(),De={search:`Filter records`,columns:`Columns`,export:`Export`,exportAllJSON:`All · JSON`,exportFilteredJSON:`Filtered · JSON`,exportAllCSV:`All · CSV`,exportFilteredCSV:`Filtered · CSV`,selected:`selected`,clearSelection:`Clear selection`,clearFilter:`Clear filter`,noRecords:`No records are available.`,noMatches:`No records match this filter.`,copyCell:`Copy cell`,copyRow:`Copy row as JSON`,copyColumn:`Copy filtered column`,selectRow:`Select row`,deselectRow:`Deselect row`,sortAscending:`Sort ascending`,sortDescending:`Sort descending`,hideColumn:`Hide column`,showColumn:`Show column`,moveEarlier:`Move earlier`,moveLater:`Move later`,columnActions:`Column actions`,reorderColumn:`Reorder column`,resizeColumn:`Resize column`,previousWindow:`Previous rows`,nextWindow:`Next rows`,showing:`Showing`,of:`of`,copied:`Copied to clipboard`,copyUnavailable:`Clipboard unavailable`,filtered:`filtered`,all:`all`,structuredValue:`Structured value`},Oe={search:`فیلتر رکوردها`,columns:`ستون‌ها`,export:`خروجی`,exportAllJSON:`همه · JSON`,exportFilteredJSON:`فیلترشده · JSON`,exportAllCSV:`همه · CSV`,exportFilteredCSV:`فیلترشده · CSV`,selected:`انتخاب‌شده`,clearSelection:`پاک‌کردن انتخاب`,clearFilter:`پاک‌کردن فیلتر`,noRecords:`رکوردی در دسترس نیست.`,noMatches:`هیچ رکوردی با این فیلتر هم‌خوانی ندارد.`,copyCell:`کپی سلول`,copyRow:`کپی رکورد به‌صورت JSON`,copyColumn:`کپی ستون فیلترشده`,selectRow:`انتخاب ردیف`,deselectRow:`برداشتن انتخاب ردیف`,sortAscending:`مرتب‌سازی صعودی`,sortDescending:`مرتب‌سازی نزولی`,hideColumn:`پنهان‌کردن ستون`,showColumn:`نمایش ستون`,moveEarlier:`انتقال به قبل`,moveLater:`انتقال به بعد`,columnActions:`اقدام‌های ستون`,reorderColumn:`جابجایی ستون`,resizeColumn:`تغییر عرض ستون`,previousWindow:`ردیف‌های قبلی`,nextWindow:`ردیف‌های بعدی`,showing:`نمایش`,of:`از`,copied:`در کلیپ‌بورد کپی شد`,copyUnavailable:`کلیپ‌بورد در دسترس نیست`,filtered:`فیلترشده`,all:`همه`,structuredValue:`مقدار ساخت‌یافته`},ke=[];function O(e){return typeof e==`object`&&!!e}function k(e){return Array.isArray(e)?`Array · ${e.length}`:typeof e==`object`&&e?`Object · ${Object.keys(e).length}`:e===null?`null`:typeof e==`string`?e:typeof e==`number`?e.toString():typeof e==`boolean`?e?`true`:`false`:`Not set`}function A({value:e,depth:t}){if(Array.isArray(e))return e.length?(0,D.jsx)(`ol`,{className:`structured-value__array`,children:e.map((e,n)=>(0,D.jsx)(`li`,{children:(0,D.jsx)(A,{value:e,depth:t+1})},n))}):(0,D.jsx)(`span`,{className:`structured-value__empty`,children:`[]`});if(typeof e==`object`&&e){let n=Object.entries(e);return n.length?(0,D.jsx)(`dl`,{className:`structured-value__object`,children:n.map(([e,n])=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`dt`,{children:e}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(A,{value:n,depth:t+1})})]},e))}):(0,D.jsx)(`span`,{className:`structured-value__empty`,children:`{}`})}return(0,D.jsx)(`span`,{className:`structured-value__scalar`,dir:`auto`,children:k(e)})}function Ae({value:e,label:t}){return O(e)?(0,D.jsxs)(`details`,{className:`structured-value`,children:[(0,D.jsx)(`summary`,{"aria-label":t,children:_(e)}),(0,D.jsx)(`div`,{className:`structured-value__content`,dir:`auto`,children:(0,D.jsx)(A,{value:y(e),depth:0})})]}):(0,D.jsx)(`span`,{className:`structured-value__scalar`,dir:`auto`,children:_(e)})}function j(e,t,n){if(n)try{let r=n(e,t).trim();if(r)return r}catch{}if(typeof e==`object`&&e)for(let t of[`id`,`code`,`key`]){let n;try{n=Reflect.get(e,t)}catch{n=void 0}if(typeof n==`string`&&n)return`${t}:${n}`;if(typeof n==`number`&&Number.isFinite(n))return`${t}:${n.toString()}`}return`row:${t}`}function je(e,t){let n=new Map;return e.map((e,r)=>{let i=j(e,r,t),a=n.get(i)??0;return n.set(i,a+1),{key:a===0?i:`${i}#${a}`,row:e,sourceIndex:r}})}function Me(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.label===r.label&&e.get===r.get&&e.visible===r.visible&&e.width===r.width&&e.sortable===r.sortable})}async function Ne(e){try{let t=globalThis.navigator?.clipboard;return!t||typeof t.writeText!=`function`?!1:(await t.writeText(e),!0)}catch{return!1}}function Pe(e){return e.trim().replace(/[^a-z0-9._-]+/gi,`-`).replace(/^-+|-+$/g,``)||`records`}function Fe(e,t=!1){return O(e)?b(e,t):_(e)}function Ie(e,t,n){if(typeof document>`u`||typeof URL.createObjectURL!=`function`)return;let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.hidden=!0,document.body.append(i),i.click(),i.remove(),globalThis.setTimeout(()=>URL.revokeObjectURL(r),0)}function M({records:n,fields:r,preferredFields:i=ke,locale:c,direction:l=c.toLowerCase().startsWith(`fa`)?`rtl`:`ltr`,ariaLabel:u,labels:oe,rowKey:d,rowClassName:le,renderCell:de,windowSize:fe=120,toolbar:pe=!0,filename:me=`records`,initialSort:p=null,preserveViewportAnchor:m=!1,className:h=``,empty:g}){let _={...c.toLowerCase().startsWith(`fa`)?Oe:De,...oe},v=(0,f.useId)().replaceAll(`:`,``),y=Math.max(20,Math.min(200,Math.round(fe))),x=(0,f.useMemo)(()=>r?[]:ge(n,i),[n,i,r]),C=r??x,[he,_e]=(0,f.useState)(()=>w([],C)),T=(0,f.useMemo)(()=>w(he,C),[C,he]);(0,f.useEffect)(()=>{_e(e=>{let t=w(e,C);return Me(e,t)?e:t})},[C]);let E=(0,f.useMemo)(()=>{let e=T.filter(e=>e.visible);return e.length?e:T.slice(0,1)},[T]),O=(0,f.useMemo)(()=>je(n,d),[n,d]),[k,A]=(0,f.useState)(``),[j,M]=(0,f.useState)(p),[N,P]=(0,f.useState)(()=>new Set),[Le,F]=(0,f.useState)(0),[I,L]=(0,f.useState)({area:`header`,field:0,row:0}),[R,z]=(0,f.useState)(null),[Re,ze]=(0,f.useState)(``),[B,V]=(0,f.useState)(null),H=(0,f.useRef)(null),U=(0,f.useRef)(null),Be=(0,f.useRef)(null),Ve=(0,f.useMemo)(()=>ve(O,T,j,c),[T,O,c,j]),W=(0,f.useMemo)(()=>ye(Ve,T,k,c),[Ve,T,c,k]),G=Math.max(0,Math.floor(Math.max(0,W.length-1)/y)*y),K=Math.min(Le,G),He=W.slice(K,K+y),Ue=K+He.length;(0,f.useEffect)(()=>F(0),[k,j?.direction,j?.field]),(0,f.useEffect)(()=>{Le>G&&F(G)},[G,Le]),(0,f.useEffect)(()=>{L(e=>{let t=Math.max(0,Math.min(Math.max(0,E.length-1),e.field));return e.area===`header`||W.length===0?{area:`header`,field:t,row:0}:{area:`row`,field:t,row:Math.min(W.length-1,e.row)}})},[W.length,E.length]),(0,f.useEffect)(()=>{let e=new Set(O.map(e=>e.key));P(t=>{let n=new Set([...t].filter(t=>e.has(t)));return n.size===t.size?t:n})},[O]);let q=()=>{if(!m)return;let e=H.current;if(!e)return;let t=e.getBoundingClientRect(),n=[...e.querySelectorAll(`[data-collection-row-key]`)],r=n.find(e=>e.getBoundingClientRect().bottom>t.top+1)??n[0];r&&(Be.current={key:r.dataset.collectionRowKey??``,offset:r.getBoundingClientRect().top-t.top,scrollTop:e.scrollTop,nearStart:e.scrollTop<=4})};(0,f.useLayoutEffect)(()=>{if(!m)return;let e=H.current,t=Be.current;if(!e||!t)q();else{if(t.nearStart)e.scrollTop=0;else{let n=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(t.key):t.key.replace(/["\\]/g,`\\$&`),r=e.querySelector(`[data-collection-row-key="${n}"]`);if(r){let n=r.getBoundingClientRect().top-e.getBoundingClientRect().top;e.scrollTop=Se(e.scrollTop,t.offset,n)}else e.scrollTop=Ce(t.scrollTop,e.scrollHeight,e.clientHeight)}q()}},[W,m]),(0,f.useEffect)(()=>{if(!R)return;let e=e=>{U.current?.contains(e.target)||z(null)},t=e=>{e.key===`Escape`&&z(null)},n=e=>{U.current?.contains(e.target)||z(null)},r=()=>z(null);return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`focusin`,n),globalThis.addEventListener(`blur`,r),U.current?.querySelector(`button`)?.focus(),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`focusin`,n),globalThis.removeEventListener(`blur`,r)}},[R]),(0,f.useLayoutEffect)(()=>{if(!R||!U.current)return;let e=U.current.getBoundingClientRect(),t=globalThis.visualViewport,n=t?.width??globalThis.innerWidth,r=t?.height??globalThis.innerHeight,i=Math.round(Math.max(8,Math.min(R.left,n-e.width-8))),a=Math.round(Math.max(8,Math.min(R.top,r-e.height-8)));(i!==R.left||a!==R.top)&&z(e=>e&&{...e,left:i,top:a})},[R]);let J=e=>{_e(t=>e(w(t,C)))},We=(e,t)=>J(n=>n.map(n=>n.id===e?{...n,width:Ee(t)}:n)),Ge=(e,t)=>J(n=>n.map(n=>n.id===e?{...n,visible:t}:n)),Ke=(e,t)=>J(n=>{let r=n.findIndex(t=>t.id===e),i=Math.max(0,Math.min(n.length-1,r+t));if(r<0||r===i)return n;let a=[...n],[o]=a.splice(r,1);return a.splice(i,0,o),a}),Y=(e,t)=>J(n=>{let r=n.findIndex(t=>t.id===e),i=n.findIndex(e=>e.id===t);if(r<0||i<0||r===i)return n;let a=[...n],[o]=a.splice(r,1);return a.splice(i,0,o),a}),qe=e=>P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Je=async e=>{let t=await Ne(e);ze(t?_.copied:_.copyUnavailable)},Ye=(e,t)=>{e.sortable&&M({field:e.id,direction:t}),z(null)},Xe=e=>{e.sortable&&M(t=>t?.field===e.id?{field:e.id,direction:t.direction===`asc`?`desc`:`asc`}:{field:e.id,direction:`asc`})},X=(e,t,n,r,i)=>{let a=r.getBoundingClientRect(),o=globalThis.innerWidth||1024,s=globalThis.innerHeight||768,c=Math.max(8,Math.min(i?.left??a.left,o-226)),ee=Math.max(8,Math.min(i?.top??a.bottom+4,s-280));z({kind:e,field:t,row:n,left:c,top:ee})},Ze=e=>`${v}-${e.area}-${e.row}-${e.field}`,Qe=e=>{L(e),e.area===`row`&&(e.row=Ue)&&F(Math.floor(e.row/y)*y),globalThis.requestAnimationFrame?.(()=>{H.current?.querySelector(`[data-focus-token="${Ze(e)}"]`)?.focus()})},$e=(e,t)=>{if(we(e)){e.preventDefault(),X(t.area,t.field,t.row,e.currentTarget);return}if(t.area===`row`&&e.key===` `){e.preventDefault();let n=W[t.row];n&&qe(n.key);return}if(t.area===`row`&&e.key===`Enter`){let t=e.currentTarget.querySelector(`summary`);t&&(e.preventDefault(),t.click());return}let n=Te(t,e.key,W.length,E.length,l,e.ctrlKey||e.metaKey);(n.area!==t.area||n.field!==t.field||n.row!==t.row)&&(e.preventDefault(),Qe(n))},et=(e,t)=>{t.preventDefault();let n=t.clientX,r=e.width,i=l===`rtl`?-1:1,a=t=>We(e.id,r+(t.clientX-n)*i),o=()=>{globalThis.removeEventListener(`pointermove`,a),globalThis.removeEventListener(`pointerup`,o),globalThis.removeEventListener(`pointercancel`,o)};globalThis.addEventListener(`pointermove`,a),globalThis.addEventListener(`pointerup`,o),globalThis.addEventListener(`pointercancel`,o)},Z=(e,t)=>{let n=(e===`all`?Ve:W).map(e=>e.row),r=t===`json`?xe(n):be(n,T),i=e===`all`?`all`:`filtered`;Ie(`${Pe(me)}-${i}.${t}`,r,t===`json`?`application/json;charset=utf-8`:`text/csv;charset=utf-8`)},Q=R?E[R.field]:void 0,$=R?.kind===`row`?W[R.row]:void 0,tt=T.filter(e=>e.visible).length;return(0,D.jsxs)(`section`,{className:`typed-collection ${h}`.trim(),dir:l,"aria-label":u,children:[pe&&(0,D.jsxs)(`div`,{className:`typed-collection__toolbar`,children:[(0,D.jsxs)(`label`,{className:`typed-collection__search`,children:[(0,D.jsx)(s,{size:16,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`sr-only`,children:_.search}),(0,D.jsx)(`input`,{value:k,placeholder:_.search,onChange:e=>A(e.target.value)}),k&&(0,D.jsx)(`button`,{type:`button`,"aria-label":_.clearFilter,onClick:()=>A(``),children:(0,D.jsx)(a,{size:14})})]}),(0,D.jsxs)(`div`,{className:`typed-collection__summary`,"aria-live":`polite`,children:[(0,D.jsx)(`strong`,{children:W.length}),(0,D.jsx)(`span`,{children:k?_.filtered:_.all}),N.size>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`i`,{"aria-hidden":`true`}),(0,D.jsx)(`strong`,{children:N.size}),(0,D.jsx)(`span`,{children:_.selected})]})]}),N.size>0&&(0,D.jsx)(`button`,{type:`button`,className:`typed-collection__quiet-action`,onClick:()=>P(new Set),children:_.clearSelection}),(0,D.jsxs)(`details`,{className:`typed-collection__popover typed-collection__columns`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,D.jsxs)(`summary`,{children:[(0,D.jsx)(ue,{size:16}),_.columns]}),(0,D.jsx)(`div`,{className:`typed-collection__popover-panel`,role:`group`,"aria-label":_.columns,children:T.map(e=>(0,D.jsxs)(`div`,{className:`typed-collection__column-option`,onDragOver:t=>{B&&B!==e.id&&t.preventDefault()},onDrop:t=>{t.preventDefault();let n=B??t.dataTransfer.getData(`text/plain`);n&&Y(n,e.id),V(null)},children:[(0,D.jsxs)(`label`,{children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:e.visible,disabled:e.visible&&tt<=1,onChange:t=>Ge(e.id,t.target.checked)}),e.visible?(0,D.jsx)(ne,{size:14}):(0,D.jsx)(te,{size:14}),(0,D.jsx)(`span`,{children:e.label})]}),(0,D.jsx)(`button`,{type:`button`,className:`typed-collection__column-drag`,draggable:!0,"aria-label":`${_.reorderColumn}: ${e.label}`,onDragStart:t=>{V(e.id),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id)},onDragEnd:()=>V(null),onKeyDown:t=>{(t.key===`ArrowUp`||t.key===`ArrowDown`)&&(t.preventDefault(),Ke(e.id,t.key===`ArrowUp`?-1:1))},disabled:T.length<2,children:(0,D.jsx)(re,{size:15})})]},e.id))})]}),(0,D.jsxs)(`details`,{className:`typed-collection__popover typed-collection__export`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.open=!1)},children:[(0,D.jsxs)(`summary`,{children:[(0,D.jsx)(ee,{size:16}),_.export]}),(0,D.jsxs)(`div`,{className:`typed-collection__popover-panel`,role:`group`,"aria-label":_.export,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>Z(`all`,`json`),children:_.exportAllJSON}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>Z(`filtered`,`json`),children:_.exportFilteredJSON}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>Z(`all`,`csv`),children:_.exportAllCSV}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>Z(`filtered`,`csv`),children:_.exportFilteredCSV})]})]})]}),!T.length||!n.length?g??(0,D.jsx)(`p`,{className:`typed-collection__empty`,children:_.noRecords}):W.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`typed-collection__viewport`,ref:H,onScroll:q,children:(0,D.jsxs)(`table`,{className:`typed-collection__grid`,role:`grid`,"aria-label":u,"aria-multiselectable":`true`,"aria-rowcount":W.length+1,"aria-colcount":E.length+1,children:[(0,D.jsxs)(`colgroup`,{children:[(0,D.jsx)(`col`,{className:`typed-collection__select-column`}),E.map(e=>(0,D.jsx)(`col`,{style:{width:e.width}},e.id))]}),(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{role:`row`,"aria-rowindex":1,children:[(0,D.jsx)(`th`,{className:`typed-collection__select`,scope:`col`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:_.selected})}),E.map((e,n)=>{let r={area:`header`,field:n,row:0},i=j?.field===e.id?j.direction:null;return(0,D.jsxs)(`th`,{scope:`col`,role:`columnheader`,"aria-colindex":n+2,"aria-sort":i===`asc`?`ascending`:i===`desc`?`descending`:`none`,"aria-haspopup":`menu`,tabIndex:I.area===`header`&&I.field===n?0:-1,"data-focus-token":Ze(r),style:{"--collection-column-width":`${e.width}px`},onFocus:()=>L(r),onKeyDown:e=>$e(e,r),onContextMenu:e=>{e.preventDefault(),X(`header`,n,0,e.currentTarget,{left:e.clientX,top:e.clientY})},onDragOver:t=>{B&&B!==e.id&&t.preventDefault()},onDrop:t=>{t.preventDefault();let n=B??t.dataTransfer.getData(`text/plain`);n&&Y(n,e.id),V(null)},onDragEnd:()=>V(null),children:[(0,D.jsxs)(`button`,{type:`button`,className:`typed-collection__sort`,tabIndex:-1,disabled:!e.sortable,onClick:()=>Xe(e),children:[(0,D.jsx)(`span`,{children:e.label}),i===`asc`?(0,D.jsx)(ie,{size:14}):i===`desc`?(0,D.jsx)(ae,{size:14}):(0,D.jsx)(`span`,{className:`typed-collection__sort-placeholder`,"aria-hidden":`true`})]}),(0,D.jsxs)(`span`,{className:`typed-collection__header-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`typed-collection__header-menu`,tabIndex:-1,"aria-label":`${_.columnActions}: ${e.label}`,"aria-haspopup":`menu`,onClick:e=>X(`header`,n,0,e.currentTarget),children:(0,D.jsx)(t,{size:14})}),(0,D.jsx)(`button`,{type:`button`,className:`typed-collection__reorder`,tabIndex:-1,draggable:!0,"aria-label":`${_.reorderColumn}: ${e.label}`,onDragStart:t=>{V(e.id),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id)},onDragEnd:()=>V(null),children:(0,D.jsx)(re,{size:13})})]}),(0,D.jsx)(`button`,{type:`button`,className:`typed-collection__resize`,tabIndex:-1,"aria-label":`${_.resizeColumn}: ${e.label}`,onPointerDown:t=>et(e,t),onKeyDown:t=>{if(t.key!==`ArrowLeft`&&t.key!==`ArrowRight`)return;t.preventDefault();let n=t.key===`ArrowRight`?12:-12;We(e.id,e.width+(l===`rtl`?-n:n))},children:(0,D.jsx)(re,{size:13})})]},e.id)})]})}),(0,D.jsx)(`tbody`,{children:He.map((t,n)=>{let r=K+n,i=N.has(t.key);return(0,D.jsxs)(`tr`,{role:`row`,"aria-rowindex":r+2,"aria-selected":i,"data-collection-row-key":t.key,className:le?.(t.row),children:[(0,D.jsx)(`td`,{className:`typed-collection__select`,role:`gridcell`,"aria-colindex":1,children:(0,D.jsxs)(`label`,{children:[(0,D.jsx)(`input`,{type:`checkbox`,tabIndex:-1,checked:i,onChange:()=>qe(t.key)}),(0,D.jsx)(`span`,{className:`sr-only`,children:i?_.deselectRow:_.selectRow}),i&&(0,D.jsx)(e,{size:13,"aria-hidden":`true`})]})}),E.map((e,n)=>{let i=S(e,t.row),a=de?.(e,i,t.row),o={area:`row`,field:n,row:r};return(0,D.jsx)(`td`,{role:`gridcell`,"aria-colindex":n+2,"aria-haspopup":`menu`,tabIndex:I.area===`row`&&I.row===r&&I.field===n?0:-1,"data-focus-token":Ze(o),onFocus:()=>L(o),onKeyDown:e=>$e(e,o),onContextMenu:e=>{e.preventDefault(),X(`row`,n,r,e.currentTarget,{left:e.clientX,top:e.clientY})},children:a===void 0?(0,D.jsx)(Ae,{value:i,label:`${_.structuredValue}: ${e.label}`}):a},e.id)})]},t.key)})})]})}),W.length>y&&(0,D.jsxs)(`nav`,{className:`typed-collection__window-nav`,"aria-label":`${u} · ${_.showing}`,children:[(0,D.jsxs)(`button`,{type:`button`,disabled:K===0,onClick:()=>F(Math.max(0,K-y)),children:[(0,D.jsx)(se,{size:15}),_.previousWindow]}),(0,D.jsxs)(`span`,{children:[_.showing,` `,(0,D.jsxs)(`strong`,{children:[K+1,`–`,Ue]}),` `,_.of,` `,(0,D.jsx)(`strong`,{children:W.length})]}),(0,D.jsxs)(`button`,{type:`button`,disabled:Ue>=W.length,onClick:()=>F(Math.min(G,K+y)),children:[_.nextWindow,(0,D.jsx)(o,{size:15})]})]})]}):(0,D.jsxs)(`div`,{className:`typed-collection__empty`,children:[(0,D.jsx)(s,{size:21}),(0,D.jsx)(`p`,{children:_.noMatches}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>A(``),children:_.clearFilter})]}),(0,D.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:Re}),R&&Q&&(0,D.jsx)(`div`,{ref:U,className:`typed-collection__context-menu`,role:`menu`,"aria-label":R.kind===`header`?Q.label:`${Q.label} · ${R.row+1}`,style:{left:R.left,top:R.top},onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement);(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus())},children:R.kind===`header`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:!Q.sortable,onClick:()=>Ye(Q,`asc`),children:[(0,D.jsx)(ie,{size:15}),_.sortAscending]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:!Q.sortable,onClick:()=>Ye(Q,`desc`),children:[(0,D.jsx)(ae,{size:15}),_.sortDescending]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:R.field===0,onClick:()=>{Y(Q.id,E[R.field-1].id),z(null)},children:[l===`rtl`?(0,D.jsx)(o,{size:15}):(0,D.jsx)(se,{size:15}),_.moveEarlier]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:R.field===E.length-1,onClick:()=>{Y(Q.id,E[R.field+1].id),z(null)},children:[l===`rtl`?(0,D.jsx)(se,{size:15}):(0,D.jsx)(o,{size:15}),_.moveLater]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Je(W.map(e=>Fe(S(Q,e.row))).join(` `)),z(null)},children:[(0,D.jsx)(ce,{size:15}),_.copyColumn]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:tt<=1,onClick:()=>{Ge(Q.id,!1),z(null)},children:[(0,D.jsx)(te,{size:15}),_.hideColumn]})]}):$?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Je(Fe(S(Q,$.row),!0)),z(null)},children:[(0,D.jsx)(ce,{size:15}),_.copyCell]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{Je(b($.row,!0)),z(null)},children:[(0,D.jsx)(ce,{size:15}),_.copyRow]}),(0,D.jsxs)(`button`,{type:`button`,role:`menuitemcheckbox`,"aria-checked":N.has($.key),onClick:()=>{qe($.key),z(null)},children:[(0,D.jsx)(e,{size:15}),N.has($.key)?_.deselectRow:_.selectRow]}),N.size>0&&(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{P(new Set),z(null)},children:[(0,D.jsx)(a,{size:15}),_.clearSelection]}),k&&(0,D.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{A(``),z(null)},children:[(0,D.jsx)(s,{size:15}),_.clearFilter]})]}):null})]})}export{M as n,b as r,Ae as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-Co4i84v0.js b/Tools/Controller/internal/webui/dist/assets/chunk-B6TQ82AF.js similarity index 89% rename from Tools/Controller/internal/webui/dist/assets/chunk-Co4i84v0.js rename to Tools/Controller/internal/webui/dist/assets/chunk-B6TQ82AF.js index 6b9c6f51..7c516440 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-Co4i84v0.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-B6TQ82AF.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};t.node;var n=e(t),r={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};r.node;var i=e(r);export{n,i as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};t.node;var n=e(t),r={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};r.node;var i=e(r);export{n,i as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-CQk5ARdV.js b/Tools/Controller/internal/webui/dist/assets/chunk-BEQPqDaE.js similarity index 99% rename from Tools/Controller/internal/webui/dist/assets/chunk-CQk5ARdV.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BEQPqDaE.js index 0e1c3ddb..85ce6456 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-CQk5ARdV.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BEQPqDaE.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunk-BuW8SQma.js","assets/app-DHmIY1mo.js","assets/index-B-6g0IjL.css"])))=>i.map(i=>d[i]); -import{B as e,C as t,E as n,Et as r,F as i,G as a,H as o,I as s,It as c,J as l,K as u,L as d,M as f,Nt as p,Ot as m,P as h,Pt as g,Q as _,R as v,St as y,T as b,Tt as x,U as ee,V as S,W as C,X as w,Y as T,Z as E,_ as D,_t as O,at as k,bt as te,c as A,ct as j,d as ne,dt as re,et as ie,f as ae,g as oe,gt as se,h as M,ht as ce,i as le,it as ue,l as N,lt as P,m as de,mt as fe,nt as F,ot as I,p as pe,q as me,rt as L,s as he,st as R,t as z,tt as ge,u as _e,ut as ve,w as ye,wt as be,x as xe,y as Se,yt as B,z as Ce,zt as we}from"./app-DHmIY1mo.js";import{i as Te,n as Ee,r as De,t as Oe}from"./chunk-COZaly3R.js";import{_ as ke,a as Ae,c as je,d as V,f as Me,g as Ne,h as H,i as Pe,l as Fe,m as Ie,n as Le,o as Re,p as ze,r as Be,s as Ve,t as He,u as Ue,v as We,x as Ge,y as Ke}from"./chunk-BepNkYer.js";import{n as qe,t as Je}from"./chunk-CWMYvVMg.js";import{n as U,t as Ye}from"./chunk-Co4i84v0.js";import{n as Xe,t as Ze}from"./chunk-F-tPTz9z.js";import{t as W}from"./chunk-eKoA1lB1.js";var Qe={name:`chart-no-axes-combined`,size:24,node:[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]};Qe.node;var $e=g(Qe),et={name:`circle-power`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M7.998 9.003a5 5 0 1 0 8-.005`,key:`1pek45`}]],aliases:[`power-circle`]};et.node;var tt=g(et),nt={name:`circuit-board`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M11 9h4a2 2 0 0 0 2-2V3`,key:`1ve2rv`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`M7 21v-4a2 2 0 0 1 2-2h4`,key:`1fwkro`}],[`circle`,{cx:`15`,cy:`15`,r:`2`,key:`3i40o0`}]]};nt.node;var rt=g(nt),it={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};it.node;var at=g(it),ot={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};ot.node;var st=g(ot),ct={name:`heart-pulse`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]};ct.node;var lt=g(ct),ut={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};ut.node;var G=g(ut),dt={name:`monitor-smartphone`,size:24,node:[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]};dt.node;var ft=g(dt),pt={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};pt.node;var mt=g(pt),ht={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};ht.node;var gt=g(ht),_t={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};_t.node;var vt=g(_t),yt={name:`timer-reset`,size:24,node:[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M12 14v-4`,key:`1evpnu`}],[`path`,{d:`M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6`,key:`1ts96g`}],[`path`,{d:`M9 17H4v5`,key:`8t5av`}]]};yt.node;var bt=g(yt),xt={name:`toggle-right`,size:24,node:[[`circle`,{cx:`15`,cy:`12`,r:`3`,key:`1afu0r`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};xt.node;var St=g(xt),Ct={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};Ct.node;var wt=g(Ct),K=we(c(),1),q=re();function Tt(e){let t=e.kind.toLowerCase();return t.includes(`error`)||t.includes(`fault`)||t.includes(`hot`)?`bad`:t.includes(`warning`)||t.includes(`door`)||t.includes(`disconnect`)?`warn`:t.includes(`connect`)||t.includes(`ready`)||t.includes(`complete`)?`good`:`info`}function Et(e){return e.text||e.reason||e.state}function Dt({events:e,locale:t,t:n,limit:r=6,toolbar:i=!1}){let a=(e,n)=>t===`fa`?n:e,o=(0,K.useMemo)(()=>[{id:`time`,label:a(`Time`,`زمان`),get:e=>e.time,width:142},{id:`kind`,label:a(`Type`,`نوع`),get:e=>e.kind,width:165},{id:`message`,label:a(`Message`,`پیام`),get:Et,width:330},{id:`source`,label:a(`Source`,`مبدأ`),get:e=>e.source,width:170,visible:i},{id:`metadata`,label:a(`Metadata`,`فراداده`),get:e=>e.metadata,width:270,visible:i}],[t,i]),s=e.slice(0,r);return(0,q.jsx)(Xe,{records:s,fields:o,locale:t,direction:t===`fa`?`rtl`:`ltr`,ariaLabel:a(`Controller event collection`,`مجموعهٔ رویدادهای کنترلر`),filename:`controller-events`,toolbar:i,windowSize:120,preserveViewportAnchor:!0,className:`typed-collection--events${i?``:` typed-collection--compact`}`,rowKey:e=>`${e.id}:${e.time}`,rowClassName:e=>`typed-collection__row--${Tt(e)}`,renderCell:(e,n,r)=>{if(e.id===`time`)return(0,q.jsx)(`time`,{dateTime:r.time,children:xe(t,r.time)});if(e.id===`kind`)return(0,q.jsx)(`strong`,{className:`typed-collection__event-kind`,children:r.kind});if(e.id===`message`)return(0,q.jsxs)(`div`,{className:`typed-collection__event-copy`,children:[(0,q.jsx)(`span`,{className:`typed-collection__event-message`,dir:`auto`,children:Et(r)||`—`}),!i&&r.metadata&&Object.keys(r.metadata).length>0&&(0,q.jsx)(Ze,{value:r.metadata,label:a(`Expand event metadata`,`نمایش فرادادهٔ رویداد`)})]});if(e.id===`metadata`&&r.metadata&&Object.keys(r.metadata).length)return(0,q.jsx)(Ze,{value:r.metadata,label:a(`Expand event metadata`,`نمایش فرادادهٔ رویداد`)});if(n===void 0)return(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`—`})},empty:(0,q.jsx)(E,{icon:p,title:n(`noEvents`),detail:n(`eventStream`)})})}var Ot=[{value:`app page dashboard`,group:`navigation`,label:{en:`Open dashboard`,fa:`باز کردن داشبورد`}},{value:`app page controls`,group:`navigation`,label:{en:`Open controls`,fa:`باز کردن کنترل‌ها`}},{value:`app page workbench`,group:`navigation`,label:{en:`Open workbench`,fa:`باز کردن میزکار`}},{value:`app page updates`,group:`navigation`,label:{en:`Open updates`,fa:`باز کردن به‌روزرسانی‌ها`}},{value:`app page settings`,group:`navigation`,label:{en:`Open settings`,fa:`باز کردن تنظیمات`}},{value:`app page events`,group:`navigation`,label:{en:`Open event timeline`,fa:`باز کردن رویدادها`}},{value:`status`,group:`diagnostics`,label:{en:`Read controller status`,fa:`خواندن وضعیت کنترلر`}},{value:`os facts system`,group:`diagnostics`,label:{en:`Read host system facts`,fa:`خواندن اطلاعات سیستم میزبان`}},{value:`os facts serial`,group:`diagnostics`,label:{en:`Inspect host serial ports`,fa:`بررسی درگاه‌های سریال میزبان`}},{value:`relay off`,group:`safety`,label:{en:`Turn all outputs off`,fa:`خاموش کردن همه خروجی‌ها`}}],kt=new Set([`Alt`,`AltGraph`,`Control`,`Meta`,`OS`,`Shift`,`Super`,`Win`,`Windows`]),At={Backspace:`BACKSPACE`,Tab:`TAB`,Enter:`ENTER`,Escape:`ESC`,Esc:`ESC`," ":`SPACE`,Space:`SPACE`,Spacebar:`SPACE`,PageUp:`PAGEUP`,PageDown:`PAGEDOWN`,End:`END`,Home:`HOME`,ArrowLeft:`LEFT`,Left:`LEFT`,ArrowUp:`UP`,Up:`UP`,ArrowRight:`RIGHT`,Right:`RIGHT`,ArrowDown:`DOWN`,Down:`DOWN`,Insert:`INSERT`,Delete:`DELETE`,Del:`DELETE`,AudioVolumeMute:`VOLUME_MUTE`,VolumeMute:`VOLUME_MUTE`,AudioVolumeDown:`VOLUME_DOWN`,VolumeDown:`VOLUME_DOWN`,AudioVolumeUp:`VOLUME_UP`,VolumeUp:`VOLUME_UP`,MediaTrackNext:`MEDIA_NEXT`,MediaNextTrack:`MEDIA_NEXT`,MediaTrackPrevious:`MEDIA_PREVIOUS`,MediaPreviousTrack:`MEDIA_PREVIOUS`,MediaStop:`MEDIA_STOP`,MediaPlayPause:`MEDIA_PLAY_PAUSE`},jt={ESC:`Esc`,BACKSPACE:`Backspace`,TAB:`Tab`,ENTER:`Enter`,SPACE:`Space`,PAGEUP:`Page Up`,PAGEDOWN:`Page Down`,END:`End`,HOME:`Home`,LEFT:`←`,UP:`↑`,RIGHT:`→`,DOWN:`↓`,INSERT:`Insert`,DELETE:`Delete`,VOLUME_MUTE:`Mute`,VOLUME_DOWN:`Volume Down`,VOLUME_UP:`Volume Up`,MEDIA_NEXT:`Media Next`,MEDIA_PREVIOUS:`Media Previous`,MEDIA_STOP:`Media Stop`,MEDIA_PLAY_PAUSE:`Play/Pause`};function Mt(e){let t=e.code??``;return/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^F(?:[1-9]|1[0-9]|2[0-4])$/.test(t)?t:At[e.key]||(/^F(?:[1-9]|1[0-9]|2[0-4])$/i.test(e.key)||/^[a-z0-9]$/i.test(e.key)?e.key.toUpperCase():null)}function Nt(e){if(e.repeat||e.isComposing||e.keyCode===229||e.key===`Process`||e.key===`Dead`||e.key===`Unidentified`||kt.has(e.key)||e.getModifierState?.(`AltGraph`))return null;let t=Mt(e);if(!t)return null;let n=[];if(e.ctrlKey&&n.push(`Ctrl`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),e.metaKey&&n.push(`Win`),n.length===0&&!/^F(?:[1-9]|1[0-9]|2[0-4])$/.test(t))return null;let r=[...n,t].join(`+`);return{canonical:r,keys:J(r)}}function J(e){return e.split(`+`).map(e=>e.trim()).filter(Boolean).map(e=>jt[e.toUpperCase()]??{CTRL:`Ctrl`,CONTROL:`Ctrl`,ALT:`Alt`,OPTION:`Alt`,SHIFT:`Shift`,WIN:`Win`,WINDOWS:`Win`,META:`Win`,SUPER:`Win`}[e.toUpperCase()]??e)}function Y(e){return new TextEncoder().encode(e).length}function Pt(e,t){let n=``;for(let r of e){if(Y(n+r)>t)break;n+=r}return n}function Ft(e){return Pt(e.normalize(`NFKC`).replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,``).replace(/\s+/g,` `).trimStart(),64)}function It(e){return Ot.some(t=>t.value===e)}function Lt(e){let t=e.status;if(!t)return{state:`unavailable`,detail:`The host did not expose registrar status.`};if(t.last_error)return{state:`error`,detail:t.last_error};if(!t.supported)return{state:`error`,detail:`Global hotkeys are not supported by this host.`};let n=e.bindings.filter(e=>e.enabled),r=t.bindings??[];if(n.length===0)return!t.running&&r.length===0?{state:`idle`,detail:`No global shortcuts are enabled.`}:{state:`pending`,detail:`The host is removing the previous shortcuts.`};if(!t.running)return{state:`pending`,detail:`The host registrar has not started yet.`};if(n.length!==r.length)return{state:`pending`,detail:`The host is reconciling the shortcut set.`};let i=new Map(r.map(e=>[e.name.toLocaleLowerCase(`en-US`),e]));for(let e of n){let t=i.get(e.name.toLocaleLowerCase(`en-US`));if(!t||t.accelerator!==e.chord||t.command!==e.command)return{state:`pending`,detail:`The host has not confirmed ${e.name} yet.`}}return{state:`active`,detail:`${n.length} global shortcut${n.length===1?``:`s`} active.`}}var Rt=new Set([`Alt`,`AltGraph`,`Control`,`Meta`,`OS`,`Shift`,`Super`,`Win`,`Windows`]);function X(e,t,n){return e===`fa`?n:t}function zt(e,t,r){if(r.state===`active`){let r=t.bindings.filter(e=>e.enabled).length;return e===`fa`?`${n(`fa`,r)} میانبر سراسری فعال است.`:`${r} global ${r===1?`shortcut is`:`shortcuts are`} active.`}return r.state===`idle`?X(e,`No global shortcuts are enabled.`,`هیچ میانبر سراسری فعالی وجود ندارد.`):r.detail}function Z(e,t){return new Promise(n=>{if(t.aborted){n(!1);return}let r=window.setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},e),i=()=>{window.clearTimeout(r),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Bt({chord:e}){return(0,q.jsx)(ie,{keys:J(e)})}function Vt({locale:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!0),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(null),[u,d]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(Ot[0].value),[_,v]=(0,K.useState)(!0),[y,b]=(0,K.useState)(!1),[ee,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(!1),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(`info`),[te,A]=(0,K.useState)(!1),ne=(0,K.useRef)(null),re=(0,K.useRef)(null),ie=(0,K.useRef)(null),ae=e=>{c(e.name),d(e.name),m(e.chord),g(e.command),v(e.enabled),b(!1),A(!1),D(``)},oe=(t=!1)=>{c(null),d(``),m(``),g(Ot[0].value),v(!0),b(!1),A(!1),D(X(e,`Name the shortcut, record its keys, then choose an action.`,`میانبر را نام‌گذاری کنید، کلیدها را ضبط و سپس یک کنش انتخاب کنید.`)),k(`info`),t&&window.requestAnimationFrame(()=>re.current?.focus())},se=async(e,t=!1)=>{o(``);try{let r=await f(`controller.hotkeys.get`,{},e);if(n(r),t){let e=r.bindings[0];e?ae(e):oe()}return r}catch(t){if(e?.aborted)return null;let n=t instanceof Error?t.message:String(t);return o(n),null}finally{e?.aborted||i(!1)}};(0,K.useEffect)(()=>{let e=new AbortController;return se(e.signal,!0),()=>{e.abort(),ie.current?.abort()}},[]);let M=(0,K.useMemo)(()=>t?.bindings.find(e=>e.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`)),[s,t]),le=Ft(u).trim(),ue=t?.bindings.some(e=>e.name.toLocaleLowerCase(`en-US`)===le.toLocaleLowerCase(`en-US`)&&e.name.toLocaleLowerCase(`en-US`)!==s?.toLocaleLowerCase(`en-US`))??!1,N=t?.bindings.some(e=>e.chord===p&&e.name.toLocaleLowerCase(`en-US`)!==s?.toLocaleLowerCase(`en-US`))??!1,P=le?ue?X(e,`That name is already in use.`,`این نام قبلاً استفاده شده است.`):``:X(e,`A binding name is required.`,`نام میانبر الزامی است.`),de=p?N?X(e,`That key combination is already assigned.`,`این ترکیب کلید قبلاً اختصاص یافته است.`):``:X(e,`Record a supported key combination.`,`یک ترکیب کلید پشتیبانی‌شده ضبط کنید.`),fe=It(h)?``:X(e,`Choose an approved action before saving.`,`پیش از ذخیره، یک کنش تأییدشده انتخاب کنید.`),F=u?P:``,pe=p?de:``,me=!P&&!de&&!fe,L=!M||M.enabled!==_||M.chord!==p||M.command!==h,he=t?Lt(t):null,z=!!(t?.apply_pending||C),ge=!z&&he?.state===`error`?he.detail:``,_e=ge?`danger`:O,ve=r?{tone:`neutral`,label:X(e,`Synchronizing`,`همگام‌سازی`)}:a?{tone:`bad`,label:X(e,`Unavailable`,`دردسترس نیست`)}:z?{tone:`warn`,label:X(e,`Apply pending`,`در انتظار اعمال`)}:he?.state===`active`?{tone:`good`,label:X(e,`Active`,`فعال`)}:he?.state===`error`?{tone:`bad`,label:X(e,`Registration failed`,`ثبت ناموفق`)}:he?.state===`idle`?{tone:`neutral`,label:X(e,`No active bindings`,`بدون میانبر فعال`)}:{tone:`warn`,label:X(e,`Not confirmed`,`تأیید نشده`)},ye=async t=>{ie.current?.abort();let r=new AbortController;ie.current=r,w(!0),n(t),D(X(e,`Saved. Waiting for the host registrar to confirm the change…`,`ذخیره شد؛ در انتظار تأیید تغییر توسط میزبان…`)),k(`info`);for(let t=0;t<16;t+=1){if(!await Z(t===0?100:250,r.signal))return;let i;try{i=await f(`controller.hotkeys.get`,{},r.signal)}catch(e){if(r.signal.aborted)return;w(!1),n(e=>e&&{...e,apply_pending:!1}),D(e instanceof Error?e.message:String(e)),k(`danger`);return}n(i);let a=Lt(i);if(a.state===`active`||a.state===`idle`){w(!1),D(zt(e,i,a)),k(`success`);return}if(a.state===`error`||a.state===`unavailable`){w(!1),D(a.detail),k(a.state===`error`?`danger`:`warning`);return}}w(!1),D(X(e,`Saved, but the registrar did not confirm the change in time.`,`ذخیره شد، اما ثبت‌کننده در زمان مقرر تغییر را تأیید نکرد.`)),k(`warning`)},be=async e=>{if(e.preventDefault(),me&&L){S(!0),A(!1),D(``);try{let e=await f(`controller.hotkeys.set`,{operation:`upsert`,name:M?.name??le,enabled:_,chord:p,command:h}),t=e.bindings.find(e=>e.name.toLocaleLowerCase(`en-US`)===(M?.name??le).toLocaleLowerCase(`en-US`));t&&ae(t),ye(e)}catch(e){D(e instanceof Error?e.message:String(e)),k(`danger`)}finally{S(!1)}}},xe=async()=>{if(M){if(!te)A(!0),D(X(e,`Confirm removal of “${M.name}”.`,`حذف «${M.name}» را تأیید کنید.`)),k(`warning`);else{S(!0);try{let e=await f(`controller.hotkeys.set`,{operation:`remove`,name:M.name});oe(!0),ye(e)}catch(e){D(e instanceof Error?e.message:String(e)),k(`danger`)}finally{S(!1)}}}},Se=()=>{b(!0),A(!1),D(X(e,`Listening now. Press a combination, or Escape to cancel.`,`در حال شنیدن؛ ترکیب کلید را بزنید یا با Escape لغو کنید.`)),k(`info`),window.requestAnimationFrame(()=>ne.current?.focus())},B=t=>{if(!y||t.nativeEvent.isComposing||t.keyCode===229)return;if(t.stopPropagation(),t.key===`Escape`&&!t.ctrlKey&&!t.altKey&&!t.shiftKey&&!t.metaKey){t.preventDefault(),b(!1),D(X(e,`Shortcut recording cancelled.`,`ضبط میانبر لغو شد.`)),k(`info`);return}if(Rt.has(t.key)||t.repeat)return;t.preventDefault();let n=Nt(t.nativeEvent);n?(m(n.canonical),b(!1),A(!1),D(X(e,`Recorded ${n.canonical}.`,`${n.canonical} ضبط شد.`)),k(`success`)):(D(X(e,`Use Ctrl, Alt, Shift or Win with a supported key; F1–F24 may be used alone.`,`از Ctrl، Alt، Shift یا Win همراه یک کلید پشتیبانی‌شده استفاده کنید؛ F1 تا F24 می‌توانند تنها باشند.`)),k(`warning`))},Ce=[`navigation`,`diagnostics`,`safety`].map(e=>({group:e,commands:Ot.filter(t=>t.group===e)}));return(0,q.jsx)(T,{icon:x,iconTone:ve.tone===`bad`?`red`:ve.tone===`good`?`green`:ve.tone===`warn`?`amber`:`violet`,title:X(e,`Global shortcuts`,`میانبرهای سراسری`),eyebrow:ve.label,className:`settings-card settings-card--wide hotkey-card`,action:(0,q.jsx)(I,{tone:ve.tone,pulse:z,children:ve.label}),children:a&&!t?(0,q.jsxs)(`div`,{className:`hotkey-editor__load-error`,role:`alert`,children:[(0,q.jsx)(ce,{"aria-hidden":`true`,size:20}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:X(e,`Hotkey settings could not be loaded`,`تنظیمات میانبر بارگیری نشد`)}),(0,q.jsx)(`span`,{children:a})]}),(0,q.jsx)(l,{icon:De,busy:r,onClick:()=>{i(!0),se(void 0,!0)},children:X(e,`Retry`,`تلاش دوباره`)})]}):(0,q.jsxs)(`div`,{className:`hotkey-editor`,children:[(0,q.jsxs)(`section`,{className:`hotkey-editor__library`,"aria-label":X(e,`Configured global shortcuts`,`میانبرهای سراسری پیکربندی‌شده`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:X(e,`Bindings`,`میانبرها`)}),(0,q.jsx)(`small`,{children:t?X(e,`${t.bindings.length} configured`,`${t.bindings.length} مورد پیکربندی شده`):X(e,`Loading…`,`در حال بارگیری…`)})]}),(0,q.jsx)(l,{ref:re,compact:!0,icon:ke,onClick:()=>oe(),children:X(e,`New`,`جدید`)})]}),(0,q.jsxs)(`div`,{className:`hotkey-binding-list`,children:[t?.bindings.map(t=>(0,q.jsxs)(`button`,{type:`button`,className:t.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`)?`is-selected`:``,"aria-pressed":t.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`),onClick:()=>ae(t),children:[(0,q.jsx)(`span`,{className:`hotkey-binding-list__icon`,children:(0,q.jsx)(x,{"aria-hidden":`true`,size:17})}),(0,q.jsxs)(`span`,{className:`hotkey-binding-list__copy`,children:[(0,q.jsx)(`strong`,{children:t.name}),(0,q.jsx)(Bt,{chord:t.chord})]}),(0,q.jsx)(`span`,{className:`hotkey-binding-list__state${t.enabled?` is-enabled`:``}`,children:t.enabled?X(e,`Enabled`,`فعال`):X(e,`Disabled`,`غیرفعال`)})]},t.name)),t?.bindings.length===0&&(0,q.jsxs)(`div`,{className:`hotkey-binding-list__empty`,children:[(0,q.jsx)(x,{"aria-hidden":`true`,size:22}),(0,q.jsx)(`span`,{children:X(e,`No shortcuts configured yet.`,`هنوز میانبری پیکربندی نشده است.`)})]})]})]}),(0,q.jsxs)(`form`,{className:`hotkey-editor__form`,onSubmit:e=>void be(e),children:[(0,q.jsxs)(`header`,{className:`hotkey-editor__form-heading`,children:[(0,q.jsx)(`span`,{className:`hotkey-editor__form-icon`,children:M?(0,q.jsx)(U,{"aria-hidden":`true`,size:19}):(0,q.jsx)(ke,{"aria-hidden":`true`,size:19})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`small`,{children:M?X(e,`EDIT BINDING`,`ویرایش میانبر`):X(e,`NEW BINDING`,`میانبر جدید`)}),(0,q.jsx)(`strong`,{children:M?.name||X(e,`Create a global shortcut`,`ایجاد میانبر سراسری`)})]})]}),(0,q.jsxs)(`div`,{className:`hotkey-editor__fields`,children:[(0,q.jsx)(R,{label:X(e,`Binding name`,`نام میانبر`),value:u,disabled:!!M,autoComplete:`off`,spellCheck:!1,onInput:e=>{d(Ft(e.currentTarget.value)),D(``),A(!1)},onChange:e=>{d(Ft(e.currentTarget.value)),D(``),A(!1)},onBlur:()=>d(e=>e.trim()),error:F||void 0,hint:M?X(e,`Names stay fixed so an edit cannot create a duplicate binding.`,`نام ثابت می‌ماند تا ویرایش، میانبر تکراری نسازد.`):void 0}),(0,q.jsxs)(`label`,{className:`hotkey-command-field${fe?` is-invalid`:``}`,children:[(0,q.jsx)(`span`,{children:X(e,`Action`,`کنش`)}),(0,q.jsxs)(`select`,{value:h,"aria-invalid":fe?!0:void 0,onChange:e=>{g(e.currentTarget.value),D(``),A(!1)},children:[!It(h)&&(0,q.jsx)(`option`,{value:h,disabled:!0,children:X(e,`Existing custom action — choose a safe replacement`,`کنش سفارشی فعلی — یک جایگزین امن انتخاب کنید`)}),Ce.map(({group:t,commands:n})=>(0,q.jsx)(`optgroup`,{label:{navigation:X(e,`Navigation`,`پیمایش`),diagnostics:X(e,`Diagnostics`,`عیب‌یابی`),safety:X(e,`Safety`,`ایمنی`)}[t],children:n.map(t=>(0,q.jsx)(`option`,{value:t.value,children:t.label[e]},t.value))},t))]}),(0,q.jsx)(`small`,{className:fe?`text-bad`:``,dir:`ltr`,children:fe||h})]}),(0,q.jsxs)(`div`,{className:`hotkey-recorder-field${pe?` is-invalid`:``}`,children:[(0,q.jsx)(`span`,{children:X(e,`Key combination`,`ترکیب کلید`)}),(0,q.jsxs)(`button`,{ref:ne,type:`button`,className:`hotkey-recorder${y?` is-recording`:``}`,"aria-pressed":y,"aria-describedby":`hotkey-recorder-message`,onClick:Se,onKeyDown:B,onBlur:()=>{y&&(b(!1),D(X(e,`Shortcut recording stopped.`,`ضبط میانبر متوقف شد.`)),k(`info`))},children:[(0,q.jsx)(`span`,{className:`hotkey-recorder__indicator`,"aria-hidden":`true`}),p?(0,q.jsx)(Bt,{chord:p}):(0,q.jsx)(`span`,{children:X(e,`Record shortcut`,`ضبط میانبر`)}),(0,q.jsx)(`small`,{children:y?X(e,`Listening…`,`در حال شنیدن…`):X(e,`Press to record`,`برای ضبط فشار دهید`)})]}),(0,q.jsx)(`small`,{id:`hotkey-recorder-message`,className:pe?`text-bad`:``,role:pe?`alert`:`status`,children:pe||(y?X(e,`Waiting for a non-modifier key.`,`در انتظار یک کلید غیرترکیبی.`):p?X(e,`The recorded combination is valid.`,`ترکیب ضبط‌شده معتبر است.`):X(e,`No key combination recorded.`,`هنوز ترکیب کلیدی ضبط نشده است.`))})]})]}),(0,q.jsx)(j,{checked:_,onChange:e=>{v(e),D(``),A(!1)},label:X(e,`Enable this global shortcut`,`فعال‌سازی این میانبر سراسری`),detail:_?X(e,`The host will register it after saving.`,`میزبان پس از ذخیره آن را ثبت می‌کند.`):X(e,`The binding is saved but not registered.`,`میانبر ذخیره می‌شود اما ثبت نخواهد شد.`)}),(0,q.jsxs)(`div`,{className:`hotkey-editor__notice is-${_e}`,role:_e===`danger`?`alert`:`status`,"aria-live":`polite`,children:[_e===`danger`?(0,q.jsx)(ce,{"aria-hidden":`true`,size:17}):_e===`success`?(0,q.jsx)(W,{"aria-hidden":`true`,size:17}):(0,q.jsx)(`span`,{className:`hotkey-editor__notice-line`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:ge||E||(t&&he?zt(e,t,he):``)||X(e,`Choose a binding to edit or create a new one.`,`یک میانبر را برای ویرایش انتخاب یا میانبر تازه‌ای ایجاد کنید.`)})]}),(0,q.jsxs)(`footer`,{className:`hotkey-editor__actions`,children:[(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:H,busy:ee,disabled:!me||!L||te||z,children:M?X(e,`Save binding`,`ذخیره میانبر`):X(e,`Add binding`,`افزودن میانبر`)}),M&&(0,q.jsx)(l,{type:`button`,tone:`danger`,icon:V,busy:ee,disabled:z,onClick:()=>void xe(),children:te?X(e,`Confirm remove`,`تأیید حذف`):X(e,`Remove`,`حذف`)}),te&&(0,q.jsx)(l,{type:`button`,tone:`ghost`,onClick:()=>{A(!1),D(``)},children:X(e,`Cancel`,`لغو`)})]})]})]})})}var Ht=[`relay`,`motion`,`pwm`,`display`,`sensor`];function Ut(e,t){let n=new Map(t.map(e=>[e.key,e.default_name]));return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,a(t).normalized]).filter(([e,t])=>t&&t!==n.get(e)).sort(([e],[t])=>e.localeCompare(t)))}function Wt(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Gt({locale:e}){let t=(t,n)=>e===`fa`?n:t,[n,r]=(0,K.useState)([]),[i,o]=(0,K.useState)({}),[c,u]=(0,K.useState)({}),[d,p]=(0,K.useState)(!0),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=!0;return f(`controller.peripherals.get`).then(t=>{if(!e)return;let n=Ut(t.peripheral_names??{},t.peripherals??[]);r(t.peripherals??[]),o(n),u(n),h(``),_(!1)}).catch(t=>{e&&(h(t instanceof Error?t.message:String(t)),_(!0))}).finally(()=>{e&&p(!1)}),()=>{e=!1}},[]);let v=(0,K.useMemo)(()=>Ut(c,n),[n,c]),y=!Wt(v,i),b=Object.keys(v).length,x=(0,K.useMemo)(()=>Ht.map(e=>({kind:e,entries:n.filter(t=>t.kind===e)})).filter(e=>e.entries.length),[n]),ee=e=>({relay:t(`Relays`,`رله‌ها`),motion:t(`Motion sides`,`سمت‌های حرکت`),pwm:t(`PWM and lighting`,`PWM و نورپردازی`),display:t(`Displays`,`نمایشگرها`),sensor:t(`Sensors`,`حسگرها`)})[e]??e,S=(e,t)=>{h(``),_(!1),u(n=>({...n,[e]:s(t)}))},C=async()=>{if(y){p(!0),h(``),_(!1);try{let e=await f(`controller.peripherals.set`,{peripheral_names:v}),i=Ut(e.peripheral_names??{},e.peripherals??n);r(e.peripherals??n),o(i),u(i),h(t(`Names saved.`,`نام‌ها ذخیره شدند.`))}catch(e){h(e instanceof Error?e.message:String(e)),_(!0)}finally{p(!1)}}},w=m||(d?t(`Synchronizing the host peripheral catalog…`,`در حال همگام‌سازی فهرست تجهیزات میزبان…`):y?t(`${b} custom name${b===1?``:`s`} in the validated draft.`,`${b} نام سفارشی در پیش‌نویس معتبر است.`):t(`${n.length} peripherals synchronized · ${b} customized.`,`${n.length} تجهیز همگام است · ${b} مورد سفارشی شده.`));return(0,q.jsxs)(T,{icon:B,iconTone:`accent`,title:t(`Peripheral names`,`نام تجهیزات`),eyebrow:d?t(`Synchronizing`,`در حال همگام‌سازی`):y?t(`Unsaved changes`,`تغییرات ذخیره‌نشده`):t(`Host authoritative`,`مرجع میزبان`),className:`settings-card settings-card--wide peripheral-names-card`,menu:n.length?[{label:t(`Restore every default name`,`بازگردانی همهٔ نام‌های پیش‌فرض`),icon:Ee,onSelect:()=>{u({}),h(``),_(!1)}}]:void 0,children:[(0,q.jsx)(`div`,{className:`peripheral-name-groups`,"aria-busy":d,children:x.map((e,n)=>(0,q.jsxs)(`details`,{className:`peripheral-name-group`,open:n===0,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`span`,{children:ee(e.kind)}),(0,q.jsx)(`small`,{children:e.entries.length})]}),(0,q.jsx)(`div`,{className:`peripheral-name-grid`,children:e.entries.map(e=>{let n=c[e.key]??``,r=a(n),i=!!(r.normalized&&r.normalized!==e.default_name);return(0,q.jsx)(R,{label:e.default_name,value:n,placeholder:e.default_name,maxLength:64,onInput:t=>S(e.key,t.currentTarget.value),onChange:t=>S(e.key,t.currentTarget.value),error:r.valid?void 0:r.error,success:i?t(`Custom · ${e.key}`,`سفارشی · ${e.key}`):void 0,action:(0,q.jsx)(l,{compact:!0,disabled:!n,icon:Ee,onClick:()=>S(e.key,``),children:t(`Default`,`پیش‌فرض`)})},e.key)})})]},e.kind))}),(0,q.jsxs)(`footer`,{className:`peripheral-names-card__footer`,children:[(0,q.jsx)(`span`,{className:g?`text-warn`:m&&!y?`text-good`:``,role:`status`,"aria-live":`polite`,children:w}),(0,q.jsx)(l,{tone:`primary`,icon:U,busy:d,disabled:!y,onClick:()=>void C(),children:t(`Save names`,`ذخیرهٔ نام‌ها`)})]})]})}function Kt(e){return e?e.transitioning?e.requested:e.applied:`unknown`}function qt(e,t,n){return e?.find(e=>e.key===t)?.name.trim()||n}var Jt=(0,K.lazy)(()=>z(()=>import(`./chunk-BuW8SQma.js`).then(e=>({default:e.TelemetryChart})),__vite__mapDeps([0,1,2])));function Q(e,t){let[n,r]=(0,K.useState)(Date.now);return(0,K.useEffect)(()=>{let n=0,i=!1,a=e?Date.parse(e):NaN,o=()=>{if(i||!Number.isFinite(a))return;let e=Math.max(0,Date.now()-a),s=e{r(Date.now()),o()},s)};return r(Date.now()),o(),()=>{i=!0,window.clearTimeout(n)}},[t,e]),n}function Yt(e,t,n){return e.connected?e.port.friendly_name||e.port.product||e.port.name||t:e.connection_reason||(n===`fa`?`در انتظار اتصال کنترلر`:`Waiting for a controller connection`)}function Xt(e,t){return e.map(e=>e[t]).filter(e=>typeof e==`number`&&Number.isFinite(e))}function Zt(e){let t=e.kind.toLowerCase();return t.includes(`error`)||t.includes(`fault`)||t.includes(`hot`)?`bad`:t.includes(`warning`)||t.includes(`door`)||t.includes(`disconnect`)?`warn`:t.includes(`connect`)||t.includes(`ready`)||t.includes(`complete`)?`good`:`info`}function Qt({state:e,locale:t,action:n,showTitle:r=!0}){let i=(e,n)=>t===`fa`?n:e,a=e===`connecting`||e===`transport-offline`,o=e===`transport-offline`?i(`Reconnecting…`,`در حال اتصال دوباره…`):e===`connecting`?i(`Connecting…`,`در حال اتصال…`):i(`Board offline`,`برد آفلاین`);return(0,q.jsxs)(`div`,{className:`controller-unavailable is-${e}`,role:`status`,"aria-live":`polite`,children:[a?(0,q.jsxs)(`div`,{className:`connection-fuji`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{className:`connection-fuji__sun`}),(0,q.jsx)(`span`,{className:`connection-fuji__rear`}),(0,q.jsx)(`span`,{className:`connection-fuji__face`}),(0,q.jsx)(`span`,{className:`connection-fuji__snow`}),(0,q.jsx)(`span`,{className:`connection-fuji__trace`})]}):(0,q.jsx)(`span`,{className:`controller-unavailable__icon`,"aria-hidden":`true`,children:(0,q.jsx)(Ge,{size:28})}),r&&(0,q.jsx)(`strong`,{children:o}),n&&(0,q.jsx)(`div`,{className:`controller-unavailable__action`,children:n})]})}function $t({snapshot:e,locale:t,reconnect:n,hardwareReset:r}){let i=(e,n)=>t===`fa`?n:e,[a,o]=(0,K.useState)(Date.now);(0,K.useEffect)(()=>{if(e.connection_phase!==`attempting`&&e.connection_phase!==`waiting_retry`)return;let t=window.setInterval(()=>o(Date.now()),250);return()=>window.clearInterval(t)},[e.connection_phase,e.connection_attempt_started,e.connection_next_retry]);let s=oe(e,t,a),c=s.phase===`blocked`?(0,q.jsx)(mt,{size:30}):s.phase===`paused`?(0,q.jsx)(Ue,{size:30}):s.phase===`waiting_retry`?(0,q.jsx)(bt,{size:30}):(0,q.jsx)(gt,{size:30});return(0,q.jsxs)(`div`,{className:`connection-state connection-state--${s.tone} is-${s.phase}`,role:`status`,"aria-live":`polite`,children:[(0,q.jsx)(`div`,{className:`connection-state__icon`,"aria-hidden":`true`,children:c}),(0,q.jsxs)(`div`,{className:`connection-state__body`,children:[(0,q.jsxs)(`div`,{className:`connection-state__heading`,children:[(0,q.jsx)(`strong`,{children:s.title}),s.attempt&&(0,q.jsx)(`span`,{className:`connection-state__attempt`,children:s.attempt})]}),(0,q.jsx)(`p`,{children:s.detail}),(0,q.jsxs)(`div`,{className:`connection-state__facts`,children:[s.candidate&&(0,q.jsxs)(`span`,{children:[(0,q.jsx)(Oe,{size:15}),s.candidate]}),s.timing&&(0,q.jsxs)(`span`,{children:[(0,q.jsx)(bt,{size:15}),s.timing]})]})]}),(0,q.jsxs)(`div`,{className:`connection-state__actions`,children:[r&&(0,q.jsx)(l,{compact:!0,icon:Ke,onClick:r,children:i(`Hardware reset`,`بازنشانی سخت‌افزاری`)}),(0,q.jsx)(l,{compact:!0,tone:s.phase===`blocked`?`danger`:`primary`,icon:s.animated?De:gt,busy:s.animated,disabled:s.retryDisabled,onClick:n,children:s.action})]})]})}var $=[`telemetry`,`outputs`,`overview`,`actions`,`events`];function en(e){let{appTitle:n,snapshot:i,samples:a,events:o,locale:s,t:c,command:u,refresh:d,openDialog:h}=e,g=(e,t)=>s===`fa`?t:e,_=i.status,v=e.transport.boardState===`ready`&&i.connected&&i.have_status,x=M(i),ee=x.ina219||x.temperatureLED||x.temperatureBTAudio,S=ee,C=[x.invalidINA219?g(`Power measurements unavailable`,`اندازه‌گیری‌های توان در دسترس نیست`):``,x.invalidTemperatureLED?g(`LED temperature unavailable`,`دمای LED در دسترس نیست`):``,x.invalidTemperatureBTAudio?g(`BT Amplifier temperature unavailable`,`دمای آمپلی‌فایر بلوتوث در دسترس نیست`):``].filter(Boolean),E=i.hardware_problems?.[0],O=E?le(E,s):void 0,k=!v&&e.transport.authenticationRequired,te=e.transport.boardState===`loading`,A=!k&&e.transport.streamState===`connecting`,j=!k&&e.transport.streamState!==`open`,ne=oe(i,s),re=v?`good`:A?`info`:ne.tone,ie=j?A?g(`Connecting…`,`در حال اتصال…`):g(`Reconnecting…`,`در حال اتصال دوباره…`):O?.title||(te?g(`Discovering controller board…`,`در حال جستجوی برد کنترلر…`):ne.title),ae=j?void 0:O?.guidance||i.connection_reason||c(`noHardware`),se=v?c(`online`):A?g(`Connecting`,`در حال اتصال`):j?g(`Reconnecting`,`در حال اتصال دوباره`):te?g(`Searching for board`,`در حال جستجوی برد`):ne.title,N=i.hello.build_hash?i.hello.build_hash.toString(16).toUpperCase().padStart(8,`0`):`—`,P=Array.from({length:8},(e,t)=>!!(_.active_relays&1<e.kind===`config`)?.id??0,fe=e.transport.measurementFreshnessMS??1500,F=Q(i.status_updated,fe),pe=ye(s,i.status_updated,fe,F),[me,L]=(0,K.useState)(null),[he,R]=(0,K.useState)(!1),[z,_e]=(0,K.useState)(()=>He(`dashboard`,$)),[ve,be]=(0,K.useState)(null),Se=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!v){L(null);return}let e=!0;return f(`controller.ui.config.get`).then(t=>{e&&L(t)}).catch(()=>{e&&L(null)}),()=>{e=!1}},[v,de]);let B=(e,t)=>qt(me?.controls,e,me?.peripheral_names?.[e]?.trim()||t),Ce=[g(`Side A direction`,`جهت سمت A`),g(`Side A output`,`خروجی سمت A`),g(`Side B direction`,`جهت سمت B`),g(`Side B output`,`خروجی سمت B`),g(`User relay 5`,`رلهٔ کاربر ۵`),g(`User relay 6`,`رلهٔ کاربر ۶`),g(`User relay 7`,`رلهٔ کاربر ۷`),g(`User relay 8`,`رلهٔ کاربر ۸`)],we={move:g(`Move`,`جابجایی`),collapse:g(`Collapse`,`جمع‌کردن`),expand:g(`Expand`,`بازکردن`),hide:g(`Hide`,`پنهان‌کردن`),show:g(`Show`,`نمایش`),customize:g(`Arrange`,`چیدمان`),done:g(`Done`,`پایان`),reset:g(`Reset layout`,`بازنشانی چیدمان`),hidden:g(`Hidden cards`,`کارت‌های پنهان`)},Te=[{id:`telemetry`,label:c(`liveTelemetry`)},{id:`outputs`,label:c(`outputs`)},{id:`overview`,label:c(`status`)},{id:`actions`,label:c(`quickActions`)},{id:`events`,label:c(`events`)}],Ee=z.order.filter(e=>v?e===`telemetry`?ee:e!==`outputs`||x.relays:!1),Oe=e=>{_e(t=>{let n=e(t);return Pe(`dashboard`,$,n),n})},ke=()=>{Be(`dashboard`),_e(He(`dashboard`,$))},V=(e,t,n)=>{let r=document.elementFromPoint(t,n)?.closest(`[data-layout-card-id]`)?.dataset.layoutCardId,i=$.includes(r)?r:void 0;je(Se.current,e,i)&&(Se.current=i,Oe(t=>Le(t,e,i)))},Ne=(e,t)=>Oe(n=>{let r=n.order.filter(e=>Ee.includes(e)&&!n.hidden.includes(e)),i=r[r.indexOf(e)+t];return i?Le(n,e,i):n}),H=(e,t,n)=>(0,q.jsx)(Ve,{id:e,title:t,order:z.order.indexOf(e),collapsed:z.collapsed.includes(e),hidden:z.hidden.includes(e),editing:he,dragging:ve===e,copy:we,onToggleCollapsed:()=>Oe(t=>({...t,collapsed:Ae(t.collapsed,e)})),onHide:()=>Oe(t=>({...t,hidden:Ae(t.hidden,e)})),onReorderStart:e=>{Se.current=null,be(e)},onReorderMove:V,onReorderEnd:()=>{Se.current=null,be(null)},onKeyboardReorder:Ne,children:n});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:v?pe:A?g(`Reconnecting`,`اتصال دوباره`):j?g(`Connection unavailable`,`اتصال در دسترس نیست`):i.paused?g(`Board connection paused`,`اتصال برد متوقف شده`):te?g(`Discovering board`,`در حال جستجوی برد`):g(`PCController host online`,`میزبان PCController آنلاین است`),title:c(`dashboard`),detail:k?c(`authenticationDashboardDetail`):v?Yt(i,n,s):ae,action:(0,q.jsxs)(`div`,{className:`header-actions`,children:[(0,q.jsx)(I,{tone:re,pulse:A||i.connection_state===`connecting`,children:se}),!v&&!k&&!j&&(0,q.jsx)(l,{icon:gt,compact:!0,busy:ne.animated,disabled:ne.retryDisabled,onClick:()=>void u(`reconnect`,ne.action),children:ne.action}),(0,q.jsx)(l,{icon:De,compact:!0,onClick:()=>void d(),children:c(`refresh`)}),Ee.length>0&&(0,q.jsx)(Re,{copy:we,editing:he,cards:Te.filter(({id:e})=>Ee.includes(e)),hidden:z.hidden,onToggleEditing:()=>R(e=>!e),onShow:e=>Oe(t=>({...t,hidden:t.hidden.filter(t=>t!==e)})),onReset:ke})]})}),(0,q.jsxs)(`section`,{className:`hero-panel${v?` is-online`:``}`,children:[(0,q.jsxs)(`div`,{className:`hero-panel__identity`,children:[!j&&(0,q.jsx)(`div`,{className:`eyebrow`,children:v?`${g(`Controller board`,`برد کنترلر`)} · ${i.connection_state}`:g(`PCController host · online`,`میزبان PCController · آنلاین`)}),j&&!k?(0,q.jsx)(Qt,{state:A?`connecting`:`transport-offline`,locale:s}):!v&&!k&&!E?(0,q.jsx)($t,{snapshot:i,locale:s,reconnect:()=>void u(`reconnect`,ne.action),hardwareReset:D(i)?()=>void u(`reset lines`,g(`Hardware reset sent`,`بازنشانی سخت‌افزاری ارسال شد`)):void 0}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{children:v?i.hello.name||n:k?c(`authenticationDashboard`):ie}),(v||k||ae)&&(0,q.jsx)(`p`,{children:v?`USB ${i.port.vid||`—`}:${i.port.pid||`—`} · ${i.port.name||g(`automatic port`,`درگاه خودکار`)}`:k?c(`authenticationDashboardDetail`):ae})]}),k&&(0,q.jsx)(l,{icon:U,tone:`primary`,onClick:()=>{window.location.hash=`#/settings`},children:g(`Enter access token`,`ورود توکن دسترسی`)})]}),v&&(0,q.jsxs)(`div`,{className:`hero-panel__readout`,dir:`ltr`,children:[(0,q.jsx)(`span`,{children:g(`BUILD`,`ساخت`)}),(0,q.jsx)(`strong`,{children:N}),(0,q.jsx)(`span`,{children:g(`UPTIME`,`زمان کارکرد`)}),(0,q.jsx)(`strong`,{children:t(s,_.uptime_ms)})]})]}),E&&O&&(0,q.jsxs)(`section`,{className:`hardware-alert is-${E.severity}`,role:`alert`,"aria-live":`assertive`,children:[(0,q.jsx)(`div`,{className:`hardware-alert__icon`,children:(0,q.jsx)(ce,{size:24,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`hardware-alert__copy`,children:[(0,q.jsx)(`strong`,{children:O.title}),(0,q.jsx)(`p`,{children:O.guidance}),O.impact&&(0,q.jsx)(`p`,{className:`hardware-alert__impact`,children:O.impact}),(E.os_problem_code||E.location)&&(0,q.jsx)(`span`,{dir:`ltr`,children:[E.os_problem_code?`Windows code ${E.os_problem_code}`:``,E.location||``].filter(Boolean).join(` · `)})]})]}),v&&S&&(0,q.jsxs)(`section`,{className:`metric-grid`,children:[x.ina219&&(0,q.jsx)(ge,{icon:wt,label:B(`sensor.supply-voltage`,c(`voltage`)),value:b(s,_.supply_mv/1e3,2),unit:`V`,values:Xt(a,`supply`),tone:`accent`,scale:`supply`,detail:`${B(`sensor.bus-voltage`,g(`Bus voltage`,`ولتاژ باس`))} · ${b(s,_.bus_mv/1e3,2)} V`}),x.ina219&&(0,q.jsx)(ge,{icon:Fe,label:B(`sensor.current`,c(`current`)),value:b(s,_.current_ma,0),unit:`mA`,values:Xt(a,`current`),tone:`green`,scale:`current`,detail:`${B(`sensor.power`,g(`Load power`,`توان بار`))} · ${b(s,_.power_mw/1e3,2)} W`}),x.temperatureLED&&(0,q.jsx)(ge,{icon:Me,label:B(`sensor.temperature-led`,`${c(`temperature`)} · LED`),value:b(s,_.temperature_led_centi_c/100,1),unit:`°C`,values:Xt(a,`ledTemp`),tone:`amber`,scale:`temperature`}),x.temperatureBTAudio&&(0,q.jsx)(ge,{icon:Me,label:B(`sensor.temperature-audio`,g(`BT Amplifier temperature`,`دمای آمپلی‌فایر بلوتوث`)),value:b(s,_.temperature_bt_audio_centi_c/100,1),unit:`°C`,values:Xt(a,`btTemp`),tone:`violet`,scale:`temperature`})]}),v&&C.length>0&&(0,q.jsx)(`div`,{className:`measurement-alerts`,role:`status`,"aria-live":`polite`,children:C.map(e=>(0,q.jsxs)(`div`,{className:`measurement-alert`,children:[(0,q.jsx)(ce,{size:16}),(0,q.jsx)(`span`,{children:e})]},e))}),(0,q.jsxs)(`section`,{className:`dashboard-layout-grid`,children:[v&&ee&&H(`telemetry`,c(`liveTelemetry`),(0,q.jsx)(T,{icon:$e,iconTone:`violet`,title:c(`liveTelemetry`),eyebrow:pe,className:`telemetry-chart-card`,action:(0,q.jsxs)(I,{tone:`good`,children:[a.length,` `,g(`samples`,`نمونه`)]}),menu:[{label:g(`Refresh telemetry`,`تازه‌سازی تله‌متری`),icon:De,onSelect:()=>{d()}},{label:g(`Open Workbench`,`بازکردن میزکار`),icon:Ye,onSelect:()=>{window.location.hash=`#/workbench`}}],children:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsxs)(`div`,{className:`telemetry-chart__empty`,role:`status`,children:[(0,q.jsx)(p,{size:22}),(0,q.jsx)(`span`,{children:s===`fa`?`در حال آماده‌سازی نمودار…`:`Preparing chart…`})]}),children:(0,q.jsx)(Jt,{connected:!0,locale:s,samples:a,reduceMotion:e.reduceMotion})})})),v&&x.relays&&H(`outputs`,c(`outputs`),(0,q.jsxs)(T,{icon:St,iconTone:P?`amber`:`green`,title:c(`outputs`),eyebrow:`R1—R8`,className:`outputs-card`,action:(0,q.jsx)(I,{tone:_.active_relays?`warn`:`neutral`,children:_.active_relays?`${P} ${g(`ACTIVE`,`فعال`)}`:g(`SAFE`,`ایمن`)}),menu:[{label:g(`Read controller status`,`خواندن وضعیت کنترلر`),icon:r,onSelect:()=>{u(`status`)}},{label:g(`Release every output`,`آزادسازی همهٔ خروجی‌ها`),icon:Ue,tone:`danger`,onSelect:()=>h({tone:`danger`,title:c(`confirmEmergencyTitle`),body:c(`confirmEmergencyBody`),confirmLabel:c(`emergencyOff`),action:async()=>{await u(`relay off`),await u(`pwm off`)}})}],children:[(0,q.jsx)(`div`,{className:`output-matrix`,children:Array.from({length:8},(e,t)=>{let n=!!(_.active_relays&1<void u(`relay ${t+1} ${n?`off`:`on`}`,g(`R${t+1} ${n?`off`:`on`}`,`رلهٔ ${t+1} ${n?`خاموش`:`روشن`} شد`)),"aria-pressed":n,children:[(0,q.jsxs)(`span`,{children:[`R`,t+1,` · `,B(`relay.${t+1}`,Ce[t])]}),(0,q.jsx)(`strong`,{children:c(n?`on`:`off`)}),(0,q.jsx)(`i`,{"aria-hidden":`true`})]},t)})}),(0,q.jsxs)(`div`,{className:`safety-strip`,children:[(0,q.jsx)(U,{size:17}),(0,q.jsx)(`span`,{children:P?g(`${P} outputs active · confirmation required for emergency release`,`${P} خروجی فعال است · آزادسازی اضطراری به تأیید نیاز دارد`):g(`All physical outputs are released`,`همهٔ خروجی‌های فیزیکی آزاد هستند`)})]})]})),v&&H(`overview`,c(`status`),(0,q.jsx)(T,{icon:r,iconTone:`green`,title:c(`status`),eyebrow:c(`device`),className:`device-card`,menu:[{label:g(`Read identity`,`خواندن شناسه`),icon:m,onSelect:()=>{u(`hello`)}},{label:g(`Open controller controls`,`بازکردن کنترل‌های برد`),icon:rt,onSelect:()=>{window.location.hash=`#/controls`}}],children:(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:c(`device`),value:i.port.friendly_name||i.port.name||`—`}),(0,q.jsx)(w,{label:c(`firmware`),value:i.hello.build_timestamp||N,mono:!0}),(0,q.jsx)(w,{label:c(`door`),value:_.door_open?c(`open`):c(`closed`),tone:_.door_open?`warn`:`good`}),x.bluetoothAudio&&(0,q.jsx)(w,{label:c(`bluetooth`),value:_.bluetooth_audio_state===2?c(`online`):_.bluetooth_audio_state===1?c(`connecting`):c(`offline`)}),(0,q.jsx)(w,{label:g(`UART CRC / framing`,`CRC / قاب‌بندی UART`),value:`${_.crc_errors} / ${_.framing_errors}`,mono:!0,tone:_.crc_errors||_.framing_errors?`warn`:`good`}),(0,q.jsx)(w,{label:g(`Reset count`,`تعداد بازنشانی`),value:_.reset_count,mono:!0})]})})),v&&H(`actions`,c(`quickActions`),(0,q.jsx)(T,{icon:wt,iconTone:`amber`,title:c(`quickActions`),eyebrow:g(`Confirmation protected`,`محافظت‌شده با تأیید`),className:`actions-card`,children:(0,q.jsxs)(`div`,{className:`action-grid`,children:[(0,q.jsx)(l,{icon:mt,tone:`danger`,onClick:()=>void u(`estop ${i.emergency_stop?.active?`off`:`on`}`),children:i.emergency_stop?.active?g(`Release E-STOP`,`آزادسازی توقف اضطراری`):g(`Engage E-STOP`,`فعال‌سازی توقف اضطراری`)}),(0,q.jsx)(l,{icon:r,onClick:()=>void u(`status`),children:g(`Read status`,`خواندن وضعیت`)}),x.statusLED&&(0,q.jsx)(l,{icon:y,onClick:()=>void u(`rgb effect play attention`),children:g(`Attention cue`,`اعلان توجه`)})]})})),v&&H(`events`,c(`events`),(0,q.jsx)(T,{icon:p,iconTone:`violet`,title:c(`events`),eyebrow:o.length?`${xe(s,o[0].time)} · ${o[0].kind}`:c(`eventStream`),className:`activity-card`,action:(0,q.jsx)(`span`,{className:`count-chip`,children:o.length}),menu:[{label:g(`Open full timeline`,`بازکردن خط زمانی کامل`),icon:p,onSelect:()=>{window.location.hash=`#/events`}},{label:g(`Refresh snapshot`,`تازه‌سازی وضعیت`),icon:De,onSelect:()=>{d()}}],children:(0,q.jsx)(Dt,{events:o,locale:s,t:c})}))]})]})}function tn(e){let{snapshot:t,locale:n,t:r,command:i,openDialog:a}=e,o=(e,t)=>n===`fa`?t:e,s=e.transport.boardState===`ready`&&t.connected&&t.have_status,c=M(t),u=!!t.emergency_stop?.active,d=()=>Array.from({length:16},(e,n)=>n===t.status.pwm_channel?t.status.pwm_value:0),[p,m]=(0,K.useState)(d),[h,g]=(0,K.useState)(d),[v,b]=(0,K.useState)(!1),[x,ee]=(0,K.useState)([]),[S,C]=(0,K.useState)(``),[w,E]=(0,K.useState)(!1),[O,k]=(0,K.useState)(null),te=(0,K.useRef)({}),[j,re]=(0,K.useState)(25),[ie,se]=(0,K.useState)(130),[ce,le]=(0,K.useState)(220),[P,fe]=(0,K.useState)(190),[me,he]=(0,K.useState)(`#000000`),[R,z]=(0,K.useState)(`color`),[ge,ve]=(0,K.useState)(1600),[ye,be]=(0,K.useState)(8),[xe,Se]=(0,K.useState)(`loop`),[B,Ce]=(0,K.useState)(`ready`),we=e.events.find(e=>e.kind===`config`)?.id??0,Te=(0,K.useRef)(p),Ee=(0,K.useRef)(0),Oe=(0,K.useRef)(``),ke=`${t.host_instance_id}/${t.connection_generation}`;Oe.current!==ke&&(Oe.current=ke,Ee.current=0);let Ae=(0,K.useRef)(w),je=(0,K.useRef)(null),V=(0,K.useRef)(null),Me=`#${[j,ie,ce].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase(),H=t.have_status_led?t.status_led:void 0,Pe=H?`#${[H.red,H.green,H.blue].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase():`#000000`,Fe=`${R===`color`?``:` --period ${ge} --minimum ${ye} --repeat ${xe}`}${R===`flash`||R===`cycle`||R===`transition`?` --to "${me}"`:``}`,Le=R===`color`?`rgb color "${Me}" ${P}`:`rgb effect ${R} "${Me}" --brightness ${P}${Fe}`,Re=R===`color`?`rgb profile set ${B} color "${Me}" ${P}`:`rgb profile set ${B} ${R} "${Me}" --brightness ${P}${Fe}`;je.current||=new N,te.current=O?.pwm_channels??{};let Be=e=>te.current[`pwm.${e}`],Ve=(e,t=null)=>{if(e.revision!==void 0&&e.revisione.map((e,r)=>V.current?.isEditing(r)?e:r===t?n.values[r]:V.current?.pendingChannels().includes(r)?e:n.values[r])),C(``),b(!0)):C(`PWM unavailable`)};V.current||=new A({operations:je.current,commit:(e,t)=>f(`controller.pwm.set`,{channel:e,raw_value:t}),onDraft:(e,t)=>{C(``),g(n=>n.map((n,r)=>r===e?t:n))},onAuthoritative:Ve,onPending:e=>ee([...e]),onError:(e,t,n)=>{C(t.message),n&&g(t=>t.map((t,n)=>n===e?Te.current[e]:t))}}),(0,K.useEffect)(()=>()=>V.current?.dispose(),[]),(0,K.useEffect)(()=>{if(!s){k(null);return}let e=!0;return f(`controller.ui.config.get`).then(t=>{e&&k(t)}).catch(()=>{e&&k(null)}),()=>{e=!1}},[s,we,e.events.find(e=>e.kind===`peripherals.changed`)?.id,t.port.name]),(0,K.useEffect)(()=>{if(!s||!c.pwm){b(!1);return}C(``);let t=new _e({eventDriven:e.transport.streamState===`open`,operations:je.current,canRead:()=>!Ae.current&&(V.current?.pendingChannels().length??0)===0,read:e=>f(`controller.pwm.values`,{},e),onAuthoritative:e=>Ve(e),onError:e=>C(e.message)});return t.start(),()=>t.stop()},[c.pwm,s,e.transport.streamState]),(0,K.useEffect)(()=>{s&&t.pwm_values&&Ve(t.pwm_values)},[s,t.pwm_revision,t.pwm_values,x.length]),(0,K.useEffect)(()=>{if(!e.focusControl||!s||!O)return;let t=[...document.querySelectorAll(`[data-control-key]`)].find(t=>t.dataset.controlKey===e.focusControl?.key);t?.scrollIntoView({block:`center`,behavior:e.reduceMotion?`auto`:`smooth`}),t?.focus({preventScroll:!0})},[e.focusControl,s,O]);let He=[`MOSFET 1`,`MOSFET 2`,`MOSFET 3`,`MOSFET 4`,`MOSFET 5`,`MOSFET 6`,`MOSFET 7`,`MOSFET 8`,o(`User PWM 9`,`PWM کاربر ۹`),o(`User PWM 10`,`PWM کاربر ۱۰`),o(`User PWM 11`,`PWM کاربر ۱۱`),o(`Enclosure light`,`نور محفظه`),o(`Power indicator`,`نشانگر توان`),o(`Status red`,`وضعیت قرمز`),o(`Status green`,`وضعیت سبز`),o(`Status blue`,`وضعیت آبی`)],Ke=[o(`Side A direction`,`جهت سمت A`),o(`Side A output`,`خروجی سمت A`),o(`Side B direction`,`جهت سمت B`),o(`Side B output`,`خروجی سمت B`),o(`User relay 5`,`رلهٔ کاربر ۵`),o(`User relay 6`,`رلهٔ کاربر ۶`),o(`User relay 7`,`رلهٔ کاربر ۷`),o(`User relay 8`,`رلهٔ کاربر ۸`)],qe=(e,t)=>qt(O?.controls,e,O?.peripheral_names?.[e]?.trim()||t),Je=e=>qe(`pwm.${e}`,He[e]),U=(e,t,n=!1)=>{V.current?.schedule(e,de(t,Be(e)),n)},Ye=async(e,t)=>{if(Be(e)){C(``);try{await f(`controller.pwm.channel.configure`,{channel:e,...t});let n=await f(`controller.ui.config.get`);k(n),Ve(await je.current.run(()=>f(`controller.pwm.values`)))}catch(e){C(e instanceof Error?e.message:String(e))}}},Xe=async(e,t)=>{if(!(V.current?.pendingChannels().length||Ae.current)){Ae.current=!0,E(!0),C(``);try{let n=await je.current.run(()=>f(`controller.control.invoke`,{action_id:`pwm.${e}.${t}`}));Ve(n.pwm)}catch(e){C(e instanceof Error?e.message:String(e))}finally{Ae.current=!1,E(!1)}}},Ze=async()=>{if(!x.length){Ae.current=!0,E(!0),C(``);try{Ve(await je.current.run(()=>f(`controller.pwm.off`)))}catch(e){C(e instanceof Error?e.message:String(e))}finally{Ae.current=!1,E(!1)}}};if(!s){let a=e.transport.streamState===`connecting`,s=e.transport.streamState!==`open`,c=a?`connecting`:s?`transport-offline`:`board-offline`,l=oe(t,n),u=a?o(`Connecting…`,`در حال اتصال…`):s?o(`Reconnecting…`,`در حال اتصال دوباره…`):l.title;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:o(`Controller board controls`,`کنترل‌های برد`),title:r(`controls`),detail:s?void 0:t.connection_reason}),(0,q.jsx)(T,{icon:s?Ne:Ge,iconTone:`amber`,title:u,eyebrow:a?o(`Reconnecting`,`اتصال دوباره`):o(`Connection`,`اتصال`),children:s?(0,q.jsx)(Qt,{state:c,locale:n,showTitle:!1}):(0,q.jsx)($t,{snapshot:t,locale:n,reconnect:()=>void i(`reconnect`,l.action),hardwareReset:D(t)?()=>void i(`reset lines`,o(`Hardware reset sent`,`بازنشانی سخت‌افزاری ارسال شد`)):void 0})})]})}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:o(`Connected controller`,`کنترلر متصل`),title:r(`controls`),detail:Yt(t,e.appTitle,n)}),(0,q.jsxs)(`div`,{className:`safety-strip controller-estop${u?` is-danger`:``}`,role:`status`,"aria-live":`assertive`,children:[(0,q.jsx)(mt,{size:17}),(0,q.jsx)(`span`,{children:u?o(`E-STOP locked · effects, motion, relay-on, and PWM output are blocked`,`توقف اضطراری قفل است · افکت‌ها، حرکت، روشن‌کردن رله و خروجی PWM مسدود هستند`):o(`E-STOP ready`,`توقف اضطراری آماده است`)}),(0,q.jsx)(l,{compact:!0,tone:`danger`,onClick:()=>void i(`estop ${u?`off`:`on`}`),children:u?o(`Release`,`آزادسازی`):o(`Engage`,`فعال‌سازی`)})]}),(0,q.jsxs)(`section`,{className:`control-layout`,children:[c.relays&&(0,q.jsxs)(T,{icon:rt,iconTone:t.status.active_relays?`amber`:`green`,eyebrow:o(`Eight protected outputs`,`هشت خروجی محافظت‌شده`),title:o(`Relays & motion`,`رله‌ها و حرکت`),className:`relay-control-card`,action:(0,q.jsx)(I,{tone:t.status.active_relays?`warn`:`good`,children:t.status.active_relays?o(`ENERGIZED`,`برقدار`):o(`RELEASED`,`آزاد`)}),menu:[{label:o(`Refresh output state`,`تازه‌سازی وضعیت خروجی‌ها`),icon:De,onSelect:()=>{i(`status`)}},{label:o(`Release every relay`,`آزادسازی همهٔ رله‌ها`),icon:Ue,tone:`danger`,onSelect:()=>a({tone:`danger`,title:r(`confirmEmergencyTitle`),body:r(`confirmEmergencyBody`),confirmLabel:r(`emergencyOff`),action:async()=>{await i(`relay off`)}})}],children:[(0,q.jsx)(`div`,{className:`relay-bank`,children:Array.from({length:8},(e,n)=>{let a=!!(t.status.active_relays&1<void i(`relay ${n+1} ${a?`off`:`on`}`)}),(0,q.jsx)(`small`,{children:qe(`relay.${n+1}`,Ke[n])}),(0,q.jsxs)(`div`,{className:`relay-switch__actions`,children:[(0,q.jsx)(l,{compact:!0,disabled:a||u,onClick:()=>void i(`relay ${n+1} on`),children:r(`on`)}),(0,q.jsx)(l,{compact:!0,disabled:!a,onClick:()=>void i(`relay ${n+1} off`),children:r(`off`)})]})]},n)})}),(0,q.jsx)(`div`,{className:`motion-actions`,children:[`left`,`right`].map(e=>{let n=t.motion?.[e],r=Kt(n),a=r===`up`?o(`UP`,`بالا`):r===`down`?o(`DOWN`,`پایین`):r===`stop`?o(`STOPPED`,`متوقف`):o(`UNKNOWN`,`نامشخص`);return(0,q.jsxs)(`div`,{className:`motion-side`,"data-control-key":e===`left`?`seat.a`:`seat.b`,tabIndex:-1,children:[(0,q.jsxs)(`div`,{className:`motion-side__identity`,children:[(0,q.jsx)(`strong`,{children:e===`left`?qe(`seat.a`,o(`Side A motion`,`حرکت سمت A`)):qe(`seat.b`,o(`Side B motion`,`حرکت سمت B`))}),(0,q.jsx)(I,{tone:r===`unknown`?`neutral`:r===`stop`?`good`:n?.transitioning?`warn`:`info`,pulse:n?.transitioning,children:n?.transitioning?`${a} · ${o(`SYNCING`,`همگام‌سازی`)}`:a})]}),(0,q.jsxs)(`div`,{className:`motion-side__actions`,children:[(0,q.jsx)(_,{compact:!0,disabled:u,onHoldStart:()=>i(`relay side ${e} up`),onHoldStop:()=>i(`relay side ${e} stop`),children:o(`Hold Up`,`بالا نگه‌دار`)}),(0,q.jsx)(l,{compact:!0,onClick:()=>void i(`relay side ${e} stop`),children:o(`Stop`,`توقف`)}),(0,q.jsx)(_,{compact:!0,disabled:u,onHoldStart:()=>i(`relay side ${e} down`),onHoldStop:()=>i(`relay side ${e} stop`),children:o(`Hold Down`,`پایین نگه‌دار`)})]})]},e)})}),(0,q.jsx)(l,{icon:mt,tone:`danger`,onClick:()=>a({tone:`danger`,title:r(`confirmEmergencyTitle`),body:r(`confirmEmergencyBody`),confirmLabel:r(`emergencyOff`),action:async()=>{await i(`relay off`)}}),children:r(`emergencyOff`)})]}),c.pwm&&(0,q.jsxs)(T,{icon:Ie,iconTone:`violet`,eyebrow:o(`11 user channels · acknowledged writes`,`۱۱ کانال کاربر · نوشتن با تأیید`),title:o(`PWM mixer`,`میکسر PWM`),className:`pwm-card`,action:(0,q.jsx)(I,{tone:S?`bad`:x.length?`warn`:v?`good`:`neutral`,children:S?o(`ERROR`,`خطا`):x.length?o(`SYNCING`,`همگام‌سازی`):v?o(`CONFIRMED`,`تأییدشده`):o(`READING`,`در حال خواندن`)}),children:[(0,q.jsx)(`div`,{className:`pwm-mixer`,children:ne.map(e=>{let n=p[e],i=h[e],a=x.includes(e),s=Je(e),c=Be(e);return(0,q.jsxs)(`div`,{"data-control-key":`pwm.${e}`,tabIndex:-1,className:`pwm-mixer__row${t.status.pwm_channel===e&&!a?` is-live`:``}${a?` is-pending`:``}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`strong`,{children:[c?.icon===`lightbulb`?`💡 `:c?.output_type===`motor`?`⚙️ `:``,s]}),(0,q.jsx)(`small`,{children:s===He[e]?`pwm.${e}`:`${He[e]} · pwm.${e}`}),(0,q.jsx)(`small`,{children:a?o(`Board ${n} · draft ${i}`,`برد ${n} · پیش‌نویس ${i}`):o(`${pe(n,c)}% brightness · raw ${n}`,`${pe(n,c)}٪ روشنایی · خام ${n}`)}),(0,q.jsxs)(`div`,{className:`pwm-channel-config`,children:[(0,q.jsxs)(`select`,{"aria-label":o(`${s} output type`,`نوع خروجی ${s}`),value:c?.output_type??`general`,onChange:t=>void Ye(e,{output_type:t.target.value,icon:t.target.value===`lighting`?`lightbulb`:t.target.value===`indicator`?`led`:t.target.value===`motor`?`settings`:`sliders-horizontal`}),children:[(0,q.jsx)(`option`,{value:`lighting`,children:o(`Lighting`,`روشنایی`)}),(0,q.jsx)(`option`,{value:`indicator`,children:o(`LED indicator`,`نشانگر LED`)}),(0,q.jsx)(`option`,{value:`motor`,children:o(`Motor`,`موتور`)}),(0,q.jsx)(`option`,{value:`general`,children:o(`General PWM`,`PWM عمومی`)})]}),(0,q.jsxs)(`select`,{"aria-label":o(`${s} response curve`,`منحنی پاسخ ${s}`),value:c?.curve??`linear`,onChange:t=>void Ye(e,{curve:t.target.value,gamma:t.target.value===`linear`?1:c?.gamma===1?2.2:c?.gamma??2.2}),children:[(0,q.jsx)(`option`,{value:`gamma`,children:o(`Perceptual`,`ادراکی`)}),(0,q.jsx)(`option`,{value:`linear`,children:o(`Linear`,`خطی`)})]}),c?.on_behavior&&(0,q.jsxs)(`select`,{"aria-label":o(`${s} On behavior`,`رفتار روشن شدن ${s}`),value:c.on_behavior,disabled:a||w,onChange:t=>void Ye(e,{on_behavior:t.target.value}),children:[(0,q.jsx)(`option`,{value:`full`,children:o(`On: full brightness`,`روشن: نور کامل`)}),(0,q.jsx)(`option`,{value:`restore`,children:o(`On: last brightness`,`روشن: آخرین روشنایی`)})]})]})]}),(0,q.jsx)(F,{label:o(`${s} brightness`,`روشنایی ${s}`),value:pe(i,c),min:0,max:100,step:.1,unit:`%`,disabled:!v||w||u||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked,onEditStart:()=>V.current?.beginEdit(e),onEditEnd:()=>V.current?.endEdit(e),onChange:t=>U(e,t)}),(0,q.jsxs)(`div`,{className:`pwm-mixer__actions`,children:[(0,q.jsx)(l,{compact:!0,disabled:!v||w||a||n===0||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked,onClick:()=>void Xe(e,`off`),children:r(`off`)}),(0,q.jsx)(l,{compact:!0,disabled:!v||w||a||u||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked||(c?.on_behavior===`restore`?n>0:n===4095),onClick:()=>void Xe(e,`on`),children:r(`on`)})]}),c?.curve===`gamma`&&(0,q.jsx)(F,{label:o(`Curve strength`,`شدت منحنی`),value:c.gamma,min:.1,max:5,step:.1,disabled:w,onChange:t=>void Ye(e,{gamma:t})})]},e)})}),(0,q.jsx)(`div`,{className:`system-output-summary`,"aria-label":o(`Role-specific system PWM channels`,`کانال‌های PWM سیستمی با کنترل اختصاصی`),children:[11,12,13,14,15].map(e=>(0,q.jsxs)(`span`,{"data-control-key":`pwm.${e}`,tabIndex:-1,children:[(0,q.jsx)(`strong`,{children:Je(e)}),(0,q.jsxs)(`small`,{children:[p[e],` / 4095`]})]},e))}),(0,q.jsx)(`div`,{className:`pwm-authority-status${S?` is-error`:``}`,role:`status`,"aria-live":`polite`,children:S||(x.length?o(`${x.length} channel${x.length===1?``:`s`} waiting for controller acknowledgement.`,`${x.length} کانال در انتظار تأیید کنترلر است.`):v?o(`Every displayed board value is authoritative; sliders are separate local drafts until acknowledged.`,`همهٔ مقادیر برد معتبرند؛ لغزنده‌ها تا زمان تأیید، پیش‌نویس محلی جداگانه‌اند.`):o(`Reading the complete 16-channel state from the controller…`,`در حال خواندن وضعیت کامل ۱۶ کانال از کنترلر…`))}),(0,q.jsx)(l,{icon:vt,busy:w,disabled:!v||w||x.length>0,onClick:()=>void Ze(),children:o(`Clear all PWM channels`,`پاک‌کردن همهٔ کانال‌های PWM`)})]}),c.statusLED&&(0,q.jsxs)(T,{icon:y,iconTone:`amber`,eyebrow:o(`Color and effects`,`رنگ و افکت‌ها`),title:o(`Status lighting`,`نور وضعیت`),className:`rgb-card`,children:[(0,q.jsxs)(`div`,{className:`status-led-previews`,children:[(0,q.jsxs)(`div`,{className:`color-preview`,style:{"--preview":Me},children:[(0,q.jsx)(`span`,{}),(0,q.jsxs)(`strong`,{children:[o(`Selected`,`انتخاب‌شده`),` · `,Me,` · RGB `,j,` `,ie,` `,ce]})]}),(0,q.jsxs)(`div`,{className:`status-led-live`,style:{"--preview":Pe},children:[(0,q.jsx)(`i`,{"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:o(`Physical LED mirror`,`بازتاب LED فیزیکی`)}),(0,q.jsx)(`small`,{dir:`ltr`,children:H?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mono`,children:Pe}),` · effect ${H.effect} · condition ${H.condition}`]}):o(`Awaiting pushed board state`,`در انتظار وضعیت ارسالی برد`)})]})]})]}),(0,q.jsxs)(`label`,{className:`native-color-field`,children:[(0,q.jsx)(`span`,{children:o(`Color picker`,`انتخاب‌گر رنگ`)}),(0,q.jsx)(`input`,{type:`color`,value:Me,"aria-label":o(`Status LED color`,`رنگ LED وضعیت`),onChange:e=>{let t=e.target.value;re(Number.parseInt(t.slice(1,3),16)),se(Number.parseInt(t.slice(3,5),16)),le(Number.parseInt(t.slice(5,7),16))}}),(0,q.jsx)(`code`,{children:Me})]}),v&&(0,q.jsxs)(`div`,{className:`rgb-board-state`,children:[(0,q.jsx)(`span`,{children:o(`Board-reported PWM`,`PWM گزارش‌شدهٔ برد`)}),(0,q.jsxs)(`strong`,{dir:`ltr`,children:[p[13],` · `,p[14],` · `,p[15]]})]}),(0,q.jsx)(F,{label:o(`Red`,`قرمز`),value:j,min:0,max:255,onChange:re}),(0,q.jsx)(F,{label:o(`Green`,`سبز`),value:ie,min:0,max:255,onChange:se}),(0,q.jsx)(F,{label:o(`Blue`,`آبی`),value:ce,min:0,max:255,onChange:le}),(0,q.jsx)(F,{label:o(`Brightness`,`روشنایی`),value:P,min:0,max:255,onChange:e=>{fe(e),be(t=>Math.min(t,e))}}),(0,q.jsxs)(`div`,{className:`rgb-effect-fields`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Presentation`,`نحوه نمایش`)}),(0,q.jsxs)(`select`,{value:R,onChange:e=>z(e.target.value),children:[(0,q.jsx)(`option`,{value:`color`,children:o(`Steady color`,`رنگ ثابت`)}),(0,q.jsx)(`option`,{value:`breathe`,children:o(`Breathe`,`تنفس`)}),(0,q.jsx)(`option`,{value:`flash`,children:o(`Flash`,`چشمک`)}),(0,q.jsx)(`option`,{value:`cycle`,children:o(`Two-color cycle`,`چرخه دو رنگ`)}),(0,q.jsx)(`option`,{value:`transition`,children:o(`Transition`,`گذار`)})]})]}),R!==`color`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Period`,`دوره`)}),(0,q.jsx)(`input`,{type:`number`,min:640,max:6e4,value:ge,onChange:e=>ve(Math.max(640,Math.min(6e4,Number(e.target.value))))}),(0,q.jsx)(`small`,{children:`ms`})]}),(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Repeat`,`تکرار`)}),(0,q.jsxs)(`select`,{value:xe,onChange:e=>Se(e.target.value),children:[(0,q.jsx)(`option`,{value:`once`,children:o(`Once`,`یک‌بار`)}),(0,q.jsx)(`option`,{value:`loop`,children:o(`Loop`,`پیوسته`)})]})]})]}),R===`breathe`&&(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Minimum brightness`,`حداقل روشنایی`)}),(0,q.jsx)(`input`,{type:`number`,min:0,max:P,value:ye,onChange:e=>be(Math.max(0,Math.min(P,Number(e.target.value))))})]}),(R===`flash`||R===`cycle`||R===`transition`)&&(0,q.jsxs)(`label`,{className:`native-color-field native-color-field--compact`,children:[(0,q.jsx)(`span`,{children:o(`Second color`,`رنگ دوم`)}),(0,q.jsx)(`input`,{type:`color`,value:me,onChange:e=>he(e.target.value.toUpperCase())}),(0,q.jsx)(`code`,{children:me})]})]}),(0,q.jsxs)(`div`,{className:`inline-actions`,children:[(0,q.jsx)(l,{tone:`primary`,icon:ze,disabled:!t.connected,onClick:()=>void i(Le),children:o(`Apply live`,`اعمال زنده`)}),(0,q.jsx)(l,{disabled:!t.connected,onClick:()=>void i(`rgb effect stop`),children:o(`Stop effect`,`توقف افکت`)})]}),(0,q.jsxs)(`div`,{className:`rgb-profile-row`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`EEPROM condition`,`شرط EEPROM`)}),(0,q.jsx)(`select`,{value:B,onChange:e=>Ce(e.target.value),children:[`off`,`boot`,`ready`,`learning`,`hot`,`fault`,`custom`,`bluetooth-connected`,`bluetooth-off`,`bluetooth-waiting`,`running`,`door-open`,`door-closed`,`bluetooth`,`menu`,`radio`,`save`,`discard`,`reset`].map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),(0,q.jsx)(l,{icon:We,disabled:!t.connected,onClick:()=>void i(Re),children:o(`Save profile (live when active)`,`ذخیره پروفایل (هنگام فعال‌شدن زنده)`)})]})]})]})]})}var nn=[`capabilities`,`snapshot`];function rn(e){return e.http_reachable===!0}function an(e){return e.configured===!0&&!rn(e)}function on({locale:e,t}){let n=(t,n)=>e===`fa`?n:t,[r,i]=(0,K.useState)({power:`unknown`,phase:`idle`}),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[u,d]=(0,K.useState)(null),[p,h]=(0,K.useState)(`capabilities`),[g,_]=(0,K.useState)(``),v=async()=>{try{i(await f(`controller.device.status`)),_(``)}catch(e){_(e instanceof Error?e.message:String(e))}};(0,K.useEffect)(()=>{v();let e=window.setInterval(()=>void v(),3e3);return()=>window.clearInterval(e)},[]);let y=async(t,n=``,a=0)=>{if(t!==`passive.refresh`&&!rn(r))_(e===`fa`?`ارتباط HTTP وسیله در دسترس نیست.`:`The device HTTP command transport is unavailable.`);else{o(t);try{i(await f(`controller.device.action`,{action:t,text:n,count:a})),_(``),t===`display.message`&&c(``)}catch(e){_(e instanceof Error?e.message:String(e))}finally{o(``)}}},b=async()=>{if(!rn(r))_(e===`fa`?`برای بازرسی، ارتباط HTTP لازم است.`:`Inspection requires the device HTTP transport.`);else{o(`inspect`);try{d(await f(`controller.device.inspect`,{resource:p})),_(``)}catch(e){_(e instanceof Error?e.message:String(e))}finally{o(``)}}},x=r.power?.toUpperCase(),ee=x===`ON`,S=rn(r),C=an(r),D=r.configured===!1?e===`fa`?`یکپارچه‌سازی وسیله غیرفعال است`:`Local device integration is disabled`:r.events_online?e===`fa`?`مسیر فرمان HTTP در دسترس نیست`:`HTTP command transport is unavailable`:r.configured?e===`fa`?`وسیلهٔ محلی در دسترس نیست`:`Local companion is unreachable`:g?e===`fa`?`وضعیت وسیله دریافت نشد`:`Companion status is unavailable`:e===`fa`?`در حال بررسی وسیلهٔ محلی`:`Checking local companion availability`,k=r.last_error||g||(r.configured===!1?e===`fa`?`نشانی و فعال‌سازی را در تنظیمات خدمات محلی بررسی کنید.`:`Choose a private-network endpoint and enable it in local-service settings.`:e===`fa`?`وضعیت فعلی: ${r.phase||`نامشخص`}`:`Current phase: ${r.phase||`unknown`}`),A=[{label:e===`fa`?`تازه‌سازی وضعیت`:`Refresh device status`,icon:De,onSelect:()=>{v()}},...C?[{label:e===`fa`?`تلاش دوباره برای اتصال`:`Retry companion connection`,icon:gt,onSelect:()=>{y(`passive.refresh`)}}]:[],...S?[{label:ee?e===`fa`?`خاموش‌کردن وسیله`:`Turn device off`:e===`fa`?`روشن‌کردن وسیله`:`Turn device on`,icon:tt,onSelect:()=>{y(ee?`power.off`:`power.on`)}}]:[]];return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:`${n(`Local companion`,`وسیلهٔ محلی`)} · ${r.phase||`idle`}`,title:r.name||t(`device`),detail:r.base_url||n(`Typed local-network companion through the primary host`,`وسیلهٔ شبکهٔ محلی با قرارداد مشخص، از طریق میزبان اصلی`),action:(0,q.jsx)(I,{tone:r.events_online?`good`:r.http_reachable?`warn`:`bad`,pulse:r.phase===`connecting`,children:r.events_online?n(`EVENT STREAM`,`جریان رویداد`):r.http_reachable?`HTTP`:t(`offline`)})}),(0,q.jsxs)(`section`,{className:`device-layout`,children:[(0,q.jsxs)(T,{icon:m,iconTone:ee?`green`:`amber`,title:n(`Local device`,`وسیلهٔ محلی`),eyebrow:r.events_online?n(`Events connected`,`رویدادها متصل‌اند`):r.http_reachable?n(`HTTP reachable`,`HTTP در دسترس`):n(`Unavailable`,`دردسترس نیست`),className:`device-stage${ee?` is-on`:``}`,menu:A,children:[(0,q.jsxs)(`div`,{className:`device-overview`,"aria-label":n(`Device power ${r.power??`unknown`}`,`توان وسیله ${r.power??`نامشخص`}`),children:[(0,q.jsxs)(`div`,{className:`device-overview__mark`,children:[(0,q.jsx)(m,{size:38}),(0,q.jsx)(`span`,{"aria-hidden":`true`})]}),(0,q.jsxs)(`div`,{className:`device-overview__copy`,children:[(0,q.jsx)(`span`,{children:r.base_url||n(`Host-mediated local connection`,`اتصال محلی با میانجی‌گری میزبان`)}),(0,q.jsx)(`strong`,{children:ee?n(`Device is powered on`,`وسیله روشن است`):x===`OFF`?n(`Device is powered off`,`وسیله خاموش است`):n(`Power state is unknown`,`وضعیت توان نامشخص است`)}),(0,q.jsx)(`small`,{children:r.last_event||r.last_error||(r.phase?`${n(`Phase`,`مرحله`)}: ${r.phase}`:n(`No device event received`,`رویدادی از وسیله دریافت نشده است`))})]})]}),(0,q.jsxs)(`div`,{className:`device-facts`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:t(`status`)}),(0,q.jsx)(`strong`,{children:r.power??t(`unknown`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:n(`Transport`,`رسانهٔ ارتباطی`)}),(0,q.jsx)(`strong`,{children:r.events_online?n(`Events`,`رویدادها`):r.http_reachable?`HTTP`:t(`offline`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:n(`Updated`,`آخرین تغییر`)}),(0,q.jsx)(`strong`,{children:r.updated_at?xe(e,r.updated_at):`—`})]})]}),S?(0,q.jsxs)(`div`,{className:`device-actions`,children:[(0,q.jsx)(l,{tone:`success`,icon:se,busy:a===`power.on`,onClick:()=>void y(`power.on`),children:t(`on`)}),(0,q.jsx)(l,{tone:`secondary`,icon:te,busy:a===`power.off`,onClick:()=>void y(`power.off`),children:t(`off`)}),(0,q.jsx)(l,{tone:`primary`,icon:tt,busy:a===`power.toggle`,onClick:()=>void y(`power.toggle`),children:t(`toggle`)})]}):(0,q.jsx)(E,{icon:r.configured===!1?O:Ue,title:D,detail:k,action:(0,q.jsxs)(`div`,{className:`device-unavailable__actions`,children:[C&&(0,q.jsx)(l,{compact:!0,tone:`primary`,icon:gt,busy:a===`passive.refresh`,onClick:()=>void y(`passive.refresh`),children:e===`fa`?`تلاش دوباره`:`Retry connection`}),(0,q.jsx)(l,{compact:!0,icon:De,busy:a===`status`,onClick:()=>void v(),children:e===`fa`?`تازه‌سازی وضعیت`:`Refresh status`}),r.configured!==!0&&(0,q.jsx)(l,{compact:!0,icon:O,onClick:()=>{window.location.hash=`#/settings`},children:e===`fa`?`تنظیم یکپارچه‌سازی`:`Open integration settings`})]})}),(0,q.jsx)(ve,{initial:!1,children:g&&(0,q.jsx)(P.div,{className:`inline-error-presence`,initial:{height:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(4px)`},animate:{height:`auto`,opacity:1,clipPath:`inset(0 0 0% 0)`,filter:`blur(0px)`},exit:{height:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(3px)`},transition:{duration:.28,ease:[.22,1,.36,1]},children:(0,q.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,q.jsx)(mt,{size:17}),(0,q.jsx)(`span`,{children:g})]})},`local-device-error`)})]}),(0,q.jsxs)(`div`,{className:`device-side`,children:[S&&(0,q.jsxs)(T,{icon:G,iconTone:`violet`,title:t(`message`),eyebrow:s.length?n(`${s.length} characters`,`${s.length} نویسه`):n(`No message entered`,`پیامی وارد نشده`),action:(0,q.jsx)(I,{tone:`info`,children:n(`LOCAL DEVICE`,`وسیلهٔ محلی`)}),children:[(0,q.jsxs)(`div`,{className:`message-compose`,children:[(0,q.jsx)(`input`,{value:s,maxLength:256,placeholder:n(`A bounded display message`,`پیام کوتاه برای نمایش`),onChange:e=>c(e.target.value)}),(0,q.jsx)(l,{icon:Je,tone:`primary`,busy:a===`display.message`,disabled:!s.trim(),onClick:()=>void y(`display.message`,s.trim()),children:t(`send`)})]}),(0,q.jsxs)(`div`,{className:`beep-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(fe,{size:18}),(0,q.jsxs)(`span`,{children:[t(`beep`),` · `,n(`explicit alert pulse`,`پالس هشدار صریح`)]})]}),[1,2,3].map(e=>(0,q.jsxs)(l,{compact:!0,busy:a===`alert.pulse`,onClick:()=>void y(`alert.pulse`,``,e),children:[e,`×`]},e))]})]}),S&&(0,q.jsxs)(T,{icon:Te,iconTone:`accent`,title:t(`diagnostics`),eyebrow:u?n(`Inspection loaded`,`بازرسی بارگیری شد`):n(`Not inspected`,`بازرسی نشده`),action:(0,q.jsx)(l,{icon:De,compact:!0,busy:a===`inspect`,onClick:()=>void b(),children:t(`fetch`)}),children:[(0,q.jsx)(`div`,{className:`diagnostic-picker`,children:nn.map(e=>(0,q.jsx)(`button`,{className:p===e?`is-active`:``,onClick:()=>h(e),dir:`ltr`,children:e},e))}),u!==null&&(0,q.jsx)(`pre`,{className:`diagnostic-output`,dir:`ltr`,children:JSON.stringify(u,null,2)})]}),(0,q.jsx)(T,{icon:lt,iconTone:r.events_online?`green`:`amber`,title:n(`Connection health`,`سلامت اتصال`),eyebrow:r.events_online?n(`Event stream connected`,`جریان رویداد متصل است`):r.http_reachable?n(`HTTP reachable`,`HTTP در دسترس`):n(`Unavailable`,`دردسترس نیست`),action:(0,q.jsx)(l,{icon:De,compact:!0,onClick:()=>void v(),children:e===`fa`?`تازه‌سازی`:`Refresh`}),children:(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:n(`Phase`,`مرحله`),value:r.phase||`idle`}),(0,q.jsx)(w,{label:`HTTP`,value:r.http_reachable?t(`online`):t(`offline`),tone:r.http_reachable?`good`:`bad`}),(0,q.jsx)(w,{label:n(`Event stream`,`جریان رویداد`),value:r.events_online?t(`online`):t(`offline`),tone:r.events_online?`good`:`warn`}),(0,q.jsx)(w,{label:n(`Last event`,`آخرین رویداد`),value:r.last_event||`—`}),(0,q.jsx)(w,{label:n(`Identity`,`هویت`),value:[r.name,r.model,r.firmware].filter(Boolean).join(` · `)||`—`}),(0,q.jsx)(w,{label:n(`Device ID`,`شناسهٔ وسیله`),value:r.device_id||`—`,mono:!0})]})})]})]})]})}function sn({events:e,locale:t,t:n}){let r=(e,n)=>t===`fa`?n:e,[i,a]=(0,K.useState)(`all`),o=e.filter(e=>i===`all`||Zt(e)===i);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:r(`Unified history`,`تاریخچهٔ یکپارچه`),title:n(`events`),detail:r(`One timeline for controller lifecycle, RF, doors, macros, automations and integrated services.`,`یک خط زمانی برای چرخهٔ کنترلر، RF، درها، ماکروها، خودکارسازی‌ها و سرویس‌های یکپارچه.`),action:(0,q.jsxs)(I,{tone:`info`,children:[e.length,` `,r(`retained`,`نگه‌داری‌شده`)]})}),(0,q.jsxs)(T,{icon:p,iconTone:`violet`,className:`events-page-card`,title:r(`Event timeline`,`خط زمانی رویدادها`),eyebrow:r(`${o.length} visible`,`${o.length} مورد نمایان`),children:[(0,q.jsx)(`div`,{className:`event-toolbar`,children:(0,q.jsx)(k,{value:i,label:r(`Event severity`,`شدت رویداد`),options:[{value:`all`,label:r(`All`,`همه`)},{value:`good`,label:r(`Good`,`عادی`)},{value:`warn`,label:r(`Warn`,`هشدار`)},{value:`bad`,label:r(`Fault`,`خطا`)},{value:`info`,label:r(`Info`,`اطلاعات`)}],onChange:a})}),(0,q.jsx)(Dt,{events:o,locale:t,t:n,limit:o.length,toolbar:!0})]})]})}function cn({appTitle:t,snapshot:n,locale:a,t:s,command:c,appearance:m,onAppearance:g,token:_,onToken:x,onAppTitle:D,boardSettingsReadState:O,uiConfig:A,onMeasurementTiming:ne,onBuzzerPath:re,transport:ie,navigationSync:ae,navigationSyncStatus:oe={state:`idle`,detail:``},onNavigationSync:ce,appInstances:le=[]}){let N=(e,t)=>a===`fa`?t:e,P=M(n),de=e=>a===`fa`?{"Application title is required.":`عنوان برنامه الزامی است.`,"Application title must be 64 characters or fewer.":`عنوان برنامه باید حداکثر ۶۴ نویسه باشد.`,"Application title must include a letter or number.":`عنوان برنامه باید دست‌کم یک حرف یا عدد داشته باشد.`,"A root URL is required while this integration is enabled.":`وقتی یکپارچه‌سازی فعال است، نشانی ریشه الزامی است.`,"Enter a valid HTTP or HTTPS root URL.":`یک نشانی ریشهٔ معتبر HTTP یا HTTPS وارد کنید.`,"Only HTTP and HTTPS are supported.":`فقط HTTP و HTTPS پشتیبانی می‌شوند.`,"Credentials are not allowed in the URL.":`اطلاعات دسترسی نباید داخل نشانی باشد.`,"Query strings and fragments are not allowed.":`پارامتر پرس‌وجو و قطعه در نشانی مجاز نیست.`,"Use the service root without a path.":`ریشهٔ سرویس را بدون مسیر وارد کنید.`,"Use a private, loopback, link-local, or local-DNS host.":`از میزبان خصوصی، loopback، link-local یا DNS محلی استفاده کنید.`,"The data service must use localhost or a loopback address.":`سرویس داده باید از localhost یا نشانی loopback استفاده کند.`,"Use no more than 14 page keys or IDs.":`حداکثر ۱۴ کلید یا شناسهٔ صفحه وارد کنید.`,"Page keys or IDs must use printable ASCII characters.":`کلیدها یا شناسه‌های صفحه باید فقط از نویسه‌های قابل چاپ ASCII باشند.`,"Page keys or IDs must be unique.":`کلیدها یا شناسه‌های صفحه باید یکتا باشند.`,"Text must use printable ASCII characters.":`متن باید فقط از نویسه‌های قابل چاپ ASCII باشد.`,"Text must contain at least 5 printable ASCII bytes.":`متن باید دست‌کم ۵ بایت ASCII قابل چاپ داشته باشد.`,"Text and repeat gap must fit within 40 bytes.":`متن همراه با فاصلهٔ تکرار باید در ۴۰ بایت جا شود.`}[e]??e:e,[pe,L]=(0,K.useState)(_),[z,ge]=(0,K.useState)(t),[_e,ve]=(0,K.useState)(!1),[ye,xe]=(0,K.useState)(``),[we,Ee]=(0,K.useState)(!1),[De,ke]=(0,K.useState)(``),[Ae,je]=(0,K.useState)(n.settings.display_brightness),[V,Me]=(0,K.useState)(n.settings.display_closed_brightness),[Ne,H]=(0,K.useState)(n.settings.motion_exit_hold_seconds||2),[Pe,Fe]=(0,K.useState)(n.settings.status_brightness),[Le,Re]=(0,K.useState)(n.settings.stream_period_ms||200),[ze,Be]=(0,K.useState)(n.settings.output_persistence),[Ve,He]=(0,K.useState)(n.settings.relay_restore_mask),[Ge,Ke]=(0,K.useState)(String(n.settings.light_mode)),[Je,Ye]=(0,K.useState)(n.settings.on_brightness),[Xe,Ze]=(0,K.useState)(n.settings.off_brightness),[W,Qe]=(0,K.useState)(n.illumination),[$e,et]=(0,K.useState)(n.illumination.applied_pwm),[nt,it]=(0,K.useState)(!1),[ot,ct]=(0,K.useState)(``),[lt,ut]=(0,K.useState)(!1),[G,dt]=(0,K.useState)({enabled:!0,pages:[`door`],door_open_text:`door is open`,door_closed_text:`door is closed`,speed_ms:220,gap_cells:3}),[pt,mt]=(0,K.useState)(`door`),[ht,gt]=(0,K.useState)(null),[_t,yt]=(0,K.useState)(!0),[bt,xt]=(0,K.useState)(``),[St,Ct]=(0,K.useState)(!1),[wt,Tt]=(0,K.useState)(A?.status_interval_ms??200),[Et,Dt]=(0,K.useState)(A?.measurement_freshness_ms??1500),[Ot,kt]=(0,K.useState)({refresh:A?.status_interval_ms??200,freshness:A?.measurement_freshness_ms??1500}),[At,jt]=(0,K.useState)(A===null),[Mt,Nt]=(0,K.useState)(``),[J,Y]=(0,K.useState)({local_device:{enabled:!1,base_url:``},data_hub:{enabled:!1,base_url:`http://127.0.0.1:8080`},lifecycle_safety:{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``}}),[Pt,Ft]=(0,K.useState)({local_device:{enabled:!1,base_url:``},data_hub:{enabled:!1,base_url:`http://127.0.0.1:8080`},lifecycle_safety:{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``}}),[It,Lt]=(0,K.useState)(!0),[Rt,X]=(0,K.useState)(!1),[zt,Z]=(0,K.useState)(``),[Bt,Ht]=(0,K.useState)(A?.buzzer_runtime),Ut=(e,t)=>g({...m,[e]:t}),Wt=(0,K.useMemo)(()=>o(z),[z]),Kt=(0,K.useMemo)(()=>e(pe),[pe]),qt=n.connected&&n.have_settings,Jt=qt&&!!(n.settings.flags&1),Q=Bt??A?.buzzer_runtime,Yt=Q?!Q.host_mirror:!(A?.integrations?.buzzer_host_enabled??!1),Xt=qt?he(Jt,Yt):null,Zt=Q?.effective_path&&Q.effective_path!==`unknown`?Q.effective_path:Xt,Qt=async e=>{Ee(!0),ke(``);try{await re(e);let t=await f(`controller.integrations.status`);Ht(t.buzzer_runtime),ke(N(`Applied and verified.`,`اعمال و تأیید شد.`))}catch(e){ke(e instanceof Error?e.message:String(e))}finally{Ee(!1)}},$t=(0,K.useMemo)(()=>C(J.local_device.base_url??``,J.local_device.enabled),[J.local_device.base_url,J.local_device.enabled]),$=(0,K.useMemo)(()=>ee(J.data_hub.base_url??``,J.data_hub.enabled),[J.data_hub.base_url,J.data_hub.enabled]),en=$t.valid&&$.valid,tn=Rt&&!h(J,Pt),nn=Wt.normalized!==t,rn=Kt!==_,an=(0,K.useMemo)(()=>u(pt),[pt]),on=(0,K.useMemo)(()=>me(G.door_open_text,G.gap_cells),[G.door_open_text,G.gap_cells]),sn=(0,K.useMemo)(()=>me(G.door_closed_text,G.gap_cells),[G.door_closed_text,G.gap_cells]),cn=(0,K.useMemo)(()=>({...G,pages:an.pages,door_open_text:on.normalized,door_closed_text:sn.normalized}),[sn.normalized,on.normalized,an.pages,G]),ln=an.valid&&on.valid&&sn.valid,un=ht!==null&&!S(cn,ht),dn=wt>=50&&wt<=6e4&&Et>=wt+100&&Et<=12e4,fn=wt!==Ot.refresh||Et!==Ot.freshness,pn=[{value:`leave`,label:N(`Release keys`,`رهاسازی کلیدها`)},{value:`stop-motion`,label:N(`Stop motion`,`توقف حرکت`)},{value:`all-off`,label:N(`All outputs off`,`خاموشی همه خروجی‌ها`)}],mn=bt||(_t?ht?N(`Saving the validated scrolling configuration…`,`در حال ذخیرهٔ تنظیمات معتبر پیمایش…`):N(`Loading the persisted scrolling configuration…`,`در حال بارگذاری تنظیمات ذخیره‌شدهٔ پیمایش…`):ln?un?N(`Validated draft · ready to save.`,`پیش‌نویس معتبر است و آمادهٔ ذخیره است.`):ht?N(`Saved configuration is up to date.`,`تنظیمات ذخیره‌شده به‌روز است.`):N(`Persistent scrolling configuration is unavailable.`,`تنظیمات ماندگار پیمایش در دسترس نیست.`):N(`Correct the highlighted fields before saving.`,`پیش از ذخیره، فیلدهای مشخص‌شده را اصلاح کنید.`));(0,K.useEffect)(()=>ge(t),[t]),(0,K.useEffect)(()=>L(_),[_]),(0,K.useEffect)(()=>{A&&(Tt(A.status_interval_ms),Dt(A.measurement_freshness_ms),kt({refresh:A.status_interval_ms,freshness:A.measurement_freshness_ms}),jt(!1))},[A?.measurement_freshness_ms,A?.status_interval_ms]),(0,K.useEffect)(()=>{let e=!0;return f(`controller.ui.config.get`).then(t=>{if(!e)return;let n=u(t.segment_scroll.pages.join(` `)).pages,r={...t.segment_scroll,pages:n,door_open_text:Ce(t.segment_scroll.door_open_text),door_closed_text:Ce(t.segment_scroll.door_closed_text)};dt(r),gt(r),mt(n.join(` `)),xt(``),Ct(!1)}).catch(t=>{e&&(xt(t instanceof Error?t.message:String(t)),Ct(!0))}).finally(()=>{e&&yt(!1)}),()=>{e=!1}},[]),(0,K.useEffect)(()=>{Ke(String(n.settings.light_mode)),Ye(n.settings.on_brightness),Ze(n.settings.off_brightness),je(n.settings.display_brightness),Me(n.settings.display_closed_brightness),H(n.settings.motion_exit_hold_seconds||2),Fe(n.settings.status_brightness),Re(n.settings.stream_period_ms||200),Be(n.settings.output_persistence),He(n.settings.relay_restore_mask)},[n.settings.light_mode,n.settings.on_brightness,n.settings.off_brightness,n.settings.display_brightness,n.settings.display_closed_brightness,n.settings.motion_exit_hold_seconds,n.settings.status_brightness,n.settings.stream_period_ms,n.settings.output_persistence,n.settings.relay_restore_mask]),(0,K.useEffect)(()=>{Qe(n.illumination)},[n.illumination]),(0,K.useEffect)(()=>{et(n.illumination.applied_pwm)},[n.illumination.applied_pwm]),(0,K.useEffect)(()=>{if(!n.connected||!n.have_settings||!P.pwm)return;let e=new AbortController;return f(`controller.illumination.get`,{},e.signal).then(t=>{e.signal.aborted||Qe(t)}).catch(t=>{e.signal.aborted||(ct(t instanceof Error?t.message:String(t)),ut(!0))}),()=>e.abort()},[n.connected,n.have_settings,P.pwm]);let hn=async()=>{it(!0),ct(``),ut(!1);try{let e=await f(`controller.illumination.set`,{mode:Number(Ge),on_brightness:Je,off_brightness:Xe});Qe(e),ct(N(`Applied live and verified durable in EEPROM.`,`به‌صورت زنده اعمال و ماندگاری آن در EEPROM تأیید شد.`))}catch(e){ct(e instanceof Error?e.message:String(e)),ut(!0)}finally{it(!1)}},gn=async()=>{it(!0),ct(``),ut(!1);try{let e=await f(`controller.illumination.override`,{value:$e});Qe(e),et(e.applied_pwm),ct(N(`Manual value applied and verified. The enclosure-lighting policy remains the owner.`,`مقدار دستی اعمال و تأیید شد. سیاست روشنایی محفظه همچنان مالک است.`))}catch(e){ct(e instanceof Error?e.message:String(e)),ut(!0)}finally{it(!1)}},_n=(e,t)=>{Be(n=>t?n|e:n&~e)},vn=e=>{xt(``),Ct(!1),dt(e)},yn=e=>{xt(``),Ct(!1),mt(v(e))},bn=async e=>{if(e.preventDefault(),!ln)xt(N(`Correct the highlighted scrolling fields before saving.`,`پیش از ذخیره، فیلدهای پیمایش مشخص‌شده را اصلاح کنید.`)),Ct(!0);else if(un){yt(!0),xt(``),Ct(!1);try{let e=await f(`controller.ui.config.set`,{segment_scroll:cn}),t=u(e.segment_scroll.pages.join(` `)).pages,n={...e.segment_scroll,pages:t,door_open_text:Ce(e.segment_scroll.door_open_text),door_closed_text:Ce(e.segment_scroll.door_closed_text)};dt(n),gt(n),mt(t.join(` `)),xt(N(`Saved and applied by the file-watched HOST service.`,`ذخیره شد و سرویس میزبان آن را اعمال کرد.`))}catch(e){xt(e instanceof Error?e.message:String(e)),Ct(!0)}finally{yt(!1)}}},xn=async e=>{if(e.preventDefault(),dn&&fn){jt(!0),Nt(``);try{let e=await f(`controller.ui.config.set`,{status_interval_ms:wt,measurement_freshness_ms:Et});Tt(e.status_interval_ms),Dt(e.measurement_freshness_ms),kt({refresh:e.status_interval_ms,freshness:e.measurement_freshness_ms}),ne?.(e.status_interval_ms,e.measurement_freshness_ms),Nt(N(`Applied.`,`اعمال شد.`))}catch(e){Nt(e instanceof Error?e.message:String(e))}finally{jt(!1)}}},Sn=async e=>{e.preventDefault(),ve(!0),xe(``);try{if(!Wt.valid){xe(de(Wt.error));return}let e=await D(Wt.normalized);ge(e),xe(`Saved`)}catch(e){xe(e instanceof Error?e.message:String(e))}finally{ve(!1)}};(0,K.useEffect)(()=>{let e=!0;return f(`controller.integrations.local.get`).then(t=>{if(!e)return;let n={local_device:{...t.local_device,base_url:d(t.local_device.base_url??``)},data_hub:{...t.data_hub,base_url:d(t.data_hub.base_url??``)},lifecycle_safety:t.lifecycle_safety??{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:t.buzzer_mirror??{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``},buzzer_runtime:t.buzzer_runtime};Ht(t.buzzer_runtime),Y(n),Ft(n),X(!0),Z(``)}).catch(t=>{e&&Z(t instanceof Error?t.message:String(t))}).finally(()=>{e&&Lt(!1)}),()=>{e=!1}},[]);let Cn=async()=>{if(!en)Z(N(`Correct the highlighted field before saving.`,`پیش از ذخیره، فیلد مشخص‌شده را اصلاح کنید.`));else{Lt(!0),Z(``);try{let e={local_device:{...J.local_device,base_url:$t.normalized},data_hub:{...J.data_hub,base_url:$.normalized},lifecycle_safety:J.lifecycle_safety,buzzer_mirror:J.buzzer_mirror},t=await f(`controller.integrations.local.set`,e),n={local_device:{...t.local_device,base_url:d(t.local_device.base_url??``)},data_hub:{...t.data_hub,base_url:d(t.data_hub.base_url??``)},lifecycle_safety:t.lifecycle_safety,buzzer_mirror:t.buzzer_mirror,buzzer_runtime:t.buzzer_runtime};Ht(t.buzzer_runtime),Y(n),Ft(n),Z(`Saved`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Lt(!1)}}},wn=async e=>{e.preventDefault(),await Cn()},Tn=s(m.theme),En=s(m.locale===`fa`?`persian`:`english`),Dn=s(m.direction===`auto`?`auto`:m.direction===`ltr`?`leftToRight`:`rightToLeft`),On=ie.boardState===`ready`&&n.connected&&n.have_status;return ie.authenticationRequired?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:N(`Host recovery`,`بازیابی میزبان`),title:s(`settings`),detail:s(`authenticationDashboardDetail`)}),(0,q.jsx)(`section`,{className:`settings-grid`,children:(0,q.jsx)(T,{icon:U,iconTone:`amber`,title:s(`security`),eyebrow:N(`Authentication required`,`احراز هویت لازم است`),className:`settings-card`,children:(0,q.jsx)(R,{label:s(`authToken`),type:`password`,value:pe,autoComplete:`off`,spellCheck:!1,onInput:t=>L(e(t.currentTarget.value)),onChange:t=>L(e(t.currentTarget.value)),hint:rn?N(`${Kt.length} normalized characters · not applied`,`${Kt.length} نویسهٔ نرمال‌شده · اعمال نشده`):N(`Enter this host’s access token.`,`توکن دسترسی این میزبان را وارد کنید.`),action:(0,q.jsx)(l,{tone:`primary`,icon:U,disabled:!rn,onClick:()=>{x(Kt),L(Kt)},children:s(`apply`)})})})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:On?N(`Host and controller settings`,`تنظیمات میزبان و کنترلر`):N(`Host settings`,`تنظیمات میزبان`),title:s(`settings`),detail:`${N(`Theme`,`پوسته`)}: ${Tn} · ${N(`Language`,`زبان`)}: ${En} · ${N(`Direction`,`جهت`)}: ${Dn}${On?N(` · controller available`,` · کنترلر در دسترس`):``}`}),(0,q.jsxs)(`section`,{className:`settings-grid`,children:[(0,q.jsx)(T,{icon:st,iconTone:`violet`,title:N(`PC host identity`,`هویت میزبان رایانه`),eyebrow:_e?N(`Saving`,`در حال ذخیره`):nn?N(`Unsaved change`,`تغییر ذخیره‌نشده`):N(`Saved`,`ذخیره‌شده`),className:`settings-card`,children:(0,q.jsx)(`form`,{onSubmit:e=>void Sn(e),children:(0,q.jsx)(R,{label:N(`Application title`,`عنوان برنامه`),value:z,minLength:1,maxLength:64,onInput:e=>{xe(``),ge(i(e.currentTarget.value))},onChange:e=>{xe(``),ge(i(e.currentTarget.value))},error:nn&&!Wt.valid?de(Wt.error):void 0,success:ye===`Saved`?N(`Saved as “${t}”.`,`با عنوان «${t}» ذخیره شد.`):void 0,hint:nn?N(`${Wt.normalized.length}/64 characters · ready to save`,`${Wt.normalized.length} از ۶۴ نویسه · آمادهٔ ذخیره`):N(`Current title: ${t}`,`عنوان فعلی: ${t}`),action:(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:_e,disabled:!nn||!Wt.valid,children:N(`Save`,`ذخیره`)})})})}),(0,q.jsx)(T,{icon:ft,iconTone:`green`,title:N(`Connected applications`,`برنامه‌های متصل`),eyebrow:`${le.length} ${N(`live`,`فعال`)}`,className:`settings-card settings-card--wide`,children:le.length===0?(0,q.jsx)(E,{icon:ft,title:N(`No connected applications`,`برنامهٔ متصلی وجود ندارد`),detail:N(`Live clients appear here after they advertise their controls.`,`کلاینت‌های زنده پس از معرفی کنترل‌های خود اینجا ظاهر می‌شوند.`)}):(0,q.jsx)(`div`,{className:`connected-apps-list`,children:le.map(e=>{let t=(e.values?.app_actions??``).split(`,`).map(e=>e.trim()).filter(Boolean),n=e.surface.toLowerCase()===`pealayer`,r=e.self?.pid??e.self?.vars?.pid,i=e.self?.vars?.web_ui??e.self?.vars?.websocket??e.self?.vars?.rpc;return(0,q.jsxs)(`article`,{className:`connected-app`,children:[(0,q.jsxs)(`div`,{className:`connected-app__identity`,children:[(0,q.jsx)(I,{tone:e.state===`active`?`good`:`neutral`,children:e.state||N(`present`,`حاضر`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.surface}),(0,q.jsx)(`span`,{children:e.id})]})]}),(0,q.jsxs)(`div`,{className:`connected-app__facts`,children:[e.page&&(0,q.jsxs)(`span`,{children:[N(`Page`,`صفحه`),`: `,e.page]}),e.self?.kind&&(0,q.jsxs)(`span`,{children:[e.self.kind,r?` · PID ${r}`:``]}),(0,q.jsxs)(`span`,{children:[t.length,` `,N(`controls`,`کنترل`)]}),i&&(0,q.jsx)(`span`,{title:i,children:i})]}),(0,q.jsxs)(`div`,{className:`connected-app__capabilities`,"aria-label":N(`Advertised controls`,`کنترل‌های معرفی‌شده`),children:[t.slice(0,5).map(e=>(0,q.jsx)(`code`,{children:e.replace(/^pealayer\./,``)},e)),t.length>5&&(0,q.jsxs)(`span`,{title:t.slice(5).join(`, `),children:[`+`,t.length-5]})]}),n&&(0,q.jsxs)(`div`,{className:`connected-app__actions`,children:[t.includes(`pealayer.play`)&&(0,q.jsx)(l,{icon:vt,onClick:()=>void f(`controller.app.action`,{kind:`pealayer.play`,target:e.id}),children:N(`Play`,`پخش`)}),t.includes(`pealayer.pause`)&&(0,q.jsx)(l,{icon:tt,onClick:()=>void f(`controller.app.action`,{kind:`pealayer.pause`,target:e.id}),children:N(`Pause`,`مکث`)})]})]},e.id)})})}),(0,q.jsx)(Gt,{locale:a}),A&&(0,q.jsx)(T,{icon:r,iconTone:`green`,title:N(`Live measurements`,`اندازه‌گیری‌های زنده`),eyebrow:At?N(`Synchronizing`,`در حال همگام‌سازی`):`${b(a,1e3/wt,wt===200?0:1)} ${N(`Hz`,`هرتز`)}`,className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`segment-scroll-settings`,onSubmit:e=>void xn(e),children:[(0,q.jsx)(F,{label:N(`Refresh/update interval`,`فاصلهٔ تازه‌سازی/به‌روزرسانی`),value:wt,min:50,max:6e4,step:50,unit:`ms`,onChange:e=>{Nt(``),Tt(e)}}),(0,q.jsx)(F,{label:N(`Freshness window`,`پنجرهٔ تازگی`),value:Et,min:wt+100,max:12e4,step:100,unit:`ms`,onChange:e=>{Nt(``),Dt(e)}}),(0,q.jsxs)(`div`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:`segment-scroll-settings__notice${dn?``:` is-error`}`,role:`status`,"aria-live":`polite`,children:dn?Mt:N(`Freshness must be ${wt+100}..120000 ms.`,`تازگی باید بین ${wt+100} تا ۱۲۰۰۰۰ میلی‌ثانیه باشد.`)}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:At,disabled:!fn||!dn,children:N(`Apply live timing`,`اعمال زمان‌بندی زنده`)})]})]})}),(0,q.jsx)(T,{icon:Te,iconTone:`accent`,title:N(`HOST display scrolling`,`پیمایش نمایشگر میزبان`),eyebrow:G.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`),className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`segment-scroll-settings`,onSubmit:e=>void bn(e),children:[(0,q.jsx)(j,{checked:G.enabled,onChange:e=>vn(t=>({...t,enabled:e})),label:N(`Supply scrolling text to selected pages`,`ارسال متن پیمایشی به صفحات انتخابی`),detail:N(`The board keeps OPEN/CLSD as its offline fallback; warnings, edits, programming, and other critical overlays remain higher priority.`,`برد در حالت آفلاین OPEN/CLSD را نمایش می‌دهد و هشدارها و لایه‌های مهم اولویت بالاتری دارند.`)}),(0,q.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,q.jsx)(R,{label:N(`Selected page keys or IDs`,`کلید یا شناسه صفحات`),value:pt,dir:`ltr`,spellCheck:!1,onInput:e=>yn(e.currentTarget.value),onChange:e=>yn(e.currentTarget.value),error:an.valid?void 0:de(an.error),success:un&&an.valid?N(`${an.pages.length} canonical target${an.pages.length===1?``:`s`}.`,`${an.pages.length} مقصد معتبر.`):void 0,hint:N(`Spaces and commas normalize automatically; maximum 14 unique ASCII IDs.`,`فاصله و ویرگول خودکار یکسان می‌شوند؛ حداکثر ۱۴ شناسهٔ یکتای ASCII.`)}),(0,q.jsx)(R,{label:N(`Door open text`,`متن درب باز`),value:G.door_open_text,dir:`ltr`,maxLength:40,spellCheck:!1,onInput:e=>vn(t=>({...t,door_open_text:Ce(e.currentTarget.value)})),onChange:e=>vn(t=>({...t,door_open_text:Ce(e.currentTarget.value)})),error:on.valid?void 0:de(on.error),success:un&&on.valid?N(`${on.byteLength} + ${G.gap_cells} / 40 bytes.`,`${on.byteLength} + ${G.gap_cells} از ۴۰ بایت.`):void 0,hint:N(`${on.availableBytes} ASCII bytes available before the repeat gap.`,`${on.availableBytes} بایت ASCII پیش از فاصلهٔ تکرار در دسترس است.`)}),(0,q.jsx)(R,{label:N(`Door closed text`,`متن درب بسته`),value:G.door_closed_text,dir:`ltr`,maxLength:40,spellCheck:!1,onInput:e=>vn(t=>({...t,door_closed_text:Ce(e.currentTarget.value)})),onChange:e=>vn(t=>({...t,door_closed_text:Ce(e.currentTarget.value)})),error:sn.valid?void 0:de(sn.error),success:un&&sn.valid?N(`${sn.byteLength} + ${G.gap_cells} / 40 bytes.`,`${sn.byteLength} + ${G.gap_cells} از ۴۰ بایت.`):void 0,hint:N(`${sn.availableBytes} ASCII bytes available before the repeat gap.`,`${sn.availableBytes} بایت ASCII پیش از فاصلهٔ تکرار در دسترس است.`)})]}),(0,q.jsx)(F,{label:N(`Scroll window dwell`,`مکث هر پنجره پیمایش`),value:G.speed_ms,min:60,max:5e3,step:20,unit:`ms`,onChange:e=>vn(t=>({...t,speed_ms:e}))}),(0,q.jsx)(F,{label:N(`Gap between repeats`,`فاصله بین تکرارها`),value:G.gap_cells,min:0,max:12,unit:N(` cells`,` خانه`),onChange:e=>vn(t=>({...t,gap_cells:e}))}),(0,q.jsxs)(`div`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:`segment-scroll-settings__notice${St||!ln?` is-error`:``}`,role:`status`,"aria-live":`polite`,children:mn}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:_t,disabled:!un||!ln,children:N(`Save scrolling`,`ذخیره پیمایش`)})]})]})}),(0,q.jsxs)(T,{icon:fe,iconTone:`green`,title:N(`Buzzer routing`,`مسیر بیزر`),eyebrow:(Zt??N(`Pending`,`در انتظار`)).toUpperCase(),className:`settings-card settings-card--wide`,children:[(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Playback path`,`مسیر پخش`)}),(0,q.jsx)(k,{value:Zt??Q?.requested_path??J.buzzer_mirror.path??`none`,label:N(`Buzzer playback path`,`مسیر پخش بیزر`),options:[{value:`board`,label:N(`Board`,`برد`)},{value:`host`,label:N(`PC`,`رایانه`)},{value:`both`,label:N(`Both`,`هر دو`)},{value:`none`,label:N(`None`,`هیچ‌کدام`)}],onChange:e=>void Qt(e)})]}),(0,q.jsxs)(`div`,{className:`settings-inline-status`,children:[qt?(0,q.jsx)(I,{tone:Jt?`neutral`:`good`,children:N(`Board ${Jt?`silent`:`active`}`,`برد ${Jt?`بی‌صدا`:`فعال`}`)}):(0,q.jsx)(I,{tone:`neutral`,children:N(`Board state unavailable`,`وضعیت برد در دسترس نیست`)}),(0,q.jsx)(I,{tone:Yt?`neutral`:`good`,children:N(`PC ${Yt?`silent`:`active`}`,`رایانه ${Yt?`بی‌صدا`:`فعال`}`)}),we&&(0,q.jsx)(I,{tone:`warn`,children:N(`Applying…`,`در حال اعمال…`)}),Q?.requested_path&&Q.requested_path!==`unknown`&&Q.requested_path!==Q.effective_path&&(0,q.jsx)(I,{tone:Q.board_apply_state===`error`?`warn`:`neutral`,children:`${Q.requested_path} · ${Q.board_apply_state}`}),Q&&(0,q.jsx)(I,{tone:Q.backend_error?`warn`:`neutral`,children:`${Q.backend_requested} → ${Q.backend_effective}`})]}),(0,q.jsx)(j,{checked:J.buzzer_mirror.enabled,onChange:e=>{Z(``),Y(t=>{let n=t.buzzer_mirror.path,r=n===`host`||n===`none`;return{...t,buzzer_mirror:{...t.buzzer_mirror,enabled:e,path:n&&he(r,!e)}}})},label:N(`Mirror board beeps on this host`,`بازپخش بوق‌های برد روی این میزبان`)}),J.buzzer_mirror.enabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(j,{checked:J.buzzer_mirror.native_enabled,onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,native_enabled:e,backend:e&&t.buzzer_mirror.backend===`off`?`auto`:t.buzzer_mirror.backend}}))},label:N(`PC speaker renderer`,`پخش‌کنندهٔ بلندگوی رایانه`)}),(0,q.jsx)(j,{checked:J.buzzer_mirror.web_audio_enabled,onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,web_audio_enabled:e}}))},label:N(`Web browser renderer`,`پخش‌کنندهٔ مرورگر وب`)}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`PC speaker backend`,`پشتیبان بلندگوی رایانه`)}),(0,q.jsx)(k,{value:J.buzzer_mirror.backend,label:N(`PC speaker backend`,`پشتیبان بلندگوی رایانه`),options:[{value:`auto`,label:N(`Auto`,`خودکار`)},{value:`native`,label:N(`Native`,`بومی`)},{value:`external`,label:N(`Command`,`فرمان`)},{value:`off`,label:N(`Off`,`خاموش`)}],onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,backend:e,native_enabled:e!==`off`&&t.buzzer_mirror.native_enabled}}))}})]}),J.buzzer_mirror.backend!==`native`&&J.buzzer_mirror.backend!==`off`&&(0,q.jsx)(R,{label:N(`Beep executable (optional)`,`فایل اجرایی بوق (اختیاری)`),dir:`ltr`,spellCheck:!1,value:J.buzzer_mirror.executable??``,placeholder:N(`Blank uses beep from PATH`,`خالی: استفاده از beep در PATH`),onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,executable:e.currentTarget.value}}))}})]}),(0,q.jsx)(`div`,{className:`inline-actions`,children:(0,q.jsx)(l,{icon:U,tone:`primary`,busy:It,disabled:!tn,onClick:()=>void Cn(),children:N(`Save PC buzzer settings`,`ذخیرهٔ تنظیمات بیزر رایانه`)})}),De&&(0,q.jsx)(`p`,{className:`settings-action-feedback`,role:`status`,children:De})]}),(0,q.jsxs)(T,{icon:B,iconTone:`accent`,title:s(`appearance`),eyebrow:`${Tn} · ${Dn}`,className:`settings-card settings-card--wide`,menu:[{label:N(`Follow system appearance`,`پیروی از ظاهر سیستم`),icon:B,onSelect:()=>g({...m,theme:`system`,direction:`auto`})},{label:m.reduceMotion?N(`Enable interface motion`,`فعال‌سازی حرکت رابط`):N(`Reduce interface motion`,`کاهش حرکت رابط`),icon:p,onSelect:()=>Ut(`reduceMotion`,!m.reduceMotion)}],children:[(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`theme`)}),(0,q.jsx)(k,{value:m.theme,label:s(`theme`),options:[{value:`system`,label:s(`system`),icon:B},{value:`dark`,label:s(`dark`),icon:te},{value:`light`,label:s(`light`),icon:se}],onChange:e=>Ut(`theme`,e)})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`language`)}),(0,q.jsx)(k,{value:m.locale,label:s(`language`),options:[{value:`en`,label:s(`english`),icon:be},{value:`fa`,label:s(`persian`),icon:be}],onChange:e=>Ut(`locale`,e)})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`direction`)}),(0,q.jsx)(k,{value:m.direction,label:s(`direction`),options:[{value:`auto`,label:s(`auto`)},{value:`ltr`,label:s(`leftToRight`)},{value:`rtl`,label:s(`rightToLeft`)}],onChange:e=>Ut(`direction`,e)})]}),(0,q.jsx)(j,{checked:m.reduceMotion,onChange:e=>Ut(`reduceMotion`,e),label:s(`reduceMotion`),detail:m.reduceMotion?N(`Nonessential motion is off.`,`حرکت‌های غیرضروری خاموش‌اند.`):N(`Smooth interface transitions are on.`,`گذارهای نرم رابط فعال‌اند.`)}),(0,q.jsx)(j,{checked:m.compactNumbers,onChange:e=>Ut(`compactNumbers`,e),label:s(`compactNumbers`),detail:m.compactNumbers?N(`Large values use compact notation.`,`مقادیر بزرگ به‌صورت فشرده نمایش داده می‌شوند.`):N(`Large values use full notation.`,`مقادیر بزرگ به‌صورت کامل نمایش داده می‌شوند.`)}),(0,q.jsx)(j,{checked:ae,onChange:ce,label:N(`Sync this tab with other instances`,`همگام‌سازی این زبانه با نمونه‌های دیگر`),detail:oe.state===`pending`?(0,q.jsx)(`span`,{role:`status`,children:N(`Synchronizing…`,`در حال همگام‌سازی…`)}):oe.state===`error`?(0,q.jsx)(`span`,{role:`alert`,children:oe.detail}):void 0}),(0,q.jsx)(j,{checked:!m.audioMuted,onChange:e=>Ut(`audioMuted`,!e),label:(0,q.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,q.jsx)(fe,{size:16}),N(`Interaction audio`,`صدای تعامل`)]}),detail:m.audioMuted?N(`Audio cues are off.`,`نشانه‌های صوتی خاموش‌اند.`):N(`Audio cues are at ${Math.round(m.audioVolume*100)}%.`,`بلندی نشانه‌های صوتی ${Math.round(m.audioVolume*100)}٪ است.`)}),!m.audioMuted&&(0,q.jsx)(F,{label:N(`Cue volume`,`بلندی نشانه‌ها`),value:Math.round(m.audioVolume*100),min:0,max:100,unit:`%`,onChange:e=>Ut(`audioVolume`,e/100)}),!m.audioMuted&&(0,q.jsx)(l,{icon:fe,onClick:()=>window.dispatchEvent(new Event(`pccontroller:test-feedback`)),children:N(`Test notification`,`آزمایش اعلان`)})]}),(0,q.jsx)(Vt,{locale:m.locale}),A?.auth_required===!0&&(0,q.jsx)(T,{icon:U,iconTone:`green`,title:s(`security`),eyebrow:rn?N(`Token change pending`,`تغییر توکن در انتظار اعمال`):_?N(`Session authenticated`,`نشست معتبر است`):N(`No session token`,`بدون توکن نشست`),className:`settings-card`,children:(0,q.jsx)(R,{label:s(`authToken`),type:`password`,value:pe,autoComplete:`off`,spellCheck:!1,onInput:t=>L(e(t.currentTarget.value)),onChange:t=>L(e(t.currentTarget.value)),hint:rn?N(`${Kt.length} normalized characters · not applied`,`${Kt.length} نویسهٔ نرمال‌شده · اعمال نشده`):_?N(`Applied to this browser tab.`,`در این زبانهٔ مرورگر اعمال شده است.`):N(`Enter a token if the host requires one.`,`اگر میزبان توکن می‌خواهد، آن را وارد کنید.`),action:(0,q.jsx)(l,{tone:`primary`,icon:U,disabled:!rn,onClick:()=>{x(Kt),L(Kt)},children:s(`apply`)})})}),On&&P.settings&&(0,q.jsx)(T,{icon:y,iconTone:`amber`,title:N(`Enclosure illumination`,`روشنایی محفظه`),eyebrow:W.available?W.at_target?N(`Applied · at target`,`اعمال‌شده · در مقدار هدف`):N(`Transitioning to target`,`در حال گذار به مقدار هدف`):N(`Waiting for live PWM state`,`در انتظار وضعیت زندهٔ PWM`),className:`settings-card settings-card--wide illumination-settings-card`,children:n.have_settings?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`illumination-state-grid`,"aria-label":N(`Live enclosure illumination state`,`وضعیت زندهٔ روشنایی محفظه`),children:[(0,q.jsx)(w,{label:N(`Policy`,`سیاست`),value:[N(`Off`,`خاموش`),N(`Auto`,`خودکار`),N(`On`,`روشن`)][W.mode]??String(W.mode)}),(0,q.jsx)(w,{label:N(`Door input`,`ورودی درب`),value:W.door_open?N(`Open`,`باز`):N(`Closed`,`بسته`),tone:W.door_open?`warn`:`good`}),(0,q.jsx)(w,{label:N(`Selected target`,`مقدار هدف انتخاب‌شده`),value:`${W.target_brightness}/255 · ${W.target_pwm}/4095`,mono:!0}),(0,q.jsx)(w,{label:N(`Applied MOSFET channel 12`,`مقدار اعمال‌شدهٔ کانال ۱۲ ماسفت`),value:W.available?`${W.applied_brightness}/255 · ${W.applied_pwm}/4095`:N(`Unavailable`,`در دسترس نیست`),tone:W.available?W.at_target?`good`:`warn`:void 0,mono:!0}),(0,q.jsx)(w,{label:N(`EEPROM durability`,`ماندگاری EEPROM`),value:W.persisted?N(`Verified`,`تأییدشده`):N(`Not confirmed`,`تأییدنشده`),tone:W.persisted?`good`:`warn`})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Operating mode`,`حالت عملکرد`)}),(0,q.jsx)(k,{value:Ge,label:N(`Enclosure illumination mode`,`حالت روشنایی محفظه`),options:[{value:`0`,label:N(`Off`,`خاموش`)},{value:`1`,label:N(`Auto · door`,`خودکار · درب`)},{value:`2`,label:N(`On`,`روشن`)}],onChange:e=>{ct(``),Ke(e)}})]}),(0,q.jsx)(F,{label:N(`Door-open / On brightness`,`روشنایی درب باز / حالت روشن`),value:Je,min:0,max:255,onChange:e=>{ct(``),Ye(e)}}),(0,q.jsx)(F,{label:N(`Door-closed / Off brightness`,`روشنایی درب بسته / حالت خاموش`),value:Xe,min:0,max:255,onChange:e=>{ct(``),Ze(e)}}),(0,q.jsx)(F,{label:N(`Manual raw override · MOSFET channel 12`,`کنترل دستی خام · کانال ۱۲ ماسفت`),value:$e,min:0,max:4095,onChange:e=>{ct(``),et(e)}}),(0,q.jsxs)(`div`,{className:`illumination-settings-card__footer`,children:[(0,q.jsx)(`p`,{className:lt?`settings-action-feedback text-bad`:`settings-action-feedback`,role:lt?`alert`:`status`,children:ot||N(`Manual adjustment is temporary: policy ownership and EEPROM settings remain unchanged and may reapply the selected target.`,`تنظیم دستی موقت است: مالکیت سیاست و تنظیمات EEPROM تغییر نمی‌کند و ممکن است مقدار هدف دوباره اعمال شود.`)}),(0,q.jsxs)(`div`,{className:`inline-actions`,children:[(0,q.jsx)(l,{icon:Ie,busy:nt,disabled:!P.pwm||!W.available,onClick:()=>void gn(),children:N(`Apply manual override`,`اعمال کنترل دستی`)}),(0,q.jsx)(l,{tone:`primary`,icon:y,busy:nt,disabled:!P.pwm||!W.available,onClick:()=>void hn(),children:N(`Apply policy`,`اعمال سیاست`)})]})]})]}):(0,q.jsx)(E,{icon:y,title:N(`Reading illumination policy`,`در حال خواندن سیاست روشنایی`),detail:N(`The controls appear only after the board returns authoritative EEPROM settings.`,`کنترل‌ها پس از دریافت تنظیمات معتبر EEPROM از برد نمایش داده می‌شوند.`)})}),On&&P.settings&&(0,q.jsx)(T,{icon:rt,iconTone:`amber`,title:N(`Board EEPROM settings`,`تنظیمات EEPROM برد`),eyebrow:n.have_settings?N(`Live draft · explicit write`,`پیش‌نویس زنده · نوشتن صریح`):O===`loading`?N(`Reading board settings`,`در حال خواندن تنظیمات برد`):N(`Settings unavailable`,`تنظیمات در دسترس نیست`),className:`settings-card`,children:n.have_settings?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`table`,{className:`settings-value-table`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:N(`Setting`,`تنظیم`)}),(0,q.jsx)(`th`,{children:N(`EEPROM report`,`گزارش EEPROM`)}),(0,q.jsx)(`th`,{children:N(`Live draft`,`پیش‌نویس زنده`)})]})}),(0,q.jsxs)(`tbody`,{children:[(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{children:[`TM1637 · `,N(`door open`,`درب باز`)]}),(0,q.jsx)(`td`,{children:n.settings.display_brightness}),(0,q.jsx)(`td`,{children:Ae})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{children:[`TM1637 · `,N(`door closed`,`درب بسته`)]}),(0,q.jsx)(`td`,{children:n.settings.display_closed_brightness}),(0,q.jsx)(`td`,{children:V})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Motion-menu exit hold`,`مکث خروج از منوی حرکت`)}),(0,q.jsxs)(`td`,{children:[n.settings.motion_exit_hold_seconds,` s`]}),(0,q.jsxs)(`td`,{children:[Ne,` s`]})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Status brightness`,`روشنایی وضعیت`)}),(0,q.jsx)(`td`,{children:n.settings.status_brightness}),(0,q.jsx)(`td`,{children:Pe})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Telemetry period`,`دورهٔ تله‌متری`)}),(0,q.jsxs)(`td`,{children:[n.settings.stream_period_ms,` ms`]}),(0,q.jsxs)(`td`,{children:[Le,` ms`]})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember motion command`,`به‌خاطرسپاری فرمان حرکت`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&1?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&1?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember user relays`,`به‌خاطرسپاری رله‌های کاربر`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&2?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&2?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),P.pwm&&(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember user PWM`,`به‌خاطرسپاری PWM کاربر`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&4?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&4?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Stop retains direction`,`حفظ جهت هنگام توقف`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&8?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&8?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Stored relay restore mask`,`ماسک ذخیره‌شدهٔ بازیابی رله`)}),(0,q.jsxs)(`td`,{colSpan:2,children:[`0x`,Ve.toString(16).toUpperCase().padStart(2,`0`)]})]})]})]}),(0,q.jsx)(F,{label:N(`TM1637 · door-open brightness`,`TM1637 · روشنایی درب باز`),value:Ae,min:0,max:7,onChange:je}),(0,q.jsx)(F,{label:N(`TM1637 · door-closed brightness`,`TM1637 · روشنایی درب بسته`),value:V,min:0,max:7,onChange:Me}),(0,q.jsx)(F,{label:N(`Motion-menu exit hold`,`مکث خروج از منوی حرکت`),value:Ne,min:1,max:31,unit:`s`,onChange:H}),(0,q.jsx)(F,{label:N(`Status brightness`,`روشنایی وضعیت`),value:Pe,min:0,max:255,onChange:Fe}),(0,q.jsx)(F,{label:N(`Telemetry period`,`دورهٔ تله‌متری`),value:Le,min:50,max:5e3,step:50,unit:`ms`,onChange:Re}),(0,q.jsx)(j,{checked:!!(ze&1),onChange:e=>_n(1,e),label:N(`Remember motion command`,`به‌خاطرسپاری فرمان حرکت`),detail:N(`Disabled by default; motion starts released after a reboot.`,`به‌طور پیش‌فرض غیرفعال است؛ حرکت پس از راه‌اندازی دوباره در حالت آزاد آغاز می‌شود.`)}),(0,q.jsx)(j,{checked:!!(ze&2),onChange:e=>_n(2,e),label:N(`Remember user relays R5–R8`,`به‌خاطرسپاری رله‌های کاربر R5 تا R8`),detail:N(`Restore the user-output relay mask kept in EEPROM.`,`ماسک رله‌های خروجی کاربر ذخیره‌شده در EEPROM بازیابی می‌شود.`)}),P.pwm&&(0,q.jsx)(j,{checked:!!(ze&4),onChange:e=>_n(4,e),label:N(`Remember user PWM values`,`به‌خاطرسپاری مقادیر PWM کاربر`),detail:N(`Restore MOSFET/user PWM channel values after boot.`,`مقادیر کانال‌های MOSFET/PWM کاربر پس از راه‌اندازی بازیابی می‌شوند.`)}),(0,q.jsx)(j,{checked:!!(ze&8),onChange:e=>_n(8,e),label:N(`Stop keeps direction relay`,`توقف، رلهٔ جهت را حفظ کند`),detail:ze&8?N(`Motion stop releases only the output/enable relay.`,`توقف حرکت فقط رلهٔ خروجی/فعال‌سازی را آزاد می‌کند.`):N(`Motion stop releases both direction and output relays.`,`توقف حرکت هر دو رلهٔ جهت و خروجی را آزاد می‌کند.`)}),(0,q.jsx)(l,{tone:`primary`,icon:We,onClick:()=>void c(Se(n.settings,Ae,V,Pe,Le,Ne,ze,Ve)),children:N(`Write board settings`,`نوشتن تنظیمات برد`)})]}):(0,q.jsx)(E,{icon:We,title:O===`loading`?N(`Reading board settings`,`در حال خواندن تنظیمات برد`):N(`Board settings are unavailable`,`تنظیمات برد در دسترس نیست`),detail:O===`loading`?N(`Waiting for the controller to return its live EEPROM settings.`,`در انتظار دریافت تنظیمات زندهٔ EEPROM از برد.`):N(`No EEPROM values are shown until the controller returns an authoritative settings report.`,`تا دریافت گزارش معتبر تنظیمات از برد، هیچ مقدار EEPROM نمایش داده نمی‌شود.`)})}),On&&(0,q.jsxs)(T,{icon:Oe,iconTone:`green`,title:s(`connection`),eyebrow:N(`Controller board connected`,`برد کنترلر متصل است`),className:`settings-card`,children:[(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:N(`State`,`وضعیت`),value:n.connection_state,tone:`good`}),(0,q.jsx)(w,{label:N(`Port`,`درگاه`),value:n.port.name||N(`automatic`,`خودکار`),mono:!0}),(0,q.jsx)(w,{label:`VID:PID`,value:`${n.port.vid||`—`}:${n.port.pid||`—`}`,mono:!0}),(0,q.jsx)(w,{label:N(`Serial`,`سریال`),value:n.port.serial_number||`—`,mono:!0}),(0,q.jsx)(w,{label:N(`Baud`,`نرخ باد`),value:`115200 8N1`,mono:!0})]}),n.port_process&&(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:N(`Port process`,`پردازش درگاه`),value:n.port_process.state,tone:n.port_process.state===`free`?`good`:n.port_process.state===`owned`?`warn`:void 0}),(0,q.jsx)(w,{label:N(`Owner`,`مالک`),value:n.port_process.pid?`${n.port_process.name||`unknown`} · PID ${n.port_process.pid}`:n.port_process.error||`—`,mono:!0}),n.port_process.executable&&(0,q.jsx)(w,{label:N(`Executable`,`فایل اجرا`),value:n.port_process.executable,mono:!0}),(0,q.jsx)(w,{label:N(`Takeover`,`واگذاری`),value:n.port_process.takeover_ready?N(`armed when free`,`با آزادشدن آماده`):N(`not armed`,`مسلح نیست`)})]}),(0,q.jsx)(`div`,{className:`inline-actions`,children:(0,q.jsx)(l,{icon:Ue,onClick:()=>void c(`close`),children:N(`Pause controller`,`توقف کنترلر`)})})]}),(0,q.jsx)(T,{icon:qe,iconTone:`violet`,title:N(`Host services and lifecycle`,`سرویس‌ها و چرخهٔ میزبان`),eyebrow:It?N(`Synchronizing`,`در حال همگام‌سازی`):tn?N(`Unsaved changes`,`تغییرات ذخیره‌نشده`):zt===`Saved`?N(`Saved`,`ذخیره‌شده`):N(`Up to date`,`به‌روز`),className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`local-integrations-form`,onSubmit:e=>void wn(e),children:[(0,q.jsxs)(`section`,{className:`integration-config-panel`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(qe,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Local device`,`وسیلهٔ محلی`)}),(0,q.jsx)(`small`,{children:J.local_device.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`)})]})]}),(0,q.jsx)(j,{checked:J.local_device.enabled,onChange:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,enabled:e}}))},label:N(`Enable local device`,`فعال‌سازی وسیلهٔ محلی`),detail:J.local_device.enabled?N(`The host will mediate local commands and events.`,`میزبان میانجی فرمان‌ها و رویدادهای محلی خواهد بود.`):N(`No local-device requests will be sent.`,`هیچ درخواستی برای وسیلهٔ محلی ارسال نمی‌شود.`)}),J.local_device.enabled&&(0,q.jsx)(R,{label:N(`Device root URL`,`نشانی ریشهٔ وسیله`),type:`url`,dir:`ltr`,spellCheck:!1,placeholder:`http://controller-device.local`,value:J.local_device.base_url??``,onInput:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,base_url:d(e.currentTarget.value)}}))},onChange:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,base_url:d(e.currentTarget.value)}}))},onBlur:()=>$t.valid&&Y(e=>({...e,local_device:{...e.local_device,base_url:$t.normalized}})),error:$t.valid?void 0:de($t.error),success:$t.valid&&$t.normalized?N(`Validated: ${$t.normalized}`,`تأیید شد: ${$t.normalized}`):void 0})]}),(0,q.jsxs)(`section`,{className:`integration-config-panel`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(at,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Data hub`,`مرکز داده`)}),(0,q.jsx)(`small`,{children:J.data_hub.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`)})]})]}),(0,q.jsx)(j,{checked:J.data_hub.enabled,onChange:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,enabled:e}}))},label:N(`Enable data hub`,`فعال‌سازی مرکز داده`),detail:J.data_hub.enabled?N(`Authenticated data operations are routed through the host.`,`عملیات معتبر داده از طریق میزبان مسیریابی می‌شود.`):N(`No data-hub requests will be sent.`,`هیچ درخواستی برای مرکز داده ارسال نمی‌شود.`)}),J.data_hub.enabled&&(0,q.jsx)(R,{label:N(`Data-hub root URL`,`نشانی ریشهٔ مرکز داده`),type:`url`,dir:`ltr`,spellCheck:!1,placeholder:`http://127.0.0.1:8080`,value:J.data_hub.base_url??``,onInput:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,base_url:d(e.currentTarget.value)}}))},onChange:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,base_url:d(e.currentTarget.value)}}))},onBlur:()=>$.valid&&Y(e=>({...e,data_hub:{...e.data_hub,base_url:$.normalized}})),error:$.valid?void 0:de($.error),success:$.valid&&$.normalized?N(`Validated: ${$.normalized}`,`تأیید شد: ${$.normalized}`):void 0})]}),(0,q.jsxs)(`section`,{className:`integration-config-panel integration-config-panel--wide`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(U,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Session and power safety`,`ایمنی نشست و توان`)}),(0,q.jsx)(`small`,{children:J.lifecycle_safety.refresh_on_resume?N(`Automatic reconciliation`,`همگام‌سازی خودکار`):N(`Manual reconciliation`,`همگام‌سازی دستی`)})]})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`When Windows locks`,`هنگام قفل‌شدن ویندوز`)}),(0,q.jsx)(k,{value:J.lifecycle_safety.session_lock,label:N(`Session-lock safety action`,`عمل ایمنی هنگام قفل نشست`),options:pn,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,session_lock:e}}))}})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Before system suspend`,`پیش از تعلیق سیستم`)}),(0,q.jsx)(k,{value:J.lifecycle_safety.suspend,label:N(`Suspend safety action`,`عمل ایمنی هنگام تعلیق`),options:pn,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,suspend:e}}))}})]}),(0,q.jsx)(j,{checked:J.lifecycle_safety.refresh_on_resume,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,refresh_on_resume:e}}))},label:N(`Reconcile after unlock, resume, and network changes`,`همگام‌سازی پس از بازشدن قفل، بازگشت و تغییر شبکه`),detail:J.lifecycle_safety.refresh_on_resume?N(n.connected?`The host will refresh live telemetry without forcing a reconnect.`:`The host will re-arm discovery while respecting a manually paused connection.`,n.connected?`میزبان بدون اتصال مجدد اجباری، تله‌متری زنده را تازه می‌کند.`:`میزبان با حفظ توقف دستی اتصال، کشف دستگاه را دوباره فعال می‌کند.`):N(`The current connection state will be preserved until you act.`,`وضعیت فعلی اتصال تا اقدام شما حفظ می‌شود.`)})]}),(0,q.jsxs)(`footer`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:zt===`Saved`?`text-good`:zt?`text-warn`:``,children:zt===`Saved`?N(`Host service and lifecycle settings saved.`,`تنظیمات سرویس و چرخهٔ میزبان ذخیره شد.`):zt||(tn?N(`Review and save the current changes.`,`تغییرات فعلی را بازبینی و ذخیره کنید.`):N(`No pending changes.`,`تغییری در انتظار ذخیره نیست.`))}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:It,disabled:!tn||!en,children:N(`Save host settings`,`ذخیرهٔ تنظیمات میزبان`)})]})]})})]})]})}export{tn as ControlsView,en as DashboardView,sn as EventsView,on as LocalDeviceView,cn as SettingsView}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunk-DqITOKt5.js","assets/app-DeBWQZ2a.js","assets/index-B-6g0IjL.css"])))=>i.map(i=>d[i]); +import{B as e,C as t,E as n,Et as r,F as i,G as a,H as o,I as s,It as c,J as l,K as u,L as d,M as f,Nt as p,Ot as m,P as h,Pt as g,Q as _,R as v,St as y,T as b,Tt as x,U as ee,V as S,W as C,X as w,Y as T,Z as E,_ as D,_t as O,at as k,bt as te,c as A,ct as j,d as ne,dt as re,et as ie,f as ae,g as oe,gt as se,h as M,ht as ce,i as le,it as ue,l as N,lt as P,m as de,mt as fe,nt as F,ot as I,p as pe,q as me,rt as L,s as he,st as R,t as z,tt as ge,u as _e,ut as ve,w as ye,wt as be,x as xe,y as Se,yt as B,z as Ce,zt as we}from"./app-DeBWQZ2a.js";import{i as Te,n as Ee,r as De,t as Oe}from"./chunk-CNKgOZEf.js";import{_ as ke,a as Ae,c as je,d as V,f as Me,g as Ne,h as H,i as Pe,l as Fe,m as Ie,n as Le,o as Re,p as ze,r as Be,s as Ve,t as He,u as Ue,v as We,x as Ge,y as Ke}from"./chunk-CaV14yNF.js";import{n as qe,t as Je}from"./chunk-CWQLWOOn.js";import{n as U,t as Ye}from"./chunk-B6TQ82AF.js";import{n as Xe,t as Ze}from"./chunk-B3YpOg3Z.js";import{t as W}from"./chunk-BZ_h0xog.js";var Qe={name:`chart-no-axes-combined`,size:24,node:[[`path`,{d:`M12 16v5`,key:`zza2cw`}],[`path`,{d:`M16 14.639V21`,key:`1s85h0`}],[`path`,{d:`M20 10.656V21`,key:`q45596`}],[`path`,{d:`m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15`,key:`1fw8x9`}],[`path`,{d:`M4 18.463V21`,key:`1otddq`}],[`path`,{d:`M8 14.656V21`,key:`1t2idw`}]]};Qe.node;var $e=g(Qe),et={name:`circle-power`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M7.998 9.003a5 5 0 1 0 8-.005`,key:`1pek45`}]],aliases:[`power-circle`]};et.node;var tt=g(et),nt={name:`circuit-board`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M11 9h4a2 2 0 0 0 2-2V3`,key:`1ve2rv`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`M7 21v-4a2 2 0 0 1 2-2h4`,key:`1fwkro`}],[`circle`,{cx:`15`,cy:`15`,r:`2`,key:`3i40o0`}]]};nt.node;var rt=g(nt),it={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};it.node;var at=g(it),ot={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};ot.node;var st=g(ot),ct={name:`heart-pulse`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]};ct.node;var lt=g(ct),ut={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};ut.node;var G=g(ut),dt={name:`monitor-smartphone`,size:24,node:[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]};dt.node;var ft=g(dt),pt={name:`octagon-alert`,size:24,node:[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]],aliases:[`alert-octagon`]};pt.node;var mt=g(pt),ht={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};ht.node;var gt=g(ht),_t={name:`power`,size:24,node:[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]};_t.node;var vt=g(_t),yt={name:`timer-reset`,size:24,node:[[`path`,{d:`M10 2h4`,key:`n1abiw`}],[`path`,{d:`M12 14v-4`,key:`1evpnu`}],[`path`,{d:`M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6`,key:`1ts96g`}],[`path`,{d:`M9 17H4v5`,key:`8t5av`}]]};yt.node;var bt=g(yt),xt={name:`toggle-right`,size:24,node:[[`circle`,{cx:`15`,cy:`12`,r:`3`,key:`1afu0r`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};xt.node;var St=g(xt),Ct={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};Ct.node;var wt=g(Ct),K=we(c(),1),q=re();function Tt(e){let t=e.kind.toLowerCase();return t.includes(`error`)||t.includes(`fault`)||t.includes(`hot`)?`bad`:t.includes(`warning`)||t.includes(`door`)||t.includes(`disconnect`)?`warn`:t.includes(`connect`)||t.includes(`ready`)||t.includes(`complete`)?`good`:`info`}function Et(e){return e.text||e.reason||e.state}function Dt({events:e,locale:t,t:n,limit:r=6,toolbar:i=!1}){let a=(e,n)=>t===`fa`?n:e,o=(0,K.useMemo)(()=>[{id:`time`,label:a(`Time`,`زمان`),get:e=>e.time,width:142},{id:`kind`,label:a(`Type`,`نوع`),get:e=>e.kind,width:165},{id:`message`,label:a(`Message`,`پیام`),get:Et,width:330},{id:`source`,label:a(`Source`,`مبدأ`),get:e=>e.source,width:170,visible:i},{id:`metadata`,label:a(`Metadata`,`فراداده`),get:e=>e.metadata,width:270,visible:i}],[t,i]),s=e.slice(0,r);return(0,q.jsx)(Xe,{records:s,fields:o,locale:t,direction:t===`fa`?`rtl`:`ltr`,ariaLabel:a(`Controller event collection`,`مجموعهٔ رویدادهای کنترلر`),filename:`controller-events`,toolbar:i,windowSize:120,preserveViewportAnchor:!0,className:`typed-collection--events${i?``:` typed-collection--compact`}`,rowKey:e=>`${e.id}:${e.time}`,rowClassName:e=>`typed-collection__row--${Tt(e)}`,renderCell:(e,n,r)=>{if(e.id===`time`)return(0,q.jsx)(`time`,{dateTime:r.time,children:xe(t,r.time)});if(e.id===`kind`)return(0,q.jsx)(`strong`,{className:`typed-collection__event-kind`,children:r.kind});if(e.id===`message`)return(0,q.jsxs)(`div`,{className:`typed-collection__event-copy`,children:[(0,q.jsx)(`span`,{className:`typed-collection__event-message`,dir:`auto`,children:Et(r)||`—`}),!i&&r.metadata&&Object.keys(r.metadata).length>0&&(0,q.jsx)(Ze,{value:r.metadata,label:a(`Expand event metadata`,`نمایش فرادادهٔ رویداد`)})]});if(e.id===`metadata`&&r.metadata&&Object.keys(r.metadata).length)return(0,q.jsx)(Ze,{value:r.metadata,label:a(`Expand event metadata`,`نمایش فرادادهٔ رویداد`)});if(n===void 0)return(0,q.jsx)(`span`,{"aria-hidden":`true`,children:`—`})},empty:(0,q.jsx)(E,{icon:p,title:n(`noEvents`),detail:n(`eventStream`)})})}var Ot=[{value:`app page dashboard`,group:`navigation`,label:{en:`Open dashboard`,fa:`باز کردن داشبورد`}},{value:`app page controls`,group:`navigation`,label:{en:`Open controls`,fa:`باز کردن کنترل‌ها`}},{value:`app page workbench`,group:`navigation`,label:{en:`Open workbench`,fa:`باز کردن میزکار`}},{value:`app page updates`,group:`navigation`,label:{en:`Open updates`,fa:`باز کردن به‌روزرسانی‌ها`}},{value:`app page settings`,group:`navigation`,label:{en:`Open settings`,fa:`باز کردن تنظیمات`}},{value:`app page events`,group:`navigation`,label:{en:`Open event timeline`,fa:`باز کردن رویدادها`}},{value:`status`,group:`diagnostics`,label:{en:`Read controller status`,fa:`خواندن وضعیت کنترلر`}},{value:`os facts system`,group:`diagnostics`,label:{en:`Read host system facts`,fa:`خواندن اطلاعات سیستم میزبان`}},{value:`os facts serial`,group:`diagnostics`,label:{en:`Inspect host serial ports`,fa:`بررسی درگاه‌های سریال میزبان`}},{value:`relay off`,group:`safety`,label:{en:`Turn all outputs off`,fa:`خاموش کردن همه خروجی‌ها`}}],kt=new Set([`Alt`,`AltGraph`,`Control`,`Meta`,`OS`,`Shift`,`Super`,`Win`,`Windows`]),At={Backspace:`BACKSPACE`,Tab:`TAB`,Enter:`ENTER`,Escape:`ESC`,Esc:`ESC`," ":`SPACE`,Space:`SPACE`,Spacebar:`SPACE`,PageUp:`PAGEUP`,PageDown:`PAGEDOWN`,End:`END`,Home:`HOME`,ArrowLeft:`LEFT`,Left:`LEFT`,ArrowUp:`UP`,Up:`UP`,ArrowRight:`RIGHT`,Right:`RIGHT`,ArrowDown:`DOWN`,Down:`DOWN`,Insert:`INSERT`,Delete:`DELETE`,Del:`DELETE`,AudioVolumeMute:`VOLUME_MUTE`,VolumeMute:`VOLUME_MUTE`,AudioVolumeDown:`VOLUME_DOWN`,VolumeDown:`VOLUME_DOWN`,AudioVolumeUp:`VOLUME_UP`,VolumeUp:`VOLUME_UP`,MediaTrackNext:`MEDIA_NEXT`,MediaNextTrack:`MEDIA_NEXT`,MediaTrackPrevious:`MEDIA_PREVIOUS`,MediaPreviousTrack:`MEDIA_PREVIOUS`,MediaStop:`MEDIA_STOP`,MediaPlayPause:`MEDIA_PLAY_PAUSE`},jt={ESC:`Esc`,BACKSPACE:`Backspace`,TAB:`Tab`,ENTER:`Enter`,SPACE:`Space`,PAGEUP:`Page Up`,PAGEDOWN:`Page Down`,END:`End`,HOME:`Home`,LEFT:`←`,UP:`↑`,RIGHT:`→`,DOWN:`↓`,INSERT:`Insert`,DELETE:`Delete`,VOLUME_MUTE:`Mute`,VOLUME_DOWN:`Volume Down`,VOLUME_UP:`Volume Up`,MEDIA_NEXT:`Media Next`,MEDIA_PREVIOUS:`Media Previous`,MEDIA_STOP:`Media Stop`,MEDIA_PLAY_PAUSE:`Play/Pause`};function Mt(e){let t=e.code??``;return/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^F(?:[1-9]|1[0-9]|2[0-4])$/.test(t)?t:At[e.key]||(/^F(?:[1-9]|1[0-9]|2[0-4])$/i.test(e.key)||/^[a-z0-9]$/i.test(e.key)?e.key.toUpperCase():null)}function Nt(e){if(e.repeat||e.isComposing||e.keyCode===229||e.key===`Process`||e.key===`Dead`||e.key===`Unidentified`||kt.has(e.key)||e.getModifierState?.(`AltGraph`))return null;let t=Mt(e);if(!t)return null;let n=[];if(e.ctrlKey&&n.push(`Ctrl`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),e.metaKey&&n.push(`Win`),n.length===0&&!/^F(?:[1-9]|1[0-9]|2[0-4])$/.test(t))return null;let r=[...n,t].join(`+`);return{canonical:r,keys:J(r)}}function J(e){return e.split(`+`).map(e=>e.trim()).filter(Boolean).map(e=>jt[e.toUpperCase()]??{CTRL:`Ctrl`,CONTROL:`Ctrl`,ALT:`Alt`,OPTION:`Alt`,SHIFT:`Shift`,WIN:`Win`,WINDOWS:`Win`,META:`Win`,SUPER:`Win`}[e.toUpperCase()]??e)}function Y(e){return new TextEncoder().encode(e).length}function Pt(e,t){let n=``;for(let r of e){if(Y(n+r)>t)break;n+=r}return n}function Ft(e){return Pt(e.normalize(`NFKC`).replace(/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,``).replace(/\s+/g,` `).trimStart(),64)}function It(e){return Ot.some(t=>t.value===e)}function Lt(e){let t=e.status;if(!t)return{state:`unavailable`,detail:`The host did not expose registrar status.`};if(t.last_error)return{state:`error`,detail:t.last_error};if(!t.supported)return{state:`error`,detail:`Global hotkeys are not supported by this host.`};let n=e.bindings.filter(e=>e.enabled),r=t.bindings??[];if(n.length===0)return!t.running&&r.length===0?{state:`idle`,detail:`No global shortcuts are enabled.`}:{state:`pending`,detail:`The host is removing the previous shortcuts.`};if(!t.running)return{state:`pending`,detail:`The host registrar has not started yet.`};if(n.length!==r.length)return{state:`pending`,detail:`The host is reconciling the shortcut set.`};let i=new Map(r.map(e=>[e.name.toLocaleLowerCase(`en-US`),e]));for(let e of n){let t=i.get(e.name.toLocaleLowerCase(`en-US`));if(!t||t.accelerator!==e.chord||t.command!==e.command)return{state:`pending`,detail:`The host has not confirmed ${e.name} yet.`}}return{state:`active`,detail:`${n.length} global shortcut${n.length===1?``:`s`} active.`}}var Rt=new Set([`Alt`,`AltGraph`,`Control`,`Meta`,`OS`,`Shift`,`Super`,`Win`,`Windows`]);function X(e,t,n){return e===`fa`?n:t}function zt(e,t,r){if(r.state===`active`){let r=t.bindings.filter(e=>e.enabled).length;return e===`fa`?`${n(`fa`,r)} میانبر سراسری فعال است.`:`${r} global ${r===1?`shortcut is`:`shortcuts are`} active.`}return r.state===`idle`?X(e,`No global shortcuts are enabled.`,`هیچ میانبر سراسری فعالی وجود ندارد.`):r.detail}function Z(e,t){return new Promise(n=>{if(t.aborted){n(!1);return}let r=window.setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},e),i=()=>{window.clearTimeout(r),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Bt({chord:e}){return(0,q.jsx)(ie,{keys:J(e)})}function Vt({locale:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!0),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(null),[u,d]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,g]=(0,K.useState)(Ot[0].value),[_,v]=(0,K.useState)(!0),[y,b]=(0,K.useState)(!1),[ee,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(!1),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(`info`),[te,A]=(0,K.useState)(!1),ne=(0,K.useRef)(null),re=(0,K.useRef)(null),ie=(0,K.useRef)(null),ae=e=>{c(e.name),d(e.name),m(e.chord),g(e.command),v(e.enabled),b(!1),A(!1),D(``)},oe=(t=!1)=>{c(null),d(``),m(``),g(Ot[0].value),v(!0),b(!1),A(!1),D(X(e,`Name the shortcut, record its keys, then choose an action.`,`میانبر را نام‌گذاری کنید، کلیدها را ضبط و سپس یک کنش انتخاب کنید.`)),k(`info`),t&&window.requestAnimationFrame(()=>re.current?.focus())},se=async(e,t=!1)=>{o(``);try{let r=await f(`controller.hotkeys.get`,{},e);if(n(r),t){let e=r.bindings[0];e?ae(e):oe()}return r}catch(t){if(e?.aborted)return null;let n=t instanceof Error?t.message:String(t);return o(n),null}finally{e?.aborted||i(!1)}};(0,K.useEffect)(()=>{let e=new AbortController;return se(e.signal,!0),()=>{e.abort(),ie.current?.abort()}},[]);let M=(0,K.useMemo)(()=>t?.bindings.find(e=>e.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`)),[s,t]),le=Ft(u).trim(),ue=t?.bindings.some(e=>e.name.toLocaleLowerCase(`en-US`)===le.toLocaleLowerCase(`en-US`)&&e.name.toLocaleLowerCase(`en-US`)!==s?.toLocaleLowerCase(`en-US`))??!1,N=t?.bindings.some(e=>e.chord===p&&e.name.toLocaleLowerCase(`en-US`)!==s?.toLocaleLowerCase(`en-US`))??!1,P=le?ue?X(e,`That name is already in use.`,`این نام قبلاً استفاده شده است.`):``:X(e,`A binding name is required.`,`نام میانبر الزامی است.`),de=p?N?X(e,`That key combination is already assigned.`,`این ترکیب کلید قبلاً اختصاص یافته است.`):``:X(e,`Record a supported key combination.`,`یک ترکیب کلید پشتیبانی‌شده ضبط کنید.`),fe=It(h)?``:X(e,`Choose an approved action before saving.`,`پیش از ذخیره، یک کنش تأییدشده انتخاب کنید.`),F=u?P:``,pe=p?de:``,me=!P&&!de&&!fe,L=!M||M.enabled!==_||M.chord!==p||M.command!==h,he=t?Lt(t):null,z=!!(t?.apply_pending||C),ge=!z&&he?.state===`error`?he.detail:``,_e=ge?`danger`:O,ve=r?{tone:`neutral`,label:X(e,`Synchronizing`,`همگام‌سازی`)}:a?{tone:`bad`,label:X(e,`Unavailable`,`دردسترس نیست`)}:z?{tone:`warn`,label:X(e,`Apply pending`,`در انتظار اعمال`)}:he?.state===`active`?{tone:`good`,label:X(e,`Active`,`فعال`)}:he?.state===`error`?{tone:`bad`,label:X(e,`Registration failed`,`ثبت ناموفق`)}:he?.state===`idle`?{tone:`neutral`,label:X(e,`No active bindings`,`بدون میانبر فعال`)}:{tone:`warn`,label:X(e,`Not confirmed`,`تأیید نشده`)},ye=async t=>{ie.current?.abort();let r=new AbortController;ie.current=r,w(!0),n(t),D(X(e,`Saved. Waiting for the host registrar to confirm the change…`,`ذخیره شد؛ در انتظار تأیید تغییر توسط میزبان…`)),k(`info`);for(let t=0;t<16;t+=1){if(!await Z(t===0?100:250,r.signal))return;let i;try{i=await f(`controller.hotkeys.get`,{},r.signal)}catch(e){if(r.signal.aborted)return;w(!1),n(e=>e&&{...e,apply_pending:!1}),D(e instanceof Error?e.message:String(e)),k(`danger`);return}n(i);let a=Lt(i);if(a.state===`active`||a.state===`idle`){w(!1),D(zt(e,i,a)),k(`success`);return}if(a.state===`error`||a.state===`unavailable`){w(!1),D(a.detail),k(a.state===`error`?`danger`:`warning`);return}}w(!1),D(X(e,`Saved, but the registrar did not confirm the change in time.`,`ذخیره شد، اما ثبت‌کننده در زمان مقرر تغییر را تأیید نکرد.`)),k(`warning`)},be=async e=>{if(e.preventDefault(),me&&L){S(!0),A(!1),D(``);try{let e=await f(`controller.hotkeys.set`,{operation:`upsert`,name:M?.name??le,enabled:_,chord:p,command:h}),t=e.bindings.find(e=>e.name.toLocaleLowerCase(`en-US`)===(M?.name??le).toLocaleLowerCase(`en-US`));t&&ae(t),ye(e)}catch(e){D(e instanceof Error?e.message:String(e)),k(`danger`)}finally{S(!1)}}},xe=async()=>{if(M){if(!te)A(!0),D(X(e,`Confirm removal of “${M.name}”.`,`حذف «${M.name}» را تأیید کنید.`)),k(`warning`);else{S(!0);try{let e=await f(`controller.hotkeys.set`,{operation:`remove`,name:M.name});oe(!0),ye(e)}catch(e){D(e instanceof Error?e.message:String(e)),k(`danger`)}finally{S(!1)}}}},Se=()=>{b(!0),A(!1),D(X(e,`Listening now. Press a combination, or Escape to cancel.`,`در حال شنیدن؛ ترکیب کلید را بزنید یا با Escape لغو کنید.`)),k(`info`),window.requestAnimationFrame(()=>ne.current?.focus())},B=t=>{if(!y||t.nativeEvent.isComposing||t.keyCode===229)return;if(t.stopPropagation(),t.key===`Escape`&&!t.ctrlKey&&!t.altKey&&!t.shiftKey&&!t.metaKey){t.preventDefault(),b(!1),D(X(e,`Shortcut recording cancelled.`,`ضبط میانبر لغو شد.`)),k(`info`);return}if(Rt.has(t.key)||t.repeat)return;t.preventDefault();let n=Nt(t.nativeEvent);n?(m(n.canonical),b(!1),A(!1),D(X(e,`Recorded ${n.canonical}.`,`${n.canonical} ضبط شد.`)),k(`success`)):(D(X(e,`Use Ctrl, Alt, Shift or Win with a supported key; F1–F24 may be used alone.`,`از Ctrl، Alt، Shift یا Win همراه یک کلید پشتیبانی‌شده استفاده کنید؛ F1 تا F24 می‌توانند تنها باشند.`)),k(`warning`))},Ce=[`navigation`,`diagnostics`,`safety`].map(e=>({group:e,commands:Ot.filter(t=>t.group===e)}));return(0,q.jsx)(T,{icon:x,iconTone:ve.tone===`bad`?`red`:ve.tone===`good`?`green`:ve.tone===`warn`?`amber`:`violet`,title:X(e,`Global shortcuts`,`میانبرهای سراسری`),eyebrow:ve.label,className:`settings-card settings-card--wide hotkey-card`,action:(0,q.jsx)(I,{tone:ve.tone,pulse:z,children:ve.label}),children:a&&!t?(0,q.jsxs)(`div`,{className:`hotkey-editor__load-error`,role:`alert`,children:[(0,q.jsx)(ce,{"aria-hidden":`true`,size:20}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:X(e,`Hotkey settings could not be loaded`,`تنظیمات میانبر بارگیری نشد`)}),(0,q.jsx)(`span`,{children:a})]}),(0,q.jsx)(l,{icon:De,busy:r,onClick:()=>{i(!0),se(void 0,!0)},children:X(e,`Retry`,`تلاش دوباره`)})]}):(0,q.jsxs)(`div`,{className:`hotkey-editor`,children:[(0,q.jsxs)(`section`,{className:`hotkey-editor__library`,"aria-label":X(e,`Configured global shortcuts`,`میانبرهای سراسری پیکربندی‌شده`),children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:X(e,`Bindings`,`میانبرها`)}),(0,q.jsx)(`small`,{children:t?X(e,`${t.bindings.length} configured`,`${t.bindings.length} مورد پیکربندی شده`):X(e,`Loading…`,`در حال بارگیری…`)})]}),(0,q.jsx)(l,{ref:re,compact:!0,icon:ke,onClick:()=>oe(),children:X(e,`New`,`جدید`)})]}),(0,q.jsxs)(`div`,{className:`hotkey-binding-list`,children:[t?.bindings.map(t=>(0,q.jsxs)(`button`,{type:`button`,className:t.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`)?`is-selected`:``,"aria-pressed":t.name.toLocaleLowerCase(`en-US`)===s?.toLocaleLowerCase(`en-US`),onClick:()=>ae(t),children:[(0,q.jsx)(`span`,{className:`hotkey-binding-list__icon`,children:(0,q.jsx)(x,{"aria-hidden":`true`,size:17})}),(0,q.jsxs)(`span`,{className:`hotkey-binding-list__copy`,children:[(0,q.jsx)(`strong`,{children:t.name}),(0,q.jsx)(Bt,{chord:t.chord})]}),(0,q.jsx)(`span`,{className:`hotkey-binding-list__state${t.enabled?` is-enabled`:``}`,children:t.enabled?X(e,`Enabled`,`فعال`):X(e,`Disabled`,`غیرفعال`)})]},t.name)),t?.bindings.length===0&&(0,q.jsxs)(`div`,{className:`hotkey-binding-list__empty`,children:[(0,q.jsx)(x,{"aria-hidden":`true`,size:22}),(0,q.jsx)(`span`,{children:X(e,`No shortcuts configured yet.`,`هنوز میانبری پیکربندی نشده است.`)})]})]})]}),(0,q.jsxs)(`form`,{className:`hotkey-editor__form`,onSubmit:e=>void be(e),children:[(0,q.jsxs)(`header`,{className:`hotkey-editor__form-heading`,children:[(0,q.jsx)(`span`,{className:`hotkey-editor__form-icon`,children:M?(0,q.jsx)(U,{"aria-hidden":`true`,size:19}):(0,q.jsx)(ke,{"aria-hidden":`true`,size:19})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`small`,{children:M?X(e,`EDIT BINDING`,`ویرایش میانبر`):X(e,`NEW BINDING`,`میانبر جدید`)}),(0,q.jsx)(`strong`,{children:M?.name||X(e,`Create a global shortcut`,`ایجاد میانبر سراسری`)})]})]}),(0,q.jsxs)(`div`,{className:`hotkey-editor__fields`,children:[(0,q.jsx)(R,{label:X(e,`Binding name`,`نام میانبر`),value:u,disabled:!!M,autoComplete:`off`,spellCheck:!1,onInput:e=>{d(Ft(e.currentTarget.value)),D(``),A(!1)},onChange:e=>{d(Ft(e.currentTarget.value)),D(``),A(!1)},onBlur:()=>d(e=>e.trim()),error:F||void 0,hint:M?X(e,`Names stay fixed so an edit cannot create a duplicate binding.`,`نام ثابت می‌ماند تا ویرایش، میانبر تکراری نسازد.`):void 0}),(0,q.jsxs)(`label`,{className:`hotkey-command-field${fe?` is-invalid`:``}`,children:[(0,q.jsx)(`span`,{children:X(e,`Action`,`کنش`)}),(0,q.jsxs)(`select`,{value:h,"aria-invalid":fe?!0:void 0,onChange:e=>{g(e.currentTarget.value),D(``),A(!1)},children:[!It(h)&&(0,q.jsx)(`option`,{value:h,disabled:!0,children:X(e,`Existing custom action — choose a safe replacement`,`کنش سفارشی فعلی — یک جایگزین امن انتخاب کنید`)}),Ce.map(({group:t,commands:n})=>(0,q.jsx)(`optgroup`,{label:{navigation:X(e,`Navigation`,`پیمایش`),diagnostics:X(e,`Diagnostics`,`عیب‌یابی`),safety:X(e,`Safety`,`ایمنی`)}[t],children:n.map(t=>(0,q.jsx)(`option`,{value:t.value,children:t.label[e]},t.value))},t))]}),(0,q.jsx)(`small`,{className:fe?`text-bad`:``,dir:`ltr`,children:fe||h})]}),(0,q.jsxs)(`div`,{className:`hotkey-recorder-field${pe?` is-invalid`:``}`,children:[(0,q.jsx)(`span`,{children:X(e,`Key combination`,`ترکیب کلید`)}),(0,q.jsxs)(`button`,{ref:ne,type:`button`,className:`hotkey-recorder${y?` is-recording`:``}`,"aria-pressed":y,"aria-describedby":`hotkey-recorder-message`,onClick:Se,onKeyDown:B,onBlur:()=>{y&&(b(!1),D(X(e,`Shortcut recording stopped.`,`ضبط میانبر متوقف شد.`)),k(`info`))},children:[(0,q.jsx)(`span`,{className:`hotkey-recorder__indicator`,"aria-hidden":`true`}),p?(0,q.jsx)(Bt,{chord:p}):(0,q.jsx)(`span`,{children:X(e,`Record shortcut`,`ضبط میانبر`)}),(0,q.jsx)(`small`,{children:y?X(e,`Listening…`,`در حال شنیدن…`):X(e,`Press to record`,`برای ضبط فشار دهید`)})]}),(0,q.jsx)(`small`,{id:`hotkey-recorder-message`,className:pe?`text-bad`:``,role:pe?`alert`:`status`,children:pe||(y?X(e,`Waiting for a non-modifier key.`,`در انتظار یک کلید غیرترکیبی.`):p?X(e,`The recorded combination is valid.`,`ترکیب ضبط‌شده معتبر است.`):X(e,`No key combination recorded.`,`هنوز ترکیب کلیدی ضبط نشده است.`))})]})]}),(0,q.jsx)(j,{checked:_,onChange:e=>{v(e),D(``),A(!1)},label:X(e,`Enable this global shortcut`,`فعال‌سازی این میانبر سراسری`),detail:_?X(e,`The host will register it after saving.`,`میزبان پس از ذخیره آن را ثبت می‌کند.`):X(e,`The binding is saved but not registered.`,`میانبر ذخیره می‌شود اما ثبت نخواهد شد.`)}),(0,q.jsxs)(`div`,{className:`hotkey-editor__notice is-${_e}`,role:_e===`danger`?`alert`:`status`,"aria-live":`polite`,children:[_e===`danger`?(0,q.jsx)(ce,{"aria-hidden":`true`,size:17}):_e===`success`?(0,q.jsx)(W,{"aria-hidden":`true`,size:17}):(0,q.jsx)(`span`,{className:`hotkey-editor__notice-line`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:ge||E||(t&&he?zt(e,t,he):``)||X(e,`Choose a binding to edit or create a new one.`,`یک میانبر را برای ویرایش انتخاب یا میانبر تازه‌ای ایجاد کنید.`)})]}),(0,q.jsxs)(`footer`,{className:`hotkey-editor__actions`,children:[(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:H,busy:ee,disabled:!me||!L||te||z,children:M?X(e,`Save binding`,`ذخیره میانبر`):X(e,`Add binding`,`افزودن میانبر`)}),M&&(0,q.jsx)(l,{type:`button`,tone:`danger`,icon:V,busy:ee,disabled:z,onClick:()=>void xe(),children:te?X(e,`Confirm remove`,`تأیید حذف`):X(e,`Remove`,`حذف`)}),te&&(0,q.jsx)(l,{type:`button`,tone:`ghost`,onClick:()=>{A(!1),D(``)},children:X(e,`Cancel`,`لغو`)})]})]})]})})}var Ht=[`relay`,`motion`,`pwm`,`display`,`sensor`];function Ut(e,t){let n=new Map(t.map(e=>[e.key,e.default_name]));return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,a(t).normalized]).filter(([e,t])=>t&&t!==n.get(e)).sort(([e],[t])=>e.localeCompare(t)))}function Wt(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Gt({locale:e}){let t=(t,n)=>e===`fa`?n:t,[n,r]=(0,K.useState)([]),[i,o]=(0,K.useState)({}),[c,u]=(0,K.useState)({}),[d,p]=(0,K.useState)(!0),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=!0;return f(`controller.peripherals.get`).then(t=>{if(!e)return;let n=Ut(t.peripheral_names??{},t.peripherals??[]);r(t.peripherals??[]),o(n),u(n),h(``),_(!1)}).catch(t=>{e&&(h(t instanceof Error?t.message:String(t)),_(!0))}).finally(()=>{e&&p(!1)}),()=>{e=!1}},[]);let v=(0,K.useMemo)(()=>Ut(c,n),[n,c]),y=!Wt(v,i),b=Object.keys(v).length,x=(0,K.useMemo)(()=>Ht.map(e=>({kind:e,entries:n.filter(t=>t.kind===e)})).filter(e=>e.entries.length),[n]),ee=e=>({relay:t(`Relays`,`رله‌ها`),motion:t(`Motion sides`,`سمت‌های حرکت`),pwm:t(`PWM and lighting`,`PWM و نورپردازی`),display:t(`Displays`,`نمایشگرها`),sensor:t(`Sensors`,`حسگرها`)})[e]??e,S=(e,t)=>{h(``),_(!1),u(n=>({...n,[e]:s(t)}))},C=async()=>{if(y){p(!0),h(``),_(!1);try{let e=await f(`controller.peripherals.set`,{peripheral_names:v}),i=Ut(e.peripheral_names??{},e.peripherals??n);r(e.peripherals??n),o(i),u(i),h(t(`Names saved.`,`نام‌ها ذخیره شدند.`))}catch(e){h(e instanceof Error?e.message:String(e)),_(!0)}finally{p(!1)}}},w=m||(d?t(`Synchronizing the host peripheral catalog…`,`در حال همگام‌سازی فهرست تجهیزات میزبان…`):y?t(`${b} custom name${b===1?``:`s`} in the validated draft.`,`${b} نام سفارشی در پیش‌نویس معتبر است.`):t(`${n.length} peripherals synchronized · ${b} customized.`,`${n.length} تجهیز همگام است · ${b} مورد سفارشی شده.`));return(0,q.jsxs)(T,{icon:B,iconTone:`accent`,title:t(`Peripheral names`,`نام تجهیزات`),eyebrow:d?t(`Synchronizing`,`در حال همگام‌سازی`):y?t(`Unsaved changes`,`تغییرات ذخیره‌نشده`):t(`Host authoritative`,`مرجع میزبان`),className:`settings-card settings-card--wide peripheral-names-card`,menu:n.length?[{label:t(`Restore every default name`,`بازگردانی همهٔ نام‌های پیش‌فرض`),icon:Ee,onSelect:()=>{u({}),h(``),_(!1)}}]:void 0,children:[(0,q.jsx)(`div`,{className:`peripheral-name-groups`,"aria-busy":d,children:x.map((e,n)=>(0,q.jsxs)(`details`,{className:`peripheral-name-group`,open:n===0,children:[(0,q.jsxs)(`summary`,{children:[(0,q.jsx)(`span`,{children:ee(e.kind)}),(0,q.jsx)(`small`,{children:e.entries.length})]}),(0,q.jsx)(`div`,{className:`peripheral-name-grid`,children:e.entries.map(e=>{let n=c[e.key]??``,r=a(n),i=!!(r.normalized&&r.normalized!==e.default_name);return(0,q.jsx)(R,{label:e.default_name,value:n,placeholder:e.default_name,maxLength:64,onInput:t=>S(e.key,t.currentTarget.value),onChange:t=>S(e.key,t.currentTarget.value),error:r.valid?void 0:r.error,success:i?t(`Custom · ${e.key}`,`سفارشی · ${e.key}`):void 0,action:(0,q.jsx)(l,{compact:!0,disabled:!n,icon:Ee,onClick:()=>S(e.key,``),children:t(`Default`,`پیش‌فرض`)})},e.key)})})]},e.kind))}),(0,q.jsxs)(`footer`,{className:`peripheral-names-card__footer`,children:[(0,q.jsx)(`span`,{className:g?`text-warn`:m&&!y?`text-good`:``,role:`status`,"aria-live":`polite`,children:w}),(0,q.jsx)(l,{tone:`primary`,icon:U,busy:d,disabled:!y,onClick:()=>void C(),children:t(`Save names`,`ذخیرهٔ نام‌ها`)})]})]})}function Kt(e){return e?e.transitioning?e.requested:e.applied:`unknown`}function qt(e,t,n){return e?.find(e=>e.key===t)?.name.trim()||n}var Jt=(0,K.lazy)(()=>z(()=>import(`./chunk-DqITOKt5.js`).then(e=>({default:e.TelemetryChart})),__vite__mapDeps([0,1,2])));function Q(e,t){let[n,r]=(0,K.useState)(Date.now);return(0,K.useEffect)(()=>{let n=0,i=!1,a=e?Date.parse(e):NaN,o=()=>{if(i||!Number.isFinite(a))return;let e=Math.max(0,Date.now()-a),s=e{r(Date.now()),o()},s)};return r(Date.now()),o(),()=>{i=!0,window.clearTimeout(n)}},[t,e]),n}function Yt(e,t,n){return e.connected?e.port.friendly_name||e.port.product||e.port.name||t:e.connection_reason||(n===`fa`?`در انتظار اتصال کنترلر`:`Waiting for a controller connection`)}function Xt(e,t){return e.map(e=>e[t]).filter(e=>typeof e==`number`&&Number.isFinite(e))}function Zt(e){let t=e.kind.toLowerCase();return t.includes(`error`)||t.includes(`fault`)||t.includes(`hot`)?`bad`:t.includes(`warning`)||t.includes(`door`)||t.includes(`disconnect`)?`warn`:t.includes(`connect`)||t.includes(`ready`)||t.includes(`complete`)?`good`:`info`}function Qt({state:e,locale:t,action:n,showTitle:r=!0}){let i=(e,n)=>t===`fa`?n:e,a=e===`connecting`||e===`transport-offline`,o=e===`transport-offline`?i(`Reconnecting…`,`در حال اتصال دوباره…`):e===`connecting`?i(`Connecting…`,`در حال اتصال…`):i(`Board offline`,`برد آفلاین`);return(0,q.jsxs)(`div`,{className:`controller-unavailable is-${e}`,role:`status`,"aria-live":`polite`,children:[a?(0,q.jsxs)(`div`,{className:`connection-fuji`,"aria-hidden":`true`,children:[(0,q.jsx)(`span`,{className:`connection-fuji__sun`}),(0,q.jsx)(`span`,{className:`connection-fuji__rear`}),(0,q.jsx)(`span`,{className:`connection-fuji__face`}),(0,q.jsx)(`span`,{className:`connection-fuji__snow`}),(0,q.jsx)(`span`,{className:`connection-fuji__trace`})]}):(0,q.jsx)(`span`,{className:`controller-unavailable__icon`,"aria-hidden":`true`,children:(0,q.jsx)(Ge,{size:28})}),r&&(0,q.jsx)(`strong`,{children:o}),n&&(0,q.jsx)(`div`,{className:`controller-unavailable__action`,children:n})]})}function $t({snapshot:e,locale:t,reconnect:n,hardwareReset:r}){let i=(e,n)=>t===`fa`?n:e,[a,o]=(0,K.useState)(Date.now);(0,K.useEffect)(()=>{if(e.connection_phase!==`attempting`&&e.connection_phase!==`waiting_retry`)return;let t=window.setInterval(()=>o(Date.now()),250);return()=>window.clearInterval(t)},[e.connection_phase,e.connection_attempt_started,e.connection_next_retry]);let s=oe(e,t,a),c=s.phase===`blocked`?(0,q.jsx)(mt,{size:30}):s.phase===`paused`?(0,q.jsx)(Ue,{size:30}):s.phase===`waiting_retry`?(0,q.jsx)(bt,{size:30}):(0,q.jsx)(gt,{size:30});return(0,q.jsxs)(`div`,{className:`connection-state connection-state--${s.tone} is-${s.phase}`,role:`status`,"aria-live":`polite`,children:[(0,q.jsx)(`div`,{className:`connection-state__icon`,"aria-hidden":`true`,children:c}),(0,q.jsxs)(`div`,{className:`connection-state__body`,children:[(0,q.jsxs)(`div`,{className:`connection-state__heading`,children:[(0,q.jsx)(`strong`,{children:s.title}),s.attempt&&(0,q.jsx)(`span`,{className:`connection-state__attempt`,children:s.attempt})]}),(0,q.jsx)(`p`,{children:s.detail}),(0,q.jsxs)(`div`,{className:`connection-state__facts`,children:[s.candidate&&(0,q.jsxs)(`span`,{children:[(0,q.jsx)(Oe,{size:15}),s.candidate]}),s.timing&&(0,q.jsxs)(`span`,{children:[(0,q.jsx)(bt,{size:15}),s.timing]})]})]}),(0,q.jsxs)(`div`,{className:`connection-state__actions`,children:[r&&(0,q.jsx)(l,{compact:!0,icon:Ke,onClick:r,children:i(`Hardware reset`,`بازنشانی سخت‌افزاری`)}),(0,q.jsx)(l,{compact:!0,tone:s.phase===`blocked`?`danger`:`primary`,icon:s.animated?De:gt,busy:s.animated,disabled:s.retryDisabled,onClick:n,children:s.action})]})]})}var $=[`telemetry`,`outputs`,`overview`,`actions`,`events`];function en(e){let{appTitle:n,snapshot:i,samples:a,events:o,locale:s,t:c,command:u,refresh:d,openDialog:h}=e,g=(e,t)=>s===`fa`?t:e,_=i.status,v=e.transport.boardState===`ready`&&i.connected&&i.have_status,x=M(i),ee=x.ina219||x.temperatureLED||x.temperatureBTAudio,S=ee,C=[x.invalidINA219?g(`Power measurements unavailable`,`اندازه‌گیری‌های توان در دسترس نیست`):``,x.invalidTemperatureLED?g(`LED temperature unavailable`,`دمای LED در دسترس نیست`):``,x.invalidTemperatureBTAudio?g(`BT Amplifier temperature unavailable`,`دمای آمپلی‌فایر بلوتوث در دسترس نیست`):``].filter(Boolean),E=i.hardware_problems?.[0],O=E?le(E,s):void 0,k=!v&&e.transport.authenticationRequired,te=e.transport.boardState===`loading`,A=!k&&e.transport.streamState===`connecting`,j=!k&&e.transport.streamState!==`open`,ne=oe(i,s),re=v?`good`:A?`info`:ne.tone,ie=j?A?g(`Connecting…`,`در حال اتصال…`):g(`Reconnecting…`,`در حال اتصال دوباره…`):O?.title||(te?g(`Discovering controller board…`,`در حال جستجوی برد کنترلر…`):ne.title),ae=j?void 0:O?.guidance||i.connection_reason||c(`noHardware`),se=v?c(`online`):A?g(`Connecting`,`در حال اتصال`):j?g(`Reconnecting`,`در حال اتصال دوباره`):te?g(`Searching for board`,`در حال جستجوی برد`):ne.title,N=i.hello.build_hash?i.hello.build_hash.toString(16).toUpperCase().padStart(8,`0`):`—`,P=Array.from({length:8},(e,t)=>!!(_.active_relays&1<e.kind===`config`)?.id??0,fe=e.transport.measurementFreshnessMS??1500,F=Q(i.status_updated,fe),pe=ye(s,i.status_updated,fe,F),[me,L]=(0,K.useState)(null),[he,R]=(0,K.useState)(!1),[z,_e]=(0,K.useState)(()=>He(`dashboard`,$)),[ve,be]=(0,K.useState)(null),Se=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!v){L(null);return}let e=!0;return f(`controller.ui.config.get`).then(t=>{e&&L(t)}).catch(()=>{e&&L(null)}),()=>{e=!1}},[v,de]);let B=(e,t)=>qt(me?.controls,e,me?.peripheral_names?.[e]?.trim()||t),Ce=[g(`Side A direction`,`جهت سمت A`),g(`Side A output`,`خروجی سمت A`),g(`Side B direction`,`جهت سمت B`),g(`Side B output`,`خروجی سمت B`),g(`User relay 5`,`رلهٔ کاربر ۵`),g(`User relay 6`,`رلهٔ کاربر ۶`),g(`User relay 7`,`رلهٔ کاربر ۷`),g(`User relay 8`,`رلهٔ کاربر ۸`)],we={move:g(`Move`,`جابجایی`),collapse:g(`Collapse`,`جمع‌کردن`),expand:g(`Expand`,`بازکردن`),hide:g(`Hide`,`پنهان‌کردن`),show:g(`Show`,`نمایش`),customize:g(`Arrange`,`چیدمان`),done:g(`Done`,`پایان`),reset:g(`Reset layout`,`بازنشانی چیدمان`),hidden:g(`Hidden cards`,`کارت‌های پنهان`)},Te=[{id:`telemetry`,label:c(`liveTelemetry`)},{id:`outputs`,label:c(`outputs`)},{id:`overview`,label:c(`status`)},{id:`actions`,label:c(`quickActions`)},{id:`events`,label:c(`events`)}],Ee=z.order.filter(e=>v?e===`telemetry`?ee:e!==`outputs`||x.relays:!1),Oe=e=>{_e(t=>{let n=e(t);return Pe(`dashboard`,$,n),n})},ke=()=>{Be(`dashboard`),_e(He(`dashboard`,$))},V=(e,t,n)=>{let r=document.elementFromPoint(t,n)?.closest(`[data-layout-card-id]`)?.dataset.layoutCardId,i=$.includes(r)?r:void 0;je(Se.current,e,i)&&(Se.current=i,Oe(t=>Le(t,e,i)))},Ne=(e,t)=>Oe(n=>{let r=n.order.filter(e=>Ee.includes(e)&&!n.hidden.includes(e)),i=r[r.indexOf(e)+t];return i?Le(n,e,i):n}),H=(e,t,n)=>(0,q.jsx)(Ve,{id:e,title:t,order:z.order.indexOf(e),collapsed:z.collapsed.includes(e),hidden:z.hidden.includes(e),editing:he,dragging:ve===e,copy:we,onToggleCollapsed:()=>Oe(t=>({...t,collapsed:Ae(t.collapsed,e)})),onHide:()=>Oe(t=>({...t,hidden:Ae(t.hidden,e)})),onReorderStart:e=>{Se.current=null,be(e)},onReorderMove:V,onReorderEnd:()=>{Se.current=null,be(null)},onKeyboardReorder:Ne,children:n});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:v?pe:A?g(`Reconnecting`,`اتصال دوباره`):j?g(`Connection unavailable`,`اتصال در دسترس نیست`):i.paused?g(`Board connection paused`,`اتصال برد متوقف شده`):te?g(`Discovering board`,`در حال جستجوی برد`):g(`PCController host online`,`میزبان PCController آنلاین است`),title:c(`dashboard`),detail:k?c(`authenticationDashboardDetail`):v?Yt(i,n,s):ae,action:(0,q.jsxs)(`div`,{className:`header-actions`,children:[(0,q.jsx)(I,{tone:re,pulse:A||i.connection_state===`connecting`,children:se}),!v&&!k&&!j&&(0,q.jsx)(l,{icon:gt,compact:!0,busy:ne.animated,disabled:ne.retryDisabled,onClick:()=>void u(`reconnect`,ne.action),children:ne.action}),(0,q.jsx)(l,{icon:De,compact:!0,onClick:()=>void d(),children:c(`refresh`)}),Ee.length>0&&(0,q.jsx)(Re,{copy:we,editing:he,cards:Te.filter(({id:e})=>Ee.includes(e)),hidden:z.hidden,onToggleEditing:()=>R(e=>!e),onShow:e=>Oe(t=>({...t,hidden:t.hidden.filter(t=>t!==e)})),onReset:ke})]})}),(0,q.jsxs)(`section`,{className:`hero-panel${v?` is-online`:``}`,children:[(0,q.jsxs)(`div`,{className:`hero-panel__identity`,children:[!j&&(0,q.jsx)(`div`,{className:`eyebrow`,children:v?`${g(`Controller board`,`برد کنترلر`)} · ${i.connection_state}`:g(`PCController host · online`,`میزبان PCController · آنلاین`)}),j&&!k?(0,q.jsx)(Qt,{state:A?`connecting`:`transport-offline`,locale:s}):!v&&!k&&!E?(0,q.jsx)($t,{snapshot:i,locale:s,reconnect:()=>void u(`reconnect`,ne.action),hardwareReset:D(i)?()=>void u(`reset lines`,g(`Hardware reset sent`,`بازنشانی سخت‌افزاری ارسال شد`)):void 0}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`h2`,{children:v?i.hello.name||n:k?c(`authenticationDashboard`):ie}),(v||k||ae)&&(0,q.jsx)(`p`,{children:v?`USB ${i.port.vid||`—`}:${i.port.pid||`—`} · ${i.port.name||g(`automatic port`,`درگاه خودکار`)}`:k?c(`authenticationDashboardDetail`):ae})]}),k&&(0,q.jsx)(l,{icon:U,tone:`primary`,onClick:()=>{window.location.hash=`#/settings`},children:g(`Enter access token`,`ورود توکن دسترسی`)})]}),v&&(0,q.jsxs)(`div`,{className:`hero-panel__readout`,dir:`ltr`,children:[(0,q.jsx)(`span`,{children:g(`BUILD`,`ساخت`)}),(0,q.jsx)(`strong`,{children:N}),(0,q.jsx)(`span`,{children:g(`UPTIME`,`زمان کارکرد`)}),(0,q.jsx)(`strong`,{children:t(s,_.uptime_ms)})]})]}),E&&O&&(0,q.jsxs)(`section`,{className:`hardware-alert is-${E.severity}`,role:`alert`,"aria-live":`assertive`,children:[(0,q.jsx)(`div`,{className:`hardware-alert__icon`,children:(0,q.jsx)(ce,{size:24,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`hardware-alert__copy`,children:[(0,q.jsx)(`strong`,{children:O.title}),(0,q.jsx)(`p`,{children:O.guidance}),O.impact&&(0,q.jsx)(`p`,{className:`hardware-alert__impact`,children:O.impact}),(E.os_problem_code||E.location)&&(0,q.jsx)(`span`,{dir:`ltr`,children:[E.os_problem_code?`Windows code ${E.os_problem_code}`:``,E.location||``].filter(Boolean).join(` · `)})]})]}),v&&S&&(0,q.jsxs)(`section`,{className:`metric-grid`,children:[x.ina219&&(0,q.jsx)(ge,{icon:wt,label:B(`sensor.supply-voltage`,c(`voltage`)),value:b(s,_.supply_mv/1e3,2),unit:`V`,values:Xt(a,`supply`),tone:`accent`,scale:`supply`,detail:`${B(`sensor.bus-voltage`,g(`Bus voltage`,`ولتاژ باس`))} · ${b(s,_.bus_mv/1e3,2)} V`}),x.ina219&&(0,q.jsx)(ge,{icon:Fe,label:B(`sensor.current`,c(`current`)),value:b(s,_.current_ma,0),unit:`mA`,values:Xt(a,`current`),tone:`green`,scale:`current`,detail:`${B(`sensor.power`,g(`Load power`,`توان بار`))} · ${b(s,_.power_mw/1e3,2)} W`}),x.temperatureLED&&(0,q.jsx)(ge,{icon:Me,label:B(`sensor.temperature-led`,`${c(`temperature`)} · LED`),value:b(s,_.temperature_led_centi_c/100,1),unit:`°C`,values:Xt(a,`ledTemp`),tone:`amber`,scale:`temperature`}),x.temperatureBTAudio&&(0,q.jsx)(ge,{icon:Me,label:B(`sensor.temperature-audio`,g(`BT Amplifier temperature`,`دمای آمپلی‌فایر بلوتوث`)),value:b(s,_.temperature_bt_audio_centi_c/100,1),unit:`°C`,values:Xt(a,`btTemp`),tone:`violet`,scale:`temperature`})]}),v&&C.length>0&&(0,q.jsx)(`div`,{className:`measurement-alerts`,role:`status`,"aria-live":`polite`,children:C.map(e=>(0,q.jsxs)(`div`,{className:`measurement-alert`,children:[(0,q.jsx)(ce,{size:16}),(0,q.jsx)(`span`,{children:e})]},e))}),(0,q.jsxs)(`section`,{className:`dashboard-layout-grid`,children:[v&&ee&&H(`telemetry`,c(`liveTelemetry`),(0,q.jsx)(T,{icon:$e,iconTone:`violet`,title:c(`liveTelemetry`),eyebrow:pe,className:`telemetry-chart-card`,action:(0,q.jsxs)(I,{tone:`good`,children:[a.length,` `,g(`samples`,`نمونه`)]}),menu:[{label:g(`Refresh telemetry`,`تازه‌سازی تله‌متری`),icon:De,onSelect:()=>{d()}},{label:g(`Open Workbench`,`بازکردن میزکار`),icon:Ye,onSelect:()=>{window.location.hash=`#/workbench`}}],children:(0,q.jsx)(K.Suspense,{fallback:(0,q.jsxs)(`div`,{className:`telemetry-chart__empty`,role:`status`,children:[(0,q.jsx)(p,{size:22}),(0,q.jsx)(`span`,{children:s===`fa`?`در حال آماده‌سازی نمودار…`:`Preparing chart…`})]}),children:(0,q.jsx)(Jt,{connected:!0,locale:s,samples:a,reduceMotion:e.reduceMotion})})})),v&&x.relays&&H(`outputs`,c(`outputs`),(0,q.jsxs)(T,{icon:St,iconTone:P?`amber`:`green`,title:c(`outputs`),eyebrow:`R1—R8`,className:`outputs-card`,action:(0,q.jsx)(I,{tone:_.active_relays?`warn`:`neutral`,children:_.active_relays?`${P} ${g(`ACTIVE`,`فعال`)}`:g(`SAFE`,`ایمن`)}),menu:[{label:g(`Read controller status`,`خواندن وضعیت کنترلر`),icon:r,onSelect:()=>{u(`status`)}},{label:g(`Release every output`,`آزادسازی همهٔ خروجی‌ها`),icon:Ue,tone:`danger`,onSelect:()=>h({tone:`danger`,title:c(`confirmEmergencyTitle`),body:c(`confirmEmergencyBody`),confirmLabel:c(`emergencyOff`),action:async()=>{await u(`relay off`),await u(`pwm off`)}})}],children:[(0,q.jsx)(`div`,{className:`output-matrix`,children:Array.from({length:8},(e,t)=>{let n=!!(_.active_relays&1<void u(`relay ${t+1} ${n?`off`:`on`}`,g(`R${t+1} ${n?`off`:`on`}`,`رلهٔ ${t+1} ${n?`خاموش`:`روشن`} شد`)),"aria-pressed":n,children:[(0,q.jsxs)(`span`,{children:[`R`,t+1,` · `,B(`relay.${t+1}`,Ce[t])]}),(0,q.jsx)(`strong`,{children:c(n?`on`:`off`)}),(0,q.jsx)(`i`,{"aria-hidden":`true`})]},t)})}),(0,q.jsxs)(`div`,{className:`safety-strip`,children:[(0,q.jsx)(U,{size:17}),(0,q.jsx)(`span`,{children:P?g(`${P} outputs active · confirmation required for emergency release`,`${P} خروجی فعال است · آزادسازی اضطراری به تأیید نیاز دارد`):g(`All physical outputs are released`,`همهٔ خروجی‌های فیزیکی آزاد هستند`)})]})]})),v&&H(`overview`,c(`status`),(0,q.jsx)(T,{icon:r,iconTone:`green`,title:c(`status`),eyebrow:c(`device`),className:`device-card`,menu:[{label:g(`Read identity`,`خواندن شناسه`),icon:m,onSelect:()=>{u(`hello`)}},{label:g(`Open controller controls`,`بازکردن کنترل‌های برد`),icon:rt,onSelect:()=>{window.location.hash=`#/controls`}}],children:(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:c(`device`),value:i.port.friendly_name||i.port.name||`—`}),(0,q.jsx)(w,{label:c(`firmware`),value:i.hello.build_timestamp||N,mono:!0}),(0,q.jsx)(w,{label:c(`door`),value:_.door_open?c(`open`):c(`closed`),tone:_.door_open?`warn`:`good`}),x.bluetoothAudio&&(0,q.jsx)(w,{label:c(`bluetooth`),value:_.bluetooth_audio_state===2?c(`online`):_.bluetooth_audio_state===1?c(`connecting`):c(`offline`)}),(0,q.jsx)(w,{label:g(`UART CRC / framing`,`CRC / قاب‌بندی UART`),value:`${_.crc_errors} / ${_.framing_errors}`,mono:!0,tone:_.crc_errors||_.framing_errors?`warn`:`good`}),(0,q.jsx)(w,{label:g(`Reset count`,`تعداد بازنشانی`),value:_.reset_count,mono:!0})]})})),v&&H(`actions`,c(`quickActions`),(0,q.jsx)(T,{icon:wt,iconTone:`amber`,title:c(`quickActions`),eyebrow:g(`Confirmation protected`,`محافظت‌شده با تأیید`),className:`actions-card`,children:(0,q.jsxs)(`div`,{className:`action-grid`,children:[(0,q.jsx)(l,{icon:mt,tone:`danger`,onClick:()=>void u(`estop ${i.emergency_stop?.active?`off`:`on`}`),children:i.emergency_stop?.active?g(`Release E-STOP`,`آزادسازی توقف اضطراری`):g(`Engage E-STOP`,`فعال‌سازی توقف اضطراری`)}),(0,q.jsx)(l,{icon:r,onClick:()=>void u(`status`),children:g(`Read status`,`خواندن وضعیت`)}),x.statusLED&&(0,q.jsx)(l,{icon:y,onClick:()=>void u(`rgb effect play attention`),children:g(`Attention cue`,`اعلان توجه`)})]})})),v&&H(`events`,c(`events`),(0,q.jsx)(T,{icon:p,iconTone:`violet`,title:c(`events`),eyebrow:o.length?`${xe(s,o[0].time)} · ${o[0].kind}`:c(`eventStream`),className:`activity-card`,action:(0,q.jsx)(`span`,{className:`count-chip`,children:o.length}),menu:[{label:g(`Open full timeline`,`بازکردن خط زمانی کامل`),icon:p,onSelect:()=>{window.location.hash=`#/events`}},{label:g(`Refresh snapshot`,`تازه‌سازی وضعیت`),icon:De,onSelect:()=>{d()}}],children:(0,q.jsx)(Dt,{events:o,locale:s,t:c})}))]})]})}function tn(e){let{snapshot:t,locale:n,t:r,command:i,openDialog:a}=e,o=(e,t)=>n===`fa`?t:e,s=e.transport.boardState===`ready`&&t.connected&&t.have_status,c=M(t),u=!!t.emergency_stop?.active,d=()=>Array.from({length:16},(e,n)=>n===t.status.pwm_channel?t.status.pwm_value:0),[p,m]=(0,K.useState)(d),[h,g]=(0,K.useState)(d),[v,b]=(0,K.useState)(!1),[x,ee]=(0,K.useState)([]),[S,C]=(0,K.useState)(``),[w,E]=(0,K.useState)(!1),[O,k]=(0,K.useState)(null),te=(0,K.useRef)({}),[j,re]=(0,K.useState)(25),[ie,se]=(0,K.useState)(130),[ce,le]=(0,K.useState)(220),[P,fe]=(0,K.useState)(190),[me,he]=(0,K.useState)(`#000000`),[R,z]=(0,K.useState)(`color`),[ge,ve]=(0,K.useState)(1600),[ye,be]=(0,K.useState)(8),[xe,Se]=(0,K.useState)(`loop`),[B,Ce]=(0,K.useState)(`ready`),we=e.events.find(e=>e.kind===`config`)?.id??0,Te=(0,K.useRef)(p),Ee=(0,K.useRef)(0),Oe=(0,K.useRef)(``),ke=`${t.host_instance_id}/${t.connection_generation}`;Oe.current!==ke&&(Oe.current=ke,Ee.current=0);let Ae=(0,K.useRef)(w),je=(0,K.useRef)(null),V=(0,K.useRef)(null),Me=`#${[j,ie,ce].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase(),H=t.have_status_led?t.status_led:void 0,Pe=H?`#${[H.red,H.green,H.blue].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`.toUpperCase():`#000000`,Fe=`${R===`color`?``:` --period ${ge} --minimum ${ye} --repeat ${xe}`}${R===`flash`||R===`cycle`||R===`transition`?` --to "${me}"`:``}`,Le=R===`color`?`rgb color "${Me}" ${P}`:`rgb effect ${R} "${Me}" --brightness ${P}${Fe}`,Re=R===`color`?`rgb profile set ${B} color "${Me}" ${P}`:`rgb profile set ${B} ${R} "${Me}" --brightness ${P}${Fe}`;je.current||=new N,te.current=O?.pwm_channels??{};let Be=e=>te.current[`pwm.${e}`],Ve=(e,t=null)=>{if(e.revision!==void 0&&e.revisione.map((e,r)=>V.current?.isEditing(r)?e:r===t?n.values[r]:V.current?.pendingChannels().includes(r)?e:n.values[r])),C(``),b(!0)):C(`PWM unavailable`)};V.current||=new A({operations:je.current,commit:(e,t)=>f(`controller.pwm.set`,{channel:e,raw_value:t}),onDraft:(e,t)=>{C(``),g(n=>n.map((n,r)=>r===e?t:n))},onAuthoritative:Ve,onPending:e=>ee([...e]),onError:(e,t,n)=>{C(t.message),n&&g(t=>t.map((t,n)=>n===e?Te.current[e]:t))}}),(0,K.useEffect)(()=>()=>V.current?.dispose(),[]),(0,K.useEffect)(()=>{if(!s){k(null);return}let e=!0;return f(`controller.ui.config.get`).then(t=>{e&&k(t)}).catch(()=>{e&&k(null)}),()=>{e=!1}},[s,we,e.events.find(e=>e.kind===`peripherals.changed`)?.id,t.port.name]),(0,K.useEffect)(()=>{if(!s||!c.pwm){b(!1);return}C(``);let t=new _e({eventDriven:e.transport.streamState===`open`,operations:je.current,canRead:()=>!Ae.current&&(V.current?.pendingChannels().length??0)===0,read:e=>f(`controller.pwm.values`,{},e),onAuthoritative:e=>Ve(e),onError:e=>C(e.message)});return t.start(),()=>t.stop()},[c.pwm,s,e.transport.streamState]),(0,K.useEffect)(()=>{s&&t.pwm_values&&Ve(t.pwm_values)},[s,t.pwm_revision,t.pwm_values,x.length]),(0,K.useEffect)(()=>{if(!e.focusControl||!s||!O)return;let t=[...document.querySelectorAll(`[data-control-key]`)].find(t=>t.dataset.controlKey===e.focusControl?.key);t?.scrollIntoView({block:`center`,behavior:e.reduceMotion?`auto`:`smooth`}),t?.focus({preventScroll:!0})},[e.focusControl,s,O]);let He=[`MOSFET 1`,`MOSFET 2`,`MOSFET 3`,`MOSFET 4`,`MOSFET 5`,`MOSFET 6`,`MOSFET 7`,`MOSFET 8`,o(`User PWM 9`,`PWM کاربر ۹`),o(`User PWM 10`,`PWM کاربر ۱۰`),o(`User PWM 11`,`PWM کاربر ۱۱`),o(`Enclosure light`,`نور محفظه`),o(`Power indicator`,`نشانگر توان`),o(`Status red`,`وضعیت قرمز`),o(`Status green`,`وضعیت سبز`),o(`Status blue`,`وضعیت آبی`)],Ke=[o(`Side A direction`,`جهت سمت A`),o(`Side A output`,`خروجی سمت A`),o(`Side B direction`,`جهت سمت B`),o(`Side B output`,`خروجی سمت B`),o(`User relay 5`,`رلهٔ کاربر ۵`),o(`User relay 6`,`رلهٔ کاربر ۶`),o(`User relay 7`,`رلهٔ کاربر ۷`),o(`User relay 8`,`رلهٔ کاربر ۸`)],qe=(e,t)=>qt(O?.controls,e,O?.peripheral_names?.[e]?.trim()||t),Je=e=>qe(`pwm.${e}`,He[e]),U=(e,t,n=!1)=>{V.current?.schedule(e,de(t,Be(e)),n)},Ye=async(e,t)=>{if(Be(e)){C(``);try{await f(`controller.pwm.channel.configure`,{channel:e,...t});let n=await f(`controller.ui.config.get`);k(n),Ve(await je.current.run(()=>f(`controller.pwm.values`)))}catch(e){C(e instanceof Error?e.message:String(e))}}},Xe=async(e,t)=>{if(!(V.current?.pendingChannels().length||Ae.current)){Ae.current=!0,E(!0),C(``);try{let n=await je.current.run(()=>f(`controller.control.invoke`,{action_id:`pwm.${e}.${t}`}));Ve(n.pwm)}catch(e){C(e instanceof Error?e.message:String(e))}finally{Ae.current=!1,E(!1)}}},Ze=async()=>{if(!x.length){Ae.current=!0,E(!0),C(``);try{Ve(await je.current.run(()=>f(`controller.pwm.off`)))}catch(e){C(e instanceof Error?e.message:String(e))}finally{Ae.current=!1,E(!1)}}};if(!s){let a=e.transport.streamState===`connecting`,s=e.transport.streamState!==`open`,c=a?`connecting`:s?`transport-offline`:`board-offline`,l=oe(t,n),u=a?o(`Connecting…`,`در حال اتصال…`):s?o(`Reconnecting…`,`در حال اتصال دوباره…`):l.title;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:o(`Controller board controls`,`کنترل‌های برد`),title:r(`controls`),detail:s?void 0:t.connection_reason}),(0,q.jsx)(T,{icon:s?Ne:Ge,iconTone:`amber`,title:u,eyebrow:a?o(`Reconnecting`,`اتصال دوباره`):o(`Connection`,`اتصال`),children:s?(0,q.jsx)(Qt,{state:c,locale:n,showTitle:!1}):(0,q.jsx)($t,{snapshot:t,locale:n,reconnect:()=>void i(`reconnect`,l.action),hardwareReset:D(t)?()=>void i(`reset lines`,o(`Hardware reset sent`,`بازنشانی سخت‌افزاری ارسال شد`)):void 0})})]})}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:o(`Connected controller`,`کنترلر متصل`),title:r(`controls`),detail:Yt(t,e.appTitle,n)}),(0,q.jsxs)(`div`,{className:`safety-strip controller-estop${u?` is-danger`:``}`,role:`status`,"aria-live":`assertive`,children:[(0,q.jsx)(mt,{size:17}),(0,q.jsx)(`span`,{children:u?o(`E-STOP locked · effects, motion, relay-on, and PWM output are blocked`,`توقف اضطراری قفل است · افکت‌ها، حرکت، روشن‌کردن رله و خروجی PWM مسدود هستند`):o(`E-STOP ready`,`توقف اضطراری آماده است`)}),(0,q.jsx)(l,{compact:!0,tone:`danger`,onClick:()=>void i(`estop ${u?`off`:`on`}`),children:u?o(`Release`,`آزادسازی`):o(`Engage`,`فعال‌سازی`)})]}),(0,q.jsxs)(`section`,{className:`control-layout`,children:[c.relays&&(0,q.jsxs)(T,{icon:rt,iconTone:t.status.active_relays?`amber`:`green`,eyebrow:o(`Eight protected outputs`,`هشت خروجی محافظت‌شده`),title:o(`Relays & motion`,`رله‌ها و حرکت`),className:`relay-control-card`,action:(0,q.jsx)(I,{tone:t.status.active_relays?`warn`:`good`,children:t.status.active_relays?o(`ENERGIZED`,`برقدار`):o(`RELEASED`,`آزاد`)}),menu:[{label:o(`Refresh output state`,`تازه‌سازی وضعیت خروجی‌ها`),icon:De,onSelect:()=>{i(`status`)}},{label:o(`Release every relay`,`آزادسازی همهٔ رله‌ها`),icon:Ue,tone:`danger`,onSelect:()=>a({tone:`danger`,title:r(`confirmEmergencyTitle`),body:r(`confirmEmergencyBody`),confirmLabel:r(`emergencyOff`),action:async()=>{await i(`relay off`)}})}],children:[(0,q.jsx)(`div`,{className:`relay-bank`,children:Array.from({length:8},(e,n)=>{let a=!!(t.status.active_relays&1<void i(`relay ${n+1} ${a?`off`:`on`}`)}),(0,q.jsx)(`small`,{children:qe(`relay.${n+1}`,Ke[n])}),(0,q.jsxs)(`div`,{className:`relay-switch__actions`,children:[(0,q.jsx)(l,{compact:!0,disabled:a||u,onClick:()=>void i(`relay ${n+1} on`),children:r(`on`)}),(0,q.jsx)(l,{compact:!0,disabled:!a,onClick:()=>void i(`relay ${n+1} off`),children:r(`off`)})]})]},n)})}),(0,q.jsx)(`div`,{className:`motion-actions`,children:[`left`,`right`].map(e=>{let n=t.motion?.[e],r=Kt(n),a=r===`up`?o(`UP`,`بالا`):r===`down`?o(`DOWN`,`پایین`):r===`stop`?o(`STOPPED`,`متوقف`):o(`UNKNOWN`,`نامشخص`);return(0,q.jsxs)(`div`,{className:`motion-side`,"data-control-key":e===`left`?`seat.a`:`seat.b`,tabIndex:-1,children:[(0,q.jsxs)(`div`,{className:`motion-side__identity`,children:[(0,q.jsx)(`strong`,{children:e===`left`?qe(`seat.a`,o(`Side A motion`,`حرکت سمت A`)):qe(`seat.b`,o(`Side B motion`,`حرکت سمت B`))}),(0,q.jsx)(I,{tone:r===`unknown`?`neutral`:r===`stop`?`good`:n?.transitioning?`warn`:`info`,pulse:n?.transitioning,children:n?.transitioning?`${a} · ${o(`SYNCING`,`همگام‌سازی`)}`:a})]}),(0,q.jsxs)(`div`,{className:`motion-side__actions`,children:[(0,q.jsx)(_,{compact:!0,disabled:u,onHoldStart:()=>i(`relay side ${e} up`),onHoldStop:()=>i(`relay side ${e} stop`),children:o(`Hold Up`,`بالا نگه‌دار`)}),(0,q.jsx)(l,{compact:!0,onClick:()=>void i(`relay side ${e} stop`),children:o(`Stop`,`توقف`)}),(0,q.jsx)(_,{compact:!0,disabled:u,onHoldStart:()=>i(`relay side ${e} down`),onHoldStop:()=>i(`relay side ${e} stop`),children:o(`Hold Down`,`پایین نگه‌دار`)})]})]},e)})}),(0,q.jsx)(l,{icon:mt,tone:`danger`,onClick:()=>a({tone:`danger`,title:r(`confirmEmergencyTitle`),body:r(`confirmEmergencyBody`),confirmLabel:r(`emergencyOff`),action:async()=>{await i(`relay off`)}}),children:r(`emergencyOff`)})]}),c.pwm&&(0,q.jsxs)(T,{icon:Ie,iconTone:`violet`,eyebrow:o(`11 user channels · acknowledged writes`,`۱۱ کانال کاربر · نوشتن با تأیید`),title:o(`PWM mixer`,`میکسر PWM`),className:`pwm-card`,action:(0,q.jsx)(I,{tone:S?`bad`:x.length?`warn`:v?`good`:`neutral`,children:S?o(`ERROR`,`خطا`):x.length?o(`SYNCING`,`همگام‌سازی`):v?o(`CONFIRMED`,`تأییدشده`):o(`READING`,`در حال خواندن`)}),children:[(0,q.jsx)(`div`,{className:`pwm-mixer`,children:ne.map(e=>{let n=p[e],i=h[e],a=x.includes(e),s=Je(e),c=Be(e);return(0,q.jsxs)(`div`,{"data-control-key":`pwm.${e}`,tabIndex:-1,className:`pwm-mixer__row${t.status.pwm_channel===e&&!a?` is-live`:``}${a?` is-pending`:``}`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`strong`,{children:[c?.icon===`lightbulb`?`💡 `:c?.output_type===`motor`?`⚙️ `:``,s]}),(0,q.jsx)(`small`,{children:s===He[e]?`pwm.${e}`:`${He[e]} · pwm.${e}`}),(0,q.jsx)(`small`,{children:a?o(`Board ${n} · draft ${i}`,`برد ${n} · پیش‌نویس ${i}`):o(`${pe(n,c)}% brightness · raw ${n}`,`${pe(n,c)}٪ روشنایی · خام ${n}`)}),(0,q.jsxs)(`div`,{className:`pwm-channel-config`,children:[(0,q.jsxs)(`select`,{"aria-label":o(`${s} output type`,`نوع خروجی ${s}`),value:c?.output_type??`general`,onChange:t=>void Ye(e,{output_type:t.target.value,icon:t.target.value===`lighting`?`lightbulb`:t.target.value===`indicator`?`led`:t.target.value===`motor`?`settings`:`sliders-horizontal`}),children:[(0,q.jsx)(`option`,{value:`lighting`,children:o(`Lighting`,`روشنایی`)}),(0,q.jsx)(`option`,{value:`indicator`,children:o(`LED indicator`,`نشانگر LED`)}),(0,q.jsx)(`option`,{value:`motor`,children:o(`Motor`,`موتور`)}),(0,q.jsx)(`option`,{value:`general`,children:o(`General PWM`,`PWM عمومی`)})]}),(0,q.jsxs)(`select`,{"aria-label":o(`${s} response curve`,`منحنی پاسخ ${s}`),value:c?.curve??`linear`,onChange:t=>void Ye(e,{curve:t.target.value,gamma:t.target.value===`linear`?1:c?.gamma===1?2.2:c?.gamma??2.2}),children:[(0,q.jsx)(`option`,{value:`gamma`,children:o(`Perceptual`,`ادراکی`)}),(0,q.jsx)(`option`,{value:`linear`,children:o(`Linear`,`خطی`)})]}),c?.on_behavior&&(0,q.jsxs)(`select`,{"aria-label":o(`${s} On behavior`,`رفتار روشن شدن ${s}`),value:c.on_behavior,disabled:a||w,onChange:t=>void Ye(e,{on_behavior:t.target.value}),children:[(0,q.jsx)(`option`,{value:`full`,children:o(`On: full brightness`,`روشن: نور کامل`)}),(0,q.jsx)(`option`,{value:`restore`,children:o(`On: last brightness`,`روشن: آخرین روشنایی`)})]})]})]}),(0,q.jsx)(F,{label:o(`${s} brightness`,`روشنایی ${s}`),value:pe(i,c),min:0,max:100,step:.1,unit:`%`,disabled:!v||w||u||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked,onEditStart:()=>V.current?.beginEdit(e),onEditEnd:()=>V.current?.endEdit(e),onChange:t=>U(e,t)}),(0,q.jsxs)(`div`,{className:`pwm-mixer__actions`,children:[(0,q.jsx)(l,{compact:!0,disabled:!v||w||a||n===0||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked,onClick:()=>void Xe(e,`off`),children:r(`off`)}),(0,q.jsx)(l,{compact:!0,disabled:!v||w||a||u||O?.controls.find(t=>t.key===`pwm.${e}`)?.locked||(c?.on_behavior===`restore`?n>0:n===4095),onClick:()=>void Xe(e,`on`),children:r(`on`)})]}),c?.curve===`gamma`&&(0,q.jsx)(F,{label:o(`Curve strength`,`شدت منحنی`),value:c.gamma,min:.1,max:5,step:.1,disabled:w,onChange:t=>void Ye(e,{gamma:t})})]},e)})}),(0,q.jsx)(`div`,{className:`system-output-summary`,"aria-label":o(`Role-specific system PWM channels`,`کانال‌های PWM سیستمی با کنترل اختصاصی`),children:[11,12,13,14,15].map(e=>(0,q.jsxs)(`span`,{"data-control-key":`pwm.${e}`,tabIndex:-1,children:[(0,q.jsx)(`strong`,{children:Je(e)}),(0,q.jsxs)(`small`,{children:[p[e],` / 4095`]})]},e))}),(0,q.jsx)(`div`,{className:`pwm-authority-status${S?` is-error`:``}`,role:`status`,"aria-live":`polite`,children:S||(x.length?o(`${x.length} channel${x.length===1?``:`s`} waiting for controller acknowledgement.`,`${x.length} کانال در انتظار تأیید کنترلر است.`):v?o(`Every displayed board value is authoritative; sliders are separate local drafts until acknowledged.`,`همهٔ مقادیر برد معتبرند؛ لغزنده‌ها تا زمان تأیید، پیش‌نویس محلی جداگانه‌اند.`):o(`Reading the complete 16-channel state from the controller…`,`در حال خواندن وضعیت کامل ۱۶ کانال از کنترلر…`))}),(0,q.jsx)(l,{icon:vt,busy:w,disabled:!v||w||x.length>0,onClick:()=>void Ze(),children:o(`Clear all PWM channels`,`پاک‌کردن همهٔ کانال‌های PWM`)})]}),c.statusLED&&(0,q.jsxs)(T,{icon:y,iconTone:`amber`,eyebrow:o(`Color and effects`,`رنگ و افکت‌ها`),title:o(`Status lighting`,`نور وضعیت`),className:`rgb-card`,children:[(0,q.jsxs)(`div`,{className:`status-led-previews`,children:[(0,q.jsxs)(`div`,{className:`color-preview`,style:{"--preview":Me},children:[(0,q.jsx)(`span`,{}),(0,q.jsxs)(`strong`,{children:[o(`Selected`,`انتخاب‌شده`),` · `,Me,` · RGB `,j,` `,ie,` `,ce]})]}),(0,q.jsxs)(`div`,{className:`status-led-live`,style:{"--preview":Pe},children:[(0,q.jsx)(`i`,{"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:o(`Physical LED mirror`,`بازتاب LED فیزیکی`)}),(0,q.jsx)(`small`,{dir:`ltr`,children:H?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mono`,children:Pe}),` · effect ${H.effect} · condition ${H.condition}`]}):o(`Awaiting pushed board state`,`در انتظار وضعیت ارسالی برد`)})]})]})]}),(0,q.jsxs)(`label`,{className:`native-color-field`,children:[(0,q.jsx)(`span`,{children:o(`Color picker`,`انتخاب‌گر رنگ`)}),(0,q.jsx)(`input`,{type:`color`,value:Me,"aria-label":o(`Status LED color`,`رنگ LED وضعیت`),onChange:e=>{let t=e.target.value;re(Number.parseInt(t.slice(1,3),16)),se(Number.parseInt(t.slice(3,5),16)),le(Number.parseInt(t.slice(5,7),16))}}),(0,q.jsx)(`code`,{children:Me})]}),v&&(0,q.jsxs)(`div`,{className:`rgb-board-state`,children:[(0,q.jsx)(`span`,{children:o(`Board-reported PWM`,`PWM گزارش‌شدهٔ برد`)}),(0,q.jsxs)(`strong`,{dir:`ltr`,children:[p[13],` · `,p[14],` · `,p[15]]})]}),(0,q.jsx)(F,{label:o(`Red`,`قرمز`),value:j,min:0,max:255,onChange:re}),(0,q.jsx)(F,{label:o(`Green`,`سبز`),value:ie,min:0,max:255,onChange:se}),(0,q.jsx)(F,{label:o(`Blue`,`آبی`),value:ce,min:0,max:255,onChange:le}),(0,q.jsx)(F,{label:o(`Brightness`,`روشنایی`),value:P,min:0,max:255,onChange:e=>{fe(e),be(t=>Math.min(t,e))}}),(0,q.jsxs)(`div`,{className:`rgb-effect-fields`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Presentation`,`نحوه نمایش`)}),(0,q.jsxs)(`select`,{value:R,onChange:e=>z(e.target.value),children:[(0,q.jsx)(`option`,{value:`color`,children:o(`Steady color`,`رنگ ثابت`)}),(0,q.jsx)(`option`,{value:`breathe`,children:o(`Breathe`,`تنفس`)}),(0,q.jsx)(`option`,{value:`flash`,children:o(`Flash`,`چشمک`)}),(0,q.jsx)(`option`,{value:`cycle`,children:o(`Two-color cycle`,`چرخه دو رنگ`)}),(0,q.jsx)(`option`,{value:`transition`,children:o(`Transition`,`گذار`)})]})]}),R!==`color`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Period`,`دوره`)}),(0,q.jsx)(`input`,{type:`number`,min:640,max:6e4,value:ge,onChange:e=>ve(Math.max(640,Math.min(6e4,Number(e.target.value))))}),(0,q.jsx)(`small`,{children:`ms`})]}),(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Repeat`,`تکرار`)}),(0,q.jsxs)(`select`,{value:xe,onChange:e=>Se(e.target.value),children:[(0,q.jsx)(`option`,{value:`once`,children:o(`Once`,`یک‌بار`)}),(0,q.jsx)(`option`,{value:`loop`,children:o(`Loop`,`پیوسته`)})]})]})]}),R===`breathe`&&(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`Minimum brightness`,`حداقل روشنایی`)}),(0,q.jsx)(`input`,{type:`number`,min:0,max:P,value:ye,onChange:e=>be(Math.max(0,Math.min(P,Number(e.target.value))))})]}),(R===`flash`||R===`cycle`||R===`transition`)&&(0,q.jsxs)(`label`,{className:`native-color-field native-color-field--compact`,children:[(0,q.jsx)(`span`,{children:o(`Second color`,`رنگ دوم`)}),(0,q.jsx)(`input`,{type:`color`,value:me,onChange:e=>he(e.target.value.toUpperCase())}),(0,q.jsx)(`code`,{children:me})]})]}),(0,q.jsxs)(`div`,{className:`inline-actions`,children:[(0,q.jsx)(l,{tone:`primary`,icon:ze,disabled:!t.connected,onClick:()=>void i(Le),children:o(`Apply live`,`اعمال زنده`)}),(0,q.jsx)(l,{disabled:!t.connected,onClick:()=>void i(`rgb effect stop`),children:o(`Stop effect`,`توقف افکت`)})]}),(0,q.jsxs)(`div`,{className:`rgb-profile-row`,children:[(0,q.jsxs)(`label`,{children:[(0,q.jsx)(`span`,{children:o(`EEPROM condition`,`شرط EEPROM`)}),(0,q.jsx)(`select`,{value:B,onChange:e=>Ce(e.target.value),children:[`off`,`boot`,`ready`,`learning`,`hot`,`fault`,`custom`,`bluetooth-connected`,`bluetooth-off`,`bluetooth-waiting`,`running`,`door-open`,`door-closed`,`bluetooth`,`menu`,`radio`,`save`,`discard`,`reset`].map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))})]}),(0,q.jsx)(l,{icon:We,disabled:!t.connected,onClick:()=>void i(Re),children:o(`Save profile (live when active)`,`ذخیره پروفایل (هنگام فعال‌شدن زنده)`)})]})]})]})]})}var nn=[`capabilities`,`snapshot`];function rn(e){return e.http_reachable===!0}function an(e){return e.configured===!0&&!rn(e)}function on({locale:e,t}){let n=(t,n)=>e===`fa`?n:t,[r,i]=(0,K.useState)({power:`unknown`,phase:`idle`}),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(``),[u,d]=(0,K.useState)(null),[p,h]=(0,K.useState)(`capabilities`),[g,_]=(0,K.useState)(``),v=async()=>{try{i(await f(`controller.device.status`)),_(``)}catch(e){_(e instanceof Error?e.message:String(e))}};(0,K.useEffect)(()=>{v();let e=window.setInterval(()=>void v(),3e3);return()=>window.clearInterval(e)},[]);let y=async(t,n=``,a=0)=>{if(t!==`passive.refresh`&&!rn(r))_(e===`fa`?`ارتباط HTTP وسیله در دسترس نیست.`:`The device HTTP command transport is unavailable.`);else{o(t);try{i(await f(`controller.device.action`,{action:t,text:n,count:a})),_(``),t===`display.message`&&c(``)}catch(e){_(e instanceof Error?e.message:String(e))}finally{o(``)}}},b=async()=>{if(!rn(r))_(e===`fa`?`برای بازرسی، ارتباط HTTP لازم است.`:`Inspection requires the device HTTP transport.`);else{o(`inspect`);try{d(await f(`controller.device.inspect`,{resource:p})),_(``)}catch(e){_(e instanceof Error?e.message:String(e))}finally{o(``)}}},x=r.power?.toUpperCase(),ee=x===`ON`,S=rn(r),C=an(r),D=r.configured===!1?e===`fa`?`یکپارچه‌سازی وسیله غیرفعال است`:`Local device integration is disabled`:r.events_online?e===`fa`?`مسیر فرمان HTTP در دسترس نیست`:`HTTP command transport is unavailable`:r.configured?e===`fa`?`وسیلهٔ محلی در دسترس نیست`:`Local companion is unreachable`:g?e===`fa`?`وضعیت وسیله دریافت نشد`:`Companion status is unavailable`:e===`fa`?`در حال بررسی وسیلهٔ محلی`:`Checking local companion availability`,k=r.last_error||g||(r.configured===!1?e===`fa`?`نشانی و فعال‌سازی را در تنظیمات خدمات محلی بررسی کنید.`:`Choose a private-network endpoint and enable it in local-service settings.`:e===`fa`?`وضعیت فعلی: ${r.phase||`نامشخص`}`:`Current phase: ${r.phase||`unknown`}`),A=[{label:e===`fa`?`تازه‌سازی وضعیت`:`Refresh device status`,icon:De,onSelect:()=>{v()}},...C?[{label:e===`fa`?`تلاش دوباره برای اتصال`:`Retry companion connection`,icon:gt,onSelect:()=>{y(`passive.refresh`)}}]:[],...S?[{label:ee?e===`fa`?`خاموش‌کردن وسیله`:`Turn device off`:e===`fa`?`روشن‌کردن وسیله`:`Turn device on`,icon:tt,onSelect:()=>{y(ee?`power.off`:`power.on`)}}]:[]];return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:`${n(`Local companion`,`وسیلهٔ محلی`)} · ${r.phase||`idle`}`,title:r.name||t(`device`),detail:r.base_url||n(`Typed local-network companion through the primary host`,`وسیلهٔ شبکهٔ محلی با قرارداد مشخص، از طریق میزبان اصلی`),action:(0,q.jsx)(I,{tone:r.events_online?`good`:r.http_reachable?`warn`:`bad`,pulse:r.phase===`connecting`,children:r.events_online?n(`EVENT STREAM`,`جریان رویداد`):r.http_reachable?`HTTP`:t(`offline`)})}),(0,q.jsxs)(`section`,{className:`device-layout`,children:[(0,q.jsxs)(T,{icon:m,iconTone:ee?`green`:`amber`,title:n(`Local device`,`وسیلهٔ محلی`),eyebrow:r.events_online?n(`Events connected`,`رویدادها متصل‌اند`):r.http_reachable?n(`HTTP reachable`,`HTTP در دسترس`):n(`Unavailable`,`دردسترس نیست`),className:`device-stage${ee?` is-on`:``}`,menu:A,children:[(0,q.jsxs)(`div`,{className:`device-overview`,"aria-label":n(`Device power ${r.power??`unknown`}`,`توان وسیله ${r.power??`نامشخص`}`),children:[(0,q.jsxs)(`div`,{className:`device-overview__mark`,children:[(0,q.jsx)(m,{size:38}),(0,q.jsx)(`span`,{"aria-hidden":`true`})]}),(0,q.jsxs)(`div`,{className:`device-overview__copy`,children:[(0,q.jsx)(`span`,{children:r.base_url||n(`Host-mediated local connection`,`اتصال محلی با میانجی‌گری میزبان`)}),(0,q.jsx)(`strong`,{children:ee?n(`Device is powered on`,`وسیله روشن است`):x===`OFF`?n(`Device is powered off`,`وسیله خاموش است`):n(`Power state is unknown`,`وضعیت توان نامشخص است`)}),(0,q.jsx)(`small`,{children:r.last_event||r.last_error||(r.phase?`${n(`Phase`,`مرحله`)}: ${r.phase}`:n(`No device event received`,`رویدادی از وسیله دریافت نشده است`))})]})]}),(0,q.jsxs)(`div`,{className:`device-facts`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:t(`status`)}),(0,q.jsx)(`strong`,{children:r.power??t(`unknown`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:n(`Transport`,`رسانهٔ ارتباطی`)}),(0,q.jsx)(`strong`,{children:r.events_online?n(`Events`,`رویدادها`):r.http_reachable?`HTTP`:t(`offline`)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:n(`Updated`,`آخرین تغییر`)}),(0,q.jsx)(`strong`,{children:r.updated_at?xe(e,r.updated_at):`—`})]})]}),S?(0,q.jsxs)(`div`,{className:`device-actions`,children:[(0,q.jsx)(l,{tone:`success`,icon:se,busy:a===`power.on`,onClick:()=>void y(`power.on`),children:t(`on`)}),(0,q.jsx)(l,{tone:`secondary`,icon:te,busy:a===`power.off`,onClick:()=>void y(`power.off`),children:t(`off`)}),(0,q.jsx)(l,{tone:`primary`,icon:tt,busy:a===`power.toggle`,onClick:()=>void y(`power.toggle`),children:t(`toggle`)})]}):(0,q.jsx)(E,{icon:r.configured===!1?O:Ue,title:D,detail:k,action:(0,q.jsxs)(`div`,{className:`device-unavailable__actions`,children:[C&&(0,q.jsx)(l,{compact:!0,tone:`primary`,icon:gt,busy:a===`passive.refresh`,onClick:()=>void y(`passive.refresh`),children:e===`fa`?`تلاش دوباره`:`Retry connection`}),(0,q.jsx)(l,{compact:!0,icon:De,busy:a===`status`,onClick:()=>void v(),children:e===`fa`?`تازه‌سازی وضعیت`:`Refresh status`}),r.configured!==!0&&(0,q.jsx)(l,{compact:!0,icon:O,onClick:()=>{window.location.hash=`#/settings`},children:e===`fa`?`تنظیم یکپارچه‌سازی`:`Open integration settings`})]})}),(0,q.jsx)(ve,{initial:!1,children:g&&(0,q.jsx)(P.div,{className:`inline-error-presence`,initial:{height:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(4px)`},animate:{height:`auto`,opacity:1,clipPath:`inset(0 0 0% 0)`,filter:`blur(0px)`},exit:{height:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(3px)`},transition:{duration:.28,ease:[.22,1,.36,1]},children:(0,q.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,q.jsx)(mt,{size:17}),(0,q.jsx)(`span`,{children:g})]})},`local-device-error`)})]}),(0,q.jsxs)(`div`,{className:`device-side`,children:[S&&(0,q.jsxs)(T,{icon:G,iconTone:`violet`,title:t(`message`),eyebrow:s.length?n(`${s.length} characters`,`${s.length} نویسه`):n(`No message entered`,`پیامی وارد نشده`),action:(0,q.jsx)(I,{tone:`info`,children:n(`LOCAL DEVICE`,`وسیلهٔ محلی`)}),children:[(0,q.jsxs)(`div`,{className:`message-compose`,children:[(0,q.jsx)(`input`,{value:s,maxLength:256,placeholder:n(`A bounded display message`,`پیام کوتاه برای نمایش`),onChange:e=>c(e.target.value)}),(0,q.jsx)(l,{icon:Je,tone:`primary`,busy:a===`display.message`,disabled:!s.trim(),onClick:()=>void y(`display.message`,s.trim()),children:t(`send`)})]}),(0,q.jsxs)(`div`,{className:`beep-row`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(fe,{size:18}),(0,q.jsxs)(`span`,{children:[t(`beep`),` · `,n(`explicit alert pulse`,`پالس هشدار صریح`)]})]}),[1,2,3].map(e=>(0,q.jsxs)(l,{compact:!0,busy:a===`alert.pulse`,onClick:()=>void y(`alert.pulse`,``,e),children:[e,`×`]},e))]})]}),S&&(0,q.jsxs)(T,{icon:Te,iconTone:`accent`,title:t(`diagnostics`),eyebrow:u?n(`Inspection loaded`,`بازرسی بارگیری شد`):n(`Not inspected`,`بازرسی نشده`),action:(0,q.jsx)(l,{icon:De,compact:!0,busy:a===`inspect`,onClick:()=>void b(),children:t(`fetch`)}),children:[(0,q.jsx)(`div`,{className:`diagnostic-picker`,children:nn.map(e=>(0,q.jsx)(`button`,{className:p===e?`is-active`:``,onClick:()=>h(e),dir:`ltr`,children:e},e))}),u!==null&&(0,q.jsx)(`pre`,{className:`diagnostic-output`,dir:`ltr`,children:JSON.stringify(u,null,2)})]}),(0,q.jsx)(T,{icon:lt,iconTone:r.events_online?`green`:`amber`,title:n(`Connection health`,`سلامت اتصال`),eyebrow:r.events_online?n(`Event stream connected`,`جریان رویداد متصل است`):r.http_reachable?n(`HTTP reachable`,`HTTP در دسترس`):n(`Unavailable`,`دردسترس نیست`),action:(0,q.jsx)(l,{icon:De,compact:!0,onClick:()=>void v(),children:e===`fa`?`تازه‌سازی`:`Refresh`}),children:(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:n(`Phase`,`مرحله`),value:r.phase||`idle`}),(0,q.jsx)(w,{label:`HTTP`,value:r.http_reachable?t(`online`):t(`offline`),tone:r.http_reachable?`good`:`bad`}),(0,q.jsx)(w,{label:n(`Event stream`,`جریان رویداد`),value:r.events_online?t(`online`):t(`offline`),tone:r.events_online?`good`:`warn`}),(0,q.jsx)(w,{label:n(`Last event`,`آخرین رویداد`),value:r.last_event||`—`}),(0,q.jsx)(w,{label:n(`Identity`,`هویت`),value:[r.name,r.model,r.firmware].filter(Boolean).join(` · `)||`—`}),(0,q.jsx)(w,{label:n(`Device ID`,`شناسهٔ وسیله`),value:r.device_id||`—`,mono:!0})]})})]})]})]})}function sn({events:e,locale:t,t:n}){let r=(e,n)=>t===`fa`?n:e,[i,a]=(0,K.useState)(`all`),o=e.filter(e=>i===`all`||Zt(e)===i);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:r(`Unified history`,`تاریخچهٔ یکپارچه`),title:n(`events`),detail:r(`One timeline for controller lifecycle, RF, doors, macros, automations and integrated services.`,`یک خط زمانی برای چرخهٔ کنترلر، RF، درها، ماکروها، خودکارسازی‌ها و سرویس‌های یکپارچه.`),action:(0,q.jsxs)(I,{tone:`info`,children:[e.length,` `,r(`retained`,`نگه‌داری‌شده`)]})}),(0,q.jsxs)(T,{icon:p,iconTone:`violet`,className:`events-page-card`,title:r(`Event timeline`,`خط زمانی رویدادها`),eyebrow:r(`${o.length} visible`,`${o.length} مورد نمایان`),children:[(0,q.jsx)(`div`,{className:`event-toolbar`,children:(0,q.jsx)(k,{value:i,label:r(`Event severity`,`شدت رویداد`),options:[{value:`all`,label:r(`All`,`همه`)},{value:`good`,label:r(`Good`,`عادی`)},{value:`warn`,label:r(`Warn`,`هشدار`)},{value:`bad`,label:r(`Fault`,`خطا`)},{value:`info`,label:r(`Info`,`اطلاعات`)}],onChange:a})}),(0,q.jsx)(Dt,{events:o,locale:t,t:n,limit:o.length,toolbar:!0})]})]})}function cn({appTitle:t,snapshot:n,locale:a,t:s,command:c,appearance:m,onAppearance:g,token:_,onToken:x,onAppTitle:D,boardSettingsReadState:O,uiConfig:A,onMeasurementTiming:ne,onBuzzerPath:re,transport:ie,navigationSync:ae,navigationSyncStatus:oe={state:`idle`,detail:``},onNavigationSync:ce,appInstances:le=[]}){let N=(e,t)=>a===`fa`?t:e,P=M(n),de=e=>a===`fa`?{"Application title is required.":`عنوان برنامه الزامی است.`,"Application title must be 64 characters or fewer.":`عنوان برنامه باید حداکثر ۶۴ نویسه باشد.`,"Application title must include a letter or number.":`عنوان برنامه باید دست‌کم یک حرف یا عدد داشته باشد.`,"A root URL is required while this integration is enabled.":`وقتی یکپارچه‌سازی فعال است، نشانی ریشه الزامی است.`,"Enter a valid HTTP or HTTPS root URL.":`یک نشانی ریشهٔ معتبر HTTP یا HTTPS وارد کنید.`,"Only HTTP and HTTPS are supported.":`فقط HTTP و HTTPS پشتیبانی می‌شوند.`,"Credentials are not allowed in the URL.":`اطلاعات دسترسی نباید داخل نشانی باشد.`,"Query strings and fragments are not allowed.":`پارامتر پرس‌وجو و قطعه در نشانی مجاز نیست.`,"Use the service root without a path.":`ریشهٔ سرویس را بدون مسیر وارد کنید.`,"Use a private, loopback, link-local, or local-DNS host.":`از میزبان خصوصی، loopback، link-local یا DNS محلی استفاده کنید.`,"The data service must use localhost or a loopback address.":`سرویس داده باید از localhost یا نشانی loopback استفاده کند.`,"Use no more than 14 page keys or IDs.":`حداکثر ۱۴ کلید یا شناسهٔ صفحه وارد کنید.`,"Page keys or IDs must use printable ASCII characters.":`کلیدها یا شناسه‌های صفحه باید فقط از نویسه‌های قابل چاپ ASCII باشند.`,"Page keys or IDs must be unique.":`کلیدها یا شناسه‌های صفحه باید یکتا باشند.`,"Text must use printable ASCII characters.":`متن باید فقط از نویسه‌های قابل چاپ ASCII باشد.`,"Text must contain at least 5 printable ASCII bytes.":`متن باید دست‌کم ۵ بایت ASCII قابل چاپ داشته باشد.`,"Text and repeat gap must fit within 40 bytes.":`متن همراه با فاصلهٔ تکرار باید در ۴۰ بایت جا شود.`}[e]??e:e,[pe,L]=(0,K.useState)(_),[z,ge]=(0,K.useState)(t),[_e,ve]=(0,K.useState)(!1),[ye,xe]=(0,K.useState)(``),[we,Ee]=(0,K.useState)(!1),[De,ke]=(0,K.useState)(``),[Ae,je]=(0,K.useState)(n.settings.display_brightness),[V,Me]=(0,K.useState)(n.settings.display_closed_brightness),[Ne,H]=(0,K.useState)(n.settings.motion_exit_hold_seconds||2),[Pe,Fe]=(0,K.useState)(n.settings.status_brightness),[Le,Re]=(0,K.useState)(n.settings.stream_period_ms||200),[ze,Be]=(0,K.useState)(n.settings.output_persistence),[Ve,He]=(0,K.useState)(n.settings.relay_restore_mask),[Ge,Ke]=(0,K.useState)(String(n.settings.light_mode)),[Je,Ye]=(0,K.useState)(n.settings.on_brightness),[Xe,Ze]=(0,K.useState)(n.settings.off_brightness),[W,Qe]=(0,K.useState)(n.illumination),[$e,et]=(0,K.useState)(n.illumination.applied_pwm),[nt,it]=(0,K.useState)(!1),[ot,ct]=(0,K.useState)(``),[lt,ut]=(0,K.useState)(!1),[G,dt]=(0,K.useState)({enabled:!0,pages:[`door`],door_open_text:`door is open`,door_closed_text:`door is closed`,speed_ms:220,gap_cells:3}),[pt,mt]=(0,K.useState)(`door`),[ht,gt]=(0,K.useState)(null),[_t,yt]=(0,K.useState)(!0),[bt,xt]=(0,K.useState)(``),[St,Ct]=(0,K.useState)(!1),[wt,Tt]=(0,K.useState)(A?.status_interval_ms??200),[Et,Dt]=(0,K.useState)(A?.measurement_freshness_ms??1500),[Ot,kt]=(0,K.useState)({refresh:A?.status_interval_ms??200,freshness:A?.measurement_freshness_ms??1500}),[At,jt]=(0,K.useState)(A===null),[Mt,Nt]=(0,K.useState)(``),[J,Y]=(0,K.useState)({local_device:{enabled:!1,base_url:``},data_hub:{enabled:!1,base_url:`http://127.0.0.1:8080`},lifecycle_safety:{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``}}),[Pt,Ft]=(0,K.useState)({local_device:{enabled:!1,base_url:``},data_hub:{enabled:!1,base_url:`http://127.0.0.1:8080`},lifecycle_safety:{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``}}),[It,Lt]=(0,K.useState)(!0),[Rt,X]=(0,K.useState)(!1),[zt,Z]=(0,K.useState)(``),[Bt,Ht]=(0,K.useState)(A?.buzzer_runtime),Ut=(e,t)=>g({...m,[e]:t}),Wt=(0,K.useMemo)(()=>o(z),[z]),Kt=(0,K.useMemo)(()=>e(pe),[pe]),qt=n.connected&&n.have_settings,Jt=qt&&!!(n.settings.flags&1),Q=Bt??A?.buzzer_runtime,Yt=Q?!Q.host_mirror:!(A?.integrations?.buzzer_host_enabled??!1),Xt=qt?he(Jt,Yt):null,Zt=Q?.effective_path&&Q.effective_path!==`unknown`?Q.effective_path:Xt,Qt=async e=>{Ee(!0),ke(``);try{await re(e);let t=await f(`controller.integrations.status`);Ht(t.buzzer_runtime),ke(N(`Applied and verified.`,`اعمال و تأیید شد.`))}catch(e){ke(e instanceof Error?e.message:String(e))}finally{Ee(!1)}},$t=(0,K.useMemo)(()=>C(J.local_device.base_url??``,J.local_device.enabled),[J.local_device.base_url,J.local_device.enabled]),$=(0,K.useMemo)(()=>ee(J.data_hub.base_url??``,J.data_hub.enabled),[J.data_hub.base_url,J.data_hub.enabled]),en=$t.valid&&$.valid,tn=Rt&&!h(J,Pt),nn=Wt.normalized!==t,rn=Kt!==_,an=(0,K.useMemo)(()=>u(pt),[pt]),on=(0,K.useMemo)(()=>me(G.door_open_text,G.gap_cells),[G.door_open_text,G.gap_cells]),sn=(0,K.useMemo)(()=>me(G.door_closed_text,G.gap_cells),[G.door_closed_text,G.gap_cells]),cn=(0,K.useMemo)(()=>({...G,pages:an.pages,door_open_text:on.normalized,door_closed_text:sn.normalized}),[sn.normalized,on.normalized,an.pages,G]),ln=an.valid&&on.valid&&sn.valid,un=ht!==null&&!S(cn,ht),dn=wt>=50&&wt<=6e4&&Et>=wt+100&&Et<=12e4,fn=wt!==Ot.refresh||Et!==Ot.freshness,pn=[{value:`leave`,label:N(`Release keys`,`رهاسازی کلیدها`)},{value:`stop-motion`,label:N(`Stop motion`,`توقف حرکت`)},{value:`all-off`,label:N(`All outputs off`,`خاموشی همه خروجی‌ها`)}],mn=bt||(_t?ht?N(`Saving the validated scrolling configuration…`,`در حال ذخیرهٔ تنظیمات معتبر پیمایش…`):N(`Loading the persisted scrolling configuration…`,`در حال بارگذاری تنظیمات ذخیره‌شدهٔ پیمایش…`):ln?un?N(`Validated draft · ready to save.`,`پیش‌نویس معتبر است و آمادهٔ ذخیره است.`):ht?N(`Saved configuration is up to date.`,`تنظیمات ذخیره‌شده به‌روز است.`):N(`Persistent scrolling configuration is unavailable.`,`تنظیمات ماندگار پیمایش در دسترس نیست.`):N(`Correct the highlighted fields before saving.`,`پیش از ذخیره، فیلدهای مشخص‌شده را اصلاح کنید.`));(0,K.useEffect)(()=>ge(t),[t]),(0,K.useEffect)(()=>L(_),[_]),(0,K.useEffect)(()=>{A&&(Tt(A.status_interval_ms),Dt(A.measurement_freshness_ms),kt({refresh:A.status_interval_ms,freshness:A.measurement_freshness_ms}),jt(!1))},[A?.measurement_freshness_ms,A?.status_interval_ms]),(0,K.useEffect)(()=>{let e=!0;return f(`controller.ui.config.get`).then(t=>{if(!e)return;let n=u(t.segment_scroll.pages.join(` `)).pages,r={...t.segment_scroll,pages:n,door_open_text:Ce(t.segment_scroll.door_open_text),door_closed_text:Ce(t.segment_scroll.door_closed_text)};dt(r),gt(r),mt(n.join(` `)),xt(``),Ct(!1)}).catch(t=>{e&&(xt(t instanceof Error?t.message:String(t)),Ct(!0))}).finally(()=>{e&&yt(!1)}),()=>{e=!1}},[]),(0,K.useEffect)(()=>{Ke(String(n.settings.light_mode)),Ye(n.settings.on_brightness),Ze(n.settings.off_brightness),je(n.settings.display_brightness),Me(n.settings.display_closed_brightness),H(n.settings.motion_exit_hold_seconds||2),Fe(n.settings.status_brightness),Re(n.settings.stream_period_ms||200),Be(n.settings.output_persistence),He(n.settings.relay_restore_mask)},[n.settings.light_mode,n.settings.on_brightness,n.settings.off_brightness,n.settings.display_brightness,n.settings.display_closed_brightness,n.settings.motion_exit_hold_seconds,n.settings.status_brightness,n.settings.stream_period_ms,n.settings.output_persistence,n.settings.relay_restore_mask]),(0,K.useEffect)(()=>{Qe(n.illumination)},[n.illumination]),(0,K.useEffect)(()=>{et(n.illumination.applied_pwm)},[n.illumination.applied_pwm]),(0,K.useEffect)(()=>{if(!n.connected||!n.have_settings||!P.pwm)return;let e=new AbortController;return f(`controller.illumination.get`,{},e.signal).then(t=>{e.signal.aborted||Qe(t)}).catch(t=>{e.signal.aborted||(ct(t instanceof Error?t.message:String(t)),ut(!0))}),()=>e.abort()},[n.connected,n.have_settings,P.pwm]);let hn=async()=>{it(!0),ct(``),ut(!1);try{let e=await f(`controller.illumination.set`,{mode:Number(Ge),on_brightness:Je,off_brightness:Xe});Qe(e),ct(N(`Applied live and verified durable in EEPROM.`,`به‌صورت زنده اعمال و ماندگاری آن در EEPROM تأیید شد.`))}catch(e){ct(e instanceof Error?e.message:String(e)),ut(!0)}finally{it(!1)}},gn=async()=>{it(!0),ct(``),ut(!1);try{let e=await f(`controller.illumination.override`,{value:$e});Qe(e),et(e.applied_pwm),ct(N(`Manual value applied and verified. The enclosure-lighting policy remains the owner.`,`مقدار دستی اعمال و تأیید شد. سیاست روشنایی محفظه همچنان مالک است.`))}catch(e){ct(e instanceof Error?e.message:String(e)),ut(!0)}finally{it(!1)}},_n=(e,t)=>{Be(n=>t?n|e:n&~e)},vn=e=>{xt(``),Ct(!1),dt(e)},yn=e=>{xt(``),Ct(!1),mt(v(e))},bn=async e=>{if(e.preventDefault(),!ln)xt(N(`Correct the highlighted scrolling fields before saving.`,`پیش از ذخیره، فیلدهای پیمایش مشخص‌شده را اصلاح کنید.`)),Ct(!0);else if(un){yt(!0),xt(``),Ct(!1);try{let e=await f(`controller.ui.config.set`,{segment_scroll:cn}),t=u(e.segment_scroll.pages.join(` `)).pages,n={...e.segment_scroll,pages:t,door_open_text:Ce(e.segment_scroll.door_open_text),door_closed_text:Ce(e.segment_scroll.door_closed_text)};dt(n),gt(n),mt(t.join(` `)),xt(N(`Saved and applied by the file-watched HOST service.`,`ذخیره شد و سرویس میزبان آن را اعمال کرد.`))}catch(e){xt(e instanceof Error?e.message:String(e)),Ct(!0)}finally{yt(!1)}}},xn=async e=>{if(e.preventDefault(),dn&&fn){jt(!0),Nt(``);try{let e=await f(`controller.ui.config.set`,{status_interval_ms:wt,measurement_freshness_ms:Et});Tt(e.status_interval_ms),Dt(e.measurement_freshness_ms),kt({refresh:e.status_interval_ms,freshness:e.measurement_freshness_ms}),ne?.(e.status_interval_ms,e.measurement_freshness_ms),Nt(N(`Applied.`,`اعمال شد.`))}catch(e){Nt(e instanceof Error?e.message:String(e))}finally{jt(!1)}}},Sn=async e=>{e.preventDefault(),ve(!0),xe(``);try{if(!Wt.valid){xe(de(Wt.error));return}let e=await D(Wt.normalized);ge(e),xe(`Saved`)}catch(e){xe(e instanceof Error?e.message:String(e))}finally{ve(!1)}};(0,K.useEffect)(()=>{let e=!0;return f(`controller.integrations.local.get`).then(t=>{if(!e)return;let n={local_device:{...t.local_device,base_url:d(t.local_device.base_url??``)},data_hub:{...t.data_hub,base_url:d(t.data_hub.base_url??``)},lifecycle_safety:t.lifecycle_safety??{session_lock:`stop-motion`,suspend:`stop-motion`,refresh_on_resume:!0},buzzer_mirror:t.buzzer_mirror??{enabled:!1,native_enabled:!1,web_audio_enabled:!0,backend:`auto`,executable:``,driver_directory:``},buzzer_runtime:t.buzzer_runtime};Ht(t.buzzer_runtime),Y(n),Ft(n),X(!0),Z(``)}).catch(t=>{e&&Z(t instanceof Error?t.message:String(t))}).finally(()=>{e&&Lt(!1)}),()=>{e=!1}},[]);let Cn=async()=>{if(!en)Z(N(`Correct the highlighted field before saving.`,`پیش از ذخیره، فیلد مشخص‌شده را اصلاح کنید.`));else{Lt(!0),Z(``);try{let e={local_device:{...J.local_device,base_url:$t.normalized},data_hub:{...J.data_hub,base_url:$.normalized},lifecycle_safety:J.lifecycle_safety,buzzer_mirror:J.buzzer_mirror},t=await f(`controller.integrations.local.set`,e),n={local_device:{...t.local_device,base_url:d(t.local_device.base_url??``)},data_hub:{...t.data_hub,base_url:d(t.data_hub.base_url??``)},lifecycle_safety:t.lifecycle_safety,buzzer_mirror:t.buzzer_mirror,buzzer_runtime:t.buzzer_runtime};Ht(t.buzzer_runtime),Y(n),Ft(n),Z(`Saved`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Lt(!1)}}},wn=async e=>{e.preventDefault(),await Cn()},Tn=s(m.theme),En=s(m.locale===`fa`?`persian`:`english`),Dn=s(m.direction===`auto`?`auto`:m.direction===`ltr`?`leftToRight`:`rightToLeft`),On=ie.boardState===`ready`&&n.connected&&n.have_status;return ie.authenticationRequired?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:N(`Host recovery`,`بازیابی میزبان`),title:s(`settings`),detail:s(`authenticationDashboardDetail`)}),(0,q.jsx)(`section`,{className:`settings-grid`,children:(0,q.jsx)(T,{icon:U,iconTone:`amber`,title:s(`security`),eyebrow:N(`Authentication required`,`احراز هویت لازم است`),className:`settings-card`,children:(0,q.jsx)(R,{label:s(`authToken`),type:`password`,value:pe,autoComplete:`off`,spellCheck:!1,onInput:t=>L(e(t.currentTarget.value)),onChange:t=>L(e(t.currentTarget.value)),hint:rn?N(`${Kt.length} normalized characters · not applied`,`${Kt.length} نویسهٔ نرمال‌شده · اعمال نشده`):N(`Enter this host’s access token.`,`توکن دسترسی این میزبان را وارد کنید.`),action:(0,q.jsx)(l,{tone:`primary`,icon:U,disabled:!rn,onClick:()=>{x(Kt),L(Kt)},children:s(`apply`)})})})})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ue,{eyebrow:On?N(`Host and controller settings`,`تنظیمات میزبان و کنترلر`):N(`Host settings`,`تنظیمات میزبان`),title:s(`settings`),detail:`${N(`Theme`,`پوسته`)}: ${Tn} · ${N(`Language`,`زبان`)}: ${En} · ${N(`Direction`,`جهت`)}: ${Dn}${On?N(` · controller available`,` · کنترلر در دسترس`):``}`}),(0,q.jsxs)(`section`,{className:`settings-grid`,children:[(0,q.jsx)(T,{icon:st,iconTone:`violet`,title:N(`PC host identity`,`هویت میزبان رایانه`),eyebrow:_e?N(`Saving`,`در حال ذخیره`):nn?N(`Unsaved change`,`تغییر ذخیره‌نشده`):N(`Saved`,`ذخیره‌شده`),className:`settings-card`,children:(0,q.jsx)(`form`,{onSubmit:e=>void Sn(e),children:(0,q.jsx)(R,{label:N(`Application title`,`عنوان برنامه`),value:z,minLength:1,maxLength:64,onInput:e=>{xe(``),ge(i(e.currentTarget.value))},onChange:e=>{xe(``),ge(i(e.currentTarget.value))},error:nn&&!Wt.valid?de(Wt.error):void 0,success:ye===`Saved`?N(`Saved as “${t}”.`,`با عنوان «${t}» ذخیره شد.`):void 0,hint:nn?N(`${Wt.normalized.length}/64 characters · ready to save`,`${Wt.normalized.length} از ۶۴ نویسه · آمادهٔ ذخیره`):N(`Current title: ${t}`,`عنوان فعلی: ${t}`),action:(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:_e,disabled:!nn||!Wt.valid,children:N(`Save`,`ذخیره`)})})})}),(0,q.jsx)(T,{icon:ft,iconTone:`green`,title:N(`Connected applications`,`برنامه‌های متصل`),eyebrow:`${le.length} ${N(`live`,`فعال`)}`,className:`settings-card settings-card--wide`,children:le.length===0?(0,q.jsx)(E,{icon:ft,title:N(`No connected applications`,`برنامهٔ متصلی وجود ندارد`),detail:N(`Live clients appear here after they advertise their controls.`,`کلاینت‌های زنده پس از معرفی کنترل‌های خود اینجا ظاهر می‌شوند.`)}):(0,q.jsx)(`div`,{className:`connected-apps-list`,children:le.map(e=>{let t=(e.values?.app_actions??``).split(`,`).map(e=>e.trim()).filter(Boolean),n=e.surface.toLowerCase()===`pealayer`,r=e.self?.pid??e.self?.vars?.pid,i=e.self?.vars?.web_ui??e.self?.vars?.websocket??e.self?.vars?.rpc;return(0,q.jsxs)(`article`,{className:`connected-app`,children:[(0,q.jsxs)(`div`,{className:`connected-app__identity`,children:[(0,q.jsx)(I,{tone:e.state===`active`?`good`:`neutral`,children:e.state||N(`present`,`حاضر`)}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:e.surface}),(0,q.jsx)(`span`,{children:e.id})]})]}),(0,q.jsxs)(`div`,{className:`connected-app__facts`,children:[e.page&&(0,q.jsxs)(`span`,{children:[N(`Page`,`صفحه`),`: `,e.page]}),e.self?.kind&&(0,q.jsxs)(`span`,{children:[e.self.kind,r?` · PID ${r}`:``]}),(0,q.jsxs)(`span`,{children:[t.length,` `,N(`controls`,`کنترل`)]}),i&&(0,q.jsx)(`span`,{title:i,children:i})]}),(0,q.jsxs)(`div`,{className:`connected-app__capabilities`,"aria-label":N(`Advertised controls`,`کنترل‌های معرفی‌شده`),children:[t.slice(0,5).map(e=>(0,q.jsx)(`code`,{children:e.replace(/^pealayer\./,``)},e)),t.length>5&&(0,q.jsxs)(`span`,{title:t.slice(5).join(`, `),children:[`+`,t.length-5]})]}),n&&(0,q.jsxs)(`div`,{className:`connected-app__actions`,children:[t.includes(`pealayer.play`)&&(0,q.jsx)(l,{icon:vt,onClick:()=>void f(`controller.app.action`,{kind:`pealayer.play`,target:e.id}),children:N(`Play`,`پخش`)}),t.includes(`pealayer.pause`)&&(0,q.jsx)(l,{icon:tt,onClick:()=>void f(`controller.app.action`,{kind:`pealayer.pause`,target:e.id}),children:N(`Pause`,`مکث`)})]})]},e.id)})})}),(0,q.jsx)(Gt,{locale:a}),A&&(0,q.jsx)(T,{icon:r,iconTone:`green`,title:N(`Live measurements`,`اندازه‌گیری‌های زنده`),eyebrow:At?N(`Synchronizing`,`در حال همگام‌سازی`):`${b(a,1e3/wt,wt===200?0:1)} ${N(`Hz`,`هرتز`)}`,className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`segment-scroll-settings`,onSubmit:e=>void xn(e),children:[(0,q.jsx)(F,{label:N(`Refresh/update interval`,`فاصلهٔ تازه‌سازی/به‌روزرسانی`),value:wt,min:50,max:6e4,step:50,unit:`ms`,onChange:e=>{Nt(``),Tt(e)}}),(0,q.jsx)(F,{label:N(`Freshness window`,`پنجرهٔ تازگی`),value:Et,min:wt+100,max:12e4,step:100,unit:`ms`,onChange:e=>{Nt(``),Dt(e)}}),(0,q.jsxs)(`div`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:`segment-scroll-settings__notice${dn?``:` is-error`}`,role:`status`,"aria-live":`polite`,children:dn?Mt:N(`Freshness must be ${wt+100}..120000 ms.`,`تازگی باید بین ${wt+100} تا ۱۲۰۰۰۰ میلی‌ثانیه باشد.`)}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:At,disabled:!fn||!dn,children:N(`Apply live timing`,`اعمال زمان‌بندی زنده`)})]})]})}),(0,q.jsx)(T,{icon:Te,iconTone:`accent`,title:N(`HOST display scrolling`,`پیمایش نمایشگر میزبان`),eyebrow:G.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`),className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`segment-scroll-settings`,onSubmit:e=>void bn(e),children:[(0,q.jsx)(j,{checked:G.enabled,onChange:e=>vn(t=>({...t,enabled:e})),label:N(`Supply scrolling text to selected pages`,`ارسال متن پیمایشی به صفحات انتخابی`),detail:N(`The board keeps OPEN/CLSD as its offline fallback; warnings, edits, programming, and other critical overlays remain higher priority.`,`برد در حالت آفلاین OPEN/CLSD را نمایش می‌دهد و هشدارها و لایه‌های مهم اولویت بالاتری دارند.`)}),(0,q.jsxs)(`div`,{className:`advanced-fields advanced-fields--split`,children:[(0,q.jsx)(R,{label:N(`Selected page keys or IDs`,`کلید یا شناسه صفحات`),value:pt,dir:`ltr`,spellCheck:!1,onInput:e=>yn(e.currentTarget.value),onChange:e=>yn(e.currentTarget.value),error:an.valid?void 0:de(an.error),success:un&&an.valid?N(`${an.pages.length} canonical target${an.pages.length===1?``:`s`}.`,`${an.pages.length} مقصد معتبر.`):void 0,hint:N(`Spaces and commas normalize automatically; maximum 14 unique ASCII IDs.`,`فاصله و ویرگول خودکار یکسان می‌شوند؛ حداکثر ۱۴ شناسهٔ یکتای ASCII.`)}),(0,q.jsx)(R,{label:N(`Door open text`,`متن درب باز`),value:G.door_open_text,dir:`ltr`,maxLength:40,spellCheck:!1,onInput:e=>vn(t=>({...t,door_open_text:Ce(e.currentTarget.value)})),onChange:e=>vn(t=>({...t,door_open_text:Ce(e.currentTarget.value)})),error:on.valid?void 0:de(on.error),success:un&&on.valid?N(`${on.byteLength} + ${G.gap_cells} / 40 bytes.`,`${on.byteLength} + ${G.gap_cells} از ۴۰ بایت.`):void 0,hint:N(`${on.availableBytes} ASCII bytes available before the repeat gap.`,`${on.availableBytes} بایت ASCII پیش از فاصلهٔ تکرار در دسترس است.`)}),(0,q.jsx)(R,{label:N(`Door closed text`,`متن درب بسته`),value:G.door_closed_text,dir:`ltr`,maxLength:40,spellCheck:!1,onInput:e=>vn(t=>({...t,door_closed_text:Ce(e.currentTarget.value)})),onChange:e=>vn(t=>({...t,door_closed_text:Ce(e.currentTarget.value)})),error:sn.valid?void 0:de(sn.error),success:un&&sn.valid?N(`${sn.byteLength} + ${G.gap_cells} / 40 bytes.`,`${sn.byteLength} + ${G.gap_cells} از ۴۰ بایت.`):void 0,hint:N(`${sn.availableBytes} ASCII bytes available before the repeat gap.`,`${sn.availableBytes} بایت ASCII پیش از فاصلهٔ تکرار در دسترس است.`)})]}),(0,q.jsx)(F,{label:N(`Scroll window dwell`,`مکث هر پنجره پیمایش`),value:G.speed_ms,min:60,max:5e3,step:20,unit:`ms`,onChange:e=>vn(t=>({...t,speed_ms:e}))}),(0,q.jsx)(F,{label:N(`Gap between repeats`,`فاصله بین تکرارها`),value:G.gap_cells,min:0,max:12,unit:N(` cells`,` خانه`),onChange:e=>vn(t=>({...t,gap_cells:e}))}),(0,q.jsxs)(`div`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:`segment-scroll-settings__notice${St||!ln?` is-error`:``}`,role:`status`,"aria-live":`polite`,children:mn}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:_t,disabled:!un||!ln,children:N(`Save scrolling`,`ذخیره پیمایش`)})]})]})}),(0,q.jsxs)(T,{icon:fe,iconTone:`green`,title:N(`Buzzer routing`,`مسیر بیزر`),eyebrow:(Zt??N(`Pending`,`در انتظار`)).toUpperCase(),className:`settings-card settings-card--wide`,children:[(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Playback path`,`مسیر پخش`)}),(0,q.jsx)(k,{value:Zt??Q?.requested_path??J.buzzer_mirror.path??`none`,label:N(`Buzzer playback path`,`مسیر پخش بیزر`),options:[{value:`board`,label:N(`Board`,`برد`)},{value:`host`,label:N(`PC`,`رایانه`)},{value:`both`,label:N(`Both`,`هر دو`)},{value:`none`,label:N(`None`,`هیچ‌کدام`)}],onChange:e=>void Qt(e)})]}),(0,q.jsxs)(`div`,{className:`settings-inline-status`,children:[qt?(0,q.jsx)(I,{tone:Jt?`neutral`:`good`,children:N(`Board ${Jt?`silent`:`active`}`,`برد ${Jt?`بی‌صدا`:`فعال`}`)}):(0,q.jsx)(I,{tone:`neutral`,children:N(`Board state unavailable`,`وضعیت برد در دسترس نیست`)}),(0,q.jsx)(I,{tone:Yt?`neutral`:`good`,children:N(`PC ${Yt?`silent`:`active`}`,`رایانه ${Yt?`بی‌صدا`:`فعال`}`)}),we&&(0,q.jsx)(I,{tone:`warn`,children:N(`Applying…`,`در حال اعمال…`)}),Q?.requested_path&&Q.requested_path!==`unknown`&&Q.requested_path!==Q.effective_path&&(0,q.jsx)(I,{tone:Q.board_apply_state===`error`?`warn`:`neutral`,children:`${Q.requested_path} · ${Q.board_apply_state}`}),Q&&(0,q.jsx)(I,{tone:Q.backend_error?`warn`:`neutral`,children:`${Q.backend_requested} → ${Q.backend_effective}`})]}),(0,q.jsx)(j,{checked:J.buzzer_mirror.enabled,onChange:e=>{Z(``),Y(t=>{let n=t.buzzer_mirror.path,r=n===`host`||n===`none`;return{...t,buzzer_mirror:{...t.buzzer_mirror,enabled:e,path:n&&he(r,!e)}}})},label:N(`Mirror board beeps on this host`,`بازپخش بوق‌های برد روی این میزبان`)}),J.buzzer_mirror.enabled&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(j,{checked:J.buzzer_mirror.native_enabled,onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,native_enabled:e,backend:e&&t.buzzer_mirror.backend===`off`?`auto`:t.buzzer_mirror.backend}}))},label:N(`PC speaker renderer`,`پخش‌کنندهٔ بلندگوی رایانه`)}),(0,q.jsx)(j,{checked:J.buzzer_mirror.web_audio_enabled,onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,web_audio_enabled:e}}))},label:N(`Web browser renderer`,`پخش‌کنندهٔ مرورگر وب`)}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`PC speaker backend`,`پشتیبان بلندگوی رایانه`)}),(0,q.jsx)(k,{value:J.buzzer_mirror.backend,label:N(`PC speaker backend`,`پشتیبان بلندگوی رایانه`),options:[{value:`auto`,label:N(`Auto`,`خودکار`)},{value:`native`,label:N(`Native`,`بومی`)},{value:`external`,label:N(`Command`,`فرمان`)},{value:`off`,label:N(`Off`,`خاموش`)}],onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,backend:e,native_enabled:e!==`off`&&t.buzzer_mirror.native_enabled}}))}})]}),J.buzzer_mirror.backend!==`native`&&J.buzzer_mirror.backend!==`off`&&(0,q.jsx)(R,{label:N(`Beep executable (optional)`,`فایل اجرایی بوق (اختیاری)`),dir:`ltr`,spellCheck:!1,value:J.buzzer_mirror.executable??``,placeholder:N(`Blank uses beep from PATH`,`خالی: استفاده از beep در PATH`),onChange:e=>{Z(``),Y(t=>({...t,buzzer_mirror:{...t.buzzer_mirror,executable:e.currentTarget.value}}))}})]}),(0,q.jsx)(`div`,{className:`inline-actions`,children:(0,q.jsx)(l,{icon:U,tone:`primary`,busy:It,disabled:!tn,onClick:()=>void Cn(),children:N(`Save PC buzzer settings`,`ذخیرهٔ تنظیمات بیزر رایانه`)})}),De&&(0,q.jsx)(`p`,{className:`settings-action-feedback`,role:`status`,children:De})]}),(0,q.jsxs)(T,{icon:B,iconTone:`accent`,title:s(`appearance`),eyebrow:`${Tn} · ${Dn}`,className:`settings-card settings-card--wide`,menu:[{label:N(`Follow system appearance`,`پیروی از ظاهر سیستم`),icon:B,onSelect:()=>g({...m,theme:`system`,direction:`auto`})},{label:m.reduceMotion?N(`Enable interface motion`,`فعال‌سازی حرکت رابط`):N(`Reduce interface motion`,`کاهش حرکت رابط`),icon:p,onSelect:()=>Ut(`reduceMotion`,!m.reduceMotion)}],children:[(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`theme`)}),(0,q.jsx)(k,{value:m.theme,label:s(`theme`),options:[{value:`system`,label:s(`system`),icon:B},{value:`dark`,label:s(`dark`),icon:te},{value:`light`,label:s(`light`),icon:se}],onChange:e=>Ut(`theme`,e)})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`language`)}),(0,q.jsx)(k,{value:m.locale,label:s(`language`),options:[{value:`en`,label:s(`english`),icon:be},{value:`fa`,label:s(`persian`),icon:be}],onChange:e=>Ut(`locale`,e)})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:s(`direction`)}),(0,q.jsx)(k,{value:m.direction,label:s(`direction`),options:[{value:`auto`,label:s(`auto`)},{value:`ltr`,label:s(`leftToRight`)},{value:`rtl`,label:s(`rightToLeft`)}],onChange:e=>Ut(`direction`,e)})]}),(0,q.jsx)(j,{checked:m.reduceMotion,onChange:e=>Ut(`reduceMotion`,e),label:s(`reduceMotion`),detail:m.reduceMotion?N(`Nonessential motion is off.`,`حرکت‌های غیرضروری خاموش‌اند.`):N(`Smooth interface transitions are on.`,`گذارهای نرم رابط فعال‌اند.`)}),(0,q.jsx)(j,{checked:m.compactNumbers,onChange:e=>Ut(`compactNumbers`,e),label:s(`compactNumbers`),detail:m.compactNumbers?N(`Large values use compact notation.`,`مقادیر بزرگ به‌صورت فشرده نمایش داده می‌شوند.`):N(`Large values use full notation.`,`مقادیر بزرگ به‌صورت کامل نمایش داده می‌شوند.`)}),(0,q.jsx)(j,{checked:ae,onChange:ce,label:N(`Sync this tab with other instances`,`همگام‌سازی این زبانه با نمونه‌های دیگر`),detail:oe.state===`pending`?(0,q.jsx)(`span`,{role:`status`,children:N(`Synchronizing…`,`در حال همگام‌سازی…`)}):oe.state===`error`?(0,q.jsx)(`span`,{role:`alert`,children:oe.detail}):void 0}),(0,q.jsx)(j,{checked:!m.audioMuted,onChange:e=>Ut(`audioMuted`,!e),label:(0,q.jsxs)(`span`,{className:`setting-icon-label`,children:[(0,q.jsx)(fe,{size:16}),N(`Interaction audio`,`صدای تعامل`)]}),detail:m.audioMuted?N(`Audio cues are off.`,`نشانه‌های صوتی خاموش‌اند.`):N(`Audio cues are at ${Math.round(m.audioVolume*100)}%.`,`بلندی نشانه‌های صوتی ${Math.round(m.audioVolume*100)}٪ است.`)}),!m.audioMuted&&(0,q.jsx)(F,{label:N(`Cue volume`,`بلندی نشانه‌ها`),value:Math.round(m.audioVolume*100),min:0,max:100,unit:`%`,onChange:e=>Ut(`audioVolume`,e/100)}),!m.audioMuted&&(0,q.jsx)(l,{icon:fe,onClick:()=>window.dispatchEvent(new Event(`pccontroller:test-feedback`)),children:N(`Test notification`,`آزمایش اعلان`)})]}),(0,q.jsx)(Vt,{locale:m.locale}),A?.auth_required===!0&&(0,q.jsx)(T,{icon:U,iconTone:`green`,title:s(`security`),eyebrow:rn?N(`Token change pending`,`تغییر توکن در انتظار اعمال`):_?N(`Session authenticated`,`نشست معتبر است`):N(`No session token`,`بدون توکن نشست`),className:`settings-card`,children:(0,q.jsx)(R,{label:s(`authToken`),type:`password`,value:pe,autoComplete:`off`,spellCheck:!1,onInput:t=>L(e(t.currentTarget.value)),onChange:t=>L(e(t.currentTarget.value)),hint:rn?N(`${Kt.length} normalized characters · not applied`,`${Kt.length} نویسهٔ نرمال‌شده · اعمال نشده`):_?N(`Applied to this browser tab.`,`در این زبانهٔ مرورگر اعمال شده است.`):N(`Enter a token if the host requires one.`,`اگر میزبان توکن می‌خواهد، آن را وارد کنید.`),action:(0,q.jsx)(l,{tone:`primary`,icon:U,disabled:!rn,onClick:()=>{x(Kt),L(Kt)},children:s(`apply`)})})}),On&&P.settings&&(0,q.jsx)(T,{icon:y,iconTone:`amber`,title:N(`Enclosure illumination`,`روشنایی محفظه`),eyebrow:W.available?W.at_target?N(`Applied · at target`,`اعمال‌شده · در مقدار هدف`):N(`Transitioning to target`,`در حال گذار به مقدار هدف`):N(`Waiting for live PWM state`,`در انتظار وضعیت زندهٔ PWM`),className:`settings-card settings-card--wide illumination-settings-card`,children:n.have_settings?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`illumination-state-grid`,"aria-label":N(`Live enclosure illumination state`,`وضعیت زندهٔ روشنایی محفظه`),children:[(0,q.jsx)(w,{label:N(`Policy`,`سیاست`),value:[N(`Off`,`خاموش`),N(`Auto`,`خودکار`),N(`On`,`روشن`)][W.mode]??String(W.mode)}),(0,q.jsx)(w,{label:N(`Door input`,`ورودی درب`),value:W.door_open?N(`Open`,`باز`):N(`Closed`,`بسته`),tone:W.door_open?`warn`:`good`}),(0,q.jsx)(w,{label:N(`Selected target`,`مقدار هدف انتخاب‌شده`),value:`${W.target_brightness}/255 · ${W.target_pwm}/4095`,mono:!0}),(0,q.jsx)(w,{label:N(`Applied MOSFET channel 12`,`مقدار اعمال‌شدهٔ کانال ۱۲ ماسفت`),value:W.available?`${W.applied_brightness}/255 · ${W.applied_pwm}/4095`:N(`Unavailable`,`در دسترس نیست`),tone:W.available?W.at_target?`good`:`warn`:void 0,mono:!0}),(0,q.jsx)(w,{label:N(`EEPROM durability`,`ماندگاری EEPROM`),value:W.persisted?N(`Verified`,`تأییدشده`):N(`Not confirmed`,`تأییدنشده`),tone:W.persisted?`good`:`warn`})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Operating mode`,`حالت عملکرد`)}),(0,q.jsx)(k,{value:Ge,label:N(`Enclosure illumination mode`,`حالت روشنایی محفظه`),options:[{value:`0`,label:N(`Off`,`خاموش`)},{value:`1`,label:N(`Auto · door`,`خودکار · درب`)},{value:`2`,label:N(`On`,`روشن`)}],onChange:e=>{ct(``),Ke(e)}})]}),(0,q.jsx)(F,{label:N(`Door-open / On brightness`,`روشنایی درب باز / حالت روشن`),value:Je,min:0,max:255,onChange:e=>{ct(``),Ye(e)}}),(0,q.jsx)(F,{label:N(`Door-closed / Off brightness`,`روشنایی درب بسته / حالت خاموش`),value:Xe,min:0,max:255,onChange:e=>{ct(``),Ze(e)}}),(0,q.jsx)(F,{label:N(`Manual raw override · MOSFET channel 12`,`کنترل دستی خام · کانال ۱۲ ماسفت`),value:$e,min:0,max:4095,onChange:e=>{ct(``),et(e)}}),(0,q.jsxs)(`div`,{className:`illumination-settings-card__footer`,children:[(0,q.jsx)(`p`,{className:lt?`settings-action-feedback text-bad`:`settings-action-feedback`,role:lt?`alert`:`status`,children:ot||N(`Manual adjustment is temporary: policy ownership and EEPROM settings remain unchanged and may reapply the selected target.`,`تنظیم دستی موقت است: مالکیت سیاست و تنظیمات EEPROM تغییر نمی‌کند و ممکن است مقدار هدف دوباره اعمال شود.`)}),(0,q.jsxs)(`div`,{className:`inline-actions`,children:[(0,q.jsx)(l,{icon:Ie,busy:nt,disabled:!P.pwm||!W.available,onClick:()=>void gn(),children:N(`Apply manual override`,`اعمال کنترل دستی`)}),(0,q.jsx)(l,{tone:`primary`,icon:y,busy:nt,disabled:!P.pwm||!W.available,onClick:()=>void hn(),children:N(`Apply policy`,`اعمال سیاست`)})]})]})]}):(0,q.jsx)(E,{icon:y,title:N(`Reading illumination policy`,`در حال خواندن سیاست روشنایی`),detail:N(`The controls appear only after the board returns authoritative EEPROM settings.`,`کنترل‌ها پس از دریافت تنظیمات معتبر EEPROM از برد نمایش داده می‌شوند.`)})}),On&&P.settings&&(0,q.jsx)(T,{icon:rt,iconTone:`amber`,title:N(`Board EEPROM settings`,`تنظیمات EEPROM برد`),eyebrow:n.have_settings?N(`Live draft · explicit write`,`پیش‌نویس زنده · نوشتن صریح`):O===`loading`?N(`Reading board settings`,`در حال خواندن تنظیمات برد`):N(`Settings unavailable`,`تنظیمات در دسترس نیست`),className:`settings-card`,children:n.have_settings?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`table`,{className:`settings-value-table`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:N(`Setting`,`تنظیم`)}),(0,q.jsx)(`th`,{children:N(`EEPROM report`,`گزارش EEPROM`)}),(0,q.jsx)(`th`,{children:N(`Live draft`,`پیش‌نویس زنده`)})]})}),(0,q.jsxs)(`tbody`,{children:[(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{children:[`TM1637 · `,N(`door open`,`درب باز`)]}),(0,q.jsx)(`td`,{children:n.settings.display_brightness}),(0,q.jsx)(`td`,{children:Ae})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsxs)(`td`,{children:[`TM1637 · `,N(`door closed`,`درب بسته`)]}),(0,q.jsx)(`td`,{children:n.settings.display_closed_brightness}),(0,q.jsx)(`td`,{children:V})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Motion-menu exit hold`,`مکث خروج از منوی حرکت`)}),(0,q.jsxs)(`td`,{children:[n.settings.motion_exit_hold_seconds,` s`]}),(0,q.jsxs)(`td`,{children:[Ne,` s`]})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Status brightness`,`روشنایی وضعیت`)}),(0,q.jsx)(`td`,{children:n.settings.status_brightness}),(0,q.jsx)(`td`,{children:Pe})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Telemetry period`,`دورهٔ تله‌متری`)}),(0,q.jsxs)(`td`,{children:[n.settings.stream_period_ms,` ms`]}),(0,q.jsxs)(`td`,{children:[Le,` ms`]})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember motion command`,`به‌خاطرسپاری فرمان حرکت`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&1?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&1?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember user relays`,`به‌خاطرسپاری رله‌های کاربر`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&2?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&2?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),P.pwm&&(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Remember user PWM`,`به‌خاطرسپاری PWM کاربر`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&4?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&4?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Stop retains direction`,`حفظ جهت هنگام توقف`)}),(0,q.jsx)(`td`,{children:n.settings.output_persistence&8?N(`Yes`,`بله`):N(`No`,`خیر`)}),(0,q.jsx)(`td`,{children:ze&8?N(`Yes`,`بله`):N(`No`,`خیر`)})]}),(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:N(`Stored relay restore mask`,`ماسک ذخیره‌شدهٔ بازیابی رله`)}),(0,q.jsxs)(`td`,{colSpan:2,children:[`0x`,Ve.toString(16).toUpperCase().padStart(2,`0`)]})]})]})]}),(0,q.jsx)(F,{label:N(`TM1637 · door-open brightness`,`TM1637 · روشنایی درب باز`),value:Ae,min:0,max:7,onChange:je}),(0,q.jsx)(F,{label:N(`TM1637 · door-closed brightness`,`TM1637 · روشنایی درب بسته`),value:V,min:0,max:7,onChange:Me}),(0,q.jsx)(F,{label:N(`Motion-menu exit hold`,`مکث خروج از منوی حرکت`),value:Ne,min:1,max:31,unit:`s`,onChange:H}),(0,q.jsx)(F,{label:N(`Status brightness`,`روشنایی وضعیت`),value:Pe,min:0,max:255,onChange:Fe}),(0,q.jsx)(F,{label:N(`Telemetry period`,`دورهٔ تله‌متری`),value:Le,min:50,max:5e3,step:50,unit:`ms`,onChange:Re}),(0,q.jsx)(j,{checked:!!(ze&1),onChange:e=>_n(1,e),label:N(`Remember motion command`,`به‌خاطرسپاری فرمان حرکت`),detail:N(`Disabled by default; motion starts released after a reboot.`,`به‌طور پیش‌فرض غیرفعال است؛ حرکت پس از راه‌اندازی دوباره در حالت آزاد آغاز می‌شود.`)}),(0,q.jsx)(j,{checked:!!(ze&2),onChange:e=>_n(2,e),label:N(`Remember user relays R5–R8`,`به‌خاطرسپاری رله‌های کاربر R5 تا R8`),detail:N(`Restore the user-output relay mask kept in EEPROM.`,`ماسک رله‌های خروجی کاربر ذخیره‌شده در EEPROM بازیابی می‌شود.`)}),P.pwm&&(0,q.jsx)(j,{checked:!!(ze&4),onChange:e=>_n(4,e),label:N(`Remember user PWM values`,`به‌خاطرسپاری مقادیر PWM کاربر`),detail:N(`Restore MOSFET/user PWM channel values after boot.`,`مقادیر کانال‌های MOSFET/PWM کاربر پس از راه‌اندازی بازیابی می‌شوند.`)}),(0,q.jsx)(j,{checked:!!(ze&8),onChange:e=>_n(8,e),label:N(`Stop keeps direction relay`,`توقف، رلهٔ جهت را حفظ کند`),detail:ze&8?N(`Motion stop releases only the output/enable relay.`,`توقف حرکت فقط رلهٔ خروجی/فعال‌سازی را آزاد می‌کند.`):N(`Motion stop releases both direction and output relays.`,`توقف حرکت هر دو رلهٔ جهت و خروجی را آزاد می‌کند.`)}),(0,q.jsx)(l,{tone:`primary`,icon:We,onClick:()=>void c(Se(n.settings,Ae,V,Pe,Le,Ne,ze,Ve)),children:N(`Write board settings`,`نوشتن تنظیمات برد`)})]}):(0,q.jsx)(E,{icon:We,title:O===`loading`?N(`Reading board settings`,`در حال خواندن تنظیمات برد`):N(`Board settings are unavailable`,`تنظیمات برد در دسترس نیست`),detail:O===`loading`?N(`Waiting for the controller to return its live EEPROM settings.`,`در انتظار دریافت تنظیمات زندهٔ EEPROM از برد.`):N(`No EEPROM values are shown until the controller returns an authoritative settings report.`,`تا دریافت گزارش معتبر تنظیمات از برد، هیچ مقدار EEPROM نمایش داده نمی‌شود.`)})}),On&&(0,q.jsxs)(T,{icon:Oe,iconTone:`green`,title:s(`connection`),eyebrow:N(`Controller board connected`,`برد کنترلر متصل است`),className:`settings-card`,children:[(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:N(`State`,`وضعیت`),value:n.connection_state,tone:`good`}),(0,q.jsx)(w,{label:N(`Port`,`درگاه`),value:n.port.name||N(`automatic`,`خودکار`),mono:!0}),(0,q.jsx)(w,{label:`VID:PID`,value:`${n.port.vid||`—`}:${n.port.pid||`—`}`,mono:!0}),(0,q.jsx)(w,{label:N(`Serial`,`سریال`),value:n.port.serial_number||`—`,mono:!0}),(0,q.jsx)(w,{label:N(`Baud`,`نرخ باد`),value:`115200 8N1`,mono:!0})]}),n.port_process&&(0,q.jsxs)(`div`,{className:`data-list`,children:[(0,q.jsx)(w,{label:N(`Port process`,`پردازش درگاه`),value:n.port_process.state,tone:n.port_process.state===`free`?`good`:n.port_process.state===`owned`?`warn`:void 0}),(0,q.jsx)(w,{label:N(`Owner`,`مالک`),value:n.port_process.pid?`${n.port_process.name||`unknown`} · PID ${n.port_process.pid}`:n.port_process.error||`—`,mono:!0}),n.port_process.executable&&(0,q.jsx)(w,{label:N(`Executable`,`فایل اجرا`),value:n.port_process.executable,mono:!0}),(0,q.jsx)(w,{label:N(`Takeover`,`واگذاری`),value:n.port_process.takeover_ready?N(`armed when free`,`با آزادشدن آماده`):N(`not armed`,`مسلح نیست`)})]}),(0,q.jsx)(`div`,{className:`inline-actions`,children:(0,q.jsx)(l,{icon:Ue,onClick:()=>void c(`close`),children:N(`Pause controller`,`توقف کنترلر`)})})]}),(0,q.jsx)(T,{icon:qe,iconTone:`violet`,title:N(`Host services and lifecycle`,`سرویس‌ها و چرخهٔ میزبان`),eyebrow:It?N(`Synchronizing`,`در حال همگام‌سازی`):tn?N(`Unsaved changes`,`تغییرات ذخیره‌نشده`):zt===`Saved`?N(`Saved`,`ذخیره‌شده`):N(`Up to date`,`به‌روز`),className:`settings-card settings-card--wide`,children:(0,q.jsxs)(`form`,{className:`local-integrations-form`,onSubmit:e=>void wn(e),children:[(0,q.jsxs)(`section`,{className:`integration-config-panel`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(qe,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Local device`,`وسیلهٔ محلی`)}),(0,q.jsx)(`small`,{children:J.local_device.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`)})]})]}),(0,q.jsx)(j,{checked:J.local_device.enabled,onChange:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,enabled:e}}))},label:N(`Enable local device`,`فعال‌سازی وسیلهٔ محلی`),detail:J.local_device.enabled?N(`The host will mediate local commands and events.`,`میزبان میانجی فرمان‌ها و رویدادهای محلی خواهد بود.`):N(`No local-device requests will be sent.`,`هیچ درخواستی برای وسیلهٔ محلی ارسال نمی‌شود.`)}),J.local_device.enabled&&(0,q.jsx)(R,{label:N(`Device root URL`,`نشانی ریشهٔ وسیله`),type:`url`,dir:`ltr`,spellCheck:!1,placeholder:`http://controller-device.local`,value:J.local_device.base_url??``,onInput:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,base_url:d(e.currentTarget.value)}}))},onChange:e=>{Z(``),Y(t=>({...t,local_device:{...t.local_device,base_url:d(e.currentTarget.value)}}))},onBlur:()=>$t.valid&&Y(e=>({...e,local_device:{...e.local_device,base_url:$t.normalized}})),error:$t.valid?void 0:de($t.error),success:$t.valid&&$t.normalized?N(`Validated: ${$t.normalized}`,`تأیید شد: ${$t.normalized}`):void 0})]}),(0,q.jsxs)(`section`,{className:`integration-config-panel`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(at,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Data hub`,`مرکز داده`)}),(0,q.jsx)(`small`,{children:J.data_hub.enabled?N(`Enabled`,`فعال`):N(`Disabled`,`غیرفعال`)})]})]}),(0,q.jsx)(j,{checked:J.data_hub.enabled,onChange:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,enabled:e}}))},label:N(`Enable data hub`,`فعال‌سازی مرکز داده`),detail:J.data_hub.enabled?N(`Authenticated data operations are routed through the host.`,`عملیات معتبر داده از طریق میزبان مسیریابی می‌شود.`):N(`No data-hub requests will be sent.`,`هیچ درخواستی برای مرکز داده ارسال نمی‌شود.`)}),J.data_hub.enabled&&(0,q.jsx)(R,{label:N(`Data-hub root URL`,`نشانی ریشهٔ مرکز داده`),type:`url`,dir:`ltr`,spellCheck:!1,placeholder:`http://127.0.0.1:8080`,value:J.data_hub.base_url??``,onInput:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,base_url:d(e.currentTarget.value)}}))},onChange:e=>{Z(``),Y(t=>({...t,data_hub:{...t.data_hub,base_url:d(e.currentTarget.value)}}))},onBlur:()=>$.valid&&Y(e=>({...e,data_hub:{...e.data_hub,base_url:$.normalized}})),error:$.valid?void 0:de($.error),success:$.valid&&$.normalized?N(`Validated: ${$.normalized}`,`تأیید شد: ${$.normalized}`):void 0})]}),(0,q.jsxs)(`section`,{className:`integration-config-panel integration-config-panel--wide`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsx)(U,{size:19}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:N(`Session and power safety`,`ایمنی نشست و توان`)}),(0,q.jsx)(`small`,{children:J.lifecycle_safety.refresh_on_resume?N(`Automatic reconciliation`,`همگام‌سازی خودکار`):N(`Manual reconciliation`,`همگام‌سازی دستی`)})]})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`When Windows locks`,`هنگام قفل‌شدن ویندوز`)}),(0,q.jsx)(k,{value:J.lifecycle_safety.session_lock,label:N(`Session-lock safety action`,`عمل ایمنی هنگام قفل نشست`),options:pn,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,session_lock:e}}))}})]}),(0,q.jsxs)(`div`,{className:`setting-group`,children:[(0,q.jsx)(`label`,{children:N(`Before system suspend`,`پیش از تعلیق سیستم`)}),(0,q.jsx)(k,{value:J.lifecycle_safety.suspend,label:N(`Suspend safety action`,`عمل ایمنی هنگام تعلیق`),options:pn,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,suspend:e}}))}})]}),(0,q.jsx)(j,{checked:J.lifecycle_safety.refresh_on_resume,onChange:e=>{Z(``),Y(t=>({...t,lifecycle_safety:{...t.lifecycle_safety,refresh_on_resume:e}}))},label:N(`Reconcile after unlock, resume, and network changes`,`همگام‌سازی پس از بازشدن قفل، بازگشت و تغییر شبکه`),detail:J.lifecycle_safety.refresh_on_resume?N(n.connected?`The host will refresh live telemetry without forcing a reconnect.`:`The host will re-arm discovery while respecting a manually paused connection.`,n.connected?`میزبان بدون اتصال مجدد اجباری، تله‌متری زنده را تازه می‌کند.`:`میزبان با حفظ توقف دستی اتصال، کشف دستگاه را دوباره فعال می‌کند.`):N(`The current connection state will be preserved until you act.`,`وضعیت فعلی اتصال تا اقدام شما حفظ می‌شود.`)})]}),(0,q.jsxs)(`footer`,{className:`local-integrations-form__footer`,children:[(0,q.jsx)(`span`,{className:zt===`Saved`?`text-good`:zt?`text-warn`:``,children:zt===`Saved`?N(`Host service and lifecycle settings saved.`,`تنظیمات سرویس و چرخهٔ میزبان ذخیره شد.`):zt||(tn?N(`Review and save the current changes.`,`تغییرات فعلی را بازبینی و ذخیره کنید.`):N(`No pending changes.`,`تغییری در انتظار ذخیره نیست.`))}),(0,q.jsx)(l,{type:`submit`,tone:`primary`,icon:U,busy:It,disabled:!tn||!en,children:N(`Save host settings`,`ذخیرهٔ تنظیمات میزبان`)})]})]})})]})]})}export{tn as ControlsView,en as DashboardView,sn as EventsView,on as LocalDeviceView,cn as SettingsView}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-Bi9TV8AN.js b/Tools/Controller/internal/webui/dist/assets/chunk-BVsUkuBT.js similarity index 75% rename from Tools/Controller/internal/webui/dist/assets/chunk-Bi9TV8AN.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BVsUkuBT.js index 7e8bf56d..8f2b1997 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-Bi9TV8AN.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BVsUkuBT.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};t.node;var n=e(t);export{n as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};t.node;var n=e(t);export{n as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-eKoA1lB1.js b/Tools/Controller/internal/webui/dist/assets/chunk-BZ_h0xog.js similarity index 73% rename from Tools/Controller/internal/webui/dist/assets/chunk-eKoA1lB1.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BZ_h0xog.js index 7916f1c5..bafb06ad 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-eKoA1lB1.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BZ_h0xog.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};t.node;var n=e(t);export{n as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};t.node;var n=e(t);export{n as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-BLxVMrn3.js b/Tools/Controller/internal/webui/dist/assets/chunk-BcFfnhtq.js similarity index 93% rename from Tools/Controller/internal/webui/dist/assets/chunk-BLxVMrn3.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BcFfnhtq.js index c0f9ce3c..13532fbe 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-BLxVMrn3.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BcFfnhtq.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};t.node;var n=e(t),r={name:`package-search`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M20.27 18.27 22 20`,key:`er2am`}],[`path`,{d:`M21 10.498V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.98-.559`,key:`tok1h1`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}],[`circle`,{cx:`18.5`,cy:`16.5`,r:`2.5`,key:`ke13xx`}]]};r.node;var i=e(r),a={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};a.node;var o=e(a);export{i as n,n as r,o as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`arrow-down-to-line`,size:24,node:[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]};t.node;var n=e(t),r={name:`package-search`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M20.27 18.27 22 20`,key:`er2am`}],[`path`,{d:`M21 10.498V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.98-.559`,key:`tok1h1`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}],[`circle`,{cx:`18.5`,cy:`16.5`,r:`2.5`,key:`ke13xx`}]]};r.node;var i=e(r),a={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};a.node;var o=e(a);export{i as n,n as r,o as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-DQyIR_Rr.js b/Tools/Controller/internal/webui/dist/assets/chunk-BndaF2VU.js similarity index 81% rename from Tools/Controller/internal/webui/dist/assets/chunk-DQyIR_Rr.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BndaF2VU.js index abffbb40..1670bd5b 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-DQyIR_Rr.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BndaF2VU.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`hard-drive-download`,size:24,node:[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]};t.node;var n=e(t);export{n as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`hard-drive-download`,size:24,node:[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]};t.node;var n=e(t);export{n as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-ByLILXol.js b/Tools/Controller/internal/webui/dist/assets/chunk-BzMnsFp-.js similarity index 96% rename from Tools/Controller/internal/webui/dist/assets/chunk-ByLILXol.js rename to Tools/Controller/internal/webui/dist/assets/chunk-BzMnsFp-.js index 187b9b65..77f875fd 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-ByLILXol.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-BzMnsFp-.js @@ -1,3 +1,3 @@ -import{$ as e,A as t,It as n,J as r,O as i,Pt as a,S as o,X as s,Y as c,Z as l,at as u,dt as d,it as f,lt as p,ot as m,st as h,ut as g,zt as _}from"./app-DHmIY1mo.js";import{n as v,r as y,t as b}from"./chunk-BLxVMrn3.js";import{t as x}from"./chunk-Bi9TV8AN.js";import{n as S,t as C}from"./chunk-CWMYvVMg.js";import{n as w,t as T}from"./chunk-Co4i84v0.js";import{n as E,r as D}from"./chunk-F-tPTz9z.js";var O={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};O.node;var k=a(O),A={name:`table-properties`,size:24,node:[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]};A.node;var j=a(A),M=_(n(),1),N=d(),P=[`id`,`code`,`name`,`title`,`category`,`state`,`value`,`updated_at`];function F(e){if(Array.isArray(e))return e.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{value:e});if(e&&typeof e==`object`){let t=e;return Array.isArray(t.records)?F(t.records):Array.isArray(t.data)?F(t.data):[t]}return[]}function I({locale:n,t:a}){let d=(e,t)=>n===`fa`?t:e,[_,O]=(0,M.useState)(`explore`),[A,I]=(0,M.useState)(`v1/status`),[L,R]=(0,M.useState)(`GET`),[z,B]=(0,M.useState)(`{ +import{$ as e,A as t,It as n,J as r,O as i,Pt as a,S as o,X as s,Y as c,Z as l,at as u,dt as d,it as f,lt as p,ot as m,st as h,ut as g,zt as _}from"./app-DeBWQZ2a.js";import{n as v,r as y,t as b}from"./chunk-BcFfnhtq.js";import{t as x}from"./chunk-BVsUkuBT.js";import{n as S,t as C}from"./chunk-CWQLWOOn.js";import{n as w,t as T}from"./chunk-B6TQ82AF.js";import{n as E,r as D}from"./chunk-B3YpOg3Z.js";var O={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};O.node;var k=a(O),A={name:`table-properties`,size:24,node:[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]};A.node;var j=a(A),M=_(n(),1),N=d(),P=[`id`,`code`,`name`,`title`,`category`,`state`,`value`,`updated_at`];function F(e){if(Array.isArray(e))return e.map(e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{value:e});if(e&&typeof e==`object`){let t=e;return Array.isArray(t.records)?F(t.records):Array.isArray(t.data)?F(t.data):[t]}return[]}function I({locale:n,t:a}){let d=(e,t)=>n===`fa`?t:e,[_,O]=(0,M.useState)(`explore`),[A,I]=(0,M.useState)(`v1/status`),[L,R]=(0,M.useState)(`GET`),[z,B]=(0,M.useState)(`{ "query": "" }`),[V,H]=(0,M.useState)([]),[U,W]=(0,M.useState)(!1),[G,K]=(0,M.useState)(null),[q,J]=(0,M.useState)([]),[Y,X]=(0,M.useState)(``),Z=async()=>{W(!0);try{let e;L===`POST`&&(JSON.parse(z),e=z);let n=await t(`datahub`,A,{method:L,body:e});K(n),H(F(n));let r=A.replace(/^\/+/,``),i=`${L} /${r}`;J(e=>[i,...e.filter(e=>e!==i)].slice(0,6)),X(``)}catch(e){X(e instanceof Error?e.message:D(e))}finally{W(!1)}},Q=async()=>{W(!0);try{await i(`datahub`,A),X(``)}catch(e){X(e instanceof Error?e.message:D(e))}finally{W(!1)}},$=e=>{let t=e.indexOf(` `);R(e.slice(0,t)),I(e.slice(t+2))};return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(f,{eyebrow:d(`Local data and streaming`,`داده و جریان محلی`),title:a(`data`),detail:d(`A loopback-only workbench for deliberate data exchange; no service-specific routes or credentials are embedded.`,`میزکاری محدود به شبکهٔ محلی برای تبادل آگاهانهٔ داده؛ هیچ مسیر اختصاصی سرویس یا اطلاعات دسترسی در رابط تعبیه نشده است.`),action:(0,N.jsx)(m,{tone:Y?`warn`:G?`good`:`info`,children:G?d(`RESPONSE READY`,`پاسخ آماده`):d(`IDLE`,`آماده`)})}),(0,N.jsx)(`nav`,{className:`subnav`,"aria-label":d(`Data workspace sections`,`بخش‌های فضای داده`),children:[[`explore`,T,d(`Request`,`درخواست`)],[`table`,j,`${a(`records`)} · ${o(n,V.length)}`],[`transfer`,y,d(`Transfer`,`انتقال`)]].map(([t,n,r])=>(0,N.jsxs)(`button`,{className:_===t?`is-active`:``,onClick:()=>O(t),children:[(0,N.jsx)(e,{icon:n,size:17}),r]},t))}),(0,N.jsx)(g,{initial:!1,children:Y&&(0,N.jsxs)(p.div,{className:`integration-banner`,role:`alert`,initial:{height:0,marginBottom:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(5px)`},animate:{height:`auto`,marginBottom:14,opacity:1,clipPath:`inset(0 0 0% 0)`,filter:`blur(0px)`},exit:{height:0,marginBottom:0,opacity:0,clipPath:`inset(0 0 100% 0)`,filter:`blur(4px)`},transition:{duration:.28,ease:[.22,1,.36,1]},children:[(0,N.jsx)(S,{size:19}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`strong`,{children:a(`unavailable`)}),(0,N.jsx)(`p`,{children:Y})]})]},`data-workspace-error`)}),_===`explore`&&(0,N.jsxs)(`section`,{className:`operations-grid`,children:[(0,N.jsxs)(c,{icon:C,iconTone:`violet`,title:d(`Request composer`,`ساخت درخواست`),eyebrow:d(`Authenticated host route`,`مسیر معتبر میزبان`),children:[(0,N.jsxs)(`div`,{className:`setting-group`,children:[(0,N.jsx)(`label`,{children:d(`Method`,`روش`)}),(0,N.jsx)(u,{value:L,label:d(`HTTP method`,`روش HTTP`),options:[{value:`GET`,label:`GET`},{value:`POST`,label:`POST`}],onChange:R})]}),(0,N.jsx)(h,{label:d(`Relative data path`,`مسیر نسبی داده`),dir:`ltr`,spellCheck:!1,value:A,placeholder:`v1/status`,onChange:e=>I(e.target.value),hint:d(`The upstream origin comes only from persistent host configuration.`,`مبدأ بالادستی فقط از پیکربندی ماندگار میزبان خوانده می‌شود.`)}),L===`POST`&&(0,N.jsxs)(`label`,{className:`payload-field`,children:[(0,N.jsx)(`span`,{children:d(`JSON body`,`بدنهٔ JSON`)}),(0,N.jsx)(`textarea`,{dir:`ltr`,spellCheck:!1,value:z,onChange:e=>B(e.target.value)})]}),(0,N.jsx)(r,{tone:`primary`,icon:C,busy:U,disabled:!A.trim(),onClick:()=>void Z(),children:d(`Send request`,`ارسال درخواست`)})]}),(0,N.jsx)(c,{icon:k,iconTone:`accent`,title:d(`Response`,`پاسخ`),eyebrow:G===null?d(`No response`,`بدون پاسخ`):d(`${V.length} projected records`,`${o(n,V.length)} رکورد استخراج‌شده`),className:`operation-result`,children:(0,N.jsx)(`pre`,{className:`operation-output`,dir:`ltr`,children:G===null?d(`Run a request to inspect the response.`,`برای بررسی پاسخ، یک درخواست اجرا کنید.`):typeof G==`string`?G:D(G,!0)})}),(0,N.jsx)(c,{icon:b,iconTone:`green`,title:d(`Recent local requests`,`درخواست‌های محلی اخیر`),eyebrow:d(`${q.length} in this tab`,`${o(n,q.length)} مورد در این زبانه`),children:(0,N.jsx)(`div`,{className:`command-chips`,children:q.length?q.map(e=>(0,N.jsx)(`button`,{dir:`ltr`,onClick:()=>$(e),children:e},e)):(0,N.jsx)(`p`,{className:`card-copy`,children:d(`No requests in this browser session.`,`در این نشست مرورگر هنوز درخواستی اجرا نشده است.`)})})})]}),_===`table`&&(0,N.jsxs)(c,{icon:j,iconTone:`violet`,className:`records-card`,title:`${a(`records`)} · ${o(n,V.length)}`,eyebrow:d(`Typed local collection`,`مجموعهٔ محلی نوع‌دار`),children:[(0,N.jsx)(E,{records:V,preferredFields:P,locale:n,direction:n===`fa`?`rtl`:`ltr`,ariaLabel:d(`Data workspace records`,`رکوردهای فضای داده`),filename:`data-workspace`,preserveViewportAnchor:!0,empty:(0,N.jsx)(l,{icon:v,title:d(`No tabular records`,`رکورد جدولی موجود نیست`),detail:d(`Run a request to inspect a structured response as a typed collection.`,`یک درخواست اجرا کنید تا پاسخ ساخت‌یافته را به‌صورت مجموعهٔ نوع‌دار بررسی کنید.`)})}),(0,N.jsxs)(`footer`,{className:`table-footer`,children:[(0,N.jsxs)(`span`,{children:[V.length,` `,d(`records`,`رکورد`)]}),(0,N.jsxs)(`span`,{children:[(0,N.jsx)(w,{size:15}),` `,d(`Credentials stripped`,`اطلاعات دسترسی حذف شده`)]}),(0,N.jsxs)(`span`,{children:[(0,N.jsx)(y,{size:15}),` `,a(`rangeReady`)]})]})]}),_===`transfer`&&(0,N.jsxs)(`section`,{className:`system-grid`,children:[(0,N.jsx)(c,{icon:x,iconTone:`accent`,title:d(`Streaming download`,`دانلود جریانی`),eyebrow:A.trim()?`/${A.replace(/^\/+/,``)}`:d(`No path selected`,`مسیری انتخاب نشده`),children:A.trim()&&(0,N.jsx)(r,{icon:x,busy:U,onClick:()=>void Q(),children:d(`Download current path`,`دانلود مسیر فعلی`)})}),(0,N.jsx)(c,{icon:w,iconTone:`green`,title:d(`Boundary status`,`وضعیت مرز امنیتی`),eyebrow:Y?d(`Request rejected`,`درخواست رد شد`):d(`Host mediated`,`با میانجی‌گری میزبان`),children:(0,N.jsxs)(`div`,{className:`data-list`,children:[(0,N.jsx)(s,{label:d(`Upstream`,`بالادست`),value:d(`Configured loopback root`,`ریشهٔ محلی پیکربندی‌شده`)}),(0,N.jsx)(s,{label:d(`Credentials`,`اطلاعات دسترسی`),value:d(`Removed before forwarding`,`پیش از ارسال حذف می‌شود`),tone:`good`}),(0,N.jsx)(s,{label:d(`Redirect selection`,`انتخاب تغییرمسیر`),value:d(`Host-owned`,`در اختیار میزبان`)}),(0,N.jsx)(s,{label:d(`Range requests`,`درخواست‌های بازه‌ای`),value:d(`Preserved`,`حفظ می‌شوند`),tone:`good`})]})}),(0,N.jsx)(c,{icon:T,iconTone:`violet`,title:d(`Current response`,`پاسخ فعلی`),eyebrow:G===null?d(`No response`,`بدون پاسخ`):typeof G==`string`?d(`Text`,`متن`):d(`Structured data`,`دادهٔ ساخت‌یافته`),children:G!==null&&(0,N.jsx)(`pre`,{className:`operation-output`,dir:`ltr`,children:typeof G==`string`?G:D(G,!0)})})]})]})}export{I as DataWorkspaceView}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-COZaly3R.js b/Tools/Controller/internal/webui/dist/assets/chunk-CNKgOZEf.js similarity index 94% rename from Tools/Controller/internal/webui/dist/assets/chunk-COZaly3R.js rename to Tools/Controller/internal/webui/dist/assets/chunk-CNKgOZEf.js index 22020dc0..65b934a3 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-COZaly3R.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-CNKgOZEf.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`binary`,size:24,node:[[`rect`,{x:`14`,y:`14`,width:`4`,height:`6`,rx:`2`,key:`p02svl`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`6`,rx:`2`,key:`xm4xkj`}],[`path`,{d:`M6 20h4`,key:`1i6q5t`}],[`path`,{d:`M14 10h4`,key:`ru81e7`}],[`path`,{d:`M6 14h2v6`,key:`16z9wg`}],[`path`,{d:`M14 4h2v6`,key:`1idq9u`}]]};t.node;var n=e(t),r={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};r.node;var i=e(r),a={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};a.node;var o=e(a),s={name:`usb`,size:24,node:[[`circle`,{cx:`10`,cy:`7`,r:`1`,key:`dypaad`}],[`circle`,{cx:`4`,cy:`20`,r:`1`,key:`22iqad`}],[`path`,{d:`M4.7 19.3 19 5`,key:`1enqfc`}],[`path`,{d:`m21 3-3 1 2 2Z`,key:`d3ov82`}],[`path`,{d:`M9.26 7.68 5 12l2 5`,key:`1esawj`}],[`path`,{d:`m10 14 5 2 3.5-3.5`,key:`v8oal5`}],[`path`,{d:`m18 12 1-1 1 1-1 1Z`,key:`1bh22v`}]]};s.node;var c=e(s);export{n as i,o as n,i as r,c as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`binary`,size:24,node:[[`rect`,{x:`14`,y:`14`,width:`4`,height:`6`,rx:`2`,key:`p02svl`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`6`,rx:`2`,key:`xm4xkj`}],[`path`,{d:`M6 20h4`,key:`1i6q5t`}],[`path`,{d:`M14 10h4`,key:`ru81e7`}],[`path`,{d:`M6 14h2v6`,key:`16z9wg`}],[`path`,{d:`M14 4h2v6`,key:`1idq9u`}]]};t.node;var n=e(t),r={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};r.node;var i=e(r),a={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};a.node;var o=e(a),s={name:`usb`,size:24,node:[[`circle`,{cx:`10`,cy:`7`,r:`1`,key:`dypaad`}],[`circle`,{cx:`4`,cy:`20`,r:`1`,key:`22iqad`}],[`path`,{d:`M4.7 19.3 19 5`,key:`1enqfc`}],[`path`,{d:`m21 3-3 1 2 2Z`,key:`d3ov82`}],[`path`,{d:`M9.26 7.68 5 12l2 5`,key:`1esawj`}],[`path`,{d:`m10 14 5 2 3.5-3.5`,key:`v8oal5`}],[`path`,{d:`m18 12 1-1 1 1-1 1Z`,key:`1bh22v`}]]};s.node;var c=e(s);export{n as i,o as n,i as r,c as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-CWMYvVMg.js b/Tools/Controller/internal/webui/dist/assets/chunk-CWQLWOOn.js similarity index 96% rename from Tools/Controller/internal/webui/dist/assets/chunk-CWMYvVMg.js rename to Tools/Controller/internal/webui/dist/assets/chunk-CWQLWOOn.js index 5dc4803d..d141484d 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-CWMYvVMg.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-CWQLWOOn.js @@ -1 +1 @@ -import{Pt as e}from"./app-DHmIY1mo.js";var t={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};t.node;var n=e(t),r={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};r.node;var i=e(r),a={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};a.node;var o=e(a),s={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};s.node;var c=e(s),l={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};l.node;var u=e(l);export{n as a,i,c as n,o as r,u as t}; \ No newline at end of file +import{Pt as e}from"./app-DeBWQZ2a.js";var t={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};t.node;var n=e(t),r={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};r.node;var i=e(r),a={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};a.node;var o=e(a),s={name:`network`,size:24,node:[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]};s.node;var c=e(s),l={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};l.node;var u=e(l);export{n as a,i,c as n,o as r,u as t}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-BepNkYer.js b/Tools/Controller/internal/webui/dist/assets/chunk-CaV14yNF.js similarity index 97% rename from Tools/Controller/internal/webui/dist/assets/chunk-BepNkYer.js rename to Tools/Controller/internal/webui/dist/assets/chunk-CaV14yNF.js index 61de7145..f1c06485 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-BepNkYer.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-CaV14yNF.js @@ -1 +1 @@ -import{n as e}from"./chunk-COZaly3R.js";import{a as t,i as n,r}from"./chunk-CWMYvVMg.js";import{At as i,J as a,Pt as o,dt as s}from"./app-DHmIY1mo.js";var c={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};c.node;var l=o(c),u={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};u.node;var d=o(u),f={name:`list-restart`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]};f.node;var p=o(f),m={name:`memory-stick`,size:24,node:[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]};m.node;var h=o(m),g={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};g.node;var _=o(g),v={name:`radio`,size:24,node:[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};v.node;var y=o(v),b={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};b.node;var x=o(b),S={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};S.node;var C=o(S),w={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};w.node;var T=o(w),E={name:`thermometer`,size:24,node:[[`path`,{d:`M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z`,key:`17jzev`}]]};E.node;var D=o(E),O={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};O.node;var k=o(O),A={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};A.node;var j=o(A),M={name:`waves-horizontal`,size:24,node:[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]],aliases:[`waves`]};M.node;var N=o(M);function P(e,t,n){return!!(n&&n!==t&&n!==e)}function F(e,t){return e===`ArrowUp`?-1:e===`ArrowDown`?1:e===`ArrowLeft`?t===`rtl`?1:-1:e===`ArrowRight`?t===`rtl`?-1:1:null}var I=s();function L({copy:t,editing:o,cards:s,hidden:c,onToggleEditing:l,onShow:u,onReset:d}){let f=s.filter(({id:e})=>c.includes(e));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{compact:!0,className:`card-layout-editor__toggle`,icon:o?i:r,"aria-pressed":o,onClick:l,children:o?t.done:t.customize}),o&&(0,I.jsxs)(`div`,{className:`card-layout-editor`,role:`toolbar`,"aria-label":t.customize,children:[f.length>0&&(0,I.jsxs)(`div`,{className:`card-layout-editor__hidden`,children:[(0,I.jsx)(`span`,{children:t.hidden}),f.map(({id:e,label:r})=>(0,I.jsxs)(a,{compact:!0,icon:n,onClick:()=>u(e),children:[t.show,` `,r]},e))]}),(0,I.jsx)(a,{compact:!0,tone:`ghost`,icon:e,onClick:d,children:t.reset})]})]})}function R({id:e,title:n,order:i,collapsed:a,hidden:o,editing:s,dragging:c,copy:l,onToggleCollapsed:u,onHide:f,onReorderStart:p,onReorderMove:m,onReorderEnd:h,onKeyboardReorder:g,children:_}){return o?null:(0,I.jsxs)(`section`,{className:`card-layout-frame${s?` is-editing`:``}${a?` is-collapsed`:``}${c?` is-dragging`:``}`,"data-layout-card-id":e,style:{order:i},children:[(s||a)&&(0,I.jsxs)(`div`,{className:`card-layout-frame__toolbar`,children:[s&&(0,I.jsx)(`button`,{type:`button`,className:`card-layout-frame__reorder`,title:`${l.move} ${n}`,"aria-label":`${l.move} ${n}`,onPointerDown:t=>{t.button===0&&t.isPrimary&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),p(e,t.clientX,t.clientY))},onPointerMove:t=>{t.currentTarget.hasPointerCapture(t.pointerId)&&m(e,t.clientX,t.clientY)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),h()},onPointerCancel:h,onLostPointerCapture:h,onKeyDown:t=>{let n=document.documentElement.dir===`rtl`?`rtl`:`ltr`,r=F(t.key,n);r!==null&&(t.preventDefault(),g(e,r))},children:(0,I.jsx)(r,{size:16})}),(0,I.jsx)(`strong`,{children:n}),(0,I.jsx)(`button`,{type:`button`,title:`${a?l.expand:l.collapse} ${n}`,"aria-label":`${a?l.expand:l.collapse} ${n}`,"aria-expanded":!a,onClick:u,children:(0,I.jsx)(d,{size:16})}),s&&(0,I.jsx)(`button`,{type:`button`,title:`${l.hide} ${n}`,"aria-label":`${l.hide} ${n}`,onClick:f,children:(0,I.jsx)(t,{size:16})})]}),!a&&_]})}function z(e){return`pccontroller.${e}-layout`}function B(e){return{order:[...e],collapsed:[],hidden:[]}}function V(e,t){let n=new Set(t),r=e=>{let t=new Set;return(e??[]).filter(e=>!n.has(e)||t.has(e)?!1:(t.add(e),!0))},i=r(e?.order);return i.push(...t.filter(e=>!i.includes(e))),{order:i,collapsed:r(e?.collapsed),hidden:r(e?.hidden)}}function H(e,t,n=typeof localStorage>`u`?null:localStorage){try{return V(JSON.parse(n?.getItem(z(e))??`null`),t)}catch{return B(t)}}function U(e,t,n,r=typeof localStorage>`u`?null:localStorage){try{r?.setItem(z(e),JSON.stringify(V(n,t)))}catch{}}function W(e,t=typeof localStorage>`u`?null:localStorage){try{t?.removeItem(z(e))}catch{}}function G(e,t,n){if(t===n)return e;let r=e.order.indexOf(t),i=e.order.indexOf(n);if(r<0||i<0)return e;let a=e.order.filter(e=>e!==t),o=a.indexOf(n)+ +(re!==t):[...e,t]}export{_,K as a,d as b,P as c,k as d,D as f,y as g,x as h,U as i,N as l,C as m,G as n,L as o,T as p,W as r,R as s,H as t,j as u,h as v,l as x,p as y}; \ No newline at end of file +import{n as e}from"./chunk-CNKgOZEf.js";import{a as t,i as n,r}from"./chunk-CWQLWOOn.js";import{At as i,J as a,Pt as o,dt as s}from"./app-DeBWQZ2a.js";var c={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};c.node;var l=o(c),u={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};u.node;var d=o(u),f={name:`list-restart`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M7 12H3`,key:`13ou7f`}],[`path`,{d:`M7 19H3`,key:`wbqt3n`}],[`path`,{d:`M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14`,key:`qth677`}],[`path`,{d:`M11 10v4h4`,key:`172dkj`}]]};f.node;var p=o(f),m={name:`memory-stick`,size:24,node:[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]};m.node;var h=o(m),g={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};g.node;var _=o(g),v={name:`radio`,size:24,node:[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};v.node;var y=o(v),b={name:`save`,size:24,node:[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]};b.node;var x=o(b),S={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};S.node;var C=o(S),w={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};w.node;var T=o(w),E={name:`thermometer`,size:24,node:[[`path`,{d:`M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z`,key:`17jzev`}]]};E.node;var D=o(E),O={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};O.node;var k=o(O),A={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};A.node;var j=o(A),M={name:`waves-horizontal`,size:24,node:[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]],aliases:[`waves`]};M.node;var N=o(M);function P(e,t,n){return!!(n&&n!==t&&n!==e)}function F(e,t){return e===`ArrowUp`?-1:e===`ArrowDown`?1:e===`ArrowLeft`?t===`rtl`?1:-1:e===`ArrowRight`?t===`rtl`?-1:1:null}var I=s();function L({copy:t,editing:o,cards:s,hidden:c,onToggleEditing:l,onShow:u,onReset:d}){let f=s.filter(({id:e})=>c.includes(e));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{compact:!0,className:`card-layout-editor__toggle`,icon:o?i:r,"aria-pressed":o,onClick:l,children:o?t.done:t.customize}),o&&(0,I.jsxs)(`div`,{className:`card-layout-editor`,role:`toolbar`,"aria-label":t.customize,children:[f.length>0&&(0,I.jsxs)(`div`,{className:`card-layout-editor__hidden`,children:[(0,I.jsx)(`span`,{children:t.hidden}),f.map(({id:e,label:r})=>(0,I.jsxs)(a,{compact:!0,icon:n,onClick:()=>u(e),children:[t.show,` `,r]},e))]}),(0,I.jsx)(a,{compact:!0,tone:`ghost`,icon:e,onClick:d,children:t.reset})]})]})}function R({id:e,title:n,order:i,collapsed:a,hidden:o,editing:s,dragging:c,copy:l,onToggleCollapsed:u,onHide:f,onReorderStart:p,onReorderMove:m,onReorderEnd:h,onKeyboardReorder:g,children:_}){return o?null:(0,I.jsxs)(`section`,{className:`card-layout-frame${s?` is-editing`:``}${a?` is-collapsed`:``}${c?` is-dragging`:``}`,"data-layout-card-id":e,style:{order:i},children:[(s||a)&&(0,I.jsxs)(`div`,{className:`card-layout-frame__toolbar`,children:[s&&(0,I.jsx)(`button`,{type:`button`,className:`card-layout-frame__reorder`,title:`${l.move} ${n}`,"aria-label":`${l.move} ${n}`,onPointerDown:t=>{t.button===0&&t.isPrimary&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),p(e,t.clientX,t.clientY))},onPointerMove:t=>{t.currentTarget.hasPointerCapture(t.pointerId)&&m(e,t.clientX,t.clientY)},onPointerUp:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),h()},onPointerCancel:h,onLostPointerCapture:h,onKeyDown:t=>{let n=document.documentElement.dir===`rtl`?`rtl`:`ltr`,r=F(t.key,n);r!==null&&(t.preventDefault(),g(e,r))},children:(0,I.jsx)(r,{size:16})}),(0,I.jsx)(`strong`,{children:n}),(0,I.jsx)(`button`,{type:`button`,title:`${a?l.expand:l.collapse} ${n}`,"aria-label":`${a?l.expand:l.collapse} ${n}`,"aria-expanded":!a,onClick:u,children:(0,I.jsx)(d,{size:16})}),s&&(0,I.jsx)(`button`,{type:`button`,title:`${l.hide} ${n}`,"aria-label":`${l.hide} ${n}`,onClick:f,children:(0,I.jsx)(t,{size:16})})]}),!a&&_]})}function z(e){return`pccontroller.${e}-layout`}function B(e){return{order:[...e],collapsed:[],hidden:[]}}function V(e,t){let n=new Set(t),r=e=>{let t=new Set;return(e??[]).filter(e=>!n.has(e)||t.has(e)?!1:(t.add(e),!0))},i=r(e?.order);return i.push(...t.filter(e=>!i.includes(e))),{order:i,collapsed:r(e?.collapsed),hidden:r(e?.hidden)}}function H(e,t,n=typeof localStorage>`u`?null:localStorage){try{return V(JSON.parse(n?.getItem(z(e))??`null`),t)}catch{return B(t)}}function U(e,t,n,r=typeof localStorage>`u`?null:localStorage){try{r?.setItem(z(e),JSON.stringify(V(n,t)))}catch{}}function W(e,t=typeof localStorage>`u`?null:localStorage){try{t?.removeItem(z(e))}catch{}}function G(e,t,n){if(t===n)return e;let r=e.order.indexOf(t),i=e.order.indexOf(n);if(r<0||i<0)return e;let a=e.order.filter(e=>e!==t),o=a.indexOf(n)+ +(re!==t):[...e,t]}export{_,K as a,d as b,P as c,k as d,D as f,y as g,x as h,U as i,N as l,C as m,G as n,L as o,T as p,W as r,R as s,H as t,j as u,h as v,l as x,p as y}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-BuW8SQma.js b/Tools/Controller/internal/webui/dist/assets/chunk-DqITOKt5.js similarity index 99% rename from Tools/Controller/internal/webui/dist/assets/chunk-BuW8SQma.js rename to Tools/Controller/internal/webui/dist/assets/chunk-DqITOKt5.js index 5c789a0b..80e3bd20 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-BuW8SQma.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-DqITOKt5.js @@ -1,4 +1,4 @@ -import{Ft as e,It as t,Lt as n,Rt as r,at as i,dt as a,ot as o,zt as s}from"./app-DHmIY1mo.js";function c(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,u=e.desc,d=S(e,b),p=a||{width:r,height:i,x:0,y:0},m=l(`recharts-surface`,o);return f.createElement(`svg`,x({},v(d),{className:m,width:r,height:i,style:s,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),f.createElement(`title`,null,c),f.createElement(`desc`,null,u),n)}),T=[`children`,`className`];function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=D(e,T),a=l(`recharts-layer`,r);return f.createElement(`g`,E({className:a},v(i),{ref:t}),n)});function A(e){return e===`__proto__`}var j=Object.prototype.hasOwnProperty;function M(e,t){return j.call(e,t)}var N=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function ee(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:N.test(e);default:return!1}}function te(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function ne(e){return typeof e==`symbol`||e instanceof Symbol}function re(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n0&&(t+=`,`),t+=re(e[n]);return t}if(ne(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function ie(e){return e==null?``:re(e)}function ae(e){if(Array.isArray(e))return e.map(te);if(typeof e==`symbol`)return[e];e=ie(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ce),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function P(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+le(i)+n},``)}var ue=e=>e===0?0:e>0?1:-1,de=e=>typeof e==`number`&&e!=+e,fe=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!de(e),pe=e=>F(e)||typeof e==`string`,me=0,he=e=>{var t=++me;return`${e||``}${t}`},ge=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!F(e)&&typeof e!=`string`)return n;var i;if(fe(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return de(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},_e=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):oe(e,t))===n)}var I=e=>e==null,be=e=>I(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function xe(e){return e!=null}function Se(){}function Ce(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=Ce(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Te({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Te({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Te({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Te({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Te({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Te({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Te({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Te({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(F(n.x)||fe(n.x))&&(F(n.y)||fe(n.y))?Te({x:c+ge(n.x,g),y:l+ge(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Te({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Ae=[`top`,`left`,`right`,`bottom`];function je(e){return e==null?!1:typeof e==`object`||Ae.includes(e)}var Me=(0,f.createContext)(null),Ne=()=>(0,f.useContext)(Me);function L(e){return function(){return e}}var Pe=Math.cos,Fe=Math.sin,Ie=Math.sqrt,Le=Math.PI;Le/2;var Re=2*Le,ze=Math.PI,Be=2*ze,Ve=1e-6,He=Be-Ve;function Ue(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Ue;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tVe){if(!(Math.abs(u*s-c*l)>Ve)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((ze-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ve&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Ve||Math.abs(this._y1-l)>Ve)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Be+Be),d>He?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Ve&&this._append`A${n},${n},0,${+(d>=ze)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Ge.prototype;function Ke(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Ge(t)}Array.prototype.slice;function qe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Je(e){this._context=e}Je.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Ye(e){return new Je(e)}function Xe(e){return e[0]}function Ze(e){return e[1]}function Qe(e,t){var n=L(!0),r=null,i=Ye,a=null,o=Ke(s);e=typeof e==`function`?e:e===void 0?Xe:L(e),t=typeof t==`function`?t:t===void 0?Ze:L(t);function s(s){var c,l=(s=qe(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Qe().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:L(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:L(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:L(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:L(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:L(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var et=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function tt(e){return new et(e,!0)}function nt(e){return new et(e,!1)}var rt={draw(e,t){let n=Ie(t/Le);e.moveTo(n,0),e.arc(0,0,n,0,Re)}},it={draw(e,t){let n=Ie(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},at=Ie(1/3),ot=at*2,st={draw(e,t){let n=Ie(t/ot),r=n*at;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ct={draw(e,t){let n=Ie(t),r=-n/2;e.rect(r,r,n,n)}},lt=.8908130915292852,ut=Fe(Le/10)/Fe(7*Le/10),dt=Fe(Re/10)*ut,ft=-Pe(Re/10)*ut,pt={draw(e,t){let n=Ie(t*lt),r=dt*n,i=ft*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Re*t/5,o=Pe(a),s=Fe(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},mt=Ie(3),ht={draw(e,t){let n=-Ie(t/(mt*3));e.moveTo(0,n*2),e.lineTo(-mt*n,-n),e.lineTo(mt*n,-n),e.closePath()}},gt=-.5,_t=Ie(3)/2,vt=1/Ie(12),yt=(vt/2+1)*3,bt={draw(e,t){let n=Ie(t/yt),r=n/2,i=n*vt,a=r,o=n*vt+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(gt*r-_t*i,_t*r+gt*i),e.lineTo(gt*a-_t*o,_t*a+gt*o),e.lineTo(gt*s-_t*c,_t*s+gt*c),e.lineTo(gt*r+_t*i,gt*i-_t*r),e.lineTo(gt*a+_t*o,gt*o-_t*a),e.lineTo(gt*s+_t*c,gt*c-_t*s),e.closePath()}};function xt(e,t){let n=null,r=Ke(i);e=typeof e==`function`?e:L(e||rt),t=typeof t==`function`?t:L(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:L(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function St(){}function Ct(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function wt(e){this._context=e}wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Tt(e){return new wt(e)}function Et(e){this._context=e}Et.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dt(e){return new Et(e)}function Ot(e){this._context=e}Ot.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function kt(e){return new Ot(e)}function At(e){this._context=e}At.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function jt(e){return new At(e)}function Mt(e){return e<0?-1:1}function Nt(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Mt(a)+Mt(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Pt(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Ft(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function It(e){this._context=e}It.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ft(this,this._t0,Pt(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Ft(this,Pt(this,n=Nt(this,e,t)),n);break;default:Ft(this,this._t0,n=Nt(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Lt(e){this._context=new Rt(e)}(Lt.prototype=Object.create(It.prototype)).point=function(e,t){It.prototype.point.call(this,t,e)};function Rt(e){this._context=e}Rt.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function zt(e){return new It(e)}function Bt(e){return new Lt(e)}function Vt(e){this._context=e}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Ht(e),i=Ht(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function Gt(e){return new Wt(e,.5)}function Kt(e){return new Wt(e,0)}function qt(e){return new Wt(e,1)}function Jt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Xt(e,t){return e[t]}function Zt(e){let t=[];return t.key=e,t}function Qt(){var e=L([]),t=Yt,n=Jt,r=Xt;function i(i){var a=Array.from(e.apply(this,arguments),Zt),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;rfn[`symbol${be(e)}`]||rt,hn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*pn;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gn=(e,t)=>{fn[`symbol${be(e)}`]=t},_n=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=on(on({},un(e,nn)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var u=()=>{var e=mn(c),t=xt().type(e).size(hn(i,o,c))();if(t!==null)return t},d=s.className,p=s.cx,m=s.cy,h=v(s);return F(p)&&F(m)&&F(i)?f.createElement(`path`,rn({},h,{className:l(`recharts-symbols`,d),transform:`translate(${p}, ${m})`,d:u()})):null};_n.registerSymbol=gn;var vn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,yn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,f.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{d(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},bn=(e,t,n)=>r=>(e(t,n,r),null),xn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];d(i)&&typeof a==`function`&&(r||={},r[i]=bn(a,t,n))}),r};function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cn(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,u=e.desc,d=S(e,b),p=a||{width:r,height:i,x:0,y:0},m=l(`recharts-surface`,o);return f.createElement(`svg`,x({},v(d),{className:m,width:r,height:i,style:s,viewBox:`${p.x} ${p.y} ${p.width} ${p.height}`,ref:t}),f.createElement(`title`,null,c),f.createElement(`desc`,null,u),n)}),T=[`children`,`className`];function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var n=e.children,r=e.className,i=D(e,T),a=l(`recharts-layer`,r);return f.createElement(`g`,E({className:a},v(i),{ref:t}),n)});function A(e){return e===`__proto__`}var j=Object.prototype.hasOwnProperty;function M(e,t){return j.call(e,t)}var N=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function ee(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:N.test(e);default:return!1}}function te(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function ne(e){return typeof e==`symbol`||e instanceof Symbol}function re(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n0&&(t+=`,`),t+=re(e[n]);return t}if(ne(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function ie(e){return e==null?``:re(e)}function ae(e){if(Array.isArray(e))return e.map(te);if(typeof e==`symbol`)return[e];e=ie(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r1&&arguments[1]!==void 0?arguments[1]:ce),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function P(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+le(i)+n},``)}var ue=e=>e===0?0:e>0?1:-1,de=e=>typeof e==`number`&&e!=+e,fe=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!de(e),pe=e=>F(e)||typeof e==`string`,me=0,he=e=>{var t=++me;return`${e||``}${t}`},ge=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!F(e)&&typeof e!=`string`)return n;var i;if(fe(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return de(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},_e=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;re&&(typeof t==`function`?t(e):oe(e,t))===n)}var I=e=>e==null,be=e=>I(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function xe(e){return e!=null}function Se(){}function Ce(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=Ce(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?Te({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?Te({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?Te({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?Te({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?Te({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?Te({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?Te({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?Te({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(F(n.x)||fe(n.x))&&(F(n.y)||fe(n.y))?Te({x:c+ge(n.x,g),y:l+ge(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):Te({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},Ae=[`top`,`left`,`right`,`bottom`];function je(e){return e==null?!1:typeof e==`object`||Ae.includes(e)}var Me=(0,f.createContext)(null),Ne=()=>(0,f.useContext)(Me);function L(e){return function(){return e}}var Pe=Math.cos,Fe=Math.sin,Ie=Math.sqrt,Le=Math.PI;Le/2;var Re=2*Le,ze=Math.PI,Be=2*ze,Ve=1e-6,He=Be-Ve;function Ue(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return Ue;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tVe){if(!(Math.abs(u*s-c*l)>Ve)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((ze-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>Ve&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>Ve||Math.abs(this._y1-l)>Ve)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%Be+Be),d>He?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>Ve&&this._append`A${n},${n},0,${+(d>=ze)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Ge.prototype;function Ke(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Ge(t)}Array.prototype.slice;function qe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Je(e){this._context=e}Je.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Ye(e){return new Je(e)}function Xe(e){return e[0]}function Ze(e){return e[1]}function Qe(e,t){var n=L(!0),r=null,i=Ye,a=null,o=Ke(s);e=typeof e==`function`?e:e===void 0?Xe:L(e),t=typeof t==`function`?t:t===void 0?Ze:L(t);function s(s){var c,l=(s=qe(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return Qe().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:L(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:L(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:L(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:L(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:L(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var et=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function tt(e){return new et(e,!0)}function nt(e){return new et(e,!1)}var rt={draw(e,t){let n=Ie(t/Le);e.moveTo(n,0),e.arc(0,0,n,0,Re)}},it={draw(e,t){let n=Ie(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},at=Ie(1/3),ot=at*2,st={draw(e,t){let n=Ie(t/ot),r=n*at;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ct={draw(e,t){let n=Ie(t),r=-n/2;e.rect(r,r,n,n)}},lt=.8908130915292852,ut=Fe(Le/10)/Fe(7*Le/10),dt=Fe(Re/10)*ut,ft=-Pe(Re/10)*ut,pt={draw(e,t){let n=Ie(t*lt),r=dt*n,i=ft*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=Re*t/5,o=Pe(a),s=Fe(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},mt=Ie(3),ht={draw(e,t){let n=-Ie(t/(mt*3));e.moveTo(0,n*2),e.lineTo(-mt*n,-n),e.lineTo(mt*n,-n),e.closePath()}},gt=-.5,_t=Ie(3)/2,vt=1/Ie(12),yt=(vt/2+1)*3,bt={draw(e,t){let n=Ie(t/yt),r=n/2,i=n*vt,a=r,o=n*vt+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(gt*r-_t*i,_t*r+gt*i),e.lineTo(gt*a-_t*o,_t*a+gt*o),e.lineTo(gt*s-_t*c,_t*s+gt*c),e.lineTo(gt*r+_t*i,gt*i-_t*r),e.lineTo(gt*a+_t*o,gt*o-_t*a),e.lineTo(gt*s+_t*c,gt*c-_t*s),e.closePath()}};function xt(e,t){let n=null,r=Ke(i);e=typeof e==`function`?e:L(e||rt),t=typeof t==`function`?t:L(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:L(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:L(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function St(){}function Ct(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function wt(e){this._context=e}wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ct(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Tt(e){return new wt(e)}function Et(e){this._context=e}Et.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dt(e){return new Et(e)}function Ot(e){this._context=e}Ot.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ct(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function kt(e){return new Ot(e)}function At(e){this._context=e}At.prototype={areaStart:St,areaEnd:St,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function jt(e){return new At(e)}function Mt(e){return e<0?-1:1}function Nt(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Mt(a)+Mt(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Pt(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Ft(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function It(e){this._context=e}It.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ft(this,this._t0,Pt(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Ft(this,Pt(this,n=Nt(this,e,t)),n);break;default:Ft(this,this._t0,n=Nt(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Lt(e){this._context=new Rt(e)}(Lt.prototype=Object.create(It.prototype)).point=function(e,t){It.prototype.point.call(this,t,e)};function Rt(e){this._context=e}Rt.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function zt(e){return new It(e)}function Bt(e){return new Lt(e)}function Vt(e){this._context=e}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Ht(e),i=Ht(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function Gt(e){return new Wt(e,.5)}function Kt(e){return new Wt(e,0)}function qt(e){return new Wt(e,1)}function Jt(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Xt(e,t){return e[t]}function Zt(e){let t=[];return t.key=e,t}function Qt(){var e=L([]),t=Yt,n=Jt,r=Xt;function i(i){var a=Array.from(e.apply(this,arguments),Zt),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0&&(a=(i=e[t[0]]).length)>0){for(var n=0,r=1,i,a,o;rfn[`symbol${be(e)}`]||rt,hn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*pn;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gn=(e,t)=>{fn[`symbol${be(e)}`]=t},_n=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=on(on({},un(e,nn)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var u=()=>{var e=mn(c),t=xt().type(e).size(hn(i,o,c))();if(t!==null)return t},d=s.className,p=s.cx,m=s.cy,h=v(s);return F(p)&&F(m)&&F(i)?f.createElement(`path`,rn({},h,{className:l(`recharts-symbols`,d),transform:`translate(${p}, ${m})`,d:u()})):null};_n.registerSymbol=gn;var vn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,yn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,f.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{d(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},bn=(e,t,n)=>r=>(e(t,n,r),null),xn=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];d(i)&&typeof a==`function`&&(r||={},r[i]=bn(a,t,n))}),r};function Sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cn(e){for(var t=1;t(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function On(){return On=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var p=t.formatter||i,m=l({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var h=typeof s==`object`?An({},s):{};h.color=t.inactive?a:h.color||t.color,h.whiteSpace??=`normal`,h.overflowWrap??=`break-word`;var g=p?p(t.value,t,r):t.value;return f.createElement(`li`,On({className:m,style:u,key:`legend-item-${r}`},xn(e,t,r)),f.createElement(w,{width:n,height:n,viewBox:c,style:d,"aria-label":t.value==null?`legend icon`:`${t.value} legend icon`},f.createElement(Ln,{data:t,iconType:o,inactiveColor:a})),f.createElement(`span`,{className:`recharts-legend-item-text`,style:h},g))})}var zn=e=>{var t=Dn(e,Fn),n=t.payload,r=t.layout,i=t.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return f.createElement(`ul`,{className:`recharts-default-legend`,style:a},f.createElement(Rn,On({},t,{payload:n})))};function Bn(e,t){let n=new Map;for(let r=0;r=0}function Wn(e){return e!=null&&typeof e!=`function`&&Un(e.length)}function Gn(e){return function(t){return oe(t,e)}}function Kn(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function qn(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Jn=`[object RegExp]`,Yn=`[object String]`,Xn=`[object Number]`,Zn=`[object Boolean]`,Qn=`[object Arguments]`,$n=`[object Symbol]`,er=`[object Date]`,tr=`[object Map]`,nr=`[object Set]`,rr=`[object Array]`,ir=`[object Function]`,ar=`[object ArrayBuffer]`,or=`[object Object]`,sr=`[object Error]`,cr=`[object DataView]`,lr=`[object Uint8Array]`,ur=`[object Uint8ClampedArray]`,dr=`[object Uint16Array]`,fr=`[object Uint32Array]`,pr=`[object BigUint64Array]`,mr=`[object Int8Array]`,hr=`[object Int16Array]`,gr=`[object Int32Array]`,_r=`[object BigInt64Array]`,vr=`[object Float32Array]`,yr=`[object Float64Array]`;function br(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function xr(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Sr(e,t,n){return typeof n==`function`?Cr(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Cr(t,r,e,s,!1):!!c},new Map,!0):Sr(e,t,()=>void 0)}function Cr(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return wr(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Cr(e,Object.assign({},t),n,r,i):br(e,t);default:return xr(e)&&i?typeof t!=`string`||t===``:br(e,t)}}function wr(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Er(e,t,n,r);if(t instanceof Map)return Tr(e,t,n,r);if(t instanceof Set)return Dr(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)Kn(e)&&(e=Object(e));else{if(qn(t)===`[object Error]`)return qn(e)===`[object Error]`&&e.name===t.name&&e.message===t.message;let n=qn(e);if(n!==`[object Object]`&&n!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;ivoid 0)}function kr(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Ar=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function jr(e){return Ar.Buffer!==void 0&&Ar.Buffer.isBuffer(e)}function Mr(e){return jr(e)}function Nr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Pr(e){return Nr(e)}function Fr(e,t){return Ir(e,void 0,e,new Map,t)}function Ir(e,t,n,r,i){if(i!=null){let a=i(e,t,n,r);if(a!==void 0)return a}if(Kn(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a{t.set(a,Ir(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(Ir(e,void 0,n,r,i))}),t}if(Mr(e))return e.subarray();if(Pr(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;aOr(t,e)}var Vr=/^(?:0|[1-9]\d*)$/;function Hr(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),Zr=n(((e,t)=>{t.exports=Xr()})),Qr=n((e=>{var n=t(),r=Zr();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),$r=n(((e,t)=>{t.exports=Qr()})),ei=(0,f.createContext)(null),ti=$r(),ni=e=>e,R=()=>{var e=(0,f.useContext)(ei);return e?e.store.dispatch:ni},ri=()=>{},ii=()=>ri,ai=(e,t)=>e===t;function z(e){var t=(0,f.useContext)(ei),n=(0,f.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:ri,[t,e]);return(0,ti.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:ii,t?t.store.getState:ri,t?t.store.getState:ri,n,ai)}function oi(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function si(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var ci=e=>Array.isArray(e)?e:[e];function li(e){let t=Array.isArray(e[0])?e[0]:e;return si(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function ui(e,t){let n=[],{length:r}=e;for(let i=0;i`u`?di:WeakRef,pi=0,mi=1;function hi(){return{s:pi,v:void 0,o:null,p:null}}function gi(e){return e instanceof fi?e.deref():e}function _i(e,t={}){let n=hi(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e{n=hi(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function vi(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),oi(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=_i,argsMemoizeOptions:u=[]}={...n,...a},d=ci(c),f=ci(u),p=li(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=ui(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var B=vi(_i);function yi(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a{if(e!==t){let r=Si(e),i=Si(t);if(r===i&&r===0){if(et)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},wi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ti=/^\w*$/;function Ei(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||ne(e)?!0:typeof e==`string`&&(Ti.test(e)||!wi.test(e))||t!=null&&M(t,e)}function Di(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Wn(e)?Array.from(e):xi(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?M(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||Ei(e)?e:{key:e,path:ae(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;re.original)}function Oi(e,...t){let n=t.length;return n>1&&bi(e,t[0],t[1])?t=[]:n>2&&bi(t[0],t[1],t[2])&&(t=[t[0]]),Di(e,yi(t),[`asc`])}var ki=e=>e.legend.settings,Ai=e=>e.legend.size,ji=B([e=>e.legend.payload,ki],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?Oi(r,n):r});function Mi(){return z(ji)}function Ni(e,t){return Ri(e)||Li(e,t)||Fi(e,t)||Pi()}function Pi(){throw TypeError(`Invalid attempt to destructure non-iterable instance. diff --git a/Tools/Controller/internal/webui/dist/assets/chunk-BHa6AuNE.js b/Tools/Controller/internal/webui/dist/assets/chunk-DyKkUGk4.js similarity index 99% rename from Tools/Controller/internal/webui/dist/assets/chunk-BHa6AuNE.js rename to Tools/Controller/internal/webui/dist/assets/chunk-DyKkUGk4.js index 44429d7b..49dd5aa0 100644 --- a/Tools/Controller/internal/webui/dist/assets/chunk-BHa6AuNE.js +++ b/Tools/Controller/internal/webui/dist/assets/chunk-DyKkUGk4.js @@ -1 +1 @@ -import{D as e,Et as t,It as n,J as r,M as i,N as a,Ot as o,Pt as s,X as c,Y as l,Z as u,dt as d,ht as f,it as p,j as m,jt as ee,k as h,n as te,ot as g,r as _,st as v,x as ne,xt as re,zt as ie}from"./app-DHmIY1mo.js";import{n as y,r as ae,t as oe}from"./chunk-BLxVMrn3.js";import{i as se,n as ce,r as le,t as ue}from"./chunk-COZaly3R.js";import{t as de}from"./chunk-eKoA1lB1.js";import{t as fe}from"./chunk-Bi9TV8AN.js";import{t as b}from"./chunk-DQyIR_Rr.js";import{n as x,t as S}from"./chunk-Co4i84v0.js";var C={name:`archive-arrow-up`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]],aliases:[`archive-restore`]};C.node;var pe=s(C),w={name:`clock-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]};w.node;var me=s(w),T={name:`cloud-download`,size:24,node:[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]],aliases:[`download-cloud`]};T.node;var he=s(T),E={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};E.node;var ge=s(E),D={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};D.node;var O=s(D),k={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};k.node;var A=s(k),j={name:`file-up`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]};j.node;var M=s(j),N={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};N.node;var _e=s(N),P={name:`package-check`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};P.node;var ve=s(P),F={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};F.node;var I=s(F),L=ie(n(),1);function ye(e,t){return i(`controller.discovery.github.workflow`,e,t)}function R(e,t){return i(`controller.discovery.github.release`,e,t)}function be(e,t,n){return i(`controller.discovery.manifest`,{url:e,...t?{bearer_token:t}:{}},n)}function z(e,t,n){return i(`controller.discovery.check`,{current:e??{},kind:t.kind,platform:t.platform??``,candidates:[t]},n)}function xe(e,t,n){let r=`stage:${e.id}:${e.sha256||e.archive_sha256||`unhashed`}`;return i(`controller.discovery.stage`,{candidate:e,idempotency_key:r,...t?{bearer_token:t}:{}},n)}function B(e,t){return i(`controller.discovery.status`,e?{id:e}:{},t)}function Se(){let e=typeof navigator>`u`?void 0:navigator,t=`${e?.userAgent??``} ${e?.platform??``}`.toLowerCase();return`${t.includes(`win`)?`windows`:t.includes(`mac`)?`darwin`:`linux`}/${t.includes(`arm64`)||t.includes(`aarch64`)?`arm64`:`amd64`}`}var V=d(),Ce=[`firmware`,`eeprom`,`flash-backup`,`host-executable`];function we(e,t){if(e=e.trim(),!e)return;let n=Number.parseInt(e.replace(/^0x/i,``),e.toLowerCase().startsWith(`0x`)?16:10);if(!Number.isSafeInteger(n)||n<0||n>4294967295)throw Error(t);return n}function Te(e,t){if(e)return t===`host-executable`?e.current.host:t===`eeprom`?e.current.eeprom:t===`flash-backup`?e.current.flash_readback:e.current.firmware}function Ee(e,t){return e?e.slice(0,12).toUpperCase():t}function De({manifest:e,events:t,locale:n,openDialog:i,onArtifactsChanged:a}){let o=(e,t)=>n===`fa`?t:e,s=e=>({firmware:o(`Board firmware`,`میان‌افزار برد`),eeprom:o(`Board EEPROM`,`EEPROM برد`),"flash-backup":o(`Flash backup`,`پشتیبان فلش`),"host-executable":o(`Host executable`,`فایل اجرایی میزبان`)})[e],[d,f]=(0,L.useState)(`release`),[p,m]=(0,L.useState)(`firmware`),[h,te]=(0,L.useState)(``),[ne,ie]=(0,L.useState)(`main`),[ae,oe]=(0,L.useState)(`Build`),[se,ce]=(0,L.useState)(``),[ue,fe]=(0,L.useState)(``),[b,S]=(0,L.useState)(``),[C,pe]=(0,L.useState)(()=>Se()),[w,me]=(0,L.useState)(``),[T,E]=(0,L.useState)(``),[ge,D]=(0,L.useState)(``),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(``),[M,N]=(0,L.useState)(null),[P,ve]=(0,L.useState)(null),[F,I]=(0,L.useState)(``),[De,H]=(0,L.useState)(``),U=O?.candidates.find(e=>e.id===A),W=(0,L.useMemo)(()=>t.find(e=>e.kind.startsWith(`artifact.discovery.`)),[t]),G=e=>{ve(e),e.state===`failed`?H(e.error||e.detail||o(`Candidate staging failed.`,`آماده‌سازی گزینهٔ انتخابی ناموفق بود.`)):e.state===`completed`&&(E(``),a())};(0,L.useEffect)(()=>{P?.id&&W&&B(P.id).then(G).catch(e=>{H(e instanceof Error?e.message:String(e))})},[W?.id,W?.time]),(0,L.useEffect)(()=>{N(null),U&&z(Te(e,U.kind),U).then(N).catch(e=>{H(e instanceof Error?e.message:String(e))})},[A,e]);let Oe=async e=>{e.preventDefault(),I(`discover`),H(``);try{let e=we(w,o(`Packed timestamp must be a 32-bit decimal or 0x-prefixed hexadecimal value.`,`مهر زمانی فشرده باید یک عدد ده‌دهی ۳۲ بیتی یا مقدار شانزده‌شانزدهی با پیشوند 0x باشد.`)),t=T?{bearer_token:T}:{},n=d===`manifest`?await be(ue.trim(),T):d===`workflow`?await ye({repository:h.trim(),branch:ne.trim(),workflow:ae.trim(),kind:p,platform:p===`host-executable`?C.trim():void 0,api_base_url:b.trim()||void 0,packed_timestamp:e,...t}):await R({repository:h.trim(),tag:se.trim()||void 0,kind:p,platform:p===`host-executable`?C.trim():void 0,api_base_url:b.trim()||void 0,packed_timestamp:e,...t});k(n),j(n.candidates[0]?.id??``),H(o(`${n.candidates.length} verified metadata candidate${n.candidates.length===1?``:`s`} discovered. No file was downloaded.`,`${n.candidates.length} گزینه با فرادادهٔ تأییدشده پیدا شد. هیچ فایلی دانلود نشده است.`))}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(``)}},ke=e=>i({title:o(`Download and stage this candidate?`,`این گزینه دانلود و آماده شود؟`),body:`${e.name}\n${e.repository||e.url}\n${e.archive_sha256||e.sha256||o(`No provider digest; the content-addressed store will still calculate SHA-256.`,`ارائه‌دهنده چکیده‌ای نداده است؛ مخزن محتوامحور همچنان SHA-256 را محاسبه می‌کند.`)}\n\n${o(`This downloads through the primary host, safely selects a ZIP member when needed, verifies all available size/digest metadata, and stages it. It does not open or program the board.`,`فایل از طریق میزبان اصلی دانلود می‌شود، در صورت نیاز عضو مناسب ZIP با ایمنی انتخاب می‌گردد، همهٔ فراداده‌های موجودِ اندازه و چکیده بررسی و سپس آماده می‌شود. این کار برد را باز یا پروگرام نمی‌کند.`)}`,confirmLabel:o(`Download and stage only`,`فقط دانلود و آماده‌سازی`),action:async()=>{I(`stage`);try{let t=await xe(ge.trim()?{...e,archive_path:ge.trim()}:e,T);G(t.operation),H(o(`Verified download queued. Programming still requires a separate update authorization.`,`دانلود تأییدشده در صف قرار گرفت. پروگرام همچنان به مجوز جداگانهٔ به‌روزرسانی نیاز دارد.`))}catch(e){throw H(e instanceof Error?e.message:String(e)),e}finally{I(``)}}});return(0,V.jsxs)(l,{icon:y,iconTone:`violet`,title:o(`Release & workflow discovery`,`کشف انتشار و گردش‌کار`),eyebrow:`${d===`release`?o(`Release`,`انتشار`):d===`workflow`?o(`Workflow`,`گردش‌کار`):o(`Manifest`,`مانیفست`)} · ${o(`proxy aware`,`سازگار با پراکسی`)}`,className:`release-discovery-card`,action:(0,V.jsx)(g,{tone:P?.state===`failed`?`bad`:P?.state===`completed`?`good`:P?`info`:`neutral`,children:P?.state?.toUpperCase()||o(`READY`,`آماده`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:o(`Discover build artifacts without hardcoded product names. Provider metadata, release checksums, hashes, packed timestamps and platform are preserved into the content-addressed inventory.`,`خروجی‌های ساخت بدون نام محصولِ ثابت کشف می‌شوند. فرادادهٔ ارائه‌دهنده، چک‌سام انتشار، هش، مهر زمانی فشرده و پلتفرم در فهرست محتوامحور حفظ می‌شود.`)}),(0,V.jsxs)(`form`,{className:`release-discovery-form`,onSubmit:e=>void Oe(e),children:[(0,V.jsxs)(`div`,{className:`discovery-source-picker`,children:[(0,V.jsxs)(`button`,{type:`button`,className:d===`release`?`is-active`:``,onClick:()=>f(`release`),children:[(0,V.jsx)(_e,{}),o(`GitHub release`,`انتشار GitHub`)]}),(0,V.jsxs)(`button`,{type:`button`,className:d===`workflow`?`is-active`:``,onClick:()=>f(`workflow`),children:[(0,V.jsx)(_e,{}),o(`Workflow artifact`,`خروجی گردش‌کار`)]}),(0,V.jsxs)(`button`,{type:`button`,className:d===`manifest`?`is-active`:``,onClick:()=>f(`manifest`),children:[(0,V.jsx)(y,{}),o(`HTTP manifest`,`مانیفست HTTP`)]})]}),d===`manifest`?(0,V.jsx)(v,{label:o(`Manifest URL`,`نشانی مانیفست`),type:`url`,dir:`ltr`,value:ue,placeholder:`https://host.example/update-manifest.json`,onChange:e=>fe(e.target.value)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:o(`Repository`,`مخزن`),dir:`ltr`,value:h,placeholder:`owner/repository`,onChange:e=>te(e.target.value)}),d===`workflow`?(0,V.jsx)(v,{label:o(`Branch`,`شاخه`),dir:`ltr`,value:ne,onChange:e=>ie(e.target.value)}):(0,V.jsx)(v,{label:o(`Tag (blank = latest stable)`,`برچسب (خالی = آخرین نسخهٔ پایدار)`),dir:`ltr`,value:se,onChange:e=>ce(e.target.value)})]}),d===`workflow`&&(0,V.jsx)(v,{label:o(`Workflow name`,`نام گردش‌کار`),value:ae,onChange:e=>oe(e.target.value)}),(0,V.jsx)(v,{label:o(`GitHub API base (optional)`,`نشانی پایهٔ API گیت‌هاب (اختیاری)`),type:`url`,dir:`ltr`,value:b,placeholder:`https://api.github.com`,onChange:e=>S(e.target.value),hint:o(`Supports GitHub Enterprise; normal GitHub uses the default when blank.`,`از GitHub Enterprise پشتیبانی می‌کند؛ برای گیت‌هاب عادی، خالی بگذارید تا مقدار پیش‌فرض استفاده شود.`)})]}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsxs)(`label`,{className:`field`,children:[(0,V.jsx)(`span`,{children:o(`Artifact kind`,`نوع خروجی`)}),(0,V.jsx)(`select`,{value:p,onChange:e=>m(e.target.value),children:Ce.map(e=>(0,V.jsx)(`option`,{value:e,children:s(e)},e))})]}),(0,V.jsx)(v,{label:o(`Target platform`,`پلتفرم مقصد`),dir:`ltr`,value:C,disabled:p!==`host-executable`,onChange:e=>pe(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:o(`Packed timestamp override`,`بازنویسی مهر زمانی فشرده`),dir:`ltr`,value:w,placeholder:o(`0x… or decimal`,`0x… یا ده‌دهی`),onChange:e=>me(e.target.value)}),(0,V.jsx)(v,{label:o(`Provider / peer bearer token`,`توکن حامل ارائه‌دهنده / همتا`),type:`password`,autoComplete:`off`,dir:`ltr`,value:T,onChange:e=>E(e.target.value),hint:o(`Held only in this browser session and cleared after a successful stage.`,`فقط در همین نشست مرورگر نگهداری و پس از آماده‌سازی موفق پاک می‌شود.`)})]}),(0,V.jsx)(r,{type:`submit`,tone:`primary`,icon:y,busy:F===`discover`,disabled:d===`manifest`?!ue.trim():!h.trim(),children:o(`Discover metadata`,`کشف فراداده`)})]}),De&&(0,V.jsxs)(`div`,{className:`update-notice${/failed|error|invalid|mismatch/i.test(De)?` is-error`:``}`,children:[(0,V.jsx)(de,{size:17}),(0,V.jsx)(`span`,{children:De})]}),O?.candidates.length?(0,V.jsx)(`div`,{className:`release-candidates`,children:O.candidates.map(e=>(0,V.jsxs)(`label`,{className:e.id===A?`is-selected`:``,children:[(0,V.jsx)(`input`,{type:`radio`,name:`release-candidate`,checked:e.id===A,onChange:()=>j(e.id)}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsxs)(`small`,{children:[e.release_tag?`${o(`release`,`انتشار`)} ${e.release_tag}`:e.workflow_run_id?`${o(`run`,`اجرا`)} ${e.workflow_run_id}`:e.source,` · `,e.platform||o(`platform-neutral`,`مستقل از پلتفرم`)]})]}),(0,V.jsx)(`code`,{children:Ee(e.archive_sha256||e.sha256,o(`UNPUBLISHED`,`منتشرنشده`))}),(0,V.jsx)(`em`,{children:_(e.archive_bytes||e.bytes,o(`unknown`,`نامشخص`))})]},e.id))}):!F&&O&&(0,V.jsx)(u,{icon:ee,title:o(`No matching candidates`,`گزینهٔ منطبقی پیدا نشد`),detail:o(`Adjust artifact kind, platform, release tag, branch, or workflow name.`,`نوع خروجی، پلتفرم، برچسب انتشار، شاخه یا نام گردش‌کار را تغییر دهید.`)}),U&&(0,V.jsxs)(`div`,{className:`release-selection`,children:[(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:o(`Comparison`,`مقایسه`),value:M?.status||o(`checking`,`در حال بررسی`),tone:M?.status===`newer`?`good`:M?.status===`older`?`warn`:void 0}),(0,V.jsx)(c,{label:o(`Reason`,`دلیل`),value:M?.reason||o(`Comparing hashes and packed/build timestamps…`,`در حال مقایسهٔ هش و مهرهای زمانی فشرده/ساخت…`)}),(0,V.jsx)(c,{label:o(`Build hash`,`هش ساخت`),value:U.build_hash||o(`not supplied`,`ارائه نشده`),mono:!0}),(0,V.jsx)(c,{label:o(`Build time`,`زمان ساخت`),value:U.build_timestamp||o(`not supplied`,`ارائه نشده`),mono:!0})]}),U.archive&&(0,V.jsx)(v,{label:o(`ZIP member path (optional)`,`مسیر عضو ZIP (اختیاری)`),dir:`ltr`,value:ge,placeholder:o(`Auto-select a unique platform/kind match`,`انتخاب خودکار فایل یکتای منطبق با پلتفرم و نوع`),onChange:e=>D(e.target.value),hint:o(`Specify this only when an archive contains multiple equally suitable files.`,`فقط زمانی مشخص کنید که آرشیو چند فایل به یک اندازه مناسب دارد.`)}),(0,V.jsx)(r,{tone:`primary`,icon:he,busy:F===`stage`,onClick:()=>ke(U),children:o(`Review verified staging`,`بازبینی آماده‌سازی تأییدشده`)})]}),P&&(0,V.jsxs)(`div`,{className:`release-operation`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(re,{className:P.state===`queued`||P.state===`downloading`?`spin`:``}),(0,V.jsx)(`strong`,{children:P.error||P.detail||P.state}),(0,V.jsxs)(`span`,{children:[_(P.bytes_done,o(`unknown`,`نامشخص`)),` / `,_(P.bytes_total,o(`unknown`,`نامشخص`))]})]}),(0,V.jsx)(`div`,{className:`update-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.max(0,Math.min(100,P.progress_percent)),children:(0,V.jsx)(`i`,{style:{width:`${Math.max(0,Math.min(100,P.progress_percent))}%`}})}),(0,V.jsx)(r,{compact:!0,icon:le,onClick:()=>void B(P.id).then(G).catch(e=>H(e instanceof Error?e.message:String(e))),children:o(`Refresh operation`,`تازه‌سازی عملیات`)}),P.artifact&&(0,V.jsxs)(`p`,{children:[(0,V.jsx)(x,{}),` `,o(`Staged as`,`آماده‌شده با شناسه`),` `,(0,V.jsx)(`code`,{children:P.artifact.sha256}),`؛ `,o(`board programming remains a separate action.`,`پروگرام برد همچنان عملی جداگانه است.`)]})]})]})}var H=new Set([`completed`,`failed`,`cancelled`,`downloaded`,`staged`]);function U(e){return!!e?.state&&!H.has(e.state)}function W(e){return!U(e)||!e?.progress_known||!Number.isFinite(e.progress_percent)?null:Math.max(0,Math.min(100,e.progress_percent))}function G(e,t){let n=Date.parse(e.started_at??``),r=U(e)?t:Date.parse(e.updated_at??``);if(!Number.isFinite(n)||!Number.isFinite(r)||r=60?`${Math.floor(i/60)}m ${i%60}s`:`${i}s`}var Oe={queued:[`Queued`,`در صف`],preflight:[`Checking tools & target`,`بررسی ابزارها و مقصد`],uploading:[`Uploading artifact`,`ارسال فایل`],receiving:[`Receiving artifact`,`دریافت فایل`],preparing:[`Preparing board`,`آماده‌سازی برد`],"backing-up":[`Saving board settings`,`ذخیره تنظیمات برد`],reading:[`Reading memory`,`خواندن حافظه`],writing:[`Writing memory`,`نوشتن حافظه`],programming:[`Programming board`,`پروگرام برد`],erasing:[`Erasing memory`,`پاک کردن حافظه`],verifying:[`Verifying memory`,`تأیید حافظه`],reconnecting:[`Reconnecting board`,`اتصال دوباره برد`],restoring:[`Restoring settings`,`بازیابی تنظیمات`],downloading:[`Downloading artifact`,`دریافت فایل`],staging:[`Preparing host replacement`,`آماده‌سازی جایگزین میزبان`],staged:[`Host replacement ready`,`جایگزین میزبان آماده است`],prepare:[`Preparing board`,`آماده‌سازی برد`],settings:[`Reading settings`,`خواندن تنظیمات`],release:[`Releasing serial port`,`آزاد کردن درگاه سریال`],backup:[`Saving board backup`,`ذخیره پشتیبان برد`],flash:[`Programming board`,`پروگرام برد`],reconnect:[`Reconnecting board`,`اتصال دوباره برد`],restore:[`Restoring settings`,`بازیابی تنظیمات`],"flash read":[`Reading flash`,`خواندن فلش`],"EEPROM read":[`Reading EEPROM`,`خواندن EEPROM`],"flash write":[`Writing flash`,`نوشتن فلش`],"flash verification":[`Verifying flash`,`تأیید فلش`]};function ke({status:e,locale:t}){let n=(e,n)=>t===`fa`?n:e,r=U(e),i=W(e),[a,o]=(0,L.useState)(Date.now);(0,L.useEffect)(()=>{if(!r)return;let e=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(e)},[r]);let s=G(e,a),c=e.state===`failed`||e.state===`cancelled`,l=e.stage||(r?e.state:``),u=l.split(`:`)[0],d=Oe[u]?.[+(t===`fa`)]||u.replaceAll(`-`,` `),p=c?n(`Update stopped`,`به‌روزرسانی متوقف شد`):r?d:n(`Operation complete`,`عملیات کامل شد`),m=c?f:r?re:de;return(0,V.jsxs)(`section`,{className:`update-operation ${c?`is-failed`:r?`is-running`:`is-complete`}`,"aria-label":n(`Update operation`,`عملیات به‌روزرسانی`),children:[(0,V.jsxs)(`header`,{className:`update-operation__header`,children:[(0,V.jsx)(`div`,{className:`update-operation__icon`,children:(0,V.jsx)(m,{className:r?`spin`:void 0})}),(0,V.jsxs)(`div`,{className:`update-operation__heading`,children:[(0,V.jsx)(`span`,{children:e.kind===`firmware`?n(`Board firmware`,`میان‌افزار برد`):e.kind.replaceAll(`-`,` `)}),(0,V.jsx)(`h2`,{children:p})]}),s&&(0,V.jsxs)(`span`,{className:`update-operation__elapsed`,children:[(0,V.jsx)(me,{size:16}),(0,V.jsx)(`b`,{children:s})]})]}),r&&(0,V.jsxs)(`div`,{className:`update-operation__measurement`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:i===null?n(`Waiting for this stage`,`در انتظار این مرحله`):n(`Current stage`,`مرحله جاری`)}),(0,V.jsx)(`strong`,{children:i===null?`…`:`${i}%`})]}),(0,V.jsx)(`div`,{className:`update-progress${i===null?` is-indeterminate`:``}`,role:`progressbar`,"aria-label":d,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i??void 0,"aria-valuetext":i===null?n(`In progress; duration unknown`,`در حال اجرا؛ زمان نامشخص`):void 0,children:(0,V.jsx)(`i`,{style:i===null?void 0:{width:`${i}%`}})},l)]}),e.detail&&(0,V.jsx)(`div`,{className:`update-operation__detail`,dir:`auto`,role:c?`alert`:void 0,children:e.detail}),(0,V.jsxs)(`dl`,{className:`update-operation__facts`,children:[c&&d&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Last stage`,`آخرین مرحله`)}),(0,V.jsx)(`dd`,{children:d})]}),e.programming_method&&e.programming_method!==`none`&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Connection`,`اتصال`)}),(0,V.jsx)(`dd`,{children:e.programming_method===`urclock`?`UART / Urclock`:`USBasp / ISP`})]}),!!e.bytes_total&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Transferred`,`انتقال داده`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{title:`${e.bytes_done??0} / ${e.bytes_total} bytes`,children:te(e.bytes_done??0,e.bytes_total)})})]}),e.updated_at&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Last activity`,`آخرین فعالیت`)}),(0,V.jsx)(`dd`,{children:new Date(e.updated_at).toLocaleTimeString(t)})]})]}),(0,V.jsxs)(`details`,{className:`update-operation__diagnostics`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(S,{size:16}),n(`Technical details`,`جزئیات فنی`)]}),(0,V.jsxs)(`dl`,{children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Operation`,`عملیات`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.id})})})]}),e.error_code&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Error`,`خطا`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.error_code})})})]}),e.artifact_sha256&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`SHA-256`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.artifact_sha256})})})]})]})]})]})}function K(){let e=h();return e?{Authorization:`Bearer ${e}`}:{}}async function Ae(e){let t=await e.text(),n=null;if(t)try{n=JSON.parse(t)}catch{n=t}if(!e.ok){let t=m(n,e.statusText,e.status);throw Error(t||`HTTP ${e.status}`)}return n}function je(e){return i(`controller.artifact.manifest`,{},e)}function Me(e,t){return i(`controller.artifact.list`,e?{kind:e}:{},t)}function Ne(e,t){return i(`controller.artifact.fetch`,e,t)}function Pe(e,t){return i(`controller.artifact.capture`,e,t)}function Fe(e,t){return i(`controller.update.firmware`,e,t)}function Ie(e,t){return i(`controller.restore.flash`,e,t)}function Le(e,t){return i(`controller.update.eeprom`,e,t)}function Re(e,t){return i(`controller.update.host`,e,t)}function ze(e){return i(`controller.bridge.list`,{},e)}var Be=`pccontroller.peer-update.intent.`,q=new Map,J;function Y(e,t){try{sessionStorage!==J&&(q.clear(),J=sessionStorage)}catch{}return`${Be}${encodeURIComponent(e.trim().toLowerCase())}.${t}`}function X(e){let t=new Uint8Array(16);globalThis.crypto.getRandomValues(t);let n=Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``);return`peer-host-${e.slice(0,12)}-${n}`}function Z(e,t){if(!e.trim())throw Error(`Peer host update requires a peer`);let n=t.trim().toLowerCase();if(!/^[0-9a-f]{64}$/.test(n))throw Error(`Peer host update requires an exact SHA-256 digest`);let r=Y(e,n),i=q.get(r);if(i)return i;try{let e=sessionStorage.getItem(r)?.trim()??``;if(/^[A-Za-z0-9._:-]{1,128}$/.test(e))return q.set(r,e),e}catch{}let a=X(n);q.set(r,a);try{sessionStorage.setItem(r,a)}catch{}return a}function Q(e,t,n){let r=Y(e,t.trim().toLowerCase());q.get(r)===n&&q.delete(r);try{sessionStorage.getItem(r)===n&&sessionStorage.removeItem(r)}catch{}}function Ve(e,t,n){let r=t.trim().toLowerCase(),i=n.trim();if(!e.trim()||!/^[0-9a-f]{64}$/.test(r)||!/^[A-Za-z0-9._:-]{1,128}$/.test(i))return!1;q.set(Y(e,r),i);try{return sessionStorage.setItem(Y(e,r),i),!0}catch{return!0}}function He(e,t,n){Q(e,t,n.trim())}async function Ue(t,n,r){let a=n.trim().toLowerCase(),o=Z(t,a);try{let e=await i(`controller.peer.update.host`,{peer:t,artifact_sha256:a,authorized:!0,idempotency_key:o},r);return Q(t,a,o),e}catch(n){throw n instanceof e&&n.code!==-32004&&Q(t,a,o),n}}async function We(e,t,n,r,i){let o=new URL(a(`/api/artifacts/upload`),location.href);o.searchParams.set(`kind`,t),o.searchParams.set(`name`,e.name),o.searchParams.set(`sha256`,n),o.searchParams.set(`bytes`,String(e.size));let s=new FormData;return s.set(`artifact`,e,e.name),i&&typeof XMLHttpRequest<`u`?new Promise((t,n)=>{let a=new XMLHttpRequest,c=e.size,l=()=>a.abort();a.open(`POST`,o.toString());for(let[e,t]of Object.entries(K()))a.setRequestHeader(e,t);a.upload.onprogress=e=>{c=e.lengthComputable&&e.total>0?e.total:c,i(e.loaded,c)},a.onerror=()=>n(Error(`Artifact upload transport failed`)),a.onabort=()=>n(new DOMException(`Artifact upload was cancelled`,`AbortError`)),a.onload=()=>{r?.removeEventListener(`abort`,l);let e=null;try{e=a.responseText?JSON.parse(a.responseText):null}catch{e=a.responseText}a.status<200||a.status>=300?n(Error(m(e,a.statusText,a.status))):(i(c,c),t(e))},r?.addEventListener(`abort`,l,{once:!0}),r?.aborted?l():a.send(s)}):Ae(await fetch(o.toString(),{method:`POST`,headers:K(),body:s,signal:r}))}async function Ge(e,t,n){let r=a(`/api/artifacts/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.sha256)}`);if(n&&typeof XMLHttpRequest<`u`){Ke(await new Promise((i,a)=>{let o=new XMLHttpRequest,s=()=>o.abort();o.open(`GET`,r),o.responseType=`blob`;for(let[e,t]of Object.entries(K()))o.setRequestHeader(e,t);o.onprogress=t=>n(t.loaded,t.lengthComputable?t.total:e.bytes),o.onerror=()=>a(Error(`Artifact download transport failed`)),o.onabort=()=>a(new DOMException(`Artifact download was cancelled`,`AbortError`)),o.onload=()=>{t?.removeEventListener(`abort`,s),o.status<200||o.status>=300?a(Error(o.statusText||`HTTP ${o.status}`)):(n(e.bytes,e.bytes),i(o.response))},t?.addEventListener(`abort`,s,{once:!0}),t?.aborted?s():o.send()}),e.name);return}let i=await fetch(r,{headers:K(),signal:t});i.ok||await Ae(i),Ke(await i.blob(),e.name)}function Ke(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.rel=`noopener`,document.body.append(r),r.click(),r.remove(),URL.revokeObjectURL(n)}async function qe(e){let t=await crypto.subtle.digest(`SHA-256`,await e.arrayBuffer());return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function Je(e,t){return!e||!t?`unknown`:e.sha256.toLowerCase()===t.sha256.toLowerCase()?`same`:!e.build_timestamp||!t.build_timestamp||t.build_timestamp===e.build_timestamp?`different`:t.build_timestamp>e.build_timestamp?`newer`:`older`}var Ye=[`firmware`,`eeprom`,`flash-backup`,`host-executable`];function Xe(e){return e?e.slice(0,12).toUpperCase():`—`}function Ze(e){let t=e.metadata;return!et(e)||!t?.operation_id||!t.kind||!t.state?null:{id:t.operation_id,kind:t.kind,state:t.state,stage:t.stage,detail:t.detail??e.text,error_code:t.error_code,progress_known:t.progress_known===`true`,progress_percent:Number(t.progress_percent),started_at:t.started_at,updated_at:t.updated_at,stage_started_at:t.stage_started_at,artifact_sha256:t.sha256,programming_method:t.programming_method,bootloader_outcome:t.bootloader_outcome,isp_fallback_suggested:t.isp_fallback_suggested===`true`,toolchain:t.toolchain_ready?{ready:t.toolchain_ready===`true`,policy:t.toolchain_policy,provider:t.toolchain_provider,version:t.toolchain_version,compatible_sources:t.toolchain_compatible_sources?Number(t.toolchain_compatible_sources):void 0,providers:t.toolchain_providers?t.toolchain_providers.split(`,`).filter(Boolean):void 0}:void 0,bytes_done:t.bytes_done?Number(t.bytes_done):void 0,bytes_total:t.bytes_total?Number(t.bytes_total):void 0}}function $(e,t){return{firmware:[`Board firmware`,`میان‌افزار برد`],eeprom:[`Board EEPROM`,`EEPROM برد`],"flash-backup":[`Flash readback`,`بازخوانی فلش`],"host-executable":[`Host executable`,`فایل اجرایی میزبان`]}[e]?.[+(t===`fa`)]??e}function Qe(e,t){return t(e.operation),e.artifact}function $e(e,t){return t===`host-executable`||e}function et(e){return e.kind.startsWith(`update.`)&&e.source!==`bridge`&&!e.metadata?.[`bridge.ingress`]}function tt(e){let t=e.kind.trim().toLowerCase();if(!t.startsWith(`peer-update.`))return null;let n=e.metadata?.peer?.trim()??``,r=(e.metadata?.state??t.slice(12)).trim().toLowerCase();if(!n||!r)return null;let i=Number(e.metadata?.progress_percent);return{peer:n,state:r,operationID:e.metadata?.remote_operation_id?.trim()||e.metadata?.operation_id?.trim()||`—`,progressPercent:Number.isFinite(i)?Math.min(100,Math.max(0,i)):0,progressKnown:e.metadata?.progress_known===`true`&&Number.isFinite(i),bytesDone:e.metadata?.bytes_done?Number(e.metadata.bytes_done):void 0,bytesTotal:e.metadata?.bytes_total?Number(e.metadata.bytes_total):void 0,detail:e.text,artifactSHA256:e.metadata?.sha256?.trim().toLowerCase()??``,idempotencyKey:e.metadata?.idempotency_key?.trim()??``,retrySameIntent:e.metadata?.retry_same_idempotency_key===`true`,terminalVerified:e.metadata?.terminal_verified===`true`}}function nt({appTitle:e,snapshot:n,events:i,locale:a,openDialog:s}){let d=(e,t)=>a===`fa`?t:e,[m,ee]=(0,L.useState)(null),[h,ie]=(0,L.useState)([]),[y,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(null),[w,me]=(0,L.useState)([]),[T,E]=(0,L.useState)(null),[D,k]=(0,L.useState)(``),[j,N]=(0,L.useState)(``),[_e,P]=(0,L.useState)(``),[F,ye]=(0,L.useState)(`firmware`),[R,be]=(0,L.useState)(null),[z,xe]=(0,L.useState)(``),[B,Se]=(0,L.useState)(!1),[Ce,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(``),[H,W]=(0,L.useState)(``),[G,Oe]=(0,L.useState)(``),[K,Ae]=(0,L.useState)(``),Be=(0,L.useRef)(null),q=(0,L.useCallback)(async()=>{k(e=>e||`refresh`);try{let[e,t,n]=await Promise.all([je(),Me(),ze()]);ee(e),ie(t.artifacts),C(e.update??null),me(n),P(``),x(n=>n&&t.artifacts.some(e=>e.sha256===n)?n:e.defaults.firmware?.sha256??t.artifacts[0]?.sha256??``)}catch(e){ee(null),ie([]),me([]),P(e instanceof Error?e.message:String(e))}finally{k(e=>e===`refresh`?``:e)}},[]);(0,L.useEffect)(()=>{q()},[q]);let J=(0,L.useMemo)(()=>i.find(et),[i]),Y=(0,L.useMemo)(()=>i.map(tt).find(e=>e!==null)??null,[i]);(0,L.useEffect)(()=>{Y?.idempotencyKey&&Y.artifactSHA256&&(Y.state===`outcome-uncertain`&&Y.retrySameIntent?Ve(Y.peer,Y.artifactSHA256,Y.idempotencyKey):(Y.state===`failed`||Y.state===`completed`)&&He(Y.peer,Y.artifactSHA256,Y.idempotencyKey))},[Y]);let X=Y??(T?{peer:T.peer,state:T.stage,operationID:T.operation.id,progressPercent:T.operation.progress_percent,progressKnown:T.operation.progress_known===!0,bytesDone:T.operation.bytes_done,bytesTotal:T.operation.bytes_total,detail:T.operation.detail??``,artifactSHA256:T.artifact.sha256,idempotencyKey:T.operation.idempotency_key??``,retrySameIntent:!1,terminalVerified:T.terminal_verified}:null);(0,L.useEffect)(()=>{if(!J)return;let e=Ze(J);e&&(C(t=>t?.updated_at&&e.updated_at&&Date.parse(t.updated_at)>Date.parse(e.updated_at)?t:e),U(e)||q())},[J?.id,J?.time]);let Z=h.find(e=>e.sha256===y),Q=Je(Z?.kind===`host-executable`?m?.current.host:Z?.kind===`eeprom`?m?.current.eeprom:Z?.kind===`flash-backup`?m?.current.flash_readback:m?.current.firmware,Z),Ke=S?.isp_fallback_suggested===!0,nt=async e=>{if(be(e),xe(``),N(``),e){Se(!0);try{xe(await qe(e))}catch(e){N(`${d(`Could not hash selection`,`محاسبهٔ هش فایل انتخابی ممکن نشد`)}: ${e instanceof Error?e.message:String(e)}`)}finally{Se(!1)}}},rt=e=>{nt(e.currentTarget.files?.[0]??null)},it=e=>{e.preventDefault(),we(!1),nt(e.dataTransfer.files?.[0]??null)},at=async()=>{if(!R||!z)return;k(`upload`);let e=`browser-upload-${z.slice(0,16)}`,t=new Date().toISOString(),n=0,r=R.size;try{let i=Qe(await We(R,F,z,void 0,(i,a)=>{n=i,r=a;let o=a>0?Math.max(0,Math.min(100,Math.round(i*100/a))):0,s={id:e,kind:`artifact-upload`,state:`uploading`,stage:`uploading`,progress_known:a>0,progress_percent:o,bytes_done:i,bytes_total:a,detail:d(`Sending selected artifact to this host`,`ارسال فایل انتخاب‌شده به این میزبان`),started_at:t,updated_at:new Date().toISOString()};C(s),window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:s}))}),C);window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:e,kind:`artifact-upload`,state:`completed`,stage:`completed`,progress_known:r>0,progress_percent:100,bytes_done:r,bytes_total:r,detail:d(`Artifact upload completed and was verified`,`ارسال فایل کامل و تأیید شد`),started_at:t,updated_at:new Date().toISOString()}})),N(d(`${R.name} was verified and staged. Nothing has been programmed.`,`${R.name} تأیید و آماده شد. هیچ چیزی پروگرام نشده است.`)),await q(),i&&x(i.sha256)}catch(i){let a=i instanceof Error?i.message:String(i);window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:e,kind:`artifact-upload`,state:`failed`,stage:`uploading`,progress_known:r>0,progress_percent:r>0?Math.max(0,Math.min(100,Math.round(n*100/r))):0,bytes_done:n,bytes_total:r,detail:a,started_at:t,updated_at:new Date().toISOString()}})),N(a)}finally{k(``)}},ot=async e=>{e.preventDefault();let t=G.trim().toLowerCase();if(t&&!/^[0-9a-f]{64}$/.test(t))N(d(`Expected SHA-256 must contain exactly 64 hexadecimal characters.`,`مقدار مورد انتظار SHA-256 باید دقیقاً ۶۴ نویسهٔ شانزده‌شانزدهی داشته باشد.`));else{k(`remote`);try{let e=Qe(await Ne({url:Te.trim(),kind:F,...H.trim()?{name:H.trim()}:{},...t?{sha256:t}:{},...K?{bearer_token:K}:{}}),C);N(d(`Remote content was downloaded, checked and staged. Nothing has been programmed.`,`محتوای راه‌دور دانلود، بررسی و آماده شد. هیچ چیزی پروگرام نشده است.`)),Ae(``),await q(),e&&x(e.sha256)}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(``)}}},st=(e,t=`urclock`)=>{let r=e.kind!==`host-executable`;if(!$e(n.connected,e.kind)){N(d(`Connect the controller before starting a board update.`,`پیش از آغاز به‌روزرسانی برد، کنترلر را متصل کنید.`));return}let i=e.kind===`host-executable`?d(`replace the host application`,`برنامهٔ میزبان را جایگزین می‌کند`):e.kind===`eeprom`?d(`restore MCU EEPROM`,`EEPROM ریزکنترل‌گر را بازیابی می‌کند`):e.kind===`flash-backup`?d(`restore the captured flash image`,`تصویر ثبت‌شدهٔ فلش را بازیابی می‌کند`):d(`program board firmware`,`میان‌افزار برد را پروگرام می‌کند`);s({tone:`danger`,title:e.kind===`flash-backup`?d(`Authorize guarded flash restore?`,`بازیابی محافظت‌شدهٔ فلش مجاز شود؟`):d(`Authorize ${$(e.kind,a).toLowerCase()} update?`,`به‌روزرسانی ${$(e.kind,a)} مجاز شود؟`),body:`${e.name}\nSHA-256 ${e.sha256}\n\n${d(`This is the authorization step. Selection and staging did not write hardware.`,`این مرحلهٔ صدور مجوز است. انتخاب و آماده‌سازی چیزی روی سخت‌افزار ننوشته‌اند.`)} ${r?d(`The primary host will make the board safe, back up flash and EEPROM, then ${i}, verify readback, and restore lifecycle settings.`,`میزبان اصلی ابتدا برد را در وضعیت امن قرار می‌دهد، از فلش و EEPROM پشتیبان می‌گیرد، سپس ${i}، بازخوانی را تأیید و تنظیمات چرخهٔ کار را بازیابی می‌کند.`):d(`The primary host will verify the package, prepare a recoverable replacement, and ${i} only after the current process exits cleanly.`,`میزبان اصلی بسته را تأیید و جایگزینی قابل‌بازیابی آماده می‌کند و فقط پس از خروج پاک فرایند فعلی، ${i}.`)}`,confirmLabel:t===`usbasp`?d(`Authorize ISP programming`,`اجازهٔ پروگرام ISP`):d(`Authorize verified update`,`اجازهٔ به‌روزرسانی تأییدشده`),action:async()=>{k(`update`);try{let r={artifact_sha256:e.sha256,authorized:!0,method:t,...n.port.name?{port:n.port.name}:{}};Qe(e.kind===`host-executable`?await Re(r):e.kind===`eeprom`?await Le(r):e.kind===`flash-backup`?await Ie(r):await Fe(r),C),N(d(`${e.name} entered the guarded ${e.kind===`flash-backup`?`restore`:`update`} queue.`,`${e.name} وارد صف محافظت‌شدهٔ ${e.kind===`flash-backup`?`بازیابی`:`به‌روزرسانی`} شد.`))}catch(e){throw N(e instanceof Error?e.message:String(e)),e}finally{k(``)}}})},ct=(e,t)=>{!e.connected||!e.allow_commands?N(d(`Peer ${e.name} is not connected for commands.`,`همتای ${e.name} برای فرمان‌ها متصل نیست.`)):s({tone:`danger`,title:d(`Upgrade ${e.name}?`,`به‌روزرسانی ${e.name}؟`),body:`${t.name}\nSHA-256 ${t.sha256}\n\n${d(`The primary instance will transfer the verified executable over its configured bridge, ask the remote coordinator to perform its journaled replacement, wait through restart, and verify the peer acknowledges this exact active SHA.`,`نمونهٔ اصلی فایل اجرایی تأییدشده را از پل معتبر منتقل می‌کند، از هماهنگ‌کنندهٔ راه‌دور می‌خواهد جایگزینی ثبت‌شده را انجام دهد، در طول راه‌اندازی مجدد منتظر می‌ماند و تأیید می‌کند که همتا همین SHA فعال دقیق را اعلام می‌کند.`)}`,confirmLabel:d(`Authorize peer upgrade`,`اجازهٔ به‌روزرسانی همتا`),action:async()=>{k(`peer-update`);try{let n=await Ue(e.name,t.sha256);E(n),N(d(`${e.name} restarted and acknowledged ${n.artifact.sha256.slice(0,12)} as its active host executable.`,`${e.name} دوباره راه‌اندازی شد و ${n.artifact.sha256.slice(0,12)} را به‌عنوان فایل اجرایی فعال میزبان تأیید کرد.`))}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(``)}}})},lt=(e=`urclock`)=>{n.connected?s({title:d(`Capture current flash and EEPROM?`,`فلش و EEPROM فعلی ثبت شوند؟`),body:`${d(`The primary host will briefly take ownership of the programming path, read both memories, verify their exact byte counts, and store content-addressed backups. Existing identical images are not duplicated.`,`میزبان اصلی برای مدتی کوتاه مسیر پروگرام را در اختیار می‌گیرد، هر دو حافظه را می‌خواند، شمار دقیق بایت‌ها را تأیید و پشتیبان‌های محتوامحور ذخیره می‌کند. تصاویر یکسان موجود دوباره کپی نمی‌شوند.`)}${e===`usbasp`?`\n\n${d(`ISP access is being used because the bootloader probe failed.`,`به‌دلیل ناموفق بودن بررسی بوت‌لودر، از دسترسی ISP استفاده می‌شود.`)}`:``}`,confirmLabel:e===`usbasp`?d(`Authorize ISP capture`,`اجازهٔ ثبت با ISP`):d(`Authorize readback`,`اجازهٔ بازخوانی`),action:async()=>{k(`capture`);try{Qe(await Pe({components:[`flash`,`eeprom`],authorized:!0,method:e}),C),N(d(`Flash and EEPROM capture entered the guarded queue.`,`ثبت فلش و EEPROM وارد صف محافظت‌شده شد.`))}catch(e){throw N(e instanceof Error?e.message:String(e)),e}finally{k(``)}}}):N(d(`Connect the controller before capturing its memories.`,`پیش از ثبت حافظه‌ها، کنترلر را متصل کنید.`))},ut=async e=>{let t=`browser-download-${e.sha256.slice(0,16)}`,n=new Date().toISOString(),r=0,i=e.bytes,a=(e,a,o,s)=>{r=a,i=o;let c=o>0?Math.max(0,Math.min(100,Math.round(a*100/o))):0;window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:t,kind:`artifact-fetch`,state:e,stage:e===`completed`?`completed`:`downloading`,progress_known:o>0,progress_percent:c,bytes_done:a,bytes_total:o,detail:s,started_at:n,updated_at:new Date().toISOString()}}))};try{await Ge(e,void 0,(e,t)=>a(`downloading`,e,t,d(`Downloading verified artifact to this browser`,`دریافت فایل تأییدشده در این مرورگر`))),a(`completed`,e.bytes,e.bytes,d(`Artifact download completed`,`دریافت فایل کامل شد`))}catch(e){let t=e instanceof Error?e.message:String(e);a(`failed`,r,i,t),N(t)}};return _e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{eyebrow:d(`Verified host updates`,`به‌روزرسانی تأییدشدهٔ میزبان`),title:d(`Firmware & updates`,`میان‌افزار و به‌روزرسانی`),detail:d(`Remote update is performed by the primary host over the board programming link; it is not MCU-native OTA.`,`به‌روزرسانی راه‌دور توسط میزبان اصلی و از مسیر پروگرام برد انجام می‌شود؛ این فرایند OTA بومی ریزکنترل‌گر نیست.`)}),(0,V.jsxs)(l,{icon:I,iconTone:`red`,title:d(`Artifact service`,`سرویس خروجی‌های ساخت`),eyebrow:d(`Unavailable`,`دردسترس نیست`),className:`updates-unavailable`,children:[(0,V.jsx)(u,{icon:I,title:d(`Artifact service unavailable`,`سرویس خروجی‌های ساخت در دسترس نیست`),detail:_e}),(0,V.jsx)(r,{icon:le,onClick:()=>void q(),children:d(`Retry typed service`,`تلاش دوباره برای سرویس`)})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{eyebrow:d(`Verified host updates`,`به‌روزرسانی تأییدشدهٔ میزبان`),title:d(`Firmware & updates`,`میان‌افزار و به‌روزرسانی`)}),S&&(0,V.jsx)(ke,{status:S,locale:a}),j&&(0,V.jsxs)(`div`,{className:`update-notice${/failed|error|could not|expected/i.test(j)?` is-error`:``}`,children:[(0,V.jsx)(de,{size:17}),(0,V.jsx)(`span`,{children:j})]}),(0,V.jsxs)(`section`,{className:`updates-grid`,children:[(0,V.jsxs)(l,{icon:M,iconTone:`violet`,title:d(`Stage a local artifact`,`آماده‌سازی خروجی محلی`),eyebrow:d(`Select · hash · stage`,`انتخاب · هش · آماده‌سازی`),className:`update-source-card`,action:(0,V.jsx)(g,{tone:R&&z?`good`:`neutral`,children:R?B?d(`HASHING`,`در حال هش`):d(`SELECTED`,`انتخاب‌شده`):d(`NO FILE`,`بدون فایل`)}),children:[(0,V.jsx)(`div`,{className:`artifact-kind-picker`,role:`radiogroup`,"aria-label":d(`Artifact kind`,`نوع خروجی`),children:Ye.map(e=>(0,V.jsxs)(`button`,{role:`radio`,"aria-checked":F===e,className:F===e?`is-active`:``,onClick:()=>ye(e),children:[e===`firmware`?(0,V.jsx)(A,{}):e===`eeprom`?(0,V.jsx)(se,{}):e===`host-executable`?(0,V.jsx)(o,{}):(0,V.jsx)(O,{}),(0,V.jsx)(`span`,{children:$(e,a)})]},e))}),(0,V.jsx)(`input`,{ref:Be,className:`visually-hidden`,type:`file`,accept:`.hex,.eep,.bin,.exe,application/octet-stream,text/plain`,onChange:rt}),(0,V.jsxs)(`button`,{className:`artifact-drop${Ce?` is-dragging`:``}`,type:`button`,onClick:()=>Be.current?.click(),onDragEnter:e=>{e.preventDefault(),we(!0)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`},onDragLeave:()=>we(!1),onDrop:it,children:[B?(0,V.jsx)(re,{className:`spin`}):(0,V.jsx)(M,{}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`strong`,{children:R?.name||d(`Browse for firmware, EEPROM, or readback`,`انتخاب میان‌افزار، EEPROM یا بازخوانی`)}),(0,V.jsx)(`span`,{children:R?`${_(R.size)} · SHA-256 ${Xe(z)}`:d(`The browser calculates SHA-256 locally before the host receives anything.`,`مرورگر پیش از دریافت هر چیزی توسط میزبان، SHA-256 را به‌صورت محلی محاسبه می‌کند.`)})]}),(0,V.jsx)(`span`,{children:d(`Choose file`,`انتخاب فایل`)})]}),(0,V.jsx)(r,{tone:`primary`,icon:ge,busy:D===`upload`,disabled:!R||!z||B,onClick:()=>void at(),children:d(`Verify and stage only`,`فقط تأیید و آماده‌سازی`)})]}),(0,V.jsx)(l,{icon:he,iconTone:`accent`,title:d(`Stage from a remote source`,`آماده‌سازی از منبع راه‌دور`),eyebrow:d(`HTTPS or trusted peer`,`HTTPS یا همتای مورد اعتماد`),className:`update-source-card`,children:(0,V.jsxs)(`form`,{className:`remote-artifact-form`,onSubmit:e=>void ot(e),children:[(0,V.jsx)(v,{label:d(`Source URL`,`نشانی منبع`),type:`url`,dir:`ltr`,value:Te,placeholder:`https://host.example/artifacts/firmware/…`,onChange:e=>Ee(e.target.value),hint:d(`The host respects configured proxy environment variables, validates redirects, size, and digest, then stages without programming.`,`میزبان تنظیمات پراکسی محیط را رعایت می‌کند، تغییرمسیرها، اندازه و چکیده را می‌سنجد و سپس بدون پروگرام فایل را آماده می‌کند.`)}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:d(`Display name (optional)`,`نام نمایشی (اختیاری)`),value:H,onChange:e=>W(e.target.value)}),(0,V.jsx)(v,{label:d(`Expected SHA-256 (recommended)`,`SHA-256 مورد انتظار (پیشنهادی)`),dir:`ltr`,value:G,maxLength:64,onChange:e=>Oe(e.target.value.replace(/[^0-9a-f]/gi,``).toLowerCase())})]}),(0,V.jsx)(v,{label:d(`Peer bearer token (optional)`,`توکن حامل همتا (اختیاری)`),type:`password`,autoComplete:`off`,dir:`ltr`,value:K,onChange:e=>Ae(e.target.value),hint:d(`Used once by the primary host for this peer download; it is not persisted or printed.`,`فقط یک‌بار توسط میزبان اصلی برای دانلود معتبر از همتا استفاده می‌شود و ذخیره یا چاپ نخواهد شد.`)}),(0,V.jsx)(r,{type:`submit`,tone:`primary`,icon:he,busy:D===`remote`,disabled:!Te.trim(),children:d(`Download, verify and stage`,`دانلود، تأیید و آماده‌سازی`)})]})}),(0,V.jsx)(De,{manifest:m,events:i,locale:a,openDialog:s,onArtifactsChanged:()=>void q()}),(0,V.jsxs)(l,{icon:I,iconTone:`accent`,title:d(`Update a configured peer`,`به‌روزرسانی همتای معتبر`),eyebrow:d(`Bridge-native · verified · coordinated`,`پل بومی · تأییدشده · هماهنگ`),action:(0,V.jsxs)(g,{tone:w.some(e=>e.connected)?`good`:`warn`,children:[w.filter(e=>e.connected).length,` `,d(`CONNECTED`,`متصل`)]}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`Transfer the selected verified host executable over the configured bridge, perform the peer’s recoverable replacement, and wait for restart health plus an exact active-SHA acknowledgement. No SSH command or shared filesystem is used.`,`فایل اجرایی تأییدشدهٔ میزبان را از پل پیکربندی‌شده منتقل می‌کند، جایگزینی قابل‌بازیابی همتا را انجام می‌دهد و تا سلامت راه‌اندازی مجدد و تأیید دقیق SHA فعال منتظر می‌ماند. هیچ فرمان SSH یا فایل مشترکی استفاده نمی‌شود.`)}),X&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Shared peer progress · ${X.peer}`,`پیشرفت مشترک همتا · ${X.peer}`),value:X.state===`completed`?d(`Restarted and active SHA verified`,`راه‌اندازی مجدد و SHA فعال تأیید شد`):X.state===`remote-staged`?d(`Remote staged`,`آماده‌شده در راه‌دور`):X.state===`remote-queued`?d(`Remote queued`,`در صف راه‌دور`):X.state===`outcome-uncertain`?d(`Outcome uncertain — retry this update`,`نتیجه نامشخص است — همین به‌روزرسانی را دوباره امتحان کنید`):X.state===`failed`?d(`Peer attempt failed`,`تلاش همتا ناموفق بود`):X.progressKnown?`${X.state.replaceAll(`-`,` `)} · ${Math.round(X.progressPercent)}%`:X.state.replaceAll(`-`,` `),tone:X.state===`completed`&&X.terminalVerified?`good`:X.state===`failed`?`bad`:`warn`}),(0,V.jsx)(c,{label:d(`Transferred`,`انتقال داده`),value:X.bytesTotal?te(X.bytesDone??0,X.bytesTotal):d(`Not measured for this stage`,`برای این مرحله اندازه‌گیری نشده`),mono:!0}),(0,V.jsx)(c,{label:d(`Peer operation`,`عملیات همتا`),value:X.operationID,mono:!0}),(0,V.jsx)(c,{label:d(`Terminal replacement`,`جایگزینی نهایی`),value:X.terminalVerified?d(`Acknowledged · active SHA matches`,`تأیید شد · SHA فعال مطابقت دارد`):d(`Waiting for health, reconnect & active SHA`,`در انتظار سلامت، اتصال دوباره و SHA فعال`),tone:X.terminalVerified?`good`:`warn`})]}),(0,V.jsx)(`div`,{className:`update-progress${X.progressKnown?``:` is-indeterminate`}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":X.progressKnown?X.progressPercent:void 0,"aria-valuetext":X.bytesTotal?te(X.bytesDone??0,X.bytesTotal):X.detail,children:(0,V.jsx)(`i`,{style:X.progressKnown?{width:`${X.progressPercent}%`}:void 0})})]}),w.length?(0,V.jsx)(`div`,{className:`data-list`,children:w.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(c,{label:e.name,value:e.connected?d(`Connected`,`متصل`):e.last_error||d(`Disconnected`,`قطع`),tone:e.connected?`good`:`bad`}),(0,V.jsx)(`div`,{className:`inline-actions`,children:(0,V.jsx)(r,{icon:ce,tone:`primary`,disabled:!e.connected||!e.allow_commands||Z?.kind!==`host-executable`||D===`peer-update`,busy:D===`peer-update`,onClick:()=>Z&&void ct(e,Z),children:d(`Review peer host update`,`بازبینی به‌روزرسانی میزبان همتا`)})})]},e.name))}):(0,V.jsx)(u,{icon:I,title:d(`No bridge peers configured`,`هیچ همتای پلی پیکربندی نشده`),detail:d(`Add a peer in integration settings; connected peers appear here immediately.`,`یک همتای معتبر را در تنظیمات یکپارچه‌سازی بیفزایید؛ همتایان متصل فوراً اینجا ظاهر می‌شوند.`)})]}),(0,V.jsxs)(l,{icon:pe,iconTone:`green`,title:d(`Embedded first-board recovery`,`بازیابی تعبیه‌شدهٔ نخستین برد`),eyebrow:d(`Verified build defaults`,`پیش‌فرض‌های تأییدشدهٔ ساخت`),action:(0,V.jsx)(g,{tone:m?.defaults_enabled?`good`:`warn`,children:m?.defaults_enabled?d(`AVAILABLE`,`موجود`):d(`NOT PACKAGED`,`بسته‌بندی نشده`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`Enabled automatically only when the release contains both a real firmware image and a generated valid default EEPROM image. It is never auto-flashed—even a non-responsive, corrupt, or older board still requires your grant.`,`فقط وقتی خودکار فعال می‌شود که انتشار هم تصویر واقعی میان‌افزار و هم تصویر معتبرِ تولیدشده برای EEPROM پیش‌فرض داشته باشد. هرگز خودکار فلش نمی‌شود؛ حتی برد پاسخ‌گو‌نبود‌ه، خراب یا قدیمی نیز به اجازهٔ شما نیاز دارد.`)}),(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Firmware`,`میان‌افزار`),value:m?.defaults.firmware?`${Xe(m.defaults.firmware.sha256)} · ${_(m.defaults.firmware.bytes)}`:d(`Missing from this host`,`در این میزبان موجود نیست`),mono:!0}),(0,V.jsx)(c,{label:d(`Default EEPROM`,`EEPROM پیش‌فرض`),value:m?.defaults.eeprom?`${Xe(m.defaults.eeprom.sha256)} · ${_(m.defaults.eeprom.bytes)}`:d(`Missing; empty .eep is never accepted`,`موجود نیست؛ فایل خالی .eep پذیرفته نمی‌شود`),mono:!0})]}),n.connected&&(0,V.jsxs)(`div`,{className:`inline-actions`,children:[(0,V.jsx)(r,{icon:o,tone:`primary`,disabled:!m?.defaults.firmware||D===`update`,onClick:()=>m?.defaults.firmware&&st(m.defaults.firmware),children:d(`Review firmware programming`,`بازبینی پروگرام میان‌افزار`)}),(0,V.jsx)(r,{icon:pe,disabled:!m?.defaults.eeprom||D===`update`,onClick:()=>m?.defaults.eeprom&&st(m.defaults.eeprom),children:d(`Review EEPROM restore`,`بازبینی بازیابی EEPROM`)})]})]}),n.connected&&(0,V.jsxs)(l,{icon:b,iconTone:`amber`,title:d(`Capture this connected board`,`ثبت برد متصل`),eyebrow:d(`Flash + EEPROM · deduplicated`,`فلش + EEPROM · بدون تکرار`),action:(0,V.jsx)(g,{tone:`good`,children:n.port.name||d(`CONNECTED`,`متصل`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`A readback is stored by content hash. Identical firmware is referenced, not copied, and the resulting flash/EEPROM artifacts can be served to configured peers or downloaded below.`,`بازخوانی بر پایهٔ هش محتوا ذخیره می‌شود. به میان‌افزار یکسان ارجاع داده می‌شود و دوباره کپی نمی‌گردد؛ خروجی فلش/EEPROM را می‌توان در اختیار همتاهای معتبر گذاشت یا از پایین دانلود کرد.`)}),(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Current board`,`برد فعلی`),value:n.hello.name||e}),(0,V.jsx)(c,{label:d(`Running build`,`ساخت در حال اجرا`),value:n.hello.build_hash?n.hello.build_hash.toString(16).toUpperCase().padStart(8,`0`):`—`,mono:!0}),(0,V.jsx)(c,{label:d(`Port owner`,`مالک درگاه`),value:n.port.name||d(`automatic`,`خودکار`),mono:!0})]}),(0,V.jsx)(r,{icon:b,busy:D===`capture`,onClick:()=>lt(),children:d(`Review flash + EEPROM capture`,`بازبینی ثبت فلش + EEPROM`)})]}),n.connected&&Ke&&(0,V.jsxs)(l,{icon:f,iconTone:`red`,title:d(`Bootloader probe failed`,`بررسی بوت‌لودر ناموفق بود`),eyebrow:d(`ISP fallback recommended`,`مسیر جایگزین ISP پیشنهاد می‌شود`),className:`isp-fallback-card`,action:(0,V.jsx)(g,{tone:`bad`,children:d(`NO BOOTLOADER ROUTE`,`بدون مسیر بوت‌لودر`)}),children:[(0,V.jsxs)(`div`,{className:`isp-guidance`,children:[(0,V.jsx)(f,{}),(0,V.jsx)(`p`,{children:d(`The host could not enter Urboot/Urclock. Connect a supported ISP programmer; the same primary host will back up what it can, program through ISP, verify the image, and restore the application lifecycle. ISP was not suggested before this failed probe.`,`میزبان نتوانست وارد Urboot/Urclock شود. یک پروگرامر ISP پشتیبانی‌شده متصل کنید؛ همان میزبان اصلی از بخش‌های ممکن پشتیبان می‌گیرد، از طریق ISP پروگرام می‌کند، تصویر را تأیید و چرخهٔ کار برنامه را بازیابی می‌کند. پیش از این بررسی ناموفق، ISP پیشنهاد نشده بود.`)})]}),(0,V.jsxs)(`div`,{className:`inline-actions`,children:[(0,V.jsx)(r,{tone:`danger`,icon:ue,disabled:!Z||Z.kind===`host-executable`,onClick:()=>Z&&st(Z,`usbasp`),children:d(`Review ISP programming`,`بازبینی پروگرام ISP`)}),(0,V.jsx)(r,{icon:oe,onClick:()=>lt(`usbasp`),children:d(`Review ISP capture`,`بازبینی ثبت با ISP`)})]})]}),(0,V.jsxs)(l,{icon:O,iconTone:`violet`,title:d(`Verified artifact inventory`,`فهرست خروجی‌های تأییدشده`),eyebrow:d(`${h.length} content-addressed artifacts`,`${h.length} خروجی محتوامحور`),className:`artifact-inventory`,action:(0,V.jsxs)(g,{tone:`info`,children:[h.length,` `,d(`UNIQUE`,`یکتا`)]}),children:[h.length?(0,V.jsx)(`div`,{className:`artifact-table-wrap`,children:(0,V.jsxs)(`table`,{className:`artifact-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{"aria-label":d(`Select`,`انتخاب`)}),(0,V.jsx)(`th`,{children:d(`Artifact`,`خروجی`)}),(0,V.jsx)(`th`,{children:d(`Source`,`منبع`)}),(0,V.jsx)(`th`,{children:d(`Build / digest`,`ساخت / چکیده`)}),(0,V.jsx)(`th`,{children:d(`Size`,`اندازه`)}),(0,V.jsx)(`th`,{children:d(`Created`,`ایجاد`)}),(0,V.jsx)(`th`,{children:d(`Actions`,`عملیات`)})]})}),(0,V.jsx)(`tbody`,{children:h.map(e=>{let t=y===e.sha256,n=e.metadata,i=n?.repository||(n?.workflow_run_id?`${d(`run`,`اجرا`)} ${n.workflow_run_id}`:n?.release_id?`${d(`release`,`انتشار`)} ${n.release_id}`:``);return(0,V.jsxs)(`tr`,{className:t?`is-selected`:``,children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`input`,{type:`radio`,name:`artifact`,checked:t,"aria-label":d(`Select ${e.name}`,`انتخاب ${e.name}`),onChange:()=>x(e.sha256)})}),(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsxs)(`span`,{children:[$(e.kind,a),e.embedded?d(` · embedded`,` · تعبیه‌شده`):``,e.current?d(` · current`,` · فعلی`):``]})]}),(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`strong`,{children:n?.provider||e.source}),i&&(0,V.jsx)(`span`,{children:i})]}),(0,V.jsxs)(`td`,{className:`mono`,children:[(0,V.jsx)(`strong`,{children:e.build_hash||Xe(e.sha256)}),(0,V.jsx)(`span`,{children:e.build_timestamp||e.sha256})]}),(0,V.jsx)(`td`,{className:`mono`,children:_(e.bytes)}),(0,V.jsx)(`td`,{children:ne(a,e.created_at)}),(0,V.jsx)(`td`,{children:(0,V.jsx)(r,{compact:!0,icon:fe,onClick:()=>void ut(e),children:d(`Download`,`دانلود`)})})]},`${e.kind}-${e.sha256}`)})})]})}):(0,V.jsx)(u,{icon:O,title:d(`No verified artifacts yet`,`هنوز خروجی تأییدشده‌ای وجود ندارد`),detail:d(`Stage a local or remote image, or capture the connected board.`,`یک تصویر محلی یا راه‌دور آماده کنید یا از برد متصل نسخه بگیرید.`)}),Z&&(0,V.jsxs)(`div`,{className:`artifact-selection`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{children:[d(`SELECTED`,`انتخاب‌شده`),` / `,$(Z.kind,a).toUpperCase()]}),(0,V.jsx)(`strong`,{children:Z.name}),(0,V.jsx)(`code`,{children:Z.sha256})]}),(0,V.jsx)(g,{tone:Q===`same`?`good`:Q===`newer`?`info`:Q===`older`?`warn`:`neutral`,children:Q===`same`?d(`SAME`,`یکسان`):Q===`newer`?d(`NEWER`,`جدیدتر`):Q===`older`?d(`OLDER`,`قدیمی‌تر`):d(`UNKNOWN`,`نامشخص`)}),$e(n.connected,Z.kind)&&(0,V.jsx)(r,{icon:Z.kind===`host-executable`?ce:Z.kind===`flash-backup`?pe:t,tone:`primary`,disabled:D===`update`,onClick:()=>st(Z),children:Z.kind===`host-executable`?d(`Review host self-update`,`بازبینی به‌روزرسانی میزبان`):Z.kind===`eeprom`?d(`Review EEPROM restore`,`بازبینی بازیابی EEPROM`):Z.kind===`flash-backup`?d(`Review flash restore`,`بازبینی بازیابی فلش`):d(`Review board programming`,`بازبینی پروگرام برد`)})]})]}),(0,V.jsx)(l,{icon:I,iconTone:`accent`,title:d(`Distribution paths`,`مسیرهای توزیع`),eyebrow:d(`Serve · download · bridge`,`ارائه · دانلود · پل`),className:`update-distribution-card`,children:(0,V.jsxs)(`div`,{className:`distribution-grid`,children:[(0,V.jsxs)(`article`,{children:[(0,V.jsx)(I,{}),(0,V.jsx)(`strong`,{children:d(`Authenticated serving`,`ارائهٔ معتبر`)}),(0,V.jsx)(`p`,{children:d(`Current flash, EEPROM, firmware, host packages and backups are served by exact SHA-256 through HTTP and bridge RPC.`,`فلش فعلی، EEPROM، میان‌افزار، بسته‌های میزبان و پشتیبان‌ها با SHA-256 دقیق از طریق HTTP و RPC پل ارائه می‌شوند.`)})]}),(0,V.jsxs)(`article`,{children:[(0,V.jsx)(ae,{}),(0,V.jsx)(`strong`,{children:d(`Remote synchronization`,`همگام‌سازی راه‌دور`)}),(0,V.jsx)(`p`,{children:d(`Secondary instances request staging and updates through the primary owner; they never race it for the serial port.`,`نمونه‌های ثانویه آماده‌سازی و به‌روزرسانی را از مالک اصلی درخواست می‌کنند و هرگز برای درگاه سریال با آن رقابت ندارند.`)})]}),(0,V.jsxs)(`article`,{children:[(0,V.jsx)(ve,{}),(0,V.jsx)(`strong`,{children:d(`Verified replacement`,`جایگزینی تأییدشده`)}),(0,V.jsx)(`p`,{children:d(`Size, digest, packed date/time and build hash comparisons are visible before any update is authorized.`,`مقایسهٔ اندازه، چکیده، تاریخ/زمان فشرده و هش ساخت پیش از صدور مجوز هر به‌روزرسانی دیده می‌شود.`)})]})]})})]})]})}export{nt as UpdatesView}; \ No newline at end of file +import{D as e,Et as t,It as n,J as r,M as i,N as a,Ot as o,Pt as s,X as c,Y as l,Z as u,dt as d,ht as f,it as p,j as m,jt as ee,k as h,n as te,ot as g,r as _,st as v,x as ne,xt as re,zt as ie}from"./app-DeBWQZ2a.js";import{n as y,r as ae,t as oe}from"./chunk-BcFfnhtq.js";import{i as se,n as ce,r as le,t as ue}from"./chunk-CNKgOZEf.js";import{t as de}from"./chunk-BZ_h0xog.js";import{t as fe}from"./chunk-BVsUkuBT.js";import{t as b}from"./chunk-BndaF2VU.js";import{n as x,t as S}from"./chunk-B6TQ82AF.js";var C={name:`archive-arrow-up`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]],aliases:[`archive-restore`]};C.node;var pe=s(C),w={name:`clock-3`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]};w.node;var me=s(w),T={name:`cloud-download`,size:24,node:[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]],aliases:[`download-cloud`]};T.node;var he=s(T),E={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};E.node;var ge=s(E),D={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};D.node;var O=s(D),k={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};k.node;var A=s(k),j={name:`file-up`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]};j.node;var M=s(j),N={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};N.node;var _e=s(N),P={name:`package-check`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};P.node;var ve=s(P),F={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};F.node;var I=s(F),L=ie(n(),1);function ye(e,t){return i(`controller.discovery.github.workflow`,e,t)}function R(e,t){return i(`controller.discovery.github.release`,e,t)}function be(e,t,n){return i(`controller.discovery.manifest`,{url:e,...t?{bearer_token:t}:{}},n)}function z(e,t,n){return i(`controller.discovery.check`,{current:e??{},kind:t.kind,platform:t.platform??``,candidates:[t]},n)}function xe(e,t,n){let r=`stage:${e.id}:${e.sha256||e.archive_sha256||`unhashed`}`;return i(`controller.discovery.stage`,{candidate:e,idempotency_key:r,...t?{bearer_token:t}:{}},n)}function B(e,t){return i(`controller.discovery.status`,e?{id:e}:{},t)}function Se(){let e=typeof navigator>`u`?void 0:navigator,t=`${e?.userAgent??``} ${e?.platform??``}`.toLowerCase();return`${t.includes(`win`)?`windows`:t.includes(`mac`)?`darwin`:`linux`}/${t.includes(`arm64`)||t.includes(`aarch64`)?`arm64`:`amd64`}`}var V=d(),Ce=[`firmware`,`eeprom`,`flash-backup`,`host-executable`];function we(e,t){if(e=e.trim(),!e)return;let n=Number.parseInt(e.replace(/^0x/i,``),e.toLowerCase().startsWith(`0x`)?16:10);if(!Number.isSafeInteger(n)||n<0||n>4294967295)throw Error(t);return n}function Te(e,t){if(e)return t===`host-executable`?e.current.host:t===`eeprom`?e.current.eeprom:t===`flash-backup`?e.current.flash_readback:e.current.firmware}function Ee(e,t){return e?e.slice(0,12).toUpperCase():t}function De({manifest:e,events:t,locale:n,openDialog:i,onArtifactsChanged:a}){let o=(e,t)=>n===`fa`?t:e,s=e=>({firmware:o(`Board firmware`,`میان‌افزار برد`),eeprom:o(`Board EEPROM`,`EEPROM برد`),"flash-backup":o(`Flash backup`,`پشتیبان فلش`),"host-executable":o(`Host executable`,`فایل اجرایی میزبان`)})[e],[d,f]=(0,L.useState)(`release`),[p,m]=(0,L.useState)(`firmware`),[h,te]=(0,L.useState)(``),[ne,ie]=(0,L.useState)(`main`),[ae,oe]=(0,L.useState)(`Build`),[se,ce]=(0,L.useState)(``),[ue,fe]=(0,L.useState)(``),[b,S]=(0,L.useState)(``),[C,pe]=(0,L.useState)(()=>Se()),[w,me]=(0,L.useState)(``),[T,E]=(0,L.useState)(``),[ge,D]=(0,L.useState)(``),[O,k]=(0,L.useState)(null),[A,j]=(0,L.useState)(``),[M,N]=(0,L.useState)(null),[P,ve]=(0,L.useState)(null),[F,I]=(0,L.useState)(``),[De,H]=(0,L.useState)(``),U=O?.candidates.find(e=>e.id===A),W=(0,L.useMemo)(()=>t.find(e=>e.kind.startsWith(`artifact.discovery.`)),[t]),G=e=>{ve(e),e.state===`failed`?H(e.error||e.detail||o(`Candidate staging failed.`,`آماده‌سازی گزینهٔ انتخابی ناموفق بود.`)):e.state===`completed`&&(E(``),a())};(0,L.useEffect)(()=>{P?.id&&W&&B(P.id).then(G).catch(e=>{H(e instanceof Error?e.message:String(e))})},[W?.id,W?.time]),(0,L.useEffect)(()=>{N(null),U&&z(Te(e,U.kind),U).then(N).catch(e=>{H(e instanceof Error?e.message:String(e))})},[A,e]);let Oe=async e=>{e.preventDefault(),I(`discover`),H(``);try{let e=we(w,o(`Packed timestamp must be a 32-bit decimal or 0x-prefixed hexadecimal value.`,`مهر زمانی فشرده باید یک عدد ده‌دهی ۳۲ بیتی یا مقدار شانزده‌شانزدهی با پیشوند 0x باشد.`)),t=T?{bearer_token:T}:{},n=d===`manifest`?await be(ue.trim(),T):d===`workflow`?await ye({repository:h.trim(),branch:ne.trim(),workflow:ae.trim(),kind:p,platform:p===`host-executable`?C.trim():void 0,api_base_url:b.trim()||void 0,packed_timestamp:e,...t}):await R({repository:h.trim(),tag:se.trim()||void 0,kind:p,platform:p===`host-executable`?C.trim():void 0,api_base_url:b.trim()||void 0,packed_timestamp:e,...t});k(n),j(n.candidates[0]?.id??``),H(o(`${n.candidates.length} verified metadata candidate${n.candidates.length===1?``:`s`} discovered. No file was downloaded.`,`${n.candidates.length} گزینه با فرادادهٔ تأییدشده پیدا شد. هیچ فایلی دانلود نشده است.`))}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(``)}},ke=e=>i({title:o(`Download and stage this candidate?`,`این گزینه دانلود و آماده شود؟`),body:`${e.name}\n${e.repository||e.url}\n${e.archive_sha256||e.sha256||o(`No provider digest; the content-addressed store will still calculate SHA-256.`,`ارائه‌دهنده چکیده‌ای نداده است؛ مخزن محتوامحور همچنان SHA-256 را محاسبه می‌کند.`)}\n\n${o(`This downloads through the primary host, safely selects a ZIP member when needed, verifies all available size/digest metadata, and stages it. It does not open or program the board.`,`فایل از طریق میزبان اصلی دانلود می‌شود، در صورت نیاز عضو مناسب ZIP با ایمنی انتخاب می‌گردد، همهٔ فراداده‌های موجودِ اندازه و چکیده بررسی و سپس آماده می‌شود. این کار برد را باز یا پروگرام نمی‌کند.`)}`,confirmLabel:o(`Download and stage only`,`فقط دانلود و آماده‌سازی`),action:async()=>{I(`stage`);try{let t=await xe(ge.trim()?{...e,archive_path:ge.trim()}:e,T);G(t.operation),H(o(`Verified download queued. Programming still requires a separate update authorization.`,`دانلود تأییدشده در صف قرار گرفت. پروگرام همچنان به مجوز جداگانهٔ به‌روزرسانی نیاز دارد.`))}catch(e){throw H(e instanceof Error?e.message:String(e)),e}finally{I(``)}}});return(0,V.jsxs)(l,{icon:y,iconTone:`violet`,title:o(`Release & workflow discovery`,`کشف انتشار و گردش‌کار`),eyebrow:`${d===`release`?o(`Release`,`انتشار`):d===`workflow`?o(`Workflow`,`گردش‌کار`):o(`Manifest`,`مانیفست`)} · ${o(`proxy aware`,`سازگار با پراکسی`)}`,className:`release-discovery-card`,action:(0,V.jsx)(g,{tone:P?.state===`failed`?`bad`:P?.state===`completed`?`good`:P?`info`:`neutral`,children:P?.state?.toUpperCase()||o(`READY`,`آماده`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:o(`Discover build artifacts without hardcoded product names. Provider metadata, release checksums, hashes, packed timestamps and platform are preserved into the content-addressed inventory.`,`خروجی‌های ساخت بدون نام محصولِ ثابت کشف می‌شوند. فرادادهٔ ارائه‌دهنده، چک‌سام انتشار، هش، مهر زمانی فشرده و پلتفرم در فهرست محتوامحور حفظ می‌شود.`)}),(0,V.jsxs)(`form`,{className:`release-discovery-form`,onSubmit:e=>void Oe(e),children:[(0,V.jsxs)(`div`,{className:`discovery-source-picker`,children:[(0,V.jsxs)(`button`,{type:`button`,className:d===`release`?`is-active`:``,onClick:()=>f(`release`),children:[(0,V.jsx)(_e,{}),o(`GitHub release`,`انتشار GitHub`)]}),(0,V.jsxs)(`button`,{type:`button`,className:d===`workflow`?`is-active`:``,onClick:()=>f(`workflow`),children:[(0,V.jsx)(_e,{}),o(`Workflow artifact`,`خروجی گردش‌کار`)]}),(0,V.jsxs)(`button`,{type:`button`,className:d===`manifest`?`is-active`:``,onClick:()=>f(`manifest`),children:[(0,V.jsx)(y,{}),o(`HTTP manifest`,`مانیفست HTTP`)]})]}),d===`manifest`?(0,V.jsx)(v,{label:o(`Manifest URL`,`نشانی مانیفست`),type:`url`,dir:`ltr`,value:ue,placeholder:`https://host.example/update-manifest.json`,onChange:e=>fe(e.target.value)}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:o(`Repository`,`مخزن`),dir:`ltr`,value:h,placeholder:`owner/repository`,onChange:e=>te(e.target.value)}),d===`workflow`?(0,V.jsx)(v,{label:o(`Branch`,`شاخه`),dir:`ltr`,value:ne,onChange:e=>ie(e.target.value)}):(0,V.jsx)(v,{label:o(`Tag (blank = latest stable)`,`برچسب (خالی = آخرین نسخهٔ پایدار)`),dir:`ltr`,value:se,onChange:e=>ce(e.target.value)})]}),d===`workflow`&&(0,V.jsx)(v,{label:o(`Workflow name`,`نام گردش‌کار`),value:ae,onChange:e=>oe(e.target.value)}),(0,V.jsx)(v,{label:o(`GitHub API base (optional)`,`نشانی پایهٔ API گیت‌هاب (اختیاری)`),type:`url`,dir:`ltr`,value:b,placeholder:`https://api.github.com`,onChange:e=>S(e.target.value),hint:o(`Supports GitHub Enterprise; normal GitHub uses the default when blank.`,`از GitHub Enterprise پشتیبانی می‌کند؛ برای گیت‌هاب عادی، خالی بگذارید تا مقدار پیش‌فرض استفاده شود.`)})]}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsxs)(`label`,{className:`field`,children:[(0,V.jsx)(`span`,{children:o(`Artifact kind`,`نوع خروجی`)}),(0,V.jsx)(`select`,{value:p,onChange:e=>m(e.target.value),children:Ce.map(e=>(0,V.jsx)(`option`,{value:e,children:s(e)},e))})]}),(0,V.jsx)(v,{label:o(`Target platform`,`پلتفرم مقصد`),dir:`ltr`,value:C,disabled:p!==`host-executable`,onChange:e=>pe(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:o(`Packed timestamp override`,`بازنویسی مهر زمانی فشرده`),dir:`ltr`,value:w,placeholder:o(`0x… or decimal`,`0x… یا ده‌دهی`),onChange:e=>me(e.target.value)}),(0,V.jsx)(v,{label:o(`Provider / peer bearer token`,`توکن حامل ارائه‌دهنده / همتا`),type:`password`,autoComplete:`off`,dir:`ltr`,value:T,onChange:e=>E(e.target.value),hint:o(`Held only in this browser session and cleared after a successful stage.`,`فقط در همین نشست مرورگر نگهداری و پس از آماده‌سازی موفق پاک می‌شود.`)})]}),(0,V.jsx)(r,{type:`submit`,tone:`primary`,icon:y,busy:F===`discover`,disabled:d===`manifest`?!ue.trim():!h.trim(),children:o(`Discover metadata`,`کشف فراداده`)})]}),De&&(0,V.jsxs)(`div`,{className:`update-notice${/failed|error|invalid|mismatch/i.test(De)?` is-error`:``}`,children:[(0,V.jsx)(de,{size:17}),(0,V.jsx)(`span`,{children:De})]}),O?.candidates.length?(0,V.jsx)(`div`,{className:`release-candidates`,children:O.candidates.map(e=>(0,V.jsxs)(`label`,{className:e.id===A?`is-selected`:``,children:[(0,V.jsx)(`input`,{type:`radio`,name:`release-candidate`,checked:e.id===A,onChange:()=>j(e.id)}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsxs)(`small`,{children:[e.release_tag?`${o(`release`,`انتشار`)} ${e.release_tag}`:e.workflow_run_id?`${o(`run`,`اجرا`)} ${e.workflow_run_id}`:e.source,` · `,e.platform||o(`platform-neutral`,`مستقل از پلتفرم`)]})]}),(0,V.jsx)(`code`,{children:Ee(e.archive_sha256||e.sha256,o(`UNPUBLISHED`,`منتشرنشده`))}),(0,V.jsx)(`em`,{children:_(e.archive_bytes||e.bytes,o(`unknown`,`نامشخص`))})]},e.id))}):!F&&O&&(0,V.jsx)(u,{icon:ee,title:o(`No matching candidates`,`گزینهٔ منطبقی پیدا نشد`),detail:o(`Adjust artifact kind, platform, release tag, branch, or workflow name.`,`نوع خروجی، پلتفرم، برچسب انتشار، شاخه یا نام گردش‌کار را تغییر دهید.`)}),U&&(0,V.jsxs)(`div`,{className:`release-selection`,children:[(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:o(`Comparison`,`مقایسه`),value:M?.status||o(`checking`,`در حال بررسی`),tone:M?.status===`newer`?`good`:M?.status===`older`?`warn`:void 0}),(0,V.jsx)(c,{label:o(`Reason`,`دلیل`),value:M?.reason||o(`Comparing hashes and packed/build timestamps…`,`در حال مقایسهٔ هش و مهرهای زمانی فشرده/ساخت…`)}),(0,V.jsx)(c,{label:o(`Build hash`,`هش ساخت`),value:U.build_hash||o(`not supplied`,`ارائه نشده`),mono:!0}),(0,V.jsx)(c,{label:o(`Build time`,`زمان ساخت`),value:U.build_timestamp||o(`not supplied`,`ارائه نشده`),mono:!0})]}),U.archive&&(0,V.jsx)(v,{label:o(`ZIP member path (optional)`,`مسیر عضو ZIP (اختیاری)`),dir:`ltr`,value:ge,placeholder:o(`Auto-select a unique platform/kind match`,`انتخاب خودکار فایل یکتای منطبق با پلتفرم و نوع`),onChange:e=>D(e.target.value),hint:o(`Specify this only when an archive contains multiple equally suitable files.`,`فقط زمانی مشخص کنید که آرشیو چند فایل به یک اندازه مناسب دارد.`)}),(0,V.jsx)(r,{tone:`primary`,icon:he,busy:F===`stage`,onClick:()=>ke(U),children:o(`Review verified staging`,`بازبینی آماده‌سازی تأییدشده`)})]}),P&&(0,V.jsxs)(`div`,{className:`release-operation`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(re,{className:P.state===`queued`||P.state===`downloading`?`spin`:``}),(0,V.jsx)(`strong`,{children:P.error||P.detail||P.state}),(0,V.jsxs)(`span`,{children:[_(P.bytes_done,o(`unknown`,`نامشخص`)),` / `,_(P.bytes_total,o(`unknown`,`نامشخص`))]})]}),(0,V.jsx)(`div`,{className:`update-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.max(0,Math.min(100,P.progress_percent)),children:(0,V.jsx)(`i`,{style:{width:`${Math.max(0,Math.min(100,P.progress_percent))}%`}})}),(0,V.jsx)(r,{compact:!0,icon:le,onClick:()=>void B(P.id).then(G).catch(e=>H(e instanceof Error?e.message:String(e))),children:o(`Refresh operation`,`تازه‌سازی عملیات`)}),P.artifact&&(0,V.jsxs)(`p`,{children:[(0,V.jsx)(x,{}),` `,o(`Staged as`,`آماده‌شده با شناسه`),` `,(0,V.jsx)(`code`,{children:P.artifact.sha256}),`؛ `,o(`board programming remains a separate action.`,`پروگرام برد همچنان عملی جداگانه است.`)]})]})]})}var H=new Set([`completed`,`failed`,`cancelled`,`downloaded`,`staged`]);function U(e){return!!e?.state&&!H.has(e.state)}function W(e){return!U(e)||!e?.progress_known||!Number.isFinite(e.progress_percent)?null:Math.max(0,Math.min(100,e.progress_percent))}function G(e,t){let n=Date.parse(e.started_at??``),r=U(e)?t:Date.parse(e.updated_at??``);if(!Number.isFinite(n)||!Number.isFinite(r)||r=60?`${Math.floor(i/60)}m ${i%60}s`:`${i}s`}var Oe={queued:[`Queued`,`در صف`],preflight:[`Checking tools & target`,`بررسی ابزارها و مقصد`],uploading:[`Uploading artifact`,`ارسال فایل`],receiving:[`Receiving artifact`,`دریافت فایل`],preparing:[`Preparing board`,`آماده‌سازی برد`],"backing-up":[`Saving board settings`,`ذخیره تنظیمات برد`],reading:[`Reading memory`,`خواندن حافظه`],writing:[`Writing memory`,`نوشتن حافظه`],programming:[`Programming board`,`پروگرام برد`],erasing:[`Erasing memory`,`پاک کردن حافظه`],verifying:[`Verifying memory`,`تأیید حافظه`],reconnecting:[`Reconnecting board`,`اتصال دوباره برد`],restoring:[`Restoring settings`,`بازیابی تنظیمات`],downloading:[`Downloading artifact`,`دریافت فایل`],staging:[`Preparing host replacement`,`آماده‌سازی جایگزین میزبان`],staged:[`Host replacement ready`,`جایگزین میزبان آماده است`],prepare:[`Preparing board`,`آماده‌سازی برد`],settings:[`Reading settings`,`خواندن تنظیمات`],release:[`Releasing serial port`,`آزاد کردن درگاه سریال`],backup:[`Saving board backup`,`ذخیره پشتیبان برد`],flash:[`Programming board`,`پروگرام برد`],reconnect:[`Reconnecting board`,`اتصال دوباره برد`],restore:[`Restoring settings`,`بازیابی تنظیمات`],"flash read":[`Reading flash`,`خواندن فلش`],"EEPROM read":[`Reading EEPROM`,`خواندن EEPROM`],"flash write":[`Writing flash`,`نوشتن فلش`],"flash verification":[`Verifying flash`,`تأیید فلش`]};function ke({status:e,locale:t}){let n=(e,n)=>t===`fa`?n:e,r=U(e),i=W(e),[a,o]=(0,L.useState)(Date.now);(0,L.useEffect)(()=>{if(!r)return;let e=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(e)},[r]);let s=G(e,a),c=e.state===`failed`||e.state===`cancelled`,l=e.stage||(r?e.state:``),u=l.split(`:`)[0],d=Oe[u]?.[+(t===`fa`)]||u.replaceAll(`-`,` `),p=c?n(`Update stopped`,`به‌روزرسانی متوقف شد`):r?d:n(`Operation complete`,`عملیات کامل شد`),m=c?f:r?re:de;return(0,V.jsxs)(`section`,{className:`update-operation ${c?`is-failed`:r?`is-running`:`is-complete`}`,"aria-label":n(`Update operation`,`عملیات به‌روزرسانی`),children:[(0,V.jsxs)(`header`,{className:`update-operation__header`,children:[(0,V.jsx)(`div`,{className:`update-operation__icon`,children:(0,V.jsx)(m,{className:r?`spin`:void 0})}),(0,V.jsxs)(`div`,{className:`update-operation__heading`,children:[(0,V.jsx)(`span`,{children:e.kind===`firmware`?n(`Board firmware`,`میان‌افزار برد`):e.kind.replaceAll(`-`,` `)}),(0,V.jsx)(`h2`,{children:p})]}),s&&(0,V.jsxs)(`span`,{className:`update-operation__elapsed`,children:[(0,V.jsx)(me,{size:16}),(0,V.jsx)(`b`,{children:s})]})]}),r&&(0,V.jsxs)(`div`,{className:`update-operation__measurement`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{children:i===null?n(`Waiting for this stage`,`در انتظار این مرحله`):n(`Current stage`,`مرحله جاری`)}),(0,V.jsx)(`strong`,{children:i===null?`…`:`${i}%`})]}),(0,V.jsx)(`div`,{className:`update-progress${i===null?` is-indeterminate`:``}`,role:`progressbar`,"aria-label":d,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i??void 0,"aria-valuetext":i===null?n(`In progress; duration unknown`,`در حال اجرا؛ زمان نامشخص`):void 0,children:(0,V.jsx)(`i`,{style:i===null?void 0:{width:`${i}%`}})},l)]}),e.detail&&(0,V.jsx)(`div`,{className:`update-operation__detail`,dir:`auto`,role:c?`alert`:void 0,children:e.detail}),(0,V.jsxs)(`dl`,{className:`update-operation__facts`,children:[c&&d&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Last stage`,`آخرین مرحله`)}),(0,V.jsx)(`dd`,{children:d})]}),e.programming_method&&e.programming_method!==`none`&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Connection`,`اتصال`)}),(0,V.jsx)(`dd`,{children:e.programming_method===`urclock`?`UART / Urclock`:`USBasp / ISP`})]}),!!e.bytes_total&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Transferred`,`انتقال داده`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{title:`${e.bytes_done??0} / ${e.bytes_total} bytes`,children:te(e.bytes_done??0,e.bytes_total)})})]}),e.updated_at&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Last activity`,`آخرین فعالیت`)}),(0,V.jsx)(`dd`,{children:new Date(e.updated_at).toLocaleTimeString(t)})]})]}),(0,V.jsxs)(`details`,{className:`update-operation__diagnostics`,children:[(0,V.jsxs)(`summary`,{children:[(0,V.jsx)(S,{size:16}),n(`Technical details`,`جزئیات فنی`)]}),(0,V.jsxs)(`dl`,{children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Operation`,`عملیات`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.id})})})]}),e.error_code&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:n(`Error`,`خطا`)}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.error_code})})})]}),e.artifact_sha256&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`SHA-256`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`bdi`,{children:(0,V.jsx)(`code`,{children:e.artifact_sha256})})})]})]})]})]})}function K(){let e=h();return e?{Authorization:`Bearer ${e}`}:{}}async function Ae(e){let t=await e.text(),n=null;if(t)try{n=JSON.parse(t)}catch{n=t}if(!e.ok){let t=m(n,e.statusText,e.status);throw Error(t||`HTTP ${e.status}`)}return n}function je(e){return i(`controller.artifact.manifest`,{},e)}function Me(e,t){return i(`controller.artifact.list`,e?{kind:e}:{},t)}function Ne(e,t){return i(`controller.artifact.fetch`,e,t)}function Pe(e,t){return i(`controller.artifact.capture`,e,t)}function Fe(e,t){return i(`controller.update.firmware`,e,t)}function Ie(e,t){return i(`controller.restore.flash`,e,t)}function Le(e,t){return i(`controller.update.eeprom`,e,t)}function Re(e,t){return i(`controller.update.host`,e,t)}function ze(e){return i(`controller.bridge.list`,{},e)}var Be=`pccontroller.peer-update.intent.`,q=new Map,J;function Y(e,t){try{sessionStorage!==J&&(q.clear(),J=sessionStorage)}catch{}return`${Be}${encodeURIComponent(e.trim().toLowerCase())}.${t}`}function X(e){let t=new Uint8Array(16);globalThis.crypto.getRandomValues(t);let n=Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``);return`peer-host-${e.slice(0,12)}-${n}`}function Z(e,t){if(!e.trim())throw Error(`Peer host update requires a peer`);let n=t.trim().toLowerCase();if(!/^[0-9a-f]{64}$/.test(n))throw Error(`Peer host update requires an exact SHA-256 digest`);let r=Y(e,n),i=q.get(r);if(i)return i;try{let e=sessionStorage.getItem(r)?.trim()??``;if(/^[A-Za-z0-9._:-]{1,128}$/.test(e))return q.set(r,e),e}catch{}let a=X(n);q.set(r,a);try{sessionStorage.setItem(r,a)}catch{}return a}function Q(e,t,n){let r=Y(e,t.trim().toLowerCase());q.get(r)===n&&q.delete(r);try{sessionStorage.getItem(r)===n&&sessionStorage.removeItem(r)}catch{}}function Ve(e,t,n){let r=t.trim().toLowerCase(),i=n.trim();if(!e.trim()||!/^[0-9a-f]{64}$/.test(r)||!/^[A-Za-z0-9._:-]{1,128}$/.test(i))return!1;q.set(Y(e,r),i);try{return sessionStorage.setItem(Y(e,r),i),!0}catch{return!0}}function He(e,t,n){Q(e,t,n.trim())}async function Ue(t,n,r){let a=n.trim().toLowerCase(),o=Z(t,a);try{let e=await i(`controller.peer.update.host`,{peer:t,artifact_sha256:a,authorized:!0,idempotency_key:o},r);return Q(t,a,o),e}catch(n){throw n instanceof e&&n.code!==-32004&&Q(t,a,o),n}}async function We(e,t,n,r,i){let o=new URL(a(`/api/artifacts/upload`),location.href);o.searchParams.set(`kind`,t),o.searchParams.set(`name`,e.name),o.searchParams.set(`sha256`,n),o.searchParams.set(`bytes`,String(e.size));let s=new FormData;return s.set(`artifact`,e,e.name),i&&typeof XMLHttpRequest<`u`?new Promise((t,n)=>{let a=new XMLHttpRequest,c=e.size,l=()=>a.abort();a.open(`POST`,o.toString());for(let[e,t]of Object.entries(K()))a.setRequestHeader(e,t);a.upload.onprogress=e=>{c=e.lengthComputable&&e.total>0?e.total:c,i(e.loaded,c)},a.onerror=()=>n(Error(`Artifact upload transport failed`)),a.onabort=()=>n(new DOMException(`Artifact upload was cancelled`,`AbortError`)),a.onload=()=>{r?.removeEventListener(`abort`,l);let e=null;try{e=a.responseText?JSON.parse(a.responseText):null}catch{e=a.responseText}a.status<200||a.status>=300?n(Error(m(e,a.statusText,a.status))):(i(c,c),t(e))},r?.addEventListener(`abort`,l,{once:!0}),r?.aborted?l():a.send(s)}):Ae(await fetch(o.toString(),{method:`POST`,headers:K(),body:s,signal:r}))}async function Ge(e,t,n){let r=a(`/api/artifacts/${encodeURIComponent(e.kind)}/${encodeURIComponent(e.sha256)}`);if(n&&typeof XMLHttpRequest<`u`){Ke(await new Promise((i,a)=>{let o=new XMLHttpRequest,s=()=>o.abort();o.open(`GET`,r),o.responseType=`blob`;for(let[e,t]of Object.entries(K()))o.setRequestHeader(e,t);o.onprogress=t=>n(t.loaded,t.lengthComputable?t.total:e.bytes),o.onerror=()=>a(Error(`Artifact download transport failed`)),o.onabort=()=>a(new DOMException(`Artifact download was cancelled`,`AbortError`)),o.onload=()=>{t?.removeEventListener(`abort`,s),o.status<200||o.status>=300?a(Error(o.statusText||`HTTP ${o.status}`)):(n(e.bytes,e.bytes),i(o.response))},t?.addEventListener(`abort`,s,{once:!0}),t?.aborted?s():o.send()}),e.name);return}let i=await fetch(r,{headers:K(),signal:t});i.ok||await Ae(i),Ke(await i.blob(),e.name)}function Ke(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.rel=`noopener`,document.body.append(r),r.click(),r.remove(),URL.revokeObjectURL(n)}async function qe(e){let t=await crypto.subtle.digest(`SHA-256`,await e.arrayBuffer());return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function Je(e,t){return!e||!t?`unknown`:e.sha256.toLowerCase()===t.sha256.toLowerCase()?`same`:!e.build_timestamp||!t.build_timestamp||t.build_timestamp===e.build_timestamp?`different`:t.build_timestamp>e.build_timestamp?`newer`:`older`}var Ye=[`firmware`,`eeprom`,`flash-backup`,`host-executable`];function Xe(e){return e?e.slice(0,12).toUpperCase():`—`}function Ze(e){let t=e.metadata;return!et(e)||!t?.operation_id||!t.kind||!t.state?null:{id:t.operation_id,kind:t.kind,state:t.state,stage:t.stage,detail:t.detail??e.text,error_code:t.error_code,progress_known:t.progress_known===`true`,progress_percent:Number(t.progress_percent),started_at:t.started_at,updated_at:t.updated_at,stage_started_at:t.stage_started_at,artifact_sha256:t.sha256,programming_method:t.programming_method,bootloader_outcome:t.bootloader_outcome,isp_fallback_suggested:t.isp_fallback_suggested===`true`,toolchain:t.toolchain_ready?{ready:t.toolchain_ready===`true`,policy:t.toolchain_policy,provider:t.toolchain_provider,version:t.toolchain_version,compatible_sources:t.toolchain_compatible_sources?Number(t.toolchain_compatible_sources):void 0,providers:t.toolchain_providers?t.toolchain_providers.split(`,`).filter(Boolean):void 0}:void 0,bytes_done:t.bytes_done?Number(t.bytes_done):void 0,bytes_total:t.bytes_total?Number(t.bytes_total):void 0}}function $(e,t){return{firmware:[`Board firmware`,`میان‌افزار برد`],eeprom:[`Board EEPROM`,`EEPROM برد`],"flash-backup":[`Flash readback`,`بازخوانی فلش`],"host-executable":[`Host executable`,`فایل اجرایی میزبان`]}[e]?.[+(t===`fa`)]??e}function Qe(e,t){return t(e.operation),e.artifact}function $e(e,t){return t===`host-executable`||e}function et(e){return e.kind.startsWith(`update.`)&&e.source!==`bridge`&&!e.metadata?.[`bridge.ingress`]}function tt(e){let t=e.kind.trim().toLowerCase();if(!t.startsWith(`peer-update.`))return null;let n=e.metadata?.peer?.trim()??``,r=(e.metadata?.state??t.slice(12)).trim().toLowerCase();if(!n||!r)return null;let i=Number(e.metadata?.progress_percent);return{peer:n,state:r,operationID:e.metadata?.remote_operation_id?.trim()||e.metadata?.operation_id?.trim()||`—`,progressPercent:Number.isFinite(i)?Math.min(100,Math.max(0,i)):0,progressKnown:e.metadata?.progress_known===`true`&&Number.isFinite(i),bytesDone:e.metadata?.bytes_done?Number(e.metadata.bytes_done):void 0,bytesTotal:e.metadata?.bytes_total?Number(e.metadata.bytes_total):void 0,detail:e.text,artifactSHA256:e.metadata?.sha256?.trim().toLowerCase()??``,idempotencyKey:e.metadata?.idempotency_key?.trim()??``,retrySameIntent:e.metadata?.retry_same_idempotency_key===`true`,terminalVerified:e.metadata?.terminal_verified===`true`}}function nt({appTitle:e,snapshot:n,events:i,locale:a,openDialog:s}){let d=(e,t)=>a===`fa`?t:e,[m,ee]=(0,L.useState)(null),[h,ie]=(0,L.useState)([]),[y,x]=(0,L.useState)(``),[S,C]=(0,L.useState)(null),[w,me]=(0,L.useState)([]),[T,E]=(0,L.useState)(null),[D,k]=(0,L.useState)(``),[j,N]=(0,L.useState)(``),[_e,P]=(0,L.useState)(``),[F,ye]=(0,L.useState)(`firmware`),[R,be]=(0,L.useState)(null),[z,xe]=(0,L.useState)(``),[B,Se]=(0,L.useState)(!1),[Ce,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(``),[H,W]=(0,L.useState)(``),[G,Oe]=(0,L.useState)(``),[K,Ae]=(0,L.useState)(``),Be=(0,L.useRef)(null),q=(0,L.useCallback)(async()=>{k(e=>e||`refresh`);try{let[e,t,n]=await Promise.all([je(),Me(),ze()]);ee(e),ie(t.artifacts),C(e.update??null),me(n),P(``),x(n=>n&&t.artifacts.some(e=>e.sha256===n)?n:e.defaults.firmware?.sha256??t.artifacts[0]?.sha256??``)}catch(e){ee(null),ie([]),me([]),P(e instanceof Error?e.message:String(e))}finally{k(e=>e===`refresh`?``:e)}},[]);(0,L.useEffect)(()=>{q()},[q]);let J=(0,L.useMemo)(()=>i.find(et),[i]),Y=(0,L.useMemo)(()=>i.map(tt).find(e=>e!==null)??null,[i]);(0,L.useEffect)(()=>{Y?.idempotencyKey&&Y.artifactSHA256&&(Y.state===`outcome-uncertain`&&Y.retrySameIntent?Ve(Y.peer,Y.artifactSHA256,Y.idempotencyKey):(Y.state===`failed`||Y.state===`completed`)&&He(Y.peer,Y.artifactSHA256,Y.idempotencyKey))},[Y]);let X=Y??(T?{peer:T.peer,state:T.stage,operationID:T.operation.id,progressPercent:T.operation.progress_percent,progressKnown:T.operation.progress_known===!0,bytesDone:T.operation.bytes_done,bytesTotal:T.operation.bytes_total,detail:T.operation.detail??``,artifactSHA256:T.artifact.sha256,idempotencyKey:T.operation.idempotency_key??``,retrySameIntent:!1,terminalVerified:T.terminal_verified}:null);(0,L.useEffect)(()=>{if(!J)return;let e=Ze(J);e&&(C(t=>t?.updated_at&&e.updated_at&&Date.parse(t.updated_at)>Date.parse(e.updated_at)?t:e),U(e)||q())},[J?.id,J?.time]);let Z=h.find(e=>e.sha256===y),Q=Je(Z?.kind===`host-executable`?m?.current.host:Z?.kind===`eeprom`?m?.current.eeprom:Z?.kind===`flash-backup`?m?.current.flash_readback:m?.current.firmware,Z),Ke=S?.isp_fallback_suggested===!0,nt=async e=>{if(be(e),xe(``),N(``),e){Se(!0);try{xe(await qe(e))}catch(e){N(`${d(`Could not hash selection`,`محاسبهٔ هش فایل انتخابی ممکن نشد`)}: ${e instanceof Error?e.message:String(e)}`)}finally{Se(!1)}}},rt=e=>{nt(e.currentTarget.files?.[0]??null)},it=e=>{e.preventDefault(),we(!1),nt(e.dataTransfer.files?.[0]??null)},at=async()=>{if(!R||!z)return;k(`upload`);let e=`browser-upload-${z.slice(0,16)}`,t=new Date().toISOString(),n=0,r=R.size;try{let i=Qe(await We(R,F,z,void 0,(i,a)=>{n=i,r=a;let o=a>0?Math.max(0,Math.min(100,Math.round(i*100/a))):0,s={id:e,kind:`artifact-upload`,state:`uploading`,stage:`uploading`,progress_known:a>0,progress_percent:o,bytes_done:i,bytes_total:a,detail:d(`Sending selected artifact to this host`,`ارسال فایل انتخاب‌شده به این میزبان`),started_at:t,updated_at:new Date().toISOString()};C(s),window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:s}))}),C);window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:e,kind:`artifact-upload`,state:`completed`,stage:`completed`,progress_known:r>0,progress_percent:100,bytes_done:r,bytes_total:r,detail:d(`Artifact upload completed and was verified`,`ارسال فایل کامل و تأیید شد`),started_at:t,updated_at:new Date().toISOString()}})),N(d(`${R.name} was verified and staged. Nothing has been programmed.`,`${R.name} تأیید و آماده شد. هیچ چیزی پروگرام نشده است.`)),await q(),i&&x(i.sha256)}catch(i){let a=i instanceof Error?i.message:String(i);window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:e,kind:`artifact-upload`,state:`failed`,stage:`uploading`,progress_known:r>0,progress_percent:r>0?Math.max(0,Math.min(100,Math.round(n*100/r))):0,bytes_done:n,bytes_total:r,detail:a,started_at:t,updated_at:new Date().toISOString()}})),N(a)}finally{k(``)}},ot=async e=>{e.preventDefault();let t=G.trim().toLowerCase();if(t&&!/^[0-9a-f]{64}$/.test(t))N(d(`Expected SHA-256 must contain exactly 64 hexadecimal characters.`,`مقدار مورد انتظار SHA-256 باید دقیقاً ۶۴ نویسهٔ شانزده‌شانزدهی داشته باشد.`));else{k(`remote`);try{let e=Qe(await Ne({url:Te.trim(),kind:F,...H.trim()?{name:H.trim()}:{},...t?{sha256:t}:{},...K?{bearer_token:K}:{}}),C);N(d(`Remote content was downloaded, checked and staged. Nothing has been programmed.`,`محتوای راه‌دور دانلود، بررسی و آماده شد. هیچ چیزی پروگرام نشده است.`)),Ae(``),await q(),e&&x(e.sha256)}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(``)}}},st=(e,t=`urclock`)=>{let r=e.kind!==`host-executable`;if(!$e(n.connected,e.kind)){N(d(`Connect the controller before starting a board update.`,`پیش از آغاز به‌روزرسانی برد، کنترلر را متصل کنید.`));return}let i=e.kind===`host-executable`?d(`replace the host application`,`برنامهٔ میزبان را جایگزین می‌کند`):e.kind===`eeprom`?d(`restore MCU EEPROM`,`EEPROM ریزکنترل‌گر را بازیابی می‌کند`):e.kind===`flash-backup`?d(`restore the captured flash image`,`تصویر ثبت‌شدهٔ فلش را بازیابی می‌کند`):d(`program board firmware`,`میان‌افزار برد را پروگرام می‌کند`);s({tone:`danger`,title:e.kind===`flash-backup`?d(`Authorize guarded flash restore?`,`بازیابی محافظت‌شدهٔ فلش مجاز شود؟`):d(`Authorize ${$(e.kind,a).toLowerCase()} update?`,`به‌روزرسانی ${$(e.kind,a)} مجاز شود؟`),body:`${e.name}\nSHA-256 ${e.sha256}\n\n${d(`This is the authorization step. Selection and staging did not write hardware.`,`این مرحلهٔ صدور مجوز است. انتخاب و آماده‌سازی چیزی روی سخت‌افزار ننوشته‌اند.`)} ${r?d(`The primary host will make the board safe, back up flash and EEPROM, then ${i}, verify readback, and restore lifecycle settings.`,`میزبان اصلی ابتدا برد را در وضعیت امن قرار می‌دهد، از فلش و EEPROM پشتیبان می‌گیرد، سپس ${i}، بازخوانی را تأیید و تنظیمات چرخهٔ کار را بازیابی می‌کند.`):d(`The primary host will verify the package, prepare a recoverable replacement, and ${i} only after the current process exits cleanly.`,`میزبان اصلی بسته را تأیید و جایگزینی قابل‌بازیابی آماده می‌کند و فقط پس از خروج پاک فرایند فعلی، ${i}.`)}`,confirmLabel:t===`usbasp`?d(`Authorize ISP programming`,`اجازهٔ پروگرام ISP`):d(`Authorize verified update`,`اجازهٔ به‌روزرسانی تأییدشده`),action:async()=>{k(`update`);try{let r={artifact_sha256:e.sha256,authorized:!0,method:t,...n.port.name?{port:n.port.name}:{}};Qe(e.kind===`host-executable`?await Re(r):e.kind===`eeprom`?await Le(r):e.kind===`flash-backup`?await Ie(r):await Fe(r),C),N(d(`${e.name} entered the guarded ${e.kind===`flash-backup`?`restore`:`update`} queue.`,`${e.name} وارد صف محافظت‌شدهٔ ${e.kind===`flash-backup`?`بازیابی`:`به‌روزرسانی`} شد.`))}catch(e){throw N(e instanceof Error?e.message:String(e)),e}finally{k(``)}}})},ct=(e,t)=>{!e.connected||!e.allow_commands?N(d(`Peer ${e.name} is not connected for commands.`,`همتای ${e.name} برای فرمان‌ها متصل نیست.`)):s({tone:`danger`,title:d(`Upgrade ${e.name}?`,`به‌روزرسانی ${e.name}؟`),body:`${t.name}\nSHA-256 ${t.sha256}\n\n${d(`The primary instance will transfer the verified executable over its configured bridge, ask the remote coordinator to perform its journaled replacement, wait through restart, and verify the peer acknowledges this exact active SHA.`,`نمونهٔ اصلی فایل اجرایی تأییدشده را از پل معتبر منتقل می‌کند، از هماهنگ‌کنندهٔ راه‌دور می‌خواهد جایگزینی ثبت‌شده را انجام دهد، در طول راه‌اندازی مجدد منتظر می‌ماند و تأیید می‌کند که همتا همین SHA فعال دقیق را اعلام می‌کند.`)}`,confirmLabel:d(`Authorize peer upgrade`,`اجازهٔ به‌روزرسانی همتا`),action:async()=>{k(`peer-update`);try{let n=await Ue(e.name,t.sha256);E(n),N(d(`${e.name} restarted and acknowledged ${n.artifact.sha256.slice(0,12)} as its active host executable.`,`${e.name} دوباره راه‌اندازی شد و ${n.artifact.sha256.slice(0,12)} را به‌عنوان فایل اجرایی فعال میزبان تأیید کرد.`))}catch(e){N(e instanceof Error?e.message:String(e))}finally{k(``)}}})},lt=(e=`urclock`)=>{n.connected?s({title:d(`Capture current flash and EEPROM?`,`فلش و EEPROM فعلی ثبت شوند؟`),body:`${d(`The primary host will briefly take ownership of the programming path, read both memories, verify their exact byte counts, and store content-addressed backups. Existing identical images are not duplicated.`,`میزبان اصلی برای مدتی کوتاه مسیر پروگرام را در اختیار می‌گیرد، هر دو حافظه را می‌خواند، شمار دقیق بایت‌ها را تأیید و پشتیبان‌های محتوامحور ذخیره می‌کند. تصاویر یکسان موجود دوباره کپی نمی‌شوند.`)}${e===`usbasp`?`\n\n${d(`ISP access is being used because the bootloader probe failed.`,`به‌دلیل ناموفق بودن بررسی بوت‌لودر، از دسترسی ISP استفاده می‌شود.`)}`:``}`,confirmLabel:e===`usbasp`?d(`Authorize ISP capture`,`اجازهٔ ثبت با ISP`):d(`Authorize readback`,`اجازهٔ بازخوانی`),action:async()=>{k(`capture`);try{Qe(await Pe({components:[`flash`,`eeprom`],authorized:!0,method:e}),C),N(d(`Flash and EEPROM capture entered the guarded queue.`,`ثبت فلش و EEPROM وارد صف محافظت‌شده شد.`))}catch(e){throw N(e instanceof Error?e.message:String(e)),e}finally{k(``)}}}):N(d(`Connect the controller before capturing its memories.`,`پیش از ثبت حافظه‌ها، کنترلر را متصل کنید.`))},ut=async e=>{let t=`browser-download-${e.sha256.slice(0,16)}`,n=new Date().toISOString(),r=0,i=e.bytes,a=(e,a,o,s)=>{r=a,i=o;let c=o>0?Math.max(0,Math.min(100,Math.round(a*100/o))):0;window.dispatchEvent(new CustomEvent(`pccontroller:update-transfer-progress`,{detail:{id:t,kind:`artifact-fetch`,state:e,stage:e===`completed`?`completed`:`downloading`,progress_known:o>0,progress_percent:c,bytes_done:a,bytes_total:o,detail:s,started_at:n,updated_at:new Date().toISOString()}}))};try{await Ge(e,void 0,(e,t)=>a(`downloading`,e,t,d(`Downloading verified artifact to this browser`,`دریافت فایل تأییدشده در این مرورگر`))),a(`completed`,e.bytes,e.bytes,d(`Artifact download completed`,`دریافت فایل کامل شد`))}catch(e){let t=e instanceof Error?e.message:String(e);a(`failed`,r,i,t),N(t)}};return _e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{eyebrow:d(`Verified host updates`,`به‌روزرسانی تأییدشدهٔ میزبان`),title:d(`Firmware & updates`,`میان‌افزار و به‌روزرسانی`),detail:d(`Remote update is performed by the primary host over the board programming link; it is not MCU-native OTA.`,`به‌روزرسانی راه‌دور توسط میزبان اصلی و از مسیر پروگرام برد انجام می‌شود؛ این فرایند OTA بومی ریزکنترل‌گر نیست.`)}),(0,V.jsxs)(l,{icon:I,iconTone:`red`,title:d(`Artifact service`,`سرویس خروجی‌های ساخت`),eyebrow:d(`Unavailable`,`دردسترس نیست`),className:`updates-unavailable`,children:[(0,V.jsx)(u,{icon:I,title:d(`Artifact service unavailable`,`سرویس خروجی‌های ساخت در دسترس نیست`),detail:_e}),(0,V.jsx)(r,{icon:le,onClick:()=>void q(),children:d(`Retry typed service`,`تلاش دوباره برای سرویس`)})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{eyebrow:d(`Verified host updates`,`به‌روزرسانی تأییدشدهٔ میزبان`),title:d(`Firmware & updates`,`میان‌افزار و به‌روزرسانی`)}),S&&(0,V.jsx)(ke,{status:S,locale:a}),j&&(0,V.jsxs)(`div`,{className:`update-notice${/failed|error|could not|expected/i.test(j)?` is-error`:``}`,children:[(0,V.jsx)(de,{size:17}),(0,V.jsx)(`span`,{children:j})]}),(0,V.jsxs)(`section`,{className:`updates-grid`,children:[(0,V.jsxs)(l,{icon:M,iconTone:`violet`,title:d(`Stage a local artifact`,`آماده‌سازی خروجی محلی`),eyebrow:d(`Select · hash · stage`,`انتخاب · هش · آماده‌سازی`),className:`update-source-card`,action:(0,V.jsx)(g,{tone:R&&z?`good`:`neutral`,children:R?B?d(`HASHING`,`در حال هش`):d(`SELECTED`,`انتخاب‌شده`):d(`NO FILE`,`بدون فایل`)}),children:[(0,V.jsx)(`div`,{className:`artifact-kind-picker`,role:`radiogroup`,"aria-label":d(`Artifact kind`,`نوع خروجی`),children:Ye.map(e=>(0,V.jsxs)(`button`,{role:`radio`,"aria-checked":F===e,className:F===e?`is-active`:``,onClick:()=>ye(e),children:[e===`firmware`?(0,V.jsx)(A,{}):e===`eeprom`?(0,V.jsx)(se,{}):e===`host-executable`?(0,V.jsx)(o,{}):(0,V.jsx)(O,{}),(0,V.jsx)(`span`,{children:$(e,a)})]},e))}),(0,V.jsx)(`input`,{ref:Be,className:`visually-hidden`,type:`file`,accept:`.hex,.eep,.bin,.exe,application/octet-stream,text/plain`,onChange:rt}),(0,V.jsxs)(`button`,{className:`artifact-drop${Ce?` is-dragging`:``}`,type:`button`,onClick:()=>Be.current?.click(),onDragEnter:e=>{e.preventDefault(),we(!0)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=`copy`},onDragLeave:()=>we(!1),onDrop:it,children:[B?(0,V.jsx)(re,{className:`spin`}):(0,V.jsx)(M,{}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`strong`,{children:R?.name||d(`Browse for firmware, EEPROM, or readback`,`انتخاب میان‌افزار، EEPROM یا بازخوانی`)}),(0,V.jsx)(`span`,{children:R?`${_(R.size)} · SHA-256 ${Xe(z)}`:d(`The browser calculates SHA-256 locally before the host receives anything.`,`مرورگر پیش از دریافت هر چیزی توسط میزبان، SHA-256 را به‌صورت محلی محاسبه می‌کند.`)})]}),(0,V.jsx)(`span`,{children:d(`Choose file`,`انتخاب فایل`)})]}),(0,V.jsx)(r,{tone:`primary`,icon:ge,busy:D===`upload`,disabled:!R||!z||B,onClick:()=>void at(),children:d(`Verify and stage only`,`فقط تأیید و آماده‌سازی`)})]}),(0,V.jsx)(l,{icon:he,iconTone:`accent`,title:d(`Stage from a remote source`,`آماده‌سازی از منبع راه‌دور`),eyebrow:d(`HTTPS or trusted peer`,`HTTPS یا همتای مورد اعتماد`),className:`update-source-card`,children:(0,V.jsxs)(`form`,{className:`remote-artifact-form`,onSubmit:e=>void ot(e),children:[(0,V.jsx)(v,{label:d(`Source URL`,`نشانی منبع`),type:`url`,dir:`ltr`,value:Te,placeholder:`https://host.example/artifacts/firmware/…`,onChange:e=>Ee(e.target.value),hint:d(`The host respects configured proxy environment variables, validates redirects, size, and digest, then stages without programming.`,`میزبان تنظیمات پراکسی محیط را رعایت می‌کند، تغییرمسیرها، اندازه و چکیده را می‌سنجد و سپس بدون پروگرام فایل را آماده می‌کند.`)}),(0,V.jsxs)(`div`,{className:`compact-fields`,children:[(0,V.jsx)(v,{label:d(`Display name (optional)`,`نام نمایشی (اختیاری)`),value:H,onChange:e=>W(e.target.value)}),(0,V.jsx)(v,{label:d(`Expected SHA-256 (recommended)`,`SHA-256 مورد انتظار (پیشنهادی)`),dir:`ltr`,value:G,maxLength:64,onChange:e=>Oe(e.target.value.replace(/[^0-9a-f]/gi,``).toLowerCase())})]}),(0,V.jsx)(v,{label:d(`Peer bearer token (optional)`,`توکن حامل همتا (اختیاری)`),type:`password`,autoComplete:`off`,dir:`ltr`,value:K,onChange:e=>Ae(e.target.value),hint:d(`Used once by the primary host for this peer download; it is not persisted or printed.`,`فقط یک‌بار توسط میزبان اصلی برای دانلود معتبر از همتا استفاده می‌شود و ذخیره یا چاپ نخواهد شد.`)}),(0,V.jsx)(r,{type:`submit`,tone:`primary`,icon:he,busy:D===`remote`,disabled:!Te.trim(),children:d(`Download, verify and stage`,`دانلود، تأیید و آماده‌سازی`)})]})}),(0,V.jsx)(De,{manifest:m,events:i,locale:a,openDialog:s,onArtifactsChanged:()=>void q()}),(0,V.jsxs)(l,{icon:I,iconTone:`accent`,title:d(`Update a configured peer`,`به‌روزرسانی همتای معتبر`),eyebrow:d(`Bridge-native · verified · coordinated`,`پل بومی · تأییدشده · هماهنگ`),action:(0,V.jsxs)(g,{tone:w.some(e=>e.connected)?`good`:`warn`,children:[w.filter(e=>e.connected).length,` `,d(`CONNECTED`,`متصل`)]}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`Transfer the selected verified host executable over the configured bridge, perform the peer’s recoverable replacement, and wait for restart health plus an exact active-SHA acknowledgement. No SSH command or shared filesystem is used.`,`فایل اجرایی تأییدشدهٔ میزبان را از پل پیکربندی‌شده منتقل می‌کند، جایگزینی قابل‌بازیابی همتا را انجام می‌دهد و تا سلامت راه‌اندازی مجدد و تأیید دقیق SHA فعال منتظر می‌ماند. هیچ فرمان SSH یا فایل مشترکی استفاده نمی‌شود.`)}),X&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Shared peer progress · ${X.peer}`,`پیشرفت مشترک همتا · ${X.peer}`),value:X.state===`completed`?d(`Restarted and active SHA verified`,`راه‌اندازی مجدد و SHA فعال تأیید شد`):X.state===`remote-staged`?d(`Remote staged`,`آماده‌شده در راه‌دور`):X.state===`remote-queued`?d(`Remote queued`,`در صف راه‌دور`):X.state===`outcome-uncertain`?d(`Outcome uncertain — retry this update`,`نتیجه نامشخص است — همین به‌روزرسانی را دوباره امتحان کنید`):X.state===`failed`?d(`Peer attempt failed`,`تلاش همتا ناموفق بود`):X.progressKnown?`${X.state.replaceAll(`-`,` `)} · ${Math.round(X.progressPercent)}%`:X.state.replaceAll(`-`,` `),tone:X.state===`completed`&&X.terminalVerified?`good`:X.state===`failed`?`bad`:`warn`}),(0,V.jsx)(c,{label:d(`Transferred`,`انتقال داده`),value:X.bytesTotal?te(X.bytesDone??0,X.bytesTotal):d(`Not measured for this stage`,`برای این مرحله اندازه‌گیری نشده`),mono:!0}),(0,V.jsx)(c,{label:d(`Peer operation`,`عملیات همتا`),value:X.operationID,mono:!0}),(0,V.jsx)(c,{label:d(`Terminal replacement`,`جایگزینی نهایی`),value:X.terminalVerified?d(`Acknowledged · active SHA matches`,`تأیید شد · SHA فعال مطابقت دارد`):d(`Waiting for health, reconnect & active SHA`,`در انتظار سلامت، اتصال دوباره و SHA فعال`),tone:X.terminalVerified?`good`:`warn`})]}),(0,V.jsx)(`div`,{className:`update-progress${X.progressKnown?``:` is-indeterminate`}`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":X.progressKnown?X.progressPercent:void 0,"aria-valuetext":X.bytesTotal?te(X.bytesDone??0,X.bytesTotal):X.detail,children:(0,V.jsx)(`i`,{style:X.progressKnown?{width:`${X.progressPercent}%`}:void 0})})]}),w.length?(0,V.jsx)(`div`,{className:`data-list`,children:w.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(c,{label:e.name,value:e.connected?d(`Connected`,`متصل`):e.last_error||d(`Disconnected`,`قطع`),tone:e.connected?`good`:`bad`}),(0,V.jsx)(`div`,{className:`inline-actions`,children:(0,V.jsx)(r,{icon:ce,tone:`primary`,disabled:!e.connected||!e.allow_commands||Z?.kind!==`host-executable`||D===`peer-update`,busy:D===`peer-update`,onClick:()=>Z&&void ct(e,Z),children:d(`Review peer host update`,`بازبینی به‌روزرسانی میزبان همتا`)})})]},e.name))}):(0,V.jsx)(u,{icon:I,title:d(`No bridge peers configured`,`هیچ همتای پلی پیکربندی نشده`),detail:d(`Add a peer in integration settings; connected peers appear here immediately.`,`یک همتای معتبر را در تنظیمات یکپارچه‌سازی بیفزایید؛ همتایان متصل فوراً اینجا ظاهر می‌شوند.`)})]}),(0,V.jsxs)(l,{icon:pe,iconTone:`green`,title:d(`Embedded first-board recovery`,`بازیابی تعبیه‌شدهٔ نخستین برد`),eyebrow:d(`Verified build defaults`,`پیش‌فرض‌های تأییدشدهٔ ساخت`),action:(0,V.jsx)(g,{tone:m?.defaults_enabled?`good`:`warn`,children:m?.defaults_enabled?d(`AVAILABLE`,`موجود`):d(`NOT PACKAGED`,`بسته‌بندی نشده`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`Enabled automatically only when the release contains both a real firmware image and a generated valid default EEPROM image. It is never auto-flashed—even a non-responsive, corrupt, or older board still requires your grant.`,`فقط وقتی خودکار فعال می‌شود که انتشار هم تصویر واقعی میان‌افزار و هم تصویر معتبرِ تولیدشده برای EEPROM پیش‌فرض داشته باشد. هرگز خودکار فلش نمی‌شود؛ حتی برد پاسخ‌گو‌نبود‌ه، خراب یا قدیمی نیز به اجازهٔ شما نیاز دارد.`)}),(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Firmware`,`میان‌افزار`),value:m?.defaults.firmware?`${Xe(m.defaults.firmware.sha256)} · ${_(m.defaults.firmware.bytes)}`:d(`Missing from this host`,`در این میزبان موجود نیست`),mono:!0}),(0,V.jsx)(c,{label:d(`Default EEPROM`,`EEPROM پیش‌فرض`),value:m?.defaults.eeprom?`${Xe(m.defaults.eeprom.sha256)} · ${_(m.defaults.eeprom.bytes)}`:d(`Missing; empty .eep is never accepted`,`موجود نیست؛ فایل خالی .eep پذیرفته نمی‌شود`),mono:!0})]}),n.connected&&(0,V.jsxs)(`div`,{className:`inline-actions`,children:[(0,V.jsx)(r,{icon:o,tone:`primary`,disabled:!m?.defaults.firmware||D===`update`,onClick:()=>m?.defaults.firmware&&st(m.defaults.firmware),children:d(`Review firmware programming`,`بازبینی پروگرام میان‌افزار`)}),(0,V.jsx)(r,{icon:pe,disabled:!m?.defaults.eeprom||D===`update`,onClick:()=>m?.defaults.eeprom&&st(m.defaults.eeprom),children:d(`Review EEPROM restore`,`بازبینی بازیابی EEPROM`)})]})]}),n.connected&&(0,V.jsxs)(l,{icon:b,iconTone:`amber`,title:d(`Capture this connected board`,`ثبت برد متصل`),eyebrow:d(`Flash + EEPROM · deduplicated`,`فلش + EEPROM · بدون تکرار`),action:(0,V.jsx)(g,{tone:`good`,children:n.port.name||d(`CONNECTED`,`متصل`)}),children:[(0,V.jsx)(`p`,{className:`card-copy`,children:d(`A readback is stored by content hash. Identical firmware is referenced, not copied, and the resulting flash/EEPROM artifacts can be served to configured peers or downloaded below.`,`بازخوانی بر پایهٔ هش محتوا ذخیره می‌شود. به میان‌افزار یکسان ارجاع داده می‌شود و دوباره کپی نمی‌گردد؛ خروجی فلش/EEPROM را می‌توان در اختیار همتاهای معتبر گذاشت یا از پایین دانلود کرد.`)}),(0,V.jsxs)(`div`,{className:`data-list`,children:[(0,V.jsx)(c,{label:d(`Current board`,`برد فعلی`),value:n.hello.name||e}),(0,V.jsx)(c,{label:d(`Running build`,`ساخت در حال اجرا`),value:n.hello.build_hash?n.hello.build_hash.toString(16).toUpperCase().padStart(8,`0`):`—`,mono:!0}),(0,V.jsx)(c,{label:d(`Port owner`,`مالک درگاه`),value:n.port.name||d(`automatic`,`خودکار`),mono:!0})]}),(0,V.jsx)(r,{icon:b,busy:D===`capture`,onClick:()=>lt(),children:d(`Review flash + EEPROM capture`,`بازبینی ثبت فلش + EEPROM`)})]}),n.connected&&Ke&&(0,V.jsxs)(l,{icon:f,iconTone:`red`,title:d(`Bootloader probe failed`,`بررسی بوت‌لودر ناموفق بود`),eyebrow:d(`ISP fallback recommended`,`مسیر جایگزین ISP پیشنهاد می‌شود`),className:`isp-fallback-card`,action:(0,V.jsx)(g,{tone:`bad`,children:d(`NO BOOTLOADER ROUTE`,`بدون مسیر بوت‌لودر`)}),children:[(0,V.jsxs)(`div`,{className:`isp-guidance`,children:[(0,V.jsx)(f,{}),(0,V.jsx)(`p`,{children:d(`The host could not enter Urboot/Urclock. Connect a supported ISP programmer; the same primary host will back up what it can, program through ISP, verify the image, and restore the application lifecycle. ISP was not suggested before this failed probe.`,`میزبان نتوانست وارد Urboot/Urclock شود. یک پروگرامر ISP پشتیبانی‌شده متصل کنید؛ همان میزبان اصلی از بخش‌های ممکن پشتیبان می‌گیرد، از طریق ISP پروگرام می‌کند، تصویر را تأیید و چرخهٔ کار برنامه را بازیابی می‌کند. پیش از این بررسی ناموفق، ISP پیشنهاد نشده بود.`)})]}),(0,V.jsxs)(`div`,{className:`inline-actions`,children:[(0,V.jsx)(r,{tone:`danger`,icon:ue,disabled:!Z||Z.kind===`host-executable`,onClick:()=>Z&&st(Z,`usbasp`),children:d(`Review ISP programming`,`بازبینی پروگرام ISP`)}),(0,V.jsx)(r,{icon:oe,onClick:()=>lt(`usbasp`),children:d(`Review ISP capture`,`بازبینی ثبت با ISP`)})]})]}),(0,V.jsxs)(l,{icon:O,iconTone:`violet`,title:d(`Verified artifact inventory`,`فهرست خروجی‌های تأییدشده`),eyebrow:d(`${h.length} content-addressed artifacts`,`${h.length} خروجی محتوامحور`),className:`artifact-inventory`,action:(0,V.jsxs)(g,{tone:`info`,children:[h.length,` `,d(`UNIQUE`,`یکتا`)]}),children:[h.length?(0,V.jsx)(`div`,{className:`artifact-table-wrap`,children:(0,V.jsxs)(`table`,{className:`artifact-table`,children:[(0,V.jsx)(`thead`,{children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{"aria-label":d(`Select`,`انتخاب`)}),(0,V.jsx)(`th`,{children:d(`Artifact`,`خروجی`)}),(0,V.jsx)(`th`,{children:d(`Source`,`منبع`)}),(0,V.jsx)(`th`,{children:d(`Build / digest`,`ساخت / چکیده`)}),(0,V.jsx)(`th`,{children:d(`Size`,`اندازه`)}),(0,V.jsx)(`th`,{children:d(`Created`,`ایجاد`)}),(0,V.jsx)(`th`,{children:d(`Actions`,`عملیات`)})]})}),(0,V.jsx)(`tbody`,{children:h.map(e=>{let t=y===e.sha256,n=e.metadata,i=n?.repository||(n?.workflow_run_id?`${d(`run`,`اجرا`)} ${n.workflow_run_id}`:n?.release_id?`${d(`release`,`انتشار`)} ${n.release_id}`:``);return(0,V.jsxs)(`tr`,{className:t?`is-selected`:``,children:[(0,V.jsx)(`td`,{children:(0,V.jsx)(`input`,{type:`radio`,name:`artifact`,checked:t,"aria-label":d(`Select ${e.name}`,`انتخاب ${e.name}`),onChange:()=>x(e.sha256)})}),(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsxs)(`span`,{children:[$(e.kind,a),e.embedded?d(` · embedded`,` · تعبیه‌شده`):``,e.current?d(` · current`,` · فعلی`):``]})]}),(0,V.jsxs)(`td`,{children:[(0,V.jsx)(`strong`,{children:n?.provider||e.source}),i&&(0,V.jsx)(`span`,{children:i})]}),(0,V.jsxs)(`td`,{className:`mono`,children:[(0,V.jsx)(`strong`,{children:e.build_hash||Xe(e.sha256)}),(0,V.jsx)(`span`,{children:e.build_timestamp||e.sha256})]}),(0,V.jsx)(`td`,{className:`mono`,children:_(e.bytes)}),(0,V.jsx)(`td`,{children:ne(a,e.created_at)}),(0,V.jsx)(`td`,{children:(0,V.jsx)(r,{compact:!0,icon:fe,onClick:()=>void ut(e),children:d(`Download`,`دانلود`)})})]},`${e.kind}-${e.sha256}`)})})]})}):(0,V.jsx)(u,{icon:O,title:d(`No verified artifacts yet`,`هنوز خروجی تأییدشده‌ای وجود ندارد`),detail:d(`Stage a local or remote image, or capture the connected board.`,`یک تصویر محلی یا راه‌دور آماده کنید یا از برد متصل نسخه بگیرید.`)}),Z&&(0,V.jsxs)(`div`,{className:`artifact-selection`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{children:[d(`SELECTED`,`انتخاب‌شده`),` / `,$(Z.kind,a).toUpperCase()]}),(0,V.jsx)(`strong`,{children:Z.name}),(0,V.jsx)(`code`,{children:Z.sha256})]}),(0,V.jsx)(g,{tone:Q===`same`?`good`:Q===`newer`?`info`:Q===`older`?`warn`:`neutral`,children:Q===`same`?d(`SAME`,`یکسان`):Q===`newer`?d(`NEWER`,`جدیدتر`):Q===`older`?d(`OLDER`,`قدیمی‌تر`):d(`UNKNOWN`,`نامشخص`)}),$e(n.connected,Z.kind)&&(0,V.jsx)(r,{icon:Z.kind===`host-executable`?ce:Z.kind===`flash-backup`?pe:t,tone:`primary`,disabled:D===`update`,onClick:()=>st(Z),children:Z.kind===`host-executable`?d(`Review host self-update`,`بازبینی به‌روزرسانی میزبان`):Z.kind===`eeprom`?d(`Review EEPROM restore`,`بازبینی بازیابی EEPROM`):Z.kind===`flash-backup`?d(`Review flash restore`,`بازبینی بازیابی فلش`):d(`Review board programming`,`بازبینی پروگرام برد`)})]})]}),(0,V.jsx)(l,{icon:I,iconTone:`accent`,title:d(`Distribution paths`,`مسیرهای توزیع`),eyebrow:d(`Serve · download · bridge`,`ارائه · دانلود · پل`),className:`update-distribution-card`,children:(0,V.jsxs)(`div`,{className:`distribution-grid`,children:[(0,V.jsxs)(`article`,{children:[(0,V.jsx)(I,{}),(0,V.jsx)(`strong`,{children:d(`Authenticated serving`,`ارائهٔ معتبر`)}),(0,V.jsx)(`p`,{children:d(`Current flash, EEPROM, firmware, host packages and backups are served by exact SHA-256 through HTTP and bridge RPC.`,`فلش فعلی، EEPROM، میان‌افزار، بسته‌های میزبان و پشتیبان‌ها با SHA-256 دقیق از طریق HTTP و RPC پل ارائه می‌شوند.`)})]}),(0,V.jsxs)(`article`,{children:[(0,V.jsx)(ae,{}),(0,V.jsx)(`strong`,{children:d(`Remote synchronization`,`همگام‌سازی راه‌دور`)}),(0,V.jsx)(`p`,{children:d(`Secondary instances request staging and updates through the primary owner; they never race it for the serial port.`,`نمونه‌های ثانویه آماده‌سازی و به‌روزرسانی را از مالک اصلی درخواست می‌کنند و هرگز برای درگاه سریال با آن رقابت ندارند.`)})]}),(0,V.jsxs)(`article`,{children:[(0,V.jsx)(ve,{}),(0,V.jsx)(`strong`,{children:d(`Verified replacement`,`جایگزینی تأییدشده`)}),(0,V.jsx)(`p`,{children:d(`Size, digest, packed date/time and build hash comparisons are visible before any update is authorized.`,`مقایسهٔ اندازه، چکیده، تاریخ/زمان فشرده و هش ساخت پیش از صدور مجوز هر به‌روزرسانی دیده می‌شود.`)})]})]})})]})]})}export{nt as UpdatesView}; \ No newline at end of file diff --git a/Tools/Controller/internal/webui/dist/index.html b/Tools/Controller/internal/webui/dist/index.html index ce91cdc6..53355ef5 100644 --- a/Tools/Controller/internal/webui/dist/index.html +++ b/Tools/Controller/internal/webui/dist/index.html @@ -22,7 +22,7 @@ - + diff --git a/Tools/Controller/toolchain-lock.json b/Tools/Controller/toolchain-lock.json index 67e5252e..ed53a866 100644 --- a/Tools/Controller/toolchain-lock.json +++ b/Tools/Controller/toolchain-lock.json @@ -1,6 +1,6 @@ { "policy_name": "controllerboardmini-atmega328p", - "resolved_at_utc": "2026-10-30T01:24:36.917Z", + "resolved_at_utc": "2026-11-03T01:20:06.147Z", "firmware": { "name": "controllerboardmini-atmega328p", "fqbn": "MiniCore:avr:328:bootloader=uart0,eeprom=keep,baudrate=115200,variant=modelP,BOD=2v7,LTO=Os_flto,clock=16MHz_external", @@ -139,7 +139,7 @@ }, "go": { "version": "1.27.3", - "go_mod_sha256": "59a2cdac2bbb5146db8bc6f6419f0e5077d8b7a375ffb23b8839811b04dadbd8", - "go_sum_sha256": "12b3c9489dfcc0a34010eb558aef19853274ef42d84d4d448d51292416be1380" + "go_mod_sha256": "007c676538e2254b040b7808161626694420cda59f7d6030c16dad2268d848bd", + "go_sum_sha256": "debaacbc938cf35920da474d62d99f5bd3e0daafb79e1b315f45e8a7daefb23c" } } diff --git a/Tools/Controller/web/package-lock.json b/Tools/Controller/web/package-lock.json index 252ea786..762dcb25 100644 --- a/Tools/Controller/web/package-lock.json +++ b/Tools/Controller/web/package-lock.json @@ -848,9 +848,9 @@ } }, "node_modules/@vitejs/plugin-react": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz", - "integrity": "sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.2.1.tgz", + "integrity": "sha512-9KyWCij3r0+qLG3Q62vBmv0VyevmYibAtxaCIVK9o0k6CXgaajZRIe8tpfchQcdZArJ5b/7OrIz4W3b2uxVRDA==", "dev": true, "license": "MIT", "dependencies": { @@ -860,9 +860,9 @@ "node": "^20.19.0 || >=22.12.0" }, "peerDependencies": { - "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0 || ^0.3.0", "babel-plugin-react-compiler": "^1.0.0", - "oxc-transform-react": "^0.152.0", + "oxc-transform-react": ">=0.152.0 <0.157.0", "vite": "^8.0.0" }, "peerDependenciesMeta": { @@ -878,14 +878,14 @@ } }, "node_modules/@vitest/mocker": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz", - "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz", + "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.31", - "@vitest/spy": "5.0.5", + "@vitest/spy": "5.1.0", "estree-walker": "^3.0.3", "magic-string": "^1.4.3" }, @@ -906,9 +906,9 @@ } }, "node_modules/@vitest/spy": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz", - "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz", + "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==", "dev": true, "license": "MIT", "funding": { @@ -1096,9 +1096,9 @@ "license": "MIT" }, "node_modules/es-toolkit": { - "version": "1.53.0", - "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.53.0.tgz", - "integrity": "sha512-3+AYXp9fmJ/UhHBMYj2/U+RaUouMD90SzoItyDOB2Za7W6dB7fQApFGnZPl2MF6K8/Tv1koh1JyirSx/kju6Pw==", + "version": "1.53.1", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.53.1.tgz", + "integrity": "sha512-VhMc6IXmexu8iYFfL2aaAww6IvJTdHlqBLruLoEUs33YD4IcP5DdZcLOybMsMmmLsiy1c8PsiLsrM0DdIuuRUA==", "license": "MIT", "workspaces": [ "docs", @@ -1152,12 +1152,12 @@ } }, "node_modules/framer-motion": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-14.8.0.tgz", - "integrity": "sha512-PQsSx+UlaKiyPhADjVT5wALBErJJdbMeKQS4gQx6ibOrSNni7qjqfTKMvf6YHGG8pQWi6njs7AqrIG7R2hbnxA==", + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-14.9.0.tgz", + "integrity": "sha512-g1hZu8WoTwgsoVAaqEEcefhvR03cKGtkmrKaRrWpXhnM3LGR8jl1u2qyJ1PMVlO7LKQHE8TTRQYUlMmnrY4L+g==", "license": "MIT", "dependencies": { - "motion-dom": "14.8.0", + "motion-dom": "14.9.0", "motion-utils": "14.7.0", "tslib": "^2.4.0" }, @@ -1486,9 +1486,9 @@ } }, "node_modules/lucide-react": { - "version": "1.64.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.64.0.tgz", - "integrity": "sha512-v626F/bcLNvFom6vzztHILtG9tUgXXbgA5AGkd82YkV401+Ko/NHyrWafbPwGofa+6p/EgDJcvEkIwsMH9098w==", + "version": "1.66.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.66.0.tgz", + "integrity": "sha512-8zjbi/Us+ETXqfBwmXF/FHrWGIqOdE6zT1yUdRJLQVoptomSkB0zdFWVIM667t9K8djWDaXdkBkqi2qVTuDNiw==", "license": "ISC", "peerDependencies": { "@types/react": "*", @@ -1511,12 +1511,12 @@ } }, "node_modules/motion": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/motion/-/motion-14.8.0.tgz", - "integrity": "sha512-4KUxmgq8Lt8o/4/m8WnRicBQ+mJUMHl5Gp00o0R0+uU3NDqLwQX3GuBiqVillZl0NzOrhPuC00c5ydP6lokjmQ==", + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/motion/-/motion-14.9.0.tgz", + "integrity": "sha512-Oc+jjq/AyhwsnEUaAq2xEu/SsfKTphgsXqoxddTSLzgTdXZc6FwHcp9RLGSECccTykN1/p3gWUN4kMJAamm+1g==", "license": "MIT", "dependencies": { - "framer-motion": "14.8.0", + "framer-motion": "14.9.0", "tslib": "^2.4.0" }, "peerDependencies": { @@ -1537,9 +1537,9 @@ } }, "node_modules/motion-dom": { - "version": "14.8.0", - "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-14.8.0.tgz", - "integrity": "sha512-HzA41kvV7BgluM7L/XbW+gHFzDtJUbHnEsrlnIzPS9dqSfoPy9YzL6VKF7ai0TiQcykkkLUqvIxECAdwa9gwAw==", + "version": "14.9.0", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-14.9.0.tgz", + "integrity": "sha512-wGjKbNDMHd75aLStkxLCKZ+T8/wusZHklmNLK1Ak68UrdBt2X8I4yweYR/0WonxGnBsw6oloDTIV8pN+UTvzzA==", "license": "MIT", "dependencies": { "motion-utils": "14.7.0" @@ -1799,9 +1799,9 @@ "license": "MIT" }, "node_modules/tinybench": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz", - "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", + "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==", "dev": true, "license": "MIT", "engines": { @@ -1836,9 +1836,9 @@ } }, "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", "license": "0BSD" }, "node_modules/typescript": { @@ -1993,14 +1993,14 @@ } }, "node_modules/vitest": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz", - "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz", + "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==", "dev": true, "license": "MIT", "dependencies": { "@types/chai": "^5.2.2", - "@vitest/mocker": "5.0.5", + "@vitest/mocker": "5.1.0", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", @@ -2026,12 +2026,12 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "5.0.5", - "@vitest/browser-preview": "5.0.5", + "@vitest/browser-playwright": "5.1.0", + "@vitest/browser-preview": "5.1.0", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", - "@vitest/coverage-istanbul": "5.0.5", - "@vitest/coverage-v8": "5.0.5", - "@vitest/ui": "5.0.5", + "@vitest/coverage-istanbul": "5.1.0", + "@vitest/coverage-v8": "5.1.0", + "@vitest/ui": "5.1.0", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" diff --git a/Tools/Dependencies/resolved-tools-lock.json b/Tools/Dependencies/resolved-tools-lock.json index 7a580481..8d47a721 100644 --- a/Tools/Dependencies/resolved-tools-lock.json +++ b/Tools/Dependencies/resolved-tools-lock.json @@ -1,7 +1,7 @@ { "format": "pccontroller-host-tool-lock/v1", "policy_name": "pccontroller-host-build-tools", - "resolved_at_utc": "2026-10-30T15:53:15.066Z", + "resolved_at_utc": "2026-11-03T01:20:08.279Z", "node": { "version": "26.13.0", "lts": "Lithium", @@ -132,7 +132,7 @@ "installer_sha256": "3c69305081e4a647144339a936244fcf7d3d9e558319e1ad7be2cd2886d4b6a1" }, "web": { - "package_lock_sha256": "6796ca737cb5b71d5287a58913e776c5b2aa6a6058625a9a60dd1d046d23a8d5" + "package_lock_sha256": "eefed338385717685a75e65f4a1b030db8f3299bbad9df247748f062545abcaa" }, "build": { "package_lock_sha256": "323ac44b9417ec4a68487f026e41d4bc29199b7f40ded040de0d5b592318ca98"