@deveco/deveco-cli-common 1.3.10 → 1.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2735 -1916
  3. package/THIRD-PARTY-LICENSES +76 -46
  4. package/dist/cli.js +258 -158
  5. package/dist/design2arkts-engine/LICENSE +21 -0
  6. package/dist/design2arkts-engine/dist/index.d.ts +2739 -0
  7. package/dist/design2arkts-engine/dist/index.js +6207 -0
  8. package/dist/design2arkts-engine/package.json +40 -0
  9. package/dist/design2arkts-engine/pixso-arkts.mjs +98 -0
  10. package/dist/design2arkts-engine/resources/skill/LICENSE +21 -0
  11. package/dist/design2arkts-engine/resources/skill/SKILL.md +176 -0
  12. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/INSTRUCTIONS.md +310 -0
  13. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/evals/evals.json +249 -0
  14. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/basics-and-display.md +146 -0
  15. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/containers-and-navigation.md +527 -0
  16. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/feedback-and-overlay.md +275 -0
  17. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/hds-components.md +667 -0
  18. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/input-and-selection.md +382 -0
  19. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/data-and-form.md +440 -0
  20. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/state-management.md +213 -0
  21. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui-scoring-workflow/INSTRUCTIONS.md +164 -0
  22. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/INSTRUCTIONS.md +138 -0
  23. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/components.md +777 -0
  24. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/migration-patterns.md +187 -0
  25. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/INSTRUCTIONS.md +350 -0
  26. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-basic-mapping.md +455 -0
  27. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-common-issues.md +516 -0
  28. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/button.md +104 -0
  29. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/flex.md +115 -0
  30. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/grid.md +121 -0
  31. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/image.md +118 -0
  32. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/list.md +152 -0
  33. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/location.md +160 -0
  34. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/richeditor.md +132 -0
  35. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/row-column.md +118 -0
  36. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/stack.md +106 -0
  37. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/swiper.md +117 -0
  38. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/tabs.md +163 -0
  39. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text-input.md +147 -0
  40. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text.md +145 -0
  41. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/waterflow.md +116 -0
  42. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/index.md +23 -0
  43. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/matching.md +127 -0
  44. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/clarification-template.md +53 -0
  45. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/INSTRUCTIONS.md +163 -0
  46. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/api-architecture.md +17 -0
  47. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/data-architecture.md +17 -0
  48. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/logic-architecture.md +17 -0
  49. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/ui-architecture.md +23 -0
  50. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/behavior-audit.md +143 -0
  51. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/diff-analysis.md +115 -0
  52. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/dimension-identification.md +86 -0
  53. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/output-format.md +347 -0
  54. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/understanding-modes.md +214 -0
  55. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/INSTRUCTIONS.md +86 -0
  56. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/breakpoints.md +86 -0
  57. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/chunks.md +48 -0
  58. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/dsl-schema.md +151 -0
  59. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/patterns.md +147 -0
  60. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/rules.md +115 -0
  61. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/INSTRUCTIONS.md +572 -0
  62. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/assets/template-ui-page.md +293 -0
  63. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/references/animation-design.md +84 -0
  64. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/INSTRUCTIONS.md +195 -0
  65. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/analysis_workflow.md +119 -0
  66. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/scoring_schema.md +83 -0
  67. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/vlm_prompt.md +61 -0
  68. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/scripts/ui_score.py +691 -0
  69. package/dist/design2arkts-engine/resources/skill/references/cli-integration.md +94 -0
  70. package/dist/design2arkts-engine/resources/skill/references/design-doc-auto-recovery.md +91 -0
  71. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/01-acquire-figma-react-source.md +96 -0
  72. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/02-convert-react-to-arkui.md +92 -0
  73. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/03-complete-interaction-logic.md +26 -0
  74. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/04-quality-and-build.md +43 -0
  75. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/05-summary.md +36 -0
  76. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/01-acquire-figma-react-source.md +161 -0
  77. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/02-convert-react-to-arkui.md +219 -0
  78. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/03-complete-interaction-logic.md +31 -0
  79. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/04-quality-and-build.md +28 -0
  80. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/05-visual-calibration.md +190 -0
  81. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/06-summary.md +29 -0
  82. package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-fast.json +40 -0
  83. package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-full.json +47 -0
  84. package/dist/design2arkts-engine/resources/skill/references/host-vision.md +56 -0
  85. package/dist/design2arkts-engine/resources/skill/references/mcp-dependency.md +62 -0
  86. package/dist/design2arkts-engine/resources/skill/references/page-revisions.md +42 -0
  87. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/01-acquire-pixso-dsl.md +287 -0
  88. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/02-generate-skeleton-and-assets.md +245 -0
  89. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/03-understand-repository.md +133 -0
  90. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/05-design-component-tree.md +222 -0
  91. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/06-implement-static-layout.md +143 -0
  92. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/07-complete-interaction-logic.md +131 -0
  93. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/08-quality-build-and-audits.md +343 -0
  94. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/09-summary.md +103 -0
  95. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/01-acquire-pixso-dsl.md +287 -0
  96. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/02-generate-skeleton-and-assets.md +245 -0
  97. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/03-understand-repository.md +133 -0
  98. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/05-design-and-confirm-component-tree.md +282 -0
  99. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/06-implement-static-layout.md +143 -0
  100. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/07-complete-interaction-logic.md +131 -0
  101. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/08-quality-build-and-audits.md +343 -0
  102. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/09-visual-calibration.md +190 -0
  103. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/10-summary.md +105 -0
  104. package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-fast.json +58 -0
  105. package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-full.json +64 -0
  106. package/dist/design2arkts-engine/resources/skill/references/requirement-clarification.md +131 -0
  107. package/dist/design2arkts-engine/resources/skill/references/resource-revisions.md +13 -0
  108. package/dist/design2arkts-engine/resources/skill/references/runtime-contract.md +435 -0
  109. package/dist/design2arkts-engine/resources/skill/references/score-engine.json +5 -0
  110. package/dist/design2arkts-engine/resources/skill/references/source-tools.md +17 -0
  111. package/dist/design2arkts-engine/resources/skill/references/standalone-capabilities.md +63 -0
  112. package/dist/design2arkts-engine/resources/skill/references/workflow-origin.json +96 -0
  113. package/dist/design2arkts-engine/resources/skill/scripts/file-lock.mjs +131 -0
  114. package/dist/design2arkts-engine/resources/skill/scripts/workflow.mjs +3672 -0
  115. package/dist/design2arkts-engine/runner.mjs +44 -0
  116. package/dist/internal/plugin-hook-runner.js +1 -0
  117. package/dist/internal/telemetry-upload-background.js +44 -7
  118. package/package.json +81 -71
  119. package/skills/deveco-cli/SKILL.md +494 -335
  120. package/skills/hmos-arkui-develop-skill/SKILL.md +77 -0
  121. package/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +634 -0
  122. package/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +649 -0
  123. package/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
  124. package/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +109 -0
  125. package/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +90 -0
  126. package/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
  127. package/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
  128. package/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +120 -0
  129. package/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +118 -0
  130. package/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +89 -0
  131. package/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +152 -0
  132. package/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +127 -0
  133. package/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +52 -0
  134. package/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
  135. package/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
  136. package/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +128 -0
  137. package/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +401 -0
  138. package/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
  139. package/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +76 -0
  140. package/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
  141. package/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
  142. package/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
  143. package/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
  144. package/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
  145. package/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
  146. package/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
  147. package/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
  148. package/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
  149. package/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
  150. package/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
  151. package/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
  152. package/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
  153. package/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
  154. package/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
  155. package/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
  156. package/skills/hmos-arkui-develop-skill/references/style-guide.md +491 -0
  157. package/skills/hmos-arkui-develop-skill/test-cases/code_gen_cases.json +292 -0
  158. package/skills/hmos-dfx-analyzer/SKILL.md +683 -0
  159. package/skills/hmos-dfx-analyzer/changelog/CHANGELOG.md +17 -0
  160. package/skills/hmos-dfx-analyzer/evals/evals.json +119 -0
  161. package/skills/hmos-dfx-analyzer/references/appfreeze/analyzer.md +471 -0
  162. package/skills/hmos-dfx-analyzer/references/appfreeze/references/fault-mode-library.md +94 -0
  163. package/skills/hmos-dfx-analyzer/references/appfreeze/references/ffrt-freeze-analysis.md +132 -0
  164. package/skills/hmos-dfx-analyzer/references/appfreeze/references/libuv-freeze-analysis.md +116 -0
  165. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/__init__.py +40 -0
  166. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/binder.py +343 -0
  167. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/collector.py +84 -0
  168. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/common.py +132 -0
  169. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/faultlog.py +212 -0
  170. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/main.py +81 -0
  171. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/report.py +675 -0
  172. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/sections.py +377 -0
  173. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/stack.py +165 -0
  174. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/llvm_addr2line.py +123 -0
  175. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/match_so.py +120 -0
  176. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/sample_stack_analyzer.py +209 -0
  177. package/skills/hmos-dfx-analyzer/references/cppcrash/analyzer.md +470 -0
  178. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkdata.md +325 -0
  179. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkui.md +266 -0
  180. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkweb.md +144 -0
  181. package/skills/hmos-dfx-analyzer/references/cppcrash/references/fault_mode.md +178 -0
  182. package/skills/hmos-dfx-analyzer/references/cppcrash/references/gwp_asan.md +300 -0
  183. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsruntime.md +339 -0
  184. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsvm.md +203 -0
  185. package/skills/hmos-dfx-analyzer/references/cppcrash/references/libuv.md +166 -0
  186. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption.md +348 -0
  187. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption_second_scene.md +74 -0
  188. package/skills/hmos-dfx-analyzer/references/cppcrash/references/multithreading.md +284 -0
  189. package/skills/hmos-dfx-analyzer/references/cppcrash/references/render_service.md +300 -0
  190. package/skills/hmos-dfx-analyzer/references/cppcrash/references/rosen_text.md +41 -0
  191. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/__init__.py +36 -0
  192. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/collector.py +93 -0
  193. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/common.py +68 -0
  194. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/crash_log.py +275 -0
  195. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/extract_hilog.py +69 -0
  196. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/hints.py +251 -0
  197. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/main.py +82 -0
  198. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/match_so.py +120 -0
  199. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/ohos_llvm_tools.py +279 -0
  200. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/report.py +226 -0
  201. package/skills/hmos-dfx-analyzer/references/jscrash/analyzer.md +174 -0
  202. package/skills/hmos-dfx-analyzer/references/jscrash/references/fault-mode-library.md +107 -0
  203. package/skills/hmos-dfx-analyzer/references/jscrash/references/jscrash-patterns.md +92 -0
  204. package/skills/hmos-dfx-analyzer/references/jscrash/references/sourcemap-symbolication.md +67 -0
  205. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack +25 -0
  206. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack.bat +26 -0
  207. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js +2 -0
  208. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js.LICENSE.txt +1 -0
  209. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/mappings.wasm +0 -0
  210. package/skills/hmos-dfx-analyzer/references/white-screen/analyzer.md +129 -0
  211. package/skills/hmos-dfx-analyzer/scripts/collect/collect-hilog.mjs +120 -0
  212. package/skills/hmos-dfx-analyzer/scripts/collect/jscrash-report.mjs +138 -0
  213. package/skills/hmos-dfx-analyzer/scripts/collect/parse-jscrash-log.mjs +126 -0
  214. package/skills/hmos-dfx-analyzer/scripts/collect/shared/deveco-cli.mjs +79 -0
  215. package/skills/hmos-dfx-analyzer/scripts/collect/shared/jscrash-parse.mjs +389 -0
  216. package/skills/hmos-dfx-analyzer/scripts/collect/shared/utils.mjs +27 -0
  217. package/skills/hmos-dfx-analyzer/scripts/export_report.py +373 -0
  218. package/skills/hmos-dfx-analyzer/scripts/identify_fault_log.py +500 -0
  219. package/skills/hmos-dfx-analyzer/scripts/report_template.html +103 -0
  220. package/skills/hmos-dfx-analyzer/test-cases/functional.md +112 -0
  221. package/skills/hmos-dfx-analyzer/test-cases/smoke.md +86 -0
  222. package/skills/hmos-dfx-analyzer/test-cases/test-prompts.md +35 -0
  223. package/skills/hmos-dfx-analyzer/test-cases/trigger.md +121 -0
  224. package/skills/index.json +17 -0
  225. package/src/resources/aclPermission/aclPermissionsInfo.json +310 -310
  226. package/src/resources/arkts-check.cjs +3833 -3671
  227. package/templates/application/AppScope/app.json5 +10 -10
  228. package/templates/application/AppScope/resources/base/element/string.json +8 -8
  229. package/templates/application/AppScope/resources/base/media/layered_image.json +6 -6
  230. package/templates/application/build-profile.json5 +41 -41
  231. package/templates/application/code-linter.json5 +31 -31
  232. package/templates/application/entry/build-profile.json5 +32 -32
  233. package/templates/application/entry/gitignore.txt +5 -5
  234. package/templates/application/entry/hvigorfile.ts +7 -7
  235. package/templates/application/entry/obfuscation-rules.txt +19 -19
  236. package/templates/application/entry/oh-package.json5 +10 -10
  237. package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +62 -62
  238. package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +30 -30
  239. package/templates/application/entry/src/main/ets/pages/Index.ets +37 -37
  240. package/templates/application/entry/src/main/module.json5 +49 -49
  241. package/templates/application/entry/src/main/resources/base/element/color.json +7 -7
  242. package/templates/application/entry/src/main/resources/base/element/float.json +8 -8
  243. package/templates/application/entry/src/main/resources/base/element/string.json +15 -15
  244. package/templates/application/entry/src/main/resources/base/media/layered_image.json +6 -6
  245. package/templates/application/entry/src/main/resources/base/profile/backup_config.json +2 -2
  246. package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -5
  247. package/templates/application/entry/src/main/resources/dark/element/color.json +7 -7
  248. package/templates/application/gitignore.txt +12 -12
  249. package/templates/application/hvigor/hvigor-config.json5 +23 -23
  250. package/templates/application/hvigorfile.ts +7 -7
  251. package/templates/application/oh-package.json5 +10 -10
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Copyright (c) 2026 Huawei Device Co., Ltd.
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ var _e=new Set,Vt=null,Ne=new Map;function _i(t){return Ne.get(t)??0}function Ni(t){_e=t}function Mi(){_e=new Set}function Ei(t){Vt=t}function Pi(){Vt=null}function Oi(){Ne=new Map}function ot(t,e=0){if(typeof t=="number")return t;if(typeof t=="string"){const n=parseFloat(t);return isNaN(n)?e:n}return e}function Li(t){if(!t)return[0,0];const e=t.margin;if(e===void 0)return[ot(t.marginTop),ot(t.marginBottom)];if(typeof e=="number")return[e,e];if(typeof e=="string"){const o=e.trim().split(/\s+/).map(r=>parseFloat(r)||0);return o.length===1?[o[0],o[0]]:o.length===2?[o[0],o[0]]:o.length===3?[o[0],o[2]]:[o[0]||0,o[2]||0]}const n=e;return[ot(n.top),ot(n.bottom)]}function _n(t){const e=t.styles??{},n=ot(e.height,0),[o,r]=Li(e);return n+o+r}function Fi(t){var e;const n=t.styles;return n?.top!==void 0?ot(n.top):(e=t.meta)!=null&&e.bbox&&t.meta.bbox.length>=4?t.meta.bbox[1]:0}function Bi(t){var e;const n=((e=t.meta)==null?void 0:e.octoName)??t.name,o=typeof n=="string"?n:String(n??"");if(o.endsWith("StatusBar")||o.endsWith("Aibottombar")||o.endsWith("BottomBar"))return!0;if(o==="\u77E9\u5F62"&&t.styles){const r=t.styles,i=r.position==="absolute"||t.componentName==="Stack",s=r.backdropFilter,a=typeof s=="string"&&s.includes("blur");if(i&&a){const c=_n(t);if(c>0&&c<10)return!0}}return!1}function zi(t,e){var n,o,r,i,s,a,c;const l=new Set;let u=1/0,f=0,d=1/0,g=0,m=null;const h=new Map;function p(v,k){var I,M;for(const L of v){const E=(I=L.meta)==null?void 0:I.octoId;if(!E)continue;const P=(M=L.styles)==null?void 0:M.height;if(P===void 0||isNaN(typeof P=="number"?P:parseFloat(String(P)))||typeof P=="string"&&P.includes("%"))continue;const O=h.get(E)??0;h.set(E,Math.max(O,k))}}function y(v,k,I){var M,L,E,P;const O=((M=v.meta)==null?void 0:M.octoName)??v.name,J=typeof O=="string"?O:String(O??"");if(Bi(v)){const V=(L=v.meta)==null?void 0:L.octoId;V&&l.add(V),!m&&((E=k?.meta)!=null&&E.octoId)&&(m=k.meta.octoId);const Q=Fi(v),j=_n(v);J.includes("StatusBar")?(u=Math.min(u,Q),f=Math.max(f,Q+j)):J.includes("BottomBar")&&(d=Math.min(d,Q),g=Math.max(g,Q+j)),p(I,j)}if((P=v.children)!=null&&P.length)for(const V of v.children)y(V,v,[...I,v])}for(const v of t)y(v,null,[]);const b=f>0&&u!==1/0?f-u:0,x=g>0&&d!==1/0?g-d:0;if(b>0){if(e){const v=(n=e.styles)==null?void 0:n.height,k=(o=e.meta)==null?void 0:o.octoId;if(v!==void 0&&k&&!(typeof v=="string"&&v.includes("%"))){const I=h.get(k)??0;h.set(k,Math.max(I,b))}}else if(t.length>0)for(const v of t){const k=(r=v.styles)==null?void 0:r.height;if(k===void 0||typeof k=="string"&&k.includes("%"))continue;const I=(i=v.meta)==null?void 0:i.octoId;if(!I)continue;const M=h.get(I)??0;h.set(I,Math.max(M,b));break}}if(e&&b>0){const v=ot((s=e.styles)==null?void 0:s.height,0),k=e.children??[];for(const I of k){if(I.componentName!=="Image")continue;const M=ot((a=I.styles)==null?void 0:a.height,0);if(M<=0||Math.abs(M-v)>100)continue;const L=(c=I.meta)==null?void 0:c.octoId;if(!L)continue;const E=h.get(L)??0;h.set(L,Math.max(E,b))}}return Ne=h,{skipGuids:l,systemBarsInfo:b>0||x>0?{statusBarHeight:b,statusBarTop:u===1/0?0:u,bottomBarHeight:x,bottomBarBottom:g,compensationContainerGuid:m}:null}}function Di(t){var e;const n=(e=t.meta)==null?void 0:e.octoId;return n?_e.has(n):!1}function ji(t){if(!t||!Vt)return t;const{statusBarHeight:e,statusBarTop:n,bottomBarHeight:o}=Vt,r={...t};return r.y!==void 0&&r.y>=n&&e>0&&(r.y=Math.max(0,r.y-e)),r.bottom!==void 0&&o>0&&(r.bottom=r.bottom+o),r}function ct(t){t=t.trim();const e=t.match(/^rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)$/i);if(e){const n=parseInt(e[1]).toString(16).padStart(2,"0"),o=parseInt(e[2]).toString(16).padStart(2,"0"),r=parseInt(e[3]).toString(16).padStart(2,"0");return`#${e[4]!==void 0?Math.round(parseFloat(e[4])*255).toString(16).padStart(2,"0"):"FF"}${n}${o}${r}`.toUpperCase()}if(!t.startsWith("#"))return t;if(/^#[0-9a-fA-F]{3}$/.test(t)){const n=t[1],o=t[2],r=t[3];return`#${n}${n}${o}${o}${r}${r}`.toUpperCase()}if(/^#[0-9a-fA-F]{4}$/.test(t)){const n=t[1],o=t[2],r=t[3],i=t[4];return`#${i}${i}${n}${n}${o}${o}${r}${r}`.toUpperCase()}return/^#[0-9a-fA-F]{8}$/.test(t)||/^#[0-9a-fA-F]{6}$/.test(t)?t.toUpperCase():t}function Hi(t){if(t.startsWith("http://")||t.startsWith("https://"))return`"${t}"`;const e=t.replace(/^.*[\\/]/,"").replace(/\.[^.]+$/,"").replace(/-/g,"_");return e?`$r('app.media.${e}')`:'""'}function X(t){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)}function Nn(t){if(t===void 0)return"";if(typeof t=="number")return String(t);if(typeof t=="string")return t;const e=[];if(t.top!==void 0){const n=typeof t.top=="string"&&X(t.top)?t.top:String(t.top);e.push(`top: ${n}`)}if(t.right!==void 0){const n=typeof t.right=="string"&&X(t.right)?t.right:String(t.right);e.push(`right: ${n}`)}if(t.bottom!==void 0){const n=typeof t.bottom=="string"&&X(t.bottom)?t.bottom:String(t.bottom);e.push(`bottom: ${n}`)}if(t.left!==void 0){const n=typeof t.left=="string"&&X(t.left)?t.left:String(t.left);e.push(`left: ${n}`)}return e.length===0?"":e.length===1?`{ ${e[0].split(": ")[0]}: ${e[0].split(": ")[1]} }`:`{ ${e.join(", ")} }`}function Gi(t){const e=(Array.isArray(t)?t:[t])[0];return`.shadow({ radius: ${e.radius??0}, color: ${e.color?`"${ct(e.color)}"`:"Color.Black"}, offsetX: ${e.offsetX??0}, offsetY: ${e.offsetY??0} })`}function Wi(t){const e=t.match(/linear-gradient\s*\((.+)\)\s*$/is);if(!e)return null;const n=e[1],o=[];let r=0,i="";for(const d of n)d==="("?(r++,i+=d):d===")"?(r--,i+=d):d===","&&r===0?(o.push(i.trim()),i=""):i+=d;if(i.trim()&&o.push(i.trim()),o.length<2)return null;let s=180,a=0;const c=o[0].trim(),l=c.match(/^(-?\d+(?:\.\d+)?)\s*deg$/i);l?(s=parseFloat(l[1]),a=1):/^to\s+/i.test(c)&&(s={bottom:180,top:0,right:90,left:270}[c.replace(/^to\s+/i,"").trim().toLowerCase()]??180,a=1);const u=[],f=o.length-a;for(let d=a;d<o.length;d++){const g=o[d].trim(),m=g.lastIndexOf(" ");let h,p;if(m!==-1){const x=g.slice(m+1).trim();/^[\d.]+%?$/.test(x)?(h=g.slice(0,m).trim(),p=x):(h=g,p="")}else h=g,p="";const y=Vi(h);let b;p.endsWith("%")?b=String(parseFloat(p)/100):p?b=p:b=String(Math.round((d-a)/(f-1)*1e3)/1e3),u.push(`['${y}', ${b}]`)}return`.linearGradient({ angle: ${s}, colors: [${u.join(", ")}] })`}function Vi(t){return ct(t)}function Ui(t){if(typeof t=="number"||typeof t=="string")return String(t);const e=t,n=e.topLeft??0,o=e.topRight??0,r=e.bottomRight??0,i=e.bottomLeft??0;return n===o&&o===r&&r===i?String(n):`{ topLeft: ${n}, topRight: ${o}, bottomRight: ${r}, bottomLeft: ${i} }`}var Xi={Start:"HorizontalAlign.Start",End:"HorizontalAlign.End",Center:"HorizontalAlign.Center",Stretch:"HorizontalAlign.Center"},Ki={Start:"VerticalAlign.Top",End:"VerticalAlign.Bottom",Center:"VerticalAlign.Center",Stretch:"VerticalAlign.Center"},Yi=new Set(["alignItems","justifyContent","space","flexDirection","columnsTemplate","rowsTemplate","columnsGap","rowsGap"]),Mn=["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"],En=["marginTop","marginRight","marginBottom","marginLeft"],Pn=["paddingTop","paddingRight","paddingBottom","paddingLeft"];function Zi(t){const e=["top","right","bottom","left"],n=[],o=[],r=[];for(const i of e){const s=i.charAt(0).toUpperCase()+i.slice(1),a=`border${s}Width`,c=`border${s}Color`,l=`border${s}Style`,u=t[a],f=t[c],d=t[l];if(u!==void 0||f!==void 0||d!==void 0){const g=u!==void 0?qi(String(u)):0;n.push(`${i}: ${g}`);const m=f?`"${ct(String(f))}"`:'"#000000"';o.push(`${i}: ${m}`);const h=d==="Dashed"?"BorderStyle.Dashed":d==="Dotted"?"BorderStyle.Dotted":"BorderStyle.Solid";r.push(`${i}: ${h}`)}}return n.length===0?null:`.border({ width: { ${n.join(", ")} }, color: { ${o.join(", ")} }, style: { ${r.join(", ")} } })`}function qi(t){const e=t.match(/^([\d.]+)\s*px$/i);return e?parseFloat(e[1]):parseFloat(t)||0}function Ji(t){const e=[],n=Qi(t);for(const o of n){const r=o.trim();if(!r)continue;const i=r.startsWith("inset");let s=r;i&&(s=s.replace(/^inset\s+/,""));let a="";const c=s.match(/^(rgba?\s*\([^)]+\)|#[0-9a-fA-F]{3,8})\s*(.*)$/i);if(c)a=c[1],s=c[2];else{const d=s.match(/^(.*?)\s+(rgba?\s*\([^)]+\)|#[0-9a-fA-F]{3,8})\s*$/i);d&&(a=d[2],s=d[1])}const l=[],u=/(-?[\d.]+)(px)?/g;let f;for(;(f=u.exec(s))!==null;)l.push(parseFloat(f[1]));e.push({offsetX:l[0]??0,offsetY:l[1]??0,radius:l[2]??0,spread:l[3]??0,color:a||"#000000",inset:i})}return e}function Qi(t){const e=[];let n=0,o="";for(const r of t)r==="("?(n++,o+=r):r===")"?(n--,o+=r):r===","&&n===0?(e.push(o.trim()),o=""):o+=r;return o.trim()&&e.push(o.trim()),e}function ts(t){const e=t.trim().toLowerCase();return!!(e==="transparent"||/^#0{4}$/i.test(e)||/^#0{8}$/i.test(e)||e.match(/^rgba\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*0(?:\.0*)?\s*\)$/))}function es(t){const e=Ji(t);if(e.length===0)return null;let n=null;for(const o of e)if(!o.inset&&!ts(o.color)){n=o;break}if(!n){for(const o of e)if(!o.inset){n=o;break}}return n?`.shadow({ radius: ${Math.max(n.radius,.1)}, color: ${`"${ct(n.color)}"`}, offsetX: ${n.offsetX}, offsetY: ${n.offsetY} })`:null}var ns=new Set(["fontSize","fontColor","fontWeight","lineHeight","textAlign","fontFamily"]),os=new Set(["Column","Row","Stack","Scroll","Flex","List","ListItem","Grid","HdsListItem","HdsListItemCard","HdsActionBar","HdsNavDestination","HdsNavigation","HdsSideBar","HdsSideMenu","HdsSnackBar","HdsTabs","HdsVisualComponent","Button","Search","Toggle","Image"]),rs=new Set(["Stack","List","ListItem","Navigation"]);function is(t){const e={...t};if(En.some(n=>t[n]!==void 0)){const n=t.margin;let o;typeof n=="number"?o={top:n,right:n,bottom:n,left:n}:typeof n=="object"&&n!==null?o={...n}:o={},t.marginTop!==void 0&&t.marginTop!=="auto"&&(o.top=t.marginTop),t.marginRight!==void 0&&t.marginRight!=="auto"&&(o.right=t.marginRight),t.marginBottom!==void 0&&t.marginBottom!=="auto"&&(o.bottom=t.marginBottom),t.marginLeft!==void 0&&t.marginLeft!=="auto"&&(o.left=t.marginLeft),e.margin=o}if(Pn.some(n=>t[n]!==void 0)){const n=t.padding;let o;typeof n=="number"?o={top:n,right:n,bottom:n,left:n}:typeof n=="object"&&n!==null?o={...n}:o={},t.paddingTop!==void 0&&(o.top=t.paddingTop),t.paddingRight!==void 0&&(o.right=t.paddingRight),t.paddingBottom!==void 0&&(o.bottom=t.paddingBottom),t.paddingLeft!==void 0&&(o.left=t.paddingLeft),e.padding=o}return e}function ss(t,e,n,o){if(!t)return[];const r=[],i=is(t),s=os.has(e);for(const[a,c]of Object.entries(i))if(!(c==null||Yi.has(a))&&!(s&&ns.has(a))&&!(En.includes(a)||Pn.includes(a))&&!Mn.includes(a))switch(a){case"width":typeof c=="number"?r.push(`${n}.width(${c})`):typeof c=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(c)?r.push(`${n}.width(${c})`):r.push(`${n}.width("${c}")`);break;case"height":typeof c=="number"?r.push(`${n}.height(${c})`):typeof c=="string"&&X(c)?r.push(`${n}.height(${c})`):r.push(`${n}.height("${c}")`);break;case"backgroundColor":o?.skipBackgroundColor||(typeof c=="string"&&X(c)?r.push(`${n}.backgroundColor(${c})`):r.push(`${n}.backgroundColor("${ct(String(c))}")`));break;case"backgroundImage":{if(o?.skipBackgroundImage)break;const l=String(c).match(/url\(["']?([^"')]+)["']?\)/);if(l){const u=l[1],f=Hi(u);r.push(`${n}.backgroundImage(${f})`)}break}case"backgroundSize":{if(o?.skipBackgroundImage)break;const l=String(c).trim().toLowerCase();l==="cover"||l==="100%"||l==="100% 100%"?r.push(`${n}.backgroundImageSize(ImageSize.Cover)`):l==="contain"?r.push(`${n}.backgroundImageSize(ImageSize.Contain)`):r.push(`${n}.backgroundImageSize(ImageSize.Auto)`);break}case"borderRadius":{if(o?.skipBorderRadius)break;const l=Ui(c);r.push(`${n}.borderRadius(${l})`);break}case"margin":{let l=c;if(o?.hasPosition&&typeof l=="object"&&l!==null){const f={...l};delete f.top,delete f.left,l=f}const u=Nn(l);u&&r.push(`${n}.margin(${u})`);break}case"padding":{const l=Nn(c);l&&r.push(`${n}.padding(${l})`);break}case"fontSize":typeof c=="number"?r.push(`${n}.fontSize(${c})`):typeof c=="string"&&X(c)?r.push(`${n}.fontSize(${c})`):r.push(`${n}.fontSize(${c})`);break;case"fontColor":typeof c=="string"&&X(c)?r.push(`${n}.fontColor(${c})`):r.push(`${n}.fontColor("${ct(String(c))}")`);break;case"fontWeight":typeof c=="number"?r.push(`${n}.fontWeight(${c})`):typeof c=="string"&&X(c)?r.push(`${n}.fontWeight(${c})`):c==="bold"?r.push(`${n}.fontWeight(FontWeight.Bold)`):c==="normal"?r.push(`${n}.fontWeight(FontWeight.Normal)`):r.push(`${n}.fontWeight(${c})`);break;case"lineHeight":typeof c=="number"?r.push(`${n}.lineHeight(${c})`):typeof c=="string"&&X(c)?r.push(`${n}.lineHeight(${c})`):r.push(`${n}.lineHeight(${c})`);break;case"textAlign":{const l=String(c).toLowerCase(),u={center:"TextAlign.Center",right:"TextAlign.End",end:"TextAlign.End",left:"TextAlign.Start",start:"TextAlign.Start"};u[l]&&r.push(`${n}.textAlign(${u[l]})`);break}case"objectFit":{const l=String(c),u={Cover:"ImageFit.Cover",Contain:"ImageFit.Contain",Fill:"ImageFit.Fill",Auto:"ImageFit.Auto",ScaleDown:"ImageFit.ScaleDown",None:"ImageFit.None"};u[l]&&r.push(`${n}.objectFit(${u[l]})`);break}case"fontFamily":r.push(`${n}.fontFamily("${c}")`);break;case"opacity":r.push(`${n}.opacity(${c})`);break;case"layoutWeight":r.push(`${n}.layoutWeight(${c})`);break;case"overflow":c==="hidden"&&r.push(`${n}.clip(true)`);break;case"border":{const l=c;if(l.width!==void 0||l.color!==void 0||l.style!==void 0){const u=typeof l.width=="number"?l.width:0,f=l.color?`"${ct(l.color)}"`:'"#000000"',d=l.style==="Dashed"?"BorderStyle.Dashed":l.style==="Dotted"?"BorderStyle.Dotted":"BorderStyle.Solid";r.push(`${n}.border({ width: ${u}, color: ${f}, style: ${d} })`)}break}case"shadow":r.push(`${n}${Gi(c)}`);break;case"linearGradient":{const l=Wi(String(c));l&&r.push(`${n}${l}`);break}case"boxShadow":{const l=es(String(c));l&&r.push(`${n}${l}`);break}case"backdropFilter":{const l=String(c).trim().match(/blur\(\s*([\d.]+)\s*px\s*\)/i);l&&r.push(`${n}.backdropBlur(${l[1]})`);break}default:if(Mn.some(l=>i[l]!==void 0)){const l=Zi(i);l&&r.push(`${n}${l}`)}break}return r}function On(t,e,n){if(!t)return[];const o=[],r=t.alignItems,i=t.justifyContent,s={Start:"FlexAlign.Start",End:"FlexAlign.End",Center:"FlexAlign.Center",SpaceBetween:"FlexAlign.SpaceBetween","Space-between":"FlexAlign.SpaceBetween",SpaceAround:"FlexAlign.SpaceAround","Space-around":"FlexAlign.SpaceAround",SpaceEvenly:"FlexAlign.SpaceEvenly","Space-evenly":"FlexAlign.SpaceEvenly"};if(i&&s[i]&&o.push(`${n}.justifyContent(${s[i]})`),!rs.has(e)){const a=e==="Row",c=r||"Start",l=a?Ki:Xi;l[c]&&o.push(`${n}.alignItems(${l[c]})`)}return o}function as(t,e){if(!t)return[];const n=[];return t.columnsTemplate&&n.push(`${e}.columnsTemplate('${t.columnsTemplate}')`),t.rowsTemplate&&n.push(`${e}.rowsTemplate('${t.rowsTemplate}')`),t.columnsGap!==void 0&&n.push(`${e}.columnsGap(${t.columnsGap})`),t.rowsGap!==void 0&&n.push(`${e}.rowsGap(${t.rowsGap})`),n}function Me(t){return t?.space?`{ space: ${t.space} }`:""}var lt=new Map,cs=new Set;function ls(t){const e=t.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/);return e?{names:e[1].split(",").map(n=>n.trim()).filter(Boolean),module:e[2]}:null}function Ee(t){const e=ls(t);if(e){lt.has(e.module)||lt.set(e.module,new Set);const n=lt.get(e.module);for(const o of e.names)n.add(o)}else lt.has(t)||lt.set(t,new Set)}function us(){const t=[];for(const[e,n]of lt)if(n.size>0){const o=[...n].join(", ");t.push(`import { ${o} } from '${e}';`)}else t.push(e);return t}function fs(){lt.clear(),cs.clear()}var ds=new Set(["text","fontSize","fontColor","activatedFontColor","fontFamily","labelMargin","localizedLabelMargin"]);function gs(t){return t.replace(/\\/g,"\\\\").replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n").replace(/\t/g," ").replace(/"/g,'\\"')}function ms(t,e,n,o){var r;const i=" ".repeat(e),s=(r=t.children)==null?void 0:r[0];Ee("import { Chip, LengthMetrics } from '@kit.ArkUI';");const a=["allowClose: false","enabled: true"];if(a.unshift(`label: {
6
+ ${o} text: "\u64CD\u4F5C\u5757"
7
+ ${o}}`),s?.componentName==="Row"&&s.styles){const c=s.styles;if(c.width!==void 0||c.height!==void 0){const f=c.width??0,d=c.height??0;a.push(`size: { width: ${f}, height: ${d} }`)}if(c.padding&&typeof c.padding=="object"){const f=c.padding;a.push(`padding: { top: LengthMetrics.vp(${f.top??0}), end: LengthMetrics.vp(${f.right??0}), bottom: LengthMetrics.vp(${f.bottom??0}), start: LengthMetrics.vp(${f.left??0}) }`)}const l=[],u=new Set(["width","height","padding","overflow","position","left","top"]);for(const[f,d]of Object.entries(c))u.has(f)||(typeof d=="string"?l.push(`${f}: "${d}"`):typeof d=="number"?l.push(`${f}: ${d}`):typeof d=="boolean"&&l.push(`${f}: ${d}`));a.push(...l)}if(s?.children){const c=s.children.find(l=>l.componentName==="Text");if(c){const l=[];c.content&&l.push(`text: "${gs(c.content)}"`);const u=c.styles??{};for(const f of ds)if(f!=="text"&&u[f]!==void 0){const d=u[f];typeof d=="string"?l.push(`${f}: "${d}"`):typeof d=="number"&&l.push(`${f}: ${d}`)}if(l.length>0){const f=a.findIndex(g=>g.startsWith("label: {")),d=`label: {
8
+ ${o} ${l.join(`,
9
+ `+o+" ")}
10
+ ${o}}`;f>=0?a[f]=d:a.push(d)}}}return`${i}Chip({
11
+ ${a.map(c=>`${o}${c}`).join(`,
12
+ `)}
13
+ ${i}})`}function hs(t,e,n,o){var r,i;const s=ms(t,e,n,o);if(t.styles&&t.styles.position==="absolute"){const a=" ".repeat(e),c=((r=t.styles)==null?void 0:r.left)??0,l=((i=t.styles)==null?void 0:i.top)??0,u=c-(n?.left??0),f=l-(n?.top??0);return s+(u===0&&f===0?`
14
+ ${a}.position({ x: 0, y: 0 })`:`
15
+ ${a}.position({ x: ${u}, y: ${f} })`)}return s}function ps(t,e,n,o,r,i,s){var a;const c=" ".repeat(e),l=" ".repeat(e+1),u=o?.position==="absolute",f=t.content??"",d=r(o,"Text",l,{hasPosition:u});return[`${c}Text(${((a=t.meta)==null?void 0:a.isParamRef)===!0?f:`"${s(f)}"`})`,...d].join(`
16
+ `)+i(t,c,n)}function ys(t,e,n,o,r,i,s){const a=" ".repeat(e),c=" ".repeat(e+1),l=o?.position==="absolute",u=s(t.src??""),f=r(o,"Image",c,{hasPosition:l,skipBackgroundImage:!0,skipBackgroundColor:!0});return[`${a}Image(${u})`,...f].join(`
17
+ `)+i(t,a,n)}function bs(t,e,n,o,r,i,s,a,c,l){const u=" ".repeat(e),f=" ".repeat(e+1),d=r?.position==="absolute",g=t.src?a(t.src):"",m=i(r,"Button",f,{hasPosition:d}),h=r?.backgroundColor?"":`${f}.backgroundColor(Color.Transparent)`;if(o.length>0){const p=c(t),y=o.map(b=>l(b,e+1,p));return[`${u}Button() {`,...y,`${u}}`,h,...m].filter(Boolean).join(`
18
+ `)+s(t,u,n)}return g?[`${u}Button() {`,`${f}Image(${g})`,`${u}}`,h,...m].filter(Boolean).join(`
19
+ `)+s(t,u,n):[`${u}Button()`,h,...m].filter(Boolean).join(`
20
+ `)+s(t,u,n)}function vs(t,e,n,o,r,i,s,a,c){const l=" ".repeat(e),u=i(r,"Search"," ".repeat(e+1),{hasPosition:r?.position==="absolute"}),f=a(t)||t.content||"";return[`${l}Search(${f?`{ placeholder: "${c(f)}" }`:""})`,...u].join(`
21
+ `)+s(t,l,n)}function xs(t,e,n,o,r,i,s,a,c){const l=" ".repeat(e),u=i(r,"Select"," ".repeat(e+1),{hasPosition:r?.position==="absolute"}),f=o.map(g=>{const m=a(g)||g.content||"";return m?`{ value: "${c(m)}" }`:null}).filter(g=>g!==null);let d="";return f.length>0?d=`[${f.join(", ")}]`:d='[{ value: "aaa" }]',[`${l}Select(${d})`,...u].join(`
22
+ `)+s(t,l,n)}function ws(t,e,n,o,r,i){const s=" ".repeat(e),a=r(o,"Radio"," ".repeat(e+1),{hasPosition:o?.position==="absolute"});return[`${s}Radio({ value: '', group: '' })`,...a].join(`
23
+ `)+i(t,s,n)}function Ss(t,e,n,o,r,i){const s=" ".repeat(e),a=r(o,"Toggle"," ".repeat(e+1),{hasPosition:o?.position==="absolute",skipBackgroundColor:!0,skipBorderRadius:!0});return[`${s}Toggle({ type: ToggleType.Switch, isOn: true })`,...a].join(`
24
+ `)+i(t,s,n)}function ks(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"Slider",a,{hasPosition:o?.position==="absolute",skipBackgroundColor:!0,skipBorderRadius:!0});return[`${s}Slider({ style: SliderStyle.InSet, value: 50 })`,`${a}.showTips(true)`,...c].join(`
25
+ `)+i(t,s,n)}var $s=new Set(["HdsListItem","HdsListItemCard","HdsActionBar","HdsNavDestination","HdsNavigation","HdsSideBar","HdsSideMenu","HdsSnackBar","HdsTabs","HdsVisualComponent"]);function Is(t,e,n,o,r,i,s,a,c){const l=" ".repeat(n),u=" ".repeat(n+1),f=t.styles,d=t.children??[],g=r(f,e,u,{hasPosition:f?.position==="absolute"}),m=i(f,e,u),h=a(t);if(e==="HdsListItem")return As(t,n,g,m,c)+s(t,l,o);const p=d.map(y=>c(y,n+1,h));return p.length>0?[`${l}${e}() {`,...p,`${l}}`,...m,...g].join(`
26
+ `)+s(t,l,o):[`${l}${e}()`,...m,...g].join(`
27
+ `)+s(t,l,o)}function As(t,e,n,o,r){const i=" ".repeat(e),s=" ".repeat(e+1),a=(t.children??[]).map(c=>r(c,e+2));return[`${i}ListItem() {`,`${s}Row() {`,...a,`${s}}`,...o.map(c=>`${s}${c.replace(s,"").trimStart()}`),...n.map(c=>`${s}${c.replace(s,"").trimStart()}`),`${i}}`].join(`
28
+ `)}function Rs(t,e,n,o,r,i,s,a,c){const l=" ".repeat(e),u=i(r,"Scroll"," ".repeat(e+1),{hasPosition:r?.position==="absolute"}),f=a(t),d=o.map(g=>c(g,e+1,f));return[`${l}Scroll() {`,...d,`${l}}`,...u].join(`
29
+ `)+s(t,l,n)}function Cs(t,e,n,o,r,i,s,a,c,l){const u=" ".repeat(e),f=i(r,"List"," ".repeat(e+1),{hasPosition:r?.position==="absolute"}),d=a(t),g=o.map(m=>Ts(m,e+1,d,c,l));return[`${u}List(${Me(r)}) {`,...g,`${u}}`,...f].join(`
30
+ `)+s(t,u,n)}function Ts(t,e,n,o,r){var i;const s=" ".repeat(e),a=" ".repeat(e+1);if(t.componentName==="ListItem")return o(t,e,n);const c=o(t,e+2,n);return r(t)&&(((i=t.children)==null?void 0:i.length)??0)>1?`${s}ListItem() {
31
+ ${a}Column() {
32
+ ${c}
33
+ ${a}}
34
+ ${s}}`:`${s}ListItem() {
35
+ ${c}
36
+ ${s}}`}function _s(t,e,n,o,r,i,s,a,c,l){const u=" ".repeat(e),f=" ".repeat(e+1),d=i(r,"Grid",f,{hasPosition:r?.position==="absolute"}),g=as(r,f),m=a(t),h=o.map(p=>Ns(p,e+1,m,c,l));return[`${u}Grid() {`,...h,`${u}}`,...g,...d].join(`
37
+ `)+s(t,u,n)}function Ns(t,e,n,o,r){var i;const s=" ".repeat(e),a=" ".repeat(e+1);if(t.componentName==="GridItem"){const l=t.children??[];return l.length<=1?o(t,e,n):`${s}GridItem() {
38
+ ${a}Column() {
39
+ ${l.map(u=>o(u,e+3,void 0)).join(`
40
+ `)}
41
+ ${a}}
42
+ ${s}}`}const c=o(t,e+2,n);return r(t)&&(((i=t.children)==null?void 0:i.length)??0)>1?`${s}GridItem() {
43
+ ${a}Column() {
44
+ ${c}
45
+ ${a}}
46
+ ${s}}`:`${s}GridItem() {
47
+ ${c}
48
+ ${s}}`}function Ms(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"Checkbox",a,{hasPosition:o?.position==="absolute"});return[`${s}Checkbox()`,`${a}.select(true)`,`${a}.selectedColor("#0c5af7")`,`${a}.shape(CheckBoxShape.ROUNDED_SQUARE)`,...c].join(`
49
+ `)+i(t,s,n)}function Es(t,e,n,o,r,i,s,a,c){const l=" ".repeat(e),u=" ".repeat(e+1),f=" ".repeat(e+2),d=i(r,"CheckboxGroup",u,{hasPosition:r?.position==="absolute"}),g=[];return g.push(`${l}Column() {`),g.push(`${u}Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {`),g.push(`${f}CheckboxGroup({ group: 'checkboxGroup' })`),g.push(`${f} .checkboxShape(CheckBoxShape.ROUNDED_SQUARE)`),g.push(`${f} .selectedColor('#0c5af7')`),g.push(`${f} .onChange((itemName: CheckboxGroupResult) => {`),g.push(`${f} console.info("checkbox group content" + JSON.stringify(itemName))`),g.push(`${f} })`),g.push(`${f}Text('Select All').fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500)`),g.push(`${u}}`),o.forEach((m,h)=>{const p=c(a(m)||`Checkbox${h+1}`);g.push(""),g.push(`${u}Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {`),g.push(`${f}Checkbox({ name: 'checkbox${h+1}', group: 'checkboxGroup' })`),g.push(`${f} .selectedColor('#0c5af7')`),g.push(`${f} .shape(CheckBoxShape.ROUNDED_SQUARE)`),g.push(`${f} .onChange((value: boolean) => {`),g.push(`${f} console.info('Checkbox${h+1} change is' + value)`),g.push(`${f} })`),g.push(`${f}Text('${p}').fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500)`),g.push(`${u}}.margin({ left: 36 })`)}),g.push(`${l}}`),g.push(...d),g.join(`
50
+ `)+s(t,l,n)}function Ps(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"Rating",a,{hasPosition:o?.position==="absolute"});return[`${s}Rating({ rating: 5, indicator: false })`,`${a}.stars(5)`,`${a}.stepSize(0.5)`,...c].join(`
51
+ `)+i(t,s,n)}function Os(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"Counter",a,{hasPosition:o?.position==="absolute"});return[`${s}Counter() {`,`${a}Text("1")`,`${s}}`,...c].join(`
52
+ `)+i(t,s,n)}function Ls(t,e,n,o,r,i){const s=" ".repeat(e),a=r(o,"TextInput"," ".repeat(e+1),{hasPosition:o?.position==="absolute"});return[`${s}TextInput({ text: "", placeholder: 'input your word...' })`,...a].join(`
53
+ `)+i(t,s,n)}function Fs(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"Progress",a,{hasPosition:o?.position==="absolute"});return[`${s}Progress({ value: 10, type: ProgressType.Linear })`,`${a}.style({ strokeWidth: 10, enableSmoothEffect: true })`,...c].join(`
54
+ `)+i(t,s,n)}function Bs(t,e,n,o,r,i){const s=" ".repeat(e),a=r(o,"QRCode"," ".repeat(e+1),{hasPosition:o?.position==="absolute"});return[`${s}QRCode("hello world")`,...a].join(`
55
+ `)+i(t,s,n)}function zs(t,e,n,o,r,i,s,a){Ee("import { SubHeaderV2, SubHeaderV2Title, TextModifier, SubHeaderV2OperationType } from '@kit.ArkUI';");const c=" ".repeat(e),l=" ".repeat(e+1),u=r(o,"SubHeaderV2",l,{hasPosition:o?.position==="absolute"}),f=t.children??[];let d="icon: ''";for(const p of f)if(p.componentName==="Image"&&p.src){d=`icon: ${s(p.src)}`;break}let g="";const m=[];for(const p of f)if(p.componentName==="Text"){const y=a(p)||p.content||"";y&&(g=y);const b=p.styles;b&&(b.fontColor&&m.push(`.fontColor("${b.fontColor}")`),b.fontWeight!==void 0&&m.push(`.fontWeight(${b.fontWeight})`),b.fontSize!==void 0&&m.push(`.fontSize(${b.fontSize})`));break}const h=m.length>0?`new TextModifier()${m.join("")}`:"";return[`${c}SubHeaderV2({`,`${l}${d},`,`${l}title: new SubHeaderV2Title({`,`${l} primaryTitle: "${g}",`,`${l} primaryTitleModifier: ${h||"new TextModifier()"}`,`${l}}),`,`${l}operationType: SubHeaderV2OperationType.BUTTON,`,`${l}operationItems: []`,`${c}})`,...u].join(`
56
+ `)+i(t,c,n)}function Ds(t,e,n,o,r,i){const s=" ".repeat(e),a=" ".repeat(e+1),c=r(o,"CalendarPicker",a,{hasPosition:o?.position==="absolute"});return[`${s}CalendarPicker({ hintRadius: 10, selected: new Date() })`,`${a}.edgeAlign(CalendarAlign.END)`,...c].join(`
57
+ `)+i(t,s,n)}function js(t,e,n,o,r,i){Ee(`class MyDataSource implements IDataSource {
58
+ private list: number[] = [];
59
+
60
+ constructor(list: number[]) {
61
+ this.list = list;
62
+ }
63
+
64
+ totalCount(): number {
65
+ return this.list.length;
66
+ }
67
+
68
+ getData(index: number): number {
69
+ return this.list[index];
70
+ }
71
+
72
+ registerDataChangeListener(listener: DataChangeListener): void {
73
+ }
74
+
75
+ unregisterDataChangeListener() {
76
+ }
77
+ }`);const s=" ".repeat(e),a=" ".repeat(e+1),c=" ".repeat(e+2),l=r(o,"Swiper",a,{hasPosition:o?.position==="absolute"});return[`${s}Swiper(new SwiperController()) {`,`${a}LazyForEach(new MyDataSource([1, 2, 3]), (item: string) => {`,`${c}Text(item.toString())`,`${c} .width('90%')`,`${c} .height(160)`,`${c} .backgroundColor(0xAFEEEE)`,`${c} .textAlign(TextAlign.Center)`,`${c} .fontSize(30)`,`${a}}, (item: string) => item)`,`${s}}`,`${a}.cachedCount(2)`,`${a}.index(1)`,`${a}.autoPlay(true)`,`${a}.interval(4000)`,`${a}.loop(true)`,`${a}.indicatorInteractive(true)`,`${a}.duration(1000)`,`${a}.itemSpace(5)`,`${a}.prevMargin(35)`,`${a}.nextMargin(35)`,`${a}.indicator(`,`${a} new DotIndicator()`,`${a} .itemWidth(15)`,`${a} .itemHeight(15)`,`${a} .selectedItemWidth(15)`,`${a} .selectedItemHeight(15)`,`${a} .color(Color.Gray)`,`${a} .selectedColor(Color.Blue))`,`${a}.displayArrow({`,`${a} showBackground: true,`,`${a} isSidebarMiddle: true,`,`${a} backgroundSize: 24,`,`${a} backgroundColor: Color.White,`,`${a} arrowSize: 18,`,`${a} arrowColor: Color.Blue`,`${a}}, false)`,`${a}.curve(Curve.Linear)`,...l].join(`
78
+ `)+i(t,s,n)}var Hs=[{match:t=>t==="Chips"||t==="Chip",generate:(t,e,n,o)=>hs(t,e,n," ".repeat(e+1))},{match:t=>t==="Text",generate:(t,e,n,o)=>ps(t,e,n,t.styles,o.buildStyleLines,o.posSuffix,o.escapeStr)},{match:t=>t==="Image",generate:(t,e,n,o)=>ys(t,e,n,t.styles,o.buildStyleLines,o.posSuffix,o.v2ToArkUIResource)},{match:t=>t==="Button",generate:(t,e,n,o)=>bs(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.v2ToArkUIResource,o.getChildOffset,o.generateV2Node)},{match:t=>t==="Search",generate:(t,e,n,o)=>vs(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.extractTextFromChildren,o.escapeStr)},{match:t=>t==="Select",generate:(t,e,n,o)=>xs(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.extractTextFromChildren,o.escapeStr)},{match:t=>t==="Radio",generate:(t,e,n,o)=>ws(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Checkbox",generate:(t,e,n,o)=>Ms(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="CheckboxGroup",generate:(t,e,n,o)=>Es(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.extractTextFromChildren,o.escapeStr)},{match:t=>t==="Rating",generate:(t,e,n,o)=>Ps(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Counter",generate:(t,e,n,o)=>Os(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="TextInput",generate:(t,e,n,o)=>Ls(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Progress",generate:(t,e,n,o)=>Fs(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="QRCode",generate:(t,e,n,o)=>Bs(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="SubHeader",generate:(t,e,n,o)=>zs(t,e,n,t.styles,o.buildStyleLines,o.posSuffix,o.v2ToArkUIResource,o.extractTextFromChildren)},{match:t=>t==="CalendarPicker"||t==="Calendar",generate:(t,e,n,o)=>Ds(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Swiper",generate:(t,e,n,o)=>js(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Toggle",generate:(t,e,n,o)=>Ss(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>t==="Slider",generate:(t,e,n,o)=>ks(t,e,n,t.styles,o.buildStyleLines,o.posSuffix)},{match:t=>$s.has(t),generate:(t,e,n,o)=>Is(t,t.componentName,e,n,o.buildStyleLines,o.getV2AlignModifiers,o.posSuffix,o.getChildOffset,o.generateV2Node)},{match:t=>t==="Scroll",generate:(t,e,n,o)=>Rs(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.getChildOffset,o.generateV2Node)},{match:t=>t==="List",generate:(t,e,n,o)=>Cs(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.getChildOffset,o.generateV2Node,o.isVirtualGroup)},{match:t=>t==="Grid",generate:(t,e,n,o)=>_s(t,e,n,t.children??[],t.styles,o.buildStyleLines,o.posSuffix,o.getChildOffset,o.generateV2Node,o.isVirtualGroup)}];function Gs(t){for(const e of Hs)if(e.match(t))return e.generate;return null}function Ut(t){return t?.position==="absolute"}function St(t,e,n){var o,r;if(!Ut(t.styles))return"";const i=(o=t.styles)==null?void 0:o.left,s=(r=t.styles)==null?void 0:r.top,a=n?.left??0,c=n?.top??0,l=typeof i=="number"?i:null,u=typeof s=="number"?s:null;let f=l,d=u;const g=n===void 0||n.left===0&&n.top===0;if(l!==null&&u!==null&&g){const p=ji({x:l,y:u});p&&(f=p.x,d=p.y)}let m;f!==null?m=String(f-a):m=String(i);let h;return d!==null?h=String(d-c):h=String(s),`
79
+ ${e}.position({ x: ${m}, y: ${h} })`}function Ln(t){var e;const n=t.componentName,o=t.styles;if(n==="Stack"||Ut(o))return o?.left!==void 0||o?.top!==void 0?{left:o?.left??0,top:o?.top??0}:(e=t.meta)!=null&&e.bbox&&t.meta.bbox.length>=2?{left:t.meta.bbox[0],top:t.meta.bbox[1]}:{left:0,top:0}}function Fn(t){var e;return((e=t.meta)==null?void 0:e.octoType)==="VIRTUAL_GROUP"}function Bn(t){return t.replace(/\\/g,"\\\\").replace(/\r\n/g,"\\n").replace(/\n/g,"\\n").replace(/\r/g,"\\n").replace(/\t/g," ").replace(/"/g,'\\"')}function Ws(t){if(!t)return'""';if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return t;if(t.startsWith("http://")||t.startsWith("https://"))return`"${t}"`;const e=t.replace(/^.*[\\/]/,"").replace(/\.[^.]+$/,"").replace(/-/g,"_");return e?`$r('app.media.${e}')`:'""'}function Vs(t){const e=t.children??[];for(const n of e)if(n.componentName==="Text"&&n.content)return n.content;return""}function Pe(t,e,n,o){return ss(t,e,n,o)}var kt=new Map,$t=new Set,Xt=new Map;function Us(t,e=[]){kt.clear();for(const[n,o]of Object.entries(t))kt.set(n,o);$t.clear();for(const n of e)$t.add(n)}function zn(t){Xt.clear();for(const[e,n]of Object.entries(t))Xt.set(e,n)}function Dn(){kt.clear(),$t.clear(),Xt.clear()}function K(t){var e;return((e=t.meta)==null?void 0:e.octoId)??`${t.componentName}_${Object.keys(t.styles??{}).join("_")}`}function ut(t,e,n){var o;const r=" ".repeat(e);if(Fn(t))return(t.children??[]).map(f=>ut(f,e,n)).join(`
80
+ `);const i=Xs(t),s=K(t);if(s&&$t.has(s)||Di(t))return"";const a=kt.get(s);if(a)return a.includes("(")?`${r}this.${a}`:`${r}this.${a}()`;let c=t;const l=_i(s);if(l>0&&((o=t.styles)==null?void 0:o.height)!==void 0){const f=t.styles.height,d=typeof f=="number"?f:parseFloat(String(f));!isNaN(d)&&!(typeof f=="string"&&f.includes("%"))&&(c={...t,styles:{...t.styles,height:Math.max(0,d-l)}})}const u=Gs(i);return u?u(c,e,n,{posSuffix:St,buildStyleLines:Pe,generateV2Node:ut,getChildOffset:Ln,escapeStr:Bn,v2ToArkUIResource:Ws,extractTextFromChildren:Vs,hasAbsolute:Ut,getV2AlignModifiers:On,isVirtualGroup:Fn}):Ks(c,i,e,n)}function Xs(t){var e,n;const o=(n=(e=t.meta)==null?void 0:e.mergedFrom)==null?void 0:n.supType;if(o){if(o.toLowerCase()==="hdslistitem")return"HdsListItem";if(o.toLowerCase()==="scroll")return"Scroll"}return t.componentName}function Ks(t,e,n,o){const r=" ".repeat(n),i=" ".repeat(n+1),s=t.styles,a=t.children??[];if(t.content&&a.length===0){const h=t.content,p=Pe(s,"Text",i,{hasPosition:!1});return[`${r}Text("${Bn(h)}")`,...p].join(`
81
+ `)+St(t,r,o)}const c=Pe(s,e,i,{hasPosition:Ut(s)}),l=On(s,e,i),u=K(t),f=Xt.get(u);if(f&&f.length>0){const h=Me(s),p=f.map(y=>` ${i}this.${y}`);return[`${r}${e}(${h}) {`,...p,`${r}}`,...l,...c].join(`
82
+ `)+St(t,r,o)}const d=Me(s),g=Ln(t),m=a.map(h=>{const p=K(h);if(p&&$t.has(p))return null;const y=kt.get(p);return y?y.includes("(")?` ${i}this.${y}`:` ${i}this.${y}()`:ut(h,n+1,g)}).filter(h=>h!==null&&h!=="");return m.length>0?[`${r}${e}(${d}) {`,...m,`${r}}`,...l,...c].join(`
83
+ `)+St(t,r,o):[`${r}${e}(${d})`,...l,...c].join(`
84
+ `)+St(t,r,o)}function Ys(t,e,n={}){const o=t.children??[],r=t.styles??{},i={backgroundColor:r.backgroundColor,backgroundImage:r.backgroundImage,backgroundSize:r.backgroundSize,alignItems:r.alignItems,justifyContent:r.justifyContent,overflow:r.overflow},s=t.componentName,a=o.map((g,m)=>Zs(g,m,e));let c=null;const l=[];for(const g of a)g.isFullScreen&&!c?c=g.node:l.push(g);const u=qs(l);u.forEach(g=>{g.type=Js(g,e)});const f=[],d={};if(c){const g=jn(c);g&&(d[g]="BackgroundLayer")}for(const g of u)if(g.nodes.length>=1){const m=jn(g.nodes[0]);m&&(d[m]=g.id)}return{pageSize:e,rootNodeStyles:i,rootComponentName:s,backgroundNode:c,rootRegions:u,extractedBuilders:f,originalRootNode:t,nodeToBuilderMapping:d,skipNodeIds:[],containerToPattern:{},containerParametricCalls:{}}}function Zs(t,e,n){const o=t.styles??{},r=(t.meta??{}).bbox??[0,0,100,100],i=typeof o.left=="number"?o.left:typeof r[0]=="number"?r[0]:0,s=typeof o.top=="number"?o.top:typeof r[1]=="number"?r[1]:0,a=typeof o.width=="number"?o.width:typeof(r[2]-r[0])=="number"?r[2]-r[0]:100,c=typeof o.height=="number"?o.height:typeof(r[3]-r[1])=="number"?r[3]-r[1]:100,l=s+c;return{node:t,index:e,yTop:s,yBottom:l,width:a,height:c,xLeft:i,xRight:i+a,isFullScreen:t.componentName==="Image"&&o.position==="absolute"&&a>=n.width-50&&c>=n.height-50,isBottomEdge:o.position==="absolute"&&l>=n.height-50}}function qs(t,e){return t.map((n,o)=>({id:`Region_${o}`,displayName:`\u533A\u57DF ${o}`,type:"content",yRange:[n.yTop,n.yBottom],nodes:[n.node],subRegions:[],patterns:[],isExtracted:!1}))}function Js(t,e){var n,o;const{nodes:r,yRange:i}=t,[s,a]=i;if(s<50&&r.length>0&&r[0].componentName!=="Image"&&(r.some(c=>{if(c.componentName==="Text"&&c.content){const l=c.content.toString();return/^\d{1,2}:\d{2}$/.test(l)}return!1})||r.length<=3))return"topBar";if(a>=e.height-50)return r.length===1&&r[0].componentName==="Image"?"gestureBar":"bottomBar";if(r.length===1&&r[0].componentName==="Image"){const c=r[0],l=typeof((n=c.styles)==null?void 0:n.width)=="number"?c.styles.width:0,u=typeof((o=c.styles)==null?void 0:o.height)=="number"?c.styles.height:0;if(l<100&&u<30)return"indicator"}return r.some(c=>c.componentName==="Column"||c.componentName==="Row")&&Qs(r)?"appGrid":a-s>100?"card":"content"}function Qs(t){var e,n;for(const o of t)if(o.children&&o.children.length>=3){const r=o.children.filter(s=>s.componentName==="Column");if(r.length>=3){const s=r[0];if(s.children){const a=s.children.some(l=>l.componentName==="Image"),c=s.children.some(l=>l.componentName==="Text");if(a&&c)return!0}}const i=o.children.filter(s=>s.componentName==="Image");if(i.length>=3){const s=i[0],a=((e=s.styles)==null?void 0:e.width)??0,c=((n=s.styles)==null?void 0:n.height)??0;if(i.every(l=>{var u,f;return((u=l.styles)==null?void 0:u.width)===a&&((f=l.styles)==null?void 0:f.height)===c}))return!0}}return!1}function jn(t){var e;return((e=t.meta)==null?void 0:e.octoId)??`${t.componentName}_${Object.keys(t.styles??{}).join("_")}`}function ta(t,e){return{background:"BackgroundLayer",topBar:"StatusBar",content:"ContentArea",bottomBar:"BottomBar",indicator:"PageIndicator",gestureBar:"HomeIndicator",appGrid:"AppGrid",card:"CardArea",custom:"CustomArea"}[t.type]||"Region"}var ea=3,It=new Set(["left","top","position","content","src","width","height","fontSize","fontWeight","fontColor","textAlign","lineHeight","opacity","marginLeft","marginRight","marginTop","marginBottom","margin","paddingLeft","paddingRight","paddingTop","paddingBottom","backgroundColor","borderRadius","objectFit","scale","rotate"]),Kt=new Set(["backgroundImage","backgroundPosition","backgroundRepeat","backgroundSize","border"]);function Hn(t,e=ea){const n=t.children??[];if(n.length<e||!n.every(a=>a.componentName===n[0].componentName)||!oa(n)||!Vn(n))return null;const o=na(n),{params:r,callParams:i,pathToParamName:s}=aa(o);return{builderName:la(t),params:r,templateNode:o[0],callParams:i,pathToParamName:s}}function na(t){return t.map(e=>{var n,o,r,i;const s=e.styles??{},a=s.left??((o=(n=e.meta)==null?void 0:n.bbox)==null?void 0:o[0])??0,c=s.top??((i=(r=e.meta)==null?void 0:r.bbox)==null?void 0:i[1])??0;return a===0&&c===0?e:Gn(e,a,c)})}function Gn(t,e,n){var o;const r=(o=t.children)==null?void 0:o.map(i=>{var s;const a=i.styles?{...i.styles}:void 0;a&&(typeof a.left=="number"&&(a.left=a.left-e),typeof a.top=="number"&&(a.top=a.top-n));const c=(s=i.children)==null?void 0:s.map(l=>Gn(l,e,n));return{...i,styles:a,children:c}});return{...t,children:r}}function oa(t){if(t.length<=1)return!0;const e=t[0];for(let n=1;n<t.length;n++)if(!Wn(e,t[n]))return!1;return!0}function Wn(t,e){if(t.componentName!==e.componentName)return!1;const n=t.children??[],o=e.children??[];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!Wn(n[r],o[r]))return!1;return!0}function Vn(t){if(t.length<=1)return!0;const e=t[0].styles??{},n=Object.keys(e),o=n.filter(i=>t.every(s=>(s.styles??{}).hasOwnProperty(i)));for(const i of n)if(!o.includes(i)&&(!It.has(i)&&!Kt.has(i)||Kt.has(i)&&!t.every(s=>(s.styles??{}).hasOwnProperty(i))))return!1;for(const i of o){if(It.has(i)||Kt.has(i))continue;const s=JSON.stringify(e[i]);for(let a=1;a<t.length;a++)if(JSON.stringify((t[a].styles??{})[i])!==s)return!1}const r=t[0].children??[];if(r.length>0)for(let i=0;i<r.length;i++){const s=t.map(a=>(a.children??[])[i]).filter(Boolean);if(s.length===t.length&&!Vn(s))return!1}return!0}function ra(t){switch(t){case"left":return"x";case"top":return"y";case"width":return"itemWidth";case"height":return"itemHeight";case"fontSize":return"fontSize";case"fontWeight":return"fontWeight";case"fontColor":return"fontColor";case"marginLeft":return"marginLeft";case"marginTop":return"marginTop";case"backgroundColor":return"bgColor";default:return t}}function ia(t,e){return t==="src"?"Resource":t==="content"?"string":typeof e=="number"?"number":"string"}function sa(t){return["left","top","x","y"].includes(t)}function aa(t){const e=[],n=new Set,o=new Map,r=new Map;for(const d of t)Un(d,"",e,n,o,r);const i=[],s=new Map;for(const d of e)if(!s.has(d.paramName)){const g={name:d.paramName,type:d.paramType,usage:d.usage};i.push(g),s.set(d.paramName,g)}const a=[];for(const d of t){const g=[];Xn(d,"",g,s,o),a.push(g)}for(const d of a){const g=new Set(d.map(m=>m.name));for(const m of i)if(!g.has(m.name)){const h=ca(m.name,m.type);d.push({name:m.name,type:m.type,defaultValue:h,usage:m.usage})}}const c=[];for(const d of i.map(g=>g.name)){const g=a.map(x=>x.find(v=>v.name===d)),m=g.map(x=>x._isReal===!0),h=m.filter(Boolean).length,p=g.map(x=>x?.defaultValue),y=p.find((x,v)=>m[v]),b=p.some(x=>x!==y);if(h===g.length){b&&c.push(d);continue}h>=2&&b&&c.push(d)}const l=i.filter(d=>c.includes(d.name)),u=a.map(d=>{const g=new Map(d.map(m=>[m.name,m]));return c.map(m=>g.get(m)).filter(Boolean)}),f=new Map;for(const[d,g]of o)c.includes(g)&&f.set(d,g);return{params:l,callParams:u,pathToParamName:f}}function Un(t,e,n,o,r,i){const s=t.styles??{};if(typeof s.left=="number"){const c=e?`${e}.styles.left`:"styles.left";if(!o.has(c)){o.add(c);const l=At("x",r,c,i);n.push({path:c,paramName:l,paramType:"number",usage:"positional"})}}if(typeof s.top=="number"){const c=e?`${e}.styles.top`:"styles.top";if(!o.has(c)){o.add(c);const l=At("y",r,c,i);n.push({path:c,paramName:l,paramType:"number",usage:"positional"})}}if(t.content!==void 0){const c=e?`${e}.content`:"content";if(!o.has(c)){o.add(c);const l=At("text",r,c,i);n.push({path:c,paramName:l,paramType:"string",usage:"positional"})}}if(t.src!==void 0){const c=e?`${e}.src`:"src";if(!o.has(c)){o.add(c);const l=At("imageSrc",r,c,i);n.push({path:c,paramName:l,paramType:"Resource",usage:"repetitive"})}}const a=Object.entries(s);for(const[c,l]of a)if(It.has(c)&&l!==void 0){const u=e?`${e}.styles.${c}`:`styles.${c}`;if(!o.has(u)){o.add(u);const f=At(ra(c),r,u,i),d=ia(c,l),g=sa(c)?"positional":"repetitive";n.push({path:u,paramName:f,paramType:d,usage:g})}}if(t.children)for(let c=0;c<t.children.length;c++)Un(t.children[c],e?`${e}.${c}`:String(c),n,o,r,i)}function At(t,e,n,o){const r=o.get(t)??0;o.set(t,r+1);const i=r===0?t:`${t}_${r+1}`;return e.set(n,i),i}function ca(t,e){return e==="Resource"?"$r('app.media.placeholder')":e==="string"?'""':{opacity:"1",scale:"1"}[t]??"0"}function Xn(t,e,n,o,r){const i=t.styles??{};if(t.content!==void 0){const s=e?`${e}.content`:"content",a=r.get(s),c=a?o.get(a):void 0;if(c){const l=t.content.replace(/[\r\n]+/g," ").trim();n.push({name:c.name,type:c.type,defaultValue:`"${l}"`,usage:c.usage,_isReal:!0})}}if(t.src!==void 0){const s=e?`${e}.src`:"src",a=r.get(s),c=a?o.get(a):void 0;if(c){const l=t.src.replace(/^assets\//,"").replace(/\.[^.]+$/,"").replace(/-/g,"_");n.push({name:c.name,type:c.type,defaultValue:`$r('app.media.${l}')`,usage:c.usage,_isReal:!0})}}for(const[s,a]of Object.entries(i))if(It.has(s)&&a!==void 0){const c=e?`${e}.styles.${s}`:`styles.${s}`,l=r.get(c),u=l?o.get(l):void 0;if(u){const f=String(a);n.push({name:u.name,type:u.type,defaultValue:f,usage:u.usage,_isReal:!0})}}if(t.children)for(let s=0;s<t.children.length;s++)Xn(t.children[s],e?`${e}.${s}`:String(s),n,o,r)}function la(t){var e,n;const o=t.componentName;let r="Item";switch(o){case"Row":r="RowItem";break;case"Column":r="ColumnItem";break;case"Stack":r="StackItem";break;default:r="CustomItem"}return(t.componentName==="Text"||(e=t.children)!=null&&e.some(i=>i.componentName==="Text"))&&(r="TextItem"),(t.componentName==="Image"||(n=t.children)!=null&&n.some(i=>i.componentName==="Image"))&&(r="IconItem"),r}function ua(t){const e=[];function n(o){if(o.children&&o.children.length>0){if(["Row","Column","Stack"].includes(o.componentName)){const r=Hn(o);r&&e.push(r)}for(const r of o.children)n(r)}}return n(t),e}function fa(t,e){const o=[];o.push(` // #region ${t.displayName}`),o.push(" @Builder"),o.push(` ${t.id}() {`);for(const r of t.nodes){const i=ut(r,3);o.push(i)}return o.push(" }"),o.push(" // #endregion"),o.join(`
85
+ `)}function da(t){const e=[];e.push(" // #region \u80CC\u666F\u5C42"),e.push(" @Builder"),e.push(" BackgroundLayer() {");const o=ut(t,3);return e.push(o),e.push(" }"),e.push(" // #endregion"),e.join(`
86
+ `)}function ga(t,e=null){const n=[],r=t.params.map(s=>`${s.name}: ${s.type}`);n.push(" @Builder"),n.push(...ya(t.name,r,1));const i=ut(Kn(t.regionNode,t.params,t.pathToParamName),3);return n.push(i),n.push(" }"),n.join(`
87
+ `)}function Kn(t,e,n,o=""){const r=new Map;for(const d of e)r.set(d.name,d);const i={...t,styles:t.styles?{...t.styles}:void 0,children:t.children?t.children.map((d,g)=>Kn(d,e,n,o?`${o}.${g}`:String(g))):void 0},s=o?`${o}.content`:"content",a=n.get(s),c=a?r.get(a):void 0;c&&i.content!==void 0&&(i.content=c.name,i.meta={...i.meta,isParamRef:!0});const l=o?`${o}.src`:"src",u=n.get(l),f=u?r.get(u):void 0;if(f&&i.src!==void 0&&(i.src=f.name,i.meta={...i.meta,isParamRef:!0}),i.styles){for(const[d,g]of Object.entries(i.styles)){const m=o?`${o}.styles.${d}`:`styles.${d}`,h=n.get(m),p=h?r.get(h):void 0;p&&(i.styles={...i.styles,[d]:p.name})}for(const[d,g]of n){const m=o?`${o}.styles.`:"styles.";if(d.startsWith(m)){const h=d.slice(m.length);if(i.styles[h]===void 0){const p=r.get(g);p&&(i.styles={...i.styles,[h]:p.name})}}}}return i}function ma(t,e){const n=[];n.push("@Entry"),n.push("@Component"),n.push(`struct ${e} {`),Us(t.nodeToBuilderMapping,t.skipNodeIds),Object.keys(t.containerParametricCalls).length>0&&zn(t.containerParametricCalls);try{n.push(" build() {"),n.push(" Scroll() {");const r=ut(t.originalRootNode,3);n.push(pa(r,t.nodeToBuilderMapping,t.rootRegions)),n.push(" }"),n.push(" }")}finally{Dn()}n.push(""),t.backgroundNode&&(n.push(da(t.backgroundNode)),n.push(""));for(const r of t.extractedBuilders)n.push(ga(r)),n.push("");try{Object.keys(t.containerParametricCalls).length>0&&zn(t.containerParametricCalls);for(let r=0;r<t.rootRegions.length;r++){const i=t.rootRegions[r];i.type!=="background"&&(n.push(fa(i,r)),n.push(""))}}finally{Dn()}return n.push("}"),n.join(`
88
+ `)}function ha(t){return{background:"\u80CC\u666F\u5C42",topBar:"\u9876\u90E8\u72B6\u6001\u680F",content:"\u5185\u5BB9\u533A\u57DF",bottomBar:"\u5E95\u90E8\u5BFC\u822A\u680F",indicator:"\u9875\u9762\u6307\u793A\u5668",gestureBar:"\u5E95\u90E8\u624B\u52BF\u6761",appGrid:"\u5E94\u7528\u56FE\u6807\u533A",card:"\u5361\u7247\u533A\u57DF",custom:"\u81EA\u5B9A\u4E49\u533A\u57DF"}[t.type]||t.displayName}function pa(t,e,n){const o={};for(const r of n)o[r.id]=r.displayName;return o.BackgroundLayer="\u80CC\u666F\u5C42",t.replace(/\n(\s+)(this\.([A-Z][a-zA-Z]*)\(\))/g,(r,i,s,a)=>{const c=o[a];return c?`
89
+ ${i}// ${c}
90
+ ${i}${s}`:r})}function ya(t,e,n){const r=" ".repeat(n),i=`${r}${t}(${e.join(", ")})`;if(i.length<=120)return[`${i} {`];const s=" ".repeat(n+1),a=e.map(c=>`${s}${c}`);return[`${r}${t}(`,`${a.join(`,
91
+ `)}`,`${r}) {`]}function ba(t,e={}){var n;const o=zi(t.ui.children??[],t.ui);Ni(o.skipGuids),Ei(o.systemBarsInfo);try{const r=Ys(t.ui,va(t.ui),e);xa(r,e),wa(r),Sa(r),ka(r),fs();const i=ma(r,_a(((n=t.page)==null?void 0:n.name)||"Page")),s=us();return s.length>0?s.join(`
92
+ `)+`
93
+
94
+ `+i:i}finally{Mi(),Pi(),Oi()}}function va(t){const e=t.styles??{};return{width:typeof e.width=="number"?e.width:360,height:typeof e.height=="number"?e.height:780}}function xa(t,e){var n;if(e.detectRepetitivePattern??!0)for(const o of t.rootRegions){for(const r of o.nodes)if(["Row","Column","Stack"].includes(r.componentName)){const i=Hn(r);if(i){o.patterns.push(i);const s=K(r);s&&(t.containerToPattern[s]=i)}}for(const r of o.nodes){const i=ua(r);for(const s of i){const a=((n=s.templateNode.meta)==null?void 0:n.octoId)??K(s.templateNode);o.patterns.some(c=>{var l;return(((l=c.templateNode.meta)==null?void 0:l.octoId)??K(c.templateNode))===a})||o.patterns.push(s)}}}}function wa(t){const e=new Set;for(let n=0;n<t.rootRegions.length;n++){const o=t.rootRegions[n];let r=ta(o),i=r,s=1;for(;e.has(i);)i=`${r}_${s}`,s++;e.add(i),o.id=i,o.displayName=ha(o)}}function Sa(t){for(const e of t.rootRegions)if(e.nodes.length>=1){const n=K(e.nodes[0]);n&&(t.nodeToBuilderMapping[n]=e.id)}if(t.backgroundNode){const e=K(t.backgroundNode);e&&(t.nodeToBuilderMapping[e]="BackgroundLayer")}}function ka(t){const n=new Set,o=new Map,r=[],i=new Map;for(const a of t.rootRegions)for(const c of a.patterns){if(c.callParams.length<3)continue;const l=`${c.builderName}(${c.params.map(h=>`${h.name}:${h.type}`).join(",")})`;let u,f=!0;const d=o.get(l);if(d){const h=r.find(p=>p.name===d);if(h){if(Ra(h.pattern,c,h.params))u=d,f=!1;else if(u=c.builderName,n.has(u)){let p=2;for(;n.has(`${u}_${p}`);)p++;u=`${u}_${p}`}}else u=d,f=!1}else if(u=c.builderName,n.has(u)){let h=2;for(;n.has(`${u}_${h}`);)h++;u=`${u}_${h}`}if(f){n.add(u),o.set(l,u);const h={name:u,params:c.params,regionNode:c.templateNode,pathToParamName:c.pathToParamName};t.extractedBuilders.push(h),r.push({name:u,params:c.params,pattern:c})}const g=qn(a.nodes,c.templateNode);if(!g)continue;const m=K(g);if(m&&(i.set(m,{pattern:c,builderName:u,containerNode:g}),g.children))for(const h of g.children){const p=K(h);p&&t.skipNodeIds.push(p)}}const s=new Set;for(const a of r)for(const c of r)if(a!==c&&Yn(a,c)){s.add(a.name);break}t.extractedBuilders=t.extractedBuilders.filter(a=>!s.has(a.name));for(const[a,c]of i){let l=null;for(const f of r)if(!s.has(f.name)&&Yn({name:c.builderName,params:c.pattern.params,pattern:c.pattern},f)){l=f;break}const u=[];for(let f=0;f<c.pattern.callParams.length;f++){const d=c.pattern.callParams[f],g=new Map(d.map(y=>[y.name,y])),m=$a(c.containerNode),h=(l?l.params:c.pattern.params).map(y=>{var b;const x=g.get(y.name);let v;if(x)if(Ia(y.name,c.pattern.pathToParamName)){const k=parseFloat(x.defaultValue??"0")-(m?.left??0);v=Oe({...x,defaultValue:String(k)})}else if(Aa(y.name,c.pattern.pathToParamName)){const k=parseFloat(x.defaultValue??"0")-(m?.top??0);v=Oe({...x,defaultValue:String(k)})}else v=Oe(x);else{const k=(b=c.containerNode.children)==null?void 0:b[f];v=Ca(y.name,k,m)}return v}),p=l?l.name:c.builderName;u.push(Ta(p,h))}t.containerParametricCalls[a]=u}}function $a(t){var e;if(!t)return{left:0,top:0};const n=t.styles??{};if(n.left!==void 0||n.top!==void 0)return{left:n.left??0,top:n.top??0};const o=(e=t.meta)==null?void 0:e.bbox;return o&&o.length>=2?{left:o[0],top:o[1]}:{left:0,top:0}}function Ia(t,e){for(const[n,o]of e)if(o===t&&n==="styles.left")return!0;return!1}function Aa(t,e){for(const[n,o]of e)if(o===t&&n==="styles.top")return!0;return!1}function Ra(t,e,n){const o=new Set(n.map(a=>a.name)),r=t.templateNode.styles??{},i=e.templateNode.styles??{},s=new Set([...Object.keys(r),...Object.keys(i)]);for(const a of s)if(!(It.has(a)&&o.has(Zn(a)))){if(Kt.has(a)){if(r.hasOwnProperty(a)!==i.hasOwnProperty(a))return!1;continue}if(JSON.stringify(r[a])!==JSON.stringify(i[a]))return!1}return!0}function Yn(t,e){if(e.params.length<t.params.length)return!1;for(const n of t.params){const o=e.params.find(r=>r.name===n.name);if(!o||o.type!==n.type)return!1}if(t.pattern&&e.pattern){const n=t.pattern.templateNode.styles??{},o=e.pattern.templateNode.styles??{},r=new Set(t.params.map(s=>s.name)),i=new Set(e.params.map(s=>s.name));for(const s of Object.keys(n)){if(o[s]===void 0)return!1;if(JSON.stringify(n[s])!==JSON.stringify(o[s])){const a=Zn(s);if(!r.has(a)&&!i.has(a))return!1}}}return!0}function Zn(t){switch(t){case"left":return"x";case"top":return"y";case"width":return"itemWidth";case"height":return"itemHeight";case"fontSize":return"fontSize";case"fontWeight":return"fontWeight";case"fontColor":return"fontColor";case"textAlign":return"textAlign";case"lineHeight":return"lineHeight";case"marginLeft":return"marginLeft";case"marginTop":return"marginTop";case"backgroundColor":return"bgColor";case"borderRadius":return"borderRadius";case"opacity":return"opacity";case"objectFit":return"objectFit";default:return t}}function Ca(t,e,n){if(!e)return"0";const o=e.styles??{};switch(t){case"x":return typeof o.left=="number"?String(o.left-(n?.left??0)):"0";case"y":return typeof o.top=="number"?String(o.top-(n?.top??0)):"0";case"itemWidth":return typeof o.width=="number"?String(o.width):"0";case"itemHeight":return typeof o.height=="number"?String(o.height):"0";case"fontSize":return typeof o.fontSize=="number"?String(o.fontSize):"0";case"fontWeight":return typeof o.fontWeight=="number"?String(o.fontWeight):"0";case"fontColor":return o.fontColor?`"${o.fontColor}"`:'"#000000"';case"marginLeft":return typeof o.marginLeft=="number"?String(o.marginLeft):"0";case"bgColor":return o.backgroundColor?`"${o.backgroundColor}"`:'"#FFFFFF"';case"borderRadius":return typeof o.borderRadius=="number"?String(o.borderRadius):"0";case"opacity":return typeof o.opacity=="number"?String(o.opacity):"1";default:return"0"}}function qn(t,e){for(const n of t)if(n.children){if(n.children.includes(e))return n;const o=qn(n.children,e);if(o)return o}return null}function Oe(t){const e=t.defaultValue??"",n=t.type;return n==="Resource"?e:n==="string"?e.startsWith('"')&&e.endsWith('"')?`"${e.slice(1,-1).replace(/[\r\n]+/g," ").trim()}"`:!isNaN(Number(e))&&e.trim()!==""?e:`"${e.replace(/[\r\n]+/g," ").trim()}"`:n==="number"?isNaN(Number(e))?"0":String(Number(e)):e.startsWith('"')&&e.endsWith('"')?`"${e.slice(1,-1).replace(/[\r\n]+/g," ").trim()}"`:`"${e.replace(/[\r\n]+/g," ").trim()}"`}function Ta(t,e){const o=`${t}(${e.join(", ")})`;if(o.length<=120)return o;const r=" ";return`${t}(
95
+ ${e.map(i=>`${r}${i}`).join(`,
96
+ `)}
97
+ ${r})`}function _a(t){return t.replace(/[^a-zA-Z0-9_]/g,"_").replace(/^[0-9]/,"_$&")}function Na(t,e){return ba(t,e)}var Ma=Na,Ea=32,Yt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function Rt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return typeof t=="string"&&t.trim().length>0?t:void 0}function Le(t,e){const n={...t};for(const[o,r]of Object.entries(e)){const i=n[o];n[o]=Rt(i)&&Rt(r)?Le(i,r):r}return n}function Y(t){const e={};for(const[r,i]of Object.entries(t))r!=="children"&&r!=="override"&&(e[r]=i);const n=Rt(t.override)?t.override:void 0,o=n?Le(e,n):e;return o.type=t.type,Yt(t,"id")?o.id=t.id:delete o.id,o}function Fe(t){const e=Rt(t.override)?t.override:void 0;return e&&Yt(e,"children")?{present:!0,value:Array.isArray(e.children)?e.children:[]}:{present:Yt(t,"children"),value:Array.isArray(t.children)?t.children:[]}}function Ct(t){const e=Y(t);return D(e.componentNodeRef)??D(e.id)}function Zt(t){return D(Y(t).componentNodeRef)}function Jn(t){const e=Y(t);return[D(e.type)??"",D(e.name)??"",D(e.componentRef)??""].join("\0")}function Pa(t){if(Yt(t,"children"))return!0;const e=new Set(["id","type","name","box","componentKey"]);return Object.keys(t).some(n=>!e.has(n))}function Oa(t,e,n){const o=Y(t),r=e?Y(e):{},i=D(o.id),s=D(r.id);if(delete o.id,delete r.id,n&&Rt(o.box)){const l={...o.box};delete l.x,delete l.y,o.box=l}const a=Le(o,r);a.type=D(r.type)??D(o.type)??t.type,s?a.id=s:delete a.id;const c=e?Zt(e)??(n?void 0:Ct(t)):n?void 0:Ct(t);return c?a.componentNodeRef=c:delete a.componentNodeRef,!s&&i&&a.id===i&&delete a.id,delete a.override,delete a.children,a}function La(t,e){const n=new Map,o=new Set,r=new Map,i=new Map;t.forEach((u,f)=>{const d=Ct(u);d&&!i.has(d)&&i.set(d,f)}),e.forEach((u,f)=>{const d=Zt(u),g=d?i.get(d):void 0;g===void 0||o.has(g)||(o.add(g),n.set(g,u),r.set(f,g))});const s=[...r.entries()].sort(([u],[f])=>u-f),a=new Map;e.forEach((u,f)=>{if(r.has(f)||Zt(u))return;const d=[...s].reverse().find(([v])=>v<f),g=s.find(([v])=>v>f),m=d?d[1]+1:0,h=g?g[1]:t.length;if(m>=h)return;const p=Jn(u),y=`${m}:${h}`,b=a.get(y)??m;let x=-1;for(let v=b;v<h;v+=1)if(!o.has(v)&&Jn(t[v])===p){x=v;break}x<0||(a.set(y,x+1),o.add(x),n.set(x,u),r.set(f,x))});const c=new Map,l=[];return e.forEach((u,f)=>{if(r.has(f))return;let d;for(let m=f+1;m<e.length;m+=1){const h=r.get(m);if(h!==void 0){d=h;break}}if(d===void 0){l.push(u);return}const g=c.get(d)??[];g.push(u),c.set(d,g)}),{byTemplateIndex:n,additionsBefore:c,trailingAdditions:l}}function Be(t,e,n,o,r){return t.issues.push({code:e,node:n,componentRef:o,path:r}),n}function gt(t,e,n,o){if(Y(t).visible===!1)return{...t};const r=Fe(t);if(t.type==="INSTANCE"){const s=Y(t);return s.type=t.type,delete s.override,r.present?s.children=r.value:delete s.children,De(s,e,n,o)}const i={...t};return r.present?i.children=r.value.map((s,a)=>gt(s,e,`${n}.${a}`,o)):delete i.children,i}function ze(t,e,n,o,r,i){const s=Oa(t,e,n);if(s.visible===!1)return s;const a=D(Y(t).componentRef),c=e?D(Y(e).componentRef):void 0,l=!n&&t.type==="INSTANCE"&&a!==void 0&&c!==void 0&&a!==c?[]:Fe(t).value,u=e?Fe(e):{present:!1,value:[]};if(i.occurrenceDriven===!0&&e!==void 0&&D(e.id)!==void 0&&u.present){const d=new Map;for(const m of l){const h=Ct(m);h&&!d.has(h)&&d.set(h,m)}const g=u.value.map((m,h)=>{const p=Zt(m),y=p?d.get(p):void 0;return y?ze(y,m,!1,o,`${r}.${p}`,i):gt(m,o,`${r}.occ-${h}`,i)});return g.length>0||u.value.length===0?s.children=g:delete s.children,!n&&s.type==="INSTANCE"?De(s,o,r,i):s}let f=[];if(u.present&&u.value.length===0)f=[];else if(l.length===0)f=u.value.map((d,g)=>gt(d,o,`${r}.new-${g}`,i));else{const d=La(l,u.value);for(let g=0;g<l.length;g+=1){for(const m of d.additionsBefore.get(g)??[])f.push(gt(m,o,`${r}.before-${g}-${f.length}`,i));f.push(ze(l[g],d.byTemplateIndex.get(g),!1,o,`${r}.${Ct(l[g])??g}`,i))}d.trailingAdditions.forEach((g,m)=>{f.push(gt(g,o,`${r}.after-${m}`,i))})}return f.length>0||u.present&&u.value.length===0?s.children=f:delete s.children,!n&&s.type==="INSTANCE"?De(s,o,r,i):s}function De(t,e,n,o){const r=D(Y(t).componentRef);if(!r)return Be(o,"missing-component-ref",t,void 0,n);if(e.includes(r)||e.length>=Ea)return Be(o,"cyclic-component-ref",t,r,n);const i=o.componentRoots[r];if(!i||!Pa(i))return Be(o,"missing-component-root",t,r,n);const s=ze(i,t,!0,[...e,r],`${n}@${r}`,o);return o.hydratedInstances.add(s),s}function Fa(t,e={}){const n=new WeakSet,o=[],r={componentRoots:t.resolvedRefs?.componentRoots??{},hydratedInstances:n,issues:o,...e.occurrenceDriven===!0?{occurrenceDriven:!0}:{}};return{roots:t.roots.map((i,s)=>gt(i,[],`root.${s}`,r)),hydratedInstances:n,issues:o}}var Ba=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function Tt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function za(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function Qn(t){const e=za(t);return e!==void 0&&e>=0?e:void 0}function Da(t){return typeof t=="string"&&t.trim().length>0?t:void 0}function ja(t){return!Tt(t)||!Da(t.type)||!Tt(t.box)?!1:Qn(t.box.w)!==void 0&&Qn(t.box.h)!==void 0}function qt(t){return!Tt(t)||!Array.isArray(t.roots)||t.roots.length===0||!Tt(t.refsIndex)?!1:t.roots.every(ja)&&t.roots.some(e=>Ga(e,"visible")!==!1)}function Ha(t){return Tt(t.override)?t.override:void 0}function Ga(t,e){const n=Ha(t);return n&&Ba(n,e)?n[e]:t[e]}var Wa="mask-composition";function je(t,e){return t==="MASK"||e===!0}function to(t,e){return e.children(t).some(n=>e.isVisible(n)&&e.isMask(n))}function eo(t,e,n,o,r,i,s){if(r.length===0)return;const a=[t,...[...e].reverse()].find(u=>u!==n&&s.sourceId(u)!==void 0&&(s.isExportableOwner?.(u)??!0));if(!a){const u=i.unownedResources.get(t)??{path:o,reasons:new Set};r.forEach(f=>u.reasons.add(f)),i.unownedResources.set(t,u);return}const c=s.sourceId(a),l=i.compositeOwners.get(a)??{ownerId:c,reasons:new Set,sourcePaths:new Set};r.forEach(u=>l.reasons.add(u)),l.sourcePaths.add(o),i.compositeOwners.set(a,l)}function no(t,e){return[...t.unownedResources.entries()].map(([n,o])=>({code:"missing-resource-owner",path:o.path,source_type:e.sourceType(n),reasons:[...o.reasons],...e.sourceId(n)?{node_id:e.sourceId(n)}:{}}))}function He(t){return`assets/${t.replace(/[^A-Za-z0-9._-]/g,"_")}.png`}var Va=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function T(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function w(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function rt(t){const e=w(t);return e!==void 0&&e>=0?e:void 0}function S(t){return typeof t=="string"&&t.trim().length>0?t:void 0}function oo(t,e){const n={...t};for(const[o,r]of Object.entries(e)){const i=n[o];n[o]=T(i)&&T(r)?oo(i,r):r}return n}function ro(t){return T(t.override)?t.override:void 0}function C(t,e){const n=ro(t);return n&&Va(n,e)?n[e]:t[e]}function it(t,e){const n=T(t[e])?t[e]:void 0,o=ro(t),r=o&&T(o[e])?o[e]:void 0;if(!(!n&&!r))return r?oo(n??{},r):{...n}}function io(t,e){const n=C(t,e);return Array.isArray(n)?n:[]}function Ge(t){return it(t,"box")??{}}function Jt(t){return Array.from(t,e=>/^[a-zA-Z0-9._-]$/.test(e)?e:`~${e.codePointAt(0).toString(16)}~`).join("")}function H(t){return S(t.id)}function Ua(t,e,n){return`pixso:refs:synthetic:${Jt(t)}:${e}:${Jt(n.type)}`}function Xa(t,e,n){return H(t)??Ua(e,n,t)}function Ka(t){const e={};for(const[n,o]of Object.entries(t))n!=="children"&&(e[n]=o);return e}function Ya(t){return t.startsWith("style:")?t.slice(6):t}function ft(t){const e=Ya(t),n=e.indexOf("/");return n>0?[e,e.slice(0,n)]:[e]}function Qt(t){return typeof t=="string"&&t.startsWith("style:")?t:void 0}function te(t){const e=[];for(const o of["fills","strokes","effects"])for(const r of io(t,o)){const i=Qt(r);i&&e.push(i)}const n=Qt(it(t,"text")?.style);return n&&e.push(n),[...new Set(e)]}function We(t){const e=[];for(const n of["id","key","ref","styleId","style_id","style_key"]){const o=S(t[n]);o&&e.push(...ft(o))}return[...new Set(e)]}function so(t,e,n){for(const o of[...ft(e),...We(n)])t.has(o)||t.set(o,n)}function Za(t){const e=new Map,n=t.resolvedRefs?.styles;if(Array.isArray(n)){for(const r of n)if(T(r))for(const i of We(r))so(e,i,r)}else if(T(n))for(const[r,i]of Object.entries(n))T(i)&&so(e,r,i);const o=new Map;for(const r of Array.isArray(t.refsIndex.styles)?t.refsIndex.styles:[]){if(!T(r))continue;const i=We(r);for(const s of i)for(const a of ft(s))o.has(a)||o.set(a,r)}return{entries:e,metadata:o}}function ee(t,e){e.usedStyleRefs.add(t);for(const n of ft(t)){const o=e.styles.entries.get(n);if(o)return o}e.unresolvedStyleRefs.add(t)}var qa=["style_value","styleValue","style","value","data"];function ne(t){const e=[],n=new Set,o=(r,i)=>{if(!(i>8||n.has(r))){n.add(r),e.push(r);for(const s of qa){const a=r[s];T(a)&&o(a,i+1)}}};return o(t,0),e}function oe(t,e){for(const n of ne(t))for(const o of e){const r=n[o];if(Array.isArray(r))return r.filter(T);if(T(r))return[r]}return[]}function U(t){return Math.max(0,Math.min(255,Math.round(t)))}function mt(t,e=1){const n=w(t)??e;return Math.max(0,Math.min(1,n))}function Ja(t){if(t.type==="color"){const a=w(t.red),c=w(t.green),l=w(t.blue);return a===void 0||c===void 0||l===void 0?void 0:{type:"color",red:U(a),green:U(c),blue:U(l),alpha:mt(t.alpha)}}const e=w(t.r),n=w(t.g),o=w(t.b);if(e!==void 0&&n!==void 0&&o!==void 0){const a=Math.max(e,n,o)<=1;return{type:"color",red:U(a?e*255:e),green:U(a?n*255:n),blue:U(a?o*255:o),alpha:mt(t.a??t.alpha)}}const r=w(t.red),i=w(t.green),s=w(t.blue);if(!(r===void 0||i===void 0||s===void 0))return{type:"color",red:U(r),green:U(i),blue:U(s),alpha:mt(t.alpha??t.a)}}function Qa(t){const e=t.trim().match(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i);if(!e)return;const n=e[1],o=n.length<=4?Array.from(n,r=>`${r}${r}`).join(""):n;return{type:"color",red:Number.parseInt(o.slice(0,2),16),green:Number.parseInt(o.slice(2,4),16),blue:Number.parseInt(o.slice(4,6),16),alpha:o.length===8?Number.parseInt(o.slice(6,8),16)/255:1}}function Ve(t){const e=t.trim();if(e.endsWith("%")){const o=Number.parseFloat(e.slice(0,-1));return Number.isFinite(o)?U(o*2.55):void 0}const n=Number.parseFloat(e);return Number.isFinite(n)?U(n):void 0}function tc(t){const e=t.trim().match(/^rgba?\((.*)\)$/i);if(!e)return;const n=e[1].replace("/",",").split(/[\s,]+/).filter(Boolean);if(n.length<3)return;const o=Ve(n[0]),r=Ve(n[1]),i=Ve(n[2]);if(o===void 0||r===void 0||i===void 0)return;const s=n[3];return{type:"color",red:o,green:r,blue:i,alpha:mt(s?.endsWith("%")?Number.parseFloat(s.slice(0,-1))/100:s===void 0?1:Number.parseFloat(s))}}function Z(t){if(T(t))return Ja(t);if(typeof t=="string")return Qa(t)??tc(t)}function ec(t,e){const n=w(e);if(n===void 0)return t;const o=mt(n),r=Math.abs(o-t.alpha)<1e-6?t.alpha:t.alpha*o;return{...t,alpha:mt(r)}}function ht(t){if(!Array.isArray(t)||t.length<2)return;const e=w(t[0]),n=w(t[1]);return e!==void 0&&n!==void 0?[e,n]:void 0}function nc(t){if(Array.isArray(t)){const o=Z(t[0]),r=w(t[1]);return o&&r!==void 0?{color:o,ratio:r}:void 0}if(!T(t))return;const e=Z(t.color??t.value),n=w(t.ratio??t.position??t.offset);return e&&n!==void 0?{color:e,ratio:n}:void 0}function Ue(t){const e=(S(t.value)??S(t.type))?.toUpperCase(),n=e?.includes("RADIAL")?"radial":e?.includes("ANGULAR")||e?.includes("CONIC")?"angular":e?.includes("GRADIENT")||e==="LINEAR"?"linear":void 0;if(!n)return;const o=(Array.isArray(t.stops)?t.stops:Array.isArray(t.gradient_range)?t.gradient_range:[]).map(nc).filter(s=>s!==void 0);if(o.length===0)return;const r=Array.isArray(t.points)?t.points:[],i=ht(t.minor_axis_point)??ht(r[0])??[1,0];return{type:n,center_point:ht(t.center_point)??ht(r[1])??[0,0],long_axis_point:ht(t.long_axis_point)??ht(r[2])??[0,1],minor_axis_point:i,gradient_range:o}}function oc(t){return T(t)?Z(t)??Ue(t):Z(t)}function q(t){return S(t.type)?.toLowerCase()}function pt(t){return t.visible!==!1&&w(t.opacity)!==0}function Xe(t){const e=Z(t.color??t.value);return e?ec(e,t.opacity):void 0}function ao(t){const e=w(t);if(e!==void 0)return[e,e,e,e];if(Array.isArray(t)&&t.length===4){const s=t.map(w);if(s.every(a=>a!==void 0))return[s[0],s[1],s[2],s[3]]}if(!T(t))return;const n=w(t.topLeft??t.top_left),o=w(t.topRight??t.top_right),r=w(t.bottomRight??t.bottom_right),i=w(t.bottomLeft??t.bottom_left);if(![n,o,r,i].every(s=>s===void 0))return[n??0,o??0,r??0,i??0]}function rc(t){if(!Array.isArray(t))return;const e=[];for(const n of t){if(!T(n))continue;const o=S(n.position)?.toLowerCase(),r=rt(n.width);r===void 0||o!=="top"&&o!=="right"&&o!=="bottom"&&o!=="left"||e.push({position:o,style:S(n.style)??"solid",width:r,...Z(n.color)?{color:Z(n.color)}:{}})}return e.length>0?e:void 0}function ic(t){if(!Array.isArray(t))return;const e=[];for(const n of t){if(!T(n))continue;const o=Z(n.color);o&&e.push({type:String(n.type).toLowerCase().includes("inner")?"inner":"outer",color:o,x:w(n.x)??0,y:w(n.y)??0,blur:Math.max(0,w(n.blur)??0),...w(n.spread)!==void 0?{spread:w(n.spread)}:{}})}return e.length>0?e:void 0}function sc(t){if(!Array.isArray(t))return;const e=[];for(const n of t){if(!T(n))continue;const o=rt(n.value);o!==void 0&&e.push({type:String(n.type).toLowerCase()==="background"?"background":"layer",value:o})}return e.length>0?e:void 0}function ac(t){if(typeof t!="string")return;const e=t.toLowerCase();return e==="left"||e==="center"||e==="right"||e==="justify"?e:void 0}function cc(t){if(typeof t!="string")return;const e=t.toLowerCase();return e==="center"||e==="middle"?"center":e==="top"||e==="bottom"?e:void 0}function co(t){const e=w(t);if(e!==void 0)return e;if(typeof t!="string")return;const n=Number.parseFloat(t);if(Number.isFinite(n))return n;const o=t.toLowerCase();return o.includes("thin")?100:o.includes("light")?300:o.includes("medium")?500:o.includes("semi")?600:o.includes("bold")?700:o.includes("black")?900:o.includes("regular")||o.includes("normal")?400:void 0}function Ke(t){return T(t)?w(t.value??t.number):w(t)}function _t(t,e){const n=S(e.fontFamily??e.font_family),o=Ke(e.fontSize??e.font_size),r=co(e.fontWeight??e.font_weight??e.fontStyle),i=Ke(e.lineHeight??e.lineHeightNumber??e.line_height),s=Ke(e.letterSpacing??e.letterSpacingNumber??e.letter_spacing);n&&(t.font_family=n),o!==void 0&&(t.font_size=o),r!==void 0&&(t.font_weight=r),i!==void 0&&(t.line_height=i),s!==void 0&&(t.letter_spacing=S(e.letterSpacingUnit)?.toUpperCase()==="PERCENT"&&o!==void 0?o*s/100:s);const a=ac(e.textAlignHorizontal??e.text_align_horizontal),c=cc(e.textAlignVertical??e.text_align_vertical);a&&(t.text_align_horizontal=a),c&&(t.text_align_vertical=c)}var lc={BODY_L:16,BODY_M:14,BODY_S:12,CAPTION_L:12,CAPTION_M:10,SUBTITLE_L:18,SUBTITLE_M:16,SUBTITLE_S:14,TITLE_L:30,TITLE_M:24,TITLE_S:20};function uc(t,e){for(const n of ft(t)){const o=e.styles.metadata.get(n);if(o)return o}}function fc(t,e,n){const o=Qt(it(e,"text")?.style);if(!o)return;const r=uc(o,n);if(!r)return;const i={};for(const a of[...ne(r)].reverse())_t(i,a);const s=S(r.style_name??r.styleName??r.name)?.match(/^Font\/([A-Za-z]+_[A-Za-z]+)\/([^/]+)$/i);s&&(i.font_size??=lc[s[1].toUpperCase()],i.font_weight??=co(s[2]),i.font_family??="HarmonyHeiTi");for(const a of["font_family","font_size","font_weight","line_height","letter_spacing","text_align_horizontal","text_align_vertical"])t[a]===void 0&&i[a]!==void 0&&Object.assign(t,{[a]:i[a]})}function re(t,e){let n=e.assetIndexes.get(t);return n===void 0&&(n=e.assets.length,e.assets.push(t),e.assetIndexes.set(t,n)),`$${n}`}function lo(t,e,n,o){const r=oc(e.background_color),i=Z(e.font_color);r&&(n&&r.type==="color"?t.font_color=r:t.background_color=r),i&&(t.font_color=i);const s=S(e.background_image);s&&!s.startsWith("$")&&(t.background_image=re(s,o));for(const g of["background_position","background_repeat","background_size"]){const m=S(e[g]);m&&(t[g]=m)}_t(t,e);const a=w(e.opacity),c=w(e.rotation_angle);a!==void 0&&(t.opacity=Math.max(0,Math.min(1,a))),c!==void 0&&(t.rotation_angle=c);const l=ao(e.round_corner),u=rc(e.border),f=ic(e.shadow),d=sc(e.filter);l&&(t.round_corner=l),u&&(t.border=u),f&&(t.shadow=f),d&&(t.filter=d)}function dc(t,e,n,o){for(const l of[...ne(e)].reverse())lo(t,l,n,o),_t(t,l);const r=oe(e,["fills","fillPaints","paints"]),i=r.find(l=>pt(l)&&q(l)==="solid"),s=r.find(l=>pt(l)&&q(l)?.includes("gradient")),a=i?Xe(i):void 0,c=s?Ue(s):void 0;a?n?t.font_color=a:t.background_color=a:c&&!n&&(t.background_color=c);for(const l of oe(e,["text","textStyle","typography"]))_t(t,l)}function Nt(t,e,n,o){const r=[];for(const i of io(t,e)){const s=Qt(i);if(!s){T(i)&&r.push(i);continue}const a=ee(s,o);if(!a)continue;const c=oe(a,n);c.length>0?r.push(...c):q(a)!==void 0&&r.push(a)}return r}var Ye=new Set(["VECTOR","BOOLEAN_OPERATION","LINE","POLYGON","STAR"]),uo=new Set(["HM Symbol","Material Icons","Material Symbols","iconfont","icomoon","Font Awesome"]);function Ze(t){return je(t.type,C(t,"mask"))}function gc(t){return to(t,{children:e=>Array.isArray(e.children)?e.children:[],isVisible:e=>C(e,"visible")!==!1,isMask:Ze})}function mc(t,e){let n;for(const r of te(t)){const i=ee(r,e);if(i){for(const s of[...ne(i)].reverse())n=S(s.fontFamily??s.font_family)??n;for(const s of oe(i,["text","textStyle","typography"]))n=S(s.fontFamily??s.font_family)??n}}const o=it(t,"text");return S(o?.fontFamily??o?.font_family)??n}function fo(t,e,n,o,r,i){eo(t,e,n,o,r,i,{sourceId:H,sourceType:s=>s.type})}function hc(t,e,n){const o=new Map;for(const i of e){const s=o.get(i.node)??[];s.push(`hydration-${i.code}`),o.set(i.node,s)}const r=(i,s,a,c)=>{if(C(i,"visible")===!1)return;for(const y of te(i))ee(y,n);const l=Nt(i,"fills",["fills","fillPaints","paints"],n),u=Nt(i,"strokes",["strokes","strokePaints"],n),f=l.filter(pt),d=u.filter(pt),g=[...o.get(i)??[]],m=n.options.occurrenceDslProfile===!0,h=w(C(i,"angle"));!m&&h!==void 0&&h!==0&&g.push("rotation"),!m&&C(i,"showMask")===!0&&g.push("show-mask"),gc(i)&&g.push("mask-composition"),Ze(i)&&s.length===0&&g.push("root-mask"),!m&&f.length>1&&g.push("multiple-fills"),!m&&d.length>1&&g.push("multiple-strokes");const p=S(C(i,"blendMode"))?.toUpperCase();if(p&&p!=="NORMAL"&&p!=="PASS_THROUGH"&&g.push("blend-mode"),f.some(y=>q(y)?.includes("gradient")===!0&&Array.isArray(y.transform)&&!Array.isArray(y.points))&&g.push("unresolved-gradient-transform"),fo(i,s,a,c,g,n),!H(i)){const y=[];f.some(x=>{const v=q(x);return v==="asset"||v==="image"})&&y.push("idless-bitmap");const b=S(C(i,"vectorRef"));(m?Ye.has(i.type)&&b===void 0:Ye.has(i.type)||b!==void 0)&&y.push("idless-vector"),(i.type==="TEXT"||i.type==="PARAGRAPH")&&uo.has(mc(i,n)??"")&&y.push("idless-icon-font"),fo(i,s,a,c,y,n)}(Array.isArray(i.children)?i.children:[]).forEach((y,b)=>r(y,[...s,i],a,`${c}.${b}`))};t.forEach((i,s)=>r(i,[],i,`root.${s}`)),n.resourceDiagnostics=no(n,{sourceId:H,sourceType:i=>i.type})}function pc(t,e){const n=S(e.name)?.match(/\.[a-z0-9]+$/i)?.[0]??".png";return`assets/pixso/asset-${Jt(t)}${n}`}function yc(t,e){const n=S(t.url??t.src??t.path);if(n)return n;const o=S(t.id??t.hash??t.assetId??t.value);if(o)return e.options.assetPathForId?.(o,t)??pc(o,t)}function bc(t,e,n,o){const r=e.filter(pt),i=r.find(d=>q(d)==="solid"),s=r.find(d=>q(d)?.includes("gradient")),a=i?Xe(i):void 0,c=s?Ue(s):void 0;if(a?n?t.font_color=a:t.background_color=a:c&&!n&&(t.background_color=c),n)return{};const l=r.find(d=>q(d)==="asset"||q(d)==="image");if(!l)return{};const u=yc(l,o);if(!u)return{asset:l};t.background_image=re(u,o),t.background_position="center",t.background_repeat="no-repeat";const f=S(l.imageScaleMode??l.scaleMode)?.toUpperCase();return t.background_size=f==="FIT"?"contain":f==="STRETCH"?"100% 100%":"cover",{asset:l,assetPath:u}}function vc(t,e,n){const o=e.find(s=>pt(s)&&q(s)==="solid"),r=o?Xe(o):void 0,i=rt(C(n,"strokeWeight"));!r||i===void 0||i===0||(t.border=["top","right","bottom","left"].map(s=>({position:s,style:"solid",width:i,color:r})))}function xc(t){return Array.isArray(t)?{x:w(t[0])??0,y:w(t[1])??0}:T(t)?{x:w(t.x)??0,y:w(t.y)??0}:{x:0,y:0}}function wc(t,e){const n=[],o=[];for(const r of e){if(r.visible===!1)continue;const i=S(r.type)?.toUpperCase()??"";if(i==="DROP_SHADOW"||i==="INNER_SHADOW"){const s=Z(r.color);if(!s)continue;const a=xc(r.offset);n.push({type:i==="INNER_SHADOW"?"inner":"outer",color:s,x:a.x,y:a.y,blur:Math.max(0,w(r.radius??r.blur)??0),...w(r.spread)!==void 0?{spread:w(r.spread)}:{}})}else if(i==="BACKGROUND_BLUR"||i==="FOREGROUND_BLUR"||i==="LAYER_BLUR"){const s=rt(r.radius??r.value);s!==void 0&&o.push({type:i==="BACKGROUND_BLUR"?"background":"layer",value:s})}}n.length>0&&(t.shadow=n),o.length>0&&(t.filter=o)}function Sc(t,e,n,o){const r=t.type==="TEXT"||t.type==="PARAGRAPH",i={origin_width:e,origin_height:n},s=te(t);for(const p of s){const y=ee(p,o);y&&dc(i,y,r,o)}const a=it(t,"style");a&&lo(i,a,r,o);const c=Nt(t,"fills",["fills","fillPaints","paints"],o),l=Nt(t,"strokes",["strokes","strokePaints"],o),u=Nt(t,"effects",["effects","effectiveEffects"],o),f=bc(i,c,r,o);vc(i,l,t),wc(i,u);const d=it(t,"text");d&&_t(i,d),r&&fc(i,t,o);const g=w(C(t,"opacity")),m=w(C(t,"angle")),h=ao(C(t,"radius"));return g!==void 0&&(i.opacity=Math.max(0,Math.min(1,g))),m!==void 0&&(i.rotation_angle=m),h&&(i.round_corner=h),{style:i,...f}}function go(t){if(typeof t!="string")return;const e=t.trim().toUpperCase().replace(/[ -]+/g,"_");return e==="START"||e==="FLEX_START"||e==="LEFT"||e==="TOP"?"MIN":e==="END"||e==="FLEX_END"||e==="RIGHT"||e==="BOTTOM"?"MAX":e==="MIN"||e==="CENTER"||e==="MAX"||e==="SPACE_BETWEEN"||e==="BASELINE"?e:void 0}function kc(t){const e=w(t);if(e!==void 0)return{top:e,right:e,bottom:e,left:e};if(Array.isArray(t)&&t.length===4){const s=t.map(w);if(s.every(a=>a!==void 0))return{top:s[0],right:s[1],bottom:s[2],left:s[3]}}if(!T(t))return;const n=w(t.top),o=w(t.right),r=w(t.bottom),i=w(t.left);if(![n,o,r,i].every(s=>s===void 0))return{top:n??0,right:o??0,bottom:r??0,left:i??0}}function $c(t){const e=it(t,"autoLayout");if(!e)return;const n=S(e.mode??e.direction??e.stackMode)?.toUpperCase(),o=n==="HORIZONTAL"||n==="VERTICAL"||n==="NONE"?n:void 0,r=o==="HORIZONTAL"?e.itemHoriAlign:e.itemVertAlign,i=o==="HORIZONTAL"?e.itemVertAlign:e.itemHoriAlign,s={};o&&(s.stackMode=o);const a=go(e.primaryAlign??e.align??r),c=go(e.counterAlign??i);a&&(s.stackPrimaryAlignItems=a),c&&(s.stackCounterAlignItems=c);const l=w(e.gap??e.stackSpacing??e.autoLayoutItemSpacing);l!==void 0&&(s.stackSpacing=l);const u=kc(e.padding);u&&(s.stackPaddingTop=u.top,s.stackPaddingRight=u.right,s.stackPaddingBottom=u.bottom,s.stackPaddingLeft=u.left);for(const[f,d]of[["stackPrimarySizing",["primarySizing","stackPrimarySizing","widthResize"]],["stackCounterSizing",["counterSizing","stackCounterSizing","heightResize"]],["stackChildPrimarySizing",["childPrimarySizing","stackChildPrimarySizing"]],["stackChildCounterSizing",["childCounterSizing","stackChildCounterSizing"]]]){const g=d.map(m=>S(e[m])).find(Boolean);g&&(s[f]=g.toUpperCase())}return(e.absolute===!0||e.autoLayoutAbsolutePos===!0||e.autoLayoutItemAbsolutePos===!0)&&(s.autoLayoutAbsolutePos=!0),e.wrap===!0||String(e.wrap).toUpperCase()==="WRAP"||e.stackWrap==="WRAP"?s.stackWrap="WRAP":(e.wrap===!1||e.stackWrap==="NO_WRAP")&&(s.stackWrap="NO_WRAP"),Object.keys(s).length>0?JSON.stringify(s):void 0}function Ic(t){const e=new Map,n=o=>{if(!T(o))return;const r=S(o.id);r&&e.set(r,o)};for(const o of Array.isArray(t.refsIndex.components)?t.refsIndex.components:[])n(o);for(const o of Array.isArray(t.refsIndex.componentSets)?t.refsIndex.componentSets:[]){n(o);for(const r of Array.isArray(o.variants)?o.variants:[])n(r)}return e}function Ac(t,e,n){if(t.type!=="INSTANCE")return;const o=S(C(t,"componentRef")),r=o?n.componentMetadata.get(o):void 0,i=S(r?.componentKey)??S(C(t,"componentKey")),s=S(t.name)??e,a=S(r?.name);return{...i?{component_key:i}:{},...a?{component_name:a}:{},...o?{symbol_key:o}:{},instance_name:s}}function Rc(t,e){const n=t.type==="INSTANCE"?S(C(t,"componentRef")):void 0,o=n?e.resolvedRefs?.componentRoots?.[n]:void 0,r=o?Ge(o):{},i=Ge(t);return{width:rt(i.w??i.width)??rt(r.w??r.width),height:rt(i.h??i.height)??rt(r.h??r.height)}}function Cc(t,e){const n=[];for(const o of t){let r,i;for(const f of ft(o))r??=e.styles.metadata.get(f),i??=e.styles.entries.get(f);const s=r??i,a=S(s?.style_key)??ft(o)[0],c=S(s?.style_name??s?.name),l=S(s?.style_type??s?.category),u=T(i?.style_value)?i.style_value:void 0;n.push({style_key:a,...c?{style_name:c}:{},...l?{style_type:l}:{},...u?{style_value:u}:{},resolved:i!==void 0})}return n.length>0?n:void 0}function Tc(t,e=!1){return t.type==="INSTANCE"?"FRAME":t.type==="PARAGRAPH"?"TEXT":t.type==="SYMBOL"?"COMPONENT":e&&(Ye.has(t.type)||t.type==="IMAGE")?"FRAME":t.type}function mo(t,e,n,o,r,i,s=!1){const a=Xa(t,o,r),c=Ge(t),l=e+(w(c.x??c.left)??0),u=n+(w(c.y??c.top)??0),f=Rc(t,i.input),d=f.width??0,g=f.height??0,m=i.compositeOwners.get(t),h=i.unownedResources.get(t),p=m?{style:{origin_width:d,origin_height:g}}:Sc(t,d,g,i);h&&(delete p.style.background_image,delete p.style.background_position,delete p.style.background_repeat,delete p.style.background_size,uo.has(p.style.font_family??"")&&delete p.style.font_family),m&&(i.emittedCompositeOwners.add(t),p.style.background_image=re(He(m.ownerId),i),p.style.background_position="center",p.style.background_repeat="no-repeat",p.style.background_size="100% 100%");const y=te(t),b=p.asset?S(p.asset.id??p.asset.hash??p.asset.assetId):void 0,x={source_format:"refs",source_type:t.type,...H(t)?{guid:H(t)}:{synthetic_id:a},...S(C(t,"componentRef"))?{component_ref:S(C(t,"componentRef"))}:{},...S(C(t,"componentNodeRef"))?{component_node_ref:S(C(t,"componentNodeRef"))}:{},...S(C(t,"componentSetRef"))?{component_set_ref:S(C(t,"componentSetRef"))}:{},...S(C(t,"vectorRef"))?{vector_ref:S(C(t,"vectorRef"))}:{},...y.length>0?{style_refs:y}:{},...b?{asset_refs:[b]}:{},...p.assetPath?{image_asset:p.assetPath}:{},...m?{composite_reasons:[...m.reasons],composite_source_paths:[...m.sourcePaths],occurrence_asset:He(m.ownerId)}:{},...h?{unmaterialized_resource_reasons:[...h.reasons]}:{},source:Ka(t)},v={pixso:x},k=$c(t);k&&(v.design_layout=k);const I=S(C(t,"vectorRef"));I&&!m&&!h&&(v.vector_shape=I,i.options.occurrenceDslProfile===!0&&(p.style.background_image||(p.style.background_image=re(`assets/pixso/vector-${Jt(I)}`,i)),H(t)||(x.guid=I))),Ze(t)&&(v.mask=!0,x.mask=!0);const M=(Array.isArray(t.children)?t.children:[]).map((j,nt)=>({child:j,sourceIndex:nt})).filter(({child:j})=>C(j,"visible")!==!1),L=i.options.occurrenceDslProfile===!0&&s?M:[...M].reverse(),E=s||t.type==="INSTANCE",P=m?[]:L.map(({child:j,sourceIndex:nt})=>mo(j,l,u,o,`${r}.${nt}`,i,E));m?(v.image_role="content",v.image_source="composite",v.image_opaque=!1):p.style.background_image&&(v.image_role=P.length>0?"background":"content",v.image_source="raster",v.image_opaque=!1);const O={key:a,name:S(t.name)??H(t)??t.type,type:h?.reasons.has("idless-icon-font")?"FRAME":Tc(t,h!==void 0),box:{x:l,y:u,width:d,height:g},style:p.style,extend:v},J=it(t,"text");O.type==="TEXT"&&typeof J?.content=="string"&&(O.content=J.content);const V=Ac(t,a,i);V&&(O.component_instance=V),P.length>0&&(O.children=P);const Q=Cc(y,i);return Q&&(O.library_style=Q),O}function _c(t){const e=Math.min(...t.map(a=>a.box.x)),n=Math.min(...t.map(a=>a.box.y)),o=Math.max(...t.map(a=>a.box.x+a.box.width)),r=Math.max(...t.map(a=>a.box.y+a.box.height)),i=o-e,s=r-n;return{key:"pixso:refs:synthetic:root",name:"Pixso Design",type:"FRAME",box:{x:e,y:n,width:i,height:s},style:{origin_width:i,origin_height:s},extend:{pixso:{source_format:"refs",source_type:"FRAME",synthetic_root:!0,synthetic_id:"pixso:refs:synthetic:root"}},children:[...t].reverse()}}function qe(t,e={}){if(!qt(t))throw new Error("convertPixsoRefsToRawNewRoot: \u8F93\u5165\u4E0D\u662F\u6709\u6548\u7684 Pixso refs \u8BBE\u8BA1\u6570\u636E");if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("convertPixsoRefsToRawNewRoot: options \u5FC5\u987B\u662F\u5BF9\u8C61");const n=Fa(t,{occurrenceDriven:e.occurrenceDslProfile===!0});if(e.strict===!0&&n.issues.length>0){const s=n.issues.map(a=>`${a.code}:${H(a.node)??a.path}[${a.componentRef??"-"}]`).join(", ");throw new Error(`convertPixsoRefsToRawNewRoot: component hydration failed: ${s}`)}const o={input:{roots:n.roots,refsIndex:t.refsIndex,...t.stats!==void 0?{stats:t.stats}:{},...t.resolvedRefs!==void 0?{resolvedRefs:t.resolvedRefs}:{}},options:e,assets:[],assetIndexes:new Map,componentMetadata:Ic(t),styles:Za(t),usedStyleRefs:new Set,unresolvedStyleRefs:new Set,compositeOwners:new Map,emittedCompositeOwners:new Set,unownedResources:new Map,resourceDiagnostics:[]};if(hc(n.roots,n.issues,o),e.strict===!0&&o.resourceDiagnostics.length>0){const s=o.resourceDiagnostics.map(a=>`${a.path}[${a.reasons.join(",")}]`).join(", ");throw new Error(`convertPixsoRefsToRawNewRoot: resource owner resolution failed: ${s}`)}if(e.strict===!0&&e.allowUnresolvedStyles!==!0&&o.unresolvedStyleRefs.size>0)throw new Error(`convertPixsoRefsToRawNewRoot: unresolved style references: ${[...o.unresolvedStyleRefs].join(", ")}`);const r=n.roots.map((s,a)=>({root:s,sourceIndex:a})).filter(({root:s})=>C(s,"visible")!==!1).map(({root:s,sourceIndex:a})=>mo(s,0,0,H(s)??`root-${a}`,`root.${a}`,o));if(r.length===0)throw new Error("convertPixsoRefsToRawNewRoot: roots \u6CA1\u6709\u53EF\u89C1\u8282\u70B9");const i=r.length===1?r[0]:_c(r);return{assets:o.assets,content:[i],meta:{source:"pixso-refs",name:i.name,hydration_issues:n.issues.map(s=>({code:s.code,path:s.path,...H(s.node)?{node_id:H(s.node)}:{},...s.componentRef?{component_ref:s.componentRef}:{}})),style_refs:[...o.usedStyleRefs],unresolved_style_refs:[...o.unresolvedStyleRefs],resource_owners:[...o.emittedCompositeOwners].map(s=>{const a=o.compositeOwners.get(s);return{owner_id:a.ownerId,reasons:[...a.reasons],source_paths:[...a.sourcePaths]}}),resource_diagnostics:o.resourceDiagnostics}}}function F(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $(t){return typeof t=="string"&&t.trim().length>0?t:void 0}function st(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function ho(t){const e=$(t.styleKey);if(!e)return;const n=$(t.versionHash);return n?`${e}/${n}`:e}function Nc(t){const e=new Map;if(!F(t))return e;for(const[n,o]of Object.entries(t)){if(!F(o))continue;const r=ho(o);r&&e.set(n,{reference:`style:${r}`})}return e}var po=["fontFamily","fontStyle","fontSize","fontWeight","lineHeight","letterSpacing","letterSpacingUnit","textAlignHorizontal","textAlignVertical"];function Mc(t){const e={};if(!F(t))return e;for(const n of Object.values(t)){if(!F(n))continue;const o=ho(n);if(!o||e[o]!==void 0)continue;const r={...n};if($(n.styleType)?.toUpperCase()==="TEXT"&&!F(n.text)){const i={};for(const s of po)n[s]!==void 0&&(i[s]=n[s]);Object.keys(i).length>0&&(r.text=i)}e[o]=r}return e}function Ec(t){if($(t.type)?.toUpperCase()==="IMAGE"){const e=F(t.image)?t.image:{},n={...t,type:"asset"};delete n.image;const o=$(e.hash);o&&(n.id=o);const r=$(e.name);return r&&(n.name=r),n}return{...t}}function yo(t){if(!Array.isArray(t))return;const e=t.filter(F).map(Ec);return e.length>0?e:void 0}function Pc(t,e){const n=$(t.inheritFillStyleID),o=n?e.get(n)?.reference:void 0;return o?[o]:yo(t.fillPaints)}var Oc=[...po,"textDecoration","textCase","textTruncation","maxLines"];function Lc(t,e){const n=$(t.type)?.toUpperCase();if(n!=="TEXT"&&n!=="PARAGRAPH")return;const o={},r=t.nodeText;typeof r=="string"&&(o.content=r);for(const c of Oc)t[c]!==void 0&&(o[c]=t[c]);const i=$(t.textAutoResize);i&&(o.autoResize=i);const s=$(t.inheritTextStyleID),a=s?e.get(s)?.reference:void 0;return a&&(o.style=a),Object.keys(o).length>0?o:void 0}function Fc(t){if(!F(t))return;const e={...t},n=st(t.autoLayoutPaddingTop),o=st(t.autoLayoutPaddingRight),r=st(t.autoLayoutPaddingBottom),i=st(t.autoLayoutPaddingLeft);return!F(t.padding)&&[n,o,r,i].some(s=>s!==void 0)&&(e.padding={top:n??0,right:o??0,bottom:r??0,left:i??0}),e.primaryAlign===void 0&&t.autoLayoutPrimaryAlign!==void 0&&(e.primaryAlign=t.autoLayoutPrimaryAlign),e.counterAlign===void 0&&t.autoLayoutCounterAlign!==void 0&&(e.counterAlign=t.autoLayoutCounterAlign),e.counterGap===void 0&&t.autoLayoutCounterItemSpacing!==void 0&&(e.counterGap=t.autoLayoutCounterItemSpacing),e}function Bc(t){const e={},n=st(t.width),o=st(t.height),r=st(t.left),i=st(t.top);return n!==void 0&&(e.w=n),o!==void 0&&(e.h=o),r!==void 0&&(e.x=r),i!==void 0&&(e.y=i),Object.keys(e).length>0?e:void 0}var zc=["visible","angle","blendMode","opacity","strokeWeight","effects","componentKey","frameMaskDisabled","showMask"];function Dc(t){return Array.isArray(t.childNode)?t.childNode.filter(F):[]}function bo(t,e){const n=$(t.guid),o=$(t.type);if(!n||!o)return;const r={id:n,type:o},i=$(t.name);i&&(r.name=i);const s=Bc(t);s&&(r.box=s);for(const h of zc)t[h]!==void 0&&(r[h]=t[h]);const a=t.cornerRadius??t.radius;a!==void 0&&(r.radius=a);const c=$(t.horizontalConstraint),l=$(t.verticalConstraint);if((c||l)&&(r.constraints={...c?{horizontal:c}:{},...l?{vertical:l}:{}}),o==="INSTANCE"){const h=$(t.mainComponent);h&&(r.componentRef=h);const p=$(t.mainStateGroup);p&&(r.componentSetRef=p)}const u=Pc(t,e);u&&(r.fills=u);const f=yo(t.strokePaints);f&&(r.strokes=f);const d=Lc(t,e);d&&(r.text=d);const g=Fc(t.autoLayout);g&&(r.autoLayout=g);const m=Dc(t);return $(t.svgSha)?(r.vectorRef=n,r.assetType="icon",m.length>0&&(r.childrenSummary={total:m.length,omitted:m.length,reason:"vector-icon"}),r):(m.length>0&&(r.children=[...m].reverse().map(h=>bo(h,e)).filter(h=>h!==void 0)),r)}function vo(t,e){const n=$(t.id);n&&e[n]===void 0&&(e[n]=t);for(const o of Array.isArray(t.children)?t.children:[])vo(o,e)}function jc(t,e){if(t.type!==e.type||$(t.name)!==$(e.name))return!1;const n=$(t.componentSetRef),o=$(e.componentSetRef);if(n&&o)return n===o;const r=$(t.componentRef),i=$(e.componentRef);if(r&&i)return r===i;const s=$(e.componentNodeRef);return s!==void 0&&s===$(t.componentNodeRef)}function xo(t){return $(t.id)!==void 0||F(t.override)&&Object.keys(t.override).length>0?!0:Array.isArray(t.children)&&t.children.filter(F).some(xo)}function Hc(t){const e=(o,r)=>{const i=new Map,s=new Set;for(const a of o){const c=$(a.componentNodeRef);if(!($(a.id)===void 0&&c!==void 0))continue;const l=o.find(u=>$(u.id)!==void 0&&!i.has(u)&&jc(a,u));l&&(s.add(a),$(a.componentRef)!==void 0&&$(l.componentRef)!==void 0&&$(a.componentRef)!==$(l.componentRef)&&$(l.componentNodeRef)===void 0&&i.set(l,c))}return o.filter(a=>!(s.has(a)||r&&$(a.id)===void 0&&$(a.componentNodeRef)!==void 0&&!xo(a))).map(a=>{const c=i.get(a);return n(c?{...a,componentNodeRef:c}:a)})},n=o=>{let r=o;const i=F(r.override)?r.override:void 0;return $(r.id)!==void 0&&r.visible===void 0&&i?.visible===void 0&&(r={...r,visible:!0}),!Array.isArray(r.children)||r.children.length===0?r:{...r,children:e(r.children.filter(F),$(r.id)!==void 0)}};return t.map(n)}function Gc(t,e){const n=Nc(e),o={};for(const r of Array.isArray(t)?t:[]){if(!F(r))continue;const i=bo(r,n);i&&vo(i,o)}return{componentRoots:o,styles:Mc(e)}}var Wc=1e-6;function _(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function B(t,e=0){return typeof t=="number"&&Number.isFinite(t)?t:e}function N(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function A(t){return typeof t=="string"&&t.trim().length>0?t:void 0}function Mt(t){return _(t)?A(t.guid)!==void 0&&A(t.type)!==void 0:!1}function Vc(t){return Mt(t)&&typeof t.width=="number"&&Number.isFinite(t.width)&&t.width>=0&&typeof t.height=="number"&&Number.isFinite(t.height)&&t.height>=0}function yt(t){return!_(t)||!Array.isArray(t.pixTreeNodes)||t.pixTreeNodes.length===0?!1:t.pixTreeNodes.every(Vc)&&t.pixTreeNodes.some(e=>e.visible!==!1)}function Je(t){return Math.max(0,Math.min(255,Math.round(B(t))))}function Uc(t,e){return t===void 0?e??1:e===void 0||Math.abs(t-e)<=Wc?t:t*e}function Qe(t,e){if(!_(t))return;const n=t,o=n.r??n.red,r=n.g??n.green,i=n.b??n.blue;if(N(o)===void 0||N(r)===void 0||N(i)===void 0)return;const s=Uc(N(n.a??n.alpha),N(e));return{type:"color",red:Je(o),green:Je(r),blue:Je(i),alpha:Math.max(0,Math.min(1,s))}}function tn(t){return Array.isArray(t)?t.filter(e=>_(e)&&e.visible!==!1):[]}function en(t){return Array.isArray(t)?t.filter(e=>_(e)&&e.visible!==!1):[]}function wo(t,e){const n=A(e);if(!n)return;const o=t.localStyleMap[n];return _(o)?o:void 0}function nn(t,e,n,o){const r=tn(t[e]);return Array.isArray(t[e])&&t[e].length>0?r:tn(wo(o,t[n])?.[e])}function Xc(t,e){const n=en(t.effectiveEffects);if(Array.isArray(t.effectiveEffects)&&t.effectiveEffects.length>0)return n;const o=en(t.effects);return Array.isArray(t.effects)&&t.effects.length>0?o:en(wo(e,t.inheritEffectStyleID)?.effects)}function Kc(t){return t==="PARAGRAPH"?"TEXT":t==="GROUP"?"FRAME":t==="SYMBOL"?"COMPONENT":t}function So(t){return je(t.type,t.mask)}function Yc(t){if(typeof t!="string")return;const e=t.toLowerCase();if(e==="left"||e==="center"||e==="right"||e==="justify")return e}function Zc(t){if(typeof t!="string")return;const e=t.toLowerCase();if(e==="middle"||e==="center")return"center";if(e==="top"||e==="bottom")return e}function qc(t){const e=N(t.rectangleTopLeftCornerRadius),n=N(t.rectangleTopRightCornerRadius),o=N(t.rectangleBottomRightCornerRadius),r=N(t.rectangleBottomLeftCornerRadius);if([e,n,o,r].some(s=>s!==void 0))return[e??0,n??0,o??0,r??0];const i=N(t.cornerRadius);return i!==void 0?[i,i,i,i]:void 0}function Jc(t,e){const n=N(t.strokeWeight);if(n===void 0||n<=0)return;const o=nn(t,"strokePaints","inheritStrokeStyleID",e).find(i=>i.type==="SOLID"),r=Qe(o?.color,o?.opacity);if(!(!o||!r))return["top","right","bottom","left"].map(i=>({position:i,style:"solid",width:n,color:r}))}function Qc(t,e){const n=Xc(t,e).flatMap(o=>{if(o.type!=="DROP_SHADOW"&&o.type!=="INNER_SHADOW")return[];const r=Qe(o.color);return r?[{type:o.type==="INNER_SHADOW"?"inner":"outer",color:r,x:B(o.offset?.x),y:B(o.offset?.y),blur:Math.max(0,B(o.radius)),spread:B(o.spread)}]:[]});return n.length>0?n:void 0}function on(t){return Array.from(t,e=>/^[a-zA-Z0-9._-]$/.test(e)?e:`~${e.codePointAt(0).toString(16)}~`).join("")}function tl(t){const e=A(t.image?.hash),n=A(t.image?.name);if(e){const o=n?.match(/\.[a-z0-9]+$/i)?.[0]??".png";return`assets/pixso/hash-${on(e)}${o}`}return n?`assets/pixso/name-${on(n)}`:void 0}function el(t){const e=A(t);return e?`assets/pixso/svg-${on(e)}`:void 0}function ko(t,e){let n=e.assetIndexes.get(t);return n===void 0&&(n=e.assets.length,e.assets.push(t),e.assetIndexes.set(t,n)),`$${n}`}function nl(t){const e=typeof t=="string"?t.toUpperCase():"";return{background_position:"center",background_repeat:"no-repeat",background_size:e==="FIT"?"contain":e==="STRETCH"?"100% 100%":"cover"}}function $o(t){if(typeof t!="string")return;const e=t.trim().toUpperCase().replace(/[ -]+/g,"_");if(e==="START"||e==="FLEX_START"||e==="LEFT"||e==="TOP")return"MIN";if(e==="END"||e==="FLEX_END"||e==="RIGHT"||e==="BOTTOM")return"MAX";if(e==="CENTER"||e==="SPACE_BETWEEN"||e==="BASELINE")return e}function Io(t,...e){for(const n of e){const o=N(t[n]);if(o!==void 0)return o}}function Ao(t,...e){for(const n of e){const o=A(t[n]);if(o!==void 0)return o}}function ol(t){const e=t.autoLayout;if(!_(e))return;const n=Ao(e,"stackMode"),o=$o(e.stackPrimaryAlignItems??e.autoLayoutPrimaryAlign),r=$o(e.stackCounterAlignItems??e.autoLayoutCounterAlign),i={};(n==="HORIZONTAL"||n==="VERTICAL"||n==="NONE")&&(i.stackMode=n),o&&(i.stackPrimaryAlignItems=o),r&&(i.stackCounterAlignItems=r);const s=Io(e,"stackSpacing","autoLayoutItemSpacing","autoLayoutCounterItemSpacing");s!==void 0&&(i.stackSpacing=s);for(const[a,c]of[["stackPaddingTop","autoLayoutPaddingTop"],["stackPaddingRight","autoLayoutPaddingRight"],["stackPaddingBottom","autoLayoutPaddingBottom"],["stackPaddingLeft","autoLayoutPaddingLeft"]]){const l=Io(e,a,c);l!==void 0&&(i[a]=l)}for(const a of["stackPrimarySizing","stackCounterSizing","stackChildPrimarySizing","stackChildCounterSizing"]){const c=Ao(e,a);c&&(i[a]=c)}return e.autoLayoutItemAbsolutePos===!0&&(i.autoLayoutAbsolutePos=!0),(e.stackWrap==="WRAP"||e.autoLayoutWrap===!0)&&(i.stackWrap="WRAP"),(e.stackWrap==="NO_WRAP"||e.autoLayoutWrap===!1)&&(i.stackWrap="NO_WRAP"),Object.keys(i).length>0?JSON.stringify(i):void 0}function rl(t){if(!Array.isArray(t.props))return{};for(const e of t.props)if(!(!_(e)||!Array.isArray(e.pluginData))){for(const n of e.pluginData)if(!(!_(n)||typeof n.value!="string"))try{const o=JSON.parse(n.value);if(!_(o))continue;const r={componentKey:A(o.compSetKey)??A(o.compKey),componentName:A(o.compName),instanceProperties:o.attrs};if(r.componentKey===void 0&&r.componentName===void 0&&r.instanceProperties===void 0)continue;return r}catch{}}return{}}function Ro(t){if(!Array.isArray(t))return;const e=new Map,n=new Map;for(const o of t){if(!_(o))continue;const r=A(o.pathString),i=A(o.componentId);r?e.set(r,o):i&&n.set(i,o)}return e.size>0||n.size>0?{exact:e,fallback:n}:void 0}function il(t,e){return t?{exact:new Map([...t.exact,...e.exact]),fallback:new Map([...t.fallback,...e.fallback])}:e}function sl(t,e){if(e)return e.overrides.exact.get(e.path)??e.overrides.fallback.get(t.guid)}function Co(t,e){return{...t,...e,guid:t.guid,name:e.name??t.name,type:t.type,width:B(e.width,B(t.width)),height:B(e.height,B(t.height)),childNode:t.childNode}}function To(t,e){const n=sl(t,e);return n?Co(t,n):t}function al(t,e,n){if(n)return{overrides:il(e?.overrides,n),path:t.guid};if(e)return{overrides:e.overrides,path:`${e.path}/${t.guid}`}}var cl=32,Et="__masterPageKey",rn="__hydratedFromMaster";function ll(t){if(!Array.isArray(t)||t.length===0)return;const e=new Map,n=(o,r)=>{e.has(o.guid)||e.set(o.guid,{node:o,rootGuid:r});for(const i of Array.isArray(o.childNode)?o.childNode:[])Mt(i)&&n(i,r)};for(const o of t)Mt(o)&&n(o,o.guid);return e.size>0?{byGuid:e}:void 0}function ie(t){return(Array.isArray(t.childNode)?t.childNode:[]).filter(Mt)}function ul(t){return t.type==="INSTANCE"&&ie(t).length===0}function _o(t,e){if(Array.isArray(t)){for(const n of t)if(_(n)&&(A(n.pathString)===e||A(n.componentId)===e))return n}}var fl=new Set(["guid","type","childNode","left","top","width","height","depth","visible","props","mainComponent","mainStateGroup","overrideKey","propRefMap","propAssignMap","propDefMap","pathString","componentId"]);function No(t){if(!t)return{};const e={};for(const[n,o]of Object.entries(t))!fl.has(n)&&o!==void 0&&(e[n]=o);return e}function Mo(t,e,n){const o={...No(e),...No(n),...t};return N(o.width)===void 0&&(o.width=N(e.width)),N(o.height)===void 0&&(o.height=N(e.height)),o}var dl=new Set(["pathString","componentId","guid","type","name","top","left","width","height","angle","flipHorizontally","flipVertically","visible","exportSettings","autoLayout","autoLayoutByParent","pluginData","componentNormName","overrideKey","propRefMap","propAssignMap","propDefMap"]);function gl(t){return Object.keys(t).some(e=>!dl.has(e))}function Eo(t,e){const n=Ro(t);if(n)return{exact:n.exact,fallback:n.fallback,relPath:"",consumed:e}}function ml(t,e){return t.map(n=>({...n,relPath:n.relPath?`${n.relPath}/${e}`:e}))}function hl(t,e,n){let o=t;const r=[];for(let i=e.length-1;i>=0;i-=1){const s=e[i],a=s.relPath?`${s.relPath}/${t.guid}`:t.guid;let c,l=s.exact.get(a);l?c=a:(l=s.fallback.get(t.guid),l&&(c=t.guid)),!(!l||c===void 0)&&(s.consumed?.add(c),r.push(l),n.imageTouch===void 0&&an(l,o,n.ctx)&&(n.imageTouch=a),o=Co(o,l))}return{node:o,matchedEntries:r}}function Po(t,e){const n=[...ml(e,t.guid)],o=Eo(t.props);return o&&n.push(o),n}function sn(t,e,n,o,r,i){const s=`${e}/${t.guid}`,{node:a,matchedEntries:c}=hl({...t,[Et]:s},r,i),l=ie(t);if(t.type==="INSTANCE"&&l.length===0){const g=n?`${n}/${t.guid}`:t.guid,m=()=>(i.compositeLeafHops.add(g),i.overriddenCompositeLeaf===void 0&&c.some(gl)&&(i.overriddenCompositeLeaf=g),a),h=A(t.mainComponent),p=h?i.index.byGuid.get(h):void 0;if(!h||!p)return i.issues.push({code:h?"unresolved-main-component":"missing-main-component",instance_guid:t.guid}),m();if(o.includes(h))return i.issues.push({code:"cyclic-master-ref",instance_guid:t.guid,detail:h}),m();if(o.length>=cl)return i.issues.push({code:"master-depth-exceeded",instance_guid:t.guid,detail:h}),m();const y=_o(t.props,h);y&&i.imageTouch===void 0&&an(y,a,i.ctx)&&(i.imageTouch=`${s}#root`);const b=ie(p.node);if(b.length===0)return i.issues.push({code:"empty-master-root",instance_guid:t.guid,detail:h}),m();const x=Mo(a,p.node,y);x[Et]=s,x[rn]=h,x.props=void 0;const v=[...o,h],k=Po(t,r);return x.childNode=b.map(I=>sn(I,s,g,v,k,i)),x}const u=t.type==="INSTANCE";let f=r,d=n;return u&&(f=Po(t,r),d=n?`${n}/${t.guid}`:t.guid,a.props=void 0),a.childNode=l.map(g=>sn(g,u?s:e,d,o,f,i)),a}var pl=["fillPaints","svgSha","visible","inheritFillStyleID"];function Oo(t){return t.some(e=>e.type==="IMAGE")}function yl(t,e){return A(t.svgSha)?!0:Oo(nn(t,"fillPaints","inheritFillStyleID",e))}function an(t,e,n){return pl.some(o=>o in t)?yl(e,n)?!0:Oo(tn(t.fillPaints))||A(t.svgSha)!==void 0:!1}function bl(t,e){const n=e.masterHydration,o=A(t.mainComponent);if(!o){n.issues.push({code:"missing-main-component",instance_guid:t.guid});return}if(!n.index){n.issues.push({code:"missing-master-tree",instance_guid:t.guid,detail:o});return}const r=n.index.byGuid.get(o);if(!r){n.issues.push({code:"unresolved-main-component",instance_guid:t.guid,detail:o});return}const i=A(t.mainStateGroup);i&&i!==r.rootGuid&&n.issues.push({code:"main-state-group-mismatch",instance_guid:t.guid,detail:`${i} != ${r.rootGuid}`});const s=ie(r.node);if(s.length===0){n.issues.push({code:"empty-master-root",instance_guid:t.guid,detail:o});return}const a=_o(t.props,o);if(a&&an(a,t,e)){n.issues.push({code:"override-image-fallback",instance_guid:t.guid,detail:`${t.guid}#root`});return}const c=new Set,l=Eo(t.props,c),u=l?[l]:[],f=[],d={index:n.index,ctx:e,issues:f,compositeLeafHops:new Set},g=Mo(t,r.node,a);if(g[rn]=o,g.props=void 0,g.childNode=s.map(m=>sn(m,t.guid,"",[o],u,d)),d.imageTouch!==void 0){n.issues.push({code:"override-image-fallback",instance_guid:t.guid,detail:d.imageTouch});return}if(d.overriddenCompositeLeaf!==void 0){n.issues.push({code:"composite-leaf-override-fallback",instance_guid:t.guid,detail:d.overriddenCompositeLeaf});return}if(l){const m=[...d.compositeLeafHops],h=[],p=(y,b)=>b?(n.issues.push({code:"unmappable-override-fallback",instance_guid:t.guid,detail:y}),{shouldFallback:!0}):(h.push({code:"unmapped-override-ignored",instance_guid:t.guid,detail:y}),{shouldFallback:!1});for(const y of l.exact.keys())if(!(y===o||c.has(y))&&p(y,m.some(b=>y===b||y.startsWith(`${b}/`))).shouldFallback)return;for(const y of l.fallback.keys())if(!(y===o||c.has(y))&&p(y,m.length>0).shouldFallback)return;f.push(...h)}return n.issues.push(...f),g}function vl(t){for(const e of t){if(e.type!=="IMAGE")continue;const n=tl(e);if(n)return{rasterPaint:e,rasterPath:n}}return{}}function xl(t,e,n){const o={origin_width:Math.max(0,B(t.width)),origin_height:Math.max(0,B(t.height))},r=N(t.opacity);r!==void 0&&(o.opacity=Math.max(0,Math.min(1,r)));const i=nn(t,"fillPaints","inheritFillStyleID",n),s=i.find(p=>p.type==="SOLID"),a=Qe(s?.color,s?.opacity);a&&(e==="TEXT"?o.font_color=a:o.background_color=a);const{rasterPaint:c,rasterPath:l}=vl(i),u=el(t.svgSha),f=l??u;if(f&&(o.background_image=ko(f,n),Object.assign(o,nl(c?.imageScaleMode))),e==="TEXT"){const p=A(t.fontFamily),y=N(t.fontSize),b=N(t.fontWeight),x=N(t.lineHeightNumber),v=N(t.letterSpacingNumber??t.letterSpacing);p&&(o.font_family=p),y!==void 0&&(o.font_size=y),b!==void 0&&(o.font_weight=b),x!==void 0&&(o.line_height=x),v!==void 0&&(o.letter_spacing=v);const k=Yc(t.textAlignHorizontal),I=Zc(t.textAlignVertical);k&&(o.text_align_horizontal=k),I&&(o.text_align_vertical=I)}const d=Jc(t,n),g=qc(t),m=Qc(t,n);d&&(o.border=d),g&&(o.round_corner=g),m&&(o.shadow=m);const h=N(t.rotationAngle??t.rotation);return h!==void 0&&(o.rotation_angle=h),{style:o,resources:{rasterPaint:c,rasterPath:l,svgPath:u}}}function wl(t,e){const n={guid:t.guid,source_type:t.type};A(t[Et])&&(n.hydrated_from_master_tree=!0);const o=A(t[rn]);o&&(n.hydrated_main_component=o);const r=A(e.rasterPaint?.image?.hash),i=A(e.rasterPaint?.image?.name),s=A(t.svgSha),a=A(t.mainComponent),c=A(t.componentKey);return r&&(n.image_hash=r),i&&(n.image_name=i),e.rasterPath&&(n.image_asset=e.rasterPath),s&&(n.svg_sha=s),e.svgPath&&(n.svg_asset=e.svgPath),a&&(n.main_component=a),c&&(n.component_key=c),So(t)&&(n.mask=!0),t.strokeAlign!==void 0&&(n.stroke_align=t.strokeAlign),t.fontStyle!==void 0&&(n.font_style=t.fontStyle),n}function Sl(t,e){const n=rl(t),o=A(t.componentKey);return{component_key:n.componentKey??o,instance_name:n.componentName??A(t.name)??e,symbol_key:o,instance_properties:n.instanceProperties}}function Lo(t,e,n,o,r){let i=To(t,r);ul(i)&&A(i[Et])===void 0&&(i=bl(i,o)??i);const s=e+B(i.left),a=n+B(i.top),c=Math.max(0,B(i.width)),l=Math.max(0,B(i.height)),u=Kc(i.type),f=A(i[Et])??i.guid,{style:d,resources:g}=xl({...i,width:c,height:l},u,o),m=A(i.svgSha),h={pixso:wl(i,g)};So(i)&&(h.mask=!0);const p=ol(i);p&&(h.design_layout=p);const y={key:f,name:A(i.name)??f,type:u,box:{x:s,y:a,width:c,height:l},style:d,extend:h};u==="TEXT"&&typeof i.nodeText=="string"&&(y.content=i.nodeText),i.type==="INSTANCE"&&(y.component_instance=Sl(i,f));const b=i.type==="INSTANCE"?Ro(i.props):void 0,x=(Array.isArray(i.childNode)?i.childNode:[]).filter(Mt).map(I=>({child:I,state:al(I,r,b)})).filter(({child:I,state:M})=>To(I,M).visible!==!1),v=i.type==="INSTANCE"&&x.length===0,k=x.map(({child:I,state:M})=>Lo(I,s,a,o,M));return k.length>0&&(y.children=k),v?(h.image_role="content",h.image_source="composite"):g.rasterPath?(h.image_role=k.length>0?"background":"content",h.image_source="raster"):g.svgPath&&(h.image_role=k.length>0?"background":"content",h.image_source="vector",h.vector_shape=m,k.length===0&&(h.icon=!0)),y}function Pt(t){const e=t.extend?.pixso;return _(e)?e:{}}function kl(t){return A(Pt(t).guid)}function $l(t){return A(Pt(t).source_type)??t.type}function Fo(t){const e=Pt(t);return t.extend?.mask===!0||je(e.source_type,e.mask)}var Il=new Set(["FRAME","GROUP","INSTANCE","COMPONENT","IMAGE","VECTOR","BOOLEAN_OPERATION","ELLIPSE","RECTANGLE","LINE","POLYGON","STAR","MASK","SUPPOSITIONAL"]);function Bo(t){return Il.has(t.type)?(t.children??[]).every(Bo):!1}function Al(t){const e=Pt(t);return e.synthetic_root!==!0&&e.hydrated_from_master_tree!==!0&&Bo(t)}function Rl(t,e,n){const o=He(e.ownerId);t.style={origin_width:t.box.width,origin_height:t.box.height,background_image:ko(o,n),background_position:"center",background_repeat:"no-repeat",background_size:"100% 100%"};const r={...t.extend??{}};delete r.vector_shape,delete r.icon,r.image_role="content",r.image_source="composite",r.image_opaque=!1,r.pixso={...Pt(t),composite_reasons:[...e.reasons],composite_source_paths:[...e.sourcePaths],occurrence_asset:o},t.extend=r,t.children=void 0}function Cl(t,e){const n=[],o=new Map,r=new Map,i=s=>{const a=s.style?.background_image,c=typeof a=="string"?a.match(/^\$(\d+)$/):null;if(c){const l=Number(c[1]),u=e[l];if(u!==void 0){let f=o.get(l);f===void 0&&(f=r.get(u),f===void 0&&(f=n.length,n.push(u),r.set(u,f)),o.set(l,f)),s.style.background_image=`$${f}`}}s.children?.forEach(i)};return t.forEach(i),n}function Tl(t,e){const n={compositeOwners:new Map,unownedResources:new Map},o={sourceId:kl,sourceType:$l,isExportableOwner:Al},r={children:c=>c.children??[],isVisible:()=>!0,isMask:Fo},i=(c,l,u,f)=>{const d=[];to(c,r)&&d.push(Wa),Fo(c)&&l.length===0&&d.push("root-mask"),eo(c,l,u,f,d,n,o),c.children?.forEach((g,m)=>i(g,[...l,c],u,`${f}.${m}`))};t.forEach((c,l)=>i(c,[],c,`root.${l}`));const s=new Set,a=c=>{const l=n.compositeOwners.get(c);if(l){Rl(c,l,e),s.add(c);return}c.children?.forEach(a)};if(t.forEach(a),s.size>0){const c=Cl(t,e.assets);e.assets.splice(0,e.assets.length,...c),e.assetIndexes.clear(),c.forEach((l,u)=>e.assetIndexes.set(l,u))}return{resourceOwners:[...s].map(c=>{const l=n.compositeOwners.get(c);return{owner_id:l.ownerId,reasons:[...l.reasons],source_paths:[...l.sourcePaths]}}),resourceDiagnostics:no(n,o)}}function _l(t){const e=Math.min(...t.map(a=>a.box.x)),n=Math.min(...t.map(a=>a.box.y)),o=Math.max(...t.map(a=>a.box.x+a.box.width)),r=Math.max(...t.map(a=>a.box.y+a.box.height)),i=o-e,s=r-n;return{key:"pixso:root",name:"Pixso Design",type:"FRAME",box:{x:e,y:n,width:i,height:s},style:{origin_width:i,origin_height:s},extend:{pixso:{synthetic_root:!0}},children:t}}function Nl(t){return _(t)?yt(t.full)&&_(t.occurrence):!1}function Ml(t,e){if(!yt(t))throw new TypeError("assemblePixsoDualDesignRoot: full \u4E0D\u662F\u6709\u6548\u7684 simplify=false \u5FEB\u7167\uFF08\u7F3A pixTreeNodes\uFF09");if(!_(e)||!Array.isArray(e.roots)||e.roots.length===0)throw new TypeError("assemblePixsoDualDesignRoot: occurrence \u4E0D\u662F\u6709\u6548\u7684 simplify=true \u8FD4\u56DE\uFF08\u7F3A\u975E\u7A7A roots\uFF09");return{...t,occurrenceDsl:{roots:e.roots,refsIndex:_(e.refsIndex)?e.refsIndex:{}}}}function El(t){if(t==null)return;if(!_(t))return"invalid";const e=t.roots;return!Array.isArray(e)||e.length===0||!e.every(n=>_(n)&&A(n.type)!==void 0)?"invalid":{roots:e,refsIndex:_(t.refsIndex)?t.refsIndex:{},..._(t.resolvedRefs)?{resolvedRefs:t.resolvedRefs}:{}}}function Pl(t,e){const n=Gc(t.pixComponentTreeDslNodes,t.localStyleMap),o=e.resolvedRefs,r=o?.styles,i=Array.isArray(r)?[...r,...Object.entries(n.styles).map(([a,c])=>({style_key:a,...c}))]:{...n.styles,..._(r)?r:{}},s=qe({roots:Hc(e.roots),refsIndex:e.refsIndex,resolvedRefs:{...o??{},componentRoots:{...n.componentRoots,...o?.componentRoots??{}},styles:i}},{occurrenceDslProfile:!0});return{...s,meta:{..._(s.meta)?s.meta:{},source:"pixso",name:s.content[0]?.name,isContainFixed:t.isContainFixed===!0,occurrence_dsl:!0}}}function cn(t){if(!yt(t))throw new Error("convertPixsoToRawNewRoot: \u8F93\u5165\u4E0D\u662F\u6709\u6548\u7684 Pixso \u8BBE\u8BA1\u7A3F\u6570\u636E");const e=El(t.occurrenceDsl);if(e!==void 0&&e!=="invalid")return Pl(t,e);const n={assets:[],assetIndexes:new Map,localStyleMap:_(t.localStyleMap)?t.localStyleMap:{},masterHydration:{index:ll(t.pixComponentTreeDslNodes),issues:[]}};e==="invalid"&&n.masterHydration.issues.push({code:"invalid-occurrence-dsl",instance_guid:"occurrenceDsl"});const o=t.pixTreeNodes.filter(a=>a.visible!==!1).map(a=>Lo(a,0,0,n));if(o.length===0)throw new Error("convertPixsoToRawNewRoot: pixTreeNodes \u6CA1\u6709\u53EF\u89C1\u6839\u8282\u70B9");const r=Tl(o,n),i=o.length===1?o[0]:_l(o),s=n.masterHydration.issues;return{assets:n.assets,content:[i],meta:{source:"pixso",name:i.name,isContainFixed:t.isContainFixed===!0,...s.length>0?{master_hydration_issues:s}:{},...r.resourceOwners.length>0?{resource_owners:r.resourceOwners}:{},...r.resourceDiagnostics.length>0?{resource_diagnostics:r.resourceDiagnostics}:{}}}}var se=t=>t.x+t.width,ae=t=>t.y+t.height;function Ol(t,e){const n=Math.max(t.x,e.x),o=Math.max(t.y,e.y),r=Math.min(se(t),se(e)),i=Math.min(ae(t),ae(e));return r<=n||i<=o?null:{x:n,y:o,width:r-n,height:i-o}}function zo(t,e,n=0){return e.x>=t.x-n&&e.y>=t.y-n&&se(e)<=se(t)+n&&ae(e)<=ae(t)+n}var Ll=["design_mark","custom_mark"];function ce(t){const e=t.extend;return e?Ll.some(n=>Object.prototype.hasOwnProperty.call(e,n)):!1}function Ot(t,e=!0){return e&&ce(t)?!0:(t.children??[]).some(n=>Ot(n,!0))}var bt=.5;function Do(t){if(!t)return[0,0,0,0];const[e,n=e,o=e,r=n]=t.split(/\s+/).map(i=>parseFloat(i)||0);return[e,n,o,r]}function ln(t){const e=t.trim().toLowerCase();if(!e||e==="transparent"||e==="none")return!0;const n=e.match(/rgba?\(([^)]+)\)/);if(n){const o=n[1].split(",").map(r=>parseFloat(r.trim()));if(o.length===4&&(isNaN(o[3])||o[3]<=0))return!0}return!!(/^#[0-9a-f]{8}$/.test(e)&&e.slice(-2)==="00")}function un(t){if(!t)return!1;const e=/rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(?:,\s*([\d.]+))?\s*\)/gi;let n;for(;(n=e.exec(t))!==null;){if(n[1]===void 0)continue;const r=parseFloat(n[1]);if(!isNaN(r)&&r<1)return!0}const o=/#[0-9a-f]{6}([0-9a-f]{2})/gi;for(;(n=o.exec(t))!==null;)if(parseInt(n[1],16)<255)return!0;return!1}function Fl(t){if(t.imageOpaque===!1)return!0;const e=t.style;return e?!!(e.opacity!==void 0&&e.opacity<1||un(e.backgroundImage)):!1}function le(t){return Fl(t)?!0:(t.children??[]).some(le)}function Bl(t){const e=t.style;if(e?.opacity!==void 0&&e.opacity<1||e?.filter||t.type==="IMAGE"&&t.imageSource==="icon-font"||t.type==="IMAGE"&&t.imageOpaque===!1||e?.backgroundImage&&un(e.backgroundImage))return!1;const n=!!e?.backgroundColor&&!ln(e.backgroundColor),o=!!e?.backgroundImage,r=t.type==="IMAGE";return n||o||r}function jo(t){return t.type==="TEXT"&&t.characters?.trim()||t.type==="IMAGE"&&t.imageSource==="icon-font"?!0:(t.children??[]).some(jo)}function zl(t,e){return t.type==="SUPPOSITIONAL"&&t.name.includes("FloatingTab")&&t.geometry.height<=48+bt&&jo(e)}function Dl(t,e,n,o){if(t.geometry.rotation||e.geometry.rotation||!zo(n,o,bt))return!1;const r=Do(t.style?.borderRadius),i=Do(e.style?.borderRadius),s=e.geometry.x-t.geometry.x,a=e.geometry.y-t.geometry.y,c=t.geometry.x+t.geometry.width-(e.geometry.x+e.geometry.width),l=t.geometry.y+t.geometry.height-(e.geometry.y+e.geometry.height);return!(r[0]-Math.min(s,a)>i[0]+bt||r[1]-Math.min(c,a)>i[1]+bt||r[2]-Math.min(c,l)>i[2]+bt||r[3]-Math.min(s,l)>i[3]+bt)}function jl(t){const e=new Map,n=(r,i,s)=>{const a={x:r.geometry.x,y:r.geometry.y,width:r.geometry.width,height:r.geometry.height},c=r.isPageRoot?a:s?Ol(a,s):a;e.set(r.id,{node:r,ancestors:i,descendants:new Set,effRect:c});const l=new Set(i).add(r.id);r.children?.forEach(u=>n(u,l,c))};n(t,new Set,null);const o=r=>{const i=new Set;for(const s of r.children??[]){const a=o(s);i.add(s.id),a.forEach(c=>i.add(c))}return e.get(r.id).descendants=i,i};return o(t),e}function Hl(t){const e=jl(t),n=Array.from(e.values()),o=new Set;for(const r of n){const i=r.node;if(!i.isPageRoot&&!Ot(i)){if(!r.effRect){o.add(i.id);continue}for(const s of n){const a=s.node;if(a.id!==i.id&&!(a.renderOrder<=i.renderOrder)&&!r.ancestors.has(a.id)&&!r.descendants.has(a.id)&&s.effRect&&!zl(a,i)&&Bl(a)&&Dl(a,i,s.effRect,r.effRect)){o.add(i.id);break}}}}return o}function Ho(t,e){t.children&&(t.children=t.children.filter(n=>!e.has(n.id)),t.children.forEach(n=>Ho(n,e)))}function Gl(t){const e=Hl(t);return e.size===0?0:(Ho(t,e),e.size)}function Lt(t){return t.imageRole==="background"&&!(t.virtualContainer?.kind==="background-container"&&(t.children?.length??0)>0)}function z(t){return!!(t.hints?.autoLayoutChild?.absolute||Lt(t)||t.outOfFlow!==void 0)}var ue=.5,Wl=["clipsContent","clips_content","clip","clips","crop"],Vl=new Set(["viewport","image-crop","mask-shape","visual-overflow","effect-overflow","composite-image","normal-container","unknown"]),Ul=new Set(["explicit","strong","weak","fallback"]),Go=new Set(["hidden","visible"]);function tt(t,e){return t.includes(e)?t:[...t,e]}function et(t,e,n,o){return{overflow:t,intent:e,confidence:n,reasons:o.length>0?o:["fallback-visible"]}}function Wo(t){if(!t||typeof t!="object")return!1;const e=t;return Go.has(e.overflow)&&Vl.has(e.intent)&&Ul.has(e.confidence)&&Array.isArray(e.reasons)&&e.reasons.length>0&&e.reasons.every(n=>typeof n=="string")}function Xl(t){if(Wo(t.clipDecision))return t.clipDecision;const e=t.extend?.clip_decision;if(Wo(e))return e}function Kl(t){if(typeof t=="boolean")return t;if(typeof t=="string"){const e=t.trim().toLowerCase();if(e==="true"||e==="hidden"||e==="clip"||e==="crop")return!0;if(e==="false"||e==="visible"||e==="none")return!1}}function Yl(t){const e=t.extend;if(!e)return;const n=e.overflow;if(Go.has(n)){const o=n;return et(o,o==="hidden"?"image-crop":"unknown","explicit",[`explicit-overflow-${o}`])}for(const o of Wl){if(!(o in e))continue;const r=Kl(e[o]);if(r!==void 0)return et(r?"hidden":"visible",r?"image-crop":"unknown","explicit",[r?"explicit-clip-hidden":"explicit-clip-visible"])}}function Zl(t){return tt(t,"no-explicit-clip-field")}function ql(t,e){const n=t.geometry,o=e.geometry;return{left:o.x<n.x-ue,top:o.y<n.y-ue,right:o.x+o.width>n.x+n.width+ue,bottom:o.y+o.height>n.y+n.height+ue}}function Jl(t){return t.left||t.right||t.top||t.bottom}function Ql(t){const e=[];return t.left&&e.push("direct-child-overflows-parent-left"),t.right&&e.push("direct-child-overflows-parent-right"),t.top&&e.push("direct-child-overflows-parent-top"),t.bottom&&e.push("direct-child-overflows-parent-bottom"),e}function tu(t){return t.type==="SUPPOSITIONAL"||/suppositional/i.test(t.name)}function eu(t){return!!(t.imageUrl||t.style?.backgroundImage?.includes("url(")||t.extend?.background_image||t.extend?.image_source==="raster")}function Vo(t){return t.imageSource==="raster"||eu(t)}function nu(t){return!!(t.extend?.mask===!0||t.name.includes("\u8499\u7248")||/mask/i.test(t.name)||t.style?.borderRadius&&t.children?.some(Vo))}function ou(t){return!!(t.style?.boxShadow||t.style?.textShadow)}function ru(t){return t.type==="IMAGE"&&t.imageSource==="composite"}function Uo(t,e){const n=`${t.name} ${e.name}`.toLowerCase();return/banner|card|bottom|overlay|gradient|蒙层|编组|底部|渐变/.test(n)||e.imageSource==="composite"}function Xo(t){for(const e of t.children??[]){const n=e.clipDecision;if(n?.overflow==="hidden"&&(n.intent==="image-crop"||n.intent==="mask-shape")||Xo(e))return!0}return!1}function iu(t,e){if(e||t.isPageRoot)return et("hidden","viewport","strong",["root-viewport"]);const n=Zl([]);if(ru(t))return et("visible","composite-image","strong",tt(n,"stage-composite-image"));if(ou(t))return et("visible","effect-overflow","strong",tt(n,"box-shadow-extends-outside-bounds"));const o=t.children??[];let r=!1,i,s=o.length>0;for(const c of o){const l=ql(t,c);if(!Jl(l))continue;if(s=!1,tu(c)){r=!0;continue}const u=[...n,...Ql(l)];if(Vo(c))return et("hidden",nu(t)?"mask-shape":"image-crop","strong",tt(u,"child-background-image-overflows-parent"));(!i||Uo(t,c))&&(i=u,Uo(t,c)&&(i=tt(i,"visual-composition-overflow")))}if(i)return et("visible","visual-overflow","strong",i);let a=n;return r&&(a=tt(a,"suppositional-ignored")),Xo(t)&&(a=tt(a,"descendant-overflow-not-bubbled")),s?et("visible","normal-container","weak",tt(a,"direct-children-inside-parent")):et("visible","unknown","fallback",tt(a,"fallback-visible"))}function su(t){const e=(n,o)=>{n.children?.forEach(r=>e(r,!1)),n.clipDecision=Xl(n)??Yl(n)??iu(n,o)};return e(t,!0),t}function Ko(t,e){let n=0;const o=(r,i,s,a)=>{r.depth=i,r.zIndex=s,r.renderOrder=n++,e==="figma"&&r.sourcePaintOrder===void 0&&(r.sourcePaintOrder=r.renderOrder),r.parentId=a;const c=r.children;if(!(!c||c.length===0))if(e==="figma")for(let l=c.length-1;l>=0;l--){const u=c.length-1-l;o(c[l],i+1,u,r.id)}else for(let l=0;l<c.length;l++)o(c[l],i+1,l,r.id)};o(t,0,0,void 0)}function fn(t){Ko(t,"figma")}function fe(t){Ko(t,"html")}function au(t){return t.type==="COMPONENT"||t.type==="INSTANCE"||t.componentInstance!==void 0}function cu(t,e){const n=t.componentInstance?.component_key;for(const o of e){const r={id:t.id,name:t.name,...n?{componentKey:n}:{}};o.parentComponents=[...o.parentComponents??[],r]}}function Yo(t){return Zo((t.style?.opacity??1)*lu(t.style?.color))}function lu(t){if(!t)return 1;const e=t.match(/rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+(?:\s*,\s*([\d.]+%?))?\s*\)/i);return e?e[1]===void 0?1:uu(e[1]):t.trim().match(/^#[0-9a-fA-F]{8}$/)?parseInt(t.slice(7,9),16)/255:1}function uu(t){const e=Number.parseFloat(t);return Number.isFinite(e)?Zo(t.trim().endsWith("%")?e/100:e):1}function Zo(t){return Math.max(0,Math.min(1,t))}function qo(t){return{x:t.geometry.x,y:t.geometry.y,width:t.geometry.width,height:t.geometry.height}}function Jo(t,e,n,o){if(e<=0)return 1;const r=Math.max(t,n),i=Math.min(t+e,n+o)-r;return i<=0?0:i/e}function fu(t,e){const n=qo(t);return{widthRatio:Jo(n.x,n.width,e.x,e.width),heightRatio:Jo(n.y,n.height,e.y,e.height)}}function Qo(t,e){t.children&&(t.children=t.children.filter(n=>!e.has(n.id)),t.children.forEach(n=>Qo(n,e)))}function du(t){const e=qo(t),n=new Set,o=r=>{for(const i of r.children??[]){if(!Ot(i)){const{widthRatio:s,heightRatio:a}=fu(i,e);if(s>0&&s<.15&&a>=.9){n.add(i.id);continue}}o(i)}};return o(t),n.size===0?0:(Qo(t,n),n.size)}function de(t,e){const n=Math.max(t.x,e.x),o=Math.max(t.y,e.y),r=Math.min(t.x+t.width,e.x+e.width),i=Math.min(t.y+t.height,e.y+e.height);return r<=n||i<=o?0:(r-n)*(i-o)}function G(t){return Math.max(0,t.width)*Math.max(0,t.height)}function ge(t,e){const n=Math.min(G(t),G(e));return n===0?0:de(t,e)/n}function gu(t){let e=1/0,n=1/0,o=-1/0,r=-1/0;for(const i of t){const s=i.geometry;s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x+s.width>o&&(o=s.x+s.width),s.y+s.height>r&&(r=s.y+s.height)}return{x:e,y:n,width:o-e,height:r-n}}var mu=[{name:"Top Banner",componentKey:"4ed76036ca4d91523d0c8ef981226e651d6ff2ca",imageRole:"background",imageSource:"composite",collapseToImage:!0,geometry:"self-width-subtree-height"},{name:"#illustration_Templates/Design size/Phone/Port",symbolKey:"0622dae8e6496f3632ff4da87c8c6c696c50c875",imageRole:"background",imageSource:"composite",collapseToImage:!0,geometry:"self-width-subtree-height"}];function hu(t){if(!t||typeof t!="object")return;const e=t.component_key;return typeof e=="string"?e:void 0}function pu(t){if(!t||typeof t!="object")return;const e=t.symbol_key;return typeof e=="string"?e:void 0}function yu(t){const e=hu(t.component_instance),n=pu(t.component_instance);if(!(!e&&!n))return mu.find(o=>t.name===o.name&&(o.componentKey===void 0||e===o.componentKey)&&(o.symbolKey===void 0||n===o.symbolKey))}function vt(t){if(!t)return;const e=n=>Math.round(n).toString(16).padStart(2,"0");return t.alpha>=1?`#${e(t.red)}${e(t.green)}${e(t.blue)}`:`rgba(${Math.round(t.red)}, ${Math.round(t.green)}, ${Math.round(t.blue)}, ${t.alpha})`}function tr(t){return!!t&&(t.type==="linear"||t.type==="radial"||t.type==="angular")}function er(t,e){if(!t)return;const n=t.match(/^\$(\d+)$/);if(n)return e[Number(n[1])]}function bu(t){const[e,n]=t.center_point,[o,r]=t.long_axis_point,i=o-e,s=r-n;return((Math.atan2(s,i)*180/Math.PI+90)%360+360)%360}function vu(t){const e=t.gradient_range.map(n=>`${vt(n.color)} ${(n.ratio*100).toFixed(1)}%`).join(", ");return t.type==="linear"?`linear-gradient(${bu(t).toFixed(1)}deg, ${e})`:t.type==="radial"?`radial-gradient(${e})`:`conic-gradient(${e})`}function xu(t,e){const n={},o=t.background_color,r=t.background_image,i=er(r,e),s=i?`url("${i}")`:void 0,a=o&&tr(o)?vu(o):void 0,c=o&&!tr(o)?vt(o):void 0;return a&&s?n.backgroundImage=`${a}, ${s}`:a?n.backgroundImage=a:(s&&(n.backgroundImage=s),c&&(n.backgroundColor=c)),s&&(t.background_position&&(n.backgroundPosition=t.background_position),t.background_repeat&&(n.backgroundRepeat=t.background_repeat),t.background_size&&(n.backgroundSize=t.background_size)),n}function wu(t){if(!t.border||t.border.length===0)return{};const e={top:0,right:0,bottom:0,left:0},n={top:"",right:"",bottom:"",left:""},o={top:"currentColor",right:"currentColor",bottom:"currentColor",left:"currentColor"};for(const i of t.border)e[i.position]=i.width,n[i.position]=i.style||"solid",o[i.position]=vt(i.color)??"currentColor";if(e.top===e.right&&e.right===e.bottom&&e.bottom===e.left&&n.top===n.right&&n.right===n.bottom&&n.bottom===n.left&&o.top===o.right&&o.right===o.bottom&&o.bottom===o.left)return{border:`${e.top}px ${n.top||"solid"} ${o.top}`};const r={};return e.top&&(r.borderTop=`${e.top}px ${n.top||"solid"} ${o.top}`),e.right&&(r.borderRight=`${e.right}px ${n.right||"solid"} ${o.right}`),e.bottom&&(r.borderBottom=`${e.bottom}px ${n.bottom||"solid"} ${o.bottom}`),e.left&&(r.borderLeft=`${e.left}px ${n.left||"solid"} ${o.left}`),r}function Su(t){const e=t.round_corner;if(!e)return;const[n,o,r,i]=e;if(!(n===0&&o===0&&r===0&&i===0))return n===o&&o===r&&r===i?`${n}px`:`${n}px ${o}px ${r}px ${i}px`}function ku(t){if(!(!t.shadow||t.shadow.length===0))return t.shadow.map(e=>{const n=e.type==="inner"?"inset ":"",o=vt(e.color)??"rgba(0,0,0,1)";return`${n}${e.x}px ${e.y}px ${e.blur}px ${e.spread??0}px ${o}`}).join(", ")}function $u(t){const e=t.shadow?.filter(n=>n.type!=="inner")??[];if(e.length!==0)return e.map(n=>{const o=vt(n.color)??"rgba(0,0,0,1)";return`${n.x}px ${n.y}px ${n.blur}px ${o}`}).join(", ")}function Iu(t){if(!t.filter||t.filter.length===0)return{};const e=[],n=[];for(const r of t.filter){const i=`blur(${r.value}px)`;r.type==="background"?n.push(i):e.push(i)}const o={};return e.length&&(o.filter=e.join(" ")),n.length&&(o.backdropFilter=n.join(" ")),o}function Au(t,e){const n=t.style;if(!n)return;const o=t.type==="TEXT",r={};o||Object.assign(r,xu(n,e)),o&&(n.font_color&&(r.color=vt(n.font_color)),n.font_size!==void 0&&(r.fontSize=`${n.font_size}px`),n.font_weight!==void 0&&(r.fontWeight=n.font_weight),n.line_height!==void 0&&(r.lineHeight=`${n.line_height}px`),n.letter_spacing!==void 0&&(r.letterSpacing=`${n.letter_spacing}px`),n.text_align_horizontal&&(r.textAlign=n.text_align_horizontal),n.text_align_vertical&&(r.verticalAlign=n.text_align_vertical==="center"?"middle":n.text_align_vertical));const i=Su(n);i&&(r.borderRadius=i),Object.assign(r,wu(n));const s=o?$u(n):ku(n);return s&&(o?r.textShadow=s:r.boxShadow=s),Object.assign(r,Iu(n)),n.opacity!==void 0&&n.opacity!==1&&(r.opacity=n.opacity),Object.keys(r).length>0?r:void 0}var Ru=new Set(["MIN","CENTER","MAX","SPACE_BETWEEN","BASELINE"]);function nr(t){if(t)return Ru.has(t)?t:void 0}function me(t){if(t){if(t==="FIXED")return"FIXED";if(t==="RESIZE_TO_FIT"||t==="HUG"||t==="AUTO")return"HUG";if(t==="FILL"||t==="STRETCH")return"FILL"}}function Cu(t){if(t)try{return JSON.parse(t)}catch{return}}function Tu(t,e){const n=Cu(t.extend?.design_layout);let o,r;if(n){if(n.stackMode==="HORIZONTAL"||n.stackMode==="VERTICAL"){const c=n.stackPaddingTop||n.stackPaddingRight||n.stackPaddingBottom||n.stackPaddingLeft;o={mode:n.stackMode,primaryAlign:nr(n.stackPrimaryAlignItems),counterAlign:nr(n.stackCounterAlignItems),gap:n.stackSpacing,padding:c?{top:n.stackPaddingTop??0,right:n.stackPaddingRight??0,bottom:n.stackPaddingBottom??0,left:n.stackPaddingLeft??0}:void 0,wrap:n.stackWrap==="WRAP"?!0:void 0,primarySizing:me(n.stackPrimarySizing),counterSizing:me(n.stackCounterSizing)}}const s=me(n.stackChildPrimarySizing),a=me(n.stackChildCounterSizing);(n.autoLayoutAbsolutePos||s||a)&&(r={absolute:n.autoLayoutAbsolutePos||void 0,primarySizing:s,counterSizing:a})}const i={componentName:e};return o&&(i.autoLayout=o),r&&(i.autoLayoutChild=r),i}function _u(t){return t==="TEXT"?"span":t==="VECTOR"||t==="BOOLEAN_OPERATION"?"svg":"div"}function Nu(t){return t==="content"||t==="background"}function Mu(t){return t==="raster"||t==="vector"||t==="composite"||t==="icon-font"}var Eu=new Set(["HM Symbol","Material Icons","Material Symbols","iconfont","icomoon","Font Awesome"]);function or(t){const e=Nu(t.extend?.image_role)?t.extend.image_role:void 0,n=Mu(t.extend?.image_source)?t.extend.image_source:void 0;return e||n?{role:e,source:n}:void 0}function Pu(t){const e=t.extend?.background_layer;if(!e||typeof e!="object")return;const n=typeof e.score=="number"?e.score:void 0,o=Array.isArray(e.contained_node_ids)?e.contained_node_ids.filter(i=>typeof i=="string"):void 0,r=Array.isArray(e.reasons)?e.reasons.filter(i=>typeof i=="string"):void 0;if(!(n===void 0||!o||!r))return{score:n,containedNodeIds:o,reasons:r}}function Ou(t){const e=t.extend?.virtual_container;if(!e||typeof e!="object")return;const n=Array.isArray(e.wrapped_node_ids)?e.wrapped_node_ids.filter(r=>typeof r=="string"):void 0,o=typeof e.reason=="string"?e.reason:void 0;if(!(!n||!o)){if(e.kind==="background-container"){const r=typeof e.background_node_id=="string"?e.background_node_id:void 0;return r?{kind:"background-container",backgroundNodeId:r,wrappedNodeIds:n,reason:o}:void 0}if(e.kind==="row-container"||e.kind==="column-container"||e.kind==="center-wrapper")return{kind:e.kind,wrappedNodeIds:n,reason:o}}}function Lu(t){const e=t.extend?.layout;if(!(!e||typeof e!="object")){if(e.mode==="flex"&&(e.direction==="row"||e.direction==="column")){const n={mode:"flex",direction:e.direction};return e.padding&&typeof e.padding=="object"&&Number.isFinite(e.padding.top)&&Number.isFinite(e.padding.right)&&Number.isFinite(e.padding.bottom)&&Number.isFinite(e.padding.left)&&(n.padding={top:e.padding.top,right:e.padding.right,bottom:e.padding.bottom,left:e.padding.left}),typeof e.gap=="number"&&Number.isFinite(e.gap)&&(n.gap=e.gap),typeof e.align=="string"&&(e.align==="flex-start"||e.align==="center"||e.align==="flex-end")&&(n.align=e.align),Array.isArray(e.hintConflicts)&&e.hintConflicts.length>0&&(n.hintConflicts=e.hintConflicts),n}if(e.mode==="absolute"){const n={mode:"absolute"};return Array.isArray(e.hintConflicts)&&e.hintConflicts.length>0&&(n.hintConflicts=e.hintConflicts),n}}}var Fu=new Set(["hidden","visible"]),Bu=new Set(["explicit","strong","weak","fallback"]),zu=new Set(["viewport","image-crop","mask-shape","visual-overflow","effect-overflow","composite-image","normal-container","unknown"]);function Du(t){const e=t.extend?.clip_decision;if(!e||typeof e!="object")return;const n=Fu.has(e.overflow)?e.overflow:void 0,o=zu.has(e.intent)?e.intent:void 0,r=Bu.has(e.confidence)?e.confidence:void 0,i=Array.isArray(e.reasons)?e.reasons.filter(s=>typeof s=="string"):void 0;if(!(!n||!o||!r||!i||i.length===0))return{overflow:n,intent:o,confidence:r,reasons:i}}function ju(t){const e=or(t);if(e)return e;const n=yu(t);if(n)return{role:n.imageRole,source:n.imageSource,collapseToImage:n.collapseToImage,geometry:n.geometry};if(t.type==="VECTOR"||t.type==="BOOLEAN_OPERATION")return{role:"content",source:"vector"};if(t.extend?.vector_merge)return{role:"content",source:"vector"};if(t.extend?.icon)return{role:"content",source:"vector"};if(t.extend?.vector_shape)return{role:"content",source:"vector"};if(t.type==="TEXT"&&t.style?.font_family&&Eu.has(t.style.font_family))return{role:"content",source:"icon-font"};if(t.style?.background_image)return{role:(t.children?.filter(o=>o.type!=="SUPPOSITIONAL")??[]).length>0?"background":"content",source:"raster"}}function Hu(t){return t.component_instance?"INSTANCE":t.type}function dn(t){let e=t.box.x,n=t.box.y,o=t.box.x+t.box.width,r=t.box.y+t.box.height;for(const i of t.children??[]){const s=dn(i);e=Math.min(e,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x+s.width),r=Math.max(r,s.y+s.height)}return{x:e,y:n,width:o-e,height:r-n}}function rr(t,e){const n=Math.max(t.x,e.x),o=Math.max(t.y,e.y),r=Math.min(t.x+t.width,e.x+e.width),i=Math.min(t.y+t.height,e.y+e.height);return{x:n,y:o,width:Math.max(0,r-n),height:Math.max(0,i-o)}}function Gu(t,e,n){if(e?.geometry==="subtree-union")return rr(dn(t),n);if(e?.geometry==="self-width-subtree-height"){const o=dn(t),r=Math.min(t.box.y,o.y),i=Math.max(t.box.y+t.box.height,o.y+o.height);return rr({x:t.box.x,y:r,width:t.box.width,height:i-r},n)}return t.box}function gn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function mn(t){return typeof t=="string"&&t.length>0?t:void 0}function Wu(t){if(!gn(t))return;const e=mn(t.component_key),n=mn(t.instance_name);if(!(!e&&!n))return{...e?{component_key:e}:{},...n?{instance_name:n}:{}}}function Vu(t){const e=t?.pixso;if(gn(e))return mn(e.guid)}function Uu(t,e,n){const o=t?.pixso;return e==="content"&&n==="composite"&&gn(o)&&o.source_type==="INSTANCE"}function ir(t,e,n,o){const r=Hu(t),i=n.skipImageDetection?or(t):ju(t),s=i?.role,a=i?.source,c=Pu(t),l=Ou(t),u=Lu(t),f=Du(t),d=s==="content"||i?.collapseToImage===!0,g=d?"IMAGE":r,m=g==="TEXT",h=Gu(t,i,o),p=er(t.style?.background_image,e),y=Vu(t.extend),b=Uu(t.extend,s,a),x=t.extend?.image_opaque===!1;return{id:t.key,name:t.name,type:g,geometry:{x:h.x,y:h.y,width:h.width,height:h.height,rotation:t.style?.rotation_angle},style:Au(t,e),characters:m?t.content:void 0,componentInstance:Wu(t.component_instance),hints:Tu(t,_u(g)),extend:t.extend,layout:u||void 0,clipDecision:f,imageRole:s,imageSource:a,imageUrl:p,...(p||b)&&y?{imageResourceNodeId:y}:{},...x||b?{imageOpaque:!1}:{},backgroundLayer:c,virtualContainer:l,children:d?void 0:t.children?.map(v=>ir(v,e,n,o)),depth:0,zIndex:0,renderOrder:0}}function Xu(t,e={}){if(!t.content||t.content.length===0)throw new Error("parseNewFormat: content \u4E3A\u7A7A");const n=Array.isArray(t.assets)?t.assets:[],o=ir(t.content[0],n,e,t.content[0].box);return o.isPageRoot=!0,o}function he(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ku(t){return he(t)?typeof t.key=="string"&&he(t.box)&&he(t.style):!1}function sr(t){return!he(t)||!Array.isArray(t.content)?!1:t.content.length===0?!0:Ku(t.content[0])}function ar(t){if(qt(t))return qe(t);if(yt(t))return cn(t);if(!t||typeof t!="object"||!Array.isArray(t.content))throw new Error("parseDesign: \u8F93\u5165\u4E0D\u662F\u6709\u6548\u7684\u8BBE\u8BA1\u7A3F\u6570\u636E\uFF08\u671F\u671B Octo { assets, content: [...] }\u3001Pixso { pixTreeNodes: [...] } \u6216 Pixso refs { roots, refsIndex }\uFF09");return t}function Yu(t,e={}){return Xu(ar(t),e)}function Zu(t){const e=t.extend?.pixso;return typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.source_format==="refs"&&typeof e.guid=="string"}function qu(t){if(t?.backgroundImage)return{backgroundImage:t.backgroundImage,...t.backgroundSize?{backgroundSize:t.backgroundSize}:{},...t.backgroundPosition?{backgroundPosition:t.backgroundPosition}:{},...t.backgroundRepeat?{backgroundRepeat:t.backgroundRepeat}:{}}}function hn(t,e="composite",n=!0){e==="composite"&&Zu(t)&&(t.style=qu(t.style)),t.imageRole="content",t.imageSource=e,t.type="IMAGE",n||(t.imageOpaque=!1),t.children=void 0}var pn=new Set(["IMAGE","VECTOR","BOOLEAN_OPERATION","ELLIPSE","RECTANGLE","LINE","SUPPOSITIONAL"]),yn=new Set(["FRAME","GROUP","INSTANCE","COMPONENT"]),Ju=.8,cr=.05;function lr(t){const e=t.extend?.pixso;return typeof e=="object"&&e!==null&&!Array.isArray(e)&&(e.synthetic_root===!0||e.source_format==="refs"&&typeof e.synthetic_id=="string")}function ur(t){if(t.type==="TEXT")return dt(t)?{textCount:0,hasOther:!1,shapeImageCount:1,contentCount:1}:{textCount:1,hasOther:!1,shapeImageCount:0,contentCount:1};if(pn.has(t.type))return{textCount:0,hasOther:!1,shapeImageCount:1,contentCount:1};if(!yn.has(t.type))return{textCount:0,hasOther:!0,shapeImageCount:0,contentCount:0};let e=0,n=!1,o=t.imageRole||t.imageUrl?1:0,r=t.imageRole||t.imageUrl?1:0;for(const i of t.children??[]){const s=ur(i);e+=s.textCount,s.hasOther&&(n=!0),o+=s.shapeImageCount,r+=s.contentCount}return{textCount:e,hasOther:n,shapeImageCount:o,contentCount:r}}function Qu(t){return t.contentCount===0?!1:t.shapeImageCount/t.contentCount>=Ju}function fr(t,e){if(t.type==="TEXT"&&!dt(t))return{text:t,parent:e};for(const n of t.children??[]){const o=fr(n,t);if(o)return o}}function tf(t){const e=fr(t);return e?(e.parent?.type==="INSTANCE"||(e.text.parentComponents?.length??0)>0)&&rf(t.geometry,e.text.geometry):!1}function pe(t){return!!(t&&t.trim().toLowerCase()!=="none")}function Ft(t){if(!t)return!1;const e=t.trim().toLowerCase();if(!e||e==="none"||/^0(?:px)?(?:\s|$)/.test(e))return!1;const n=e.match(/(rgba?\([^)]+\)|#[0-9a-f]{3,8}|transparent)\s*$/)?.[1];return n===void 0||!ln(n)}function dr(t){const e=t.style;return e?!!(e.backgroundColor&&!ln(e.backgroundColor)||pe(e.backgroundImage)||Ft(e.border)||Ft(e.borderTop)||Ft(e.borderRight)||Ft(e.borderBottom)||Ft(e.borderLeft)||pe(e.boxShadow)):!1}function gr(t){const e=t.style;return!!(t.geometry.rotation||e?.opacity!==void 0&&e.opacity<1||pe(e?.filter)||pe(e?.backdropFilter)||e?.overflow==="hidden")}function mr(t){const e=t.extend?.pixso;return!!(t.hints?.autoLayout&&typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.source_type==="FRAME")}function ef(t){return t.imageRole||t.imageUrl||t.type==="TEXT"||pn.has(t.type)||!yn.has(t.type)||ce(t)||t.children?.some(e=>e.type==="TEXT"&&!dt(e))||dr(t)||gr(t)?!0:!mr(t)}function nf(t){const e=[],n=o=>{if(ef(o)){e.push(o);return}o.children?.forEach(n)};return t.forEach(n),e}function of(t,e){return ce(t)?!0:e.length>=2?af(e):e.length===1&&!mr(t)?!0:dr(t)||gr(t)}function Bt(t){if(t.imageRole||t.imageUrl)return;if(t.isPageRoot){t.children?.forEach(Bt);return}if(lr(t)){t.children?.forEach(Bt);return}if(!yn.has(t.type)){t.children?.forEach(Bt);return}const e=t.children??[],n=ur(t),o=e.some(a=>a.type==="TEXT"),r=tf(t),i=e.some(a=>Ot(a,!0));t.children?.forEach(Bt);const s=of(t,nf(t.children??[]));if(!i&&!n.hasOther&&s){if(n.textCount===0&&(n.contentCount>0||bn(t)||hr(t))){hn(t,"composite",!le(t));return}if(n.textCount===1&&!o&&!r&&Qu(n)){hn(t,"composite",!le(t));return}}}function rf(t,e){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function sf(t,e){const n=G(t);return n===0?!1:de(t,e)/n>=.8}function af(t){for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++)if(ge(t[e].geometry,t[n].geometry)>=cr)return!0;return!1}function cf(t){if(t.length<2)return!1;const e=new Set([0]),n=[0];for(;n.length>0;){const o=n.pop();for(let r=0;r<t.length;r++)e.has(r)||ge(t[o].geometry,t[r].geometry)<cr||(e.add(r),n.push(r))}return e.size===t.length}function bn(t){const e=t.style;return e?!!(e.backgroundColor||e.backgroundImage||e.border||e.borderTop||e.borderRight||e.borderBottom||e.borderLeft||e.borderRadius):!1}function hr(t){return!!t.style?.boxShadow}function lf(t){if((t.children?.length??0)>0||!(t.type==="IMAGE"||pn.has(t.type))||!bn(t))return!1;const e=G(t.geometry),n=t.geometry.width>=64&&t.geometry.height>=40&&e>=4096,o=t.geometry.width>=64&&t.geometry.height>=28&&e>=2304&&t.geometry.width/Math.max(t.geometry.height,1)>=1.5;return n||o}function pr(t){return t.type==="TEXT"&&!dt(t)?!0:t.children?.some(pr)??!1}function uf(t){return t.type==="TEXT"?!dt(t):t.type==="INSTANCE"||t.type==="COMPONENT"?!0:t.type==="FRAME"||t.type==="GROUP"?pr(t):!1}function ff(t,e,n,o){let r=0;const i=[];t.imageSource==="vector"&&(r+=1,i.push("vector-source")),bn(t)&&(r+=3,i.push("surface-style")),hr(t)&&(r+=1,i.push("shadow-style")),G(t.geometry)/Math.max(G(e.geometry),1)>=.05&&(r+=2,i.push("large-surface"));const s=e.children??[];if(s.length>1){const a=n/(s.length-1);a>=.75?(r+=3,i.push("near-bottom-layer")):a>=.35&&(r+=1,i.push("lower-layer"))}return r+=Math.min(5,o.length),i.push(`contained-semantic:${o.length}`),{score:r,reasons:i}}function df(t,e,n){return t>=2?e>=8:t===1&&e>=9&&n.includes("near-bottom-layer")}function yr(t){const e=t.children;if(e&&e.length>0){for(let n=0;n<e.length;n++){const o=e[n];if(!o.backgroundLayer&&lf(o)){const r=e.slice(0,n).filter(i=>uf(i)&&sf(i.geometry,o.geometry));if(r.length>=1){const{score:i,reasons:s}=ff(o,t,n,r);df(r.length,i,s)&&(o.imageRole="background",o.backgroundLayer={score:i,containedNodeIds:r.map(a=>a.id),reasons:s})}}}e.forEach(yr)}}function br(t){if(t.children?.forEach(br),t.isPageRoot||lr(t)||t.imageRole||t.imageUrl||t.type==="TEXT"||t.type==="COMPONENT")return;const e=t.children??[];e.length!==0&&e.every(n=>n.type==="IMAGE")&&cf(e)&&(e.some(n=>Ot(n,!0))||hn(t,"composite",!le(t)))}var vr=new Set(["HM Symbol","Material Icons","Material Symbols","iconfont","icomoon","Font Awesome"]);function xr(t){if(!t)return!1;for(const e of t){const n=e.codePointAt(0);if(n!==void 0&&(n>=57344&&n<=63743||n>=983040&&n<=1048573||n>=1048576&&n<=1114109))return!0}return!1}function dt(t){if(t.type!=="TEXT")return!1;const e=t.style?.fontFamily;return!!(e&&vr.has(e)||xr(t.characters))}function wr(t,e=new Map){return dt(t)&&(t.characters!==void 0&&e.set(t.id,t.characters),t.type="IMAGE",t.imageRole="content",t.imageSource="icon-font",t.characters=void 0),t.children?.forEach(n=>wr(n,e)),e}function gf(t){const e=new Map,n=o=>{const r=o.content;o.type==="TEXT"&&typeof r=="string"&&(o.style?.font_family!==void 0&&vr.has(o.style.font_family)||xr(r)||o.extend?.image_source==="icon-font")&&e.set(o.key,r),o.children?.forEach(n)};return t.content[0]&&n(t.content[0]),e}function mf(t){return t.type==="IMAGE"&&t.imageSource==="icon-font"}function Sr(t,e,n){const o=r=>{if(!r.children)return;r.children.forEach(o);const i=[],s=[];for(const a of r.children){const c=e(a);c&&i.some(l=>n(l,a)&&ge(l.geometry,a.geometry)>=.95)||(s.push(a),c&&Yo(a)>=.5&&i.push(a))}r.children=s};o(t)}function hf(t){return!(t.isPageRoot||t.type==="TEXT"||t.type==="IMAGE"||t.children?.length!==1||t.geometry.rotation||t.style&&Object.keys(t.style).length>0||ce(t))}function kr(t){t.children?.forEach(kr),t.children&&(t.children=t.children.flatMap(e=>{if(!hf(e))return[e];const n=e.children??[];return au(e)&&cu(e,n),n}))}function pf(t){const e=ar(t),n=Yu(e),o=gf(e);return fn(n),kr(n),Bt(n),Sr(n,dt,(r,i)=>r.characters===i.characters),wr(n,o),Sr(n,mf,(r,i)=>{const s=o.get(r.id),a=o.get(i.id);return s!==void 0&&s===a}),br(n),Gl(n),du(n),yr(n),fn(n),n}function yf(t,e,n=1){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n&&Math.abs(t.width-e.width)<=n&&Math.abs(t.height-e.height)<=n}function $r(t){return t.imageRole==="background"&&!!t.backgroundLayer&&t.virtualContainer?.kind!=="background-container"&&(t.children?.length??0)===0}function Ir(t){return!!(t.imageUrl||t.style?.backgroundImage)}function bf(t){return t.imageResourceNodeId===void 0||Ir(t)}function Ar(t,e){return yf(t.geometry,e.geometry)?e.backgroundLayer.containedNodeIds.length===1||Ir(e):!1}function vf(t,e){return $r(e)&&Ar(t,e)&&e.extend?.mask!==!0&&!e.geometry.rotation&&(e.style?.opacity===void 0||e.style.opacity===1)&&bf(e)&&!t.style?.backgroundImage}function xf(t,e){const n=t.style??{},o=e.style??{},r=n.backgroundImage===void 0&&o.backgroundImage!==void 0;t.style={...n,...n.backgroundColor===void 0&&o.backgroundColor!==void 0?{backgroundColor:o.backgroundColor}:{},...n.backgroundImage===void 0&&o.backgroundImage!==void 0?{backgroundImage:o.backgroundImage}:{},...n.backgroundPosition===void 0&&o.backgroundPosition!==void 0?{backgroundPosition:o.backgroundPosition}:{},...n.backgroundRepeat===void 0&&o.backgroundRepeat!==void 0?{backgroundRepeat:o.backgroundRepeat}:{},...n.backgroundSize===void 0&&o.backgroundSize!==void 0?{backgroundSize:o.backgroundSize}:{},...n.borderRadius===void 0&&o.borderRadius!==void 0?{borderRadius:o.borderRadius}:{},...n.border===void 0&&o.border!==void 0?{border:o.border}:{},...n.borderTop===void 0&&o.borderTop!==void 0?{borderTop:o.borderTop}:{},...n.borderRight===void 0&&o.borderRight!==void 0?{borderRight:o.borderRight}:{},...n.borderBottom===void 0&&o.borderBottom!==void 0?{borderBottom:o.borderBottom}:{},...n.borderLeft===void 0&&o.borderLeft!==void 0?{borderLeft:o.borderLeft}:{}},t.imageUrl===void 0&&e.imageUrl!==void 0?(t.imageUrl=e.imageUrl,e.imageResourceNodeId!==void 0&&(t.imageResourceNodeId=e.imageResourceNodeId)):r&&t.imageResourceNodeId===void 0&&e.imageResourceNodeId!==void 0&&(t.imageResourceNodeId=e.imageResourceNodeId)}function wf(t,e){const n=[];for(const o of e){if(vf(t,o)){xf(t,o);continue}n.push(o)}return n}function Sf(t,e,n){const o=e[n];if(!$r(o))return;const r=new Set(o.backgroundLayer.containedNodeIds);if(Ar(t,o))return;const i=[],s=new Set;for(let l=0;l<n;l++)r.has(e[l].id)&&(i.push(e[l]),s.add(l));if(i.length===0)return;const a=Math.min(...s),c=new Set;for(let l=a;l<=n;l++)if(c.add(l),l!==n&&!s.has(l))return;return{backgroundIndex:n,insertIndex:a,score:o.backgroundLayer.score,wrappedNodes:i,spanIndices:c}}function kf(t){const e=[],n=new Set,o=[...t].sort((r,i)=>i.score!==r.score?i.score-r.score:i.wrappedNodes.length!==r.wrappedNodes.length?i.wrappedNodes.length-r.wrappedNodes.length:r.spanIndices.size-i.spanIndices.size);for(const r of o)if(![...r.spanIndices].some(i=>n.has(i))){e.push(r);for(const i of r.spanIndices)n.add(i)}return e.sort((r,i)=>i.backgroundIndex-r.backgroundIndex)}function $f(t,e){const n=t[e.backgroundIndex];n.type="FRAME",n.children=e.wrappedNodes,n.virtualContainer={kind:"background-container",backgroundNodeId:n.id,wrappedNodeIds:e.wrappedNodes.map(r=>r.id),reason:"background-layer"};const o=[];for(let r=0;r<t.length;r++)r===e.insertIndex&&o.push(n),!e.spanIndices.has(r)&&o.push(t[r]);return o}function Rr(t){let e=t.children;if(e&&e.length>0){e=wf(t,e);const n=kf(e.map((o,r)=>Sf(t,e,r)).filter(o=>!!o));for(const o of n)e=$f(e,o);t.children=e,t.children.forEach(Rr)}}function If(t){const e=pf(t);return Rr(e),fn(e),e}function Cr(t){t.children&&(t.children.reverse(),t.children.forEach(Cr))}function Af(t){const e=If(t);return Cr(e),fe(e),e}function Tr(t){t.children&&(t.children.sort((e,n)=>e.geometry.y-n.geometry.y),t.children.forEach(Tr))}function Rf(t){const e=Af(t);return Tr(e),fe(e),e}var _r=4,Cf=.5;function Tf(t,e){const n=t.geometry.y,o=n+t.geometry.height,r=e.geometry.y,i=r+e.geometry.height,s=Math.min(o,i)-Math.max(n,r);if(s<=0)return 0;const a=Math.min(t.geometry.height,e.geometry.height);return a<=0?0:s/a}function _f(t,e,n){return Math.abs(e.geometry.y-t.geometry.y)<n&&Tf(t,e)>Cf}function Nr(t,e=_r){if(!t.children)return;const n=t.children,o=[];let r=0;for(;r<n.length;){let i=r+1;for(;i<n.length&&_f(n[r],n[i],e);)i++;const s=n.slice(r,i).sort((a,c)=>a.geometry.x-c.geometry.x);o.push(...s),r=i}t.children=o,o.forEach(i=>Nr(i,e))}function Nf(t,e=_r){const n=Rf(t);return Nr(n,e),fe(n),n}var Mf=.5,Ef=.3,Pf=4;function Of(t,e){const n=t.geometry.x,o=n+t.geometry.width,r=e.geometry.x,i=r+e.geometry.width,s=Math.min(o,i)-Math.max(n,r);if(s<=0)return 0;const a=Math.min(t.geometry.width,e.geometry.width);return a<=0?0:s/a}function at(t){return t.geometry.x+t.geometry.width/2}function Mr(t){return[...t].sort((e,n)=>e.geometry.x-n.geometry.x||e.geometry.y-n.geometry.y)}function Lf(t){return[...t].sort((e,n)=>e.geometry.y-n.geometry.y||e.geometry.x-n.geometry.x)}function Ff(t){if(t.length===0)return[];const e=[];let n=[t[0]],o=t[0].geometry.y,r=t[0].geometry.y+t[0].geometry.height;for(let i=1;i<t.length;i++){const s=t[i],a=s.geometry.y,c=a+s.geometry.height,l=Math.min(c,r)-Math.max(a,o),u=Math.min(s.geometry.height,r-o);if(!(u>0&&l/u>Mf)){e.push(n),n=[s],o=a,r=c;continue}if(n.some(f=>Of(s,f)>Ef)){e.push(n),n=[s],o=a,r=c;continue}n.push(s),o=Math.min(o,a),r=Math.max(r,c)}return e.push(n),e}function Bf(t){let e=1/0,n=1/0,o=-1/0,r=-1/0;for(const i of t){const s=i.geometry;s.x<e&&(e=s.x),s.y<n&&(n=s.y),s.x+s.width>o&&(o=s.x+s.width),s.y+s.height>r&&(r=s.y+s.height)}return{x:e,y:n,width:o-e,height:r-n}}function zf(t,e){if(t.length!==e.length||t.length<2)return!1;const n=[...t].sort((r,i)=>at(r)-at(i)),o=[...e].sort((r,i)=>at(r)-at(i));for(let r=0;r<n.length;r++)if(Math.abs(at(n[r])-at(o[r]))>Pf)return!1;return!0}function Df(t){const e=[];let n=0;for(;n<t.length;){let o=n;for(;o+1<t.length&&zf(t[n],t[o+1]);)o++;if(o>n){const r=t.slice(n,o+1).map(a=>[...a].sort((c,l)=>at(c)-at(l))),i=r[0].length,s=[];for(let a=0;a<i;a++)s.push(r.map(c=>c[a]));e.push({type:"grid",columns:s}),n=o+1}else e.push({type:"row",row:t[n]}),n++}return e}function vn(t,e,n,o,r,i){const s=n==="row-container"?Mr(e):Lf(e),a=Bf(s),c=`${t.id}__${o}`,l=jf(s),u={id:c,name:r,type:"FRAME",geometry:a,depth:t.depth+1,zIndex:0,renderOrder:0,parentId:t.id,children:s,...l!==void 0?{sourcePaintOrder:l}:{},virtualContainer:{kind:n,wrappedNodeIds:s.map(f=>f.id),reason:i}};return s.forEach(f=>{f.parentId=c}),u}function jf(t){let e;for(const n of t)typeof n.sourcePaintOrder=="number"&&(e=e===void 0?n.sourcePaintOrder:Math.max(e,n.sourcePaintOrder));return e}function Er(t){t.children?.forEach(Er);const e=t.children;if(!e||e.length<2)return;const n=t.virtualContainer?.kind;if(n==="row-container"||n==="column-container")return;const o=Ff(e);if(!o.some(a=>a.length>=2))return;if(o.length===1&&o[0].length===e.length){t.children=Mr(o[0]);return}const r=Df(o);let i=1;const s=[];for(let a=0;a<r.length;a++){const c=r[a];if(c.type==="grid"){const l=vn(t,c.columns.map((u,f)=>vn(t,u,"column-container",`block${a}_col${f}`,`col ${f+1}`,"vertical-column")),"row-container",`block${a}_row`,`row ${i++}`,"grid-row");s.push(l)}else{const l=c.row;l.length>=2?s.push(vn(t,l,"row-container",`block${a}_row`,`row ${i++}`,"horizontal-row")):s.push(...l)}}t.children=s}function Hf(t){const e=Nf(t);return Er(e),fe(e),e}function Pr(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const i of t){const s=i.geometry;s.x<e&&(e=s.x),s.x+s.width>n&&(n=s.x+s.width),s.y<o&&(o=s.y),s.y+s.height>r&&(r=s.y+s.height)}return n-e>r-o+2?"row":"column"}function Or(t){if(t.length<2)return;const e=Lr(t,"x"),n=Lr(t,"y");if(n&&!e)return"column";if(e&&!n)return"row"}function Lr(t,e,n=.5){const o=[...t].sort((r,i)=>xn(r,e)-xn(i,e));for(let r=1;r<o.length;r++)if(xn(o[r],e)<Gf(o[r-1],e)-n)return!1;return!0}function xn(t,e){return e==="x"?t.geometry.x:t.geometry.y}function Gf(t,e){return e==="x"?t.geometry.x+t.geometry.width:t.geometry.y+t.geometry.height}function Wf(t,e){const n=t.virtualContainer?.kind;if(n==="row-container")return{mode:"flex",direction:"row"};if(n==="column-container")return{mode:"flex",direction:"column"};const o=Or(e),r=o??Pr(e),i=t.hints?.autoLayout?.mode;if(i==="HORIZONTAL"||i==="VERTICAL"){const s=i==="HORIZONTAL"?"row":"column",a={mode:"flex",direction:s};return s!==r&&(a.hintConflicts=[{field:"mode",hint:i,inferred:r==="row"?"HORIZONTAL":"VERTICAL",reason:o?`geometry suggests ${o}: 1D axis separation`:`geometry suggests ${r}: x-span vs y-span`}]),a}return{mode:"flex",direction:r}}var Vf=new Set(["FRAME","GROUP","INSTANCE","COMPONENT"]);function Fr(t){t.children?.forEach(Fr);const e=t.children;if(!e||e.length<2||!Vf.has(t.type))return;const n=Wf(t,e);n&&(t.layout=n)}function Uf(t){const e=Hf(t);return Fr(e),su(e),e}function Xf(t){if(t.length===0)throw new Error("median of empty array");const e=[...t].sort((r,i)=>r-i),n=e.length,o=Math.floor(n/2);return n%2===1?e[o]:(e[o-1]+e[o])/2}var Kf=1e-6;function zt(t,e={}){const n=Math.abs(t)<=Kf?0:t;return e.clampNegative?Math.max(0,n):n}function Yf(t){return t!==void 0&&Number.isFinite(t.top)&&Number.isFinite(t.right)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)}function Zf(t){const e=n=>zt(n,{clampNegative:!0});return{top:e(t.top),right:e(t.right),bottom:e(t.bottom),left:e(t.left)}}function qf(t,e){if(e.length<1)return null;const n=t.geometry.x,o=t.geometry.y,r=t.geometry.width,i=t.geometry.height;let s=1/0,a=1/0,c=1/0,l=1/0;for(const f of e){const d=f.geometry.x,g=f.geometry.y,m=f.geometry.width,h=f.geometry.height,p=g-o,y=d-n,b=n+r-(d+m),x=o+i-(g+h);p<s&&(s=p),y<a&&(a=y),b<c&&(c=b),x<l&&(l=x)}if(![s,a,c,l].every(Number.isFinite))return null;const u=f=>zt(f,{clampNegative:!0});return{top:u(s),right:u(c),bottom:u(l),left:u(a)}}function Dt(t){return t.filter(e=>!z(e))}function Br(t,e){if(t.length<2)return{kind:"unavailable"};const n=[...t].sort((i,s)=>e==="row"?i.geometry.x-s.geometry.x||i.geometry.y-s.geometry.y||i.id.localeCompare(s.id):i.geometry.y-s.geometry.y||i.geometry.x-s.geometry.x||i.id.localeCompare(s.id)),o=[];for(let i=1;i<n.length;i++){const s=n[i-1].geometry,a=n[i].geometry,c=e==="row"?a.x-(s.x+s.width):a.y-(s.y+s.height);o.push(zt(c))}if(!o.every(Number.isFinite))return{kind:"unavailable"};const r=Math.min(...o);return Math.max(...o)-r<=2?{kind:"uniform",value:Xf(o),gaps:o}:{kind:"non-uniform",gaps:o}}function Jf(t){return t!==null&&Number.isFinite(t.top)&&Number.isFinite(t.right)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)}function wn(t,e){t.layout?.mode==="flex"&&(t.layout.hintConflicts=(t.layout.hintConflicts??[]).concat(e))}function Qf(t,e){if(t.layout?.mode!=="flex")return;const n=t.hints?.autoLayout?.padding,o=Yf(n)?Zf(n):null;let r=null;if(o?r=o:e&&(r=e),r&&(r.top>0||r.right>0||r.bottom>0||r.left>0)&&(t.layout.padding={...r}),o&&Jf(e)){const i=[];Math.abs(o.top-e.top)>2&&i.push("top"),Math.abs(o.right-e.right)>2&&i.push("right"),Math.abs(o.bottom-e.bottom)>2&&i.push("bottom"),Math.abs(o.left-e.left)>2&&i.push("left"),i.length>0&&wn(t,{field:"padding",hint:{...o},inferred:{...e},reason:`padding differs on ${i.join(", ")} beyond 2px`})}}function td(t,e){if(t.layout?.mode!=="flex")return;const n=t.hints?.autoLayout?.gap,o=n!==void 0&&Number.isFinite(n)?zt(n):void 0,r=e.kind==="uniform"?zt(e.value):void 0;if(o!==void 0?o>0&&(t.layout.gap=o):r!==void 0&&r>0&&(t.layout.gap=r),o!==void 0)switch(e.kind){case"unavailable":break;case"uniform":if(r===void 0)break;Math.abs(o-r)>2&&wn(t,{field:"gap",hint:o,inferred:{kind:"uniform",value:r,gaps:e.gaps},reason:`geometry uniform gap ${r}, hint claims ${o}`});break;case"non-uniform":wn(t,{field:"gap",hint:o,inferred:{kind:"non-uniform",gaps:e.gaps},reason:`geometry has non-uniform gaps; hint claims single uniform value ${o}`});break}}function zr(t){if(t.children?.forEach(zr),t.layout?.mode!=="flex")return;const e=t.layout.direction;if(e!=="row"&&e!=="column")return;const n=t.children;if(!n||n.length===0)return;const o=Dt(n);Qf(t,o.length>=1?qf(t,o):null),td(t,Br(o,e))}function ed(t){const e=Uf(t);return zr(e),e}function xt(t){const e=t.geometry;return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.width)&&Number.isFinite(e.height)}function nd(t){switch(t){case"MIN":return"flex-start";case"CENTER":return"center";case"MAX":return"flex-end";default:return}}function Sn(t,e,n=2){if(t.length<2)return;const o=e==="column",r=t.map(c=>o?c.geometry.x:c.geometry.y),i=t.map(c=>o?c.geometry.x+c.geometry.width:c.geometry.y+c.geometry.height),s=r.map((c,l)=>c+(i[l]-c)/2),a=c=>Math.max(...c)-Math.min(...c);if(a(r)<=n)return"flex-start";if(a(s)<=n)return"center";if(a(i)<=n)return"flex-end"}function Dr(t,e,n,o){if(t.layout?.mode==="flex"&&(e!=="flex-start"&&(t.layout.align=e),n&&t.layout.direction)){const r=Sn(o,t.layout.direction);if(r!==void 0&&r!==e){const i={field:"align",hint:e,inferred:r,reason:`hint says ${e}, geometry suggests ${r}`};t.layout.hintConflicts=[...t.layout.hintConflicts??[],i]}}}function od(t){if(t.layout?.mode!=="flex"||!t.layout.direction||!xt(t))return;const e=Dt(t.children??[]);if(e.length<2||e.some(r=>!xt(r)))return;const n=nd(t.hints?.autoLayout?.counterAlign);if(n!==void 0){Dr(t,n,!0,e);return}const o=Sn(e,t.layout.direction);o!==void 0&&Dr(t,o,!1,e)}function jr(t){t.children?.forEach(jr),od(t)}function rd(t){const e=ed(t);return jr(e),e}var ye=.05,Hr=.2;function id(t,e=t.children??[]){return t.style?.backgroundImage?!0:e.some(n=>n.imageRole==="background"||n.backgroundLayer!==void 0||n.virtualContainer?.kind==="background-container"||(n.children??[]).some(o=>o.imageRole==="background"||o.backgroundLayer!==void 0))}function Gr(t,e,n=t.children??[]){if(e.length===0||!id(t,n))return!1;const o=gu(e),r=t.geometry.x+t.geometry.width,i=t.geometry.y+t.geometry.height,s=o.x+o.width,a=o.y+o.height,c=Math.max(0,t.geometry.x-o.x),l=Math.max(0,t.geometry.y-o.y),u=Math.max(0,s-r),f=Math.max(0,a-i),d=8,g=50;return f>g&&o.height>t.geometry.height+g&&c<=d&&u<=d&&l<=d}function sd(t,e=ye){for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=G(t[n].geometry),i=G(t[o].geometry),s=Math.min(r,i);if(!(s<=0)&&de(t[n].geometry,t[o].geometry)/s>e)return!0}return!1}function ad(t,e,n=1.1,o=8,r={}){if(e.length===0||r.isRoot&&Gr(t,e,r.children??t.children??[]))return!1;let i=1/0,s=1/0,a=-1/0,c=-1/0;for(const y of e){const b=y.geometry;b.x<i&&(i=b.x),b.y<s&&(s=b.y),b.x+b.width>a&&(a=b.x+b.width),b.y+b.height>c&&(c=b.y+b.height)}const l=a-i,u=c-s,f=t.geometry.width,d=t.geometry.height;if(f*d>0&&l*u/(f*d)>n)return!0;const g=t.geometry.x-i,m=t.geometry.y-s,h=a-(t.geometry.x+f),p=c-(t.geometry.y+d);return Math.max(g,m,h,p)>o}function cd(t,e,n=16){if(t.length<2)return!1;const o=Br(t,e);if(o.kind!=="non-uniform")return!1;const r=Math.min(...o.gaps);return Math.max(...o.gaps)-r>n}function ld(t,e,n=2){return t.length<2?!1:Sn(t,e,n)===void 0}function ud(t,e=50,n=20){const o=t?.hintConflicts??[];for(const r of o)if(r.field==="gap"){const i=typeof r.hint=="number"?r.hint:null,s=r.inferred,a=typeof s?.value=="number"?s.value:null;if(i!==null&&a!==null&&Math.abs(i-a)>e)return!0}else if(r.field==="padding"){const i=r.hint,s=r.inferred;if(i&&s&&Math.max(...["top","right","bottom","left"].map(a=>Math.abs((i[a]??0)-(s[a]??0))))>n)return!0}return!1}function fd(t,e,n=5){if(t.layout?.mode!=="flex"||t.layout.gap!==void 0)return!1;const o=Dt(t.children??[]).filter(xt);if(o.length<2)return!1;const r=e==="row",i=[...o].sort((s,a)=>(r?s.geometry.x:s.geometry.y)-(r?a.geometry.x:a.geometry.y));for(let s=1;s<i.length;s++){const a=i[s-1].geometry,c=i[s].geometry,l=r?a.x+a.width:a.y+a.height;if((r?c.x:c.y)-l>n)return!0}return!1}function dd(t,e){if(t.layout?.mode!=="flex")return!1;const n=Dt(t.children??[]).filter(xt);if(n.length<2)return!1;const o=e==="row",r=[...n].sort((i,s)=>(o?i.geometry.x:i.geometry.y)-(o?s.geometry.x:s.geometry.y));for(let i=0;i<n.length;i++)if(r[i]!==n[i])return!0;return!1}function Wr(t,e=!1){if(t.children?.forEach(c=>Wr(c,!1)),t.layout?.mode!=="flex")return;const n=t.layout.direction;if(n!=="row"&&n!=="column")return;const o=Dt(t.children??[]);if(!xt(t)||o.some(c=>!xt(c)))return;const r=[],i=e?Hr:ye;if(o.length<2&&r.push(`T0 (flowing=${o.length})`),r.length===0&&sd(o,i)&&r.push("T1 (substantial overlap)"),r.length===0&&ad(t,o,1.1,8,{isRoot:e,children:t.children??[]})&&r.push("T2 (exceeds container)"),r.length===0&&cd(o,n)&&r.push("T3 (irregular gap)"),r.length===0&&ld(o,n)&&r.push("T4 (cross-axis non-alignable)"),r.length===0&&ud(t.layout)&&r.push("T5 (hint-geom divergence)"),r.length===0&&fd(t,n)&&r.push("T6 (missing gap on non-uniform geometry)"),r.length===0&&dd(t,n)&&r.push("T7 (DOM order mismatch)"),r.length===0)return;const s=t.layout.hintConflicts??[],a={field:"mode",hint:"flex",inferred:"absolute",reason:r.join(", ")};t.layout={mode:"absolute",hintConflicts:[...s,a]}}function gd(t){Wr(t,!0)}function md(t){const e=rd(t);return gd(e),e}function be(t){const e=[],n=o=>{const r=o.characters?.trim().replace(/\s+/g," ");r&&e.push(r),o.children?.forEach(n)};return n(t),e}function hd(t){return be(t).filter(e=>e!=="08:08")[0]}function Vr(t){return t.characters?.trim().replace(/\s+/g," ")}function ve(t){const e=t.style?.fontSize;if(!e)return 0;const n=Number.parseFloat(String(e));return Number.isFinite(n)?n:0}function pd(t,e){const n=t.geometry,o=e.geometry,r=n.width/Math.max(1,o.width),i=n.height/Math.max(1,o.height);return r>=.95&&i>=.95&&n.x<=o.x+5&&n.y<=o.y+5}function wt(t,e){t.semantic||(t.semantic=e)}function yd(t){return/titlebar|floatingtitlebar|标题栏|global-nav|导航/i.test(t)}function bd(t){return/search|segmented|input/i.test(t)}function Ur(t){return/aibottombar|floatingtab|bottom.?nav|tabbar/i.test(t)}function vd(t){return(t.children??[]).some(e=>Ur(e.name))}function xd(t,e){if(!vd(e))return!1;const n=t.geometry,o=e.geometry;if(o.width>500)return!1;const r=n.y>=o.y+o.height-120&&n.y<=o.y+o.height-35,i=n.width>=o.width*.65,s=n.height>=40&&n.height<=80,a=be(t).length===0;return r&&i&&s&&a}function wd(t,e){const n=t.geometry,o=e.geometry;if(o.width<1e3||o.height<1e3)return!1;const r=n.y>=o.y+o.height*.7,i=n.width>=o.width*.8,s=be(t).join(" ");return r&&i&&/关于openEuler|友情链接|社区章程|贡献看板/.test(s)}function Sd(t,e){if(bd(t.name))return!1;const n=t.geometry,o=e.geometry,r=n.y<=o.y+60,i=n.height>=40&&n.height<=130,s=n.width>=o.width*.55;return!!(r&&i&&yd(t.name)||r&&i&&s&&hd(t))}function kd(t,e){if(t.type!=="TEXT")return!1;const n=Vr(t);if(!n||n==="08:08"||/^[\d\s.%+°-]+$/.test(n))return!1;const o=t.geometry,r=e.geometry,i=ve(t);return i>=24&&o.y<=r.y+Math.max(180,r.height*.25)||r.width>=700&&i>=16&&o.y<=r.y+90&&o.x<=r.x+r.width*.25}function $d(t){const e=new Set,n=[],o=(c,l,u=!1)=>{if(l===t&&((c.imageRole==="background"||/背景|background/i.test(c.name))&&pd(c,t)&&c.name!=="Rectangle"&&wt(c,{role:"background",positioning:"absolute-allowed",reason:/bindsheet/i.test(c.name)?"bottom sheet visual background":c.name==="graph"&&c.type==="FRAME"?"launcher sheet visual background":"full-bleed visual background"}),xd(c,t)&&wt(c,{role:"dock",positioning:"flow",reason:"launcher dock near bottom edge"}),Ur(c.name)&&wt(c,{role:"bottom-nav",positioning:"fixed",reason:"bottom navigation region"}),wd(c,t)&&wt(c,{role:"footer",positioning:"flow",reason:"site footer near page bottom"}),Sd(c,t))){const d=be(c).filter(h=>h!=="08:08"),g=d.length<=2||t.geometry.width<=700&&d.length<=4?d[0]:void 0,m=`${g??""}:${Math.round(c.geometry.x)}:${Math.round(c.geometry.y)}:${Math.round(c.geometry.width)}:${Math.round(c.geometry.height)}`;e.has(m)||(e.add(m),wt(c,{role:"titlebar",positioning:"sticky",reason:"top app or page titlebar",...g?{label:g}:{}}))}const f=u||c.semantic?.role==="titlebar";!f&&kd(c,t)&&n.push(c),c.children?.forEach(d=>o(d,c,f))};o(t);const r=e.size>0,i=n.filter(c=>ve(c)>=32),[s]=(r&&i.length>0?i:r?[]:n).sort((c,l)=>{const u=ve(l)-ve(c);return Math.abs(u)>.1?u:c.geometry.y-l.geometry.y||c.geometry.x-l.geometry.x}),a=s?Vr(s):void 0;s&&a&&wt(s,{role:"heading",label:a,positioning:"flow",reason:"top-level page heading text"})}function Id(t){const e=md(t);return $d(e),e}var Ad=4;function xe(t,e){return t.x>=e.x&&t.y>=e.y&&t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height}function we(t){return typeof t.sourcePaintOrder=="number"?t.sourcePaintOrder:void 0}function Rd(t,e){const n=we(t),o=we(e);if(!(n===void 0||o===void 0))return n>o}function Xr(t){const e=t.virtualContainer?.kind;return e==="row-container"||e==="column-container"}function Cd(t,e){return t.renderOrder>e.renderOrder}function Td(t,e){const n=we(t);return n===void 0?!1:e.some(o=>{if(o===t||Xr(o))return!1;const r=we(o);return r!==void 0&&r>n&&xe(t.geometry,o.geometry)})}function _d(t,e,n){if(!xe(e.geometry,t.geometry))return null;const o=G(t.geometry),r=G(e.geometry);return r<=0?null:o>=Ad*r?Rd(e,t)===!1&&!(Xr(t)&&Cd(e,t))||Td(e,n)?null:{node:e,kind:"stage14-overlay"}:(t.children??[]).every(i=>i.type==="SUPPOSITIONAL")?{node:t,kind:"stage14-overlay-leaf"}:null}function Nd(t){const e=new Map;for(const o of t)if(!e.has(o))for(const r of t){if(o===r||e.has(r))continue;const i=_d(o,r,t);i&&!e.has(i.node)&&e.set(i.node,i.kind)}const n=new Set(e.keys());return{remaining:t.filter(o=>!n.has(o)),extracted:Array.from(e.entries()).map(([o,r])=>({node:o,kind:r}))}}function Kr(t,e){if(e.length===0)return{top:0,right:0,bottom:0,left:0};const n=t.geometry.x,o=t.geometry.y,r=t.geometry.width,i=t.geometry.height;let s=1/0,a=1/0,c=1/0,l=1/0;for(const u of e)s=Math.min(s,u.geometry.x-n),a=Math.min(a,u.geometry.y-o),c=Math.min(c,n+r-(u.geometry.x+u.geometry.width)),l=Math.min(l,o+i-(u.geometry.y+u.geometry.height));return{top:Math.max(0,Math.floor(a)),right:Math.max(0,Math.floor(c)),bottom:Math.max(0,Math.floor(l)),left:Math.max(0,Math.floor(s))}}function Yr(t){return t.top===0&&t.right===0&&t.bottom===0&&t.left===0?{}:{padding:t}}var Md=1;function Ed(t,e){if(t.length<2)return{kind:"unavailable"};const n=[...t].sort((i,s)=>e==="row"?i.geometry.x-s.geometry.x:i.geometry.y-s.geometry.y),o=[];for(let i=1;i<n.length;i++){const s=n[i-1].geometry,a=n[i].geometry,c=e==="row"?a.x-(s.x+s.width):a.y-(s.y+s.height);o.push(Math.round(c))}const r=Math.min(...o);return Math.max(...o)-r>Md?{kind:"irregular",perChildResidual:!0}:{kind:"uniform",value:Math.max(0,r)}}var Pd=50,Od=-24;function Ld(t){return(t.layout?.hintConflicts??[]).filter(e=>e.field==="mode").map(e=>String(e.reason??""))}function Fd(t,e){return t.some(n=>n.includes(e))}function Bd(t){const e=t.hints?.autoLayout?.mode;if(e==="HORIZONTAL")return"row";if(e==="VERTICAL")return"column"}function Zr(t,e=ye){for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=Math.min(G(t[n].geometry),G(t[o].geometry));if(!(r<=0)&&de(t[n].geometry,t[o].geometry)/r>e)return!0}return!1}function zd(t,e){const n=t.geometry.x,o=t.geometry.y,r=t.geometry.width,i=t.geometry.height;let s=0;for(const a of e)s=Math.max(s,n-a.geometry.x,o-a.geometry.y,a.geometry.x+a.geometry.width-(n+r),a.geometry.y+a.geometry.height-(o+i));return Math.max(0,s)}function qr(t,e,n){if(n)return"column";if(e.length===0)return;const o=t.virtualContainer?.kind;if(o==="row-container")return"row";if(o==="column-container"||o==="background-container")return"column";if(t.layout?.mode==="flex"&&t.layout.direction)return t.layout.direction;const r=Bd(t);if(r)return r;if(e.length===1)return"column";const i=Or(e);return i||Pr(e)}function kn(t,e,n){let o=e.filter(h=>!z(h));const r=Ld(t),i=n.isRoot?Hr:ye;if(Zr(o,i)){const{remaining:h,extracted:p}=Nd(o);if(p.length>0&&!Zr(h,i))p.forEach(({node:y,kind:b})=>{y.outOfFlow=b}),o=h;else return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-T1"}}if(Fd(r,"T7"))return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-T7"};const s=zd(t,o);if(s>Pd&&!(n.isRoot&&Gr(t,o,t.children??e)))return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-T2-large"};const a=s>0;if(o.length<2){const h=qr(t,o,n.isRoot);if(!h)return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-direction-unknown"};if(o.length===1){const p=o[0],y=Kr(t,o),b=p.geometry.x-t.geometry.x,x=p.geometry.y-t.geometry.y,v=t.geometry.width-y.left-y.right,k=t.geometry.height-y.top-y.bottom,I=y.left+(v-p.geometry.width)/2,M=y.top+(k-p.geometry.height)/2,L=Math.abs(b-I)<=1&&Math.abs(x-M)<=1,E=y.left+(v-p.geometry.width),P=Math.abs(b-E)<=1,O=y.top+(k-p.geometry.height),J=Math.abs(x-O)<=1,V=Math.abs(b-y.left)<=1&&Math.abs(x-y.top)<=1;if(L||P||J||V){const Q={mode:"flex",direction:h,...Yr(y)},j={},nt={},Ci=Se(nt,"marginLeft",b-y.left,0),Ti=Se(nt,"marginTop",x-y.top,0);return!Ci||!Ti?{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-negative-margin"}:(Object.keys(nt).length>0&&(j[p.id]=nt),{layout:Q,childMargins:j,fallbackToAbsolute:!1,overflowVisible:a})}return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-C2-no-idiom"}}return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-empty"}}const c=qr(t,o,n.isRoot);if(!c)return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-direction-unknown"};const l=Kr(t,o),u=Ed(o,c),f=n.paintOrder==="html"?o:[...o].sort((h,p)=>c==="row"?h.geometry.x-p.geometry.x:h.geometry.y-p.geometry.y);let d=c==="row"?l.left:l.top;const g=u.kind==="uniform"?u.value:0,m={};for(let h=0;h<f.length;h++){const p=f[h],y=c==="row"?p.geometry.x-t.geometry.x:p.geometry.y-t.geometry.y,b=c==="row"?p.geometry.y-t.geometry.y:p.geometry.x-t.geometry.x,x=c==="row"?l.top:l.left,v=y-d,k=b-x,I=c==="row"?p.geometry.width:p.geometry.height,M=c==="row"?t.geometry.width-l.right:t.geometry.height-l.bottom,L=n.isRoot&&c==="column"&&l.bottom>0&&h===f.length-1&&v>.5&&Math.abs(y+I-M)<=1,E={},P=n.isRoot?Od:0,O=c==="row"?"marginLeft":"marginTop",J=L?(E[O]="auto",!0):Se(E,O,v,P),V=Se(E,c==="row"?"marginTop":"marginLeft",k,0);if(!J||!V)return{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-negative-margin"};Object.keys(E).length>0&&(m[p.id]=E),d=y+I+g}return!n.isRoot&&Dd(m)?{childMargins:{},fallbackToAbsolute:!0,fallbackReason:"stage14-negative-margin"}:{layout:{mode:"flex",direction:c,...Yr(l),...u.kind==="uniform"&&u.value>0?{gap:u.value}:{}},childMargins:m,fallbackToAbsolute:!1,overflowVisible:a}}function Dd(t){return Object.values(t).some(e=>typeof e.marginTop=="number"&&e.marginTop<0||typeof e.marginLeft=="number"&&e.marginLeft<0)}function Se(t,e,n,o){if(Math.abs(n)<=.5)return!0;const r=Math.round(n);return r<0?r<o?!1:(t[e]=r,!0):(r>0&&(t[e]=r),!0)}var jd=new Set(["modal","toast","fixed-nav","overlay"]);function Hd(t,e){Jr(t,e,!0)}function Jr(t,e,n){if(t.children?.forEach(i=>Jr(i,e,!1)),!t.children||t.children.length===0||t.semantic?.role&&jd.has(t.semantic.role)||t.layout?.mode==="flex"&&t.layout.direction!==void 0&&t.layout.padding!==void 0)return;const o=t.children.filter(i=>!z(i)),r=kn(t,o,{paintOrder:e.paintOrder,isRoot:n});if(r.fallbackToAbsolute){if(r.fallbackReason){const i=t.layout?.hintConflicts??[],s={field:"mode",hint:"flex",inferred:"absolute",reason:r.fallbackReason};t.layout={mode:"absolute",hintConflicts:[...i,s]}}return}r.layout&&(t.layout=r.layout);for(const i of o){const s=r.childMargins[i.id];s&&Object.keys(s).length>0&&(i.flexFlow=s)}}function ke(t){return!z(t)}function Gd(t){const e=t.virtualContainer?.kind;return e==="row-container"||e==="column-container"}function Wd(t){if(t.layout?.mode!=="flex"||t.layout.direction!=="column")return{applied:!1};const e=t.children?.filter(ke)??[];if(e.length===0)return{applied:!1};const n=t.layout.padding??{top:0,right:0,bottom:0,left:0},o=t.geometry.width-n.left-n.right;if(!e.every(a=>{const c=a.flexFlow?.marginLeft,l=(o-a.geometry.width)/2,u=a.geometry.x-t.geometry.x;return(typeof c=="number"?Math.abs(c-l)<=1:c===void 0&&Math.abs(l)<=1)&&Math.abs(u-(n.left+l))<=1}))return{applied:!1};const r=t.layout.align,i=e.map(a=>({id:a.id,marginLeft:a.flexFlow?.marginLeft})),s=()=>{t.layout?.mode==="flex"&&(t.layout.align=r),e.forEach(a=>{const c=i.find(l=>l.id===a.id);c&&a.flexFlow&&(a.flexFlow.marginLeft=c.marginLeft)})};return t.layout?.mode==="flex"&&(t.layout.align="center"),e.forEach(a=>{a.flexFlow&&delete a.flexFlow.marginLeft}),{applied:!0,undo:s}}function Vd(t){if(t.layout?.mode!=="flex"||t.layout.direction!=="column")return{applied:!1};if(Gd(t))return{applied:!1};const e=t.layout.align;if(e!==void 0&&e!=="flex-start")return{applied:!1};const n=t.children?.filter(ke)??[];if(n.length===0)return{applied:!1};const o=t.layout.padding??{top:0,right:0,bottom:0,left:0},r=t.geometry.width-o.left-o.right;if(r<=0)return{applied:!1};const i=t.children;if(!i)return{applied:!1};const s=i.map(ti),a=[...i];let c=!1;const l=new Map;for(const f of n){const d=f.flexFlow?.marginLeft;if(typeof d!="number")continue;const g=(r-f.geometry.width)/2;if(g<0)continue;const m=f.geometry.x-t.geometry.x,h=o.left+g;if(Math.abs(d-g)>1||Math.abs(m-h)>1)continue;const p=Ud(t,f,o.left,r);l.set(f.id,p),c=!0}return c?(t.children=i.map(f=>l.get(f.id)??f),{applied:!0,undo:()=>{t.children=a,s.flat().forEach(({node:f,parentId:d,depth:g,flexFlow:m})=>{f.parentId=d,f.depth=g,f.flexFlow=$n(m)})}}):{applied:!1}}function Ud(t,e,n,o){const r=`${e.id}__center_wrapper`,i=$n(e.flexFlow),s={};i?.marginTop!==void 0&&(s.marginTop=i.marginTop),e.flexFlow=void 0;const a=t.depth+1;return Qr(e,a+1-e.depth),e.parentId=r,{id:r,name:`${e.name} center wrapper`,type:"FRAME",geometry:{x:t.geometry.x+n,y:e.geometry.y,width:o,height:e.geometry.height},depth:a,zIndex:e.zIndex,renderOrder:e.renderOrder,sourcePaintOrder:e.sourcePaintOrder,parentId:t.id,layout:{mode:"flex",direction:"column",align:"center"},...Object.keys(s).length>0?{flexFlow:s}:{},children:[e],virtualContainer:{kind:"center-wrapper",wrappedNodeIds:[e.id],reason:"stage14-item-auto-center"}}}function $n(t){return t?{...t}:void 0}function Qr(t,e){e!==0&&(t.depth+=e,t.children?.forEach(n=>Qr(n,e)))}function ti(t){return[{node:t,parentId:t.parentId,depth:t.depth,flexFlow:$n(t.flexFlow)},...(t.children??[]).flatMap(ti)]}function Xd(t){if(t.layout?.mode!=="flex"||t.layout.direction!=="row")return{applied:!1};const e=t.children?.filter(ke)??[];if(e.length<2)return{applied:!1};const n=t.layout.padding??{top:0,right:0,bottom:0,left:0},o=t.geometry.width-n.left-n.right,r=e[0].geometry.x-t.geometry.x;if(Math.abs(r-n.left)>1)return{applied:!1};const i=e[e.length-1],s=i.geometry.x-t.geometry.x+i.geometry.width;if(Math.abs(s-(n.left+o))>1)return{applied:!1};if(e.reduce((f,d)=>f+d.geometry.width,0)>o+1)return{applied:!1};const a=t.layout.justify,c=t.layout.gap,l=e.map(f=>({id:f.id,marginLeft:f.flexFlow?.marginLeft})),u=()=>{t.layout?.mode==="flex"&&(t.layout.justify=a,t.layout.gap=c),e.forEach(f=>{const d=l.find(g=>g.id===f.id);d&&f.flexFlow&&(f.flexFlow.marginLeft=d.marginLeft)})};return t.layout?.mode==="flex"&&(t.layout.justify="space-between",delete t.layout.gap),e.forEach(f=>{f.flexFlow&&delete f.flexFlow.marginLeft}),{applied:!0,undo:u}}function Kd(t){if(t.layout?.mode!=="flex")return{applied:!1};const e=t.children?.filter(ke)??[];if(e.length<1)return{applied:!1};const n=t.layout.direction==="row",o=n?"marginTop":"marginLeft",r=n?"top":"left",i=e[0].flexFlow?.[o];if(typeof i!="number"||i<=0)return{applied:!1};if(!e.every(l=>l.flexFlow?.[o]===i))return{applied:!1};const s=t.layout.padding?{...t.layout.padding}:{top:0,right:0,bottom:0,left:0},a=e.map(l=>({id:l.id,m:l.flexFlow?.[o]})),c=()=>{t.layout?.mode==="flex"&&(t.layout.padding=s),e.forEach(l=>{const u=a.find(f=>f.id===l.id);u&&l.flexFlow&&(l.flexFlow[o]=u.m)})};return t.layout.padding={...s,[r]:s[r]+i},e.forEach(l=>{l.flexFlow&&(n?delete l.flexFlow.marginTop:delete l.flexFlow.marginLeft)}),{applied:!0,undo:c}}function Yd(t){if(t.layout?.mode!=="flex")return{applied:!1};if(t.layout.gap!==void 0)return{applied:!1};const e=t.layout.justify;if(e==="space-between"||e==="space-around"||e==="space-evenly"||e==="center")return{applied:!1};const n=t.layout.direction==="row"?"marginLeft":"marginTop",o=t.children?.filter(l=>!z(l))??[];if(o.length<3)return{applied:!1};const r=o.slice(1).map(l=>l.flexFlow?.[n]).map(l=>typeof l=="number"?l:0);if(r.filter(l=>l>0).length<2)return{applied:!1};const i=Math.min(...r);if(i<=0)return{applied:!1};if(Math.max(...r)-i>1)return{applied:!1};const s=t.layout.gap,a=o.slice(1).map(l=>({id:l.id,m:l.flexFlow?.[n]})),c=()=>{t.layout?.mode==="flex"&&(t.layout.gap=s),o.slice(1).forEach(l=>{const u=a.find(f=>f.id===l.id);u&&l.flexFlow&&(l.flexFlow[n]=u.m)})};return t.layout.gap=i,o.slice(1).forEach((l,u)=>{const f=r[u]-i;l.flexFlow||(l.flexFlow={}),Math.abs(f)<=.5?n==="marginLeft"?delete l.flexFlow.marginLeft:delete l.flexFlow.marginTop:l.flexFlow[n]=Math.round(f)}),{applied:!0,undo:c}}var Zd=[Kd,Yd,Wd,Vd,Xd],qd=1;function Jd(t){ei(t)}function ei(t){if(t.layout?.mode==="flex"&&(t.children?.length??0)>0)for(const e of Zd){const n=e(t);n.applied&&tg(Qd(t),t.children,qd)&&n.undo?.()}t.children?.forEach(e=>ei(e))}function Qd(t){const e=new Map;if(t.layout?.mode!=="flex")return e;const n=t.layout.direction??"column",o=t.layout.padding??{top:0,right:0,bottom:0,left:0},r=t.layout.gap??0,i=t.layout.justify,s=t.layout.align,a=t.children?.filter(g=>!z(g))??[],c=n==="row"?t.geometry.width-o.left-o.right:t.geometry.height-o.top-o.bottom,l=n==="row"?t.geometry.height-o.top-o.bottom:t.geometry.width-o.left-o.right,u=c-(a.reduce((g,m)=>g+(n==="row"?m.geometry.width:m.geometry.height),0)+Math.max(0,a.length-1)*r);let f=n==="row"?o.left:o.top;i==="center"&&(f+=u/2);const d=i==="space-between"&&a.length>1?u/(a.length-1):0;for(let g=0;g<a.length;g++){const m=a[g],h=m.flexFlow?.marginLeft,p=m.flexFlow?.marginRight,y=m.flexFlow?.marginTop;let b=f;n==="row"?h==="auto"?b=o.left+c-m.geometry.width:typeof h=="number"&&(b=f+h):y==="auto"?b=o.top+c-m.geometry.height:typeof y=="number"&&(b=f+y);let x=n==="row"?o.top:o.left;if(s==="center")x+=(l-(n==="row"?m.geometry.height:m.geometry.width))/2;else if(s==="flex-end")x=(n==="row"?o.top:o.left)+l-(n==="row"?m.geometry.height:m.geometry.width);else{const v=n==="row"?y:h;n==="column"&&h==="auto"&&p==="auto"?x+=(l-m.geometry.width)/2:typeof v=="number"&&(x+=v)}n==="row"?(e.set(m.id,[t.geometry.x+b,t.geometry.y+x,m.geometry.width,m.geometry.height]),f=b+m.geometry.width+r+d):(e.set(m.id,[t.geometry.x+x,t.geometry.y+b,m.geometry.width,m.geometry.height]),f=b+m.geometry.height+r+d)}return e}function tg(t,e,n){for(const o of e){if(z(o))continue;const r=t.get(o.id);if(r&&(Math.abs(r[0]-o.geometry.x)>n||Math.abs(r[1]-o.geometry.y)>n))return!0}return!1}var eg=.5;function ng(t){ni(t)}function ni(t){t.children?.forEach(ni);const e=t.children;if(!e||e.length<2)return;const n=new Set;for(let o=0;o<e.length;o++){const r=e[o];if(!og(r)||!r.children||r.children.length<2)continue;const i=new Map;for(let s=o+1;s<e.length;s++){const a=e[s];if(n.has(a))continue;const c=rg(r,a);if(!c)continue;const l=i.get(c)??[];l.push(a),i.set(c,l),n.add(a)}i.size!==0&&(r.children=r.children.map((s,a)=>{const c=i.get(s);return!c||c.length===0?s:sg(r,s,c,a)}))}n.size>0&&(t.children=e.filter(o=>!n.has(o)))}function og(t){return t.virtualContainer?.kind==="row-container"}function rg(t,e){if(!xe(e.geometry,t.geometry)||(t.children??[]).some(o=>xe(e.geometry,o.geometry)))return;let n;for(const o of t.children??[]){const r=ig(e.geometry,o.geometry);r<eg||e.geometry.y<o.geometry.y+o.geometry.height-1||(!n||r>n.ratio)&&(n={child:o,ratio:r})}return n?.child}function ig(t,e){const n=Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x);return n<=0?0:n/Math.max(1,Math.min(t.width,e.width))}function sg(t,e,n,o){const r=[e,...n].sort((i,s)=>i.geometry.y-s.geometry.y||i.geometry.x-s.geometry.x||i.renderOrder-s.renderOrder);return{id:`${t.id}__col${o}`,name:`col ${o+1}`,type:"FRAME",geometry:ag(r),depth:t.depth+1,zIndex:e.zIndex,renderOrder:e.renderOrder,sourcePaintOrder:e.sourcePaintOrder,parentId:t.id,children:r,virtualContainer:{kind:"column-container",wrappedNodeIds:r.map(i=>i.id),reason:"row-child-column-folding"}}}function ag(t){let e=1/0,n=1/0,o=-1/0,r=-1/0;for(const i of t)e=Math.min(e,i.geometry.x),n=Math.min(n,i.geometry.y),o=Math.max(o,i.geometry.x+i.geometry.width),r=Math.max(r,i.geometry.y+i.geometry.height);return{x:e,y:n,width:o-e,height:r-n}}var cg=.95,In=10,$e=2,oi=/__block\d*(?:_row|_col)/,lg=1.2,ug=.9;function fg(t){return!!(t.imageRole&&(t.children?.length??0)===0||t.virtualContainer?.kind==="background-container"||oi.test(t.id)||oi.test(t.name)||t.type==="TEXT")}function dg(t){An(t)}function An(t){if(t.children?.forEach(An),!ii(t))return;let e=0;for(let n=0;n<In;n++){const o=mg(t);if(o===0)break;e+=o,n===In-1&&console.warn(`[reparent] hit max iterations (${In}) on ${t.id}`)}if(e!==0){for(const n of t.children??[])n.layout===void 0&&(n.children?.length??0)>0&&(si(n),An(n));si(t)}}function gg(t){ri(t)}function ri(t){if(t.children?.forEach(i=>ri(i)),!ii(t))return;const e=(t.children??[]).filter(i=>!z(i));if(e.length<2)return;let n=null;t:for(let i=0;i<e.length;i++)for(let s=i+1;s<e.length;s++){const a=e[i],c=e[s];if(!a.geometry||!c.geometry)continue;const l=Math.max(a.geometry.width,a.geometry.height),u=Math.max(c.geometry.width,c.geometry.height);if(Math.max(l,u)/Math.min(l,u)>=lg)continue;const f=Rn(a.geometry,c.geometry),d=Math.min(Ie(a.geometry),Ie(c.geometry));if(!(d<=0)&&!(f/d<ug)){n=a.renderOrder>c.renderOrder?a:c;break t}}if(!n)return;const o=e.filter(i=>i!==n),r=kn(t,o,{paintOrder:"html",isRoot:!1});if(!(r.fallbackToAbsolute!==!1||!r.layout)){n.outOfFlow="stage14-overlay-stack",t.layout=r.layout;for(const i of o){const s=r.childMargins[i.id];s&&Object.keys(s).length>0&&(i.flexFlow=s)}}}function ii(t){return t.layout?.mode!=="absolute"?!1:(t.layout.hintConflicts??[]).some(e=>typeof e.reason=="string"&&/T1|stage14-T1/.test(e.reason))}function si(t){const e=(t.children??[]).filter(o=>!z(o));if(e.length===0)return;const n=kn(t,e,{paintOrder:"html",isRoot:!1});if(n.fallbackToAbsolute===!1&&n.layout){t.layout=n.layout;for(const o of e){const r=n.childMargins[o.id];r&&Object.keys(r).length>0&&(o.flexFlow=r)}return}t.layout={mode:"absolute",hintConflicts:[{field:"mode",hint:"flex",inferred:"absolute",reason:n.fallbackReason??"stage14-T1"}]}}function mg(t){const e=t.children;if(!e||e.length<2)return 0;const n=new Map;for(let a=0;a<e.length;a++)for(let c=0;c<e.length;c++){if(a===c)continue;const l=e[a],u=e[c];if(!l.geometry||!u.geometry||fg(l)||hg(u,l)||pg(l,u))continue;const f=Ie(l.geometry),d=Ie(u.geometry);if(f<=d||d<=0||Rn(l.geometry,u.geometry)/d<cg)continue;const g=n.get(u.id);(!g||f<g.area)&&n.set(u.id,{container:l,area:f})}if(n.size===0)return 0;const o=new Set(n.keys());for(const a of Array.from(n.keys())){const{container:c}=n.get(a);o.has(c.id)&&n.delete(a)}if(n.size===0)return 0;const r=new Map;for(const[a,{container:c}]of n){const l=e.find(f=>f.id===a);let u=r.get(c.id);u||(u={container:c,absorbed:[]},r.set(c.id,u)),u.absorbed.push(l)}const i=new Set;let s=0;for(const{container:a,absorbed:c}of r.values()){const l=[];for(const u of c)bg(a,u)&&l.push(u);if(l.length!==0){a.children=[...a.children??[],...l],a.layout=void 0,a.flexFlow=void 0;for(const u of l)i.add(u.id);s+=l.length}}return s===0?0:(t.children=e.filter(a=>!i.has(a.id)),t.layout=void 0,t.flexFlow=void 0,s)}function hg(t,e){const n=t.sourcePaintOrder,o=e.sourcePaintOrder;return typeof n=="number"&&typeof o=="number"&&n<=o}function pg(t,e){const n=ai(e);return(t.children??[]).some(o=>yg(o)&&ai(o)<n&&Rn(o.geometry,e.geometry)>0)}function yg(t){return z(t)?!Lt(t):!1}function ai(t){return typeof t.sourcePaintOrder=="number"?t.sourcePaintOrder:t.renderOrder}function bg(t,e){const n=t.geometry,o=e.geometry,r=n.x,i=n.y,s=n.x+n.width,a=n.y+n.height,c=o.x,l=o.y,u=o.x+o.width,f=o.y+o.height;return!(r-c>$e||u-s>$e||i-l>$e||f-a>$e)}function Ie(t){return Math.max(0,t.width)*Math.max(0,t.height)}function Rn(t,e){const n=Math.max(t.x,e.x),o=Math.max(t.y,e.y),r=Math.min(t.x+t.width,e.x+e.width),i=Math.min(t.y+t.height,e.y+e.height);return r<=n||i<=o?0:(r-n)*(i-o)}function vg(t){let e=Id(t);return ci(e),li(e),e=ui(e),fi(e),Tn(e),ng(e),Tn(e),Hd(e,{paintOrder:"html"}),dg(e),gg(e),Tn(e),Jd(e),e}function ci(t){if(!t.children)return;const e=[];for(const n of t.children)ci(n),Ae(n)?e.push(...n.children??[]):e.push(n);t.children=e}function Ae(t){return t.extend?.mask!==!0||xg(t)?!1:t.imageRole!=="background"||wg(t)}function xg(t){return t.imageRole==="content"&&t.imageSource==="raster"&&!!t.imageUrl}function wg(t){return t.name.includes("\u8499\u7248")||/\bmask\b/i.test(t.name)}function li(t){if(!t.children)return;const e=[];for(const n of t.children)li(n),Sg(n)||e.push(n);t.children=e}function Sg(t){return(t.type==="FRAME"||t.type==="GROUP"||t.type==="INSTANCE"||t.type==="COMPONENT")&&(t.children?.length??0)===0&&!t.imageRole&&!t.imageUrl&&!Ig(t)}function ui(t){if(t.children&&(t.children=t.children.map(ui)),!kg(t))return t;const e=t.children??[],n=`${t.id}__background_container`,o={...t,children:void 0,virtualContainer:void 0,parentId:n};return{id:n,name:`${t.name} container`,type:"FRAME",geometry:$g([o,...e]),depth:t.depth,zIndex:t.zIndex,renderOrder:t.renderOrder,parentId:t.parentId,children:[o,...e],virtualContainer:{kind:"background-container",backgroundNodeId:t.id,wrappedNodeIds:e.map(r=>r.id),reason:"background-layer"}}}function kg(t){return t.imageRole==="background"&&t.virtualContainer?.kind==="background-container"&&(t.children?.length??0)>0}function $g(t){let e=1/0,n=1/0,o=-1/0,r=-1/0;for(const i of t){const s=i.geometry;e=Math.min(e,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x+s.width),r=Math.max(r,s.y+s.height)}return{x:e,y:n,width:o-e,height:r-n}}function Ig(t){const e=t.style;return!!(e?.backgroundColor||e?.backgroundImage||e?.border||e?.borderTop||e?.borderRight||e?.borderBottom||e?.borderLeft||e?.boxShadow||e?.filter||e?.backdropFilter)}function fi(t){if(!t.children)return;t.children.forEach(fi);const e=[],n=new Set,o=[...t.children].sort((r,i)=>i.renderOrder-r.renderOrder);for(const r of o)Ag(r,e)||(n.add(r),di(r)&&Yo(r)>=.5&&e.push(r));t.children=t.children.filter(r=>n.has(r))}function Ag(t,e){if(!di(t))return!1;const n=Cn(t.characters);return e.some(o=>Cn(o.characters)===n&&ge(o.geometry,t.geometry)>=.95)}function di(t){return t.type==="TEXT"&&!!Cn(t.characters)}function Cn(t){return t?.trim().replace(/\s+/g," ")??""}function Tn(t){let e=0;const n=(o,r,i,s)=>{o.depth=r,o.zIndex=i,o.renderOrder=e++,o.parentId=s,o.children?.forEach((a,c)=>n(a,r+1,c,o.id))};n(t,0,0,void 0)}var jt=.5;function R(t){return Math.round(t*100)/100}function Re(t){if(typeof t=="number")return t;if(typeof t!="string")return;const e=Number.parseFloat(t);return Number.isFinite(e)?e:void 0}function Ht(t){return Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0").toUpperCase()}function Rg(t){const e=Number.parseFloat(t);if(Number.isFinite(e))return t.trim().endsWith("%")?Ht(e/100*255):Ht(e*255)}function Cg(t){const e=t.slice(1);if(/^[0-9a-fA-F]{3}$/.test(e)){const[n,o,r]=e;return`#${n}${n}${o}${o}${r}${r}`.toUpperCase()}if(/^[0-9a-fA-F]{4}$/.test(e)){const[n,o,r,i]=e;return`#${i}${i}${n}${n}${o}${o}${r}${r}`.toUpperCase()}if(/^[0-9a-fA-F]{6}$/.test(e))return`#${e}`.toUpperCase();if(/^[0-9a-fA-F]{8}$/.test(e)){const n=e.slice(0,2),o=e.slice(2,4),r=e.slice(4,6);return`#${e.slice(6,8)}${n}${o}${r}`.toUpperCase()}return t}function Tg(t){const e=t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+%?))?\s*\)$/i);if(!e)return;const n=Ht(Number(e[1])),o=Ht(Number(e[2])),r=Ht(Number(e[3])),i=e[4]===void 0?void 0:Rg(e[4]);return i?`#${i}${n}${o}${r}`:`#${n}${o}${r}`}function Gt(t){const e=t.trim();return/^#[0-9a-fA-F]{3,8}$/.test(e)?Cg(e):Tg(e)??t}function _g(t){return t.replace(/#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{4}|[0-9a-fA-F]{3})(?![0-9a-fA-F])/g,e=>Gt(e)).replace(/rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+(?:\s*,\s*[\d.]+%?)?\s*\)/gi,e=>Gt(e))}function gi(t){return/^\d+:\d+$/.test(t)}function Ng(t,e){return gi(t.id)?t.id:e&&gi(e.id)?e.id:t.id}function mi(t){return t.type==="IMAGE"||t.imageRole==="content"||t.imageSource!==void 0||t.imageUrl!==void 0}function Mg(t,e){return t&&t.split(/[\\/]/).at(-1)?.replace(/\.json$/i,"")||e.name}function Eg(t){if(!t)return;const e=t.trim().split(/\s+/).map(Re);if(!e.some(n=>n===void 0)){if(e.length===1)return R(e[0]);if(e.length===2)return{topLeft:R(e[0]),topRight:R(e[1]),bottomRight:R(e[0]),bottomLeft:R(e[1])};if(e.length===3)return{topLeft:R(e[0]),topRight:R(e[1]),bottomRight:R(e[2]),bottomLeft:R(e[1])};if(e.length===4)return{topLeft:R(e[0]),topRight:R(e[1]),bottomRight:R(e[2]),bottomLeft:R(e[3])}}}function Wt(t){if(!t)return;const e=t.trim().match(/^([\d.]+)px\s+(solid|dashed|dotted)\s+(.+)$/i);if(!e)return;const n=e[2].toLowerCase();return{width:R(Number(e[1])),color:Gt(e[3]),style:n==="dashed"?"Dashed":n==="dotted"?"Dotted":"Solid"}}function Pg(t){if(!t)return!0;const e=t.trim().toLowerCase();if(!e||e==="transparent"||e==="none")return!0;const n=e.match(/rgba?\(([^)]+)\)/);if(n){const o=n[1].split(",").map(r=>Number.parseFloat(r.trim()));return o.length===4&&(Number.isNaN(o[3])||o[3]<=0)}return/^#[0-9a-f]{8}$/.test(e)&&e.slice(-2)==="00"}function hi(t){if(!t)return[0,0,0,0];const[e,n=e,o=e,r=n]=t.trim().split(/\s+/).map(i=>Number.parseFloat(i)||0);return[e,n,o,r]}function Og(t,e){if(t.geometry.rotation||e.geometry.rotation||!zo(t.geometry,e.geometry,jt))return!1;const n=hi(t.style?.borderRadius),o=hi(e.style?.borderRadius),r=e.geometry.x-t.geometry.x,i=e.geometry.y-t.geometry.y,s=t.geometry.x+t.geometry.width-(e.geometry.x+e.geometry.width),a=t.geometry.y+t.geometry.height-(e.geometry.y+e.geometry.height);return!(Ce(n[0],o[0],r,i)||Ce(n[1],o[1],s,i)||Ce(n[2],o[2],s,a)||Ce(n[3],o[3],r,a))}function Ce(t,e,n,o){return t<=jt||n>=t-jt||o>=t-jt?!1:t-Math.min(n,o)>e+jt}function Lg(t){if(t.type==="TEXT"||t.type==="IMAGE"&&t.imageSource==="icon-font"||t.type==="IMAGE"&&t.imageOpaque===!1||t.style?.opacity!==void 0&&t.style.opacity<1||t.style?.filter||t.style?.backgroundImage&&un(t.style.backgroundImage))return!1;const e=!Pg(t.style?.backgroundColor),n=!!t.style?.backgroundImage,o=t.type==="IMAGE";return e||n||o}function pi(t){if(t!==void 0)return t==="center"?"Center":t==="flex-end"?"End":"Start"}function yi(t){if(t==="center")return"Center";if(t==="flex-end")return"End";if(t==="space-between")return"SpaceBetween";if(t==="space-around")return"SpaceAround";if(t==="flex-start")return"Start"}function Fg(t){if(t==="center")return"Center";if(t==="right")return"End";if(t==="left")return"Start";if(t==="justify")return"Justify"}function Bg(t){if(t==="top")return"Top";if(t==="middle")return"Center";if(t==="bottom")return"Bottom"}function zg(t,e,n){return n==="absolute"?{position:"absolute",top:R(t.geometry.y-e.geometry.y),left:R(t.geometry.x-e.geometry.x)}:{}}function Dg(t,e){return t.clipDecision?.overflow??t.style?.overflow??(e==="root"?"hidden":void 0)}function jg(t,e={}){const n={width:R(t.geometry.width),height:R(t.geometry.height),...e.root&&e.placement?zg(t,e.root,e.placement):{}},o=t.style;o?.backgroundColor&&(n.backgroundColor=Gt(o.backgroundColor)),o?.backgroundImage&&(/\b(?:repeating-)?(?:linear|radial|conic)-gradient\(/i.test(o.backgroundImage)?n.linearGradient=_g(o.backgroundImage):n.backgroundImage=o.backgroundImage),o?.backgroundSize&&(n.backgroundSize=o.backgroundSize),o?.backgroundPosition&&(n.backgroundPosition=o.backgroundPosition),o?.backgroundRepeat&&(n.backgroundRepeat=o.backgroundRepeat);const r=Dg(t,e.placement);r&&(n.overflow=r),o?.opacity!==void 0&&(n.opacity=o.opacity);const i=Eg(o?.borderRadius);i!==void 0&&(n.borderRadius=i);const s=Wt(o?.border);s&&(n.border=s);const a=Wt(o?.borderTop);a&&(n.borderTop=a);const c=Wt(o?.borderRight);c&&(n.borderRight=c);const l=Wt(o?.borderBottom);l&&(n.borderBottom=l);const u=Wt(o?.borderLeft);u&&(n.borderLeft=u),o?.boxShadow&&(n.boxShadow=o.boxShadow),o?.filter&&(n.filter=o.filter),o?.backdropFilter&&(n.backdropFilter=o.backdropFilter);const f=Re(o?.fontSize);f!==void 0&&(n.fontSize=R(f)),o?.color&&(n.fontColor=Gt(o.color)),o?.fontWeight!==void 0&&(n.fontWeight=o.fontWeight),o?.fontFamily&&(n.fontFamily=o.fontFamily);const d=Re(o?.lineHeight);d!==void 0&&(n.lineHeight=R(d));const g=Re(o?.letterSpacing);g!==void 0&&(n.letterSpacing=R(g));const m=Fg(o?.textAlign);m&&(n.textAlign=m);const h=Bg(o?.verticalAlign);if(h&&(n.verticalAlign=h),o?.textShadow&&(n.textShadow=o.textShadow),e.includeFlexLayout&&t.layout?.mode==="flex"){t.layout.gap!==void 0&&(n.space=R(t.layout.gap)),t.layout.padding&&(n.padding=t.layout.padding);const p=yi(t.layout.justify);p&&(n.justifyContent=p);const y=pi(t.layout.align);y&&(n.alignItems=y)}return e.placement!=="absolute"&&(t.flexFlow?.marginTop!==void 0&&(n.marginTop=t.flexFlow.marginTop),t.flexFlow?.marginLeft!==void 0&&(n.marginLeft=t.flexFlow.marginLeft),t.flexFlow?.marginRight!==void 0&&(n.marginRight=t.flexFlow.marginRight)),n}function Hg(t){if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}}function Gg(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}function Wg(t){const e=Gg(t.extend?.pixso)?.guid;return typeof e=="string"&&e.length>0?e:void 0}function Vg(t,e=t.id,n=!1){const o=t.extend&&Object.prototype.hasOwnProperty.call(t.extend,"custom_mark")?t.extend.custom_mark:void 0,r=t.extend&&Object.prototype.hasOwnProperty.call(t.extend,"design_mark")?Hg(t.extend.design_mark):void 0,i=Wg(t),s=t.componentInstance?.component_key||void 0,a=t.parentComponents?.map(c=>({...c}));return{octoId:e,octoName:t.name,octoType:t.type,bbox:[R(t.geometry.x),R(t.geometry.y),R(t.geometry.x+t.geometry.width),R(t.geometry.y+t.geometry.height)],...s?{designComponentKey:s}:{},...a?.length?{parentComponents:a}:{},...n&&i!==void 0?{pixsoNodeId:i}:{},...n&&t.imageResourceNodeId!==void 0?{pixsoImageId:t.imageResourceNodeId}:{},...o!==void 0?{customMark:o}:{},...r!==void 0?{designMark:r}:{}}}function bi(t){return t.type==="TEXT"?"Text":(t.children?.length??0)>0?vi(t)||Ug(t)?"Stack":t.layout?.mode==="flex"?t.layout.direction==="row"?"Row":"Column":"Stack":mi(t)?"Image":"Stack"}function Ug(t){if(t.isPageRoot)return!1;const e=t.children??[];return e.length<2?!1:e.some(n=>z(n))}function vi(t){if(!t.isPageRoot||t.layout?.mode!=="flex")return!1;const e=(t.children??[]).filter(n=>!Ae(n));return e.some(n=>Lt(n))&&e.some(n=>!z(n))}function Xg(t,e){const n=R(e.geometry.x-t.geometry.x),o=R(e.geometry.y-t.geometry.y);return{...o!==0?{marginTop:o}:{},...n!==0?{marginLeft:n}:{}}}function Kg(t,e,n){return e==="Stack"||t.layout?.mode==="flex"&&z(n)?"absolute":"flow"}function Yg(t){return`assets/${t.replace(/:/g,"_")}.png`}function Zg(t){return t.layout?.mode==="flex"&&t.layout.direction==="row"?"Row":"Column"}function qg(t){const e={width:R(t.geometry.width),height:R(t.geometry.height),position:"absolute",top:0,left:0};if(t.layout?.mode==="flex"){t.layout.gap!==void 0&&(e.space=R(t.layout.gap)),t.layout.padding&&(e.padding=t.layout.padding);const n=yi(t.layout.justify);n&&(e.justifyContent=n);const o=pi(t.layout.align);o&&(e.alignItems=o)}return e}function Jg(t){return{octoId:`${t.id}__foreground`,octoName:`${t.name} foreground`,octoType:"FRAME",bbox:[R(t.geometry.x),R(t.geometry.y),R(t.geometry.x+t.geometry.width),R(t.geometry.y+t.geometry.height)]}}function Te(t,e,n,o,r){const i=ki(n,o,r,Kg(t,e,n),t);return e==="Stack"&&i.styles?.position!=="absolute"&&(i.styles={...i.styles??{},...Xg(t,n)}),i}function Qg(t,e,n){const o=(t.children??[]).filter(l=>!Ae(l)),r=o.filter(l=>Lt(l)).sort((l,u)=>W(l)-W(u)).map(l=>Te(t,"Stack",l,e,n)),i=o.filter(l=>!z(l)),s=o.filter(l=>z(l)&&!Lt(l)).sort((l,u)=>W(l)-W(u)).map(l=>Te(t,"Stack",l,e,n)),a=Zg(t),c={componentName:a,styles:qg(t),meta:Jg(t),children:i.map(l=>Te(t,a,l,e,n))};return[...r,c,...s]}function tm(t,e,n,o){if(e==="Stack"&&vi(t))return Qg(t,n,o);const r=(t.children??[]).filter(i=>!Ae(i));return(e==="Stack"?em(r):r).map(i=>Te(t,e,i,n,o))}function em(t){const e=[...t].sort((o,r)=>W(o)-W(r)),n=e.filter(o=>o.imageRole==="background"&&o.backgroundLayer).sort((o,r)=>W(o)-W(r));for(const o of n){const r=e.indexOf(o);if(r<0)continue;const i=e.findIndex(s=>s!==o&&nm(o,s));i<0||r<i||(e.splice(r,1),e.splice(i,0,o))}return e}function W(t){return typeof t.sourcePaintOrder=="number"?t.sourcePaintOrder:t.renderOrder}function xi(t,e){return W(t)>W(e)&&Lg(t)&&Og(t,e)?!0:(t.children??[]).some(n=>xi(n,e))}function wi(t){t.children?.forEach(wi);const e=t.children;if(!e||e.length<2||bi(t)!=="Stack")return;const n=[...e].sort((r,i)=>W(r)-W(i)),o=new Set;for(let r=0;r<n.length;r++){const i=n[r];i.geometry.width<=0||i.geometry.height<=0||i.geometry.rotation||n.slice(r+1).some(s=>xi(s,i))&&o.add(i)}o.size>0&&(t.children=e.filter(r=>!o.has(r)))}function nm(t,e){const n=t.backgroundLayer?.containedNodeIds;if(!n||n.length===0)return!1;if(n.includes(e.id))return!0;const o=Si(e);return n.some(r=>o.has(r))}function Si(t){const e=new Set([t.id]);for(const n of t.children??[])for(const o of Si(n))e.add(o);return e}function ki(t,e={},n=t,o="root",r){const i=bi(t),s=tm(t,i,e,n),a=i==="Image"?Ng(t,r):t.id,c={componentName:i,styles:{...jg(t,{includeFlexLayout:i==="Row"||i==="Column",root:n,placement:o})},meta:Vg(t,a,e.includePixsoProvenance===!0)};return i==="Text"&&(c.content=t.characters??""),i==="Image"&&mi(t)&&(c.src=e.imageSrcMode==="asset-path"?Yg(a):"placeholder"),s.length>0&&(c.children=s),c}function om(t,e={}){const n=vg(t);return wi(n),{page:{name:Mg(e.sourcePath,n),description:e.sourcePath??n.name},ui:ki(n,e)}}function $i(t){const e={...t};return delete e.meta,e.children&&(e.children=e.children.map($i)),e}function rm(t,e={}){const n=qt(t),o=!n&&sr(t)&&t.content.length>0;if(!n&&!yt(t)&&!o)throw new TypeError("pixsoToArkUiDsl: Pixso \u8F93\u5165\u4E0D\u662F\u6709\u6548\u7684\u8BBE\u8BA1\u7A3F\u6570\u636E");const r=om(t,{sourcePath:e.sourcePath,imageSrcMode:"asset-path",includePixsoProvenance:e.includePixsoProvenance===!0});return e.pageName!==void 0&&(r.page.name=e.pageName),e.pageDescription!==void 0&&(r.page.description=e.pageDescription),e.keepMeta===!1&&(r.ui=$i(r.ui)),r}var im="PixsoPage",sm=/^[A-Za-z_][A-Za-z0-9_]*Page$/,am=new Set(["abstract","accessor","any","as","assert","asserts","async","await","bigint","boolean","break","build","case","catch","class","component","const","constructor","continue","debugger","declare","default","defer","delete","do","else","entry","enum","export","extends","false","finally","for","from","function","get","global","if","implements","import","in","infer","instanceof","interface","intrinsic","is","keyof","let","module","namespace","never","new","null","number","object","of","out","override","package","private","protected","public","readonly","require","return","satisfies","set","static","string","struct","super","switch","symbol","this","throw","true","try","type","typeof","undefined","unique","unknown","using","var","void","while","with","yield"]);function Ii(t,e={}){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("pixsoToRawNewRoot: options \u5FC5\u987B\u662F\u5BF9\u8C61");if(Nl(t))return cn(Ml(t.full,t.occurrence));if(qt(t))return qe(t,e);if(yt(t))return cn(t);if(sr(t)&&t.content.length>0)return t;throw new TypeError("pixsoToRawNewRoot: Pixso \u8F93\u5165\u4E0D\u662F\u6709\u6548\u7684\u8BBE\u8BA1\u7A3F\u6570\u636E")}function cm(t){const e=t===void 0?im:t;if(typeof e!="string"||!sm.test(e)||am.has(e))throw new TypeError("pixsoToArkTs: structName \u5FC5\u987B\u662F\u4EE5 Page \u7ED3\u5C3E\u3001\u5408\u6CD5\u4E14\u975E\u4FDD\u7559\u5B57\u7684 ArkTS \u6807\u8BC6\u7B26");return e}function lm(t){return`pixso_${t.replace(/[^A-Za-z0-9_]/g,"_").toLowerCase()}`}function um(t){const e=t.trim().match(/^url\(\s*(['"]?)(.*?)\1\s*\)$/i);if(!e)return;const n=e[2].trim();return/^https?:/i.test(n)?void 0:n}function Ai(t,e){if(!t)throw new TypeError("pixsoToArkTs: \u672C\u5730\u56FE\u7247\u7F3A\u5C11\u771F\u5B9E Pixso \u8282\u70B9 ID");const n=lm(t),o=e.mediaOwners.get(n);if(o!==void 0&&o!==t)throw new TypeError(`pixsoToArkTs: Pixso \u8282\u70B9 ID ${o} \u4E0E ${t} \u6620\u5C04\u5230\u540C\u4E00 media \u540D ${n}`);return e.mediaOwners.set(n,t),e.imageIds.has(t)||(e.imageIds.add(t),e.candidates.push({imageId:t,mediaName:n})),{imageId:t,mediaName:n}}function Ri(t,e){let n;if(t.componentName==="Image"&&t.src&&!/^https?:/i.test(t.src)&&(n=t.meta?.pixsoImageId??t.meta?.pixsoNodeId,t.src=`assets/${Ai(n,e).mediaName}.png`),typeof t.styles?.backgroundImage=="string"&&um(t.styles.backgroundImage)!==void 0){const o=Ai(n??t.meta?.pixsoImageId??t.meta?.pixsoNodeId,e);t.styles.backgroundImage=`url("assets/${o.mediaName}.png")`}t.children?.forEach(o=>Ri(o,e))}function fm(t,e,n){let o=e+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]===n)return o+1;o+=1}return t.length}function dm(t){const e=new Set;let n=0;for(;n<t.length;){const o=t[n],r=t[n+1];if(o==='"'||o==="'"||o==="`"){n=fm(t,n,o);continue}if(o==="/"&&r==="/"){const i=t.indexOf(`
98
+ `,n+2);n=i<0?t.length:i+1;continue}if(o==="/"&&r==="*"){const i=t.indexOf("*/",n+2);n=i<0?t.length:i+2;continue}if(o==="$"&&t[n+1]==="r"&&(n===0||!/[A-Za-z0-9_$]/.test(t[n-1]))){const i=t.slice(n).match(/^\$r\(\s*(['"])app\.media\.(pixso_[A-Za-z0-9_]+)\1\s*\)/);if(i){e.add(i[2]),n+=i[0].length;continue}}n+=1}return e}function gm(t,e){const n=dm(t),o=[...n].filter(r=>!e.mediaOwners.has(r));if(o.length>0)throw new TypeError(`pixsoToArkTs: ArkTS \u5305\u542B\u65E0\u6CD5\u6620\u5C04\u5230 Pixso \u8282\u70B9 ID \u7684 media\uFF1A${o.join(", ")}`);return e.candidates.filter(r=>n.has(r.mediaName)).map(r=>r.imageId)}function mm(t,e={}){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("pixsoToArkTs: options \u5FC5\u987B\u662F\u5BF9\u8C61");if(Object.prototype.hasOwnProperty.call(e,"detectRepetitivePattern"))throw new TypeError("pixsoToArkTs: detectRepetitivePattern \u5DF2\u79FB\u9664\uFF0C\u91CD\u590D\u7ED3\u6784\u7531\u5F15\u64CE\u81EA\u52A8\u4F18\u5316");const n=cm(e.structName),o=rm(Ii(t),{pageName:n,includePixsoProvenance:!0}),r={candidates:[],imageIds:new Set,mediaOwners:new Map};Ri(o.ui,r);let i;try{if(i=Ma(o),typeof i!="string"||i.trim()==="")throw new TypeError("ArkTS generator \u8FD4\u56DE\u4E86\u7A7A\u7684\u6E90\u7801")}catch(s){throw new Error("pixsoToArkTs: ArkTS \u751F\u6210\u5931\u8D25",{cause:s})}return{code:i,imageIds:gm(i,r)}}export{mm as pixsoToArkTs,Ii as pixsoToRawNewRoot};