Qf\f ddlZddlZddlZddlZddlZddlZddlZgdZGddeZ ejZ iZ da dad0dddZd0dZd1d Zd Zd Zddd ZGd deZGddeZGddeZGddeZGddeZGddeZGddeZeZGddeZGddeZGdd eZ Gd!d"eZ!d#Z"d$Z#ejHdd%d&k(r Gd'd(eZ%ejHd)k(rGd*d+eZ&Gd,d-eZ'd.Z(e)d/k(re(yy)2N)Erroropenopen_new open_new_tabgetregisterc eZdZy)rN)__name__ __module__ __qualname__1/opt/alt/python312/lib64/python3.12/webbrowser.pyrrsrrF preferredc t5t t||gt|j <|st r#|dt k(rtj d|ntj|dddy#1swYyxYw)Nz.desktopr)_lock _tryorderregister_standard_browsers _browserslower_os_preferred_browserinsertappend)nameklassinstancers rrrsh'    & (#(("3 $**, .dV83DH]3]   Q %   T " s A*A;;Bc tt5t tddd||g}nt}|D]u}d|vr:tj|}|ddk(rt |ddcSt |cS t|j}|d|dcS|dk|dcStd#1swYxYw#t$rt|}YLwxYw)N%s&rz!could not locate runnable browser) rrrshlexsplitBackgroundBrowserGenericBrowserrrKeyError _synthesizer)using alternativesbrowsercommands rrr&sM  *, w   7?kk'*Gr{c!("66%g.. /#GMMO4qz%qz!'!wqz|## $ 3 443U& /%g. /sB87C8CCCc tt5t tdddtD]"}t|}|j |||s"yy#1swY5xYw)NTF)rrrrr)urlnew autoraiserr+s rrrHsX   *,d) <<S) , Us AAc t|dSNr"rr.s rrr^ Q<rc t|dSNr3r4s rrrer5rc |jd}tj|sddgStjj |} t |j}|d}|rp|j|j k(rSddl }|j|}||_ tjj ||_t|d||d|gSddgS#t$rddgcYSwxYw)Nrr")rr) r$shutilwhichospathbasenamerrr'copyrr)r+rcmdrr, controllerr?s rr(r(ms  --/! C << d| 77  C DDJJL)Jdjjlj&9&99YYz* !  gg..w7 $yIj!! $< d|sC C0/C0c0eZdZ dgZddZddZdZdZy) BaseBrowserrc ||_||_yN)rr>selfrs r__init__zBaseBrowser.__init__s  rctrE)NotImplementedErrorrGr.r/r0s rrzBaseBrowser.opens!!rc&|j|dSr2r3rGr.s rrzBaseBrowser.open_newyya  rc&|j|dSr7r3rMs rrzBaseBrowser.open_new_tabrNrN)rT)r r r argsrHrrrr rrrCrCs = 6D"!!rrCceZdZ dZddZy)r&ct|tr||_dg|_n|d|_|dd|_tj j |j|_y)Nrrr") isinstancestrrrRr<r=r>rFs rrHzGenericBrowser.__init__sP dC DIDIQDIQRDI((3 rcptjd||jg|jDcgc]}|j d|c}z} tj dddk(rt j|}nt j|d}|j Scc}w#t$rYywxYw)Nwebbrowser.openrwinT) close_fdsF) sysauditrrRreplaceplatform subprocessPopenwaitOSErrorrGr.r/r0argcmdlineps rrzGenericBrowser.opens #S)99+,0II!7,5S"%T3!7,5!77 ||BQ5($$W-$$W=vvx< !7  sB$AB)) B54B5NrQr r r rHrr rrr&r&s,4 rr&ceZdZ ddZy)r%ct|jg|jDcgc]}|jd|c}z}tjd| tj dddk(rt j|}nt j|dd}|jduScc}w#t$rYywxYw)NrrXrYrZT)r[start_new_sessionF) rrRr^r\r]r_r`rapollrcrds rrzBackgroundBrowser.opens99+,0II!7,5S"%T3!7,5!77 #S) ||BQ5($$W-$$W7;=FFH$ %!7  sB&AB++ B76B7NrQr r r rr rrr%r%s  rr%c>eZdZ dZdZdZddgZdZdZdZ ddZ d dZ y) UnixBrowserNFT%actionrcg}|r+|jrt|}|j|}|r|g}|jg|z|z}|s |jrtj }nd}t j |d||jxr|xsd|d} |r | jd} | S|jr| jyy| j S#tj$rYywxYw)NTr[stdinstdoutstderrrkF) raise_optsintr backgroundr`DEVNULLraredirect_stdoutrbTimeoutExpiredrl) rGrRremoter0r. raise_optoptrfinoutrgrcs r_invokezUnixBrowser._invokes dooII//),CI99+ )D0 T__&&EE   WE%)%9%9%Ce%Kt$)T C  VVAYv __vvxvvx< ,,  sCC-,C-cHtjd||dk(r |j}nN|dk(r |j}n<|dk(r&|j |j}n|j}nt dd|zz|j Dcgc]$}|jd|jd|&}}|Dcgc]}|s| }}|j|d ||}|s<|jDcgc]}|jd|}}|j|d d Sy cc}wcc}wcc}w) NrXrr"r8zBad 'new' parameter to open(); zexpected 0, 1, or 2, got %srrpTF) r\r] remote_actionremote_action_newwinremote_action_newtabr remote_argsr^rrR)rGr.r/r0actionrerRsuccesss rrzUnixBrowser.opens/ #S) !8''F AX..F AX((0222295;<= = ++-+C D#&..y&A+ -#+tst+,,tT9c:6:ii@isCKKc*iD@<<eU3 3-+As)D4D<D&DrErQ) r r r rwryr{rrrrrrr rrroros<GJJOd#KM! Frroc&eZdZ ddgZdZdZdZdZy)MozillarprrPz -new-windowz-new-tabTNr r r rrrrryr rrrr s%.d#KM(%Jrrc*eZdZ ddgZddgZdZdZdZy) Epiphanyz-noraiserPrpr-nz-wTN)r r r rwrrrryr rrrr*s).b!Jd#KMJrrc&eZdZ ddgZdZdZdZdZy)ChromerprrP --new-windowTNrr rrrr4s%/d#KM)Jrrc&eZdZ ddgZdZdZdZdZy)OperarprrPrTNrr rrrr@s%'d#KM)Jrrc*eZdZ ddgZdZdZdZdZdZy)Elinksz-remotezopenURL(%s%action)rPz ,new-windowz,new-tabFN) r r r rrrrryr{r rrrrJs-)23KM(%JOrrceZdZ ddZy) Konquerorctjd||dk(rd}nd}tj} tjd||gd|||}|j y#t $rYnwxYw tjdd |gd|||d }|jy#t $rYnwxYw tjd d |gd|||d }|jduS#t $rYy wxYw)NrXr8newTabopenURL kfmclientT)r[rsrtru konquerorz--silentrrkfmz-dF)r\r]r`rzrarbrcrl)rGr.r/r0rdevnullrgs rrzKonqueror.open_s #S) !8FF$$   +vs!;+/w(/AA FFH       +z3!?+/w(/379Avvx     &  %s!3+/w(/379AFFH$ %  s5A A,+A,0B B+*B+/C C+*C+NrQrmr rrrrXs  +&rrc&eZdZ ddgZdZdZdZdZy)EdgerprrPrTNrr rrrrs%0d#KM)Jrrctjdrtddtdtjdrtddtgddtj vr+tjdrtddtddtj vr/tjdrtdt t dtjdrtddtdd D].}tj|st|dt|0tjd rtd t t d n/tjd rtd t t d tjd rtd dtd d D].}tj|st|dt|0tjdrtddtdtjdrtddtdyy)Nzxdg-opengio)rrz--rGNOME_DESKTOP_SESSION_IDz gvfs-openKDE_FULL_SESSIONrz x-www-browser)firefox iceweasel seamonkeyzmozilla-firefoxmozillarrepiphany)z google-chromechromechromiumzchromium-browseroperamicrosoft-edge) r:r;rr%r<environrrrrrr)r+s rregister_X_browsersrs||JT#4Z#@A||E/0KLM"RZZ/FLL4Md$5k$BCRZZ'FLL,Ei;)?@||O$$(9/(JK << WdGG$4 5 ||E 9U#34 k "i;)?@||JT8J#78O << WdF7O 4O ||G$g/||$%!4.>)?@&rcgatjdk(rXtddt dtddt dtddt dtddt dtjdk(rtddt dtjdd d k(rtd t tjjtjjd d d}tjjtjjddd}ddddd||fD].}tj|st|dt |0tjdrtddtdntjjdstjjdr` dj}t!j"|t j$}|j'j)}|at5tjjdrtjdrtddt7dtjdrtddt7dtjdrtddt9dtjdrtddt7dtjdrtddt7dd tjvrytjd jtj:}|j=|D]3}|d!k7s t?|d"#}|d$t|dt7|d"#5yy#t,t j.t0t2f$rYwxYw)%NdarwinMacOSXdefaultrrsafari serenityosBrowserrYrZzwindows-defaultzPROGRAMFILES(x86)zC:\Program Files (x86)z%Microsoft\Edge\Application\msedge.exe PROGRAMFILESzC:\Program FilesrrrzMicrosoftEdge.exerDISPLAYWAYLAND_DISPLAYz$xdg-settings get default-web-browser)ruTERMz www-browserlinkselinkslynxw3mBROWSERrPTrr") rr\r_rMacOSXOSAScriptr%WindowsDefaultr<r=joinrrr:r;rr$r` check_outputrzdecodestriprFileNotFoundErrorCalledProcessErrorPermissionErrorNotADirectoryErrorrr&rpathsepreverser()edge64edge32r+r@ raw_resultresult userchoicesrfs rrrsI ||x4!;<4!:;D/)"<=4!:; |||#D"3I">? ||BQ5 "N3bjjnn-@B[\HJbjjnn^=PQHJ!; 81G||G$$(9'(BC1 <<+ , %tT2E-F G ::>>) $ 7H(I /<BBD'44SASAST #**,224 )/%  ! ::>>& !||M*n].KL||G$$w(?@||H%4)9:||F#~f'=>||E"nU&;<BJJjj+11"**= #G"}!'T:q6>WdN7,CtT # 7&z'D'DoWij  s AO#O('O(rYrZceZdZddZy)rcztjd| tj|y#t$rYywxYw)NrXTF)r\r]r< startfilercrKs rrzWindowsDefault.open+s= II' -  S!    s . ::NrQrmr rrrr*s rrrceZdZ dZddZy)rcxtj|jjdtd||_y)Nz3 is deprecated in 3.11 use MacOSXOSAScript instead.r8 stacklevelwarningswarn __class__r DeprecationWarningrrFs rrHzMacOSX.__init__Fs5 MMT^^4456::;MZ[ ]DIrctjd|d|vrd|z}tt|}|jdk(rd|j ddz}nE|jdk(rd }nd |d z z}d |j ddz}d |jd|d|d}t jdd}|y|j||j}| S)NrX:zfile:ropen location "%s""%22OmniWebrPz toWindow %dr"z OpenURL "%s"ztell application "zK" activate  z% end tell osascriptwF) r\r]rxboolrr^r<popenwriteclose) rGr.r/r0scripttoWindowr@osapipers rrz MacOSX.openKs II' -#:ckd3i.CyyI%- C0GG99 )!H -a8H$s{{3'>>,099c8E hh{C0G MM& !B6MrNrQrhr rrrr<s   rrc\eZdZdfd ZedZej dZddZxZS)rc$t||yrE)superrH)rGrrs rrHzMacOSXOSAScript.__init__ns G T "rctj|jjd|jjdtd|j SNz!._name is deprecated in 3.11 use z.name instead.r8rr)rGs r_namezMacOSXOSAScript._nameqsK MMT^^4456""&.."9"9!:.J, <99 rctj|jjd|jjdtd||_yrr)rGvals rrzMacOSXOSAScript._namexsH MMT^^4456""&.."9"9!:.J, <DIrc4tjd||jdk(rd|jddz}n!d|j|jddfz}t j dd}|y |j ||j}| S) NrXrrrrz tell application "%s" activate open location "%s" end rrF)r\r]rr^r<rrr)rGr.r/r0rrrs rrzMacOSXOSAScript.opens II' -yyI%- C0GG  3;;sE#:; <hh{C0G MM& !B6Mr)rrQ) r r r rHpropertyrsetterr __classcell__)rs@rrrms9 #          rrcddl}dtjdz} |jtjddddg\}}d}D]O\}}|dk(rd}|dk(rd }|d k(s|d k(s!t |tj tj Qtdk7r0t |tj tj d|d}t||t d y#|j$rV}t |tj t |tj tj dYd}~d}~wwxYw) NrzcUsage: %s [-n | -t | -h] url -n: open new window -t: open new tab -h, --help: show helpr"ntdhhelp)filerz-tr8z-hz--help) getoptr\argverrorprintruexitlenr) rusageoptsrRmsgnew_winoar.s rmainr s  #xx{ +E]]388AB<A d G1 9g $Y! $Y!x- %cjj ) HHJ   4yA~ e#**%  q'Cg $K% << c # e#**%  s(C55EA EE__main__rErQ)*r<r#r:r\r` threadingr__all__ ExceptionrRLockrrrrrrrrrr(objectrCr&r%rorrrChromiumrrrrrrr_rrrr r r rrrs|E  J I       #e #5D,',D!&!&[8&L+L^k{[ K [ 2& 2&j;"2AjMUl<<u   <<8//b$+$N8 zFr