+
    Wð·j)  ã                   ó  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt]P                  ! ]4      P                  4       P                  P                  t^<tRt ! R R]P                  P                  4      tRR ltR t]R8X  d
   ]! 4        R# R# )	u¡  Local dev server for the demos: like `python3 -m http.server`, but never lets the
browser reuse a stale copy of pkg/*.js or *.wasm after `wasm-pack build`, and makes the
pages cross-origin isolated (COOP + COEP) so SharedArrayBuffer â€” and with it the
multithreaded path tracer â€” is available. All resources are same-origin, so COEP
blocks nothing.

Run from the repo root:  python3 scripts/serve.py [port] [--mcp mcp.config.json]
Then open http://localhost:<port>/www/

--mcp also enables the bridge for the MCP console page (www/mcp/, see scripts/mcp_bridge.py).
Its API only answers requests from this machine; the static pages stay reachable from the
LAN as before.
Nc                   ó¢   a a€ ] tR t^t o/ ]P
                  P                  P                  CRRRR/CtRtRt	V 3R lt
R tV 3R ltR	 tR
tVtV ;t# )ÚNoCacheHandlerz.wasmzapplication/wasmz.jsztext/javascriptNc                óÜ  <€ V P                  R R4       V P                  RR4       V P                  RR4       V P                  RR4       V P                  RR	4       V P                  '       dq   V P                  P                  \        4      '       dL   V P                  P                  V 4      '       d+   V P                  R
V P                  P                  4       4       \        SV `!  4        R# )zCache-Controlzno-cachezCross-Origin-Opener-Policyzsame-originzCross-Origin-Embedder-Policyzrequire-corpzX-Frame-OptionsÚDENYzContent-Security-Policyzframe-ancestors 'none'z
Set-CookieN)	Úsend_headerÚbridgeÚpathÚ
startswithÚ	API_PAGESÚmay_issue_cookieÚcookie_headerÚsuperÚend_headers©ÚselfÚ	__class__s   &€Ú%/work/data/stt/webtt/scripts/serve.pyr   ÚNoCacheHandler.end_headers    s²   ø€ à×Ñ˜¨*Ô5Ø×ÑÐ5°}ÔEØ×ÑÐ7¸ÔHà×ÑÐ*¨FÔ3Ø×ÑÐ2Ð4LÔMà�;�;ˆ;˜4Ÿ9™9×/Ñ/´	×:Ò:¸t¿{¹{×?[Ñ?[Ð\`×?aÒ?aØ×Ñ˜\¨4¯;©;×+DÑ+DÓ+FÔGÜ‰ÑÖó    c                óÜ   € V P                   '       d$   V P                   P                  W4      '       d   R # \        V P                  ;'       d    V P                  P                  W4      4      # )T)ÚcomputeÚhandleÚboolr   )r   Úmethods   &&r   ÚapiÚNoCacheHandler.api-   sH   € Ø�<�<ˆ<˜DŸL™L×/Ñ/°×=Ò=ÙÜ�D—K‘K×DÐD D§K¡K×$6Ñ$6°tÓ$DÓEÐEr   c                ó¼   <€ V P                   P                  R 4      '       d,   V P                  R4      '       g   V P                  RR4       R# \        SV `  4        R# )ú/api/ÚGETé”  zGAPI not enabled (start serve.py with --mcp mcp.config.json [--compute])N)r   r	   r   Ú
send_errorr   Údo_GETr   s   &€r   r!   ÚNoCacheHandler.do_GET2   sA   ø€ Ø�9‰9×Ñ ×(Ò(Ø—8‘8˜E—?’?Ø—‘ Ð%nÔoÙÜ‰‰Ör   c                ó    € V P                  R 4      '       g7   T P                  V P                  P                  R4      '       d   RMR4       R# R# )ÚPOSTr   r   i•  N)r   r    r   r	   )r   s   &r   Údo_POSTÚNoCacheHandler.do_POST9   s8   € Ø�x‰x˜×ÒØ�O‰O 4§9¡9×#7Ñ#7¸×#@Ò#@™CÀcÖJñ  r   © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚhttpÚserverÚSimpleHTTPRequestHandlerÚextensions_mapr   r   r   r   r!   r%   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   Ú__classdict__s   @@r   r   r      s\   ù‡ € ðM˜Ÿ™×<Ñ<×KÑKð MØÐ1°5Ð:KñM€Nà€FØ€GõòFõ
÷Kò Kr   r   c           	      óô   € R VRVR\         /pV'       d   R VR&   \        R\        3V4      p\        P                  P                  W 3\        P                  ! V\        \        4      R7      4      pRVn
        V# )r   r   Útimeoutc                 ó   € R # )Nr'   )r   Úargss   &*r   Ú<lambda>Úmake_server.<locals>.<lambda>C   s   € ±4r   Úlog_messageÚHandler)Ú	directoryT)ÚREQUEST_TIMEOUTÚtyper   r,   r-   ÚThreadingHTTPServerÚ	functoolsÚpartialÚstrÚROOTÚdaemon_threads)Úportr   ÚhostÚquietr   ÚattrsÚhandlerÚhttpds   &&&&&   r   Úmake_serverrK   >   sm   € ð �v˜y¨'°9¼oÐN€EßÙ7ˆˆmÑÜ�9œ~Ð/°Ó7€GÜ�K‰K×+Ñ+¨T¨L¼)×:KÒ:KÈGÔ_bÔcgÓ_hÔ:iÓj€EØ€EÔØ€Lr   c            	      óR  € \         P                  ! R R7      p V P                  RR\        RR7       V P                  RRRR	7       V P                  R
RRR7       V P	                  4       pVP
                  '       d)   VP                  '       g   \        P                  ! R4       RpVP                  '       d,   ^ RI	p VP                  VP                  VP                  4      pRpVP
                  '       d:   ^ RIpVP                  \         R,          R,          R,          VP"                  4      p\%        VP                  W%R7      ;_uu_ 4       p\'        R\          RVP                   R24       V'       dB   \'        RP)                  VP+                  4       4      4       \'        RVP                   R24       V'       d/   \'        VP-                  4       RVP                   R2,           4        VP/                  4        V'       d   VP3                  4        RRR4       R#   \        \        3 d2   p\        P                  ! RTP                   RT 24        Rp?EL|Rp?ii ; i  \0         d     Lti ; i  T'       d   TP3                  4        i i ; i  + '       g   i     R# ; i)zDev server for the demos)ÚdescriptionrE   Ú?i�  )Únargsr>   Údefaultz--mcpÚCONFIGz+enable the MCP bridge with this config file)ÚmetavarÚhelpz	--computeÚ
store_truezOenable the compute API for www/server-compute/ (needs --mcp: same access rules))ÚactionrS   zi--compute needs --mcp mcp.config.json (it uses the bridge's access rules; the config may list no servers)NzMCP config z: ÚtargetÚreleaser   )r   zServing z at http://localhost:z/www/  (Ctrl+C to stop)Ú
z MCP console at http://localhost:z)/www/mcp/ (API answers this machine only)z; page at http://localhost:ú/www/server-compute/)ÚargparseÚArgumentParserÚadd_argumentÚintÚ
parse_argsr   ÚmcpÚsysÚexitÚ
mcp_bridgeÚBridgerE   ÚOSErrorÚ
ValueErrorÚcompute_bridgeÚComputeBridgerC   Ú	authorizerK   ÚprintÚjoinÚstartup_linesÚstartup_lineÚserve_foreverÚKeyboardInterruptÚshutdown)Úapr7   r   rb   Úer   rf   rJ   s           r   Úmainrr   J   s  € Ü	×	 Ò	 Ð-GÔ	H€BØ‡O�O�F #¬C¸€OÔ>Ø‡O�O�G XÐ4a€OÔbØ‡O�O�K¨Øjð ô là�=‰=‹?€DØ‡|‡|€|˜DŸHŸH˜HÜ�ŠÐ}Ô~Ø€FØ‡x‡x€xÛð	4Ø×&Ñ& t§x¡x°·±Ó;ˆFð €GØ‡|‡|€|ÛØ ×.Ñ.¬t°h­ÀÕ/JÈYÕ/VÐX^×XhÑXhÓiˆÜ	�T—Y‘Y ×	8Õ	8¸EÜ�œ˜Ð3°D·I±I°;Ð>UÐVÔWßÜ�$—)‘)˜F×0Ñ0Ó2Ó3Ô4ÜÐ4°T·Y±Y°KÐ?hÐiÔjßÜ�'×&Ñ&Ó(Ð-HÈÏÉÈÐSgÐ+hÕhÔið	"Ø×ÑÔ!÷ Ø—‘Ô!÷ 
9Ñ	8øô œÐ$ô 	4Ü�HŠH�{ 4§8¡8 *¨B¨q¨cÐ2×3Ò3ûð	4ûô !ô 	Ùð	û÷ Ø—‘Õ!ð ú÷ 
9×	8Ð	8ús[   Â<&H! ÅA1JÇ .JÇ/I&Ç?JÈ!I#È2&IÉI#É&I4É1I7É3I4É4I7É7JÊJÊJ&	Ú__main__)z	/www/mcp/rY   z/www/gomoku/)NÚ FN)Ú__doc__rZ   r@   Úhttp.serverr,   Úpathlibr`   ÚPathÚ__file__ÚresolveÚparentrC   r=   r
   r-   r.   r   rK   rr   r(   r'   r   r   Ú<module>r|      s€   ðñó Û Û Û Û 
à‡|‚|�HÓ×%Ñ%Ó'×.Ñ.×5Ñ5€Ø€àA€	ô!K�T—[‘[×9Ñ9ô !KôH	ò!"ðH ˆzÔÙ†Fñ r   