archsight 0.4.2 → 0.4.3

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/docs/diagram.md +64 -0
  3. data/docs/modeling.md +3 -1
  4. data/lib/archsight/cli.rb +2 -1
  5. data/lib/archsight/database.rb +4 -3
  6. data/lib/archsight/diagram/cli.rb +11 -1
  7. data/lib/archsight/diagram/errors.rb +1 -0
  8. data/lib/archsight/diagram/includes.rb +168 -0
  9. data/lib/archsight/diagram/parser/ast.rb +5 -0
  10. data/lib/archsight/diagram/parser/table_layout.rb +2 -0
  11. data/lib/archsight/diagram/parser.rb +58 -16
  12. data/lib/archsight/diagram.rb +20 -4
  13. data/lib/archsight/export/confluence/storage.rb +6 -1
  14. data/lib/archsight/helpers/diagram_blocks.rb +34 -19
  15. data/lib/archsight/helpers/diagram_includes.rb +67 -0
  16. data/lib/archsight/helpers.rb +1 -0
  17. data/lib/archsight/linter.rb +10 -2
  18. data/lib/archsight/references.rb +4 -3
  19. data/lib/archsight/resources/application_component.rb +10 -0
  20. data/lib/archsight/resources/application_service.rb +9 -0
  21. data/lib/archsight/resources/technology_service.rb +9 -0
  22. data/lib/archsight/version.rb +1 -1
  23. data/lib/archsight/web/api/json_helpers.rb +3 -2
  24. data/lib/archsight/web/api/openapi/spec.yaml +9 -2
  25. data/lib/archsight/web/api/page_helpers.rb +1 -1
  26. data/lib/archsight/web/api/routes.rb +4 -3
  27. data/lib/archsight/web/application.rb +2 -1
  28. data/lib/archsight/web/public/vue/{DocPage-C8Ysway-.js → DocPage-L0GzDFiV.js} +1 -1
  29. data/lib/archsight/web/public/vue/{EditorPage-pr2MR6_b.js → EditorPage-B3iNbh1u.js} +1 -1
  30. data/lib/archsight/web/public/vue/{ErrorPage-FAkpW-hn.js → ErrorPage-Lro5vwhy.js} +1 -1
  31. data/lib/archsight/web/public/vue/{GraphView-liQJzFyo.js → GraphView-BRKwxa--.js} +1 -1
  32. data/lib/archsight/web/public/vue/{HomePage-DYpzSXG8.js → HomePage-DKgI1DXr.js} +2 -2
  33. data/lib/archsight/web/public/vue/{InstanceRouter-Ca_C8izS.css → InstanceRouter-CJSkGdBG.css} +1 -1
  34. data/lib/archsight/web/public/vue/InstanceRouter-CX6qxVTm.js +1 -0
  35. data/lib/archsight/web/public/vue/{KindList-CrgI4qDb.js → KindList-C556gf23.js} +1 -1
  36. data/lib/archsight/web/public/vue/{PageView-BIxT_t49.js → PageView-DAqHjL1x.js} +1 -1
  37. data/lib/archsight/web/public/vue/{QueryError-ChdyV8B1.js → QueryError-DvspMrsh.js} +1 -1
  38. data/lib/archsight/web/public/vue/{ResourceList-DdtaHY4k.js → ResourceList-BZOYa68X.js} +1 -1
  39. data/lib/archsight/web/public/vue/{SearchResults-BYRAcK_o.js → SearchResults-DaaOPG3t.js} +1 -1
  40. data/lib/archsight/web/public/vue/{WikiPage-CgvRN6R2.js → WikiPage-Bfx92Iig.js} +1 -1
  41. data/lib/archsight/web/public/vue/index-B_YGrWD8.css +1 -0
  42. data/lib/archsight/web/public/vue/{index-yiZbbvAs.js → index-DMhBow5t.js} +2 -2
  43. data/lib/archsight/web/public/vue.html +2 -2
  44. metadata +18 -16
  45. data/lib/archsight/web/public/vue/InstanceRouter-BdkBTmGO.js +0 -1
  46. data/lib/archsight/web/public/vue/index-BLSE5DSv.css +0 -1
@@ -18,6 +18,7 @@ module Archsight
18
18
  module DiagramBlocks
19
19
  BLOCK = %r{<pre><code class="language-asd">(.*?)</code></pre>}m
20
20
  CACHE_LIMIT = 256
21
+ INCLUDE = /\binclude\s+"/
21
22
 
22
23
  @cache = {}
23
24
  @cache_lock = Mutex.new
@@ -26,11 +27,11 @@ module Archsight
26
27
 
27
28
  # @return [Array(String, Hash{String => String})] HTML with a placeholder per
28
29
  # asd block, and the rendered replacement for each placeholder
29
- def extract(html, resolver: nil)
30
+ def extract(html, resolver: nil, includes: nil)
30
31
  diagrams = {}
31
32
  replaced = html.gsub(BLOCK) do |block|
32
33
  placeholder = "<!--asd-diagram:#{diagrams.size}-->"
33
- diagrams[placeholder] = render_block(::CGI.unescapeHTML(Regexp.last_match(1)), block, resolver: resolver)
34
+ diagrams[placeholder] = render_block(::CGI.unescapeHTML(Regexp.last_match(1)), block, resolver: resolver, includes: includes)
34
35
  placeholder
35
36
  end
36
37
  [replaced, diagrams]
@@ -44,9 +45,9 @@ module Archsight
44
45
 
45
46
  # A whole diagram definition (the `architecture/diagram` annotation) as
46
47
  # inline SVG, or the error box plus the source if it doesn't render.
47
- def render_diagram(source, resolver: nil)
48
+ def render_diagram(source, resolver: nil, includes: nil)
48
49
  escaped = ::Rack::Utils.escape_html(source)
49
- render_block(source, %(<pre><code class="language-asd">#{escaped}</code></pre>), resolver: resolver)
50
+ render_block(source, %(<pre><code class="language-asd">#{escaped}</code></pre>), resolver: resolver, includes: includes)
50
51
  end
51
52
 
52
53
  # A diagram for the editor preview: the same SVG (and cache) as a rendered page, but a diagram that
@@ -54,8 +55,8 @@ module Archsight
54
55
  # that repeats the source, which the editor already shows.
55
56
  #
56
57
  # @return [Hash] `{ html: "<figure ...>", error: nil }` or `{ html: nil, error: "message" }`
57
- def preview(source, resolver: nil)
58
- { html: render_svg(source, resolver: resolver), error: nil }
58
+ def preview(source, resolver: nil, includes: nil)
59
+ { html: render_svg(source, resolver: resolver, includes: includes), error: nil }
59
60
  rescue Archsight::Diagram::Error => e
60
61
  { html: nil, error: e.message }
61
62
  end
@@ -73,40 +74,54 @@ module Archsight
73
74
  # `resource "..."` references resolve against the database, which can
74
75
  # change under a cached render (a reload, an edit), so the outcome of
75
76
  # each reference is part of the key.
76
- def render_block(source, original, resolver: nil)
77
- render_svg(source, resolver: resolver)
77
+ def render_block(source, original, resolver: nil, includes: nil)
78
+ render_svg(source, resolver: resolver, includes: includes)
78
79
  rescue Archsight::Diagram::Error => e
79
80
  message = ::Rack::Utils.escape_html(e.message)
80
81
  %(<div class="asd-diagram-error"><p><strong>Diagram error:</strong> #{message}</p>#{original}</div>)
81
82
  end
82
83
 
83
84
  # @raise [Archsight::Diagram::Error] if the source does not render
84
- def render_svg(source, resolver: nil)
85
- key = fingerprint(source, resolver: resolver)
85
+ def render_svg(source, resolver: nil, includes: nil)
86
+ key = fingerprint(source, resolver: resolver, includes: includes)
86
87
  cached(key) do
87
- svg = Archsight::Diagram.render(source, id_prefix: "asd#{key}", resolver: resolver)
88
+ warnings = [] #: Array[String]
89
+ svg = Archsight::Diagram.render(source, id_prefix: "asd#{key}", resolver: resolver, includes: includes, warnings: warnings)
90
+ warnings.each { |message| warn "Diagram: #{message}" }
88
91
  %(<figure class="asd-diagram">#{svg.sub(/\A<\?xml[^>]*\?>\s*/, "")}</figure>)
89
92
  end
90
93
  end
91
94
 
92
95
  # The cache key of a diagram: its source plus how each `resource` reference resolves right now. It
93
- # changes exactly when the rendered diagram would, so it is also a good ETag.
94
- def fingerprint(source, resolver: nil)
95
- ::Digest::SHA256.hexdigest([source, resolutions(source, resolver)].inspect)[0, 12]
96
+ # changes exactly when the rendered diagram would, so it is also a good ETag. The diagrams it includes
97
+ # are part of it: their sources, and how their `resource` references resolve.
98
+ def fingerprint(source, resolver: nil, includes: nil)
99
+ included = included_sources(source, includes)
100
+ ::Digest::SHA256.hexdigest([source, included, resolutions([source, *included.values], resolver)].inspect)[0, 12]
96
101
  end
97
102
 
98
103
  # A diagram as a standalone SVG document (what the assets API serves for an .asd file), cached by
99
104
  # fingerprint like the inline diagrams.
100
105
  # @raise [Archsight::Diagram::Error] if the source does not render
101
- def standalone_svg(source, resolver: nil)
102
- key = fingerprint(source, resolver: resolver)
103
- cached("svg-#{key}") { Archsight::Diagram.render(source, id_prefix: "asd#{key}", resolver: resolver) }
106
+ def standalone_svg(source, resolver: nil, includes: nil)
107
+ key = fingerprint(source, resolver: resolver, includes: includes)
108
+ cached("svg-#{key}") { Archsight::Diagram.render(source, id_prefix: "asd#{key}", resolver: resolver, includes: includes) }
104
109
  end
105
110
 
106
- def resolutions(source, resolver)
111
+ # `{ path => source }` of the diagrams `source` includes, recursively; empty for a source that includes
112
+ # none (checked on the text first: most diagrams include nothing and need not be parsed twice)
113
+ # @raise [Archsight::Diagram::Error] if the source or an included one is not a valid diagram
114
+ def included_sources(source, includes)
115
+ return {} unless includes && source.match?(INCLUDE)
116
+
117
+ Archsight::Diagram.expand(source, includes: includes).sources
118
+ end
119
+
120
+ def resolutions(sources, resolver)
107
121
  return [] unless resolver
108
122
 
109
- source.scan(/\bresource\s+"([^"]*)"/).flatten.uniq.map { |reference| [reference, resolver.call(reference)] }
123
+ references = sources.flat_map { |source| source.scan(/\bresource\s+"([^"]*)"/).flatten }
124
+ references.uniq.map { |reference| [reference, resolver.call(reference)] }
110
125
  end
111
126
 
112
127
  def cached(key)
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../assets"
4
+
5
+ module Archsight
6
+ module Helpers
7
+ # Loads the diagrams that `include "<path>"` names (see Archsight::Diagram::Includes):
8
+ #
9
+ # archsight://Kind/name the `architecture/diagram` of that resource
10
+ # file://path/to/x.asd an .asd file, relative to the resources directory (never outside it)
11
+ #
12
+ # #call returns the diagram source, or `:missing` / `:forbidden` / `:invalid`. Without a database only
13
+ # `file://` paths work (the standalone `archsight diagram`).
14
+ class DiagramIncludes
15
+ ARCHSIGHT = "archsight://"
16
+ FILE = "file://"
17
+ ANNOTATION = "architecture/diagram"
18
+ MAX_BYTES = 1_000_000
19
+
20
+ # The loader for a database, whose path is the resources directory
21
+ def self.for(database)
22
+ new(database, resources_dir: (database.path if database.respond_to?(:path)))
23
+ end
24
+
25
+ def initialize(database, resources_dir:)
26
+ @database = database
27
+ @resources_dir = resources_dir
28
+ end
29
+
30
+ def call(path)
31
+ if path.start_with?(ARCHSIGHT)
32
+ resource(path.delete_prefix(ARCHSIGHT))
33
+ elsif path.start_with?(FILE)
34
+ file(path.delete_prefix(FILE))
35
+ else
36
+ :invalid
37
+ end
38
+ end
39
+
40
+ private
41
+
42
+ # `Kind/name`; names contain `:` but a kind never contains `/`, so the first `/` separates them
43
+ def resource(reference)
44
+ return :forbidden unless @database
45
+
46
+ kind, name = reference.split("/", 2)
47
+ return :invalid if kind.to_s.empty? || name.to_s.empty? || !Archsight::Resources[kind]
48
+
49
+ source = @database.instance_by_kind(kind, name)&.annotations&.fetch(ANNOTATION, nil)
50
+ source.is_a?(String) && !source.strip.empty? ? source : :missing
51
+ end
52
+
53
+ def file(path)
54
+ return :invalid if @resources_dir.nil? || !Archsight::Assets.asd?(path)
55
+ return :forbidden if path.start_with?("/") # file:///etc/x.asd; relative to the resources directory only
56
+
57
+ real = Archsight::Assets.file_for(path, resources_dir: @resources_dir)
58
+ return :missing unless real
59
+ return :forbidden if File.size(real) > MAX_BYTES
60
+
61
+ File.read(real, encoding: "UTF-8")
62
+ rescue SystemCallError
63
+ :missing
64
+ end
65
+ end
66
+ end
67
+ end
@@ -7,6 +7,7 @@ require_relative "helpers/fenced_blocks"
7
7
  require_relative "helpers/view_blocks"
8
8
  require_relative "helpers/requirements_blocks"
9
9
  require_relative "helpers/resource_resolver"
10
+ require_relative "helpers/diagram_includes"
10
11
  require_relative "helpers/embeds"
11
12
  require_relative "helpers/wiki_links"
12
13
  require_relative "helpers/asset_images"
@@ -24,6 +24,7 @@ module Archsight
24
24
  def initialize(database)
25
25
  @database = database
26
26
  @errors = []
27
+ @diagram_warnings = []
27
28
  end
28
29
 
29
30
  def validate
@@ -47,7 +48,7 @@ module Archsight
47
48
  # annotations their kind marks `deprecated:`. They are not errors, so they do not make `archsight lint` fail.
48
49
  def warnings
49
50
  renamed = @database.respond_to?(:deprecations) ? @database.deprecations.map(&:to_s) : []
50
- renamed + deprecated_annotations
51
+ renamed + deprecated_annotations + @diagram_warnings
51
52
  end
52
53
 
53
54
  # Structural modeling checks (rules of "Choosing the Kind", see Linter::Structure). Warnings, never errors.
@@ -402,7 +403,10 @@ module Archsight
402
403
  # Renders with the same resolver the web UI uses, so a `resource` reference that would show as a broken link there is reported here
403
404
  def render_diagram_source(instance, where, source)
404
405
  unresolved = []
405
- Archsight::Diagram.render(source, resolver: Helpers::ResourceResolver.new(@database), unresolved: unresolved)
406
+ warnings = []
407
+ Archsight::Diagram.render(source, resolver: Helpers::ResourceResolver.new(@database), unresolved: unresolved,
408
+ includes: diagram_includes, warnings: warnings)
409
+ warnings.each { |message| @diagram_warnings << "#{instance.path_ref}: Diagram in #{where}: #{message}" }
406
410
  unresolved.each do |u|
407
411
  @errors << "#{instance.path_ref}: Diagram resource link #{u[:reference].inspect} #{u[:reason]} in #{where} (node #{u[:node].inspect}, line #{u[:line]})"
408
412
  end
@@ -410,6 +414,10 @@ module Archsight
410
414
  @errors << "#{instance.path_ref}: Diagram error in #{where}: #{e.message}"
411
415
  end
412
416
 
417
+ def diagram_includes
418
+ @diagram_includes ||= Helpers::DiagramIncludes.for(@database)
419
+ end
420
+
413
421
  def validate_view_fields(instance)
414
422
  check_view_components(instance, instance.annotations["view/fields"].to_s.split(",").map(&:strip))
415
423
  end
@@ -26,9 +26,10 @@ module Archsight
26
26
  # Adds the derived relations to every resource of the database.
27
27
  def derive!(database)
28
28
  finder = Finder.new(database)
29
+ includes = Helpers::DiagramIncludes.for(database)
29
30
  database.instances.values.flat_map(&:values).each do |inst|
30
31
  text_sources(inst).each { |markdown| mentions(markdown, finder).each { |target| link(inst, :mentions, target) } }
31
- diagram_sources(inst, database).each { |source| depictions(source, finder).each { |target| link(inst, :depicts, target) } }
32
+ diagram_sources(inst, database).each { |source| depictions(source, finder, includes).each { |target| link(inst, :depicts, target) } }
32
33
  end
33
34
  end
34
35
 
@@ -44,8 +45,8 @@ module Archsight
44
45
  # The resources the nodes of a diagram source name with `resource "..."`; a source that is not a valid diagram
45
46
  # names none.
46
47
  # @return [Array<Base>]
47
- def depictions(source, finder)
48
- Diagram.resource_references(source).filter_map { |reference| finder.reference(reference) }
48
+ def depictions(source, finder, includes = nil)
49
+ Diagram.resource_references(source, includes: includes).filter_map { |reference| finder.reference(reference) }
49
50
  rescue Diagram::Error
50
51
  []
51
52
  end
@@ -55,6 +55,13 @@ class Archsight::Resources::ApplicationComponent < Archsight::Resources::Base
55
55
  works in queries like a tag but is not a sidebar filter, as there are too many distinct values. Deployable forms (container image, chart, package) are `TechnologyArtifact`s, not
56
56
  component types.
57
57
 
58
+ ## Teams
59
+
60
+ A component is `maintainedBy` the team (`BusinessActor`) that builds and changes it and `operatedBy` the team
61
+ (`BusinessActor` or `BusinessRole`) that runs it in production. Build and run are often different teams, which is
62
+ the point of writing both. Both are optional; without a direct `maintainedBy`, the build team is the one that
63
+ maintains the component's `TechnologyArtifact`s.
64
+
58
65
  ## Where it runs
59
66
 
60
67
  A component is `servedBy` the `TechnologyService` it is deployed on (a product's cluster, a managed platform) and
@@ -426,6 +433,9 @@ class Archsight::Resources::ApplicationComponent < Archsight::Resources::Base
426
433
  relation :servedBy, :technologyComponents, :TechnologySystemSoftware
427
434
  relation :servedBy, :technologyServices, :TechnologyService
428
435
  relation :provisions, :technologyServices, :TechnologyService
436
+ relation :maintainedBy, :businessActors, :BusinessActor
437
+ relation :operatedBy, :businessActors, :BusinessActor
438
+ relation :operatedBy, :businessRoles, :BusinessRole
429
439
  relation :exposes, :applicationInterfaces, :ApplicationInterface
430
440
  relation :dependsOn, :applicationInterfaces, :ApplicationInterface
431
441
  relation :dependsOn, :applicationComponents, :ApplicationComponent
@@ -35,6 +35,12 @@ class Archsight::Resources::ApplicationService < Archsight::Resources::Base
35
35
  the other service's components listed again; a service that many others use is modeled once. A service whose only component has the same name is a smell. See
36
36
  the modeling guide, "Choosing the Kind".
37
37
 
38
+ ## Teams
39
+
40
+ A service is `maintainedBy` the team (`BusinessActor`) that builds and changes it and `operatedBy` the team
41
+ (`BusinessActor` or `BusinessRole`) that runs it in production. Build and run are often different teams, which is
42
+ the point of writing both. `servedBy` stays "who uses it". Both are optional.
43
+
38
44
  ## Security and risk modelling
39
45
 
40
46
  A service is an asset at risk (`asset/*` profile, protection needs) that loss events `affects`, a trigger target
@@ -230,6 +236,9 @@ class Archsight::Resources::ApplicationService < Archsight::Resources::Base
230
236
  relation :dependsOn, :applicationServices, :ApplicationService
231
237
  relation :servedBy, :businessActors, :BusinessActor
232
238
  relation :servedBy, :technologyServices, :TechnologyService
239
+ relation :maintainedBy, :businessActors, :BusinessActor
240
+ relation :operatedBy, :businessActors, :BusinessActor
241
+ relation :operatedBy, :businessRoles, :BusinessRole
233
242
  relation :realizes, :motivationConstraints, :MotivationConstraint
234
243
  relation :realizes, :motivationRequirements, :MotivationRequirement
235
244
  relation :partiallyRealizes, :motivationRequirements, :MotivationRequirement
@@ -50,6 +50,12 @@ class Archsight::Resources::TechnologyService < Archsight::Resources::Base
50
50
  "servedBy" from ApplicationComponent on its page. An ApplicationService that is `servedBy` the service uses it as a
51
51
  whole; list a cluster there only when the service's own components run in it.
52
52
 
53
+ ## Teams
54
+
55
+ A service is `maintainedBy` the team (`BusinessActor`) that builds and changes it and `operatedBy` the team
56
+ (`BusinessActor` or `BusinessRole`) that runs it in production. Build and run are often different teams, which is
57
+ the point of writing both. `servedBy` stays "who uses it". Both are optional.
58
+
53
59
  ## Provisioning
54
60
 
55
61
  A service that software creates (clusters built by an infrastructure-as-code operator, a database cluster
@@ -75,6 +81,9 @@ class Archsight::Resources::TechnologyService < Archsight::Resources::Base
75
81
  relation :suppliedBy, :technologyComponents, :TechnologySystemSoftware
76
82
  relation :specializes, :technologyServices, :TechnologyService
77
83
  relation :servedBy, :businessActors, :BusinessActor
84
+ relation :maintainedBy, :businessActors, :BusinessActor
85
+ relation :operatedBy, :businessActors, :BusinessActor
86
+ relation :operatedBy, :businessRoles, :BusinessRole
78
87
  relation :locatedAt, :technologyFacilities, :TechnologyFacility
79
88
  relation :realizedBy, :technologyEquipment, :TechnologyEquipment
80
89
  relation :realizes, :motivationRequirements, :MotivationRequirement
@@ -4,5 +4,5 @@
4
4
  # Do not edit manually.
5
5
 
6
6
  module Archsight
7
- VERSION = "0.4.2"
7
+ VERSION = "0.4.3"
8
8
  end
@@ -106,7 +106,8 @@ module Archsight::Web::API::JsonHelpers
106
106
  source = annotations[DIAGRAM_ANNOTATION_KEY]
107
107
  return unless source.is_a?(String) && !source.strip.empty?
108
108
 
109
- Archsight::Helpers::DiagramBlocks.render_diagram(source, resolver: Archsight::Helpers::ResourceResolver.new(db))
109
+ Archsight::Helpers::DiagramBlocks.render_diagram(source, resolver: Archsight::Helpers::ResourceResolver.new(db),
110
+ includes: Archsight::Helpers::DiagramIncludes.for(db))
110
111
  end
111
112
 
112
113
  # The values of markdown annotations are rendered to HTML: architecture/description and every annotation the
@@ -190,7 +191,7 @@ module Archsight::Web::API::JsonHelpers
190
191
  title: annotation.title,
191
192
  description: annotation.description,
192
193
  filter_type: annotation.filter.to_s,
193
- values: values
194
+ values: values.map { |value, count| { value: value, count: count } }
194
195
  }
195
196
  end
196
197
  end
@@ -1581,9 +1581,16 @@ components:
1581
1581
  description: Filter type (e.g., "select", "boolean")
1582
1582
  values:
1583
1583
  type: array
1584
+ description: Available values with the number of instances using them, most used first
1584
1585
  items:
1585
- type: string
1586
- description: Available values for the filter
1586
+ type: object
1587
+ required: [value, count]
1588
+ properties:
1589
+ value:
1590
+ type: string
1591
+ count:
1592
+ type: integer
1593
+ description: Number of instances with this value
1587
1594
 
1588
1595
  AnalysisResult:
1589
1596
  type: object
@@ -24,7 +24,7 @@ module Archsight::Web::API::PageHelpers
24
24
  next if counts.empty?
25
25
 
26
26
  { key: annotation.key, title: annotation.title, filter_type: annotation.filter.to_s,
27
- values: counts.sort.map { |value, count| { value: value, count: count } } }
27
+ values: counts.sort_by { |value, count| [-count, value.to_s] }.map { |value, count| { value: value, count: count } } }
28
28
  end
29
29
  end
30
30
 
@@ -179,9 +179,10 @@ module Archsight::Web::API::Routes
179
179
  resolver = Archsight::Helpers::ResourceResolver.new(db)
180
180
  headers "Content-Security-Policy" => "default-src 'none'; style-src 'unsafe-inline'; sandbox"
181
181
  cache_control :public, :must_revalidate, max_age: 0
182
- etag Archsight::Helpers::DiagramBlocks.fingerprint(source, resolver: resolver)
182
+ includes = Archsight::Helpers::DiagramIncludes.for(db)
183
+ etag Archsight::Helpers::DiagramBlocks.fingerprint(source, resolver: resolver, includes: includes)
183
184
  content_type "image/svg+xml"
184
- Archsight::Helpers::DiagramBlocks.standalone_svg(source, resolver: resolver)
185
+ Archsight::Helpers::DiagramBlocks.standalone_svg(source, resolver: resolver, includes: includes)
185
186
  rescue Archsight::Diagram::Error => e
186
187
  json_error("Diagram does not render: #{e.message}", status: 422, error_type: "DiagramError")
187
188
  end
@@ -201,7 +202,7 @@ module Archsight::Web::API::Routes
201
202
  json_error("A JSON body with a 'source' string is required", status: 400, error_type: "BadRequest") unless source.is_a?(String)
202
203
 
203
204
  resolver = Archsight::Helpers::ResourceResolver.new(db)
204
- json_response(Archsight::Helpers::DiagramBlocks.preview(source, resolver: resolver))
205
+ json_response(Archsight::Helpers::DiagramBlocks.preview(source, resolver: resolver, includes: Archsight::Helpers::DiagramIncludes.for(db)))
205
206
  end
206
207
 
207
208
  # POST /api/v1/kinds/Analysis/instances/:name/execute - Execute an analysis
@@ -161,7 +161,8 @@ class Archsight::Web::Application < Sinatra::Base
161
161
  html = Archsight::Markdown.document(data).to_html
162
162
  html = Archsight::Helpers::AssetImages.rewrite(html, base_dir: base, resources_dir: Archsight.resources_dir) if base
163
163
  # ```asd blocks become placeholders until the text passes below are done (see DiagramBlocks)
164
- html, diagrams = Archsight::Helpers::DiagramBlocks.extract(html, resolver: Archsight::Helpers::ResourceResolver.new(db))
164
+ html, diagrams = Archsight::Helpers::DiagramBlocks.extract(html, resolver: Archsight::Helpers::ResourceResolver.new(db),
165
+ includes: Archsight::Helpers::DiagramIncludes.for(db))
165
166
  # so are ```view and ```requirements blocks (see ViewBlocks, RequirementsBlocks)
166
167
  html, views = Archsight::Helpers::ViewBlocks.extract(html)
167
168
  html, requirements = Archsight::Helpers::RequirementsBlocks.extract(html)
@@ -1 +1 @@
1
- import{F as e,L as t,P as n,Q as r,d as i,q as a,t as o,tt as s}from"./index-yiZbbvAs.js";import{t as c}from"./WikiPage-CgvRN6R2.js";var l={key:1},u={__name:`DocPage`,props:{filename:String},setup(u){let d=u,f=s(null);function p(e,t){let n=new DOMParser().parseFromString(e,`text/html`).body,r=n.querySelector(`:scope > article`)||n,i=r.querySelector(`h1`),a=i?.textContent.trim()||t.split(`/`).pop().replace(/[-_]/g,` `);i?.remove();let o=[...r.querySelectorAll(`h2[id], h3[id], h4[id]`)].map(e=>({level:Number(e.tagName[1]),id:e.id,text:e.textContent.trim()})),s=[{title:`Documentation`}];return t.startsWith(`resources/`)&&s.push({title:`Resource types`}),{title:a,html:r.innerHTML,toc:o.length>=2?o:[],breadcrumb:s}}async function m(){let e=await i(d.filename);f.value=e?p(e,d.filename):{title:`Not found`,html:`<p>Documentation not found.</p>`,toc:[],breadcrumb:[{title:`Documentation`}]},o(f.value.title)}return r(()=>d.filename,m,{immediate:!0}),(r,i)=>f.value?(a(),e(c,{key:0,title:f.value.title,html:f.value.html,breadcrumb:f.value.breadcrumb,toc:f.value.toc},null,8,[`title`,`html`,`breadcrumb`,`toc`])):(a(),t(`article`,l,[...i[0]||=[n(`p`,null,`Loading...`,-1)]]))}};export{u as default};
1
+ import{F as e,L as t,P as n,Q as r,d as i,q as a,t as o,tt as s}from"./index-DMhBow5t.js";import{t as c}from"./WikiPage-Bfx92Iig.js";var l={key:1},u={__name:`DocPage`,props:{filename:String},setup(u){let d=u,f=s(null);function p(e,t){let n=new DOMParser().parseFromString(e,`text/html`).body,r=n.querySelector(`:scope > article`)||n,i=r.querySelector(`h1`),a=i?.textContent.trim()||t.split(`/`).pop().replace(/[-_]/g,` `);i?.remove();let o=[...r.querySelectorAll(`h2[id], h3[id], h4[id]`)].map(e=>({level:Number(e.tagName[1]),id:e.id,text:e.textContent.trim()})),s=[{title:`Documentation`}];return t.startsWith(`resources/`)&&s.push({title:`Resource types`}),{title:a,html:r.innerHTML,toc:o.length>=2?o:[],breadcrumb:s}}async function m(){let e=await i(d.filename);f.value=e?p(e,d.filename):{title:`Not found`,html:`<p>Documentation not found.</p>`,toc:[],breadcrumb:[{title:`Documentation`}]},o(f.value.title)}return r(()=>d.filename,m,{immediate:!0}),(r,i)=>f.value?(a(),e(c,{key:0,title:f.value.title,html:f.value.html,breadcrumb:f.value.breadcrumb,toc:f.value.toc},null,8,[`title`,`html`,`breadcrumb`,`toc`])):(a(),t(`article`,l,[...i[0]||=[n(`p`,null,`Loading...`,-1)]]))}};export{u as default};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{$ as n,A as r,B as i,C as a,D as o,E as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,N as h,O as g,P as _,Q as v,S as y,U as b,W as x,X as S,a as C,at as w,et as ee,f as te,j as ne,l as re,nt as ie,p as ae,q as T,rt as E,tt as D,u as oe,z as O}from"./index-yiZbbvAs.js";import{t as se}from"./useHighlight-BH32C7yt.js";var ce=`archsight.diagramPreview.layout`,le=[`bottom`,`right`,`full`,`hidden`],ue=`(min-width: 1400px)`;function de(){try{let e=localStorage.getItem(ce);return le.includes(e)?e:null}catch{return null}}var fe=D(de()),pe=D(typeof matchMedia==`function`&&matchMedia(ue).matches);typeof matchMedia==`function`&&matchMedia(ue).addEventListener(`change`,e=>{pe.value=e.matches});var me=h(()=>fe.value||(pe.value?`right`:`bottom`));function he(e){if(le.includes(e)){fe.value=e;try{localStorage.setItem(ce,e)}catch{}}}function ge(){return{layout:me,setLayout:he}}var _e={class:`preview-head`},ve={class:`preview-tools`},ye={key:0,class:`preview-state`},be={class:`preview-layout`,role:`group`,"aria-label":`Preview layout`},xe=[`aria-pressed`,`title`,`aria-label`,`onClick`],Se={key:0,class:`preview-error`,role:`alert`},Ce=[`innerHTML`],we={key:2,class:`preview-empty`},Te=300,Ee=C({__name:`DiagramPreview`,props:{source:String},setup(e){let t=e,{layout:n,setLayout:r}=ge(),i=h(()=>n.value===`hidden`),a=[{value:`bottom`,icon:`iconoir-table-rows`,label:`Below the editor`},{value:`right`,icon:`iconoir-view-columns-2`,label:`Right of the editor`},{value:`full`,icon:`iconoir-expand`,label:`Preview only`},{value:`hidden`,icon:`iconoir-eye-closed`,label:`Hide preview`}],o=D(``),s=D(null),c=D(!1),l=null,u=null;function p(){clearTimeout(l),l=null,u?.abort(),u=null}async function g(e){u=new AbortController;let t=u;c.value=!0;try{let n=await y(e,{signal:t.signal});if(t!==u)return;n.html&&(o.value=n.html),s.value=n.error}catch(e){if(e.name===`AbortError`||t!==u)return;s.value=e.message}finally{t===u&&(c.value=!1)}}v([()=>t.source,i],([e,t],[,n])=>{p(),t?c.value=!1:!e||!e.trim()?(o.value=``,s.value=null,c.value=!1):(c.value=!0,l=setTimeout(()=>g(e),n?0:Te))},{immediate:!0}),x(p);function b(e){e.target.closest(`a`)&&e.preventDefault()}return(e,t)=>(T(),m(`div`,{class:E([`diagram-preview`,`layout-${ie(n)}`])},[_(`div`,_e,[_(`span`,null,[t[0]||=_(`i`,{class:`iconoir-eye`},null,-1),t[1]||=O(` Preview`,-1),i.value?(T(),m(ne,{key:0},[O(` hidden`)],64)):d(``,!0)]),_(`span`,ve,[c.value&&!i.value?(T(),m(`span`,ye,`Rendering…`)):d(``,!0),_(`span`,be,[(T(!0),m(ne,null,f(a.filter(e=>!i.value||e.value!==`hidden`),e=>(T(),m(`button`,{key:e.value,type:`button`,class:E({active:ie(n)===e.value}),"aria-pressed":ie(n)===e.value,title:e.label,"aria-label":e.label,onClick:t=>ie(r)(e.value)},[_(`i`,{class:E(e.icon)},null,2)],10,xe))),128))])])]),i.value?d(``,!0):(T(),m(ne,{key:0},[s.value?(T(),m(`div`,Se,[t[2]||=_(`i`,{class:`iconoir-warning-triangle`},null,-1),O(` `+w(s.value),1)])):d(``,!0),o.value?(T(),m(`div`,{key:1,class:E([`preview-body`,{stale:!!s.value}]),title:`Links are disabled in the preview`,onClick:b,innerHTML:o.value},null,10,Ce)):!s.value&&!c.value?(T(),m(`p`,we,`Nothing to preview yet.`)):d(``,!0)],64))],2))}},[[`__scopeId`,`data-v-11568657`]]),De={class:`label-row`},Oe=[`for`,`title`],ke={key:0,class:`required`},Ae=[`id`,`aria-invalid`],je=[`value`],Me=[`id`,`aria-invalid`,`placeholder`],Ne={key:0,class:`future-hint`},Pe={class:`code-source`},Fe=[`id`,`aria-invalid`,`placeholder`],Ie={class:`future-hint`},Le=[`id`,`step`,`aria-invalid`],Re=[`id`,`aria-invalid`],ze=[`id`,`aria-invalid`],Be=[`id`,`aria-invalid`],Ve={key:7,class:`field-description`},He={key:8,class:`field-error`},Ue=C({__name:`EditorField`,props:{field:Object,modelValue:[String,Number,null],error:[Array,null]},emits:[`update:modelValue`,`openMarkdown`],setup(e,{emit:t}){let n=e,r=t,i=h({get:()=>n.modelValue??``,set:e=>r(`update:modelValue`,e)}),a=h(()=>[`textarea`,`markdown`,`code`].includes(n.field.input_type)),s=h(()=>n.field.key===`page/content`),l=h(()=>n.field.code_language===`asd`),{layout:u}=ge(),p={asd:`Archsight Diagram`},v=h(()=>{let e=n.field.code_language||``;return p[e]||e.charAt(0).toUpperCase()+e.slice(1)}),y=h(()=>n.error&&n.error.length>0);return(t,n)=>(T(),m(`div`,{class:E([`field-group`,{"field-full-width":a.value}])},[_(`div`,De,[_(`label`,{for:e.field.key,title:e.field.description},[O(w(e.field.title)+` `,1),e.field.required?(T(),m(`span`,ke,`*`)):d(``,!0)],8,Oe),e.field.input_type===`markdown`?(T(),m(`button`,{key:0,type:`button`,class:`btn-edit-markdown`,title:`Open rich text editor`,onClick:n[0]||=n=>t.$emit(`openMarkdown`,e.field.key)},[...n[8]||=[_(`i`,{class:`iconoir-edit-pencil`},null,-1),O(` Edit `,-1)]])):d(``,!0)]),e.field.input_type===`select`?ee((T(),m(`select`,{key:0,id:e.field.key,"onUpdate:modelValue":n[1]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0},[n[9]||=_(`option`,{value:``},`Select...`,-1),(T(!0),m(ne,null,f(e.field.options,e=>(T(),m(`option`,{key:e,value:e},w(e),9,je))),128))],8,Ae)),[[o,i.value]]):e.field.input_type===`textarea`||e.field.input_type===`markdown`?(T(),m(`div`,{key:1,class:E([`markdown-field`,{"page-body":s.value}])},[ee(_(`textarea`,{id:e.field.key,"onUpdate:modelValue":n[2]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0,placeholder:e.field.input_type===`markdown`?`Enter markdown content...`:`One entry per line...`},null,8,Me),[[g,i.value]]),e.field.input_type===`markdown`?(T(),m(`small`,Ne,[...n[10]||=[_(`i`,{class:`iconoir-info-circle`},null,-1),O(` Markdown, `,-1),_(`code`,null,`[[links]]`,-1),O(` and `,-1),_(`code`,null,"```asd",-1),O(` diagrams. Use Edit for the rich text editor `,-1)]])):d(``,!0)],2)):e.field.input_type===`code`?(T(),m(`div`,{key:2,class:E([`code-field`,l.value&&[`with-preview`,`layout-${ie(u)}`]])},[_(`div`,Pe,[ee(_(`textarea`,{id:e.field.key,"onUpdate:modelValue":n[3]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0,placeholder:`Enter ${e.field.code_language||``} code...`,spellcheck:`false`},null,8,Fe),[[g,i.value]]),_(`small`,Ie,[n[11]||=_(`i`,{class:`iconoir-code`},null,-1),O(` `+w(v.value)+` code `,1)])]),l.value?(T(),c(Ee,{key:0,class:`field-diagram-preview`,source:String(i.value)},null,8,[`source`])):d(``,!0)],2)):e.field.input_type===`number`?ee((T(),m(`input`,{key:3,id:e.field.key,type:`number`,"onUpdate:modelValue":n[4]||=e=>i.value=e,step:e.field.step,"aria-invalid":y.value?`true`:void 0},null,8,Le)),[[g,i.value]]):e.field.input_type===`url`?ee((T(),m(`input`,{key:4,id:e.field.key,type:`url`,"onUpdate:modelValue":n[5]||=e=>i.value=e,placeholder:`https://...`,"aria-invalid":y.value?`true`:void 0},null,8,Re)),[[g,i.value]]):e.field.input_type===`list`?ee((T(),m(`input`,{key:5,id:e.field.key,type:`text`,"onUpdate:modelValue":n[6]||=e=>i.value=e,placeholder:`Comma-separated values`,"aria-invalid":y.value?`true`:void 0},null,8,ze)),[[g,i.value]]):ee((T(),m(`input`,{key:6,id:e.field.key,type:`text`,"onUpdate:modelValue":n[7]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0},null,8,Be)),[[g,i.value]]),e.field.description&&![`textarea`,`markdown`,`code`].includes(e.field.input_type)?(T(),m(`small`,Ve,w(e.field.description),1)):d(``,!0),y.value?(T(),m(`div`,He,w(e.error.join(`, `)),1)):d(``,!0)],2))}},[[`__scopeId`,`data-v-fe1221de`]]),We={class:`relations-editor`},Ge={key:0,class:`no-relations`},Ke={id:`relations-list`},qe={class:`relation-text`},Je=[`onClick`],Ye={class:`add-relation-row`},Xe=[`value`],Ze=[`value`],Qe=C({__name:`EditorRelations`,props:{relations:Array,relationOptions:Array,instancesByKind:Object},emits:[`update:relations`],setup(e,{emit:t}){let n=e,r=t,i=D(``),a=D(``),s=h(()=>[...n.relations].sort((e,t)=>(e.verb+e.kind+e.name).localeCompare(t.verb+t.kind+t.name))),c=h(()=>i.value?n.relationOptions.find(e=>e.combo===i.value)?.target_kind:null),l=h(()=>c.value&&n.instancesByKind[c.value]||[]);v(i,()=>{a.value=``});function u(){if(!i.value||!a.value)return;let e=n.relationOptions.find(e=>e.combo===i.value);if(!e||n.relations.some(t=>t.verb===e.verb&&t.kind===e.target_kind&&t.name===a.value))return;let t=[...n.relations,{verb:e.verb,kind:e.target_kind,name:a.value}];r(`update:relations`,t),i.value=``,a.value=``}function d(e){let t=n.relations.filter((t,n)=>n!==e);r(`update:relations`,t)}return(t,n)=>(T(),m(`div`,We,[!e.relationOptions||e.relationOptions.length===0?(T(),m(`p`,Ge,` This resource type has no defined relations. `)):(T(),m(ne,{key:1},[_(`div`,Ke,[(T(!0),m(ne,null,f(s.value,(e,t)=>(T(),m(`div`,{key:`${e.verb}:${e.kind}:${e.name}`,class:`relation-item`},[_(`span`,qe,[_(`strong`,null,w(e.verb),1),O(` → `+w(e.kind)+`: `,1),_(`em`,null,w(e.name),1)]),_(`button`,{class:`btn-remove`,type:`button`,title:`Remove`,onClick:e=>d(t)},[...n[2]||=[_(`i`,{class:`iconoir-xmark`},null,-1)]],8,Je)]))),128))]),_(`div`,Ye,[ee(_(`select`,{"onUpdate:modelValue":n[0]||=e=>i.value=e},[n[3]||=_(`option`,{value:``},`Select relation...`,-1),(T(!0),m(ne,null,f(e.relationOptions,e=>(T(),m(`option`,{key:e.combo,value:e.combo},w(e.verb)+` → `+w(e.target_kind),9,Xe))),128))],512),[[o,i.value]]),ee(_(`select`,{"onUpdate:modelValue":n[1]||=e=>a.value=e},[n[4]||=_(`option`,{value:``},`Select instance...`,-1),(T(!0),m(ne,null,f(l.value,e=>(T(),m(`option`,{key:e,value:e},w(e),9,Ze))),128))],512),[[o,a.value]]),_(`button`,{class:`secondary btn-add`,type:`button`,onClick:u},[...n[5]||=[_(`i`,{class:`iconoir-plus`},null,-1),O(` Add `,-1)]])])],64))]))}},[[`__scopeId`,`data-v-a987a6fe`]]),$e={class:`yaml-output-container`},et={key:0,class:`conflict-error`},tt={class:`yaml-success`},nt={id:`yaml-content`},rt={key:0,class:`yaml-file-info`},it={key:1,class:`yaml-instructions`},at={class:`yaml-actions`},ot=[`disabled`],st=C({__name:`EditorYamlOutput`,props:{yaml:String,format:{type:String,default:`yaml`},kind:String,name:String,contentHash:String,pathRef:String,inlineEditEnabled:Boolean},emits:[`editAgain`],setup(e,{emit:t}){let n=e,r=D(null),i=D(`idle`),o=D(`idle`),s=D(null),c=h(()=>n.format===`markdown`),u=h(()=>c.value?`Markdown`:`YAML`),f=h(()=>c.value?`.md`:`.yaml`);l(()=>{r.value&&se(r.value)}),v(()=>n.yaml,async()=>{await b(),r.value&&se(r.value)});async function p(){try{await navigator.clipboard.writeText(n.yaml),i.value=`copied`,setTimeout(()=>{i.value=`idle`},2e3)}catch{let e=document.createElement(`textarea`);e.value=n.yaml,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),i.value=`copied`,setTimeout(()=>{i.value=`idle`},2e3)}}async function g(){o.value=`saving`,s.value=null;try{let e=await a(n.kind,n.name,n.yaml,n.contentHash);e.success?(o.value=`saved`,setTimeout(()=>{o.value=`idle`},2e3)):e.conflict?(s.value=e.error,o.value=`idle`):(alert(`Save failed: `+e.error),o.value=`idle`)}catch(e){alert(`Save failed: `+e.message),o.value=`idle`}}return(t,n)=>(T(),m(`div`,$e,[s.value?(T(),m(`div`,et,[n[1]||=_(`i`,{class:`iconoir-warning-triangle`},null,-1),_(`span`,null,w(s.value),1)])):d(``,!0),_(`p`,tt,[n[2]||=_(`i`,{class:`iconoir-check-circle`},null,-1),O(` Generated `+w(u.value),1)]),_(`div`,{ref_key:`codeEl`,ref:r},[_(`pre`,nt,[_(`code`,{class:E(`language-${e.format}`)},w(e.yaml),3)])],512),_(`footer`,null,[e.pathRef?(T(),m(`p`,rt,[n[3]||=_(`i`,{class:`iconoir-folder`},null,-1),_(`span`,null,`Source: `+w(e.pathRef),1)])):(T(),m(`p`,it,[n[10]||=_(`i`,{class:`iconoir-info-circle`},null,-1),_(`span`,null,[O(` Copy this `+w(u.value)+` and save it to a `,1),_(`code`,null,w(f.value),1),n[6]||=O(` file in your resources directory`,-1),c.value?(T(),m(ne,{key:0},[n[4]||=O(` (named `,-1),_(`code`,null,w(e.name)+`.md`,1),n[5]||=O(`)`,-1)],64)):d(``,!0),n[7]||=O(`, `,-1),n[8]||=_(`br`,null,null,-1),n[9]||=O(`then reload the application. `,-1)])])),_(`div`,at,[e.pathRef&&e.inlineEditEnabled?(T(),m(`button`,{key:0,type:`button`,onClick:g,disabled:o.value===`saving`,class:E({saved:o.value===`saved`})},[_(`i`,{class:E(o.value===`saving`?`iconoir-refresh`:o.value===`saved`?`iconoir-check`:`iconoir-check-circle`)},null,2),O(` `+w(o.value===`saving`?`Saving...`:o.value===`saved`?`Saved!`:`Save to File`),1)],10,ot)):d(``,!0),_(`button`,{type:`button`,onClick:p,class:E({copied:i.value===`copied`})},[_(`i`,{class:E(i.value===`copied`?`iconoir-check`:`iconoir-copy`)},null,2),O(` `+w(i.value===`copied`?`Copied!`:`Copy to Clipboard`),1)],2),_(`button`,{class:`secondary`,type:`button`,onClick:n[0]||=e=>t.$emit(`editAgain`)},[...n[11]||=[_(`i`,{class:`iconoir-edit-pencil`},null,-1),O(` Edit Again `,-1)]])])])]))}},[[`__scopeId`,`data-v-b5ea938f`]]);function k(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ct(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var lt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,ut=lt&&`documentMode`in document?document.documentMode:null,dt=lt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ft=lt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pt=!(!lt||!(`InputEvent`in window)||ut)&&`getTargetRanges`in new window.InputEvent(`input`),mt=lt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ht=lt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,gt=lt&&/Android/.test(navigator.userAgent),_t=lt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vt=lt&&gt&&_t,yt=lt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&dt&&!_t,bt=0,xt=1,St=2,Ct=1,wt=2,Tt=3,Et=4,Dt=5,Ot=6,kt=mt||ht||yt?`\xA0`:`​`,At=`
1
+ import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{$ as n,A as r,B as i,C as a,D as o,E as s,F as c,G as l,H as u,I as d,J as f,K as p,L as m,N as h,O as g,P as _,Q as v,S as y,U as b,W as x,X as S,a as C,at as w,et as ee,f as te,j as ne,l as re,nt as ie,p as ae,q as T,rt as E,tt as D,u as oe,z as O}from"./index-DMhBow5t.js";import{t as se}from"./useHighlight-BH32C7yt.js";var ce=`archsight.diagramPreview.layout`,le=[`bottom`,`right`,`full`,`hidden`],ue=`(min-width: 1400px)`;function de(){try{let e=localStorage.getItem(ce);return le.includes(e)?e:null}catch{return null}}var fe=D(de()),pe=D(typeof matchMedia==`function`&&matchMedia(ue).matches);typeof matchMedia==`function`&&matchMedia(ue).addEventListener(`change`,e=>{pe.value=e.matches});var me=h(()=>fe.value||(pe.value?`right`:`bottom`));function he(e){if(le.includes(e)){fe.value=e;try{localStorage.setItem(ce,e)}catch{}}}function ge(){return{layout:me,setLayout:he}}var _e={class:`preview-head`},ve={class:`preview-tools`},ye={key:0,class:`preview-state`},be={class:`preview-layout`,role:`group`,"aria-label":`Preview layout`},xe=[`aria-pressed`,`title`,`aria-label`,`onClick`],Se={key:0,class:`preview-error`,role:`alert`},Ce=[`innerHTML`],we={key:2,class:`preview-empty`},Te=300,Ee=C({__name:`DiagramPreview`,props:{source:String},setup(e){let t=e,{layout:n,setLayout:r}=ge(),i=h(()=>n.value===`hidden`),a=[{value:`bottom`,icon:`iconoir-table-rows`,label:`Below the editor`},{value:`right`,icon:`iconoir-view-columns-2`,label:`Right of the editor`},{value:`full`,icon:`iconoir-expand`,label:`Preview only`},{value:`hidden`,icon:`iconoir-eye-closed`,label:`Hide preview`}],o=D(``),s=D(null),c=D(!1),l=null,u=null;function p(){clearTimeout(l),l=null,u?.abort(),u=null}async function g(e){u=new AbortController;let t=u;c.value=!0;try{let n=await y(e,{signal:t.signal});if(t!==u)return;n.html&&(o.value=n.html),s.value=n.error}catch(e){if(e.name===`AbortError`||t!==u)return;s.value=e.message}finally{t===u&&(c.value=!1)}}v([()=>t.source,i],([e,t],[,n])=>{p(),t?c.value=!1:!e||!e.trim()?(o.value=``,s.value=null,c.value=!1):(c.value=!0,l=setTimeout(()=>g(e),n?0:Te))},{immediate:!0}),x(p);function b(e){e.target.closest(`a`)&&e.preventDefault()}return(e,t)=>(T(),m(`div`,{class:E([`diagram-preview`,`layout-${ie(n)}`])},[_(`div`,_e,[_(`span`,null,[t[0]||=_(`i`,{class:`iconoir-eye`},null,-1),t[1]||=O(` Preview`,-1),i.value?(T(),m(ne,{key:0},[O(` hidden`)],64)):d(``,!0)]),_(`span`,ve,[c.value&&!i.value?(T(),m(`span`,ye,`Rendering…`)):d(``,!0),_(`span`,be,[(T(!0),m(ne,null,f(a.filter(e=>!i.value||e.value!==`hidden`),e=>(T(),m(`button`,{key:e.value,type:`button`,class:E({active:ie(n)===e.value}),"aria-pressed":ie(n)===e.value,title:e.label,"aria-label":e.label,onClick:t=>ie(r)(e.value)},[_(`i`,{class:E(e.icon)},null,2)],10,xe))),128))])])]),i.value?d(``,!0):(T(),m(ne,{key:0},[s.value?(T(),m(`div`,Se,[t[2]||=_(`i`,{class:`iconoir-warning-triangle`},null,-1),O(` `+w(s.value),1)])):d(``,!0),o.value?(T(),m(`div`,{key:1,class:E([`preview-body`,{stale:!!s.value}]),title:`Links are disabled in the preview`,onClick:b,innerHTML:o.value},null,10,Ce)):!s.value&&!c.value?(T(),m(`p`,we,`Nothing to preview yet.`)):d(``,!0)],64))],2))}},[[`__scopeId`,`data-v-11568657`]]),De={class:`label-row`},Oe=[`for`,`title`],ke={key:0,class:`required`},Ae=[`id`,`aria-invalid`],je=[`value`],Me=[`id`,`aria-invalid`,`placeholder`],Ne={key:0,class:`future-hint`},Pe={class:`code-source`},Fe=[`id`,`aria-invalid`,`placeholder`],Ie={class:`future-hint`},Le=[`id`,`step`,`aria-invalid`],Re=[`id`,`aria-invalid`],ze=[`id`,`aria-invalid`],Be=[`id`,`aria-invalid`],Ve={key:7,class:`field-description`},He={key:8,class:`field-error`},Ue=C({__name:`EditorField`,props:{field:Object,modelValue:[String,Number,null],error:[Array,null]},emits:[`update:modelValue`,`openMarkdown`],setup(e,{emit:t}){let n=e,r=t,i=h({get:()=>n.modelValue??``,set:e=>r(`update:modelValue`,e)}),a=h(()=>[`textarea`,`markdown`,`code`].includes(n.field.input_type)),s=h(()=>n.field.key===`page/content`),l=h(()=>n.field.code_language===`asd`),{layout:u}=ge(),p={asd:`Archsight Diagram`},v=h(()=>{let e=n.field.code_language||``;return p[e]||e.charAt(0).toUpperCase()+e.slice(1)}),y=h(()=>n.error&&n.error.length>0);return(t,n)=>(T(),m(`div`,{class:E([`field-group`,{"field-full-width":a.value}])},[_(`div`,De,[_(`label`,{for:e.field.key,title:e.field.description},[O(w(e.field.title)+` `,1),e.field.required?(T(),m(`span`,ke,`*`)):d(``,!0)],8,Oe),e.field.input_type===`markdown`?(T(),m(`button`,{key:0,type:`button`,class:`btn-edit-markdown`,title:`Open rich text editor`,onClick:n[0]||=n=>t.$emit(`openMarkdown`,e.field.key)},[...n[8]||=[_(`i`,{class:`iconoir-edit-pencil`},null,-1),O(` Edit `,-1)]])):d(``,!0)]),e.field.input_type===`select`?ee((T(),m(`select`,{key:0,id:e.field.key,"onUpdate:modelValue":n[1]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0},[n[9]||=_(`option`,{value:``},`Select...`,-1),(T(!0),m(ne,null,f(e.field.options,e=>(T(),m(`option`,{key:e,value:e},w(e),9,je))),128))],8,Ae)),[[o,i.value]]):e.field.input_type===`textarea`||e.field.input_type===`markdown`?(T(),m(`div`,{key:1,class:E([`markdown-field`,{"page-body":s.value}])},[ee(_(`textarea`,{id:e.field.key,"onUpdate:modelValue":n[2]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0,placeholder:e.field.input_type===`markdown`?`Enter markdown content...`:`One entry per line...`},null,8,Me),[[g,i.value]]),e.field.input_type===`markdown`?(T(),m(`small`,Ne,[...n[10]||=[_(`i`,{class:`iconoir-info-circle`},null,-1),O(` Markdown, `,-1),_(`code`,null,`[[links]]`,-1),O(` and `,-1),_(`code`,null,"```asd",-1),O(` diagrams. Use Edit for the rich text editor `,-1)]])):d(``,!0)],2)):e.field.input_type===`code`?(T(),m(`div`,{key:2,class:E([`code-field`,l.value&&[`with-preview`,`layout-${ie(u)}`]])},[_(`div`,Pe,[ee(_(`textarea`,{id:e.field.key,"onUpdate:modelValue":n[3]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0,placeholder:`Enter ${e.field.code_language||``} code...`,spellcheck:`false`},null,8,Fe),[[g,i.value]]),_(`small`,Ie,[n[11]||=_(`i`,{class:`iconoir-code`},null,-1),O(` `+w(v.value)+` code `,1)])]),l.value?(T(),c(Ee,{key:0,class:`field-diagram-preview`,source:String(i.value)},null,8,[`source`])):d(``,!0)],2)):e.field.input_type===`number`?ee((T(),m(`input`,{key:3,id:e.field.key,type:`number`,"onUpdate:modelValue":n[4]||=e=>i.value=e,step:e.field.step,"aria-invalid":y.value?`true`:void 0},null,8,Le)),[[g,i.value]]):e.field.input_type===`url`?ee((T(),m(`input`,{key:4,id:e.field.key,type:`url`,"onUpdate:modelValue":n[5]||=e=>i.value=e,placeholder:`https://...`,"aria-invalid":y.value?`true`:void 0},null,8,Re)),[[g,i.value]]):e.field.input_type===`list`?ee((T(),m(`input`,{key:5,id:e.field.key,type:`text`,"onUpdate:modelValue":n[6]||=e=>i.value=e,placeholder:`Comma-separated values`,"aria-invalid":y.value?`true`:void 0},null,8,ze)),[[g,i.value]]):ee((T(),m(`input`,{key:6,id:e.field.key,type:`text`,"onUpdate:modelValue":n[7]||=e=>i.value=e,"aria-invalid":y.value?`true`:void 0},null,8,Be)),[[g,i.value]]),e.field.description&&![`textarea`,`markdown`,`code`].includes(e.field.input_type)?(T(),m(`small`,Ve,w(e.field.description),1)):d(``,!0),y.value?(T(),m(`div`,He,w(e.error.join(`, `)),1)):d(``,!0)],2))}},[[`__scopeId`,`data-v-fe1221de`]]),We={class:`relations-editor`},Ge={key:0,class:`no-relations`},Ke={id:`relations-list`},qe={class:`relation-text`},Je=[`onClick`],Ye={class:`add-relation-row`},Xe=[`value`],Ze=[`value`],Qe=C({__name:`EditorRelations`,props:{relations:Array,relationOptions:Array,instancesByKind:Object},emits:[`update:relations`],setup(e,{emit:t}){let n=e,r=t,i=D(``),a=D(``),s=h(()=>[...n.relations].sort((e,t)=>(e.verb+e.kind+e.name).localeCompare(t.verb+t.kind+t.name))),c=h(()=>i.value?n.relationOptions.find(e=>e.combo===i.value)?.target_kind:null),l=h(()=>c.value&&n.instancesByKind[c.value]||[]);v(i,()=>{a.value=``});function u(){if(!i.value||!a.value)return;let e=n.relationOptions.find(e=>e.combo===i.value);if(!e||n.relations.some(t=>t.verb===e.verb&&t.kind===e.target_kind&&t.name===a.value))return;let t=[...n.relations,{verb:e.verb,kind:e.target_kind,name:a.value}];r(`update:relations`,t),i.value=``,a.value=``}function d(e){let t=n.relations.filter((t,n)=>n!==e);r(`update:relations`,t)}return(t,n)=>(T(),m(`div`,We,[!e.relationOptions||e.relationOptions.length===0?(T(),m(`p`,Ge,` This resource type has no defined relations. `)):(T(),m(ne,{key:1},[_(`div`,Ke,[(T(!0),m(ne,null,f(s.value,(e,t)=>(T(),m(`div`,{key:`${e.verb}:${e.kind}:${e.name}`,class:`relation-item`},[_(`span`,qe,[_(`strong`,null,w(e.verb),1),O(` → `+w(e.kind)+`: `,1),_(`em`,null,w(e.name),1)]),_(`button`,{class:`btn-remove`,type:`button`,title:`Remove`,onClick:e=>d(t)},[...n[2]||=[_(`i`,{class:`iconoir-xmark`},null,-1)]],8,Je)]))),128))]),_(`div`,Ye,[ee(_(`select`,{"onUpdate:modelValue":n[0]||=e=>i.value=e},[n[3]||=_(`option`,{value:``},`Select relation...`,-1),(T(!0),m(ne,null,f(e.relationOptions,e=>(T(),m(`option`,{key:e.combo,value:e.combo},w(e.verb)+` → `+w(e.target_kind),9,Xe))),128))],512),[[o,i.value]]),ee(_(`select`,{"onUpdate:modelValue":n[1]||=e=>a.value=e},[n[4]||=_(`option`,{value:``},`Select instance...`,-1),(T(!0),m(ne,null,f(l.value,e=>(T(),m(`option`,{key:e,value:e},w(e),9,Ze))),128))],512),[[o,a.value]]),_(`button`,{class:`secondary btn-add`,type:`button`,onClick:u},[...n[5]||=[_(`i`,{class:`iconoir-plus`},null,-1),O(` Add `,-1)]])])],64))]))}},[[`__scopeId`,`data-v-a987a6fe`]]),$e={class:`yaml-output-container`},et={key:0,class:`conflict-error`},tt={class:`yaml-success`},nt={id:`yaml-content`},rt={key:0,class:`yaml-file-info`},it={key:1,class:`yaml-instructions`},at={class:`yaml-actions`},ot=[`disabled`],st=C({__name:`EditorYamlOutput`,props:{yaml:String,format:{type:String,default:`yaml`},kind:String,name:String,contentHash:String,pathRef:String,inlineEditEnabled:Boolean},emits:[`editAgain`],setup(e,{emit:t}){let n=e,r=D(null),i=D(`idle`),o=D(`idle`),s=D(null),c=h(()=>n.format===`markdown`),u=h(()=>c.value?`Markdown`:`YAML`),f=h(()=>c.value?`.md`:`.yaml`);l(()=>{r.value&&se(r.value)}),v(()=>n.yaml,async()=>{await b(),r.value&&se(r.value)});async function p(){try{await navigator.clipboard.writeText(n.yaml),i.value=`copied`,setTimeout(()=>{i.value=`idle`},2e3)}catch{let e=document.createElement(`textarea`);e.value=n.yaml,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),i.value=`copied`,setTimeout(()=>{i.value=`idle`},2e3)}}async function g(){o.value=`saving`,s.value=null;try{let e=await a(n.kind,n.name,n.yaml,n.contentHash);e.success?(o.value=`saved`,setTimeout(()=>{o.value=`idle`},2e3)):e.conflict?(s.value=e.error,o.value=`idle`):(alert(`Save failed: `+e.error),o.value=`idle`)}catch(e){alert(`Save failed: `+e.message),o.value=`idle`}}return(t,n)=>(T(),m(`div`,$e,[s.value?(T(),m(`div`,et,[n[1]||=_(`i`,{class:`iconoir-warning-triangle`},null,-1),_(`span`,null,w(s.value),1)])):d(``,!0),_(`p`,tt,[n[2]||=_(`i`,{class:`iconoir-check-circle`},null,-1),O(` Generated `+w(u.value),1)]),_(`div`,{ref_key:`codeEl`,ref:r},[_(`pre`,nt,[_(`code`,{class:E(`language-${e.format}`)},w(e.yaml),3)])],512),_(`footer`,null,[e.pathRef?(T(),m(`p`,rt,[n[3]||=_(`i`,{class:`iconoir-folder`},null,-1),_(`span`,null,`Source: `+w(e.pathRef),1)])):(T(),m(`p`,it,[n[10]||=_(`i`,{class:`iconoir-info-circle`},null,-1),_(`span`,null,[O(` Copy this `+w(u.value)+` and save it to a `,1),_(`code`,null,w(f.value),1),n[6]||=O(` file in your resources directory`,-1),c.value?(T(),m(ne,{key:0},[n[4]||=O(` (named `,-1),_(`code`,null,w(e.name)+`.md`,1),n[5]||=O(`)`,-1)],64)):d(``,!0),n[7]||=O(`, `,-1),n[8]||=_(`br`,null,null,-1),n[9]||=O(`then reload the application. `,-1)])])),_(`div`,at,[e.pathRef&&e.inlineEditEnabled?(T(),m(`button`,{key:0,type:`button`,onClick:g,disabled:o.value===`saving`,class:E({saved:o.value===`saved`})},[_(`i`,{class:E(o.value===`saving`?`iconoir-refresh`:o.value===`saved`?`iconoir-check`:`iconoir-check-circle`)},null,2),O(` `+w(o.value===`saving`?`Saving...`:o.value===`saved`?`Saved!`:`Save to File`),1)],10,ot)):d(``,!0),_(`button`,{type:`button`,onClick:p,class:E({copied:i.value===`copied`})},[_(`i`,{class:E(i.value===`copied`?`iconoir-check`:`iconoir-copy`)},null,2),O(` `+w(i.value===`copied`?`Copied!`:`Copy to Clipboard`),1)],2),_(`button`,{class:`secondary`,type:`button`,onClick:n[0]||=e=>t.$emit(`editAgain`)},[...n[11]||=[_(`i`,{class:`iconoir-edit-pencil`},null,-1),O(` Edit Again `,-1)]])])])]))}},[[`__scopeId`,`data-v-b5ea938f`]]);function k(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ct(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var lt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,ut=lt&&`documentMode`in document?document.documentMode:null,dt=lt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ft=lt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),pt=!(!lt||!(`InputEvent`in window)||ut)&&`getTargetRanges`in new window.InputEvent(`input`),mt=lt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ht=lt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,gt=lt&&/Android/.test(navigator.userAgent),_t=lt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vt=lt&&gt&&_t,yt=lt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&dt&&!_t,bt=0,xt=1,St=2,Ct=1,wt=2,Tt=3,Et=4,Dt=5,Ot=6,kt=mt||ht||yt?`\xA0`:`​`,At=`
2
2
 
3
3
  `,jt=ft?`\xA0`:kt,Mt=`֑-߿יִ-﷽ﹰ-ﻼ`,Nt=`A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿`,Pt=RegExp(`^[^`+Nt+`]*[`+Mt+`]`),Ft=RegExp(`^[^`+Mt+`]*[`+Nt+`]`),It={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Lt={directionless:1,unmergeable:2},Rt={center:2,end:6,justify:4,left:1,right:3,start:5},zt={[wt]:`center`,[Ot]:`end`,[Et]:`justify`,[Ct]:`left`,[Tt]:`right`,[Dt]:`start`},Bt={normal:0,segmented:2,token:1},Vt={[bt]:`normal`,[St]:`segmented`,[xt]:`token`},Ht=`$config`;function Ut(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(V(o)&&Ut(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Wt=!1,Gt=0;function Kt(e){Gt=e.timeStamp}function qt(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Yo(e,n)!==void 0}function Jt(e,t,n){let r=Is(Os(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&ss(t,o,i,a,!1)}function Yt(e,t,n){if(F(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Ro(t)&&n.isAttached()}function Xt(e,t,n,r){for(let i=e;i&&!Zs(i);i=Ss(i)){let e=Yo(i,t);if(e!==void 0){let t=G(e,n);if(t)return H(t)||!Y(i)?void 0:[i,t]}else if(i===r)return[r,$o(n)]}}function Zt(e,t,n){Wt=!0;let r=performance.now()-Gt>100;try{ro(e,()=>{let i=I()||function(e){return e.getEditorState().read(()=>{let e=I();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=Xt(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&P(g)&&Ro(p)&&Yt(i,p,g)&&Jt(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Jo(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!qt(r,a,e)){if(ft){let e=(Y(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(qt(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||qt(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&es(i),ft&&bs(e)&&i.insertRawText(u))})}finally{Wt=!1}}function Qt(e){let t=e._observer;t!==null&&Zt(e,t.takeRecords(),t)}function $t(e){(function(e){Gt===0&&Os(e).addEventListener(`textInput`,Kt,!0)})(e),e._observer=new MutationObserver((t,n)=>{Zt(e,t,n)})}var en=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||un).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function tn(e,t){return new en(e,t)}function nn(e,t,n=`latest`){let r=(n===`latest`?e.getLatest():e).__state;return r?r.getValue(t):t.defaultValue}function rn(e,t,n){let r;if(z(),typeof n==`function`){let i=e.getLatest(),a=nn(i,t);if(r=n(a),t.isEqual(a,r))return i}else r=n;let i=e.getWritable();return sn(i).updateFromKnown(t,r),i}function an(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=$s(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var on=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return ln(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=ln(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function sn(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new on(t,cn(t));return t.__state=n,n}function cn(e){return e.__state?e.__state.sharedNodeState:Eo(Ws(),e.getType()).sharedNodeState}function ln(e){if(e)for(let t in e)return e}function un(e){return e}function dn(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function fn(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function pn(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function mn(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;let n=new Set;return!(e&&dn(n,e,t)||t&&dn(n,t,e)||e&&fn(n,e,t)||t&&fn(n,t,e))}(c,l))}function hn(e,t){let n=e.mergeWithSibling(t),r=B()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function gn(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&P(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(mn(t,r)){r=hn(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&P(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(mn(r,n)){r=hn(r,n);break}break}n.remove()}}else r.remove()}function _n(e){return vn(e.anchor),vn(e.focus),e}function vn(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),P(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!V(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,A=``,kn=null,An=null,jn=!1,Mn=!1;function Nn(e,t){let n=Tn.get(e);if(t!==null){let n=Zn(e);n.parentNode===t&&t.removeChild(n)}if(En.has(e)||bn._keyToDOMMap.delete(e),V(n)){let e=Gn(n,Tn);Pn(e,0,e.length-1,null)}n!==void 0&&_s(On,xn,Sn,n,`destroyed`)}function Pn(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Nn(t,r)}}function Fn(e,t){e.setProperty(`text-align`,t)}var In=`40px`;function Ln(e,t){let n=yn.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(bn._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||In;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function Rn(e,t){let n=e.style;t===0?Fn(n,``):t===1?Fn(n,`left`):t===2?Fn(n,`center`):t===3?Fn(n,`right`):t===4?Fn(n,`justify`):t===5?Fn(n,`start`):t===6&&Fn(n,`end`)}function zn(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(U(e))return null;let n=e.getParentOrThrow();return U(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Bn(e,t){let n=En.get(e);n===void 0&&k(60);let r=n.createDOM(yn,bn);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,bn),P(n)?r.setAttribute(`data-lexical-text`,`true`):H(n)&&r.setAttribute(`data-lexical-decorator`,`true`),V(n)){let e=n.__indent,t=n.__size;if(zn(r,n),e!==0&&Ln(r,e),t!==0){let e=t-1;Vn(Gn(n,En),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&Rn(r,i),n.isInline()||Un(null,n,r)}else{let t=n.getTextContent();if(H(n)){let t=n.decorate(bn,yn);t!==null&&qn(e,t),r.contentEditable=`false`}A+=t}return t!==null&&t.insertChild(r),_s(On,xn,Sn,n,`created`),r}function Vn(e,t,n,r,i){let a=A;A=``;let o=n;for(;o<=r;++o){Bn(e[o],i);let t=En.get(e[o]);t!==null&&P(t)?kn===null&&(kn=t.getFormat(),An=t.getStyle()):V(t)&&o<r&&!t.isInline()&&(A+=At)}i.element.__lexicalTextContent=A,A=a+A}function Hn(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return M(e)?`line-break`:H(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function Un(e,t,n){let r=Hn(e,Tn),i=Hn(t,En);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Wn(e,t,n){var r;kn=null,An=null,function(e,t,n){let r=A,i=e.__size,a=t.__size;A=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Kn(n,o);else{let e=Zn(n),t=Bn(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Nn(n,null)}let i=En.get(r);P(i)&&kn===null&&(kn=i.getFormat(),An=i.getStyle())}else{let r=Gn(e,Tn),s=Gn(t,En);if(r.length!==i&&k(227),s.length!==a&&k(228),i===0)a!==0&&Vn(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;Pn(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=Jn(Kn(r,a.element)),d++,f++;else{if(l===void 0&&(l=Yn(n,f)),c===void 0)c=Yn(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=Jn(Zn(e)),Nn(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=xs(bn,r);e!==u&&a.withBefore(u).insertChild(e),u=Jn(Kn(r,a.element)),d++,f++}else Bn(r,a.withBefore(u)),f++}let i=En.get(r);i!==null&&P(i)?kn===null&&(kn=i.getFormat(),An=i.getStyle()):V(i)&&f<=s&&!i.isInline()&&(A+=At)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:bn.getElementByKey(e);Vn(n,0,f,s,a.withBefore(t))}else m&&!p&&Pn(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=A,A=r+A}(e,t,t.getDOMSlot(n)),r=t,kn==null||kn===r.__textFormat||Mn||r.setTextFormat(kn),function(e){An==null||An===e.__textStyle||Mn||e.setTextStyle(An)}(t)}function Gn(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&k(101),n.push(r),r=e.__next}return n}function Kn(e,t){let n=Tn.get(e),r=En.get(e);n!==void 0&&r!==void 0||k(61);let i=jn||wn.has(e)||Cn.has(e),a=xs(bn,e);if(n===r&&!i){let e;if(V(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return A+=e,a}if(n!==r&&i&&_s(On,xn,Sn,r,`updated`),r.updateDOM(n,a,yn)){let n=Bn(e,null);return t===null&&k(62),t.replaceChild(n,a),Nn(e,null),n}if(V(n)){V(r)||k(334,e);let t=r.__indent;(jn||t!==n.__indent)&&Ln(a,t);let o=r.__format;if((jn||o!==n.__format)&&Rn(a,o),i)Wn(n,r,a),U(r)||r.isInline()||Un(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),A+=t}if((jn||r.__dir!==n.__dir)&&(zn(a,r),U(r)&&!jn))for(let e of r.getChildren())V(e)&&zn(xs(bn,e.getKey()),e)}else{let t=r.getTextContent();if(H(r)){let t=r.decorate(bn,yn);t!==null&&qn(e,t)}A+=t}if(!Mn&&U(r)&&r.__cachedText!==A){let e=r.getWritable();e.__cachedText=A,r=e}return a}function qn(e,t){let n=bn._pendingDecorators,r=bn._decorators;if(n===null){if(r[e]===t)return;n=Zo(bn)}n[e]=t}function Jn(e){let t=e.nextSibling;return t!==null&&t===bn._blockCursorElement&&(t=t.nextSibling),t}function Yn(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function Xn(e,t,n,r,i,a){A=``,jn=r===2,bn=n,yn=n._config,xn=n._nodes,Sn=bn._listeners.mutation,Cn=i,wn=a,Tn=e._nodeMap,En=t._nodeMap,Mn=t._readOnly,Dn=new Map(n._keyToDOMMap);let o=new Map;return On=o,Kn(`root`,null),bn=void 0,xn=void 0,Cn=void 0,wn=void 0,Tn=void 0,En=void 0,yn=void 0,Dn=void 0,On=void 0,o}function Zn(e){let t=Dn.get(e);return t===void 0&&k(75,e),t}function j(e){return{type:e}}var Qn=j(`SELECTION_CHANGE_COMMAND`),$n=j(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),er=j(`CLICK_COMMAND`),tr=j(`BEFORE_INPUT_COMMAND`),nr=j(`INPUT_COMMAND`),rr=j(`COMPOSITION_START_COMMAND`),ir=j(`COMPOSITION_END_COMMAND`),ar=j(`DELETE_CHARACTER_COMMAND`),or=j(`INSERT_LINE_BREAK_COMMAND`),sr=j(`INSERT_PARAGRAPH_COMMAND`),cr=j(`CONTROLLED_TEXT_INSERTION_COMMAND`),lr=j(`PASTE_COMMAND`),ur=j(`REMOVE_TEXT_COMMAND`),dr=j(`DELETE_WORD_COMMAND`),fr=j(`DELETE_LINE_COMMAND`),pr=j(`FORMAT_TEXT_COMMAND`),mr=j(`UNDO_COMMAND`),hr=j(`REDO_COMMAND`),gr=j(`KEYDOWN_COMMAND`),_r=j(`KEY_ARROW_RIGHT_COMMAND`),vr=j(`MOVE_TO_END`),yr=j(`KEY_ARROW_LEFT_COMMAND`),br=j(`MOVE_TO_START`),xr=j(`KEY_ARROW_UP_COMMAND`),Sr=j(`KEY_ARROW_DOWN_COMMAND`),Cr=j(`KEY_ENTER_COMMAND`),wr=j(`KEY_SPACE_COMMAND`),Tr=j(`KEY_BACKSPACE_COMMAND`),Er=j(`KEY_ESCAPE_COMMAND`),Dr=j(`KEY_DELETE_COMMAND`),Or=j(`KEY_TAB_COMMAND`),kr=j(`INSERT_TAB_COMMAND`),Ar=j(`INDENT_CONTENT_COMMAND`),jr=j(`OUTDENT_CONTENT_COMMAND`),Mr=j(`DROP_COMMAND`),Nr=j(`FORMAT_ELEMENT_COMMAND`),Pr=j(`DRAGSTART_COMMAND`),Fr=j(`DRAGOVER_COMMAND`),Ir=j(`DRAGEND_COMMAND`),Lr=j(`COPY_COMMAND`),Rr=j(`CUT_COMMAND`),zr=j(`SELECT_ALL_COMMAND`),Br=j(`CLEAR_EDITOR_COMMAND`),Vr=j(`CLEAR_HISTORY_COMMAND`),Hr=j(`CAN_REDO_COMMAND`),Ur=j(`CAN_UNDO_COMMAND`),Wr=j(`FOCUS_COMMAND`),Gr=j(`BLUR_COMMAND`),Kr=j(`KEY_MODIFIER_COMMAND`),qr=Object.freeze({}),Jr=[[`keydown`,function(e,t){Yr=e.timeStamp,Xr=e.key,!t.isComposing()&&J(t,gr,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;zs(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&ro(t,()=>{ko(n)||(ni=!0)})}],[`compositionstart`,function(e,t){J(t,rr,e)}],[`compositionend`,function(e,t){ft?ii=!0:ht||!mt&&!yt?J(t,ir,e):(ai=!0,oi=e.data)}],[`input`,function(e,t){e.stopPropagation(),ro(t,()=>{t.dispatchCommand(nr,e)},{event:e}),Qr=null}],[`click`,function(e,t){ro(t,()=>{let n=I(),r=Is(Os(t)),i=Ea();if(r){if(F(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!U(a)&&K().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=tc(a,e=>V(e)&&!e.isInline());V(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(Y(n)||Ro(n))&&es(Ta(i,r,t,e))}}J(t,er,e)})}],[`cut`,qr],[`copy`,qr],[`dragstart`,qr],[`dragover`,qr],[`dragend`,qr],[`paste`,qr],[`focus`,qr],[`blur`,qr],[`drop`,qr]];pt&&Jr.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||ft&&bs(t)||n!==`insertCompositionText`&&J(t,tr,e)}(e,t)]);var Yr=0,Xr=null,Zr=0,Qr=null,$r=new WeakMap,ei=new WeakMap,ti=!1,ni=!1,ri=!1,ii=!1,ai=!1,oi=``,si=null,ci=[0,``,0,`root`,0];function li(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=B(),l=Is(Os(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!P(s)||(!i&&(!pt||Zr<r+50)||s.isDirty()&&p<2||ns(n))&&a.offset!==o.offset&&!s.isComposing()||Lo(s)||s.isDirty()&&p>1||(i||!pt)&&f!==null&&!s.isComposing()&&u!==Bo(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Io(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(P(t)||V(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function ui(e,t){return Ro(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function di(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;ti&&(ti=!1,ui(r,i)&&ui(a,o)&&!si)||ro(t,()=>{if(!n)return void es(null);if(!jo(t,r,a))return;let s=I();if(si&&F(s)&&s.isCollapsed()){let e=s.anchor,t=si.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=si.clone(),es(s))}if(si=null,F(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=Os(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=ci,f=K(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)fi(s,o,c);else if(n.type===`text`)P(r)||k(141),pi(s,r);else if(n.type===`element`&&!p){V(r)||k(259);let e=n.getNode();e.isEmpty()?function(e,t){fi(e,t.getTextFormat(),t.getTextStyle())}(s,e):fi(s,0,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(P(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}J(t,Qn,void 0)})}function fi(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function pi(e,t){fi(e,t.getFormat(),t.getStyle())}function mi(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function hi(e){let t=e.inputType,n=mi(e),r=B(),i=I();if(t===`deleteContentBackward`){if(i===null){let e=Ea();if(!F(e))return!0;es(e.clone())}if(F(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,Xr===`MediaLast`&&a<Yr+30&&r.isComposing()&&t){if(Ko(null),Yr=0,setTimeout(()=>{ro(r,()=>{Ko(null)})},30),F(i)){let e=i.anchor.getNode();e.markDirty(),P(e)||k(142),pi(i,e)}}else{Ko(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=vt&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!H(ys(i.anchor,!0))),!c){J(r,ar,!0);let e=I();vt&&F(e)&&e.isCollapsed()&&(si=e,setTimeout(()=>si=null))}}return!0}}var a;if(!F(i))return!0;let o=e.data;Qr!==null&&os(!1,r,Qr),i.dirty&&Qr===null||!i.isCollapsed()||U(i.anchor.getNode())||n===null||i.applyDOMRange(n),Qr=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
4
4
  `)e.preventDefault(),J(r,or,!1);else if(o===At)e.preventDefault(),J(r,sr,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&li(i,n,o,e.timeStamp,!0)?(e.preventDefault(),J(r,cr,o)):Qr=o;return Zr=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:J(r,cr,e);break;case`insertFromComposition`:Ko(null),J(r,cr,e);break;case`insertLineBreak`:Ko(null),J(r,or,!1);break;case`insertParagraph`:Ko(null),ri&&!ht?(ri=!1,J(r,or,!1)):J(r,sr,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:J(r,lr,e);break;case`deleteByComposition`:(function(e,t){return e!==t||V(e)||V(t)||!Io(e)||!Io(t)})(l,u)&&J(r,ur,e);break;case`deleteByDrag`:case`deleteByCut`:J(r,ur,e);break;case`deleteContent`:J(r,ar,!1);break;case`deleteWordBackward`:J(r,dr,!0);break;case`deleteWordForward`:J(r,dr,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:J(r,fr,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:J(r,fr,!1);break;case`formatStrikeThrough`:J(r,pr,`strikethrough`);break;case`formatBold`:J(r,pr,`bold`);break;case`formatItalic`:J(r,pr,`italic`);break;case`formatUnderline`:J(r,pr,`underline`);break;case`historyUndo`:J(r,mr,void 0);break;case`historyRedo`:J(r,hr,void 0)}return!0}function gi(e){if(Y(e.target)&&ko(e.target))return!0;let t=B(),n=I(),r=e.data,i=mi(e);if(r!=null&&F(n)&&li(n,i,r,e.timeStamp,!1)){ii&&=(yi(t,r),!1);let i=n.anchor.getNode(),a=Is(Os(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;pt&&!n.isCollapsed()&&P(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===as(a.anchorNode)||J(t,cr,r);let l=r.length;ft&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),vt&&t.isComposing()&&(Yr=0,Ko(null))}else os(!1,t,r===null?void 0:r),ii&&=(yi(t,r||void 0),!1);return function(){z(),Qt(B())}(),!0}function _i(e){let t=B(),n=I();if(F(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();Ko(r.key),ws(Pi),(e.timeStamp<Yr+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||P(i)&&i.getStyle()!==n.style)&&J(t,cr,jt)}return!0}function vi(e){return yi(B(),e.data),ws(Fi),!0}function yi(e,t){let n=e._compositionKey;if(Ko(null),n!==null&&t!=null){if(t===``){let t=G(n),r=Bo(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&P(t)){let n=Is(Os(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),ss(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
@@ -1,2 +1,2 @@
1
- import{$ as e,A as t,B as n,E as r,I as i,J as a,L as o,N as s,P as c,T as l,X as u,a as d,at as f,j as p,q as m,rt as h,x as g,z as _}from"./index-yiZbbvAs.js";var v={key:0},y={class:`error-header`},b={class:`error-message`},x={class:`error-location`},S={class:`error-line-badge`},C={key:0,class:`error-code-block`},w={class:`line-number`},T={key:1},E=d({__name:`ErrorPage`,setup(d){let E=l(),D=r(),O=s(()=>{try{return E.query.data?JSON.parse(E.query.data):null}catch{return null}});async function k(){let e=await g();e.error?D.replace({name:`error`,query:{data:JSON.stringify(e.error)}}):(D.push(`/`),window.location.reload())}return(r,s)=>{let l=u(`router-link`);return O.value?(m(),o(`div`,v,[c(`header`,null,[c(`article`,y,[s[1]||=c(`h3`,null,[c(`i`,{class:`iconoir-warning-triangle`}),_(` Error `)],-1),c(`p`,b,f(O.value.error),1),c(`p`,x,[s[0]||=c(`i`,{class:`iconoir-page`},null,-1),_(` `+f(O.value.path)+` `,1),c(`span`,S,`Line `+f(O.value.line_no),1)])]),c(`a`,{href:`#`,class:`reload-btn`,onClick:t(k,[`prevent`])},[...s[2]||=[c(`i`,{class:`iconoir-refresh`},null,-1),_(` Reload `,-1)]])]),O.value.context?(m(),o(`div`,C,[c(`pre`,null,[c(`code`,null,[(m(!0),o(p,null,a(O.value.context,e=>(m(),o(`span`,{key:e.line_no,class:h(e.selected?`error-line`:`code-line`)},[c(`span`,w,f(String(e.line_no).padStart(4,` `)),1),_(f(e.content)+`
1
+ import{$ as e,A as t,B as n,E as r,I as i,J as a,L as o,N as s,P as c,T as l,X as u,a as d,at as f,j as p,q as m,rt as h,x as g,z as _}from"./index-DMhBow5t.js";var v={key:0},y={class:`error-header`},b={class:`error-message`},x={class:`error-location`},S={class:`error-line-badge`},C={key:0,class:`error-code-block`},w={class:`line-number`},T={key:1},E=d({__name:`ErrorPage`,setup(d){let E=l(),D=r(),O=s(()=>{try{return E.query.data?JSON.parse(E.query.data):null}catch{return null}});async function k(){let e=await g();e.error?D.replace({name:`error`,query:{data:JSON.stringify(e.error)}}):(D.push(`/`),window.location.reload())}return(r,s)=>{let l=u(`router-link`);return O.value?(m(),o(`div`,v,[c(`header`,null,[c(`article`,y,[s[1]||=c(`h3`,null,[c(`i`,{class:`iconoir-warning-triangle`}),_(` Error `)],-1),c(`p`,b,f(O.value.error),1),c(`p`,x,[s[0]||=c(`i`,{class:`iconoir-page`},null,-1),_(` `+f(O.value.path)+` `,1),c(`span`,S,`Line `+f(O.value.line_no),1)])]),c(`a`,{href:`#`,class:`reload-btn`,onClick:t(k,[`prevent`])},[...s[2]||=[c(`i`,{class:`iconoir-refresh`},null,-1),_(` Reload `,-1)]])]),O.value.context?(m(),o(`div`,C,[c(`pre`,null,[c(`code`,null,[(m(!0),o(p,null,a(O.value.context,e=>(m(),o(`span`,{key:e.line_no,class:h(e.selected?`error-line`:`code-line`)},[c(`span`,w,f(String(e.line_no).padStart(4,` `)),1),_(f(e.content)+`
2
2
  `,1)],2))),128))])])])):i(``,!0)])):(m(),o(`div`,T,[s[4]||=c(`p`,null,`No error data available.`,-1),n(l,{to:`/`},{default:e(()=>[...s[3]||=[_(`Back to home`,-1)]]),_:1})]))}}},[[`__scopeId`,`data-v-cb96d9d5`]]);export{E as default};
@@ -1 +1 @@
1
- import{G as e,K as t,L as n,P as r,U as i,a,m as o,q as s,tt as c}from"./index-yiZbbvAs.js";import{t as l}from"./useGraphviz-Dnm2pkon.js";import{t as u}from"./usePanZoom-HxgEsqq2.js";var d={key:0},f={key:1,class:`graph-container graph-expand`},p=[`innerHTML`],m=a({__name:`GraphView`,setup(a){let m=c(``),h=c(!0),g=c(null),_=null;e(async()=>{let e=await o();m.value=e?await l(e):``,h.value=!1,await i(),v()}),t(()=>{_?.destroy()});function v(){if(!g.value)return;let e=g.value.querySelector(`svg`);e&&(_=u(e,g.value))}return(e,t)=>(s(),n(`article`,null,[t[1]||=r(`header`,null,[r(`h2`,null,`Architecture Overview`)],-1),h.value?(s(),n(`div`,d,[...t[0]||=[r(`p`,null,`Loading graph...`,-1)]])):(s(),n(`div`,f,[r(`div`,{id:`graphviz`,ref_key:`graphEl`,ref:g,class:`fullcanvas`,innerHTML:m.value},null,8,p)]))]))}},[[`__scopeId`,`data-v-dbc5bc1f`]]);export{m as default};
1
+ import{G as e,K as t,L as n,P as r,U as i,a,m as o,q as s,tt as c}from"./index-DMhBow5t.js";import{t as l}from"./useGraphviz-Dnm2pkon.js";import{t as u}from"./usePanZoom-HxgEsqq2.js";var d={key:0},f={key:1,class:`graph-container graph-expand`},p=[`innerHTML`],m=a({__name:`GraphView`,setup(a){let m=c(``),h=c(!0),g=c(null),_=null;e(async()=>{let e=await o();m.value=e?await l(e):``,h.value=!1,await i(),v()}),t(()=>{_?.destroy()});function v(){if(!g.value)return;let e=g.value.querySelector(`svg`);e&&(_=u(e,g.value))}return(e,t)=>(s(),n(`article`,null,[t[1]||=r(`header`,null,[r(`h2`,null,`Architecture Overview`)],-1),h.value?(s(),n(`div`,d,[...t[0]||=[r(`p`,null,`Loading graph...`,-1)]])):(s(),n(`div`,f,[r(`div`,{id:`graphviz`,ref_key:`graphEl`,ref:g,class:`fullcanvas`,innerHTML:m.value},null,8,p)]))]))}},[[`__scopeId`,`data-v-dbc5bc1f`]]);export{m as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["vue/GraphView-liQJzFyo.js","vue/index-yiZbbvAs.js","vue/mermaid-C3bOamfn.js","vue/rolldown-runtime-COiEfhsA.js","vue/index-BLSE5DSv.css","vue/useGraphviz-Dnm2pkon.js","vue/usePanZoom-HxgEsqq2.js","vue/GraphView-BvWAbUAl.css"])))=>i.map(i=>d[i]);
2
- import{M as e}from"./mermaid-C3bOamfn.js";import{F as t,H as n,L as r,N as i,P as a,V as o,nt as s,q as c}from"./index-yiZbbvAs.js";import{n as l}from"./PageView-BIxT_t49.js";var u={key:2},d={__name:`HomePage`,setup(d){let f=o(()=>e(()=>import(`./GraphView-liQJzFyo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),p=n(`pages`,null),m=n(`pageHome`,null),h=i(()=>p?.value!=null),g=i(()=>m?.value);return(e,n)=>g.value?(c(),t(l,{key:0,name:g.value.name},null,8,[`name`])):h.value?(c(),t(s(f),{key:1})):(c(),r(`article`,u,[...n[0]||=[a(`p`,null,`Loading...`,-1)]]))}};export{d as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["vue/GraphView-BRKwxa--.js","vue/index-DMhBow5t.js","vue/mermaid-C3bOamfn.js","vue/rolldown-runtime-COiEfhsA.js","vue/index-B_YGrWD8.css","vue/useGraphviz-Dnm2pkon.js","vue/usePanZoom-HxgEsqq2.js","vue/GraphView-BvWAbUAl.css"])))=>i.map(i=>d[i]);
2
+ import{M as e}from"./mermaid-C3bOamfn.js";import{F as t,H as n,L as r,N as i,P as a,V as o,nt as s,q as c}from"./index-DMhBow5t.js";import{n as l}from"./PageView-DAqHjL1x.js";var u={key:2},d={__name:`HomePage`,setup(d){let f=o(()=>e(()=>import(`./GraphView-BRKwxa--.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),p=n(`pages`,null),m=n(`pageHome`,null),h=i(()=>p?.value!=null),g=i(()=>m?.value);return(e,n)=>g.value?(c(),t(l,{key:0,name:g.value.name},null,8,[`name`])):h.value?(c(),t(s(f),{key:1})):(c(),r(`article`,u,[...n[0]||=[a(`p`,null,`Loading...`,-1)]]))}};export{d as default};