{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
}}

<StateChart
  @src={{state-chart 'boolean'}}
  @initial={{if @expanded 'true' 'false'}}
as |State Guard Action dispatch state|>
{{#let (hash
  toggle=(fn dispatch 'TOGGLE')
  close=(fn dispatch 'FALSE')
  open=(fn dispatch 'TRUE')
  expanded=(state-matches state 'true')
  event=state.context
  button=(unique-id)
  controls=this.ids
) as |_api|}}
  {{#let (assign _api (hash
    Action=(component 'disclosure/action' disclosure=_api)
    Details=(component 'disclosure/details' disclosure=(hash
      add=this.add
      remove=this.remove
      expanded=(state-matches state 'true')
    ))
  )) as |api|}}
    {{yield api}}
  {{/let}}
{{/let}}
</StateChart>