(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/xml/libxml#parser-e
    (lambda (_source156579_
             _parse-string156580_
             _parse-u8vector156581_
             _parse-port156582_)
      (if (string? _source156579_)
          _parse-string156580_
          (if (u8vector? _source156579_)
              (lambda (_src156584_ _url156585_ _enc156586_ _opt156587_)
                (_parse-u8vector156581_
                 _src156584_
                 '0
                 (u8vector-length _src156584_)
                 _url156585_
                 _enc156586_
                 _opt156587_))
              (if (input-port? _source156579_)
                  _parse-port156582_
                  (error '"Illegal source; Expected string, u8vector, or input-port"
                         _source156579_))))))
  (define std/xml/libxml#parse-xml__%
    (lambda (_g156588_
             _url156534156540_
             _encoding156535156542_
             _options156536156544_
             _ns156537156546_
             _source156548_)
      (let* ((_url156550_
              (if (eq? _url156534156540_ absent-value)
                  '"none.xml"
                  _url156534156540_))
             (_encoding156552_
              (if (eq? _encoding156535156542_ absent-value)
                  '"UTF-8"
                  _encoding156535156542_))
             (_options156554_
              (if (eq? _options156536156544_ absent-value)
                  std/xml/libxml#parse-xml-default-options
                  _options156536156544_))
             (_ns156556_
              (if (eq? _ns156537156546_ absent-value) '() _ns156537156546_))
             (_parse156558_
              (std/xml/libxml#parser-e
               _source156548_
               std/xml/libxml#xmlRead-string
               std/xml/libxml#xmlRead-u8vector
               std/xml/libxml#xmlRead-port))
             (_xtree156560_
              (_parse156558_
               _source156548_
               _url156550_
               _encoding156552_
               _options156554_)))
        (if _xtree156560_
            (with-unwind-protect
             (lambda ()
               (std/xml/libxml#xml-doc->sxml _xtree156560_ _ns156556_))
             (lambda () (std/xml/libxml#xmlFreeDoc _xtree156560_)))
            (error '"Error parsing xml; no parse tree" _source156548_)))))
  (define std/xml/libxml#parse-xml__@
    (lambda (_keys156533156568_ . _args156570_)
      (apply std/xml/libxml#parse-xml__%
             _keys156533156568_
             (table-ref _keys156533156568_ 'url: absent-value)
             (table-ref _keys156533156568_ 'encoding: absent-value)
             (table-ref _keys156533156568_ 'options: absent-value)
             (table-ref _keys156533156568_ 'namespaces: absent-value)
             _args156570_)))
  (define std/xml/libxml#parse-xml
    (lambda _args156538156576_
      (apply keyword-dispatch
             '#(url: options: #f #f encoding: namespaces:)
             std/xml/libxml#parse-xml__@
             _args156538156576_)))
  (define std/xml/libxml#parse-html__%
    (lambda (_g156589_
             _url156487156493_
             _encoding156488156495_
             _options156489156497_
             _filter-els156490156499_
             _source156501_)
      (let* ((_url156503_
              (if (eq? _url156487156493_ absent-value)
                  '"none.html"
                  _url156487156493_))
             (_encoding156505_
              (if (eq? _encoding156488156495_ absent-value)
                  '"UTF-8"
                  _encoding156488156495_))
             (_options156507_
              (if (eq? _options156489156497_ absent-value)
                  std/xml/libxml#parse-html-default-options
                  _options156489156497_))
             (_filter-els156509_
              (if (eq? _filter-els156490156499_ absent-value)
                  '()
                  _filter-els156490156499_))
             (_parse156511_
              (std/xml/libxml#parser-e
               _source156501_
               std/xml/libxml#htmlRead-string
               std/xml/libxml#htmlRead-u8vector
               std/xml/libxml#htmlRead-port))
             (_xtree156513_
              (_parse156511_
               _source156501_
               _url156503_
               _encoding156505_
               _options156507_)))
        (if _xtree156513_
            (with-unwind-protect
             (lambda ()
               (std/xml/libxml#html-doc->sxml
                _xtree156513_
                (std/xml/libxml#node-filter-e _filter-els156509_)))
             (lambda () (std/xml/libxml#xmlFreeDoc _xtree156513_)))
            (error '"Error parsing html; no parse tree" _source156501_)))))
  (define std/xml/libxml#parse-html__@
    (lambda (_keys156486156521_ . _args156523_)
      (apply std/xml/libxml#parse-html__%
             _keys156486156521_
             (table-ref _keys156486156521_ 'url: absent-value)
             (table-ref _keys156486156521_ 'encoding: absent-value)
             (table-ref _keys156486156521_ 'options: absent-value)
             (table-ref _keys156486156521_ 'filter: absent-value)
             _args156523_)))
  (define std/xml/libxml#parse-html
    (lambda _args156491156529_
      (apply keyword-dispatch
             '#(encoding: options: url: filter:)
             std/xml/libxml#parse-html__@
             _args156491156529_)))
  (define std/xml/libxml#xml-doc->sxml
    (lambda (_xtree156452_ _ns156453_)
      (letrec* ((_nsmap156455_
                 (if (table? _ns156453_)
                     _ns156453_
                     (if (pair? _ns156453_) (list->table _ns156453_) '#f)))
                (_ns-name-e156456_
                 (lambda (_node156470_ _node-name156471_ _node-ns156472_)
                   (let ((_name156474_ (_node-name156471_ _node156470_))
                         (_ns156475_ (_node-ns156472_ _node156470_)))
                     (if _ns156475_
                         (let* ((_href156477_
                                 (std/xml/libxml#xmlNs-href _ns156475_))
                                (_pre156482_
                                 (let ((_$e156479_
                                        (if _nsmap156455_
                                            (table-ref
                                             _nsmap156455_
                                             _href156477_
                                             '#f)
                                            '#f)))
                                   (if _$e156479_ _$e156479_ _href156477_))))
                           (string->symbol
                            (string-append _pre156482_ '":" _name156474_)))
                         (string->symbol _name156474_)))))
                (_element-e156457_
                 (lambda (_node156468_)
                   (_ns-name-e156456_
                    _node156468_
                    std/xml/libxml#xmlNode-name
                    std/xml/libxml#xmlNode-ns)))
                (_attribute-e156458_
                 (lambda (_node156466_)
                   (_ns-name-e156456_
                    _node156466_
                    std/xml/libxml#xmlAttr-name
                    std/xml/libxml#xmlAttr-ns))))
        (let ((_body156463_
               (std/xml/libxml#xmlNode->sxml
                (std/xml/libxml#xmlDocGetRootElement _xtree156452_)
                false
                _element-e156457_
                _attribute-e156458_))
              (_nsassoc156464_
               (if _nsmap156455_
                   (hash-map
                    (lambda (_href156460_ _pre156461_)
                      (cons (string->symbol _pre156461_)
                            (cons _href156460_ '())))
                    _nsmap156455_)
                   '#f)))
          (if _nsassoc156464_
              (cons '*TOP*
                    (cons (cons '@
                                (cons (cons '*NAMESPACES* _nsassoc156464_)
                                      '()))
                          _body156463_))
              (cons '*TOP* _body156463_))))))
  (define std/xml/libxml#html-doc->sxml
    (lambda (_xtree156449_ _filter-e156450_)
      (cons '*TOP*
            (std/xml/libxml#xmlNode->sxml
             (std/xml/libxml#xmlDocGetRootElement _xtree156449_)
             _filter-e156450_
             std/xml/libxml#xmlNode-name-e
             std/xml/libxml#xmlAttr-name-e))))
  (define std/xml/libxml#xmlNode->sxml
    (lambda (_node156433_
             _filter-e156434_
             _element-e156435_
             _attribute-e156436_)
      (let _recur156438_ ((_node156440_ _node156433_))
        (if _node156440_
            (if (_filter-e156434_ _node156440_)
                (_recur156438_ (std/xml/libxml#xmlNode-next _node156440_))
                (let ((_type156442_ (std/xml/libxml#xmlNode-type _node156440_))
                      (_rest156443_
                       (_recur156438_
                        (std/xml/libxml#xmlNode-next _node156440_))))
                  (if (eq? _type156442_ std/xml/libxml#XML_ELEMENT_NODE)
                      (let ((_el156445_ (_element-e156435_ _node156440_))
                            (_attr156446_
                             (std/xml/libxml#xmlNode-properties _node156440_))
                            (_children156447_
                             (_recur156438_
                              (std/xml/libxml#xmlNode-children _node156440_))))
                        (if _attr156446_
                            (cons (cons _el156445_
                                        (cons (cons '@
                                                    (std/xml/libxml#xmlAttr->list
                                                     _attr156446_
                                                     _attribute-e156436_))
                                              _children156447_))
                                  _rest156443_)
                            (cons (cons _el156445_ _children156447_)
                                  _rest156443_)))
                      (if (eq? _type156442_ std/xml/libxml#XML_TEXT_NODE)
                          (cons (std/xml/libxml#xmlNode-content _node156440_)
                                _rest156443_)
                          (if (eq? _type156442_
                                   std/xml/libxml#XML_CDATA_SECTION_NODE)
                              (cons (cons '*CDATA*
                                          (cons (std/xml/libxml#xmlNode-content
                                                 _node156440_)
                                                '()))
                                    _rest156443_)
                              (if (eq? _type156442_
                                       std/xml/libxml#XML_COMMENT_NODE)
                                  _rest156443_
                                  (error '"Unexpected node"
                                         (std/xml/libxml#xmlNode-name
                                          _node156440_)
                                         _type156442_)))))))
            '()))))
  (define std/xml/libxml#xmlAttr->list
    (lambda (_attr156421_ _attribute-e156422_)
      (let _recur156424_ ((_attr156426_ _attr156421_))
        (if _attr156426_
            (let* ((_value156428_
                    (std/xml/libxml#xmlAttr-children _attr156426_))
                   (_value156430_
                    (if _value156428_
                        (cons (std/xml/libxml#xmlNode-content _value156428_)
                              '())
                        '())))
              (cons (cons (_attribute-e156422_ _attr156426_) _value156430_)
                    (_recur156424_
                     (std/xml/libxml#xmlAttr-next _attr156426_))))
            '()))))
  (define std/xml/libxml#xmlNode-name-e
    (lambda (_node156419_)
      (string->symbol (std/xml/libxml#xmlNode-name _node156419_))))
  (define std/xml/libxml#xmlAttr-name-e
    (lambda (_node156417_)
      (string->symbol (std/xml/libxml#xmlAttr-name _node156417_))))
  (define std/xml/libxml#parse-xml-default-options
    (fxior std/xml/libxml#XML_PARSE_NOENT
           std/xml/libxml#XML_PARSE_NONET
           std/xml/libxml#XML_PARSE_NOBLANKS))
  (define std/xml/libxml#parse-html-default-options
    (fxior std/xml/libxml#HTML_PARSE_RECOVER
           std/xml/libxml#HTML_PARSE_NOERROR
           std/xml/libxml#HTML_PARSE_NOWARNING
           std/xml/libxml#HTML_PARSE_NONET
           std/xml/libxml#HTML_PARSE_NOBLANKS))
  (define std/xml/libxml#node-filter-e
    (lambda (_elems156407_)
      (if (null? _elems156407_)
          false
          (lambda (_node156409_)
            (let ((_name156410156412_
                   (std/xml/libxml#xmlNode-name _node156409_)))
              (if _name156410156412_
                  (let ((_name156415_ _name156410156412_))
                    (member _name156415_ _elems156407_))
                  '#f)))))))
