This commit is contained in:
latypov committed 2026-11-23 23:55:37 +07:00
commit 2ca7a264b3
53 files changed
+7113

No files matched your search

+373
View File
@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
+277
View File
@@ -0,0 +1,277 @@
A. HISTORY OF THE SOFTWARE
==========================
Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
as a successor of a language called ABC. Guido remains Python's
principal author, although it includes many contributions from others.
In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
in Reston, Virginia where he released several versions of the
software.
In May 2000, Guido and the Python core development team moved to
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
year, the PythonLabs team moved to Digital Creations, which became
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
https://www.python.org/psf/) was formed, a non-profit organization
created specifically to own Python-related Intellectual Property.
Zope Corporation was a sponsoring member of the PSF.
All Python releases are Open Source (see https://opensource.org for
the Open Source Definition). Historically, most, but not all, Python
releases have also been GPL-compatible; the table below summarizes
the various releases.
Release Derived Year Owner GPL-
from compatible? (1)
0.9.0 thru 1.2 1991-1995 CWI yes
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
1.6 1.5.2 2000 CNRI no
2.0 1.6 2000 BeOpen.com no
1.6.1 1.6 2001 CNRI yes (2)
2.1 2.0+1.6.1 2001 PSF no
2.0.1 2.0+1.6.1 2001 PSF yes
2.1.1 2.1+2.0.1 2001 PSF yes
2.1.2 2.1.1 2002 PSF yes
2.1.3 2.1.2 2002 PSF yes
2.2 and above 2.1.1 2001-now PSF yes
Footnotes:
(1) GPL-compatible doesn't mean that we're distributing Python under
the GPL. All Python licenses, unlike the GPL, let you distribute
a modified version without making your changes open source. The
GPL-compatible licenses make it possible to combine Python with
other software that is released under the GPL; the others don't.
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
because its license has a choice of law clause. According to
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
is "not incompatible" with the GPL.
Thanks to the many outside volunteers who have worked under Guido's
direction to make these releases possible.
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
===============================================================
Python software and documentation are licensed under the
Python Software Foundation License Version 2.
Starting with Python 3.8.6, examples, recipes, and other code in
the documentation are dual licensed under the PSF License Version 2
and the Zero-Clause BSD license.
Some software incorporated into Python is under different licenses.
The licenses are listed with code falling under that license.
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved"
are retained in Python alone or in any derivative version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
-------------------------------------------
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
Individual or Organization ("Licensee") accessing and otherwise using
this software in source or binary form and its associated
documentation ("the Software").
2. Subject to the terms and conditions of this BeOpen Python License
Agreement, BeOpen hereby grants Licensee a non-exclusive,
royalty-free, world-wide license to reproduce, analyze, test, perform
and/or display publicly, prepare derivative works, distribute, and
otherwise use the Software alone or in any derivative version,
provided, however, that the BeOpen Python License is retained in the
Software, alone or in any derivative version prepared by Licensee.
3. BeOpen is making the Software available to Licensee on an "AS IS"
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
5. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
6. This License Agreement shall be governed by and interpreted in all
respects by the law of the State of California, excluding conflict of
law provisions. Nothing in this License Agreement shall be deemed to
create any relationship of agency, partnership, or joint venture
between BeOpen and Licensee. This License Agreement does not grant
permission to use BeOpen trademarks or trade names in a trademark
sense to endorse or promote products or services of Licensee, or any
third party. As an exception, the "BeOpen Python" logos available at
http://www.pythonlabs.com/logos.html may be used according to the
permissions granted on that web page.
7. By copying, installing or otherwise using the software, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
---------------------------------------
1. This LICENSE AGREEMENT is between the Corporation for National
Research Initiatives, having an office at 1895 Preston White Drive,
Reston, VA 20191 ("CNRI"), and the Individual or Organization
("Licensee") accessing and otherwise using Python 1.6.1 software in
source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, CNRI
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python 1.6.1
alone or in any derivative version, provided, however, that CNRI's
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
1995-2001 Corporation for National Research Initiatives; All Rights
Reserved" are retained in Python 1.6.1 alone or in any derivative
version prepared by Licensee. Alternately, in lieu of CNRI's License
Agreement, Licensee may substitute the following text (omitting the
quotes): "Python 1.6.1 is made available subject to the terms and
conditions in CNRI's License Agreement. This Agreement together with
Python 1.6.1 may be located on the internet using the following
unique, persistent identifier (known as a handle): 1895.22/1013. This
Agreement may also be obtained from a proxy server on the internet
using the following URL: http://hdl.handle.net/1895.22/1013".
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python 1.6.1 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python 1.6.1.
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. This License Agreement shall be governed by the federal
intellectual property law of the United States, including without
limitation the federal copyright law, and, to the extent such
U.S. federal law does not apply, by the law of the Commonwealth of
Virginia, excluding Virginia's conflict of law provisions.
Notwithstanding the foregoing, with regard to derivative works based
on Python 1.6.1 that incorporate non-separable material that was
previously distributed under the GNU General Public License (GPL), the
law of the Commonwealth of Virginia shall govern this License
Agreement only as to issues arising under or with respect to
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
License Agreement shall be deemed to create any relationship of
agency, partnership, or joint venture between CNRI and Licensee. This
License Agreement does not grant permission to use CNRI trademarks or
trade name in a trademark sense to endorse or promote products or
services of Licensee, or any third party.
8. By clicking on the "ACCEPT" button where indicated, or by copying,
installing or otherwise using Python 1.6.1, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
ACCEPT
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
--------------------------------------------------
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
The Netherlands. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
----------------------------------------------------------------------
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
+5
View File
@@ -0,0 +1,5 @@
f6e6f42f451f42affbbcddb00e8c9a3278dcbf399f57aab9f3f568839a7ff4a6 pyodide-lock.json
b22e5831eade9ff10e6fe2c811c68688cd91f10154377b4f80debcf5bafa1e56 pyodide.asm.js
5effb6a1a6cc4a1a85bec4622701aa797c031e1de923cbbaf2ad47abdc4ab325 pyodide.asm.wasm
24a458425dcb4ea9836eb5ce26701d18cb769374e2b79247602ba605bf093278 pyodide.js
71fee17f88a6260ec8c9c7c063533ee59c021fdc88a1ce76247378d3c4a35f4c python_stdlib.zip
+14
View File
@@ -0,0 +1,14 @@
// This document exists only under the private cookie path.
addEventListener("message", event => {
if (event.origin !== location.origin || event.source !== parent || !event.ports[0]) return;
const name="vzlet_demo_v1", next=event.data, port=event.ports[0];
try {
if(next!==null){
if(typeof next!=="string" || !/^[a-zA-Z0-9_=-]{1,3500}$/.test(next)) throw Error("Некорректная позиция");
document.cookie=name+"="+next+"; Path="+location.pathname+"; SameSite=Strict; Max-Age=2592000"+(location.protocol==="https:"?"; Secure":"");
}
const value=document.cookie.split("; ").find(item=>item.startsWith(name+"="))?.slice(name.length+1)||"";
if(next!==null && value!==next)throw Error("Браузер заблокировал cookie");
port.postMessage({value});
} catch(err){port.postMessage({error:err.message});}
});
+12
View File
@@ -0,0 +1,12 @@
// The browser creates this same-origin document locally. No upstream fetch.
const path = "/__local_game__/";
self.addEventListener("install", event => event.waitUntil(self.skipWaiting()));
self.addEventListener("activate", event => event.waitUntil(self.clients.claim()));
self.addEventListener("fetch", event => {
const url = new URL(event.request.url);
if (url.origin === self.location.origin && url.pathname === path)
event.respondWith(new Response('<!doctype html><script src="/cookie-bridge.js"></script>', {
headers: {"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store",
"Content-Security-Policy":"default-src 'none'; script-src 'self'; frame-ancestors 'self'; base-uri 'none'"}
}));
});
+116
View File
@@ -0,0 +1,116 @@
"""Browser worker bridge. Only a compact, validated position goes into the cookie."""
import base64
import json
from collections import Counter
import engine as e
from strategy import decide
CARDS = tuple(e.CAT["cards"])
COLORS = tuple(e.CAT["fleets"])
BOARD = e.CAT["board"]
POSITIONS = ["H", "F"] + [
f"{stage}:{branch}{n}" for stage, branch, count in
(("A","B",BOARD["ab_stands"]), ("A","C",BOARD["ac_stands"]),
("B","B",BOARD["b_stands"]), ("C","C",BOARD["ac_stands"]))
for n in range(1,count+1)
] + [pos for lane in e.LANES for pos in [*e.queue(lane),f"V1:{lane}",f"V2:{lane}"]]
def number(value, lo, hi):
if type(value) is not int or not lo <= value <= hi:
raise ValueError("Некорректное число в сохранении")
return value
def unpack_cards(ids):
return [CARDS[number(i,0,len(CARDS)-1)] for i in ids]
def encode(s):
def cards(seq):
return [CARDS.index(c) for c in seq]
ids=list(s["planes"])
pending=s["pending"]
wait=None
if pending:
if pending.get("type")=="runway":
wait=["r",ids.index(pending["plane"]),[POSITIONS.index(p) for p in pending["targets"]]]
else:
wait=["c",CARDS.index(pending["card"]),[ids.index(p) for p in pending["targets"]]]
record=[1,[COLORS.index(c) for c in s["colors"]],cards(s["deck"]),cards(s["discard"]),
[cards(h) for h in s["hands"]],[cards(Counter(h).elements()) for h in s["known"]],
[POSITIONS.index(p["pos"]) for p in s["planes"].values()],
[int(p["since"]==s["turn"]) for p in s["planes"].values()],
cards([s["weather"]]) if s["weather"] else [],s["turn"],s["active"],s["winner"],s["owed"],wait]
return base64.urlsafe_b64encode(json.dumps(record,separators=(",",":")).encode()).decode()
def decode(token):
if not isinstance(token,str) or len(token)>3500:
raise ValueError("Размер сохранения")
version,colors,deck,discard,hands,known,pos,entered,weather,turn,seat,winner,owed,wait=json.loads(
base64.b64decode(token, altchars=b"-_", validate=True))
n=len(colors)
if version!=1 or not 4<=n<=6 or len(set(colors))!=n or len(hands)!=n or len(known)!=n:
raise ValueError("Состав стола")
colors=[COLORS[number(c,0,len(COLORS)-1)] for c in colors]
turn=number(turn,1,2**31-1)
planes={}
for i,col in enumerate(colors):
for j,size in enumerate(e.CAT["fleets"][col],1):
k=len(planes)
planes[f"{col}-{j}"]=dict(owner=i,size=size,pos=POSITIONS[number(pos[k],0,len(POSITIONS)-1)],
since=turn-1+number(entered[k],0,1))
if len(pos)!=len(planes) or len(entered)!=len(planes):
raise ValueError("Состав флота")
hands=[unpack_cards(h) for h in hands]
known=[dict(Counter(unpack_cards(h))) for h in known]
deck,discard,weather=map(unpack_cards,(deck,discard,weather))
if len(weather)>1 or set(weather)-e.WEATHER or any(len(h)>e.HAND for h in hands):
raise ValueError("Некорректная рука или погода")
if Counter(deck+discard+sum(hands,[])+weather)!=Counter(e.CAT["cards"]):
raise ValueError("Неверный баланс карт")
if any(Counter(k)-Counter(h) for k,h in zip(known,hands)):
raise ValueError("Неверные открытые карты")
seat=number(seat,0,n-1)
pending=None
if wait is not None:
typ,value,targets=wait
keys=list(planes)
if typ=="r":
pending=dict(type="runway",seat=seat,plane=keys[number(value,0,len(keys)-1)],
targets=[POSITIONS[number(t,0,len(POSITIONS)-1)] for t in targets])
elif typ=="c" and CARDS[number(value,0,len(CARDS)-1)] in e.TROUBLE:
pending=dict(seat=(seat+1)%n,card=CARDS[value],targets=[keys[number(t,0,len(keys)-1)] for t in targets])
else:
raise ValueError("Неверная фаза")
return dict(colors=colors,deck=deck,discard=discard,hands=hands,known=known,planes=planes,
weather=next(iter(weather),None),transit=None,turn=turn,active=seat,
winner=None if winner is None else number(winner,0,n-1),
pending=pending,owed=number(owed,0,4),catalog=e.DIGEST,strategy=e.STRATEGY)
def dispatch(raw):
req=json.loads(raw)
if req["token"]:
s=decode(req["token"])
else:
s=e.new_game(number(req["bots"],3,5),req.get("color"))
recent=[]
def emit(state,kind,data):
if kind=="draw" and data["seat"]!=0:
data={"seat":data["seat"]}
recent.append(dict(kind=kind,data=data))
if req.get("command") is not None:
if e.actor(s)!=0:
raise ValueError("Ход другого участника")
e.Turn(s,emit).apply(req["command"])
for _ in range(40):
if s["winner"] is not None or e.actor(s)==0:
break
choice=decide(dict(view=e.observation(s,e.actor(s)),actions=e.actions(s)))
e.Turn(s,emit).apply(choice["command"])
else:
raise ValueError("Не удалось завершить ходы соперников")
return json.dumps(dict(token=encode(s),view=e.observation(s,0),actions=e.actions(s),recent=recent[-8:]))
+27
View File
@@ -0,0 +1,27 @@
"""Build only the files served by the public demo."""
from pathlib import Path
import json
import re
import shutil
import sys
root = Path(__file__).resolve().parents[1]
out = Path(sys.argv[1])
out.mkdir(parents=True, exist_ok=True)
static = root / "game/static"
for name in ("app.js", "airfield.js", "cards.js", "demo-client.js", "style.css"):
shutil.copy(static / name, out)
index = (static / "index.html").read_text().replace('<html lang="ru">','<html lang="ru" data-demo>')
index = re.sub(r'<nav>.*?</nav>', '', index, flags=re.S)
index = re.sub(r'<a class="brand" href="#home"\s*>', '<span class="brand">', index)
index = re.sub(r'</small></a\s*>', '</small></span>', index)
(out / "index.html").write_text(index)
shutil.copy(root / "game/catalog.json", out)
for name in ("worker.js","cookie-worker.js","cookie-bridge.js"):
shutil.copy(root / "demo" / name, out)
shutil.copytree(root / "demo/vendor", out / "vendor", dirs_exist_ok=True)
for license_file in (root / "demo").glob("LICENSE-*"):
shutil.copy(license_file, out / (license_file.name + ".txt"))
files = {name:(root / "game" / name).read_text() for name in ("catalog.json","engine.py","strategy.py")}
files["local_game.py"] = (root / "demo/local_game.py").read_text()
(out / "rules.json").write_text(json.dumps(files, ensure_ascii=False))
+76
View File
@@ -0,0 +1,76 @@
// Static-only demo server. No storage, sessions, request logs or upstreams.
package main
import (
"embed"
"io"
"io/fs"
"log"
"net/http"
"os"
"path"
"strings"
"time"
)
//go:embed public
var assets embed.FS
func serve(w http.ResponseWriter, r *http.Request) {
h := w.Header()
policy := "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; worker-src 'self'; frame-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'"
if r.URL.Path == "/worker.js" {
policy = "default-src 'none'; script-src 'self' 'wasm-unsafe-eval'; connect-src 'self'"
}
h.Set("Content-Security-Policy", policy)
h.Set("X-Content-Type-Options", "nosniff")
h.Set("Referrer-Policy", "no-referrer")
h.Set("X-Frame-Options", "DENY")
h.Set("Cross-Origin-Resource-Policy", "same-origin")
h.Set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()")
if r.Method != "GET" && r.Method != "HEAD" {
h.Set("Allow", "GET, HEAD")
w.WriteHeader(405)
return
}
name := strings.TrimPrefix(r.URL.Path, "/")
if name == "health" {
w.WriteHeader(204)
return
}
if name == "" {
name = "index.html"
}
if !fs.ValidPath(name) {
http.NotFound(w, r)
return
}
typ := map[string]string{".txt": "text/plain; charset=utf-8", ".html": "text/html; charset=utf-8", ".js": "text/javascript", ".css": "text/css", ".json": "application/json", ".wasm": "application/wasm", ".zip": "application/zip"}[path.Ext(name)]
f, err := assets.Open("public/" + name)
if err != nil || typ == "" {
http.NotFound(w, r)
return
}
defer f.Close()
info, err := f.Stat()
if err != nil || info.IsDir() {
http.NotFound(w, r)
return
}
h.Set("Content-Type", typ)
h.Set("Cache-Control", "no-cache")
http.ServeContent(w, r, name, time.Time{}, f.(io.ReadSeeker))
}
func main() {
if len(os.Args) == 2 && os.Args[1] == "-health" {
c := http.Client{Timeout: 2 * time.Second}
r, e := c.Get("http://127.0.0.1:8080/health")
if e != nil || r.StatusCode != 204 {
os.Exit(1)
}
r.Body.Close()
return
}
server := http.Server{Addr: ":8080", Handler: http.HandlerFunc(serve), ReadHeaderTimeout: 4 * time.Second, ReadTimeout: 8 * time.Second, WriteTimeout: 45 * time.Second, IdleTimeout: 20 * time.Second, MaxHeaderBytes: 8192}
log.Fatal(server.ListenAndServe())
}
+1
View File
@@ -0,0 +1 @@
{"info": {"abi_version": "2025_0", "arch": "wasm32", "platform": "emscripten_4_0_9", "python": "3.13.2", "version": "0.28.0.dev0"}, "packages": {"affine": {"depends": [], "file_name": "affine-2.4.0-py3-none-any.whl", "imports": ["affine"], "install_dir": "site", "name": "affine", "package_type": "package", "sha256": "1d4c8070a40853fc28819af0821ee25d42979718165e0d4255d3063d9b11d1d4", "unvendored_tests": true, "version": "2.4.0"}, "affine-tests": {"depends": ["affine"], "file_name": "affine-tests.tar", "imports": [], "install_dir": "site", "name": "affine-tests", "package_type": "package", "sha256": "aee4fc1688de2e658f4cf3a94caa1bc8d920b2ba4919f187d1fd425fad7b3c82", "unvendored_tests": false, "version": "2.4.0"}, "aiohappyeyeballs": {"depends": [], "file_name": "aiohappyeyeballs-2.6.1-py3-none-any.whl", "imports": ["aiohappyeyeballs"], "install_dir": "site", "name": "aiohappyeyeballs", "package_type": "package", "sha256": "9a03eb07a9f12b87fe9d00c2f28719120d1b0f397d2804ee827c8253b46afc64", "unvendored_tests": false, "version": "2.6.1"}, "aiohttp": {"depends": ["aiohappyeyeballs", "aiosignal", "async-timeout", "attrs", "charset-normalizer", "frozenlist", "multidict", "yarl"], "file_name": "aiohttp-3.11.13-cp313-cp313-pyodide_2025_0_wasm32.whl", "imports": ["aiohttp"], "install_dir": "site", "name": "aiohttp", "package_type": "package", "sha256": "d75a75f15665ce930fe07b52086f0afae5717b1e1ae6ce0f5a971abb64ceab86", "unvendored_tests": true, "version": "3.11.13"}, "aiohttp-tests": {"depends": ["aiohttp"], "file_name": "aiohttp-tests.tar", "imports": [], "install_dir": "site", "name": "aiohttp-tests", "package_type": "package", "sha256": "c7d5d7d8df2c2e4e2c824bc739f603257ede6fc5a0ab128cfe64b084195bfa45", "unvendored_tests": false, "version": "3.11.13"}, "aiosignal": {"depends": ["frozenlist"], "file_name": "aiosignal-1.3.2-py2.py3-none-any.whl", "imports": ["aiosignal"], "install_dir": "site", "name": "aiosignal", "package_type": "package", "sha256": "cb0d492148462bebaea8e915d9d7a9c284ef826365884c5d3bafe5bc52d5b09e", "unvendored_tests": false, "version": "1.3.2"}, "altair": {"depends": ["typing-extensions", "jinja2", "jsonschema", "packaging", "narwhals"], "file_name": "altair-5.5.0-py3-none-any.whl", "imports": ["altair"], "install_dir": "site", "name": "altair", "package_type": "package", "sha256": "a817c6699f1956f783540cefdb891c5dfa25f3c6f1ca09792a720231cbe9f154", "unvendored_tests": false, "version": "5.5.0"}, "annotated-types": {"depends": [], "file_name": "annotated_types-0.7.0-py3-none-any.whl", "imports": ["annotated_types"], "install_dir": "site", "name": "annotated-types", "package_type": "package", "sha256": "f2cffbe760f3c616b680279d54d4ae97185c69f6d68eb5b94675f73a834efb67", "unvendored_tests": true, "version": "0.7.0"}, "annotated-types-tests": {"depends": ["annotated-types"], "file_name": "annotated-types-tests.tar", "imports": [], "install_dir": "site", "name": "annotated-types-tests", "package_type": "package", "sha256": "583fd1bfaa07896c7a3a538cc489b2d1695cc840bd617f6e3a151094f7634337", "unvendored_tests": false, "version": "0.7.0"}, "anyio": {"depends": ["ssl", "sniffio", "typing-extensions"], "file_name": "anyio-4.9.0-py3-none-any.whl", "imports": ["anyio"], "install_dir": "site", "name": "anyio", "package_type": "package", "sha256": "72b5d6b66bffbc584350772be5959e4506cb3c9d4e830fc9f15d74186c9ee0c4", "unvendored_tests": false, "version": "4.9.0"}, "apsw": {"depends": [], "file_name": "apsw-3.49.1.0-cp313-cp313-pyodide_2025_0_wasm32.whl", "imports": ["apsw"], "install_dir": "site", "name": "apsw", "package_type": "package", "sha256": "b4fe5749b60338ee9fe522fd41a5cf0fd78466c8752e656c15009fe883311088", "unvendored_tests": false, "version": "3.49.1.0"}, "argon2-cffi": {"depends": ["argon2-cffi-bindings"], "file_name": "argon2_cffi-23.1.0-py3-none-any.whl", "imports": ["argon2"], "install_dir": "site", "name": "argon2-cffi", "package_type": "package", "sha256": "f1746991a04bfb572059eb72fc4791a2c5f83abcbcf3202edb3b95c55c546493", "unvendored_tests": false, "version": "23.1.0"}, "argon2-cffi-bindings": {"depends": ["cffi"], "file_name": "argon2_cffi_bindings-21.2.0-cp313-abi3-pyodide_2025_0_wasm32.whl", "imports": ["_argon2_cffi_bindings"], "install_dir": "site", "name": "argon2-cffi-bindings", "package_type": "package", "sha256": "20aaa40b82803c597a5c32f4e5e5e02588935014fb9ca79c0615b8e412bb4dd5", "unvendored_tests": false, "version": "21.2.0"}, "asciitree": {"depends": [], "file_name": "asciitree-0.3.3-py3-none-any.whl", "imports": ["asciitree"], "install_dir": "site", "name": "asciitree", "package_type": "package", "sha256": "4ff61ef1a58d6f2a0f639171b7cf95cbf6a69f1f79205b5ba8de98ccd87b9fea", "unvendored_tests": false, "version": "0.3.3"}, "astropy": {"depends": ["packaging", "numpy", "pyerfa", "pyyaml", "astropy_iers_data"], "file_name": "astropy-7.0.1-cp313-cp313-pyodide_2025_0_wasm32.whl", "imports": ["astropy"], "install_dir": "site", "name": "astropy", "package_type": "package", "sha256": "4708771a3Line truncated
+15
View File
@@ -0,0 +1,15 @@
"use strict";
var _createPyodideModule = (() => {
var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
return (
async function(moduleArg = {}) {
var moduleRtn;
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename}else if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_SHELL){readBinary=f=>{if(typeof readbuffer=="function"){return new Uint8Array(readbuffer(f))}let data=read(f,"binary");assert(typeof data=="object");return data};readAsync=async f=>readBinary(f);globalThis.clearTimeout??=id=>{};globalThis.setTimeout??=f=>f();arguments_=globalThis.arguments||globalThis.scriptArgs;if(typeof quit=="function"){quit_=(status,toThrow)=>{setTimeout(()=>{if(!(toThrow instanceof ExitStatus)){let toLog=toThrow;if(toThrow&&typeof toThrow=="object"&&toThrow.stack){toLog=[toThrow,toThrow.stack]}err(`exiting due to exception: ${toLog}`)}quit(status)});throw toThrow}}if(typeof print!="undefined"){globalThis.console??={};console.log=print;console.warn=console.error=globalThis.printErr??print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var dynamicLibraries=[];var wasmBinary;var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;var runtimeInitialized=false;var runtimeExited=false;var isFileURI=filename=>filename.startsWith("file://");function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b);Module["HEAP64"]=HEAP64=new BigInt64Array(b);Module["HEAPU64"]=HEAPU64=new BigUint64Array(b)}function initMemory(){if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||20971520;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:65536})}updateMemoryViews()}var __RELOC_FUNCS__=[];function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__RELOC_FUNCS__);callRuntimeCallbacks(onInits);if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();SOCKFS.root=FS.mount(SOCKFS,{},null);PIPEFS.root=FS.mount(PIPEFS,{},null);wasmExports["__wasm_call_ctors"]();callRuntimeCallbacks(onPostCtors);FS.ignorePermissions=false}function preMain(){callRuntimeCallbacks(onMains)}function exitRuntime(){___funcs_on_exit();callRuntimeCallbacks(onExits);FS.quit();TTY.shutdown();IDBFS.quit();runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"]Line truncated
return moduleRtn;
}
);
})();
globalThis._createPyodideModule = _createPyodideModule;
BIN
View File
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
"use strict";var loadPyodide=(()=>{var ce=Object.create;var A=Object.defineProperty;var de=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var o=(e,t)=>A(e,"name",{value:t,configurable:!0}),m=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var pe=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!me.call(e,a)&&a!==r&&A(e,a,{get:()=>t[a],enumerable:!(s=de(t,a))||s.enumerable});return e};var b=(e,t,r)=>(r=e!=null?ce(fe(e)):{},H(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>H(A({},"__esModule",{value:!0}),e);var V=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return r=>{for(var s=r.length,a=new Uint8Array((s-(r[s-1]=="=")-(r[s-2]=="="))*3/4|0),n=0,i=0;n<s;){var l=e[r.charCodeAt(n++)],c=e[r.charCodeAt(n++)],d=e[r.charCodeAt(n++)],u=e[r.charCodeAt(n++)];a[i++]=l<<2|c>>4,a[i++]=c<<4|d>>2,a[i++]=d<<6|u}return a}})();var Me={};pe(Me,{loadPyodide:()=>j,version:()=>L});function ye(e){return!isNaN(parseFloat(e))&&isFinite(e)}o(ye,"_isNumber");function E(e){return e.charAt(0).toUpperCase()+e.substring(1)}o(E,"_capitalize");function U(e){return function(){return this[e]}}o(U,"_getter");var k=["isConstructor","isEval","isNative","isToplevel"],I=["columnNumber","lineNumber"],N=["fileName","functionName","source"],be=["args"],ve=["evalOrigin"],T=k.concat(I,N,be,ve);function g(e){if(e)for(var t=0;t<T.length;t++)e[T[t]]!==void 0&&this["set"+E(T[t])](e[T[t]])}o(g,"StackFrame");g.prototype={getArgs:o(function(){return this.args},"getArgs"),setArgs:o(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:o(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:o(function(e){if(e instanceof g)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new g(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:o(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",s=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:s?s+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r},"toString")};g.fromString=o(function(t){var r=t.indexOf("("),s=t.lastIndexOf(")"),a=t.substring(0,r),n=t.substring(r+1,s).split(","),i=t.substring(s+1);if(i.indexOf("@")===0)var l=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i,""),c=l[1],d=l[2],u=l[3];return new g({functionName:a,args:n||void 0,fileName:c,lineNumber:d||void 0,columnNumber:u||void 0})},"StackFrame$$fromString");for(h=0;h<k.length;h++)g.prototype["get"+E(k[h])]=U(k[h]),g.prototype["set"+E(k[h])]=function(e){return function(t){this[e]=!!t}}(k[h]);var h;for(S=0;S<I.length;S++)g.prototype["get"+E(I[S])]=U(I[S]),g.prototype["set"+E(I[S])]=function(e){return function(t){if(!ye(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(I[S]);var S;for(w=0;w<N.length;w++)g.prototype["get"+E(N[w])]=U(N[w]),g.prototype["set"+E(N[w])]=function(e){return function(t){this[e]=String(t)}}(N[w]);var w,D=g;function he(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(s){if(s.stack&&s.stack.match(e))return this.parseV8OrIE(s);if(s.stack)return this.parseFFOrSafari(s);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(s){if(s.indexOf(":")===-1)return[s];var a=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=a.exec(s.replace(/[()]/g,""));return[n[1],n[2]||void 0,n[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(s){var a=s.stack.split(`
`).filter(function(n){return!!n.match(e)},this);return a.map(function(n){n.indexOf("(eval ")>-1&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),l=i.match(/ (\(.+\)$)/);i=l?i.replace(l[0],""):i;var c=this.extractLocation(l?l[1]:i),d=l&&i||void 0,u=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new D({functionName:d,fileName:u,lineNumber:c[1],columnNumber:c[2],source:n})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(s){var a=s.stack.split(`
`).filter(function(n){return!n.match(t)},this);return a.map(function(n){if(n.indexOf(" > eval")>-1&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),n.indexOf("@")===-1&&n.indexOf(":")===-1)return new D({functionName:n});var i=/((.*".+"[^@]*)?[^@]*)(?:@)/,l=n.match(i),c=l&&l[1]?l[1]:void 0,d=this.extractLocation(n.replace(i,""));return new D({functionName:c,fileName:d[0],lineNumber:d[1],columnNumber:d[2],source:n})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(he,"ErrorStackParser");var Se=new he;var z=Se;var y=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,C=y&&typeof module<"u"&&typeof module.exports<"u"&&typeof m<"u"&&typeof __dirname<"u",q=y&&!C,ze=typeof globalThis.Bun<"u",we=typeof Deno<"u",J=!y&&!we,Y=J&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",K=J&&typeof importScripts=="function"&&typeof self=="object",qe=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1,R=typeof read=="function"&&typeof load=="function";var X,M,Q,G,B;async function W(){if(!y||(X=(await import(/* webpackIgnore */"node:url")).default,G=await import(/* webpackIgnore */"node:fs"),B=await import(/* webpackIgnore */"node:fs/promises"),Q=(await import(/* webpackIgnore */"node:vm")).default,M=await import(/* webpackIgnore */"node:path"),$=M.sep,typeof m<"u"))return;let e=G,t=await import(/* webpackIgnore */"node:crypto"),r=await import(/* webpackIgnore */"ws"),s=await import(/* webpackIgnore */"node:child_process"),a={fs:e,crypto:t,ws:r,child_process:s};globalThis.require=function(n){return a[n]}}o(W,"initNodeModules");function Ee(e,t){return M.resolve(t||".",e)}o(Ee,"node_resolvePath");function Pe(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}o(Pe,"browser_resolvePath");var x;y?x=Ee:R?x=o(e=>e,"resolvePath"):x=Pe;var $;y||($="/");function ke(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:B.readFile(e).then(r=>new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}}o(ke,"node_getBinaryResponse");function Ie(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}o(Ie,"shell_getBinaryResponse");function Ne(e,t){let r=new URL(e,location);return{response:fetch(r,t?{integrity:t}:{})}}o(Ne,"browser_getBinaryResponse");var _;y?_=ke:R?_=Ie:_=Ne;async function Z(e,t){let{response:r,binary:s}=_(e,t);if(s)return s;let a=await r;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}o(Z,"loadBinaryFile");var F;if(Y)F=o(async e=>await import(/* webpackIgnore */e),"loadScript");else if(K)F=o(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(/* webpackIgnore */e);else throw t}},"loadScript");else if(y)F=Fe;else if(R)F=load;else throw new Error("Cannot determine runtime environment");async function Fe(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?Q.runInThisContext(await(await fetch(e)).text()):await import(/* webpackIgnore */X.pathToFileURL(e).href)}o(Fe,"nodeLoadScript");async function ee(e){if(y){await W();let t=await B.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(R){let t=read(e);return JSON.parse(t)}else return await(await fetch(e)).json()}o(ee,"loadLockFile");async function te(){if(C)return __dirname;let e;try{throw new Error}catch(s){e=s}let t=z.parse(e)[0].fileName;if(y&&!t.startsWith("file://")&&(t=`file://${t}`),q){let s=await import(/* webpackIgnore */"node:path");return(await import(/* webpackIgnore */"node:url")).fileURLToPath(s.dirname(t))}let r=t.lastIndexOf($);if(r===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,r)}o(te,"calculateDirname");function ne(e){return e.substring(0,e.lastIndexOf("/")+1)||globalThis.location?.toString()||"."}o(ne,"calculateInstallBaseUrl");function re(e){let t=e.FS,r=e.FS.filesystems.MEMFS,s=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:o(function(n){if(!n.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return r.mount.apply(null,arguments)},"mount"),syncfs:o(async(n,i,l)=>{try{let c=a.getLocalSet(n),d=await a.getRemoteSet(n),u=i?d:c,f=i?c:d;await a.reconcile(n,u,f),l(null)}catch(c){l(c)}},"syncfs"),getLocalSet:o(n=>{let i=Object.create(null);function l(u){return u!=="."&&u!==".."}o(l,"isRealDir");function c(u){return f=>s.join2(u,f)}o(c,"toAbsolute");let d=t.readdir(n.mountpoint).filter(l).map(c(n.mountpoint));for(;d.length;){let u=d.pop(),f=t.stat(u);t.isDir(f.mode)&&d.push.apply(d,t.readdir(u).filter(l).map(c(u))),i[u]={timestamp:f.mtime,mode:f.mode}}return{type:"local",entries:i}},"getLocalSet"),getRemoteSet:o(async n=>{let i Line truncated
try{Object.assign(exports,loadPyodide)}catch(_){}
globalThis.loadPyodide=loadPyodide.loadPyodide;
//# sourceMappingURL=pyodide.js.map
BIN
View File
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
"use strict";
importScripts("/vendor/pyodide.js");
const ready = (async () => {
const py = await loadPyodide({indexURL: "/vendor/", fullStdLib:false});
const response = await fetch("/rules.json", {credentials:"omit"});
if (!response.ok) throw Error("Файлы движка недоступны");
const files = await response.json();
for (const file of ["catalog.json","engine.py","strategy.py","local_game.py"]) {
py.FS.writeFile("/home/pyodide/"+file, files[file]);
}
return py.runPython("from local_game import dispatch\ndispatch");
})();
onmessage = async ({data}) => {
try {
const dispatch = await ready;
postMessage({result:JSON.parse(dispatch(JSON.stringify(data)))});
} catch {
postMessage({error:"Не удалось открыть позицию. Попробуйте начать новую партию."});
}
};