@techdocs/cli 1.11.5-next.2 → 1.12.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/commands/generate/generate.cjs.js +32 -2
  3. package/dist/commands/generate/generate.cjs.js.map +1 -1
  4. package/dist/commands/index.cjs.js +9 -1
  5. package/dist/commands/index.cjs.js.map +1 -1
  6. package/dist/commands/migrate/migrate.cjs.js.map +1 -1
  7. package/dist/commands/publish/publish.cjs.js +47 -0
  8. package/dist/commands/publish/publish.cjs.js.map +1 -1
  9. package/dist/commands/serve/mkdocs.cjs.js.map +1 -1
  10. package/dist/commands/serve/serve.cjs.js.map +1 -1
  11. package/dist/commands/serve/utils.cjs.js.map +1 -1
  12. package/dist/embedded-app/.config-schema.json +52 -46
  13. package/dist/embedded-app/index.html +1 -1
  14. package/dist/embedded-app/index.html.tmpl +1 -1
  15. package/dist/embedded-app/static/123.bc6a54ead4a3.chunk.js +2 -0
  16. package/dist/embedded-app/static/123.bc6a54ead4a3.chunk.js.map +1 -0
  17. package/dist/embedded-app/static/{1659.4dc5ef343178.chunk.js → 1659.9fe64c5d9180.chunk.js} +2 -2
  18. package/dist/embedded-app/static/{1659.4dc5ef343178.chunk.js.map → 1659.9fe64c5d9180.chunk.js.map} +1 -1
  19. package/dist/embedded-app/static/1749.99ba95728e00.chunk.js +2 -0
  20. package/dist/embedded-app/static/1749.99ba95728e00.chunk.js.map +1 -0
  21. package/dist/embedded-app/static/1767.511a3dc76c96.chunk.js +2 -0
  22. package/dist/embedded-app/static/1767.511a3dc76c96.chunk.js.map +1 -0
  23. package/dist/embedded-app/static/1994.7736057c2e9f.chunk.js +2 -0
  24. package/dist/embedded-app/static/1994.7736057c2e9f.chunk.js.map +1 -0
  25. package/dist/embedded-app/static/{2063.c6396ce3e9c9.chunk.js → 2063.be81f1843585.chunk.js} +3 -3
  26. package/dist/embedded-app/static/2063.be81f1843585.chunk.js.map +1 -0
  27. package/dist/embedded-app/static/{2295.0f797d8c2780.chunk.js → 2295.aaedbca4c1c5.chunk.js} +3 -3
  28. package/dist/embedded-app/static/2295.aaedbca4c1c5.chunk.js.map +1 -0
  29. package/dist/embedded-app/static/2360.806f2e1ab212.chunk.js +2 -0
  30. package/dist/embedded-app/static/2360.806f2e1ab212.chunk.js.map +1 -0
  31. package/dist/embedded-app/static/3031.f2ee3495211a.chunk.js +2 -0
  32. package/dist/embedded-app/static/{3031.cd0a0f1ddfd2.chunk.js.map → 3031.f2ee3495211a.chunk.js.map} +1 -1
  33. package/dist/embedded-app/static/3554.78dd0c182f6c.chunk.js +2 -0
  34. package/dist/embedded-app/static/3554.78dd0c182f6c.chunk.js.map +1 -0
  35. package/dist/embedded-app/static/{4587.96f03715ec4f.chunk.js → 4587.f762d58ffd52.chunk.js} +2 -2
  36. package/dist/embedded-app/static/{4587.96f03715ec4f.chunk.js.map → 4587.f762d58ffd52.chunk.js.map} +1 -1
  37. package/dist/embedded-app/static/4591.d741c025cb8a.chunk.js +2 -0
  38. package/dist/embedded-app/static/4591.d741c025cb8a.chunk.js.map +1 -0
  39. package/dist/embedded-app/static/4609.9d9e4473afcc.chunk.js +531 -0
  40. package/dist/embedded-app/static/4609.9d9e4473afcc.chunk.js.map +1 -0
  41. package/dist/embedded-app/static/4648.cd5b8df48435.chunk.js +2 -0
  42. package/dist/embedded-app/static/4648.cd5b8df48435.chunk.js.map +1 -0
  43. package/dist/embedded-app/static/4876.fa3ad2676113.chunk.js +2 -0
  44. package/dist/embedded-app/static/4876.fa3ad2676113.chunk.js.map +1 -0
  45. package/dist/embedded-app/static/5877.73f1d4863c15.chunk.js +2 -0
  46. package/dist/embedded-app/static/5877.73f1d4863c15.chunk.js.map +1 -0
  47. package/dist/embedded-app/static/6138.f15d6245c80d.chunk.js +2 -0
  48. package/dist/embedded-app/static/6138.f15d6245c80d.chunk.js.map +1 -0
  49. package/dist/embedded-app/static/6206.3e7f13e11c59.chunk.js +2 -0
  50. package/dist/embedded-app/static/6206.3e7f13e11c59.chunk.js.map +1 -0
  51. package/dist/embedded-app/static/6949.beeb90ede97f.chunk.js +4 -0
  52. package/dist/embedded-app/static/6949.beeb90ede97f.chunk.js.map +1 -0
  53. package/dist/embedded-app/static/7203.8b3d94b34b16.chunk.js +2 -0
  54. package/dist/embedded-app/static/7203.8b3d94b34b16.chunk.js.map +1 -0
  55. package/dist/embedded-app/static/8877.ab3d98868650.chunk.js +2 -0
  56. package/dist/embedded-app/static/8877.ab3d98868650.chunk.js.map +1 -0
  57. package/dist/embedded-app/static/9050.bd63e0a33f06.chunk.js +2 -0
  58. package/dist/embedded-app/static/9050.bd63e0a33f06.chunk.js.map +1 -0
  59. package/dist/embedded-app/static/9230.422824f655e0.chunk.js +2 -0
  60. package/dist/embedded-app/static/9230.422824f655e0.chunk.js.map +1 -0
  61. package/dist/embedded-app/static/main.2b07c1548609.js +2 -0
  62. package/dist/embedded-app/static/main.2b07c1548609.js.map +1 -0
  63. package/dist/embedded-app/static/module-remix-run.32d1d7665115.js +2 -0
  64. package/dist/embedded-app/static/module-remix-run.32d1d7665115.js.map +1 -0
  65. package/dist/embedded-app/static/module-zod.da562d5b5226.js +56 -0
  66. package/dist/embedded-app/static/module-zod.da562d5b5226.js.map +1 -0
  67. package/dist/embedded-app/static/{runtime.304ce6fa8de1.js → runtime.f472dc4c479f.js} +2 -2
  68. package/dist/embedded-app/static/{runtime.304ce6fa8de1.js.map → runtime.f472dc4c479f.js.map} +1 -1
  69. package/dist/embedded-app/static/vendor.d2c73d5e1e09.js +2 -0
  70. package/dist/embedded-app/static/vendor.d2c73d5e1e09.js.map +1 -0
  71. package/dist/index.cjs.js.map +1 -1
  72. package/dist/lib/PublisherConfig.cjs.js.map +1 -1
  73. package/dist/lib/etag.cjs.js +40 -0
  74. package/dist/lib/etag.cjs.js.map +1 -0
  75. package/dist/lib/httpServer.cjs.js.map +1 -1
  76. package/dist/lib/livereload.cjs.js.map +1 -1
  77. package/dist/lib/mkdocsServer.cjs.js.map +1 -1
  78. package/dist/lib/utility.cjs.js.map +1 -1
  79. package/dist/package.json.cjs.js +1 -1
  80. package/dist/package.json.cjs.js.map +1 -1
  81. package/package.json +8 -7
  82. package/dist/embedded-app/static/123.580aa7a9bfda.chunk.js +0 -2
  83. package/dist/embedded-app/static/123.580aa7a9bfda.chunk.js.map +0 -1
  84. package/dist/embedded-app/static/1749.fcf12bbab446.chunk.js +0 -2
  85. package/dist/embedded-app/static/1749.fcf12bbab446.chunk.js.map +0 -1
  86. package/dist/embedded-app/static/1767.5aca18e1057b.chunk.js +0 -2
  87. package/dist/embedded-app/static/1767.5aca18e1057b.chunk.js.map +0 -1
  88. package/dist/embedded-app/static/1994.9de2967d46a1.chunk.js +0 -2
  89. package/dist/embedded-app/static/1994.9de2967d46a1.chunk.js.map +0 -1
  90. package/dist/embedded-app/static/2063.c6396ce3e9c9.chunk.js.map +0 -1
  91. package/dist/embedded-app/static/2295.0f797d8c2780.chunk.js.map +0 -1
  92. package/dist/embedded-app/static/2360.c56e85f47e34.chunk.js +0 -2
  93. package/dist/embedded-app/static/2360.c56e85f47e34.chunk.js.map +0 -1
  94. package/dist/embedded-app/static/3031.cd0a0f1ddfd2.chunk.js +0 -2
  95. package/dist/embedded-app/static/3554.bb882f8e4aea.chunk.js +0 -2
  96. package/dist/embedded-app/static/3554.bb882f8e4aea.chunk.js.map +0 -1
  97. package/dist/embedded-app/static/4591.5563e3a7aea4.chunk.js +0 -2
  98. package/dist/embedded-app/static/4591.5563e3a7aea4.chunk.js.map +0 -1
  99. package/dist/embedded-app/static/4609.152f14ef4904.chunk.js +0 -531
  100. package/dist/embedded-app/static/4609.152f14ef4904.chunk.js.map +0 -1
  101. package/dist/embedded-app/static/4648.8a54a9ce4e70.chunk.js +0 -2
  102. package/dist/embedded-app/static/4648.8a54a9ce4e70.chunk.js.map +0 -1
  103. package/dist/embedded-app/static/4876.67117dbbe8d1.chunk.js +0 -2
  104. package/dist/embedded-app/static/4876.67117dbbe8d1.chunk.js.map +0 -1
  105. package/dist/embedded-app/static/5877.8ad98e3207c5.chunk.js +0 -2
  106. package/dist/embedded-app/static/5877.8ad98e3207c5.chunk.js.map +0 -1
  107. package/dist/embedded-app/static/6138.a55572f5ecc5.chunk.js +0 -2
  108. package/dist/embedded-app/static/6138.a55572f5ecc5.chunk.js.map +0 -1
  109. package/dist/embedded-app/static/6206.b2713857572e.chunk.js +0 -2
  110. package/dist/embedded-app/static/6206.b2713857572e.chunk.js.map +0 -1
  111. package/dist/embedded-app/static/6949.62c7fa0aab7f.chunk.js +0 -4
  112. package/dist/embedded-app/static/6949.62c7fa0aab7f.chunk.js.map +0 -1
  113. package/dist/embedded-app/static/7203.16b8799346fa.chunk.js +0 -2
  114. package/dist/embedded-app/static/7203.16b8799346fa.chunk.js.map +0 -1
  115. package/dist/embedded-app/static/8877.58093d2c2ba0.chunk.js +0 -2
  116. package/dist/embedded-app/static/8877.58093d2c2ba0.chunk.js.map +0 -1
  117. package/dist/embedded-app/static/9050.093f683d75b8.chunk.js +0 -2
  118. package/dist/embedded-app/static/9050.093f683d75b8.chunk.js.map +0 -1
  119. package/dist/embedded-app/static/9230.1a571175884d.chunk.js +0 -2
  120. package/dist/embedded-app/static/9230.1a571175884d.chunk.js.map +0 -1
  121. package/dist/embedded-app/static/main.3b7e5948ec11.js +0 -2
  122. package/dist/embedded-app/static/main.3b7e5948ec11.js.map +0 -1
  123. package/dist/embedded-app/static/module-remix-run.0c80eb31316a.js +0 -2
  124. package/dist/embedded-app/static/module-remix-run.0c80eb31316a.js.map +0 -1
  125. package/dist/embedded-app/static/module-zod.faf74f910029.js +0 -38
  126. package/dist/embedded-app/static/module-zod.faf74f910029.js.map +0 -1
  127. package/dist/embedded-app/static/vendor.3bc2778face5.js +0 -2
  128. package/dist/embedded-app/static/vendor.3bc2778face5.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["program","version","registerCommands"],"mappings":";;;;;;AAoBA,MAAM,IAAA,GAAO,CAAC,IAAA,KAAmB;AAC/B,EAAAA,iBAAA,CAAQ,IAAA,CAAK,cAAc,CAAA,CAAE,OAAA,CAAQC,gBAAO,CAAA;AAE5C,EAAAC,sBAAA,CAAiBF,iBAAO,CAAA;AAExB,EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA;AACpB,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { program } from 'commander';\nimport { registerCommands } from './commands';\nimport { version } from '../package.json';\n\nconst main = (argv: string[]) => {\n program.name('techdocs-cli').version(version);\n\n registerCommands(program);\n\n program.parse(argv);\n};\n\nmain(process.argv);\n"],"names":["program","version","registerCommands"],"mappings":";;;;;;AAoBA,MAAM,IAAA,GAAO,CAAC,IAAA,KAAmB;AAC/B,EAAAA,iBAAA,CAAQ,IAAA,CAAK,cAAc,CAAA,CAAE,OAAA,CAAQC,gBAAO,CAAA;AAE5C,EAAAC,sBAAA,CAAiBF,iBAAO,CAAA;AAExB,EAAAA,iBAAA,CAAQ,MAAM,IAAI,CAAA;AACpB,CAAA;AAEA,IAAA,CAAK,QAAQ,IAAI,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"PublisherConfig.cjs.js","sources":["../../src/lib/PublisherConfig.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n ...(opts.awsMaxAttempts && {\n maxAttempts: Number(opts.awsMaxAttempts),\n }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: opts.osCredentialId,\n secret: opts.osSecret,\n },\n authUrl: opts.osAuthUrl,\n swiftUrl: opts.osSwiftUrl,\n },\n };\n }\n}\n"],"names":["ConfigReader"],"mappings":";;;;AA6BO,MAAM,eAAA,CAAgB;AAAA;AAAA;AAAA;AAAA,EAI3B,OAAe,eAAA,GAAkB;AAAA,IAC/B,OAAO,eAAA,CAAgB,mBAAA;AAAA,IACvB,kBAAkB,eAAA,CAAgB,mBAAA;AAAA,IAClC,WAAW,eAAA,CAAgB,uBAAA;AAAA,IAC3B,gBAAgB,eAAA,CAAgB;AAAA,GAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,eAAe,IAAA,EAAkC;AACtD,IAAA,MAAM,gBAAgB,IAAA,CAAK,aAAA;AAE3B,IAAA,IAAI,CAAC,eAAA,CAAgB,gBAAA,CAAiB,aAAa,CAAA,EAAG;AACpD,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uBAAA,EAA0B,IAAA,CAAK,aAAa,CAAA,CAAE,CAAA;AAAA,IAChE;AAEA,IAAA,OAAO,IAAIA,mBAAA,CAAa;AAAA;AAAA,MAEtB,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,uBAAA;AAAA,QACT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ACF;AACF;;;;"}
1
+ {"version":3,"file":"PublisherConfig.cjs.js","sources":["../../src/lib/PublisherConfig.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConfigReader } from '@backstage/config';\nimport { OptionValues } from 'commander';\n\ntype Publisher = keyof (typeof PublisherConfig)['configFactories'];\ntype PublisherConfiguration = {\n [p in Publisher]?: any;\n} & {\n type: Publisher;\n};\n\n/**\n * Helper when working with publisher-related configurations.\n */\nexport class PublisherConfig {\n /**\n * Maps publisher-specific config keys to config getters.\n */\n private static configFactories = {\n awsS3: PublisherConfig.getValidAwsS3Config,\n azureBlobStorage: PublisherConfig.getValidAzureConfig,\n googleGcs: PublisherConfig.getValidGoogleGcsConfig,\n openStackSwift: PublisherConfig.getValidOpenStackSwiftConfig,\n };\n\n /**\n * Returns Backstage config suitable for use when instantiating a Publisher. If\n * there are any missing or invalid options provided, an error is thrown.\n *\n * Note: This assumes that proper credentials are set in Environment\n * variables for the respective GCS/AWS clients to work.\n */\n static getValidConfig(opts: OptionValues): ConfigReader {\n const publisherType = opts.publisherType;\n\n if (!PublisherConfig.isKnownPublisher(publisherType)) {\n throw new Error(`Unknown publisher type ${opts.publisherType}`);\n }\n\n return new ConfigReader({\n // This backend config is not used at all. Just something needed a create a mock discovery instance.\n backend: {\n baseUrl: 'http://localhost:7007',\n listen: {\n port: 7007,\n },\n },\n techdocs: {\n publisher: PublisherConfig.configFactories[publisherType](opts),\n legacyUseCaseSensitiveTripletPaths:\n opts.legacyUseCaseSensitiveTripletPaths,\n },\n });\n }\n\n /**\n * Typeguard to ensure the publisher has a known config getter.\n */\n private static isKnownPublisher(\n type: string,\n ): type is keyof (typeof PublisherConfig)['configFactories'] {\n return PublisherConfig.configFactories.hasOwnProperty(type);\n }\n\n /**\n * Retrieve valid AWS S3 configuration based on the command.\n */\n private static getValidAwsS3Config(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'awsS3',\n awsS3: {\n bucketName: opts.storageName,\n ...(opts.awsBucketRootPath && {\n bucketRootPath: opts.awsBucketRootPath,\n }),\n ...(opts.awsRoleArn && { credentials: { roleArn: opts.awsRoleArn } }),\n ...(opts.awsEndpoint && { endpoint: opts.awsEndpoint }),\n ...(opts.awsS3ForcePathStyle && { s3ForcePathStyle: true }),\n ...(opts.awsS3sse && { sse: opts.awsS3sse }),\n ...(opts.awsProxy && { httpsProxy: opts.awsProxy }),\n ...(opts.awsMaxAttempts && {\n maxAttempts: Number(opts.awsMaxAttempts),\n }),\n },\n };\n }\n\n /**\n * Retrieve valid Azure Blob Storage configuration based on the command.\n */\n private static getValidAzureConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n if (!opts.azureAccountName) {\n throw new Error(\n `azureBlobStorage requires --azureAccountName to be specified`,\n );\n }\n\n return {\n type: 'azureBlobStorage',\n azureBlobStorage: {\n containerName: opts.storageName,\n credentials: {\n accountName: opts.azureAccountName,\n accountKey: opts.azureAccountKey,\n },\n },\n };\n }\n\n /**\n * Retrieve valid GCS configuration based on the command.\n */\n private static getValidGoogleGcsConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n return {\n type: 'googleGcs',\n googleGcs: {\n bucketName: opts.storageName,\n ...(opts.gcsBucketRootPath && {\n bucketRootPath: opts.gcsBucketRootPath,\n }),\n },\n };\n }\n\n /**\n * Retrieves valid OpenStack Swift configuration based on the command.\n */\n private static getValidOpenStackSwiftConfig(\n opts: OptionValues,\n ): PublisherConfiguration {\n const missingParams = [\n 'osCredentialId',\n 'osSecret',\n 'osAuthUrl',\n 'osSwiftUrl',\n ].filter((param: string) => !opts[param]);\n\n if (missingParams.length) {\n throw new Error(\n `openStackSwift requires the following params to be specified: ${missingParams.join(\n ', ',\n )}`,\n );\n }\n\n return {\n type: 'openStackSwift',\n openStackSwift: {\n containerName: opts.storageName,\n credentials: {\n id: opts.osCredentialId,\n secret: opts.osSecret,\n },\n authUrl: opts.osAuthUrl,\n swiftUrl: opts.osSwiftUrl,\n },\n };\n }\n}\n"],"names":["ConfigReader"],"mappings":";;;;AA6BO,MAAM,eAAA,CAAgB;AAAA;AAAA;AAAA;AAAA,EAI3B,OAAe,eAAA,GAAkB;AAAA,IAC/B,OAAO,eAAA,CAAgB,mBAAA;AAAA,IACvB,kBAAkB,eAAA,CAAgB,mBAAA;AAAA,IAClC,WAAW,eAAA,CAAgB,uBAAA;AAAA,IAC3B,gBAAgB,eAAA,CAAgB;AAAA,GAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,OAAO,eAAe,IAAA,EAAkC;AACtD,IAAA,MAAM,gBAAgB,IAAA,CAAK,aAAA;AAE3B,IAAA,IAAI,CAAC,eAAA,CAAgB,gBAAA,CAAiB,aAAa,CAAA,EAAG;AACpD,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,uBAAA,EAA0B,IAAA,CAAK,aAAa,CAAA,CAAE,CAAA;AAAA,IAChE;AAEA,IAAA,OAAO,IAAIA,mBAAA,CAAa;AAAA;AAAA,MAEtB,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,uBAAA;AAAA,QACT,MAAA,EAAQ;AAAA,UACN,IAAA,EAAM;AAAA;AACR,OACF;AAAA,MACA,QAAA,EAAU;AAAA,QACR,SAAA,EAAW,eAAA,CAAgB,eAAA,CAAgB,aAAa,EAAE,IAAI,CAAA;AAAA,QAC9D,oCACE,IAAA,CAAK;AAAA;AACT,KACD,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,OAAe,iBACb,IAAA,EAC2D;AAC3D,IAAA,OAAO,eAAA,CA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AAAA;AAAA;AAAA;AAAA,EAKA,OAAe,wBACb,IAAA,EACwB;AACxB,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,WAAA;AAAA,MACN,SAAA,EAAW;AAAA,QACT,YAAY,IAAA,CAAK,WAAA;AAAA,QACjB,GAAI,KAAK,iBAAA,IAAqB;AAAA,UAC5B,gBAAgB,IAAA,CAAK;AAAA;AACvB;AACF,KACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAe,6BACb,IAAA,EACwB;AACxB,IAAA,MAAM,aAAA,GAAgB;AAAA,MACpB,gBAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,MACA,MAAA,CAAO,CAAC,UAAkB,CAAC,IAAA,CAAK,KAAK,CAAC,CAAA;AAExC,IAAA,IAAI,cAAc,MAAA,EAAQ;AACxB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,iEAAiE,aAAA,CAAc,IAAA;AAAA,UAC7E;AAAA,SACD,CAAA;AAAA,OACH;AAAA,IACF;AAEA,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,gBAAA;AAAA,MACN,cAAA,EAAgB;AAAA,QACd,eAAe,IAAA,CAAK,WAAA;AAAA,QACpB,WAAA,EAAa;AAAA,UACX,IAAI,IAAA,CAAK,cAAA;AAAA,UACT,QAAQ,IAAA,CAAK;AAAA,SACf;AAAA,QACA,SAAS,IAAA,CAAK,SAAA;AAAA,QACd,UAAU,IAAA,CAAK;AAAA;AACjB,KACF;AAAA,EACF;AACF;;"}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ var node_crypto = require('node:crypto');
4
+ var promises = require('node:fs/promises');
5
+ var path = require('node:path');
6
+
7
+ function toPosixPath(filePath) {
8
+ return filePath.split(path.sep).join(path.posix.sep);
9
+ }
10
+ async function listFiles(dir, base) {
11
+ const entries = await promises.readdir(dir, { withFileTypes: true });
12
+ const files = [];
13
+ for (const entry of entries) {
14
+ const fullPath = path.join(dir, entry.name);
15
+ if (entry.isDirectory()) {
16
+ files.push(...await listFiles(fullPath, base));
17
+ } else if (entry.isFile()) {
18
+ files.push(toPosixPath(path.relative(base, fullPath)));
19
+ }
20
+ }
21
+ return files;
22
+ }
23
+ async function computeDirectoryEtag(directory, options = {}) {
24
+ const excludedFiles = new Set(options.exclude ?? []);
25
+ const files = (await listFiles(directory, directory)).filter(
26
+ (file) => !excludedFiles.has(file)
27
+ );
28
+ files.sort();
29
+ const combinedHash = node_crypto.createHash("sha256");
30
+ for (const file of files) {
31
+ const content = await promises.readFile(path.join(directory, file));
32
+ const fileHash = node_crypto.createHash("sha256").update(content).digest("hex");
33
+ combinedHash.update(`${fileHash} ${file}
34
+ `);
35
+ }
36
+ return combinedHash.digest("hex");
37
+ }
38
+
39
+ exports.computeDirectoryEtag = computeDirectoryEtag;
40
+ //# sourceMappingURL=etag.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etag.cjs.js","sources":["../../src/lib/etag.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createHash } from 'node:crypto';\nimport { readFile, readdir } from 'node:fs/promises';\nimport { join, posix, relative, sep } from 'node:path';\n\ntype ComputeDirectoryEtagOptions = {\n exclude?: string[];\n};\n\nfunction toPosixPath(filePath: string): string {\n return filePath.split(sep).join(posix.sep);\n}\n\n/**\n * Recursively list all files under a directory, returning paths relative to it.\n */\nasync function listFiles(dir: string, base: string): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n if (entry.isDirectory()) {\n files.push(...(await listFiles(fullPath, base)));\n } else if (entry.isFile()) {\n files.push(toPosixPath(relative(base, fullPath)));\n }\n }\n\n return files;\n}\n\n/**\n * Compute a deterministic sha256 etag for a directory by hashing all file\n * contents. Files are sorted by their relative path so the result is stable\n * regardless of filesystem enumeration order.\n *\n * This mirrors the approach used in CI pipelines:\n * find . -type f | sort | xargs sha256sum | sha256sum\n */\nexport async function computeDirectoryEtag(\n directory: string,\n options: ComputeDirectoryEtagOptions = {},\n): Promise<string> {\n const excludedFiles = new Set(options.exclude ?? []);\n const files = (await listFiles(directory, directory)).filter(\n file => !excludedFiles.has(file),\n );\n files.sort();\n\n const combinedHash = createHash('sha256');\n\n for (const file of files) {\n const content = await readFile(join(directory, file));\n const fileHash = createHash('sha256').update(content).digest('hex');\n combinedHash.update(`${fileHash} ${file}\\n`);\n }\n\n return combinedHash.digest('hex');\n}\n"],"names":["sep","posix","readdir","join","relative","createHash","readFile"],"mappings":";;;;;;AAwBA,SAAS,YAAY,QAAA,EAA0B;AAC7C,EAAA,OAAO,SAAS,KAAA,CAAMA,QAAG,CAAA,CAAE,IAAA,CAAKC,WAAM,GAAG,CAAA;AAC3C;AAKA,eAAe,SAAA,CAAU,KAAa,IAAA,EAAiC;AACrE,EAAA,MAAM,UAAU,MAAMC,gBAAA,CAAQ,KAAK,EAAE,aAAA,EAAe,MAAM,CAAA;AAC1D,EAAA,MAAM,QAAkB,EAAC;AAEzB,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,MAAM,QAAA,GAAWC,SAAA,CAAK,GAAA,EAAK,KAAA,CAAM,IAAI,CAAA;AACrC,IAAA,IAAI,KAAA,CAAM,aAAY,EAAG;AACvB,MAAA,KAAA,CAAM,KAAK,GAAI,MAAM,SAAA,CAAU,QAAA,EAAU,IAAI,CAAE,CAAA;AAAA,IACjD,CAAA,MAAA,IAAW,KAAA,CAAM,MAAA,EAAO,EAAG;AACzB,MAAA,KAAA,CAAM,KAAK,WAAA,CAAYC,aAAA,CAAS,IAAA,EAAM,QAAQ,CAAC,CAAC,CAAA;AAAA,IAClD;AAAA,EACF;AAEA,EAAA,OAAO,KAAA;AACT;AAUA,eAAsB,oBAAA,CACpB,SAAA,EACA,OAAA,GAAuC,EAAC,EACvB;AACjB,EAAA,MAAM,gBAAgB,IAAI,GAAA,CAAI,OAAA,CAAQ,OAAA,IAAW,EAAE,CAAA;AACnD,EAAA,MAAM,KAAA,GAAA,CAAS,MAAM,SAAA,CAAU,SAAA,EAAW,SAAS,CAAA,EAAG,MAAA;AAAA,IACpD,CAAA,IAAA,KAAQ,CAAC,aAAA,CAAc,GAAA,CAAI,IAAI;AAAA,GACjC;AACA,EAAA,KAAA,CAAM,IAAA,EAAK;AAEX,EAAA,MAAM,YAAA,GAAeC,uBAAW,QAAQ,CAAA;AAExC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,UAAU,MAAMC,iBAAA,CAASH,SAAA,CAAK,SAAA,EAAW,IAAI,CAAC,CAAA;AACpD,IAAA,MAAM,QAAA,GAAWE,uBAAW,QAAQ,CAAA,CAAE,OAAO,OAAO,CAAA,CAAE,OAAO,KAAK,CAAA;AAClE,IAAA,YAAA,CAAa,MAAA,CAAO,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,IAAI;AAAA,CAAI,CAAA;AAAA,EAC9C;AAEA,EAAA,OAAO,YAAA,CAAa,OAAO,KAAK,CAAA;AAClC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"httpServer.cjs.js","sources":["../../src/lib/httpServer.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport serveHandler from 'serve-handler';\nimport http from 'node:http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\nimport {\n proxyHtmlWithLivereloadInjection,\n proxyMkdocsLivereload,\n} from './livereload';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n // This endpoint is used by the frontend to issue a cookie for the user.\n // But the MkDocs server doesn't expose it as a the Backstage backend does.\n // So we need to fake it here to prevent 404 errors.\n if (request.url === '/api/techdocs/.backstage/auth/v1/cookie') {\n const oneHourInMilliseconds = 60 * 60 * 1000;\n const expiresAt = new Date(Date.now() + oneHourInMilliseconds);\n const cookie = { expiresAt: expiresAt.toISOString() };\n response.setHeader('Content-Type', 'application/json');\n response.end(JSON.stringify(cookie));\n return;\n }\n\n if (request.url?.startsWith(this.proxyEndpoint)) {\n // Handle HTML files with livereload parameter injection\n if (request.url?.endsWith('.html')) {\n proxyHtmlWithLivereloadInjection({\n request,\n response,\n mkdocsTargetAddress: this.mkdocsTargetAddress,\n proxyEndpoint: this.proxyEndpoint,\n onError: (error: Error) => reject(error),\n });\n return;\n }\n\n // Handle non-HTML files with regular proxy\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n // This endpoint is used by the frontend to pass livereload requests to the mkdocs server.\n if (request.url?.startsWith('/.livereload')) {\n proxyMkdocsLivereload({\n request,\n response,\n mkdocsTargetAddress: this.mkdocsTargetAddress,\n onError: (error: Error) => reject(error),\n });\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n"],"names":["httpProxy","http","proxyHtmlWithLivereloadInjection","proxyMkdocsLivereload","serveHandler","createLogger"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAqB,UAAA,CAAW;AAAA,EACb,aAAA;AAAA,EACA,kBAAA;AAAA,EACA,aAAA;AAAA,EACA,mBAAA;AAAA,EACA,OAAA;AAAA,EAEjB,WAAA,CACE,kBAAA,EACA,aAAA,EACA,mBAAA,EACA,OAAA,EACA;AACA,IAAA,IAAA,CAAK,aAAA,GAAgB,gBAAA;AACrB,IAA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AA,cAC1B,OAAA,EAAS,CAAC,KAAA,KAAiB,MAAA,CAAO,KAAK;AAAA,aACxC,CAAA;AACD,YAAA;AAAA,UACF;AAEA,UAAAC,6BAAA,CAAa,SAAS,QAAA,EAAU;AAAA,YAC9B,QAAQ,IAAA,CAAK,kBAAA;AAAA,YACb,aAAA,EAAe,IAAA;AAAA,YACf,UAAU,CAAC,EAAE,QAAQ,IAAA,EAAM,WAAA,EAAa,cAAc;AAAA,WACvD,CAAA;AAAA,QACH;AAAA,OACF;AAEA,MAAA,MAAM,MAAA,GAASC,oBAAA,CAAa,EAAE,OAAA,EAAS,OAAO,CAAA;AAC9C,MAAA,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,aAAA,EAAe,MAAM;AACtC,QAAA,IAAI,KAAK,OAAA,EAAS;AAChB,UAAA,MAAA,CAAO,IAAA;AAAA,YACL,CAAA,iFAAA,EAAoF,KAAK,aAAa,CAAA;AAAA,WACxG;AAAA,QACF;AACA,QAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,MAChB,CAAC,CAAA;AAED,MAAA,MAAA,CAAO,EAAA,CAAG,OAAA,EAAS,CAAC,KAAA,KAAiB;AACnC,QAAA,MAAA,CAAO,KAAK,CAAA;AAAA,MACd,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH;AACF;;;;"}
1
+ {"version":3,"file":"httpServer.cjs.js","sources":["../../src/lib/httpServer.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport serveHandler from 'serve-handler';\nimport http from 'node:http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\nimport {\n proxyHtmlWithLivereloadInjection,\n proxyMkdocsLivereload,\n} from './livereload';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n // This endpoint is used by the frontend to issue a cookie for the user.\n // But the MkDocs server doesn't expose it as a the Backstage backend does.\n // So we need to fake it here to prevent 404 errors.\n if (request.url === '/api/techdocs/.backstage/auth/v1/cookie') {\n const oneHourInMilliseconds = 60 * 60 * 1000;\n const expiresAt = new Date(Date.now() + oneHourInMilliseconds);\n const cookie = { expiresAt: expiresAt.toISOString() };\n response.setHeader('Content-Type', 'application/json');\n response.end(JSON.stringify(cookie));\n return;\n }\n\n if (request.url?.startsWith(this.proxyEndpoint)) {\n // Handle HTML files with livereload parameter injection\n if (request.url?.endsWith('.html')) {\n proxyHtmlWithLivereloadInjection({\n request,\n response,\n mkdocsTargetAddress: this.mkdocsTargetAddress,\n proxyEndpoint: this.proxyEndpoint,\n onError: (error: Error) => reject(error),\n });\n return;\n }\n\n // Handle non-HTML files with regular proxy\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n // This endpoint is used by the frontend to pass livereload requests to the mkdocs server.\n if (request.url?.startsWith('/.livereload')) {\n proxyMkdocsLivereload({\n request,\n response,\n mkdocsTargetAddress: this.mkdocsTargetAddress,\n onError: (error: Error) => reject(error),\n });\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n"],"names":["httpProxy","http","proxyHtmlWithLivereloadInjection","proxyMkdocsLivereload","serveHandler","createLogger"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAqB,UAAA,CAAW;AAAA,EACb,aAAA;AAAA,EACA,kBAAA;AAAA,EACA,aAAA;AAAA,EACA,mBAAA;AAAA,EACA,OAAA;AAAA,EAEjB,WAAA,CACE,kBAAA,EACA,aAAA,EACA,mBAAA,EACA,OAAA,EACA;AACA,IAAA,IAAA,CAAK,aAAA,GAAgB,gBAAA;AACrB,IAAA,IAAA,CAAK,kBAAA,GAAqB,kBAAA;AAC1B,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AACrB,IAAA,IAAA,CAAK,mBAA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AC,6BAAA,CAAa,SAAS,QAAA,EAAU;AAAA,YAC9B,QAAQ,IAAA,CAAK,kBAAA;AAAA,YACb,aAAA,EAAe,IAAA;AAAA,YACf,UAAU,CAAC,EAAE,QAAQ,IAAA,EAAM,WAAA,EAAa,cAAc;AAAA,WACvD,CAAA;AAAA,QACH;AAAA,OACF;AAEA,MAAA,MAAM,MAAA,GAASC,oBAAA,CAAa,EAAE,OAAA,EAAS,OAAO,CAAA;AAC9C,MAAA,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,aAAA,EAAe,MAAM;AACtC,QAAA,IAAI,KAAK,OAAA,EAAS;AAChB,UAAA,MAAA,CAAO,IAAA;AAAA,YACL,CAAA,iFAAA,EAAoF,KAAK,aAAa,CAAA;AAAA,WACxG;AAAA,QACF;AACA,QAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,MAChB,CAAC,CAAA;AAED,MAAA,MAAA,CAAO,EAAA,CAAG,OAAA,EAAS,CAAC,KAAA,KAAiB;AACnC,QAAA,MAAA,CAAO,KAAK,CAAA;AAAA,MACd,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"livereload.cjs.js","sources":["../../src/lib/livereload.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport http from 'node:http';\nimport httpProxy from 'http-proxy';\n\n/**\n * Livereload support for techdocs-cli.\n *\n * Context:\n * - MkDocs implements autoreload using a long-poll endpoint `/livereload` and a script that injects\n * a call like: `livereload(epoch, request_id)`, where `epoch` is derived from Python's\n * `time.monotonic()`.\n * - Node.js monotonic clocks (`process.hrtime`/`performance.now`) are not compatible with Python's\n * value across processes and platforms. We therefore CANNOT reliably re-create the same epoch on\n * the frontend or in this CLI, and must read the values produced by MkDocs itself.\n * - The MkDocs script tag is removed by DOM sanitization (DomPurify) in TechDocs, so we can't rely\n * on the script being present in the embedded app. To bridge this, we extract the parameters on\n * the server side while proxying HTML and inject them as a safe custom element that survives\n * sanitization: `<live-reload live-reload-epoch=\"…\" live-reload-request-id=\"…\"/>`.\n * - The frontend addon reads that element and polls `/.livereload` (served by techdocs-cli), which\n * this module maps to MkDocs `/livereload` with permissive CORS headers.\n * - Quality-of-life: if extraction fails or the endpoint is unavailable, normal docs still work.\n *\n * See issue for background and rationale: https://github.com/backstage/backstage/issues/30514\n */\n\nconst LIVE_RELOAD_ELEMENT = 'live-reload';\nconst LIVE_RELOAD_ATTR_EPOCH = 'live-reload-epoch';\nconst LIVE_RELOAD_ATTR_REQUEST_ID = 'live-reload-request-id';\nconst CLI_LIVERELOAD_PATH = '/.livereload';\nconst MKDOCS_LIVERELOAD_PATH = '/livereload';\nconst CONTENT_TYPE_HTML = 'text/html';\nconst HEADER_CONTENT_LENGTH = 'content-length';\n\nconst BODY_START_RE = /<body\\b[^>]*>/;\n// Matches mkdocs injected call livereload(epoch, requestId)\nconst MKDOCS_LIVERELOAD_CALL_RE = /livereload\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*;?/;\n\n/**\n * Extract livereload parameters from mkdocs HTML and inject them as a custom element.\n * The injected element will later be read by the frontend addon even after DOM sanitization.\n *\n * Note:\n * - we don't add to <head> because of DomPurify sanitization.\n * - we add close to the body opening to avoid reading too far into the body.\n * - we should use streamed injection to improve performance.\n */\nexport function injectLivereloadParameters(html: string): string {\n const livereloadMatch = html.match(MKDOCS_LIVERELOAD_CALL_RE);\n\n // If we couldn't find livereload parameters, return original HTML untouched.\n if (!livereloadMatch) {\n return html;\n }\n\n const [, epoch, requestId] = livereloadMatch;\n // Insert a minimal custom element that the frontend addon can discover post-sanitization.\n // Note: embedded app needs a custom config to allow the element to survive sanitization.\n const liveReloadTag = `<${LIVE_RELOAD_ELEMENT} ${LIVE_RELOAD_ATTR_EPOCH}=\"${epoch}\" ${LIVE_RELOAD_ATTR_REQUEST_ID}=\"${requestId}\"></${LIVE_RELOAD_ELEMENT}>`;\n\n // Naively find where to insert the livereload tag.\n const bodyStart = html.match(BODY_START_RE);\n const bodyStartIndex = bodyStart?.index ?? 0;\n const bodyStartLength = bodyStart?.[0]?.length ?? 0;\n if (bodyStartIndex === 0 || bodyStartLength === 0) {\n return html;\n }\n const bodyEndIndex = bodyStartIndex + bodyStartLength;\n\n return html.slice(0, bodyEndIndex) + liveReloadTag + html.slice(bodyEndIndex);\n}\n\nfunction setCorsHeaders(response: http.ServerResponse) {\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n}\n\n/**\n * Proxies a mkdocs HTML response, injecting livereload parameters into the HTML body.\n */\nexport function proxyHtmlWithLivereloadInjection(options: {\n request: http.IncomingMessage;\n response: http.ServerResponse;\n mkdocsTargetAddress: string;\n proxyEndpoint: string;\n onError: (error: Error) => void;\n}): void {\n const { request, response, mkdocsTargetAddress, proxyEndpoint, onError } =\n options;\n\n const htmlProxy = httpProxy.createProxyServer({\n target: mkdocsTargetAddress,\n selfHandleResponse: true,\n });\n\n htmlProxy.on('error', onError);\n\n // Intercept HTML responses to inject `<live-reload …>`\n htmlProxy.on('proxyRes', (proxyRes, _req, res) => {\n const contentType = proxyRes.headers['content-type'];\n const contentEncoding = proxyRes.headers['content-encoding'];\n const isHtml =\n contentType &&\n typeof contentType === 'string' &&\n contentType.startsWith(CONTENT_TYPE_HTML);\n if (isHtml && !contentEncoding) {\n const chunks: Buffer[] = [];\n proxyRes.on('data', (chunk: Buffer | string) => {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n });\n proxyRes.on('end', () => {\n const body = Buffer.concat(chunks).toString('utf8');\n const modifiedHtml = injectLivereloadParameters(body);\n res.statusCode = (proxyRes.statusCode as number | undefined) ?? 200;\n Object.keys(proxyRes.headers).forEach(key => {\n if (key.toLowerCase() !== HEADER_CONTENT_LENGTH) {\n res.setHeader(key, proxyRes.headers[key]!);\n }\n });\n setCorsHeaders(res);\n res.end(modifiedHtml);\n });\n } else {\n res.statusCode = (proxyRes.statusCode as number | undefined) ?? 200;\n Object.keys(proxyRes.headers).forEach(key => {\n res.setHeader(key, proxyRes.headers[key]!);\n });\n setCorsHeaders(res);\n proxyRes.pipe(res);\n }\n });\n\n const forwardPath =\n request.url?.replace(new RegExp(`^${proxyEndpoint}`, 'i'), '') || '';\n request.url = forwardPath;\n htmlProxy.web(request, response);\n}\n\n/**\n * Proxies mkdocs livereload long-polling requests, mapping the CLI path to mkdocs path.\n */\nexport function proxyMkdocsLivereload(options: {\n request: http.IncomingMessage;\n response: http.ServerResponse;\n mkdocsTargetAddress: string;\n onError: (error: Error) => void;\n}): void {\n const { request, response, mkdocsTargetAddress, onError } = options;\n\n const proxy = httpProxy.createProxyServer({ target: mkdocsTargetAddress });\n proxy.on('error', onError);\n\n setCorsHeaders(response);\n response.setHeader('Access-Control-Allow-Headers', 'Content-Type');\n\n request.url = request.url?.replace(\n CLI_LIVERELOAD_PATH,\n MKDOCS_LIVERELOAD_PATH,\n );\n proxy.web(request, response);\n}\n"],"names":["httpProxy"],"mappings":";;;;;;;;AAwCA,MAAM,mBAAA,GAAsB,aAAA;AAC5B,MAAM,sBAAA,GAAyB,mBAAA;AAC/B,MAAM,2BAAA,GAA8B,wBAAA;AACpC,MAAM,mBAAA,GAAsB,cAAA;AAC5B,MAAM,sBAAA,GAAyB,aAAA;AAC/B,MAAM,iBAAA,GAAoB,WAAA;AAC1B,MAAM,qBAAA,GAAwB,gBAAA;AAE9B,MAAM,aAAA,GAAgB,eAAA;AAEtB,MAAM,yBAAA,GAA4B,4CAAA;AAW3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OAAA;AAAA,IACzB,mBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,KAAA,CAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAC7B;;;;;;"}
1
+ {"version":3,"file":"livereload.cjs.js","sources":["../../src/lib/livereload.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport http from 'node:http';\nimport httpProxy from 'http-proxy';\n\n/**\n * Livereload support for techdocs-cli.\n *\n * Context:\n * - MkDocs implements autoreload using a long-poll endpoint `/livereload` and a script that injects\n * a call like: `livereload(epoch, request_id)`, where `epoch` is derived from Python's\n * `time.monotonic()`.\n * - Node.js monotonic clocks (`process.hrtime`/`performance.now`) are not compatible with Python's\n * value across processes and platforms. We therefore CANNOT reliably re-create the same epoch on\n * the frontend or in this CLI, and must read the values produced by MkDocs itself.\n * - The MkDocs script tag is removed by DOM sanitization (DomPurify) in TechDocs, so we can't rely\n * on the script being present in the embedded app. To bridge this, we extract the parameters on\n * the server side while proxying HTML and inject them as a safe custom element that survives\n * sanitization: `<live-reload live-reload-epoch=\"…\" live-reload-request-id=\"…\"/>`.\n * - The frontend addon reads that element and polls `/.livereload` (served by techdocs-cli), which\n * this module maps to MkDocs `/livereload` with permissive CORS headers.\n * - Quality-of-life: if extraction fails or the endpoint is unavailable, normal docs still work.\n *\n * See issue for background and rationale: https://github.com/backstage/backstage/issues/30514\n */\n\nconst LIVE_RELOAD_ELEMENT = 'live-reload';\nconst LIVE_RELOAD_ATTR_EPOCH = 'live-reload-epoch';\nconst LIVE_RELOAD_ATTR_REQUEST_ID = 'live-reload-request-id';\nconst CLI_LIVERELOAD_PATH = '/.livereload';\nconst MKDOCS_LIVERELOAD_PATH = '/livereload';\nconst CONTENT_TYPE_HTML = 'text/html';\nconst HEADER_CONTENT_LENGTH = 'content-length';\n\nconst BODY_START_RE = /<body\\b[^>]*>/;\n// Matches mkdocs injected call livereload(epoch, requestId)\nconst MKDOCS_LIVERELOAD_CALL_RE = /livereload\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*;?/;\n\n/**\n * Extract livereload parameters from mkdocs HTML and inject them as a custom element.\n * The injected element will later be read by the frontend addon even after DOM sanitization.\n *\n * Note:\n * - we don't add to <head> because of DomPurify sanitization.\n * - we add close to the body opening to avoid reading too far into the body.\n * - we should use streamed injection to improve performance.\n */\nexport function injectLivereloadParameters(html: string): string {\n const livereloadMatch = html.match(MKDOCS_LIVERELOAD_CALL_RE);\n\n // If we couldn't find livereload parameters, return original HTML untouched.\n if (!livereloadMatch) {\n return html;\n }\n\n const [, epoch, requestId] = livereloadMatch;\n // Insert a minimal custom element that the frontend addon can discover post-sanitization.\n // Note: embedded app needs a custom config to allow the element to survive sanitization.\n const liveReloadTag = `<${LIVE_RELOAD_ELEMENT} ${LIVE_RELOAD_ATTR_EPOCH}=\"${epoch}\" ${LIVE_RELOAD_ATTR_REQUEST_ID}=\"${requestId}\"></${LIVE_RELOAD_ELEMENT}>`;\n\n // Naively find where to insert the livereload tag.\n const bodyStart = html.match(BODY_START_RE);\n const bodyStartIndex = bodyStart?.index ?? 0;\n const bodyStartLength = bodyStart?.[0]?.length ?? 0;\n if (bodyStartIndex === 0 || bodyStartLength === 0) {\n return html;\n }\n const bodyEndIndex = bodyStartIndex + bodyStartLength;\n\n return html.slice(0, bodyEndIndex) + liveReloadTag + html.slice(bodyEndIndex);\n}\n\nfunction setCorsHeaders(response: http.ServerResponse) {\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n}\n\n/**\n * Proxies a mkdocs HTML response, injecting livereload parameters into the HTML body.\n */\nexport function proxyHtmlWithLivereloadInjection(options: {\n request: http.IncomingMessage;\n response: http.ServerResponse;\n mkdocsTargetAddress: string;\n proxyEndpoint: string;\n onError: (error: Error) => void;\n}): void {\n const { request, response, mkdocsTargetAddress, proxyEndpoint, onError } =\n options;\n\n const htmlProxy = httpProxy.createProxyServer({\n target: mkdocsTargetAddress,\n selfHandleResponse: true,\n });\n\n htmlProxy.on('error', onError);\n\n // Intercept HTML responses to inject `<live-reload …>`\n htmlProxy.on('proxyRes', (proxyRes, _req, res) => {\n const contentType = proxyRes.headers['content-type'];\n const contentEncoding = proxyRes.headers['content-encoding'];\n const isHtml =\n contentType &&\n typeof contentType === 'string' &&\n contentType.startsWith(CONTENT_TYPE_HTML);\n if (isHtml && !contentEncoding) {\n const chunks: Buffer[] = [];\n proxyRes.on('data', (chunk: Buffer | string) => {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n });\n proxyRes.on('end', () => {\n const body = Buffer.concat(chunks).toString('utf8');\n const modifiedHtml = injectLivereloadParameters(body);\n res.statusCode = (proxyRes.statusCode as number | undefined) ?? 200;\n Object.keys(proxyRes.headers).forEach(key => {\n if (key.toLowerCase() !== HEADER_CONTENT_LENGTH) {\n res.setHeader(key, proxyRes.headers[key]!);\n }\n });\n setCorsHeaders(res);\n res.end(modifiedHtml);\n });\n } else {\n res.statusCode = (proxyRes.statusCode as number | undefined) ?? 200;\n Object.keys(proxyRes.headers).forEach(key => {\n res.setHeader(key, proxyRes.headers[key]!);\n });\n setCorsHeaders(res);\n proxyRes.pipe(res);\n }\n });\n\n const forwardPath =\n request.url?.replace(new RegExp(`^${proxyEndpoint}`, 'i'), '') || '';\n request.url = forwardPath;\n htmlProxy.web(request, response);\n}\n\n/**\n * Proxies mkdocs livereload long-polling requests, mapping the CLI path to mkdocs path.\n */\nexport function proxyMkdocsLivereload(options: {\n request: http.IncomingMessage;\n response: http.ServerResponse;\n mkdocsTargetAddress: string;\n onError: (error: Error) => void;\n}): void {\n const { request, response, mkdocsTargetAddress, onError } = options;\n\n const proxy = httpProxy.createProxyServer({ target: mkdocsTargetAddress });\n proxy.on('error', onError);\n\n setCorsHeaders(response);\n response.setHeader('Access-Control-Allow-Headers', 'Content-Type');\n\n request.url = request.url?.replace(\n CLI_LIVERELOAD_PATH,\n MKDOCS_LIVERELOAD_PATH,\n );\n proxy.web(request, response);\n}\n"],"names":["httpProxy"],"mappings":";;;;;;;;AAwCA,MAAM,mBAAA,GAAsB,aAAA;AAC5B,MAAM,sBAAA,GAAyB,mBAAA;AAC/B,MAAM,2BAAA,GAA8B,wBAAA;AACpC,MAAM,mBAAA,GAAsB,cAAA;AAC5B,MAAM,sBAAA,GAAyB,aAAA;AAC/B,MAAM,iBAAA,GAAoB,WAAA;AAC1B,MAAM,qBAAA,GAAwB,gBAAA;AAE9B,MAAM,aAAA,GAAgB,eAAA;AAEtB,MAAM,yBAAA,GAA4B,4CAAA;AAW3B,SAAS,2BAA2B,IAAA,EAAsB;AAC/D,EAAA,MAAM,eAAA,GAAkB,IAAA,CAAK,KAAA,CAAM,yBAAyB,CAAA;AAG5D,EAAA,IAAI,CAAC,eAAA,EAAiB;AACpB,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,GAAG,KAAA,EAAO,SAAS,CAAA,GAAI,eAAA;AAG7B,EAAA,MAAM,aAAA,GAAgB,CAAA,CAAA,EAAI,mBAAmB,CAAA,CAAA,EAAI,sBAAsB,CAAA,EAAA,EAAK,KAAK,CAAA,EAAA,EAAK,2BAA2B,CAAA,EAAA,EAAK,SAAS,CAAA,IAAA,EAAO,mBAAmB,CAAA,CAAA,CAAA;AAGzJ,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,KAAA,CAAM,aAAa,CAAA;AAC1C,EAAA,MAAM,cAAA,GAAiB,WAAW,KAAA,IAAS,CAAA;AAC3C,EAAA,MAAM,eAAA,GAAkB,SAAA,GAAY,CAA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AQ,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,EAAI,GAAG,CAAA,EAAG,EAAE,CAAA,IAAK,EAAA;AACpE,EAAA,OAAA,CAAQ,GAAA,GAAM,WAAA;AACd,EAAA,SAAA,CAAU,GAAA,CAAI,SAAS,QAAQ,CAAA;AACjC;AAKO,SAAS,sBAAsB,OAAA,EAK7B;AACP,EAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,mBAAA,EAAqB,SAAQ,GAAI,OAAA;AAE5D,EAAA,MAAM,QAAQA,0BAAA,CAAU,iBAAA,CAAkB,EAAE,MAAA,EAAQ,qBAAqB,CAAA;AACzE,EAAA,KAAA,CAAM,EAAA,CAAG,SAAS,OAAO,CAAA;AAEzB,EAAA,cAAA,CAAe,QAAQ,CAAA;AACvB,EAAA,QAAA,CAAS,SAAA,CAAU,gCAAgC,cAAc,CAAA;AAEjE,EAAA,OAAA,CAAQ,GAAA,GAAM,QAAQ,GAAA,EAAK,OAAA;AAAA,IACzB,mBAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,KAAA,CAAM,GAAA,CAAI,SAAS,QAAQ,CAAA;AAC7B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mkdocsServer.cjs.js","sources":["../../src/lib/mkdocsServer.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { run, RunChildProcess, RunOnOutput } from '@backstage/cli-common';\n\nexport const runMkdocsServer = (options: {\n port?: string;\n useDocker?: boolean;\n dockerImage?: string;\n dockerEntrypoint?: string;\n dockerOptions?: string[];\n onStdout?: RunOnOutput;\n onStderr?: RunOnOutput;\n mkdocsConfigFileName?: string;\n mkdocsParameterClean?: boolean;\n mkdocsParameterDirtyReload?: boolean;\n mkdocsParameterStrict?: boolean;\n}): RunChildProcess => {\n const port = options.port ?? '8000';\n const useDocker = options.useDocker ?? true;\n const dockerImage = options.dockerImage ?? 'spotify/techdocs';\n\n if (useDocker) {\n return run(\n [\n 'docker',\n 'run',\n '--rm',\n '-w',\n '/content',\n '-v',\n `${process.cwd()}:/content`,\n '-p',\n `${port}:${port}`,\n '-it',\n ...(options.dockerEntrypoint\n ? ['--entrypoint', options.dockerEntrypoint]\n : []),\n ...(options.dockerOptions || []),\n dockerImage,\n 'serve',\n '--dev-addr',\n `0.0.0.0:${port}`,\n '--livereload',\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n },\n );\n }\n\n return run(\n [\n 'mkdocs',\n 'serve',\n '--dev-addr',\n `127.0.0.1:${port}`,\n '--livereload',\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n },\n );\n};\n"],"names":["run"],"mappings":";;;;AAkBO,MAAM,eAAA,GAAkB,CAAC,OAAA,KAYT;AACrB,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,IAAQ,MAAA;AAC7B,EAAA,MAAM,SAAA,GAAY,QAAQ,SAAA,IAAa,IAAA;AACvC,EAAA,MAAM,WAAA,GAAc,QAAQ,WA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AAI,OAAA,CAAQ,oBAAA,GAAuB,CAAC,SAAS,IAAI,EAAC;AAAA,MAClD,GAAI,OAAA,CAAQ,0BAAA,GAA6B,CAAC,eAAe,IAAI,EAAC;AAAA,MAC9D,GAAI,OAAA,CAAQ,qBAAA,GAAwB,CAAC,UAAU,IAAI;AAAC,KACtD;AAAA,IACA;AAAA,MACE,UAAU,OAAA,CAAQ,QAAA;AAAA,MAClB,UAAU,OAAA,CAAQ;AAAA;AACpB,GACF;AACF;;;;"}
1
+ {"version":3,"file":"mkdocsServer.cjs.js","sources":["../../src/lib/mkdocsServer.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { run, RunChildProcess, RunOnOutput } from '@backstage/cli-common';\n\nexport const runMkdocsServer = (options: {\n port?: string;\n useDocker?: boolean;\n dockerImage?: string;\n dockerEntrypoint?: string;\n dockerOptions?: string[];\n onStdout?: RunOnOutput;\n onStderr?: RunOnOutput;\n mkdocsConfigFileName?: string;\n mkdocsParameterClean?: boolean;\n mkdocsParameterDirtyReload?: boolean;\n mkdocsParameterStrict?: boolean;\n}): RunChildProcess => {\n const port = options.port ?? '8000';\n const useDocker = options.useDocker ?? true;\n const dockerImage = options.dockerImage ?? 'spotify/techdocs';\n\n if (useDocker) {\n return run(\n [\n 'docker',\n 'run',\n '--rm',\n '-w',\n '/content',\n '-v',\n `${process.cwd()}:/content`,\n '-p',\n `${port}:${port}`,\n '-it',\n ...(options.dockerEntrypoint\n ? ['--entrypoint', options.dockerEntrypoint]\n : []),\n ...(options.dockerOptions || []),\n dockerImage,\n 'serve',\n '--dev-addr',\n `0.0.0.0:${port}`,\n '--livereload',\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n },\n );\n }\n\n return run(\n [\n 'mkdocs',\n 'serve',\n '--dev-addr',\n `127.0.0.1:${port}`,\n '--livereload',\n ...(options.mkdocsConfigFileName\n ? ['--config-file', options.mkdocsConfigFileName]\n : []),\n ...(options.mkdocsParameterClean ? ['--clean'] : []),\n ...(options.mkdocsParameterDirtyReload ? ['--dirtyreload'] : []),\n ...(options.mkdocsParameterStrict ? ['--strict'] : []),\n ],\n {\n onStdout: options.onStdout,\n onStderr: options.onStderr,\n },\n );\n};\n"],"names":["run"],"mappings":";;;;AAkBO,MAAM,eAAA,GAAkB,CAAC,OAAA,KAYT;AACrB,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAA,IAAQ,MAAA;AAC7B,EAAA,MAAM,SAAA,GAAY,QAAQ,SAAA,IAAa,IAAA;AACvC,EAAA,MAAM,WAAA,GAAc,QAAQ,WAAA,IAAe,kBAAA;AAE3C,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,OAAOA,aAAA;AAAA,MACL;AAAA,QACE,QAAA;AAAA,QACA,KAAA;AAAA,QACA,MAAA;AAAA,QACA,IAAA;AAAA,QACA,UAAA;AAAA,QACA,IAAA;AAAA,QACA,CAAA,EAAG,OAAA,CAAQ,GAAA,EAAK,CAAA,SAAA,CAAA;AAAA,QAChB,IAAA;AAAA,QACA,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QACf,KAAA;AAAA,QACA,GAAI,QAAQ,gBAAA,GACR,CAAC,gBAAgB,OAAA,CAAQ,gBAAgB,IACzC,EAAC;AAAA,QACL,GAAI,OAAA,CAAQ,aAAA,IAAiB,EAAC;AAAA,QAC9B,WAAA;AAAA,QACA,OAAA;AAAA,QACA,YAAA;AAAA,QACA,WAAW,IAAI,CAAA,CAAA;AAAA,QACf,cAAA;AAAA,QACA,GAAI,QAAQ,oBAAA,GACR,CAAC,iBAAiB,OAAA,CAAQ,oBAAoB,IAC9C,EAAC;AAAA,QACL,GAAI,OAAA,CAAQ,oBAAA,GAAuB,CAAC,SAAS,IAAI,EAAC;AAAA,QAClD,GAAI,OAAA,CAAQ,0BAAA,GAA6B,CAAC,eAAe,IAAI,EAAC;AAAA,QAC9D,GAAI,OAAA,CAAQ,qBAAA,GAAwB,CAAC,UAAU,IAAI;AAAC,OACtD;AAAA,MACA;AAAA,QACE,UAAU,OAAA,CAAQ,QAAA;AAAA,QAClB,UAAU,OAAA,CAAQ;AAAA;AACpB,KACF;AAAA,EACF;AAEA,EAAA,OAAOA,aAAA;AAAA,IACL;AAAA,MACE,QAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAa,IAAI,CAAA,CAAA;AAAA,MACjB,cAAA;AAAA,MACA,GAAI,QAAQ,oBAAA,GACR,CAAC,iBAAiB,OAAA,CAAQ,oBAAoB,IAC9C,EAAC;AAAA,MACL,GAAI,OAAA,CAAQ,oBAAA,GAAuB,CAAC,SAAS,IAAI,EAAC;AAAA,MAClD,GAAI,OAAA,CAAQ,0BAAA,GAA6B,CAAC,eAAe,IAAI,EAAC;AAAA,MAC9D,GAAI,OAAA,CAAQ,qBAAA,GAAwB,CAAC,UAAU,IAAI;AAAC,KACtD;AAAA,IACA;AAAA,MACE,UAAU,OAAA,CAAQ,QAAA;AAAA,MAClB,UAAU,OAAA,CAAQ;AAAA;AACpB,GACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utility.cjs.js","sources":["../../src/lib/utility.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n RemoteProtocol,\n ParsedLocationAnnotation,\n} from '@backstage/plugin-techdocs-node';\nimport * as winston from 'winston';\nimport { Writable } from 'node:stream';\nimport { stdout } from 'node:process';\n\nexport const convertTechDocsRefToLocationAnnotation = (\n techdocsRef: string,\n): ParsedLocationAnnotation => {\n // Split on the first colon for the protocol and the rest after the first split\n // is the location.\n const [type, target] = techdocsRef.split(/:(.+)/) as [\n RemoteProtocol?,\n string?,\n ];\n\n if (!type || !target) {\n throw new Error(\n `Can not parse --techdocs-ref ${techdocsRef}. Should be of type HOST:URL.`,\n );\n }\n\n return { type, target };\n};\n\nexport const createLogger = ({\n verbose = false,\n}: {\n verbose: boolean;\n}): winston.Logger => {\n const logger = winston.createLogger({\n level: verbose ? 'verbose' : 'info',\n transports: [\n new winston.transports.Console({ format: winston.format.simple() }),\n ],\n });\n\n return logger;\n};\n\nexport const getLogStream = (logger: winston.Logger): Writable => {\n if (process.env.LOG_LEVEL === 'debug') {\n return stdout;\n }\n\n return new Writable({\n defaultEncoding: 'utf8',\n write(chunk, _encoding, next) {\n logger.verbose(chunk.toString().trim());\n next();\n },\n });\n};\n"],"names":["winston","stdout","Writable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,sCAAA,GAAyC,CACpD,WAAA,KAC6B;AAG7B,EAAA,MAAM,CAAC,IAAA,EAAM,MAAM,CAAA,GAAI,WAAA,CAAY,MAAM,OAAO,CAAA;AAKhD,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,MAAA,EAAQ;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,gCAAgC,WAAW,CAAA,6BAAA;AAAA,KAC7C;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,MAAM,MAAA,EAAO;AACxB;AAEO,MAAM,eAAe,CAAC;AAAA,EAC3B,OAAA,GAAU;AACZ,CAAA,KAEsB;AACpB,EAAA,MAAM,MAAA,GAASA,mBAAQ,YAAA,CAAa;AAAA,IAClC,KAAA,EAAO,UAAU,SAAA,GAAY,MAAA;AAAA,IAC7B,UAAA,EAAY;AAAA,MACV,IAAIA,kBAAA,CAAQ,UAAA,CAAW,OAAA,CAAQ,EAAE,QAAQA,kBAAA,CAAQ,MAAA,CAAO,MAAA,EAAO,EAAG;AAAA;AACpE,GACD,CAAA;AAED,EAAA,OAAO,MAAA;AACT;AAEO,MAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AAChE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,SAAA,KAAc,OAAA,EAAS;AACrC,IAAA,OAAOC,mBAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAIC,oBAAA,CAAS;AAAA,IAClB,eAAA,EAAiB,MAAA;AAAA,IACjB,KAAA,CAAM,KAAA,EAAO,SAAA,EAAW,IAAA,EAAM;AAC5B,MAAA,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,QAAA,EAAS,CAAE,MAAM,CAAA;AACtC,MAAA,IAAA,EAAK;AAAA,IACP;AAAA,GACD,CAAA;AACH;;;;;;"}
1
+ {"version":3,"file":"utility.cjs.js","sources":["../../src/lib/utility.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n RemoteProtocol,\n ParsedLocationAnnotation,\n} from '@backstage/plugin-techdocs-node';\nimport * as winston from 'winston';\nimport { Writable } from 'node:stream';\nimport { stdout } from 'node:process';\n\nexport const convertTechDocsRefToLocationAnnotation = (\n techdocsRef: string,\n): ParsedLocationAnnotation => {\n // Split on the first colon for the protocol and the rest after the first split\n // is the location.\n const [type, target] = techdocsRef.split(/:(.+)/) as [\n RemoteProtocol?,\n string?,\n ];\n\n if (!type || !target) {\n throw new Error(\n `Can not parse --techdocs-ref ${techdocsRef}. Should be of type HOST:URL.`,\n );\n }\n\n return { type, target };\n};\n\nexport const createLogger = ({\n verbose = false,\n}: {\n verbose: boolean;\n}): winston.Logger => {\n const logger = winston.createLogger({\n level: verbose ? 'verbose' : 'info',\n transports: [\n new winston.transports.Console({ format: winston.format.simple() }),\n ],\n });\n\n return logger;\n};\n\nexport const getLogStream = (logger: winston.Logger): Writable => {\n if (process.env.LOG_LEVEL === 'debug') {\n return stdout;\n }\n\n return new Writable({\n defaultEncoding: 'utf8',\n write(chunk, _encoding, next) {\n logger.verbose(chunk.toString().trim());\n next();\n },\n });\n};\n"],"names":["winston","stdout","Writable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,sCAAA,GAAyC,CACpD,WAAA,KAC6B;AAG7B,EAAA,MAAM,CAAC,IAAA,EAAM,MAAM,CAAA,GAAI,WAAA,CAAY,MAAM,OAAO,CAAA;AAKhD,EAAA,IAAI,CAAC,IAAA,IAAQ,CAAC,MAAA,EAAQ;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,gCAAgC,WAAW,CAAA,6BAAA;AAAA,KAC7C;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,MAAM,MAAA,EAAO;AACxB;AAEO,MAAM,eAAe,CAAC;AAAA,EAC3B,OAAA,GAAU;AACZ,CAAA,KAEsB;AACpB,EAAA,MAAM,MAAA,GAASA,mBAAQ,YAAA,CAAa;AAAA,IAClC,KAAA,EAAO,UAAU,SAAA,GAAY,MAAA;AAAA,IAC7B,UAAA,EAAY;AAAA,MACV,IAAIA,kBAAA,CAAQ,UAAA,CAAW,OAAA,CAAQ,EAAE,QAAQA,kBAAA,CAAQ,MAAA,CAAO,MAAA,EAAO,EAAG;AAAA;AACpE,GACD,CAAA;AAED,EAAA,OAAO,MAAA;AACT;AAEO,MAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AAChE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,SAAA,KAAc,OAAA,EAAS;AACrC,IAAA,OAAOC,mBAAA;AAAA,EACT;AAEA,EAAA,OAAO,IAAIC,oBAAA,CAAS;AAAA,IAClB,eAAA,EAAiB,MAAA;AAAA,IACjB,KAAA,CAAM,KAAA,EAAO,SAAA,EAAW,IAAA,EAAM;AAC5B,MAAA,MAAA,CAAO,OAAA,CAAQ,KAAA,CAAM,QAAA,EAAS,CAAE,MAAM,CAAA;AACtC,MAAA,IAAA,EAAK;AAAA,IACP;AAAA,GACD,CAAA;AACH;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "1.11.5-next.2";
3
+ var version = "1.12.1-next.0";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"package.json.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techdocs/cli",
3
- "version": "1.11.5-next.2",
3
+ "version": "1.12.1-next.0",
4
4
  "description": "Utility CLI for managing TechDocs sites in Backstage.",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -44,20 +44,21 @@
44
44
  "watch": "./src"
45
45
  },
46
46
  "dependencies": {
47
- "@backstage/backend-defaults": "0.17.9-next.1",
48
- "@backstage/catalog-model": "1.10.0",
49
- "@backstage/cli-common": "0.3.0",
50
- "@backstage/config": "1.3.9-next.0",
51
- "@backstage/plugin-techdocs-node": "1.16.0-next.1",
47
+ "@backstage/backend-defaults": "0.18.1-next.0",
48
+ "@backstage/catalog-model": "1.10.2-next.0",
49
+ "@backstage/cli-common": "0.3.2-next.0",
50
+ "@backstage/config": "1.3.10-next.0",
51
+ "@backstage/plugin-techdocs-node": "2.0.1-next.0",
52
52
  "commander": "^14.0.3",
53
53
  "fs-extra": "^11.0.0",
54
54
  "http-proxy": "^1.18.1",
55
+ "json5": "^2.1.3",
55
56
  "react-dev-utils": "^12.0.0-next.60",
56
57
  "serve-handler": "^6.1.3",
57
58
  "winston": "^3.2.1"
58
59
  },
59
60
  "devDependencies": {
60
- "@backstage/cli": "0.36.6-next.1",
61
+ "@backstage/cli": "0.36.7-next.0",
61
62
  "@types/fs-extra": "^11.0.0",
62
63
  "@types/http-proxy": "^1.17.4",
63
64
  "@types/node": "^22.13.14",
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["123"],{79894(a){a.exports=JSON.parse('{"name":"@backstage/plugin-catalog","version":"2.0.9-next.2","description":"The Backstage plugin for browsing the Backstage catalog","backstage":{"role":"frontend-plugin","pluginId":"catalog","pluginPackages":["@backstage/plugin-catalog","@backstage/plugin-catalog-backend","@backstage/plugin-catalog-common","@backstage/plugin-catalog-node","@backstage/plugin-catalog-react"]},"publishConfig":{"access":"public"},"keywords":["backstage"],"homepage":"https://backstage.io","repository":{"type":"git","url":"https://github.com/backstage/backstage","directory":"plugins/catalog"},"license":"Apache-2.0","sideEffects":false,"exports":{".":"./src/index.ts","./alpha":"./src/alpha/index.ts","./package.json":"./package.json"},"main":"src/index.ts","types":"src/index.ts","typesVersions":{"*":{"alpha":["src/alpha/index.ts"],"package.json":["package.json"]}},"files":["dist","config.d.ts"],"scripts":{"build":"backstage-cli package build","clean":"backstage-cli package clean","lint":"backstage-cli package lint","prepack":"backstage-cli package prepack","postpack":"backstage-cli package postpack","start":"backstage-cli package start","test":"backstage-cli package test"},"dependencies":{"@backstage/catalog-client":"workspace:^","@backstage/catalog-model":"workspace:^","@backstage/core-compat-api":"workspace:^","@backstage/core-components":"workspace:^","@backstage/core-plugin-api":"workspace:^","@backstage/errors":"workspace:^","@backstage/frontend-plugin-api":"workspace:^","@backstage/integration-react":"workspace:^","@backstage/plugin-catalog-common":"workspace:^","@backstage/plugin-catalog-react":"workspace:^","@backstage/plugin-permission-react":"workspace:^","@backstage/plugin-scaffolder-common":"workspace:^","@backstage/plugin-search-common":"workspace:^","@backstage/plugin-search-react":"workspace:^","@backstage/plugin-techdocs-common":"workspace:^","@backstage/plugin-techdocs-react":"workspace:^","@backstage/types":"workspace:^","@backstage/ui":"workspace:^","@backstage/version-bridge":"workspace:^","@material-ui/core":"^4.12.2","@material-ui/icons":"^4.9.1","@material-ui/lab":"4.0.0-alpha.61","@mui/utils":"^5.14.15","@remixicon/react":"^4.6.0","classnames":"^2.3.1","csv-stringify":"^5.6.5","dataloader":"^2.0.0","lodash":"^4.17.21","pluralize":"^8.0.0","react-helmet":"6.1.0","react-use":"^17.2.4","zen-observable":"^0.10.0","zod":"^4.0.0"},"devDependencies":{"@backstage/cli":"workspace:^","@backstage/core-app-api":"workspace:^","@backstage/dev-utils":"workspace:^","@backstage/frontend-test-utils":"workspace:^","@backstage/plugin-permission-common":"workspace:^","@backstage/test-utils":"workspace:^","@testing-library/dom":"^10.0.0","@testing-library/jest-dom":"^6.0.0","@testing-library/react":"^16.0.0","@testing-library/user-event":"^14.0.0","@types/pluralize":"^0.0.33","@types/react":"^18.0.0","react":"^18.0.2","react-dom":"^18.0.2","react-router-dom":"^6.30.2","swr":"^2.2.5"},"peerDependencies":{"@types/react":"^17.0.0 || ^18.0.0","react":"^17.0.0 || ^18.0.0","react-dom":"^17.0.0 || ^18.0.0","react-router-dom":"^6.30.2"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"configSchema":"config.d.ts"}')}}]);
2
- //# sourceMappingURL=123.580aa7a9bfda.chunk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/123.580aa7a9bfda.chunk.js","sources":["webpack://techdocs-cli-embedded-app/json|/home/runner/work/publishing/publishing/plugins/catalog/package.json"],"sourcesContent":["module.exports = JSON.parse('{\"name\":\"@backstage/plugin-catalog\",\"version\":\"2.0.9-next.2\",\"description\":\"The Backstage plugin for browsing the Backstage catalog\",\"backstage\":{\"role\":\"frontend-plugin\",\"pluginId\":\"catalog\",\"pluginPackages\":[\"@backstage/plugin-catalog\",\"@backstage/plugin-catalog-backend\",\"@backstage/plugin-catalog-common\",\"@backstage/plugin-catalog-node\",\"@backstage/plugin-catalog-react\"]},\"publishConfig\":{\"access\":\"public\"},\"keywords\":[\"backstage\"],\"homepage\":\"https://backstage.io\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/backstage/backstage\",\"directory\":\"plugins/catalog\"},\"license\":\"Apache-2.0\",\"sideEffects\":false,\"exports\":{\".\":\"./src/index.ts\",\"./alpha\":\"./src/alpha/index.ts\",\"./package.json\":\"./package.json\"},\"main\":\"src/index.ts\",\"types\":\"src/index.ts\",\"typesVersions\":{\"*\":{\"alpha\":[\"src/alpha/index.ts\"],\"package.json\":[\"package.json\"]}},\"files\":[\"dist\",\"config.d.ts\"],\"scripts\":{\"build\":\"backstage-cli package build\",\"clean\":\"backstage-cli package clean\",\"lint\":\"backstage-cli package lint\",\"prepack\":\"backstage-cli package prepack\",\"postpack\":\"backstage-cli package postpack\",\"start\":\"backstage-cli package start\",\"test\":\"backstage-cli package test\"},\"dependencies\":{\"@backstage/catalog-client\":\"workspace:^\",\"@backstage/catalog-model\":\"workspace:^\",\"@backstage/core-compat-api\":\"workspace:^\",\"@backstage/core-components\":\"workspace:^\",\"@backstage/core-plugin-api\":\"workspace:^\",\"@backstage/errors\":\"workspace:^\",\"@backstage/frontend-plugin-api\":\"workspace:^\",\"@backstage/integration-react\":\"workspace:^\",\"@backstage/plugin-catalog-common\":\"workspace:^\",\"@backstage/plugin-catalog-react\":\"workspace:^\",\"@backstage/plugin-permission-react\":\"workspace:^\",\"@backstage/plugin-scaffolder-common\":\"workspace:^\",\"@backstage/plugin-search-common\":\"workspace:^\",\"@backstage/plugin-search-react\":\"workspace:^\",\"@backstage/plugin-techdocs-common\":\"workspace:^\",\"@backstage/plugin-techdocs-react\":\"workspace:^\",\"@backstage/types\":\"workspace:^\",\"@backstage/ui\":\"workspace:^\",\"@backstage/version-bridge\":\"workspace:^\",\"@material-ui/core\":\"^4.12.2\",\"@material-ui/icons\":\"^4.9.1\",\"@material-ui/lab\":\"4.0.0-alpha.61\",\"@mui/utils\":\"^5.14.15\",\"@remixicon/react\":\"^4.6.0\",\"classnames\":\"^2.3.1\",\"csv-stringify\":\"^5.6.5\",\"dataloader\":\"^2.0.0\",\"lodash\":\"^4.17.21\",\"pluralize\":\"^8.0.0\",\"react-helmet\":\"6.1.0\",\"react-use\":\"^17.2.4\",\"zen-observable\":\"^0.10.0\",\"zod\":\"^4.0.0\"},\"devDependencies\":{\"@backstage/cli\":\"workspace:^\",\"@backstage/core-app-api\":\"workspace:^\",\"@backstage/dev-utils\":\"workspace:^\",\"@backstage/frontend-test-utils\":\"workspace:^\",\"@backstage/plugin-permission-common\":\"workspace:^\",\"@backstage/test-utils\":\"workspace:^\",\"@testing-library/dom\":\"^10.0.0\",\"@testing-library/jest-dom\":\"^6.0.0\",\"@testing-library/react\":\"^16.0.0\",\"@testing-library/user-event\":\"^14.0.0\",\"@types/pluralize\":\"^0.0.33\",\"@types/react\":\"^18.0.0\",\"react\":\"^18.0.2\",\"react-dom\":\"^18.0.2\",\"react-router-dom\":\"^6.30.2\",\"swr\":\"^2.2.5\"},\"peerDependencies\":{\"@types/react\":\"^17.0.0 || ^18.0.0\",\"react\":\"^17.0.0 || ^18.0.0\",\"react-dom\":\"^17.0.0 || ^18.0.0\",\"react-router-dom\":\"^6.30.2\"},\"peerDependenciesMeta\":{\"@types/react\":{\"optional\":true}},\"configSchema\":\"config.d.ts\"}')"],"names":["JSON"],"mappings":"iIAAA,EAAO,OAAO,CAAGA,KAAK,KAAK,CAAC,ilG"}
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([["1749"],{52235(e,t,a){var r=a(4293),n=a(78920);t.default=void 0;var i=n(a(14041));t.default=(0,r(a(74044)).default)(i.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward")},49185(e,t,a){let r,n;a.d(t,{sA:()=>U,jn:()=>_,vv:()=>Z,nC:()=>$});var i,o=a(55963);function l(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function s(e){if(!l(e))return!1;let t=new Set;return Object.values(e).every(e=>(function e(t,a){return null===t||"string"==typeof t||"number"==typeof t||"boolean"==typeof t||!("object"!=typeof t||a.has(t))&&((a.add(t),Array.isArray(t))?t.every(t=>e(t,a)):!!l(t)&&Object.values(t).every(t=>e(t,a)))})(e,t))}var d=a(11601),c=a.n(d),u=a(67156),p=a.n(u);function m(e){if(!l(e)||"function"==typeof e.then)throw new o.dz("Invalid JSON schema: must be an object");let t=(r||(r=new(c())({allowUnionTypes:!0,allErrors:!0,validateSchema:!0}),p()(r)),r);try{let a=t.validateSchema(e);if("boolean"!=typeof a)throw new o.dz("Expected synchronous validation result")}catch(e){throw new o.dz(`Invalid JSON schema: ${e}`)}let a=t.errors?.[0];if(a){let e=a.message;throw Array.isArray(a?.params?.allowedValues)&&(e+=`, expected one of: ${a.params.allowedValues.join(", ")}`),new o.dz(`Invalid JSON schema, error at path ${a.instancePath}: ${e}`)}return!0}var f=a(71291),h=a(51700),g=a(22654);f.g1(f.Yj(),f.L5()).refine(e=>s(e),{message:"Invalid JSON schema"});let b=f.g1(f.Yj(),f.L5()).superRefine((e,t)=>{try{return m(e)}catch(e){return t.addIssue({code:g.eq.custom,message:(0,h.bJ)(e)?e.message:"Invalid JSON schema"}),!1}}),y=f.re({op:f.eu("declareAnnotation.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj(),schema:f.re({jsonSchema:b}).optional()})}),v=f.re({op:f.eu("declareKind.v1"),kind:f.Yj(),group:f.Yj(),properties:f.re({singular:f.Yj(),plural:f.Yj(),description:f.Yj()})}),x=f.Ik({allOf:f.PV([f.Ik({$ref:f.eu("Entity")}),f.Ik({type:f.eu("object"),properties:f.Ik({apiVersion:f.g1(f.Yj(),f.L5()).optional(),kind:f.g1(f.Yj(),f.L5()).optional()}).passthrough()}).passthrough()])}).passthrough();function j(e){let t=x.safeParse(e);if(!t.success)return e;let{allOf:a,...r}=t.data,{type:n,properties:i,...o}=a[1],{apiVersion:l,kind:s,...d}=i;return{...r,type:n,...o,properties:d}}let C=["kind","apiVersion","metadata","$ref"],S=["allOf","oneOf","anyOf","if","else","then","not","$ref"],w=f.re({selector:f.re({path:f.Yj()}),relation:f.Yj(),defaultKind:f.Yj().optional(),defaultNamespace:f.k5(["default","inherit"]).optional(),allowedKinds:f.YO(f.Yj()).optional()}),N=f.re({op:f.eu("declareKindVersion.v1"),kind:f.Yj(),name:f.Yj(),specType:f.Yj().optional(),properties:f.re({description:f.Yj().optional(),relationFields:f.YO(w).optional(),schema:f.re({jsonSchema:b})})});function A(e){let t=[];for(let r of e.versions){let n=j(r.schema.jsonSchema);for(let i of(m(n),!function(e){if(!s(e))throw new o.dz("Schema must be an object");for(let t of S)if(t in e)throw new o.dz(`Schema must not use "${t}" keyword in the root`);let t=e.properties;if(!l(t))throw new o.dz('Schema must have a "properties" field that is an object');for(let e of C)if(e in t)throw new o.dz(`Schema must not try to declare the reserved root field "${e}"`);for(let[e,a]of Object.entries(t)){if(!l(a))throw new o.dz(`Schema for root field "${e}" must be an object`);for(let t of S)if(t in a)throw new o.dz(`Schema for root field "${e}" must not use "${t}" keyword`)}}(n),Array.isArray(r.name)?r.name:[r.name]))for(let o of r.specType?[r.specType].flat():[void 0]){var a;t.push((a={kind:e.kind,name:i,specType:o,properties:{description:r.description,relationFields:r.relationFields,schema:{jsonSchema:n}}},N.parse({...a,op:"declareKindVersion.v1"})))}}return t}let k=f.re({op:f.eu("declareLabel.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj(),schema:f.re({jsonSchema:b}).optional()})}),P=f.re({op:f.eu("declareRelation.v1"),fromKind:f.Yj(),type:f.Yj(),toKind:f.Yj(),properties:f.re({reverseType:f.Yj(),title:f.Yj(),description:f.Yj()})});function T(e){return P.parse({...e,op:"declareRelation.v1"})}let L=f.re({op:f.eu("removeAnnotation.v1"),name:f.Yj()}),R=f.re({op:f.eu("removeKind.v1"),kind:f.Yj()}),I=f.re({op:f.eu("removeLabel.v1"),name:f.Yj()}),K=f.re({op:f.eu("removeTag.v1"),name:f.Yj()}),E=f.re({op:f.eu("declareTag.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj()})}),O=f.re({op:f.eu("updateAnnotation.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj().optional(),schema:f.re({jsonSchema:b}).optional()})}),z=f.re({op:f.eu("updateKind.v1"),kind:f.Yj(),properties:f.re({singular:f.Yj().optional(),plural:f.Yj().optional(),description:f.Yj().optional()})}),D=f.re({selector:f.re({path:f.Yj()}),relation:f.Yj(),defaultKind:f.Yj().optional(),defaultNamespace:f.k5(["default","inherit"]).optional(),allowedKinds:f.YO(f.Yj()).optional()}),M=f.re({op:f.eu("updateKindVersion.v1"),kind:f.Yj(),name:f.Yj(),specType:f.Yj().optional(),properties:f.re({description:f.Yj().optional(),relationFields:f.YO(D).optional(),schema:f.re({jsonSchema:b}).optional()})}),Y=f.re({op:f.eu("updateLabel.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj().optional(),schema:f.re({jsonSchema:b}).optional()})}),F=f.re({op:f.eu("updateRelation.v1"),fromKind:f.Yj(),type:f.Yj(),toKind:f.Yj(),properties:f.re({reverseType:f.Yj().optional(),title:f.Yj().optional(),description:f.Yj().optional()})});function W(e){return F.parse({...e,op:"updateRelation.v1"})}let B=f.re({op:f.eu("updateTag.v1"),name:f.Yj(),properties:f.re({title:f.Yj().optional(),description:f.Yj().optional()})}),V=a(59855).Y.create({type:"@backstage/CatalogModelLayer",versions:["v1"]});class H{#e;#t;constructor(e){this.#e=e.layerId,this.#t=[]}addKind(e){var t;let a,r=((a=[]).push((t={kind:e.names.kind,group:e.group,properties:{singular:e.names.singular,plural:e.names.plural,description:e.description}},v.parse({...t,op:"declareKind.v1"}))),a.push(...A({kind:e.names.kind,versions:e.versions??[]})),a);this.#t.push(...r)}addKindVersion(e){let t=A(e);this.#t.push(...t)}updateKind(e){let t=function(e){var t,a;let r=[];for(let n of((e.names.singular||e.names.plural||e.description)&&r.push((t={kind:e.names.kind,properties:{singular:e.names.singular,plural:e.names.plural,description:e.description}},z.parse({...t,op:"updateKind.v1"}))),e.versions??[])){let t=n.schema?j(n.schema.jsonSchema):void 0;for(let i of(t&&m(t),Array.isArray(n.name)?n.name:[n.name]))for(let o of n.specType?.length?[n.specType].flat():[void 0])r.push((a={kind:e.names.kind,name:i,specType:o,properties:{description:n.description,relationFields:n.relationFields,schema:t?{jsonSchema:t}:void 0}},M.parse({...a,op:"updateKindVersion.v1"})))}return r}(e);this.#t.push(...t)}removeKind(e){var t;let a=[(t={kind:e.kind},R.parse({...t,op:"removeKind.v1"}))];this.#t.push(...a)}addRelationPair(e){let t=function(e){let t=[];for(let a of[e.fromKind].flat())for(let r of[e.toKind].flat())t.push(T({fromKind:a,type:e.forward.type,toKind:r,properties:{reverseType:e.reverse.type,title:e.forward.title,description:e.description}})),t.push(T({fromKind:r,type:e.reverse.type,toKind:a,properties:{reverseType:e.forward.type,title:e.reverse.title,description:e.description}}));return t}(e);this.#t.push(...t)}updateRelationPair(e){let t=function(e){let t=[];for(let a of[e.fromKind].flat())for(let r of[e.toKind].flat())t.push(W({fromKind:a,type:e.forward.type,toKind:r,properties:{reverseType:e.reverse.type,title:e.forward.title,description:e.description}})),e.reverse.type&&t.push(W({fromKind:r,type:e.reverse.type,toKind:a,properties:{reverseType:e.forward.type,title:e.reverse.title,description:e.description}}));return t}(e);this.#t.push(...t)}addAnnotation(e){let t=function(e){var t;if(e.schema?.jsonSchema&&(m(e.schema.jsonSchema),"string"!==e.schema.jsonSchema.type))throw new o.dz(`Annotation "${e.name}" schema must have "type": "string" at the root, only string values are supported`);return[(t={name:e.name,properties:{title:e.title,description:e.description,schema:e.schema}},y.parse({...t,op:"declareAnnotation.v1"}))]}(e);this.#t.push(...t)}updateAnnotation(e){let t=function(e){var t;if(e.schema&&(m(e.schema.jsonSchema),"string"!==e.schema.jsonSchema.type))throw new o.dz(`Annotation "${e.name}" schema must have "type": "string" at the root, only string values are supported`);return[(t={name:e.name,properties:{title:e.title,description:e.description,schema:e.schema}},O.parse({...t,op:"updateAnnotation.v1"}))]}(e);this.#t.push(...t)}removeAnnotation(e){var t;let a=[(t={name:e.name},L.parse({...t,op:"removeAnnotation.v1"}))];this.#t.push(...a)}addLabel(e){let t=function(e){var t;if(e.schema?.jsonSchema&&(m(e.schema.jsonSchema),"string"!==e.schema.jsonSchema.type))throw new o.dz(`Label "${e.name}" schema must have "type": "string" at the root, only string values are supported`);return[(t={name:e.name,properties:{title:e.title,description:e.description,schema:e.schema}},k.parse({...t,op:"declareLabel.v1"}))]}(e);this.#t.push(...t)}updateLabel(e){let t=function(e){var t;if(e.schema&&(m(e.schema.jsonSchema),"string"!==e.schema.jsonSchema.type))throw new o.dz(`Label "${e.name}" schema must have "type": "string" at the root, only string values are supported`);return[(t={name:e.name,properties:{title:e.title,description:e.description,schema:e.schema}},Y.parse({...t,op:"updateLabel.v1"}))]}(e);this.#t.push(...t)}removeLabel(e){var t;let a=[(t={name:e.name},I.parse({...t,op:"removeLabel.v1"}))];this.#t.push(...a)}addTag(e){var t;let a=[(t={name:e.name,properties:{title:e.title,description:e.description}},E.parse({...t,op:"declareTag.v1"}))];this.#t.push(...a)}updateTag(e){var t;let a=[(t={name:e.name,properties:{title:e.title,description:e.description}},B.parse({...t,op:"updateTag.v1"}))];this.#t.push(...a)}removeTag(e){var t;let a=[(t={name:e.name},K.parse({...t,op:"removeTag.v1"}))];this.#t.push(...a)}import(e){let t=V.toInternal(e);this.#t.push(...t.ops)}build(){return V.createInstance("v1",{layerId:this.#e,ops:this.#t.slice()})}}let Z="ownedBy",$="dependsOn",_="partOf",U="hasPart";n=new H({layerId:(i={layerId:"catalog.backstage.io/well-known-relations",builder:e=>{e.addRelationPair({fromKind:["API","Component","Domain","Group","Location","Resource","System","User"],toKind:["Group","User"],description:"An ownership relation where the owner is usually an organizational entity (user or group), and the other entity can be anything.",forward:{type:"ownedBy",title:"owned by"},reverse:{type:"ownerOf",title:"owner of"}}),e.addRelationPair({fromKind:"Component",toKind:"API",description:"A relation from a component to an API it provides for consumption by others.",forward:{type:"providesApi",title:"provides API"},reverse:{type:"apiProvidedBy",title:"API provided by"}}),e.addRelationPair({fromKind:"Component",toKind:"API",description:"A relation from a component to an API it consumes.",forward:{type:"consumesApi",title:"consumes API"},reverse:{type:"apiConsumedBy",title:"API consumed by"}}),e.addRelationPair({fromKind:["Component","Resource"],toKind:["Component","Resource"],description:"A dependency relation expressing that an entity needs another entity to function.",forward:{type:"dependsOn",title:"depends on"},reverse:{type:"dependencyOf",title:"dependency of"}}),e.addRelationPair({fromKind:"Group",toKind:"Group",description:"A parent/child relation to build up a tree, used for example to describe the organizational structure between groups.",forward:{type:"parentOf",title:"parent of"},reverse:{type:"childOf",title:"child of"}}),e.addRelationPair({fromKind:"User",toKind:"Group",description:"A membership relation, typically for users in a group.",forward:{type:"memberOf",title:"member of"},reverse:{type:"hasMember",title:"has member"}}),e.addRelationPair({fromKind:["Component","API","Resource"],toKind:["Component","System"],description:"A part/whole relation where a component, API, or resource belongs to a system or a component is a subcomponent of another.",forward:{type:"partOf",title:"part of"},reverse:{type:"hasPart",title:"has part"}}),e.addRelationPair({fromKind:"System",toKind:"Domain",description:"A part/whole relation where a system belongs to a domain.",forward:{type:"partOf",title:"part of"},reverse:{type:"hasPart",title:"has part"}}),e.addRelationPair({fromKind:"Domain",toKind:"Domain",description:"A part/whole relation where a domain is a subdomain of another domain.",forward:{type:"partOf",title:"part of"},reverse:{type:"hasPart",title:"has part"}})}}).layerId}),i.builder(n),n.build()},45463(e,t,a){a.d(t,{z:()=>s});var r=a(31085),n=a(64947),i=a(14041),o=a(60603);let l=(0,i.forwardRef)((e,t)=>(0,r.jsx)(o.$h,{ref:t,...e,color:"initial"})),s=(0,i.forwardRef)((e,t)=>(0,r.jsx)(n.A,{ref:t,component:l,...e}))},98557(e,t,a){a.d(t,{M:()=>s});var r=a(31085),n=a(58837),i=a(71677),o=a(72501);let l=(0,n.A)({container:{overflow:"visible !important"},typo:{fontSize:"inherit",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box","-webkit-line-clamp":({line:e})=>e||1,"-webkit-box-orient":"vertical"}},{name:"BackstageOverflowTooltip"});function s(e){let t=l(e);return(0,r.jsx)(i.Ay,{title:e.title??(e.text||""),placement:e.placement,classes:e.tooltipClasses,children:(0,r.jsx)(o.A,{className:t.typo,variant:"inherit",children:e.text})})}},48266(e,t,a){a.d(t,{w:()=>N});var r=a(31085),n=a(77125),i=a(98552),o=a(94390),l=a(95061),s=a(41857),d=a(48543),c=a(26343),u=a(99489),p=a(7031),m=a(99703),f=a(58837),h=a(72501),g=a(92399),b=a(14041),y=a(10437);let v=(0,f.A)(e=>(0,m.A)({icon:{position:"absolute",right:e.spacing(.5),pointerEvents:"none",color:"#616161"}}),{name:"BackstageClosedDropdown"}),x=()=>{let e=v();return(0,r.jsx)(y.A,{className:e.icon,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M7.5 8L6 9.5L12.0703 15.5703L18.1406 9.5L16.6406 8L12.0703 12.5703L7.5 8Z",fill:"currentColor"})})},j=(0,f.A)(e=>(0,m.A)({icon:{position:"absolute",right:e.spacing(.5),pointerEvents:"none",color:"#616161"}}),{name:"BackstageOpenedDropdown"}),C=()=>{let e=j();return(0,r.jsx)(y.A,{className:e.icon,fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M16.5 16L18 14.5L11.9297 8.42969L5.85938 14.5L7.35938 16L11.9297 11.4297L16.5 16Z",fill:"currentColor"})})},S=(0,p.A)(e=>(0,m.A)({root:{"label + &":{marginTop:e.spacing(3)},"&.Mui-focused > div[role=button]":{borderColor:e.palette.primary.main}},input:{borderRadius:e.shape.borderRadius,position:"relative",backgroundColor:e.palette.background.paper,border:"1px solid #ced4da",fontSize:e.typography.body1.fontSize,padding:e.spacing(1.25,3.25,1.25,1.5),transition:e.transitions.create(["border-color","box-shadow"]),"&:focus":{background:e.palette.background.paper,borderRadius:e.shape.borderRadius}}}),{name:"BackstageSelectInputBase"})(s.A),w=(0,f.A)(e=>(0,m.A)({formControl:{margin:e.spacing(1,0)},label:{transform:"initial",fontWeight:"bold",fontSize:e.typography.body2.fontSize,fontFamily:e.typography.fontFamily,color:e.palette.text.primary,"&.Mui-focused":{color:e.palette.text.primary}},formLabel:{transform:"initial",fontWeight:"bold",fontSize:e.typography.body2.fontSize,fontFamily:e.typography.fontFamily,color:e.palette.text.primary,"&.Mui-focused":{color:e.palette.text.primary}},chips:{display:"flex",flexWrap:"wrap"},chip:{margin:2},checkbox:{},root:{display:"flex",flexDirection:"column"}}),{name:"BackstageSelect"});function N(e){let{multiple:t,items:a,label:s,placeholder:p,selected:m,onChange:f,triggerReset:y,native:v=!1,disabled:j=!1,margin:N,"data-testid":A="select"}=e,k=w(),[P,T]=(0,b.useState)(m||(t?[]:"")),[L,R]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{T(t?[]:"")},[y,t]),(0,b.useEffect)(()=>{T(m||(t?[]:""))},[m,t]),(0,r.jsx)(n.A,{className:k.root,children:(0,r.jsxs)(l.A,{className:k.formControl,children:[(0,r.jsx)(d.A,{className:k.formLabel,children:s}),(0,r.jsxs)(u.A,{"aria-label":s,value:P,native:v,disabled:j,"data-testid":A,displayEmpty:!0,multiple:t,margin:N,onChange:e=>{T(e.target.value),f(e.target.value)},open:L,onOpen:e=>{j?e.preventDefault():R(a=>!(!t||e.target instanceof HTMLElement)||!a)},onClose:()=>{R(!1)},input:(0,r.jsx)(S,{}),label:s,renderValue:e=>t&&0!==P.length?(0,r.jsx)(n.A,{className:k.chips,children:e.map(e=>{let t=a.find(t=>t.value===e);return!!t&&(0,r.jsx)(o.A,{"data-testid":"chip",label:t?.label,clickable:!0,deleteIcon:(0,r.jsx)(g.default,{"data-testid":"cancel-icon",onMouseDown:e=>e.stopPropagation()}),onDelete:()=>{let t=P.filter(t=>t!==e);T(t),f(t)},className:k.chip},t?.value)})}):(0,r.jsx)(h.A,{children:0===P.length?p||"":a.find(t=>t.value===e)?.label}),IconComponent:()=>L?(0,r.jsx)(C,{}):(0,r.jsx)(x,{}),MenuProps:{anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},getContentAnchorEl:null},children:[!!p&&!t&&(0,r.jsx)(c.A,{value:[],children:p}),v?a&&a.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value)):a&&a.map(e=>(0,r.jsxs)(c.A,{value:e.value,children:[t&&(0,r.jsx)(i.A,{color:"primary",checked:P.includes(e.value)||!1,className:k.checkbox}),e.label]},e.value))]})]})})}},28499(e,t,a){a.d(t,{X:()=>H});var r=a(31085),n=a(89595),i=a(25301),o=a(77125),l=a(29365),s=a(7031),d=a(58837),c=a(54917),u=a(72501),p=a(83313),m=a(89019),f=a(62461),h=a(68887),g=a(63798),b=a(64704),y=a(6774),v=a(75625),x=a(65859),j=a(45917),C=a(5416),S=a(33494),w=a(80113),N=a(26229),A=a(46802),k=a(45250),P=a(14041),T=a(89332),L=a(64947),R=a(48266);let I=(0,d.A)(e=>({root:{height:"100%",width:"315px",display:"flex",flexDirection:"column",marginRight:e.spacing(3)},value:{fontWeight:"bold",fontSize:18},header:{display:"flex",alignItems:"center",height:e.spacing(7.5),justifyContent:"space-between",borderBottom:`1px solid ${e.palette.grey[500]}`},heder:{},filters:{display:"flex",flexDirection:"column","& > *":{marginTop:e.spacing(2)}}}),{name:"BackstageTableFilters"}),K=e=>{let t=I(),{onChangeFilters:a}=e,{t:i}=(0,n.i)(T.O),[l,s]=(0,P.useState)({...e.selectedFilters}),[d,c]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{a(l)},[l,a]),(0,r.jsxs)(o.A,{className:t.root,children:[(0,r.jsxs)(o.A,{className:`${t.header} ${t.heder}`,children:[(0,r.jsx)(o.A,{className:t.value,children:i("table.filter.title")}),(0,r.jsx)(L.A,{color:"primary",onClick:()=>{s({}),c(e=>!e)},children:i("table.filter.clearAll")})]}),(0,r.jsx)(o.A,{className:t.filters,children:!!e.filters?.length&&e.filters.map(e=>(0,r.jsx)(R.w,{triggerReset:d,...e.element,selected:l[e.element.label],onChange:t=>s({...l,[e.element.label]:t})},e.element.label))})]})};var E=a(78467);function O(e){return(0,r.jsx)("tbody",{"data-testid":"loading-indicator",children:(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:e.colSpan,children:(0,r.jsx)(o.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",minHeight:"15rem"},children:(0,r.jsx)(E.A,{size:"5rem"})})})})})}let z={Add:(0,P.forwardRef)((e,t)=>(0,r.jsx)(p.default,{...e,ref:t})),Check:(0,P.forwardRef)((e,t)=>(0,r.jsx)(f.default,{...e,ref:t})),Clear:(0,P.forwardRef)((e,t)=>(0,r.jsx)(b.default,{...e,ref:t})),Delete:(0,P.forwardRef)((e,t)=>(0,r.jsx)(y.default,{...e,ref:t})),DetailPanel:(0,P.forwardRef)((e,t)=>(0,r.jsx)(g.default,{...e,ref:t})),Edit:(0,P.forwardRef)((e,t)=>(0,r.jsx)(v.default,{...e,ref:t})),Export:(0,P.forwardRef)((e,t)=>(0,r.jsx)(N.default,{...e,ref:t})),Filter:(0,P.forwardRef)((e,t)=>(0,r.jsx)(x.default,{...e,ref:t})),FirstPage:(0,P.forwardRef)((e,t)=>(0,r.jsx)(C.default,{...e,ref:t})),LastPage:(0,P.forwardRef)((e,t)=>(0,r.jsx)(S.default,{...e,ref:t})),NextPage:(0,P.forwardRef)((e,t)=>(0,r.jsx)(g.default,{...e,ref:t})),PreviousPage:(0,P.forwardRef)((e,t)=>(0,r.jsx)(h.default,{...e,ref:t})),ResetSearch:(0,P.forwardRef)((e,t)=>(0,r.jsx)(b.default,{...e,ref:t})),Search:(0,P.forwardRef)((e,t)=>(0,r.jsx)(j.default,{...e,ref:t})),SortArrow:(0,P.forwardRef)((e,t)=>(0,r.jsx)(m.default,{...e,ref:t})),ThirdStateCheck:(0,P.forwardRef)((e,t)=>(0,r.jsx)(w.default,{...e,ref:t})),ViewColumn:(0,P.forwardRef)((e,t)=>(0,r.jsx)(A.default,{...e,ref:t}))};function D(e,t){let a=t.split("."),r=e[a[0]];for(let e=1;e<a.length&&void 0!==r;++e)r=r[a[e]];return r}let M=(0,s.A)(e=>({header:{padding:e.spacing(1,2,1,2.5),borderTop:`1px solid ${e.palette.grey.A100}`,borderBottom:`1px solid ${e.palette.grey.A100}`,fontWeight:e.typography.fontWeightBold,position:"static",wordBreak:"normal",textTransform:"uppercase"}}),{name:"BackstageTableHeader"})(i.MTableHeader),Y=(0,s.A)(e=>({root:{padding:e.spacing(3,0,2.5,2.5)},title:{"& > h6":{fontWeight:e.typography.fontWeightBold}},searchField:{paddingRight:e.spacing(2)}}),{name:"BackstageTableToolbar"})(i.MTableToolbar),F=(0,d.A)(e=>({root:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap"},filterControls:{display:"flex",alignItems:"center"},title:{fontWeight:e.typography.fontWeightBold,fontSize:18,whiteSpace:"nowrap"}}),{name:"BackstageTableFiltersContainer"}),W=(0,d.A)(()=>({root:{display:"flex",alignItems:"start"}}),{name:"BackstageTable"}),B={search:"",filtersOpen:!1,filters:{}};function V(e){let{toolbarRef:t,setSearch:a,hasFilters:i,selectedFiltersLength:s,toggleFilters:d}=e,{t:c}=(0,n.i)(T.O),p=F(),m=(0,P.useCallback)(t=>{e.onSearchChanged(t),a(t)},[e,a]);return i?(0,r.jsxs)(o.A,{className:p.root,children:[(0,r.jsxs)(o.A,{className:p.filterControls,children:[(0,r.jsx)(l.A,{onClick:d,"aria-label":"filter list",children:(0,r.jsx)(x.default,{})}),(0,r.jsxs)(u.A,{className:p.title,children:[c("table.filter.title")," (",s,")"]})]}),(0,r.jsx)(Y,{...e,ref:t,onSearchChanged:m})]}):(0,r.jsx)(Y,{...e,ref:t,onSearchChanged:m})}function H(e){var t,a,l,s;let{data:d,columns:p,emptyContent:m,options:f,title:h,subtitle:g,localization:b,filters:y,initialState:v,onStateChange:x,components:j,isLoading:C,style:S,...w}=e,{t:N}=(0,n.i)(T.O),A=W(),L=(0,c.A)(),R={...B,...v},[I,E]=(0,P.useState)(R.filtersOpen),Y=(0,P.useCallback)(()=>E(e=>!e),[E]),[F,H]=(0,P.useState)(R.filters),[Z,$]=(0,P.useState)(R.search);(0,P.useEffect)(()=>{if(x){var e;x((e={search:Z,filtersOpen:I,filters:F},(0,k.transform)(e,(e,t,a)=>{(0,k.isEqual)(t,B[a])||(e[a]=t)})))}},[Z,I,F,x]);let _=(0,P.useCallback)(e=>p.find(t=>t.title===e)?.field,[p]),U=(0,P.useMemo)(()=>{if("function"==typeof d||!F)return d;let e=Object.values(F);return d&&e.flat().length?d.filter(e=>!!Object.entries(F).filter(([,e])=>!!e.length).every(([t,a])=>{let r=D(e,_(t));return Array.isArray(r)&&Array.isArray(a)?r.some(e=>a.includes(e)):Array.isArray(r)?r.includes(a):Array.isArray(a)?a.includes(r):r===a})):d},[d,F,_]),q=Object.values(F).flat().length,J=!!y?.length,Q=(0,P.useCallback)(e=>(0,r.jsx)(V,{setSearch:$,hasFilters:J,selectedFiltersLength:q,toggleFilters:Y,...e}),[Y,J,q,$]),X="function"!=typeof d&&0===d.length,G=p.length,ee=(0,P.useMemo)(()=>(function({columnCount:e,emptyContent:t,hasNoRows:a,loading:n}){return o=>n?(0,r.jsx)(O,{colSpan:e}):t&&a?(0,r.jsx)("tbody",{children:(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:e,children:t})})}):(0,r.jsx)(i.MTableBody,{...o})})({hasNoRows:X,emptyContent:m,columnCount:G,loading:C}),[X,m,G,C]);return(0,r.jsxs)(o.A,{className:A.root,children:[I&&d&&"function"!=typeof d&&y?.length&&(0,r.jsx)(K,{filters:(t=y,a=d,l=p,s=N,t.map(e=>{var t;let r,n;return{type:e.type,element:{placeholder:s("table.filter.placeholder"),label:e.column,multiple:"multiple-select"===e.type,items:[...(t=e.column,r=new Set,n=e=>{null!=e&&r.add(e)},a&&a.forEach(e=>{let a=D(e,l.find(e=>e.title===t)?.field);Array.isArray(a)?a.forEach(n):n(a)}),r)].sort().map(e=>({label:e,value:e}))}}})),selectedFilters:F,onChangeFilters:H}),(0,r.jsx)(i.default,{components:{Header:M,Body:ee,Toolbar:Q,...j},options:f,columns:p.map(e=>{let t=e.headerStyle??{},a=e.cellStyle||{};if(e.highlight)if(t.color=L.palette.textContrast,"object"==typeof a)a.fontWeight=L.typography.fontWeightBold;else{let e=a;a=(t,a,r)=>({...e(t,a,r),fontWeight:L.typography.fontWeightBold})}return{...e,headerStyle:t,cellStyle:a}}),icons:z,title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{variant:"h5",component:"h2",children:h}),g&&(0,r.jsx)(u.A,{color:"textSecondary",variant:"body1",children:g})]}),data:U,style:{width:"100%",...S},localization:{...b,body:{emptyDataSourceMessage:N("table.body.emptyDataSourceMessage"),...b?.body},pagination:{firstTooltip:N("table.pagination.firstTooltip"),labelDisplayedRows:N("table.pagination.labelDisplayedRows"),labelRowsSelect:N("table.pagination.labelRowsSelect"),lastTooltip:N("table.pagination.lastTooltip"),nextTooltip:N("table.pagination.nextTooltip"),previousTooltip:N("table.pagination.previousTooltip"),...b?.pagination},header:{actions:N("table.header.actions"),...b?.header},toolbar:{searchPlaceholder:N("table.toolbar.search"),searchTooltip:N("table.toolbar.search"),...b?.toolbar}},...w})]})}H.icons=Object.freeze(z)},89439(e,t,a){a.d(t,{n:()=>L});var r=a(31085),n=a(40703),i=a(59469),o=a(48653),l=a(45685),s=a(37197),d=a(58837),c=a(7031),u=a(53373),p=a.n(u),m=a(77125),f=a(72501),h=a(52235),g=a(60603);let b=(0,d.A)(e=>({root:{maxWidth:"fit-content",padding:e.spacing(2,2,2,2.5)},boxTitle:{margin:0,color:e.palette.textSubtle},arrow:{color:e.palette.textSubtle}}),{name:"BackstageBottomLink"});function y(e){let{link:t,title:a,onClick:n}=e,i=b();return(0,r.jsxs)(m.A,{children:[(0,r.jsx)(s.A,{}),(0,r.jsx)(g.N_,{to:t,onClick:n,underline:"none",children:(0,r.jsxs)(m.A,{display:"flex",alignItems:"center",className:i.root,children:[(0,r.jsx)(m.A,{className:i.boxTitle,fontWeight:"fontWeightBold",m:1,children:(0,r.jsx)(f.A,{children:(0,r.jsx)("strong",{children:a})})}),(0,r.jsx)(h.default,{className:i.arrow})]})})]})}var v=a(14041),x=a(45463),j=a(60691),C=a(89332),S=a(89595);let w=e=>{let{slackChannel:t}=e,{t:a}=(0,S.i)(C.O);return t?"string"==typeof t?(0,r.jsx)(f.A,{children:a("errorBoundary.title",{slackChannel:t})}):t.href?(0,r.jsx)(x.z,{to:t.href,variant:"contained",children:t.name}):(0,r.jsx)(f.A,{children:a("errorBoundary.title",{slackChannel:t.name})}):null},N=class extends v.Component{constructor(e){super(e),this.state={error:void 0,errorInfo:void 0}}componentDidCatch(e,t){console.error(`ErrorBoundary, error: ${e}`,{error:e,errorInfo:t}),this.setState({error:e,errorInfo:t})}render(){let{slackChannel:e,children:t}=this.props,{error:a}=this.state;return a?(0,r.jsx)(j.b,{title:"Something Went Wrong",error:a,children:(0,r.jsx)(w,{slackChannel:e})}):t}},A=(0,d.A)(e=>({noPadding:{padding:0,"&:last-child":{paddingBottom:0}},contentAlignBottom:{display:"flex",alignItems:"self-end"},header:{padding:e.spacing(2,2,2,2.5)},headerTitle:{fontWeight:e.typography.fontWeightBold},headerSubheader:{paddingTop:e.spacing(1)},headerAvatar:{},headerAction:{},headerContent:{},subheader:{display:"flex"}}),{name:"BackstageInfoCard"}),k=(0,c.A)(e=>({root:{display:"inline-block",padding:e.spacing(8,8,0,0),float:"right"}}),{name:"BackstageInfoCardCardActionsTopRight"})(i.A),P={flex:{display:"flex",flexDirection:"column"},fullHeight:{display:"flex",flexDirection:"column",height:"100%"},gridItem:{display:"flex",flexDirection:"column",height:"calc(100% - 10px)",marginBottom:"10px",breakInside:"avoid-page","@media print":{height:"auto"}}},T={fullHeight:{flex:1},gridItem:{flex:1}};function L(e){let{title:t,subheader:a,divider:d=!0,deepLink:c,slackChannel:u,errorBoundaryProps:m,variant:f,alignContent:h="normal",children:g,headerStyle:b,headerProps:v,icon:x,action:j,actionsClassName:C,actions:S,cardClassName:w,actionsTopRight:L,className:R,noPadding:I,titleTypographyProps:K,subheaderTypographyProps:E}=e,O=A(),z={},D={};return f&&f.split(/[\s]+/g).forEach(e=>{z={...z,...P[e]},D={...D,...T[e]}}),(0,r.jsx)(n.A,{style:z,className:R,children:(0,r.jsxs)(N,{...m||(u?{slackChannel:u}:{}),children:[t&&(0,r.jsx)(l.A,{classes:{root:p()(O.header),title:O.headerTitle,subheader:O.headerSubheader,avatar:O.headerAvatar,action:O.headerAction,content:O.headerContent},title:t,subheader:a||x?(0,r.jsxs)("div",{"data-testid":"info-card-subheader",children:[a&&(0,r.jsx)("div",{className:O.subheader,children:a}),x]}):null,action:j,style:{...b},titleTypographyProps:K,subheaderTypographyProps:E,...v}),L&&(0,r.jsx)(k,{children:L}),d&&(0,r.jsx)(s.A,{}),(0,r.jsx)(o.A,{className:p()(w,{[O.noPadding]:I,[O.contentAlignBottom]:"bottom"===h}),style:D,children:g}),S&&(0,r.jsx)(i.A,{className:C,children:S}),c&&(0,r.jsx)(y,{...c})]})})}},26438(e,t,a){a.d(t,{wL:()=>y,aR:()=>g,Zp:()=>h,bw:()=>b});var r=a(31085),n=a(14041),i=a(57873),o=a(63878),l=a(48119);let s={"bui-Card":"vwbKbDh04mMaiBi3","bui-CardHeader":"XFUmGkj6WID_JnEz","bui-CardBody":"bDKBEHaUGVdvGxpS","bui-CardFooter":"htqU_uAkxL89C8of","bui-CardTrigger":"YH9iVtgxrw5b0cYJ","bui-card-body-shadow":"bJ7HlUi_25Q2Dxr7"},d=(0,l.p)()({styles:s,classNames:{root:"bui-Card",trigger:"bui-CardTrigger"},propDefs:{children:{},className:{},onPress:{},href:{},label:{},target:{},rel:{},download:{},style:{}},utilityProps:["grow","shrink","basis"]}),c=(0,l.p)()({styles:s,classNames:{root:"bui-CardHeader"},propDefs:{children:{},className:{}}}),u=(0,l.p)()({styles:s,classNames:{root:"bui-CardBody"},propDefs:{children:{},className:{}}}),p=(0,l.p)()({styles:s,classNames:{root:"bui-CardFooter"},propDefs:{children:{},className:{}}});var m=a(13408),f=a(12860);let h=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:l,dataAttributes:s,utilityStyle:c}=(0,o.Z)(d,e),{classes:u,children:p,onPress:h,href:g,label:b,target:y,rel:v,download:x}=a,j=!!(h||g),C=(0,n.useRef)(null),S=(0,n.useCallback)(e=>{if(!j||!C.current||C.current.contains(e.target))return;let t=e.target,a=t instanceof Element?t:t?.parentElement;a?.closest('a[href],button,input,select,textarea,[role="button"],[role="link"],[tabindex]:not([tabindex="-1"])')||window.getSelection()?.toString()||C.current.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey}))},[j]);return(0,r.jsxs)(m.a,{as:"article",bg:"neutral",ref:t,className:u.root,"data-interactive":j||void 0,...s,...l,onClick:j?S:void 0,style:{...c,...a.style},children:[g&&(0,r.jsx)(f.N,{ref:C,className:u.trigger,href:g,target:y,rel:v,download:x,"aria-label":b}),h&&!g&&(0,r.jsx)(i.$,{ref:C,className:u.trigger,onPress:h,"aria-label":b}),p]})});h.displayName="Card";let g=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(c,e),{classes:i,children:l}=a;return(0,r.jsx)("div",{ref:t,className:i.root,...n,children:l})});g.displayName="CardHeader";let b=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(u,e),{classes:i,children:l}=a;return(0,r.jsx)("div",{ref:t,className:i.root,...n,children:l})});b.displayName="CardBody";let y=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(p,e),{classes:i,children:l}=a;return(0,r.jsx)("div",{ref:t,className:i.root,...n,children:l})});y.displayName="CardFooter"},77479(e,t,a){a.d(t,{S:()=>d});var r=a(31085),n=a(14041),i=a(10450),o=a(63878);let l=(0,a(48119).p)()({styles:{"bui-Checkbox":"hJtmqCNU8SMp97Lu","bui-CheckboxIndicator":"AsCZ8LTTAs5lRnNR"},classNames:{root:"bui-Checkbox",indicator:"bui-CheckboxIndicator"},propDefs:{children:{},className:{}}});var s=a(63690);let d=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:d,dataAttributes:c}=(0,o.Z)(l,e),{classes:u,children:p}=a,m=d["aria-label"],f=d["aria-labelledby"];return(0,n.useEffect)(()=>{p||m||f||console.warn("Checkbox requires either a visible label, aria-label, or aria-labelledby for accessibility")},[p,m,f]),(0,r.jsx)(i.Sc,{ref:t,className:u.root,...c,...d,children:({isIndeterminate:e})=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:u.indicator,"aria-hidden":"true",children:e?(0,r.jsx)(s.oev,{size:12}):(0,r.jsx)(s.s0,{size:12})}),null!=p&&(0,r.jsx)("div",{children:p})]})})})},495(e,t,a){a.d(t,{l:()=>es});var r=a(31085),n=a(14041),i=a(91013),o=a(63878),l=a(48119);let s={"bui-Select":"fl_o2cRttX8vIo5j","bui-SelectPopover":"xRoZ59Ta50wTyFbP","bui-SelectTrigger":"f6xSegNfnDAA591f","bui-SelectTriggerChevron":"hey3g7_Ll4EtTJdE","bui-SelectValue":"EOuke6Cxn9cos7ok","bui-SelectItemIndicator":"LiF4f9w5zcb_V5q_","bui-SelectList":"wCPzC0hbf30wVMOp","bui-SelectItem":"Mn7kwp0_L8g4rWcf","bui-SelectItemLabel":"sG8NrKzlnq4NyoHP","bui-SelectItemContent":"dEYdQefcncAOEwHx","bui-SelectItemLeadingIcon":"AKGYEGIB6gowSR1v","bui-SelectItemAvatar":"yME5bCO7KXI8ytlf","bui-SelectItemTextContent":"GxLJfL5leAuIEMf4","bui-SelectItemTitle":"VpNS7MhLIRMk2oNQ","bui-SelectItemDescription":"PIhKUXz6a8c4loYl","bui-SelectSearchWrapper":"af0jN5t2MnkzSKwM","bui-SelectContent":"PZwuqaalMCYxziS8","bui-SelectResults":"XYK5W5M9fYWqIec2","bui-SelectSearch":"MAcGzHfmHVw4bkcS","bui-SelectSearchClear":"Qm0LMYJXqDozSs4J","bui-SelectSection":"sPxu4s2LxhUkjdE5","bui-SelectSectionHeader":"FuD_n78xDNQIkQ_A","bui-SelectNoResults":"mai_FHtvkacjqFtg","bui-SelectLoading":"J9z0FCamdHQrC3j_","bui-SelectLoadingRow":"SbRLeO8aQQMTytTi"},d=(0,l.p)()({styles:s,classNames:{root:"bui-Select",popover:"bui-SelectPopover"},propDefs:{icon:{},size:{dataAttribute:!0,default:"small"},options:{},items:{},children:{},dependencies:{},search:{},loading:{},searchable:{},searchPlaceholder:{},label:{},secondaryLabel:{},description:{},isRequired:{},className:{}}}),c=(0,l.p)()({styles:s,classNames:{root:"bui-SelectTrigger",chevron:"bui-SelectTriggerChevron",value:"bui-SelectValue"},bg:"consumer",propDefs:{icon:{}}}),u=(0,l.p)()({styles:s,classNames:{root:"bui-SelectContent",searchWrapper:"bui-SelectSearchWrapper",results:"bui-SelectResults",search:"bui-SelectSearch",searchClear:"bui-SelectSearchClear"},propDefs:{search:{},options:{},items:{},children:{},dependencies:{},loading:{},isStale:{},visibleIds:{},retainedOptions:{}}}),p=(0,l.p)()({styles:s,classNames:{root:"bui-SelectList",noResults:"bui-SelectNoResults",loading:"bui-SelectLoading",loadingRow:"bui-SelectLoadingRow"},propDefs:{options:{},items:{},children:{},dependencies:{},loading:{},isStale:{},retainedOptions:{}}}),m=(0,l.p)()({styles:s,classNames:{label:"bui-SelectItemLabel"},propDefs:{}}),f=(0,l.p)()({styles:s,classNames:{root:"bui-SelectItem",indicator:"bui-SelectItemIndicator",content:"bui-SelectItemContent"},navigation:{type:"anchor"},propDefs:{children:{},showSelectionIndicator:{},className:{}}}),h=(0,l.p)()({styles:s,classNames:{root:"bui-SelectItemText",content:"bui-SelectItemContent",leadingIcon:"bui-SelectItemLeadingIcon",text:"bui-SelectItemTextContent",title:"bui-SelectItemTitle",description:"bui-SelectItemDescription"},propDefs:{title:{},description:{},leadingIcon:{},className:{}}});(0,l.p)()({styles:s,classNames:{root:"bui-SelectItemProfile",content:"bui-SelectItemContent",avatar:"bui-SelectItemAvatar",name:"bui-SelectItemTitle"},propDefs:{name:{},src:{},className:{}}});let g=(0,l.p)()({styles:s,classNames:{root:"bui-SelectSection",header:"bui-SelectSectionHeader"},propDefs:{}});var b=a(41181),y=a(94816);let v=(0,l.p)()({styles:{"bui-FieldLabelWrapper":"QCxpyIls6to9Bn5w","bui-FieldLabel":"qjnrgCeKosN0HGNG","bui-FieldSecondaryLabel":"VAD8KU3Enrs4kH_k","bui-FieldDescription":"KsFBKeDCTE86ZANx"},classNames:{root:"bui-FieldLabelWrapper",label:"bui-FieldLabel",secondaryLabel:"bui-FieldSecondaryLabel",description:"bui-FieldDescription"},propDefs:{label:{},secondaryLabel:{},description:{},htmlFor:{},id:{},descriptionId:{},descriptionSlot:{},className:{}}}),x=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(v,e),{classes:i,label:l,secondaryLabel:s,description:d,htmlFor:c,id:u,descriptionId:p,descriptionSlot:m}=a;return l?(0,r.jsxs)("div",{className:i.root,...n,ref:t,children:[l&&(0,r.jsxs)(b.J,{className:i.label,htmlFor:c,id:u,children:[l,s&&(0,r.jsxs)("span",{"aria-hidden":"true",className:i.secondaryLabel,children:["(",s,")"]})]}),d&&(0,r.jsx)(y.E,{slot:m,className:i.description,elementType:"div",id:p,children:d})]}):null});x.displayName="FieldLabel";var j=a(41783);let C=(0,l.p)()({styles:{"bui-FieldError":"Ai9iNkHuNwQ8kqsz"},classNames:{root:"bui-FieldError"},propDefs:{className:{}}}),S=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(C,e),{classes:i}=a;return(0,r.jsx)(j.b,{className:i.root,ref:t,...n})});S.displayName="FieldError";var w=a(47499),N=a(80084),A=a(19706);let k=(0,l.p)()({styles:{"bui-Popover":"c6K43dAXzUIQYTPO","bui-PopoverArrow":"nWNOVN9SSAkDCJc4","bui-PopoverContent":"ndXnur8atSwrX9tW"},classNames:{root:"bui-Popover",arrow:"bui-PopoverArrow",content:"bui-PopoverContent"},propDefs:{children:{},hideArrow:{},className:{}}});var P=a(13408),T=a(56808);let L=(0,n.forwardRef)((e,t)=>{let{ownProps:a,restProps:n}=(0,o.Z)(k,e),{classes:i,children:l,hideArrow:s}=a,d=(0,w.Bi)();return(0,r.jsx)(N.A,{className:i.root,...n,ref:t,children:({trigger:e})=>(0,r.jsxs)(r.Fragment,{children:[!s&&"MenuTrigger"!==e&&"SubmenuTrigger"!==e&&(0,r.jsx)(A.k,{className:i.arrow,children:(0,r.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,r.jsx)("defs",{children:(0,r.jsx)("path",{id:d,fillRule:"evenodd",d:"M10.3356 7.39793L15.1924 3.02682C15.9269 2.36577 16.8801 2 17.8683 2H20V7.94781e-07L1.74846e-07 -9.53674e-07L0 2L1.4651 2C2.4532 2 3.4064 2.36577 4.1409 3.02682L8.9977 7.39793C9.378 7.7402 9.9553 7.74021 10.3356 7.39793Z M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z"})}),(0,r.jsx)("use",{href:`#${d}`}),(0,r.jsx)("use",{href:`#${d}`}),(0,r.jsx)("path",{d:"M11.0046 8.14124C10.2439 8.82575 9.08939 8.82578 8.32869 8.14122L3.47189 3.77011C2.92109 3.27432 2.20619 2.99999 1.46509 2.99999L4.10999 3L8.99769 7.39793C9.37799 7.7402 9.95529 7.7402 10.3356 7.39793L15.2226 3L17.8683 2.99999C17.1271 2.99999 16.4122 3.27432 15.8614 3.77011L11.0046 8.14124Z"})]})}),(0,r.jsx)(T.fX,{children:(0,r.jsx)(P.a,{bg:"neutral",className:i.content,children:l})})]})})});L.displayName="Popover";var R=a(57873),I=a(63690);function K(e){let{ownProps:t,dataAttributes:a}=(0,o.Z)(c,e),{classes:n,icon:l}=t;return(0,r.jsxs)(R.$,{className:n.root,...a,children:[l,(0,r.jsx)(i.yv,{className:n.value,children:({isPlaceholder:e,selectedText:t,defaultChildren:a})=>e?a:t}),(0,r.jsx)("div",{className:n.chevron,children:(0,r.jsx)(I.eQr,{"aria-hidden":"true"})})]})}var E=a(23413),O=a(58583),z=a(57011),D=a(65874),M=a(2556),Y=a(32074),F=a(87426),W=a(54357);function B(e){return void 0!==e.id?e:{id:e.value,label:e.label,disabled:e.disabled}}function V(e){return e.map(e=>"options"in e?{title:e.title,options:e.options.map(B)}:B(e))}function H(e){return new Set(Array.from(e,e=>e.id))}function Z(e){return null==e?new Set:new Set(Array.isArray(e)?e:[e])}var $=a(21533);function _({definitionResult:e,navigation:t}){let{ownProps:a,restProps:n}=e,{classes:i,children:o,showSelectionIndicator:l}=a,s=(0,$.eI)(t,n);return(0,r.jsx)(M.nh,{className:i.root,...n,...s,children:e=>{let t="function"==typeof o?o(e):o;return l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:i.indicator,children:(0,r.jsx)(I.s0,{"aria-hidden":"true"})}),(0,r.jsx)("div",{className:i.content,children:t})]}):t}})}function U(e){let t=(0,o.Z)(f,e),a=t.navigation;return(0,r.jsx)(a,{props:t.restProps,view:_,viewProps:{definitionResult:t}})}var q=a(74616);function J(e,t){let[a,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if(!e)return void r(!1);let a=setTimeout(()=>r(!0),t);return()=>clearTimeout(a)},[t,e]),e&&a}let Q=["70%","55%","65%"];function X({count:e,className:t,rowClassName:a}){return(0,r.jsx)("div",{className:t,"aria-hidden":"true",children:Q.slice(0,e).map(e=>(0,r.jsx)("div",{className:a,children:(0,r.jsx)(q.E,{width:e,height:"0.75rem"})},e))})}let G=()=>{let{ownProps:e}=(0,o.Z)(p,{}),{classes:t}=e;return(0,r.jsx)("div",{className:t.noResults,children:"No results found."})};function ee({option:e}){let{ownProps:t}=(0,o.Z)(h,{title:e.label,description:e.description,leadingIcon:e.leadingIcon}),{classes:a}=t,{ownProps:{classes:n}}=(0,o.Z)(m,{});return(0,r.jsx)(U,{id:e.id,value:e,className:a.root,textValue:e.label,isDisabled:e.disabled,showSelectionIndicator:!0,children:(0,r.jsxs)("div",{className:a.content,children:[e.leadingIcon&&(0,r.jsx)("div",{className:a.leadingIcon,children:e.leadingIcon}),(0,r.jsxs)("div",{className:a.text,children:[(0,r.jsx)(y.E,{slot:"label",className:(0,W.A)(a.title,n.label),children:e.label}),e.description&&(0,r.jsx)(y.E,{slot:"description",className:a.description,children:e.description})]})]})})}function et({section:e}){let{ownProps:t}=(0,o.Z)(g,{}),{classes:a}=t;return(0,r.jsxs)(M.rd,{className:a.root,children:[(0,r.jsx)(Y.Y,{className:a.header,children:e.title}),e.options.map(e=>(0,r.jsx)(ee,{option:e},e.id))]})}function ea(e){return"options"in e?(0,r.jsx)(et,{section:e},e.title):(0,r.jsx)(ee,{option:e},e.id)}function er({normalizedOptions:e,retainedOptions:t,items:a,children:n,dependencies:i}){return e?(0,r.jsxs)(r.Fragment,{children:[e.map(ea),Array.from(t??[],e=>(0,r.jsx)(ee,{option:e},e.id))]}):a?(0,r.jsx)(F.pM,{items:a,dependencies:i,children:e=>"function"==typeof n?n(e):(0,r.jsx)(ee,{option:e})}):n}function en({isLoading:e,className:t,rowClassName:a}){return e?(0,r.jsx)(X,{count:3,className:t,rowClassName:a}):(0,r.jsx)(G,{})}function ei({loading:e,isCollectionLoading:t,isIndicatorVisible:a,className:n,rowClassName:i}){if(!e?.onLoadMore||t)return null;let o="loadingMore"===e.state?void 0:e.onLoadMore;return(0,r.jsx)(M.CI,{isLoading:a,onLoadMore:o,scrollOffset:0,children:(0,r.jsx)(X,{count:1,className:n,rowClassName:i})})}function eo(e){let{ownProps:t}=(0,o.Z)(p,e),{classes:a,options:n,items:i,children:l,dependencies:s,loading:d,isStale:c,retainedOptions:u}=t,m=n&&V(n),f=d?.state==="loading"||d?.state==="filtering"||d?.state==="sorting",h=f||d?.state==="loadingMore",g=J(c??!1,300),b=J(d?.state==="loadingMore",300),y=(0,r.jsxs)(M.qF,{className:a.root,"data-stale":g||void 0,renderEmptyState:()=>(0,r.jsx)(en,{isLoading:f,className:a.loading,rowClassName:a.loadingRow}),children:[(0,r.jsx)(er,{normalizedOptions:m,retainedOptions:u,items:i,dependencies:s,children:l}),(0,r.jsx)(ei,{loading:d,isCollectionLoading:f,isIndicatorVisible:b,className:a.loading,rowClassName:a.loadingRow})]});return(0,r.jsx)("div",{"aria-busy":h||void 0,children:y})}function el(e){let{contains:t}=(0,D.U)({sensitivity:"base"}),{ownProps:a}=(0,o.Z)(u,e),{classes:n,search:i,options:l,items:s,children:d,dependencies:c,loading:p,isStale:m,visibleIds:f,retainedOptions:h}=a,g=(0,r.jsx)("div",{className:n.results,children:(0,r.jsx)(eo,{options:l,items:s,dependencies:c,loading:p,isStale:m,retainedOptions:h,children:d})});if(!i)return(0,r.jsx)("div",{className:n.root,children:g});let b="object"==typeof i?i:void 0,y=b?.placeholder??"Search...",v=function({visibleIds:e,filter:t,contains:a}){return e?(t,a,r)=>e.has(r.key):t?(e,a,r)=>t(r.value,a):(e,t)=>a(e,t)}({visibleIds:f,filter:b?.filter,contains:t});return(0,r.jsx)(E.jT,{inputValue:b?.inputValue,defaultInputValue:b?.defaultInputValue,onInputChange:b?.onInputChange,filter:v,children:(0,r.jsxs)("div",{className:n.root,children:[(0,r.jsxs)(O.L,{autoFocus:!0,className:n.searchWrapper,"aria-label":y,children:[(0,r.jsx)(z.p,{placeholder:y,className:n.search}),(0,r.jsx)(R.$,{className:n.searchClear,children:(0,r.jsx)(I.qFd,{})})]}),g]})})}let es=(0,n.forwardRef)(function(e,t){let{ownProps:a,restProps:l,dataAttributes:s}=(0,o.Z)(d,{placeholder:"Select an option",...e}),{classes:c,label:u,description:p,options:m,icon:f,searchable:h,searchPlaceholder:g,search:b,loading:y,items:v,children:j,dependencies:C,isRequired:w,secondaryLabel:N}=a,A=l["aria-label"],k=l["aria-labelledby"];(0,n.useEffect)(()=>{u||A||k||console.warn("Select requires either a visible label, aria-label, or aria-labelledby for accessibility")},[u,A,k]);let P=function({search:e,searchable:t,searchPlaceholder:a}){return void 0!==e?e:t?{placeholder:a}:void 0}({search:b,searchable:h,searchPlaceholder:g}),T=function({options:e,items:t}){let a=Array.isArray(e)?e:void 0,r=a?V(a):void 0,n=r?r.flatMap(e=>"options"in e?e.options:e):void 0,i=e&&!Array.isArray(e)?e:void 0;return void 0!==t?{options:a,flatOptions:n,source:t,rendersItems:!0}:void 0!==i?{options:a,flatOptions:n,source:i,rendersItems:!0}:{options:a,flatOptions:n,source:n??[],rendersItems:!1}}({options:m,items:v}),R=void 0!==l.value?l.value:l.selectedKey,I=void 0!==l.defaultValue?l.defaultValue:l.defaultSelectedKey,E=function({selectedKeys:e,defaultSelectedKeys:t,onSelectionChange:a}){let[r,i]=(0,n.useState)(()=>t??new Set);return{selectedKeys:e??r,onSelectionChange:(0,n.useCallback)(e=>{i(e),a?.(e)},[a])}}({selectedKeys:void 0===R?void 0:Z(R),defaultSelectedKeys:Z(I)}),O=function({items:e,selectedKeys:t=[],search:a,loading:r,retainSelectedItems:i=!0}){let o,l,s,d=(0,n.useRef)(new Map);"object"==typeof e&&null!==e&&"items"in e&&"filterText"in e&&"setFilterText"in e&&"loadingState"in e&&"loadMore"in e?(o=e,l=[...e.items]):l=Array.from(e);let c=new Set(t),u="object"==typeof a?a:void 0,p=u?.mode==="server";for(let e of d.current.keys())c.has(e)||d.current.delete(e);for(let e of l)c.has(e.id)&&d.current.set(e.id,e);let m=H(l),f=l;p&&i&&(f=[...l,...Array.from(d.current.entries()).filter(([e])=>!m.has(e)).map(([,e])=>e)],s=m);let h=r;o&&(h={state:o.loadingState,onLoadMore:o.loadMore});let g=u?.inputValue,b=u?.onInputChange;return o&&p&&(g=o.filterText,b=o.setFilterText),{canonicalItems:f,visibleIds:s,loading:h,isStale:l.length>0&&(h?.state==="filtering"||h?.state==="sorting"),inputValue:g,defaultInputValue:u?.defaultInputValue,onInputChange:b}}({items:T.source,selectedKeys:E.selectedKeys,search:P,loading:y}),z=function(e,t){if(!e)return;let a=H(e);return t.filter(e=>!a.has(e.id))}(T.flatOptions,O.canonicalItems),D=T.rendersItems?O.canonicalItems:void 0,M="object"!=typeof P?P:{...P,inputValue:O.inputValue,defaultInputValue:O.defaultInputValue,onInputChange:O.onInputChange};return(0,r.jsxs)(i.l6,{className:c.root,...s,ref:t,...l,onChange:e=>{E.onSelectionChange(Z(e)),l.onChange?.(e)},allowsEmptyCollection:!0,children:[(0,r.jsx)(x,{label:u,secondaryLabel:N||(w?"Required":null),description:p,descriptionSlot:"description"}),(0,r.jsx)(K,{icon:f}),(0,r.jsx)(S,{}),(0,r.jsx)(L,{className:c.popover,hideArrow:!0,...s,children:(0,r.jsx)(el,{search:M,options:T.options,items:D,dependencies:C,loading:O.loading,isStale:O.isStale,visibleIds:O.visibleIds,retainedOptions:z,children:j})})]})});es.displayName="Select"},74616(e,t,a){a.d(t,{E:()=>o});var r=a(31085),n=a(63878);let i=(0,a(48119).p)()({styles:{"bui-Skeleton":"dQdXlDCvsLk1w8Z3"},classNames:{root:"bui-Skeleton"},bg:"consumer",propDefs:{width:{default:80},height:{default:24},rounded:{dataAttribute:!0,default:!1},className:{},style:{}}}),o=e=>{let{ownProps:t,restProps:a,dataAttributes:o}=(0,n.Z)(i,e),{classes:l,width:s,height:d,style:c}=t;return(0,r.jsx)("div",{className:l.root,...o,style:{width:s,height:d,...c},...a})}},28822(e,t,a){a.d(t,{f:()=>l});var r=a(31085),n=a(89996),i=a(63878),o=a(52589);let l=e=>{let{ownProps:t,restProps:a}=(0,i.Z)(o.sv,e);return(0,r.jsx)(n.fh,{className:t.classes.root,...a})};l.displayName="Cell"},34567(e,t,a){a.d(t,{i:()=>d});var r=a(31085),n=a(69749),i=a(12860),o=a(89996),l=a(63878),s=a(52589);let d=e=>{let{ownProps:t,restProps:a}=(0,l.Z)(s.fO,e),{classes:d,title:c,description:u,color:p,leadingIcon:m,href:f}=t;return(0,r.jsx)(o.fh,{className:d.root,...a,children:(0,r.jsxs)("div",{className:d.cellContentWrapper,children:[m&&(0,r.jsx)("div",{className:d.cellIcon,children:m}),(0,r.jsxs)("div",{className:d.cellContent,children:[f?(0,r.jsx)(i.N,{href:f,variant:"body-medium",color:p,truncate:!0,title:c,children:c}):(0,r.jsx)(n.E,{as:"p",variant:"body-medium",color:p,truncate:!0,title:c,children:c}),u&&(0,r.jsx)(n.E,{variant:"body-medium",color:"secondary",truncate:!0,title:u,children:u})]})]})})};d.displayName="CellText"},34292(e,t,a){a.d(t,{V:()=>s});var r=a(31085),n=a(89996),i=a(63878),o=a(52589),l=a(63690);let s=e=>{let{ownProps:t,restProps:a}=(0,i.Z)(o.a9,e),{classes:s,children:d}=t;return(0,r.jsx)(n.VP,{className:s.root,...a,children:({allowsSorting:e})=>(0,r.jsxs)("div",{className:s.headContent,children:[(0,r.jsx)("span",{className:s.headLabel,children:d}),e&&(0,r.jsx)("span",{"aria-hidden":"true",className:s.headSortButton,children:(0,r.jsx)(l.avw,{size:16})})]})})}},41077(e,t,a){a.d(t,{X:()=>O});var r=a(31085),n=a(47499),i=a(89996),o=a(83374),l=a(33830),s=a(63878),d=a(52589),c=a(36289);let u=e=>{let{ownProps:t,restProps:a,dataAttributes:n}=(0,s.Z)(d.ul,{...e,isPending:!!e.isPending||!!e.loading||(e.isPending??e.loading)});return(0,r.jsx)(c.S,{children:(0,r.jsx)(i.XI,{className:t.classes.root,"aria-label":"Data table","aria-busy":t.stale||t.isPending,...n,...a})})};var p=a(87426),m=a(77479),f=a(34292),h=a(73880);let g=e=>{let{selectionBehavior:t,selectionMode:a}=(0,i.mz)(),{ownProps:n,restProps:o}=(0,s.Z)(d.P2,e),{classes:l,columns:c,children:u}=n;return(0,r.jsxs)(i.A0,{className:l.root,...o,children:["toggle"===t&&"multiple"===a&&(0,r.jsx)(f.V,{width:40,minWidth:40,maxWidth:40,className:l.headSelection,children:(0,r.jsx)(h.s,{justify:"center",align:"center","aria-label":"Row selection",children:(0,r.jsx)(m.S,{slot:"selection","aria-label":"Select all"})})}),(0,r.jsx)(p.pM,{items:c,children:u})]})},b=e=>{let{ownProps:t,restProps:a}=(0,s.Z)(d.kM,e);return(0,r.jsx)(i.BF,{className:t.classes.root,...a})};var y=a(83740),v=a(54357);function x(e){let{ownProps:t,restProps:a,dataAttributes:n,analytics:o}=(0,s.Z)(d.qZ,e),{classes:l,columns:c,children:u}=t,f=a.href,g=(0,y.i9)(f),b=!!f&&!g,x=!!f&&g,j=!!a.onAction||!!f,C=x?"_blank":a.target,S="_blank"===C?[...new Set(["noopener","noreferrer",...a.rel?.split(/\s+/).filter(Boolean)??[]])].join(" "):a.rel,w=j?()=>{a.onAction?.(),f&&o.captureEvent("click",f,{attributes:{to:String(f)}})}:void 0,{selectionBehavior:N,selectionMode:A}=(0,i.mz)(),k=(0,r.jsxs)(r.Fragment,{children:["toggle"===N&&"multiple"===A&&(0,r.jsx)(i.fh,{className:(0,v.A)(l.cell,l.cellSelection),children:(0,r.jsx)(h.s,{justify:"center",align:"center",children:(0,r.jsx)(m.S,{slot:"selection","aria-label":"Select row"})})}),(0,r.jsx)(p.pM,{items:c,children:u})]});return(0,r.jsx)(i.fI,{...a,...n,target:C,rel:S,className:(0,v.A)(l.root,a.className),"data-react-aria-pressable":b?"true":void 0,onAction:w,children:k})}var j=a(69749),C=a(32725),S=a(495);let w=(0,a(48119).p)()({styles:{"bui-TablePagination":"Z_Iagacz0F1YYG04","bui-TablePaginationLeft":"N_pRbW6lVsY4Hdgf","bui-TablePaginationRight":"qXYnm03BkEcKl1FA","bui-TablePaginationSelect":"plzZlLJyZhc3wn3s"},classNames:{root:"bui-TablePagination",left:"bui-TablePaginationLeft",right:"bui-TablePaginationRight",select:"bui-TablePaginationSelect"},propDefs:{pageSize:{},pageSizeOptions:{default:[{label:"Show 5 results",value:5},{label:"Show 10 results",value:10},{label:"Show 20 results",value:20},{label:"Show 30 results",value:30},{label:"Show 40 results",value:40},{label:"Show 50 results",value:50}]},offset:{},totalCount:{},hasNextPage:{},hasPreviousPage:{},onNextPage:{},onPreviousPage:{},onPageSizeChange:{},showPageSizeOptions:{default:!0},getLabel:{},showPaginationLabel:{default:!0}}});var N=a(63690),A=a(14041);function k(e){return"number"==typeof e?e:e.value}function P(e){let{ownProps:t}=(0,s.Z)(w,e),{classes:a,pageSize:i,pageSizeOptions:o,offset:l,totalCount:d,hasNextPage:c,hasPreviousPage:u,onNextPage:p,onPreviousPage:m,onPageSizeChange:f,showPageSizeOptions:h,getLabel:g,showPaginationLabel:b}=t,y=(0,n.Bi)(),v=(0,A.useMemo)(()=>o.length>0&&"number"==typeof o[0]?o.map(e=>({label:`Show ${e} results`,value:e})):o,[o]),x=(0,A.useMemo)(()=>{if(o.some(e=>k(e)===i))return i;let e=k(o[0]);return console.warn(`TablePagination: pageSize ${i} is not in pageSizeOptions, using ${e} instead`),e},[i,o]),P=void 0!==d&&0!==d&&!1!==b,T=`${d} items`;if(g)T=g({pageSize:x,offset:l,totalCount:d});else if(void 0!==l){let e=l+1,t=Math.min(l+x,d??0);T=`${e} - ${t} of ${d}`}return(0,r.jsxs)("div",{className:a.root,children:[(0,r.jsx)("div",{className:a.left,children:h&&(0,r.jsx)(S.l,{name:"pageSize",size:"small","aria-label":"Select table page size",options:v.map(e=>({label:e.label,value:String(e.value)})),defaultValue:x.toString(),onChange:e=>{let t=Number(e);f?.(t)},className:a.select})}),(0,r.jsxs)("div",{className:a.right,children:[P&&(0,r.jsx)(j.E,{as:"p",variant:"body-medium",id:y,children:T}),(0,r.jsx)(C.a,{variant:"secondary",size:"small",onClick:m,isDisabled:!u,icon:(0,r.jsx)(N.vMW,{}),"aria-label":"Previous table page","aria-describedby":P?y:void 0}),(0,r.jsx)(C.a,{variant:"secondary",size:"small",onClick:p,isDisabled:!c,icon:(0,r.jsx)(N.ye6,{}),"aria-label":"Next table page","aria-describedby":P?y:void 0})]})]})}var T=a(82604),L=a(28822),R=a(74616);let I=["75%","50%","60%","45%","70%"],K=Array.from({length:5},(e,t)=>({id:`skeleton-${t}`,index:t}));function E({columns:e}){return(0,r.jsx)(b,{items:K,dependencies:[e],children:t=>{let a=t.index;return(0,r.jsx)(x,{id:t.id,columns:e,children:t=>(0,r.jsx)(L.f,{"aria-hidden":"true",children:(0,r.jsx)(R.E,{width:I[(a+e.indexOf(t))%I.length]})},t.id)})}})}function O({columnConfig:e,data:t,isPending:a=!1,loading:c=!1,isStale:p=!1,error:m,pagination:y,sort:v,rowConfig:C,selection:S,emptyState:w,className:N,style:k,virtualized:L}){let R,I,{ownProps:{classes:K}}=(0,s.Z)(d.Lu,{className:N}),z=(0,n.Bi)(),D=(0,A.useMemo)(()=>e.filter(e=>!e.isHidden),[e]),M=function({data:e,rowConfig:t}){return(0,A.useMemo)(()=>{if(e&&"function"!=typeof t&&t?.getIsDisabled)return e.reduce((e,a)=>(t.getIsDisabled?.(a)&&e.add(String(a.id)),e),new Set)},[e,t])}({data:t,rowConfig:C}),{mode:Y,selected:F,behavior:W,onSelectionChange:B}=S||{},V=(a||c)&&!t;if(m)return(0,r.jsx)("div",{className:K.root,style:k,children:(0,r.jsxs)(j.E,{variant:"body-medium",children:["Error: ",m.message]})});let H=function(e,t,a,r){if(a)return"Loading table data.";if(!r||"none"===e.type)return"";let{pageSize:n,offset:i,totalCount:o,getLabel:l}=e;if(t)return"Loading table data.";let s="Table page loaded. ";if(l)s+=l({pageSize:n,offset:i,totalCount:o});else if(void 0!==i){let e=i+1,t=Math.min(i+n,o??0);s+=`Showing ${e} to ${t} of ${o}`}return s}(y,p,V,void 0!==t),Z=e.some(e=>null!=e.width||null!=e.minWidth||null!=e.maxWidth||null!=e.defaultWidth)?e=>(0,r.jsx)(i.tk,{className:K.resizableContainer,children:e}):e=>(0,r.jsx)(r.Fragment,{children:e});return(0,r.jsxs)("div",{className:K.root,style:k,children:[(0,r.jsx)(T.s,{"aria-live":"polite",id:z,children:H}),Z((R=(0,r.jsxs)(u,{...V?{}:{selectionMode:Y,selectionBehavior:W,selectedKeys:F,onSelectionChange:B},sortDescriptor:v?.descriptor??void 0,onSortChange:v?.onSortChange,disabledKeys:M,stale:p,isPending:V,"aria-describedby":z,children:[(0,r.jsx)(g,{columns:D,children:e=>e.header?e.header():(0,r.jsx)(f.V,{id:e.id,isRowHeader:e.isRowHeader,allowsSorting:e.isSortable,width:e.width,defaultWidth:e.defaultWidth,minWidth:e.minWidth,maxWidth:e.maxWidth,children:e.label})}),V?(0,r.jsx)(E,{columns:D}):(0,r.jsx)(b,{items:t,dependencies:[D],renderEmptyState:w?()=>(0,r.jsx)(h.s,{p:"3",children:w}):void 0,children:e=>{let a=t?.indexOf(e)??-1;return"function"==typeof C?C({item:e,index:a}):(0,r.jsx)(x,{id:String(e.id),columns:D,href:C?.getHref?.(e),onAction:C?.onClick?()=>C?.onClick?.(e):void 0,children:t=>t.cell(e)})}})]}),I=L?(0,r.jsx)(o.Y,{layout:l.$,layoutOptions:"object"==typeof L?L:void 0,children:R}):R,(0,r.jsx)("div",{className:K.scrollContainer,children:I}))),"page"===y.type&&(0,r.jsx)(P,{pageSize:y.pageSize,pageSizeOptions:y.pageSizeOptions,offset:y.offset,totalCount:y.totalCount,hasNextPage:y.hasNextPage,hasPreviousPage:y.hasPreviousPage,onNextPage:y.onNextPage,onPreviousPage:y.onPreviousPage,onPageSizeChange:y.onPageSizeChange,showPageSizeOptions:y.showPageSizeOptions,getLabel:y.getLabel,showPaginationLabel:y.showPaginationLabel})]})}},52589(e,t,a){a.d(t,{sv:()=>u,ul:()=>o,qZ:()=>d,kM:()=>s,P2:()=>l,Lu:()=>i,fO:()=>p,a9:()=>c});var r=a(48119);let n={"bui-TableWrapper":"v8W8N2dqiE5cGNxm","bui-TableResizableContainer":"Q3dVWKchqFEGDxNm","bui-TableScrollContainer":"cae_vIXVMIPSb9LO","bui-Table":"kHZPXvGYPYAGYFhf","bui-TableHeader":"oifZQr6gC_QyhRzd","bui-TableHead":"X8xcDL8E6rIYbeSR","bui-TableHeadSelection":"ae9pE72Zc07f8L6W","bui-TableHeadContent":"d_1Lwe7cMab7Y7x8","bui-TableHeadLabel":"c2mE5YTadTwCB9Cv","bui-TableHeadSortButton":"U0p16BfATSMI0pZa","bui-TableBody":"RevIL7d7UeIjyBcV","bui-TableRow":"kPJhRwYa5RAAhwxF","bui-TableCell":"lBJ1evBwz18CSuEb","bui-TableCellSelection":"waN8m81er3MmoNwQ","bui-TableCellContentWrapper":"AQrmv2_3dWQm8mkC","bui-TableCellIcon":"pZfxgqebmIQNGPFo","bui-TableCellContent":"VL_PIHABTKklOpWr","bui-TableCellProfile":"qco3EFeJwhQRop02"},i=(0,r.p)()({styles:n,classNames:{root:"bui-TableWrapper",resizableContainer:"bui-TableResizableContainer",scrollContainer:"bui-TableScrollContainer"},propDefs:{className:{}}}),o=(0,r.p)()({styles:n,classNames:{root:"bui-Table"},propDefs:{stale:{dataAttribute:!0},isPending:{dataAttribute:!0},loading:{dataAttribute:!0}}}),l=(0,r.p)()({styles:n,classNames:{root:"bui-TableHeader",headSelection:"bui-TableHeadSelection"},propDefs:{columns:{},children:{}}}),s=(0,r.p)()({styles:n,classNames:{root:"bui-TableBody"},propDefs:{}}),d=(0,r.p)()({styles:n,analytics:!0,bg:"consumer",classNames:{root:"bui-TableRow",cell:"bui-TableCell",cellSelection:"bui-TableCellSelection"},propDefs:{columns:{},children:{},noTrack:{}}}),c=(0,r.p)()({styles:n,classNames:{root:"bui-TableHead",headContent:"bui-TableHeadContent",headLabel:"bui-TableHeadLabel",headSortButton:"bui-TableHeadSortButton"},propDefs:{children:{},className:{}}}),u=(0,r.p)()({styles:n,classNames:{root:"bui-TableCell"},propDefs:{className:{}}}),p=(0,r.p)()({styles:n,classNames:{root:"bui-TableCell",cellContentWrapper:"bui-TableCellContentWrapper",cellContent:"bui-TableCellContent",cellIcon:"bui-TableCellIcon"},propDefs:{title:{},description:{},color:{default:"primary"},leadingIcon:{},href:{},className:{}}});(0,r.p)()({styles:n,classNames:{root:"bui-TableCell",cellContentWrapper:"bui-TableCellContentWrapper",cellContent:"bui-TableCellContent"},propDefs:{src:{},name:{},href:{},description:{},color:{default:"primary"},className:{}}})},38390(e,t,a){a.d(t,{K:()=>h});var r=a(14041);function n(e,t,a){let[n,i]=(0,r.useState)(e);return[void 0!==t?t:n,(0,r.useCallback)(e=>{void 0===t&&i(e),a&&a(e)},[t,a])]}function i(e){let t=(0,r.useRef)(e);return t.current=e,(0,r.useCallback)((...e)=>t.current(...e),[])}function o(e,t){let[a,n]=(0,r.useState)(e);return(0,r.useEffect)(()=>{if(t<=0)return;let a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},[e,t]),t<=0?e:a}function l(e){return"number"==typeof e?e:e.value}function s(e){let{pageSize:t,pageSizeOptions:a}=e;if(!a)return t??20;let r=l(a[0]);return void 0===t?r:a.some(e=>l(e)===t)?t:(console.warn(`useTable: pageSize ${t} is not in pageSizeOptions, using ${r} instead`),r)}let d=Symbol("firstPage");class c{cache=new Map;get(e){return this.cache.get(e)}getOrCreate(e){let t=this.cache.get(e);if(t)return t;let a={data:void 0,nextCursor:void 0,prevCursor:void 0};return this.cache.set(e,a),a}clear(){this.cache.clear()}getTargetCursor(e,t,a){if("mount"===e)return u(a);if("reset"===e)return d;if("refresh"===e)return t;let r=this.cache.get(t);if(r)return"next"===e?r.nextCursor:r.prevCursor}linkEntryToSource(e,t,a){"next"===t?e.prevCursor=a:"prev"===t&&(e.nextCursor=a)}}function u(e){return void 0===e?d:e}function p(e){return e===d?void 0:e}function m(e){let{getData:t,initialCurrentCursor:a}=e,[n,i]=(0,r.useState)(()=>u(a)),o=(0,r.useRef)(new c).current,[l,s]=(0,r.useState)(!0),[d,m]=(0,r.useState)(void 0),[f,h]=(0,r.useState)(void 0),[,g]=(0,r.useReducer)(e=>e+1,0),b=(0,r.useRef)(null),y=o.get(n),v=y?.data,x=y?.nextCursor!==void 0,j=y?.prevCursor!==void 0,C=(0,r.useCallback)(async e=>{let r=o.getTargetCursor(e,n,a);if(void 0===r)return;let l=o.get(r);if(l?.data!==void 0){i(r),m(void 0);return}let d=o.getOrCreate(r);o.linkEntryToSource(d,e,n),i(r),b.current&&b.current.abort();let c=new AbortController;b.current=c,s(!0),m(void 0);try{let e=await t({cursor:p(r),signal:c.signal});if(c.signal.aborted)return;d.data=e.data,void 0===d.nextCursor&&void 0!==e.nextCursor&&(d.nextCursor=e.nextCursor),void 0===d.prevCursor&&void 0!==e.prevCursor&&(d.prevCursor=e.prevCursor),void 0!==e.totalCount&&h(e.totalCount),g(),s(!1)}catch(e){if(c.signal.aborted)return;m(e instanceof Error?e:Error(String(e))),s(!1)}},[t,a,n,o]);(0,r.useEffect)(()=>(C("mount"),()=>{b.current&&b.current.abort()}),[]);let S=(0,r.useCallback)(()=>{if(l)return;let e=o.get(n);e?.nextCursor!==void 0&&C("next")},[l,n,C,o]),w=(0,r.useCallback)(()=>{if(l)return;let e=o.get(n);e?.prevCursor!==void 0&&C("prev")},[l,n,C,o]),N=(0,r.useCallback)(e=>{b.current&&b.current.abort(),o.clear(),C(e?.keepCurrentCursor?"refresh":"reset")},[C,o]);return{isPending:l,error:d,data:v,totalCount:f,currentCursor:p(n),hasPreviousPage:j,onPreviousPage:w,hasNextPage:x,onNextPage:S,reload:N}}function f(e,t,a,n=200){let{sort:i,filter:o,search:l}=e,s=(0,r.useRef)({sort:i,filter:o,search:l,pageSize:t});(0,r.useEffect)(()=>{let e=s.current;if(e.sort!==i||e.filter!==o||e.search!==l||e.pageSize!==t){s.current={sort:i,filter:o,search:l,pageSize:t};let e=setTimeout(a,n);return()=>clearTimeout(e)}},[i,o,l,t,a,n])}function h(e){let t,a=function(e){let[t,a]=n(e.initialSort??null,e.sort,e.onSortChange),[i,o]=n(e.initialFilter,e.filter,e.onFilterChange),[l,s]=n(e.initialSearch??"",e.search,e.onSearchChange);return(0,r.useMemo)(()=>({sort:t,setSort:a,filter:i,setFilter:o,search:l,setSearch:s}),[t,a,i,o,l,s])}(e),l=(0,r.useRef)(e.mode);if(l.current!==e.mode)throw Error(`useTable mode cannot change from '${l.current}' to '${e.mode}'. The mode must remain stable for the lifetime of the component.`);if("complete"===e.mode)t=function(e,t){let{data:a,getData:n=()=>[],paginationOptions:l={},sortFn:d,filterFn:c,searchFn:u,searchDebounceMs:p=0,filterDebounceMs:m=0}=e,f="getData"in e,h="none"===l.type,{initialOffset:g=0}=l,b=h?1/0:s(l),y=i(n),{sort:v,filter:x,search:j}=t,[C,S]=(0,r.useState)(void 0),[w,N]=(0,r.useState)(!a),[A,k]=(0,r.useState)(void 0),[P,T]=(0,r.useState)(0),[L,R]=(0,r.useState)(g),[I,K]=(0,r.useState)(b),E=(0,r.useRef)(b);(0,r.useEffect)(()=>{E.current!==b&&(E.current=b,K(b),R(0))},[b]),(0,r.useEffect)(()=>{if(a)return void N(!1);if(!f)return void N(!0);let e=!1;return N(!0),k(void 0),(async()=>{try{let t=y(),a=t instanceof Promise?await t:t;e||(S(a),N(!1))}catch(t){e||(k(t instanceof Error?t:Error(String(t))),N(!1))}})(),()=>{e=!0}},[a,y,f,P]);let O=o(j,p),z=o(x,m),D=(0,r.useMemo)(()=>({sort:v,filter:z,search:O}),[v,z,O]),M=(0,r.useRef)(D);(0,r.useEffect)(()=>{M.current!==D&&(M.current=D,R(0))},[D]);let Y=(0,r.useMemo)(()=>a??C,[a,C]),F=(0,r.useMemo)(()=>{if(!Y)return;let e=[...Y];return void 0!==z&&c&&(e=c(e,z)),O&&u&&(e=u(e,O)),v&&d&&(e=d(e,v)),e},[Y,v,z,O,c,u,d]),W=(0,r.useRef)(F);void 0!==F&&(W.current=F);let B=F??W.current,V=B?.length??0,H=(0,r.useMemo)(()=>h?0:void 0===B?L:0===V?0:Math.min(L,Math.floor((V-1)/I)*I),[h,L,I,B,V]);(0,r.useEffect)(()=>{L!==H&&R(H)},[H,L]);let Z=(0,r.useMemo)(()=>h?B:B?.slice(H,H+I),[B,H,I,h]),$=!h&&H+I<V,_=!h&&H>0,U=(0,r.useCallback)(()=>{H+I<V&&R(H+I)},[H,I,V]),q=(0,r.useCallback)(()=>{H>0&&R(Math.max(0,H-I))},[H,I]);return{data:Z,isPending:w,error:A,totalCount:V,offset:H,pageSize:I,hasNextPage:$,hasPreviousPage:_,onNextPage:U,onPreviousPage:q,onPageSizeChange:(0,r.useCallback)(e=>{K(e),R(0)},[]),reload:(0,r.useCallback)(()=>{R(0),T(e=>e+1)},[])}}(e,a);else if("offset"===e.mode)t=function(e,t){let{getData:a,paginationOptions:n={}}=e,{initialOffset:o=0}=n,l=s(n),d=i(a),{sort:c,filter:u,search:p}=t,[h,g]=(0,r.useState)(l),b=m({getData:(0,r.useCallback)(async({cursor:e,signal:t})=>{let a=e??0,r=await d({offset:a,pageSize:h,sort:c,filter:u,search:p,signal:t}),n=a>0?Math.max(0,a-h):void 0,i=a+h<r.totalCount?a+h:void 0;return{data:r.data,prevCursor:n,nextCursor:i,totalCount:r.totalCount}},[d,h,c,u,p]),initialCurrentCursor:o>0?o:void 0});f(t,h,b.reload);let y=(0,r.useCallback)(e=>g(e),[]);return{data:b.data,isPending:b.isPending,error:b.error,totalCount:b.totalCount,offset:b.currentCursor??0,pageSize:h,hasNextPage:b.hasNextPage,hasPreviousPage:b.hasPreviousPage,onNextPage:b.onNextPage,onPreviousPage:b.onPreviousPage,onPageSizeChange:y,reload:b.reload}}(e,a);else if("cursor"===e.mode)t=function(e,t){let{getData:a,paginationOptions:n={}}=e,o=s(n),l=i(a),{sort:d,filter:c,search:u}=t,[p,h]=(0,r.useState)(o),g=m({getData:(0,r.useCallback)(async({cursor:e,signal:t})=>{let a=await l({cursor:e,pageSize:p,sort:d,filter:c,search:u,signal:t});return{data:a.data,prevCursor:a.prevCursor,nextCursor:a.nextCursor,totalCount:a.totalCount}},[l,p,d,c,u])});f(t,p,g.reload);let b=(0,r.useCallback)(e=>h(e),[]);return{data:g.data,isPending:g.isPending,error:g.error,totalCount:g.totalCount,offset:void 0,pageSize:p,hasNextPage:g.hasNextPage,hasPreviousPage:g.hasPreviousPage,onNextPage:g.onNextPage,onPreviousPage:g.onPreviousPage,onPageSizeChange:b,reload:g.reload}}(e,a);else throw Error("Invalid mode");return{tableProps:function(e,t,a={}){let{showPageSizeOptions:n=!0,pageSizeOptions:i,onPageSizeChange:o,onNextPage:l,onPreviousPage:s,getLabel:d,showPaginationLabel:c}=a,u=(0,r.useRef)(e.data);e.data&&(u.current=e.data);let p=e.data??u.current,m=e.isPending&&void 0!==p,f=(0,r.useMemo)(()=>"none"===a.type?{type:"none"}:{type:"page",pageSize:e.pageSize,pageSizeOptions:i,offset:e.offset,totalCount:e.totalCount,hasNextPage:e.hasNextPage,hasPreviousPage:e.hasPreviousPage,onNextPage:()=>{e.onNextPage(),l?.()},onPreviousPage:()=>{e.onPreviousPage(),s?.()},onPageSizeChange:t=>{e.onPageSizeChange(t),o?.(t)},showPageSizeOptions:n,getLabel:d,showPaginationLabel:c},[a.type,e.pageSize,i,e.offset,e.totalCount,e.hasNextPage,e.hasPreviousPage,e.onNextPage,e.onPreviousPage,e.onPageSizeChange,l,s,o,n,d,c]);return(0,r.useMemo)(()=>({data:p,isPending:e.isPending,loading:e.isPending,isStale:m,error:e.error,pagination:f,sort:t}),[p,e.isPending,m,e.error,f,t])}(t,(0,r.useMemo)(()=>({descriptor:a.sort,onSortChange:a.setSort}),[a.sort,a.setSort]),e.paginationOptions??{}),reload:t.reload,filter:{value:a.filter,onChange:a.setFilter},search:{value:a.search,onChange:a.setSearch}}}},43311(e,t,a){a.d(t,{E:()=>i});var r=a(58077),n=a(47196);function i(e,t,a){if(a){let n="string"==typeof e||"metadata"in e?e:(0,r.U2)(e);return a.forEntity(n,t).snapshot}return(0,n.T)(e,t)}},45164(e,t,a){a.d(t,{W:()=>f});var r=a(31085),n=a(49185),i=a(34292),o=a(28822),l=a(34567),s=a(3438),d=a(53987),c=a(43311),u=a(19857),p=a(53320);let m=Object.freeze({createEntityRefColumn(e){let t=e.isRowHeader??!0;return{id:"name",label:"Name",header:()=>(0,r.jsx)(i.V,{id:"name",isRowHeader:t,allowsSorting:!0,children:(0,r.jsx)(u.g,{translationKey:"name"})}),isRowHeader:t,isSortable:!0,cell:t=>(0,r.jsx)(o.f,{children:(0,r.jsx)(s.z,{entityRef:t,defaultKind:e.defaultKind,title:t.metadata?.title})}),sortValue:t=>(0,c.E)(t,{defaultKind:e.defaultKind},e.entityPresentationApi).primaryTitle}},createEntityRelationColumn:e=>({id:e.id,label:e.id.charAt(0).toUpperCase()+e.id.slice(1),header:()=>(0,r.jsx)(i.V,{id:e.id,allowsSorting:!0,children:(0,r.jsx)(u.g,{translationKey:e.translationKey})}),isSortable:!0,cell:t=>(0,r.jsx)(o.f,{children:(0,r.jsx)(d.i,{entityRefs:(0,p.t)(t,e.relation,e.filter),defaultKind:e.defaultKind})}),sortValue:t=>(0,p.t)(t,e.relation,e.filter).map(t=>(0,c.E)(t,{defaultKind:e.defaultKind},e.entityPresentationApi).primaryTitle).join(", ")}),createOwnerColumn:()=>m.createEntityRelationColumn({id:"owner",translationKey:"owner",relation:n.vv,defaultKind:"group"}),createSystemColumn:()=>m.createEntityRelationColumn({id:"system",translationKey:"system",relation:n.jn,defaultKind:"system",filter:{kind:"system"}}),createDomainColumn:()=>m.createEntityRelationColumn({id:"domain",translationKey:"domain",relation:n.jn,defaultKind:"domain",filter:{kind:"domain"}}),createMetadataDescriptionColumn:()=>({id:"description",label:"Description",header:()=>(0,r.jsx)(i.V,{id:"description",allowsSorting:!0,children:(0,r.jsx)(u.g,{translationKey:"description"})}),isSortable:!0,cell:e=>(0,r.jsx)(l.i,{title:e.metadata.description??""}),sortValue:e=>e.metadata.description??""}),createSpecTypeColumn:()=>({id:"type",label:"Type",header:()=>(0,r.jsx)(i.V,{id:"type",allowsSorting:!0,children:(0,r.jsx)(u.g,{translationKey:"type"})}),isSortable:!0,cell:e=>(0,r.jsx)(l.i,{title:e.spec?.type??""}),sortValue:e=>e.spec?.type??""}),createSpecLifecycleColumn:()=>({id:"lifecycle",label:"Lifecycle",header:()=>(0,r.jsx)(i.V,{id:"lifecycle",allowsSorting:!0,children:(0,r.jsx)(u.g,{translationKey:"lifecycle"})}),isSortable:!0,cell:e=>(0,r.jsx)(l.i,{title:e.spec?.lifecycle??""}),sortValue:e=>e.spec?.lifecycle??""})}),f={component:{columns:[m.createEntityRefColumn({defaultKind:"component"}),m.createOwnerColumn(),m.createSpecTypeColumn(),m.createSpecLifecycleColumn(),m.createMetadataDescriptionColumn()],helpLink:"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component"},resource:{columns:[m.createEntityRefColumn({defaultKind:"resource"}),m.createOwnerColumn(),m.createSpecTypeColumn(),m.createSpecLifecycleColumn(),m.createMetadataDescriptionColumn()],helpLink:"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-resource"},system:{columns:[m.createEntityRefColumn({defaultKind:"system"}),m.createOwnerColumn(),m.createMetadataDescriptionColumn()],helpLink:"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system"},domain:{columns:[m.createEntityRefColumn({defaultKind:"domain"}),m.createOwnerColumn(),m.createMetadataDescriptionColumn()],helpLink:"https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain"}}},25390(e,t,a){a.d(t,{o:()=>u});var r=a(31085),n=a(26438),i=a(73880),o=a(69749),l=a(58837),s=a(53373),d=a.n(s);let c=(0,l.A)({root:{height:"100%"},title:{minWidth:0,overflow:"hidden"},footer:{display:"flex",justifyContent:"flex-end"}});function u(e){let{title:t,headerActions:a,footerActions:l,children:s,className:u}=e,p=c();return(0,r.jsxs)(n.Zp,{className:d()(p.root,u),children:[t&&(0,r.jsx)(n.aR,{children:(0,r.jsxs)(i.s,{justify:"between",align:"center",children:[(0,r.jsx)(o.E,{as:"h3",variant:"title-x-small",weight:"bold",className:p.title,children:t}),a&&(0,r.jsx)(i.s,{align:"center",gap:"1",children:a})]})}),(0,r.jsx)(n.bw,{children:s}),l&&(0,r.jsx)(n.wL,{className:p.footer,children:l})]})}},53987(e,t,a){a.d(t,{i:()=>l});var r=a(31085),n=a(58077),i=a(14041),o=a(3438);function l(e){let{entityRefs:t,hideIcons:a,...l}=e;return(0,r.jsx)(r.Fragment,{children:t.map((e,t)=>{let s="string"==typeof e?e:(0,n.U2)(e);return(0,r.jsxs)(i.Fragment,{children:[t>0&&", ",(0,r.jsx)(o.z,{...l,entityRef:e,hideIcon:a})]},`${t}.${s}`)})})}},73955(e,t,a){a.d(t,{s:()=>b});var r=a(31085),n=a(40743),i=a(69749),o=a(12860),l=a(89595),s=a(25390),d=a(58077),c=a(38390),u=a(41077),p=a(14041);function m(e){let{columnConfig:t,data:a,loading:n,error:i,emptyState:o}=e,l=(0,p.useMemo)(()=>a.map(e=>({...e,id:(0,d.U2)(e)})),[a]),s=(0,p.useCallback)((e,a)=>{let r=t.find(e=>e.id===a.column);if(!r?.sortValue)return e;let n=r.sortValue,i="descending"===a.direction?-1:1;return[...e].sort((e,t)=>n(e).localeCompare(n(t))*i)},[t]),{tableProps:m}=(0,c.K)({mode:"complete",data:l,sortFn:s,paginationOptions:{type:"none"}});return(0,r.jsx)(u.X,{columnConfig:t,...m,loading:n,error:i,emptyState:o})}var f=a(22845),h=a(86662),g=a(79811);function b(e){let{title:t,relationType:a,entityKind:d,columnConfig:c,emptyState:u,className:p}=e,{t:b}=(0,l.i)(g.j),{entity:y}=(0,f.tN)(),{entities:v,loading:x,error:j}=(0,h.E)(y,{type:a,kind:d});return(0,r.jsx)(s.o,{title:t,className:p,children:j?(0,r.jsx)(n.F,{status:"warning",icon:!0,title:j.message,role:"status"}):(0,r.jsx)(m,{columnConfig:c,data:v??[],loading:x,emptyState:u&&(0,r.jsxs)(i.E,{as:"p",children:[u.message," ",u.helpLink&&(0,r.jsx)(o.N,{href:u.helpLink,target:"_blank",rel:"noopener noreferrer",variant:"body-medium",children:b("entityRelationCard.emptyHelpLinkTitle")})]})})})}},65671(e,t,a){a.d(t,{s:()=>b});var r=a(31085),n=a(58837),i=a(49185),o=a(98557),l=a(53320),s=a(3438),d=a(53987),c=a(43311),u=a(19857);let p=Object.freeze({createEntityRefColumn(e){let{defaultKind:t,entityPresentationApi:a}=e;function n(e){return(0,c.E)(e,{defaultKind:t},a).primaryTitle}return{title:(0,r.jsx)(u.g,{translationKey:"name"}),highlight:!0,customFilterAndSearch:(e,t)=>n(t).includes(e),customSort:(e,t)=>n(e).localeCompare(n(t)),render:e=>(0,r.jsx)(s.z,{entityRef:e,defaultKind:t,title:e.metadata?.title})}},createEntityRelationColumn(e){let{title:t,relation:a,defaultKind:n,filter:i,entityPresentationApi:o}=e;function s(e){return(0,l.t)(e,a,i)}function u(e){return s(e).map(e=>(0,c.E)(e,{defaultKind:n},o).primaryTitle).join(", ")}return{title:t,customFilterAndSearch:(e,t)=>u(t).includes(e),customSort:(e,t)=>u(e).localeCompare(u(t)),render:e=>(0,r.jsx)(d.i,{entityRefs:s(e),defaultKind:n})}},createOwnerColumn(){return this.createEntityRelationColumn({title:(0,r.jsx)(u.g,{translationKey:"owner"}),relation:i.vv,defaultKind:"group"})},createDomainColumn(){return this.createEntityRelationColumn({title:(0,r.jsx)(u.g,{translationKey:"domain"}),relation:i.jn,defaultKind:"domain",filter:{kind:"domain"}})},createSystemColumn(){return this.createEntityRelationColumn({title:(0,r.jsx)(u.g,{translationKey:"system"}),relation:i.jn,defaultKind:"system",filter:{kind:"system"}})},createMetadataDescriptionColumn:()=>({title:(0,r.jsx)(u.g,{translationKey:"description"}),field:"metadata.description",render:e=>(0,r.jsx)(o.M,{text:e.metadata.description,placement:"bottom-start",line:2})}),createSpecLifecycleColumn:()=>({title:(0,r.jsx)(u.g,{translationKey:"lifecycle"}),field:"spec.lifecycle"}),createSpecTypeColumn:()=>({title:(0,r.jsx)(u.g,{translationKey:"type"}),field:"spec.type"})}),m=[p.createEntityRefColumn({defaultKind:"system"}),p.createDomainColumn(),p.createOwnerColumn(),p.createMetadataDescriptionColumn()],f=[p.createEntityRefColumn({defaultKind:"component"}),p.createSystemColumn(),p.createOwnerColumn(),p.createSpecTypeColumn(),p.createSpecLifecycleColumn(),p.createMetadataDescriptionColumn()];var h=a(28499);let g=(0,n.A)(e=>({empty:{padding:e.spacing(2),display:"flex",justifyContent:"center"}})),b=e=>{let{entities:t,title:a,emptyContent:n,variant:i="gridItem",columns:o,tableOptions:l={}}=e,s=g(),d={minWidth:"0",width:"100%"};return"gridItem"===i&&(d.height="calc(100% - 10px)"),(0,r.jsx)(h.X,{columns:o,title:a,style:d,emptyContent:n&&(0,r.jsx)("div",{className:s.empty,children:n}),options:{search:!1,paging:!1,actionsColumnIndex:-1,padding:"dense",draggable:!1,...l},data:t})};b.columns=p,b.systemEntityColumns=m,b.componentEntityColumns=f},19857(e,t,a){a.d(t,{g:()=>i});var r=a(89595),n=a(79811);let i=({translationKey:e})=>{let{t}=(0,r.i)(n.j);return t(`entityTableColumnTitle.${e}`)}},86662(e,t,a){a.d(t,{E:()=>l});var r=a(58077),n=a(50509),i=a(73466),o=a(76272);function l(e,t){let a=t?.type?.toLocaleLowerCase("en-US"),l=t?.kind?.toLocaleLowerCase("en-US"),s=(0,n.gf)(o.v),{loading:d,value:c,error:u}=(0,i.A)(async()=>{let t=e.relations?.filter(e=>(!a||e.type.toLocaleLowerCase("en-US")===a)&&(!l||(0,r.KU)(e.targetRef).kind===l));if(!t?.length)return[];let{items:n}=await s.getEntitiesByRefs({entityRefs:t.map(e=>e.targetRef)});return n.filter(e=>!!e)},[e,a,l]);return{entities:c,loading:d,error:u}}},53320(e,t,a){a.d(t,{t:()=>n});var r=a(58077);function n(e,t,a){let n=e?.relations?.filter(e=>e.type===t).map(e=>(0,r.KU)(e.targetRef))||[];return a?.kind&&(n=n.filter(e=>e.kind.toLocaleLowerCase("en-US")===a.kind.toLocaleLowerCase("en-US"))),n}},7396(e,t,a){a.d(t,{DependsOnComponentsCard:()=>u});var r=a(31085),n=a(49185),i=a(45164),o=a(73955),l=a(79842),s=a(94376),d=a(50010),c=a(89595);function u(e){let{t}=(0,c.i)(d.W);if("variant"in e||"columns"in e||"tableOptions"in e){let{variant:a="gridItem",title:i=t("dependsOnComponentsCard.title"),columns:o=l.mz,tableOptions:d={}}=e;return(0,r.jsx)(s.p,{variant:a,title:i,entityKind:"Component",relationType:n.nC,columns:o,emptyMessage:t("dependsOnComponentsCard.emptyMessage"),emptyHelpLink:l.e2,asRenderableEntities:l.xJ,tableOptions:d})}let{title:a=t("dependsOnComponentsCard.title"),columnConfig:u=i.W.component.columns}=e;return(0,r.jsx)(o.s,{title:a,entityKind:"Component",relationType:n.nC,columnConfig:u,emptyState:{message:t("dependsOnComponentsCard.emptyMessage"),helpLink:i.W.component.helpLink}})}},94376(e,t,a){a.d(t,{p:()=>h});var r=a(31085),n=a(72501),i=a(22845),o=a(86662),l=a(65671),s=a(89439),d=a(55489),c=a(97673),u=a(60603),p=a(79842),m=a(50010),f=a(89595);let h=e=>{let{variant:t="gridItem",title:a,columns:p,entityKind:h,relationType:g,emptyMessage:b,emptyHelpLink:y,asRenderableEntities:v,tableOptions:x={}}=e,{t:j}=(0,f.i)(m.W),{entity:C}=(0,i.tN)(),{entities:S,loading:w,error:N}=(0,o.E)(C,{type:g,kind:h});return w?(0,r.jsx)(s.n,{variant:t,title:a,children:(0,r.jsx)(d.k,{})}):N?(0,r.jsx)(s.n,{variant:t,title:a,children:(0,r.jsx)(c._,{error:N})}):(0,r.jsx)(l.s,{title:a,variant:t,emptyContent:(0,r.jsxs)("div",{style:{textAlign:"center"},children:[(0,r.jsx)(n.A,{variant:"body1",children:b}),(0,r.jsx)(n.A,{variant:"body2",children:(0,r.jsx)(u.N_,{to:y,externalLinkIcon:!0,children:j("relatedEntitiesCard.emptyHelpLinkTitle")})})]}),columns:p,entities:v(S||[]),tableOptions:x})};h.componentEntityColumns=p.mz,h.componentEntityHelpLink=p.e2,h.asComponentEntities=p.xJ,h.resourceEntityColumns=p.v9,h.resourceEntityHelpLink=p.nz,h.asResourceEntities=p.eB,h.systemEntityColumns=p.MW,h.systemEntityHelpLink=p.iU,h.asSystemEntities=p.vy,h.domainEntityColumns=p.xO,h.domainEntityColums=p.xO,h.domainEntityHelpLink=p.Xr,h.asDomainEntities=p.QS},79842(e,t,a){a.d(t,{MW:()=>c,QS:()=>h,Xr:()=>f,e2:()=>i,eB:()=>d,iU:()=>u,mz:()=>n,nz:()=>s,v9:()=>l,vy:()=>p,xJ:()=>o,xO:()=>m});var r=a(65671);let n=[r.s.columns.createEntityRefColumn({defaultKind:"component"}),r.s.columns.createOwnerColumn(),r.s.columns.createSpecTypeColumn(),r.s.columns.createSpecLifecycleColumn(),r.s.columns.createMetadataDescriptionColumn()],i="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-component",o=e=>e,l=[r.s.columns.createEntityRefColumn({defaultKind:"resource"}),r.s.columns.createOwnerColumn(),r.s.columns.createSpecTypeColumn(),r.s.columns.createSpecLifecycleColumn(),r.s.columns.createMetadataDescriptionColumn()],s="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-resource",d=e=>e,c=[r.s.columns.createEntityRefColumn({defaultKind:"system"}),r.s.columns.createOwnerColumn(),r.s.columns.createMetadataDescriptionColumn()],u="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-system",p=e=>e,m=[r.s.columns.createEntityRefColumn({defaultKind:"domain"}),r.s.columns.createOwnerColumn(),r.s.columns.createMetadataDescriptionColumn()],f="https://backstage.io/docs/features/software-catalog/descriptor-format#kind-domain",h=e=>e}}]);
2
- //# sourceMappingURL=1749.fcf12bbab446.chunk.js.map