
    /Цi                         S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  S rS r\S	 5       rS
 r " S S\\5      rg)    N)UserDict)	lru_cache)quote)	docscrape)ReprHTMLMixinc                     U R                   n[        R                  " U S3U=(       d    S5      nUc  gUR                  S5      n[	        U5       S[	        U5       3nU SU 3$ )zURL to the relevant section of the docstring using a Text Fragment

https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments
z	 : (.+)\n N   z,-z	#:~:text=)__doc__researchgroupr   )estimator_class
param_namedoc_link	docstringm
param_typetext_fragments          ^/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/sklearn/utils/_repr_html/params.py_generate_link_to_param_docr      sp    
  ''I
		ZL
+Y_"=Ay  JZ()E*,=+>?MZy00    c                     [         R                  " U 5      n [        R                  " 5       nSUl        SUl        SUl        [         R                  " UR                  U5      5      nX;   a  SOSnXPUS.$ )zCategorizes parameters as 'default' or 'user-set' and formats their values.
Escapes or truncates parameter values for display safety and readability.
   r
   2   zuser-setdefault)r   r   param_value)htmlescapereprlibReprmaxlistmaxtuple	maxstringrepr)namevaluenon_default_paramsrcleaned_valuer   s         r   _read_paramsr+   &   s_     ;;tDAAIAJAKKKu.M#9yJ$WWr   c                 .    [         R                  " U 5      $ N)r   NumpyDocString)r   s    r   _scrape_estimator_docstringr/   6   s    ##I..r   c           	         SnSnSn[         R                  " U R                  5      nU(       a3  [        U5      =n(       a!  US    Vs0 s H  nUR                  U_M     nnO0 n/ nU  H  n	[        XU	   U R                  5      n
[        U R                  XR                  5      nUR                  U	S5      =n(       a8  UR                   SUR                   SSR                  UR                  5       3nOSnU R                  (       a#  U(       a  U(       a  UR                  UU
S	   US
9nOU
S	   nUR                  UR                  " S0 U
DSU0D65        M     UR                  SR                  U5      S9$ s  snf )zGenerate HTML representation of estimator parameters.

Creates an HTML table with parameter names and values, wrapped in a
collapsible details element. Parameters are styled differently based
on whether they are default or user-set values.
a/  
        <div class="estimator-table">
            <details>
                <summary>Parameters</summary>
                <table class="parameters-table">
                  <tbody>
                    {rows}
                  </tbody>
                </table>
            </details>
        </div>
    aW  
        <tr class="{param_type}">
            <td><i class="copy-paste-icon"
                 onclick="copyToClipboard('{param_name}',
                          this.parentElement.nextElementSibling)"
            ></i></td>
            <td class="param">{param_display}</td>
            <td class="value">{param_value}</td>
        </tr>
    z
        <a class="param-doc-link"
            rel="noreferrer" target="_blank" href="{link}">
            {param_name}
            <span class="param-doc-description">{param_description}</span>
        </a>
    
ParametersNz: z<br><br>z<br>r   )linkr   param_descriptionparam_display
)rows )inspectgetdocr   r/   r&   r+   non_defaultr   r   gettypejoindescformatappend)paramsPARAMS_TABLE_TEMPLATEPARAM_ROW_TEMPLATE!PARAM_AVAILABLE_DOC_LINK_TEMPLATEestimator_class_docsstructured_docstringparam_docstring	param_mapr6   rowparamr2   param_numpydocr3   r4   s                  r   _params_html_reprrL   ;   s   	)% #>>&*@*@A ;<P QQQ $8#E
#E   /1#E 	 
	
 	DS+v/A/AB*6+A+A3X&]]355>5!&&'r.*=*=)>h;;~22346 
 !%??t(9=DD ."3 E M ",/M&--SS]ST- 0 !''TYYt_'==?
s   E6c                   H   ^  \ rS rSrSr\rS\" 5       SSS.U 4S jjrSr	U =r
$ )
ParamsDict   a  Dictionary-like class to store and provide an HTML representation.

It builds an HTML structure to be used with Jupyter notebooks or similar
environments. It allows storing metadata to track non-default parameters.

Parameters
----------
params : dict, default=None
    The original dictionary of parameters and their values.

non_default : tuple, default=(,)
    The list of non-default parameters.

estimator_class : type, default=None
    The class of the estimator. It allows to find the online documentation
    link for each parameter.

doc_link : str, default=""
    The base URL to the online documentation for the estimator class.
    Used to generate parameter-specific documentation links in the HTML
    representation. If empty, documentation links will not be generated.
Nr	   )rA   r:   r   r   c                Z   > [         TU ]  U=(       d    0 5        X l        X0l        X@l        g r-   )super__init__r:   r   r   )selfrA   r:   r   r   	__class__s        r   rR   ParamsDict.__init__   s'     	2&&. r   )r   r   r:   )__name__
__module____qualname____firstlineno__r   rL   
_html_reprtuplerR   __static_attributes____classcell__)rT   s   @r   rN   rN      s'    . #J %'4RT! !r   rN   )r   r8   r   r    collectionsr   	functoolsr   urllib.parser   sklearn.externals._numpydocr   sklearn.utils._repr_html.baser   r   r+   r/   rL   rN   r7   r   r   <module>rc      sV      	      1 71,X  / /I>X !  !r   