From d17d3edd7f55f06882e20980897a80a59ff06fd2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 20 Jun 2021 16:48:34 +0000 Subject: [PATCH] Update content of files --- data/core.telegram.org/api/passport.html | 670 ------ .../method/help.getProxyData | 132 -- .../method/messages.getMessageReactionsList | 178 -- .../method/messages.getMessagesReactions | 153 -- .../method/messages.searchGifs | 172 -- .../method/messages.sendReaction | 185 -- data/core.telegram.org/methods.html | 2084 ----------------- .../type/MessageReactionsList.html | 128 - data/core.telegram.org/type/help.ProxyData | 130 - .../core.telegram.org/type/messages.FoundGifs | 128 - data/tsf.telegram.org/auth.html | 241 -- data/tsf.telegram.org/js/jquery-ui.min.js | 9 - data/tsf.telegram.org/js/main-aj.js | 1079 --------- 13 files changed, 5289 deletions(-) delete mode 100644 data/core.telegram.org/api/passport.html delete mode 100644 data/core.telegram.org/method/help.getProxyData delete mode 100644 data/core.telegram.org/method/messages.getMessageReactionsList delete mode 100644 data/core.telegram.org/method/messages.getMessagesReactions delete mode 100644 data/core.telegram.org/method/messages.searchGifs delete mode 100644 data/core.telegram.org/method/messages.sendReaction delete mode 100644 data/core.telegram.org/methods.html delete mode 100644 data/core.telegram.org/type/MessageReactionsList.html delete mode 100644 data/core.telegram.org/type/help.ProxyData delete mode 100644 data/core.telegram.org/type/messages.FoundGifs delete mode 100644 data/tsf.telegram.org/auth.html delete mode 100644 data/tsf.telegram.org/js/jquery-ui.min.js delete mode 100644 data/tsf.telegram.org/js/main-aj.js diff --git a/data/core.telegram.org/api/passport.html b/data/core.telegram.org/api/passport.html deleted file mode 100644 index 91f2e3beb5..0000000000 --- a/data/core.telegram.org/api/passport.html +++ /dev/null @@ -1,670 +0,0 @@ - - - - - Telegram passport - - - - - - - - - - - - - -
- -
-
-
- -

Telegram passport

- -
- -

Telegram Passport is a unified authorization method for services that require personal identification. Users can upload their documents once, then instantly share their data with services that require real-world ID (finance, ICOs, etc.). Telegram doesn‘t have access to the users’ personal information thanks to end-to-end encryption.

-

This page describes the request flow that client apps must used to send the requested data to the service.

-

Overview

-

From the perspective of a service that requires real-world ID, the process looks like this:

-
    -
  • A user presses “Log in with Telegram” on your website or in your app.
  • -
  • You request the data you need.
  • -
  • The user accepts your privacy policy and agrees to share their data.
  • -
  • The user's Telegram app downloads and decrypts the data you requested from the end-to-end encrypted storage on Telegram.
  • -
  • If some of the data you requested is missing, the user can add it to their Telegram Passport at this point.
  • -
  • The user's app encrypts the data with your public key and sends it to you.
  • -
  • You decrypt the data, check it for errors and re-request any missing or invalid information.
  • -
  • You sign the user up for your service. Tada!
  • -
-

See As a bot to see how to request passport data using a bot, through the MTProto API.
Look at the Passport Manual to see how to request passport data using a bot, through the simplified bot API.

-

From the perspective of a user, the process looks something like this:

-
    -
  • Your app receives an event/intent from one of the SDKs, or from a custom source.
  • -
  • The user accepts your privacy policy and agrees to share their data.
  • -
  • The user's Telegram app downloads the data you requested from the end-to-end encrypted storage on Telegram.
  • -
  • If some of the data you requested is missing, the user can add it to their Telegram Passport at this point.
  • -
  • The user's app encrypts the data with your public key and sends it to the service.
  • -
  • You sign the user up for your service. Tada!
  • -
-

See As a user to see how user client apps should send passport data to a service, through the MTProto API.

-

As a bot

-

A simplified version of this process can be used using the bot API, for more info see the Passport Manual.

-

Using the MTProto API, the process is pretty much the same, up until the actual API calls.

-
-

Note that all binary fields are in raw binary format, unlike in the bot API where they are base64-encoded

-
-

Setting Up Telegram Passport

-

As per the bot API.

-

Requesting Information

-

As per the bot API.

-

Receiving information

-

Scheme:

-
secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;
-
-securePlainPhone#7d6099dd phone:string = SecurePlainData;
-securePlainEmail#21ec5a5f email:string = SecurePlainData;
-
-secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;
-
-secureValueTypePersonalDetails#9d2a81e3 = SecureValueType;
-secureValueTypePassport#3dac6a00 = SecureValueType;
-secureValueTypeDriverLicense#6e425c4 = SecureValueType;
-secureValueTypeIdentityCard#a0d0744b = SecureValueType;
-secureValueTypeInternalPassport#99a48f23 = SecureValueType;
-secureValueTypeAddress#cbe31e26 = SecureValueType;
-secureValueTypeUtilityBill#fc36954e = SecureValueType;
-secureValueTypeBankStatement#89137c0d = SecureValueType;
-secureValueTypeRentalAgreement#8b883488 = SecureValueType;
-secureValueTypePassportRegistration#99e3806a = SecureValueType;
-secureValueTypeTemporaryRegistration#ea02ec33 = SecureValueType;
-secureValueTypePhone#b320aadb = SecureValueType;
-secureValueTypeEmail#8e3ca7ee = SecureValueType;
-
-secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;
-
-secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
-
-messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;    
-messageService#286fa604 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction = Message;
-
-updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
-

When the user confirms your request by pressing the 'Authorize' button, the MTProto API sends an updateNewMessage from the user, with a messageService constructor, containing a messageActionSecureValuesSentMe constructor that contains the encrypted Telegram Passport data.

-

Decrypting data

-
secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
-
-messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;    
-

To decrypt the received data, first, decrypt the credentials contained in secureCredentialsEncrypted.

-
    -
  1. Decrypt the credentials secret ( secret field in secureCredentialsEncrypted) using your private key (set OAEP padding option, e.g. OPENSSL_PKCS1_OAEP_PADDING in PHP)
  2. -
  3. Use this secret and the credentials hash ( hash field in secureCredentialsEncrypted) to calculate credentials_key and credentials_iv as described below:

    -
     credentials_secret_hash = SHA512( credentials_secret + credentials_hash )
    - credentials_key = slice( credentials_secret_hash, 0, 32 )
    - credentials_iv = slice( credentials_secret_hash, 32, 16 )
    -
  4. -
  5. Decrypt the credentials data ( data field in secureCredentialsEncrypted) by AES256-CBC using these credentials_key and credentials_iv. IMPORTANT: At this step, make sure that the credentials hash is equal to SHA256( credentials_data )

    -
  6. -
  7. Credentials data is padded with 32 to 255 random padding bytes to make its length divisible by 16 bytes. The first byte contains the length of this padding (including this byte). Remove the padding to get the data.
  8. -
-
-

Note that all hashes are raw binary data, not hexits

-
-

Credentials

-

The credentials are a JSON-serialized object, structured exactly as in the bot API ».
Since decryption credentials are E2E encrypted, apps have to store the decryption credentials as JSON and not TL payloads.

-

The credentials are used as described in the Passport Manual to decrypt the files attached to the secureValue.
In this case, the container for the E2E encrypted data is in TL, while the encrypted data itself is in JSON.

-
secureValue
-
secureValue#187fa0ca flags:# type:SecureValueType data:flags.0?SecureData front_side:flags.1?SecureFile reverse_side:flags.2?SecureFile selfie:flags.3?SecureFile translation:flags.6?Vector<SecureFile> files:flags.4?Vector<SecureFile> plain_data:flags.5?SecurePlainData hash:bytes = SecureValue;
-
-messageActionSecureValuesSentMe#1b287353 values:Vector<SecureValue> credentials:SecureCredentialsEncrypted = MessageAction;    
-

The scheme for the secureValue constructor defines the constructor that can be found in each field.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
typeSecureValueTypeSecure passport value type
dataflags.0?SecureDataEncrypted Telegram Passport element data
front_sideflags.1?SecureFileEncrypted passport file with the front side of the document
reverse_sideflags.2?SecureFileEncrypted passport file with the reverse side of the document
selfieflags.3?SecureFileEncrypted passport file with a selfie of the user holding the document
translationflags.6?Vector<SecureFile>Array of encrypted passport files with translated versions of the provided documents
filesflags.4?Vector<SecureFile>Array of encrypted passport files with photos the of the documents
plain_dataflags.5?SecurePlainDataPlaintext verified passport data
hashbytesData hash
-

Here's a list of possible SecureValueTypes, and the parameters that can be set/requested when using each type.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeAllowed fields
secureValueTypeEmailplain_data
secureValueTypePhoneplain_data
secureValueTypePersonalDetailsdata
secureValueTypePassportdata, front_side, selfie, translation
secureValueTypeDriverLicensedata, front_side, reverse_side, selfie, translation
secureValueTypeIdentityCarddata, front_side, reverse_side, selfie, translation
secureValueTypeInternalPassportdata, front_side, selfie, translation
secureValueTypeAddressdata
secureValueTypeUtilityBillfiles, translation
secureValueTypeBankStatementfiles, translation
secureValueTypeRentalAgreementfiles, translation
secureValueTypePassportRegistrationfiles, translation
secureValueTypeTemporaryRegistrationfiles, translation
-
SecureData
-
secureData#8aeabec3 data:bytes data_hash:bytes secret:bytes = SecureData;
-

Data is an encrypted and padded JSON-serialized object of one of the specified JSON types, depending on the chosen type.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Chosen typeJSON object
secureValueTypePersonalDetailsPersonalDetails
secureValueTypePassportIdDocumentData
secureValueTypeDriverLicenseIdDocumentData
secureValueTypeIdentityCardIdDocumentData
secureValueTypeInternalPassportIdDocumentData
secureValueTypeAddressResidentialAddress
-

DataCredentials extracted from the credentials can then be used to decrypt encrypted data from the data field in secureData.
For more info on how to decrypt the data field, see the passport manual.

-
SecureFile
-
secureFile#e0277a62 id:long access_hash:long size:int dc_id:int date:int file_hash:bytes secret:bytes = SecureFile;    
-
-inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
-
----functions---
-
-upload.getFile#b15a9afc flags:# precise:flags.0?true cdn_supported:flags.1?true location:InputFileLocation offset:int limit:int = upload.File;
-

Files (JPG format when decrypted, max. 10MB) are downloaded chunk by chunk as described in files », except that instead of generating an inputFileLocation, an inputFileLocation should be generated, instead.

-
    -
  • The id field is the id of the secureFile
  • -
  • The access_hash field is the access_hash of the secureFile
  • -
-

FileCredentials extracted from the credentials can then be used to decrypt downloaded encrypted data.
For more info on how to decrypt passport files, see the passport manual.

-
SecurePlainData
-
securePlainPhone#7d6099dd phone:string = SecurePlainData;
-securePlainEmail#21ec5a5f email:string = SecurePlainData;
-

The email/phone is passed in plaintext using the respective SecurePlainData constructor.
Emails and phone numbers sent using telegram passport are already verified as described in the passport manual.

-

Fixing errors

-
secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;
-secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
-secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;
-secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
-
-inputUser#d8292816 user_id:int access_hash:long = InputUser;
-
-
----functions---
-
-users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
-

If the data you received contains errors, the bot can use the users.setSecureValueErrors method to inform the user and request information again. The user will not be able to resend the data, until all errors are fixed.

-

Descriptions of the method parameters can be found in the method's documentation page ».

-

As a user

-

Receiving requests

-

The process starts when your app receives an event from one of the SDKs, or from a custom source.

-

URI format

-

The SDKs trigger a passport authorization request by opening the following Telegram-specific URI:

-
tg://resolve?params
-

With the following query string parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParametersTypeRequiredDescription
domainStringYesAlways telegrampassport for Passport authorization requests.
tg:// URI are also used to resolve usernames, stickersets, translation packs and more, the domain parameter identifies the action to take when opening the link.
bot_idIntegerYesUnique identifier for the bot. You can get it from bot token. For example, for the bot token 1234567:4TT8bAc8GHUspu3ERYn-KGcvsvGB9u_n4ddy, the bot id is 1234567.
scopeUriPassportScopeYesA more compact JSON-serialized object describing the data you want to request
public_keyStringYesPublic key of the bot
nonceStringYesBot-specified nonce. Important: For security purposes it should be a cryptographically secure unique identifier of the request. In particular, it should be long enough and it should be generated using a cryptographically secure pseudorandom number generator. You should never accept credentials with the same nonce twice.
callback_urlStringOptionalSupported by some Telegram clients, specifies a callback URL to open once the process is finished or canceled.
payloadStringOptionalDeprecated parameter from Telegram Passport 1.0 that had the same function of the nonce parameter.
Services that still use a legacy version of the SDK may provide this parameter instead of the nonce.
In some cases, both the nonce and the payload parameters may be found in a URI, for backwards compatibility: in this case, the nonce parameter should always be used instead of payload.
-

Example URI, generated by the Telegram Passport Example page:

-
tg://resolve?domain=telegrampassport&bot_id=543260180&scope=%7B%22v%22%3A1%2C%22d%22%3A%5B%7B%22_%22%3A%22pd%22%2C%22n%22%3A1%7D%2C%22ad%22%2C%22pn%22%2C%22em%22%2C%7B%22_%22%3A%5B%7B%22_%22%3A%22pp%22%2C%22s%22%3A1%2C%22t%22%3A1%7D%2C%22ip%22%2C%22dl%22%2C%22ic%22%5D%7D%2C%7B%22_%22%3A%5B%22ub%22%2C%22bs%22%2C%22ra%22%2C%22pr%22%2C%22tr%22%5D%7D%5D%7D&public_key=-----BEGIN%20PUBLIC%20KEY-----%0AMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv6m1zBF8lZOCqcxf8hnj%0AkvHwuWdU8s4rBWaxKXH%2FvDDUklcCS5uhSnmjhxWca9suubaG3lW4HxlCilkeJPVf%0Ajimg5Q8ZqWrR3OoOihEpcG9iJZTOEpsEk7VtEiabgacBG3Quv9JslTrDe95Fn801%0At9d21HXwgMrHeHpWDOn31Dr%2BwoEH%2BkwySUWa6L%2FZbnGwSNP7eeDTE7Amz1RMDk3t%0A8EWGq58u0IQatPcEH09aUQlKzk6MIiALkZ9ILBKCBk6d2WCokKnsdBctovNbxwSx%0AhP1qst1r%2BYc8iPBZozsDC0ZsC5jXCkcODI3OC0tkNtYzN2XKalW5R0DjDRUDmGhT%0AzQIDAQAB%0A-----END%20PUBLIC%20KEY-----%0A&nonce=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e&callback_url=https%3A%2F%2Fcore.telegram.org%2Fpassport%2Fexample%3Fpassport_ssid%3Db8e892dc2e0afe63424d101b964f1256_32858210_db259b427f200751ce&payload=b8e892dc2e0afe63424d101b964f1256_32858210_708614a4585b84872e
-

UriPassportScope

-

This object represents the data to be requested.

- - - - - - - - - - - - - - - - - - -
FieldTypeDescription
dArray of UriPassportScopeElementList of requested elements, each type may be used only once in the entire array of UriPassportScopeElement objects
vIntegerScope version, must be 1
-
UriPassportScopeElement
-

This object represents a requested element, should be one of:

- -

Passport document type identifiers are aliased with the following reduced type identifiers:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FullAlias
personal_detailspd
passportpp
driver_licensedl
identity_cardic
internal_passportip
id_documentidd
addressad
utility_billub
bank_statementbs
rental_agreementra
passport_registrationpr
temporary_registrationtr
address_documentadd
phone_numberpn
emailem
-

You can use the special type “idd” as an alias for one of “pp”, “dl”, “ic” and the special type “add” as an alias for one of “ub”, “bs”, “ra”.

-

UriPassportScopeElementOneOfSeveral

-

This object represents several elements one of which must be provided.

- - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
_Array of UriPassportScopeElementOneList of elements one of which must be provided; must contain either several of “pp”, “dl”, “ic”, “ip” or several of “ub”, “bs”, “ra”, “pr”, “tr”
sBooleanOptional. Use this parameter if you want to request a selfie with the document from this list that the user chooses to upload.
tBooleanOptional. Use this parameter if you want to request a translation of the document from this list that the user chooses to upload. Note: We suggest to only request translations after you have received a valid document that requires one.
-

UriPassportScopeElementOne

-

This object represents one particular element that must be provided. If no options are needed, String can be used instead of this object to specify the type of the element.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
_StringElement type. One of “pd”, “pp”, “dl”, “ic”, “ip”, “ad”, “ub”, “bs”, “ra”, “pr”, “tr”, “pn”, “em”
sBooleanOptional. Use this parameter if you want to request a selfie with the document as well. Available for “pp”, “dl”, “ic” and “ip”
tBooleanOptional. Use this parameter if you want to request a translation of the document as well. Available for “pp”, “dl”, “ic”, “ip”, “ub”, “bs”, “ra”, “pr” and “tr”. Note: We suggest to only request translations after you have received a valid document that requires one.
nBooleanOptional. Use this parameter to request the first, last and middle name of the user in the language of the user's country of residence. Available for “pd”
-

You can also use the special type “idd” as an alias for one of “pp”, “dl”, “ic” and the special type “add” as an alias for one of “ub”, “bs”, “ra”.

-

Setting up Telegram Passport

-

The next step for the client app is to request the user's 2FA passport, and configure Telegram Passport/fetch and decrypt remotely saved Telegram Passport parameters as described in the Encryption article ».

-

Fetching the passport form

-
account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;
-
----functions---
-
-account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm;
-

Then, the client app passes the bot ID, scope and public key from the passport authorization request to the Telegram servers using the account.getAuthorizationForm method.

-

The response will be an account.authorizationForm constructor, with info about the required document types, the URL of the service's privacy policy, as well as info about the bot to which the form should be sent.
If the form was already submitted at least once, the constructor will also contain a list of already submitted data, along with eventual errors.

-

The user should accept the privacy policy and proceed to fill in the required data, and the client should encrypt and upload it as described in the Encryption article ».

-

Submitting the passport form

-
secureCredentialsEncrypted#33f0ea47 data:bytes hash:bytes secret:bytes = SecureCredentialsEncrypted;
-
-secureValueHash#ed1ecdb0 type:SecureValueType hash:bytes = SecureValueHash;
-
----functions---
-
-account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
-

Once the user finishes uploading the required documents and clicks on the submit button, the client calls account.acceptAuthorization, submitting the documents to the bot associated to the service.

-
    -
  • As before, bot_id, scope and public_key are taken from the authorization request URI.
  • -
  • value_hashes is used by the server to choose which document of which type to send to the bot: the type field should be set to the document type, and the hash field should be set to the data_hash/file_hash generated when uploading encrypting the data ».
  • -
  • credentials contains the encrypted credentials required by the service to decrypt the sent E2E encrypted secure values: it is generated as described in Passport Credentials ».
  • -
-

Finally, the client opens the callback URL (if present).

-

Handling invalid forms

-
secureValueErrorData#e8a40bd9 type:SecureValueType data_hash:bytes field:string text:string = SecureValueError;
-secureValueErrorFrontSide#be3dfa type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorReverseSide#868a2aa5 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorSelfie#e537ced6 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorFile#7a700873 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorFiles#666220e9 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
-secureValueError#869d758f type:SecureValueType hash:bytes text:string = SecureValueError;
-secureValueErrorTranslationFile#a1144770 type:SecureValueType file_hash:bytes text:string = SecureValueError;
-secureValueErrorTranslationFiles#34636dd8 type:SecureValueType file_hash:Vector<bytes> text:string = SecureValueError;
-
-account.authorizationForm#ad2e1cd8 flags:# required_types:Vector<SecureRequiredType> values:Vector<SecureValue> errors:Vector<SecureValueError> users:Vector<User> privacy_policy_url:flags.0?string = account.AuthorizationForm;
-
----functions---
-
-account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm;
-

If any of the values of the submitted form are rejected by the service, the bot calls the appropriate method to set information about errors.

-

The user can find out about these errors directly from the service, or, if they decide to restart the process and resend the corrected data, directly from the authorization form (errors field).

-
- -
- -
-
- -
- - - - - - - - diff --git a/data/core.telegram.org/method/help.getProxyData b/data/core.telegram.org/method/help.getProxyData deleted file mode 100644 index c43da0ed70..0000000000 --- a/data/core.telegram.org/method/help.getProxyData +++ /dev/null @@ -1,132 +0,0 @@ - - - - - help.getProxyData - - - - - - - - - - - - - -
- -
-
-
- -

help.getProxyData

- - - -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/method/messages.getMessageReactionsList b/data/core.telegram.org/method/messages.getMessageReactionsList deleted file mode 100644 index a7cd0225a1..0000000000 --- a/data/core.telegram.org/method/messages.getMessageReactionsList +++ /dev/null @@ -1,178 +0,0 @@ - - - - - messages.getMessageReactionsList - - - - - - - - - - - - - -
- -
-
-
- -

messages.getMessageReactionsList

- -

Get full message reaction list

-

-
 Method schema is available as of layer 135. Switch »

-

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
flags#Flags, see TL conditional fields
peerInputPeerPeer
idintMessage ID
reactionflags.0?stringGet only reactions of this type (UTF8 emoji)
offsetflags.1?stringOffset (typically taken from the next_offset field of the returned MessageReactionsList)
limitintMaximum number of results to return, see pagination
-

Result

-

MessageReactionsList

-

Bots can use this method

-

Related pages

-

MessageReactionsList

-

List of message reactions

-

Pagination in the API

-

How to fetch results from large lists of objects.

- -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/method/messages.getMessagesReactions b/data/core.telegram.org/method/messages.getMessagesReactions deleted file mode 100644 index 58119d44fd..0000000000 --- a/data/core.telegram.org/method/messages.getMessagesReactions +++ /dev/null @@ -1,153 +0,0 @@ - - - - - messages.getMessagesReactions - - - - - - - - - - - - - -
- -
-
-
- -

messages.getMessagesReactions

- - - -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/method/messages.searchGifs b/data/core.telegram.org/method/messages.searchGifs deleted file mode 100644 index b57a14a06b..0000000000 --- a/data/core.telegram.org/method/messages.searchGifs +++ /dev/null @@ -1,172 +0,0 @@ - - - - - messages.searchGifs - - - - - - - - - - - - - -
- -
-
-
- -

messages.searchGifs

- -

Search for GIFs

-

-
 Method schema is available as of layer 114. Switch »

-

Parameters

- - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
qstringText query
offsetintOffset for pagination »
-

Result

-

messages.FoundGifs

-

Possible errors

- - - - - - - - - - - - - - - -
CodeTypeDescription
400SEARCH_QUERY_EMPTYThe search query is empty
-

Related pages

-

Pagination in the API

-

How to fetch results from large lists of objects.

- -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/method/messages.sendReaction b/data/core.telegram.org/method/messages.sendReaction deleted file mode 100644 index 836b132baa..0000000000 --- a/data/core.telegram.org/method/messages.sendReaction +++ /dev/null @@ -1,185 +0,0 @@ - - - - - messages.sendReaction - - - - - - - - - - - - - -
- -
-
-
- -

messages.sendReaction

- -

Send reaction to message

-

-
 Method schema is available as of layer 135. Switch »

-

Parameters

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
flags#Flags, see TL conditional fields
peerInputPeerPeer
msg_idintMessage ID to react to
reactionflags.0?stringReaction (a UTF8 emoji)
-

Result

-

Updates

-

Possible errors

- - - - - - - - - - - - - - - - - - - - -
CodeTypeDescription
400MESSAGE_ID_INVALIDThe provided message id is invalid
400REACTION_EMPTYEmpty reaction provided
-

Bots can use this method

- -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/methods.html b/data/core.telegram.org/methods.html deleted file mode 100644 index bfde4f831a..0000000000 --- a/data/core.telegram.org/methods.html +++ /dev/null @@ -1,2084 +0,0 @@ - - - - - Methods - - - - - - - - - - - - - -
- -
-
-
- -

Methods

- -

Accepting the Terms of Service

- - - - - - - - - - - - - - - - - -
NameDescription
help.getTermsOfServiceUpdateLook for updates of telegram's terms of service
help.acceptTermsOfServiceAccept the new terms of service
-

Dealing with spam and ToS violations

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.reportPeerReport a peer for violation of telegram's Terms of Service
channels.reportSpamReports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup
messages.reportReport a message in a chat for violation of telegram's Terms of Service
messages.reportSpamReport a new incoming chat for spam, if the peer settings of the chat allow us to do that
messages.reportEncryptedSpamReport a secret chat for spam
-

Fetching configuration

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
help.getAppChangelogGet changelog of current app.
Typically, an updates constructor will be returned, containing one or more updateServiceNotification updates with app-specific changelogs.
help.getAppConfigGet app-specific configuration, see client configuration for more info on the result.
help.getAppUpdateReturns information on update availability for the current application.
help.getConfigReturns current configuration, including data center configuration.
help.getInviteTextReturns localized text of a text message with an invitation.
help.getNearestDcReturns info on data centre nearest to the user.
help.getSupportReturns the support user for the 'ask a question' feature.
help.getSupportNameGet localized name of the telegram support user
help.getCountriesListGet name, ISO code, localized name and phone codes/patterns of all available countries
help.dismissSuggestionDismiss a suggestion
-

Login via QR code

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
auth.exportLoginTokenGenerate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code.

For more info, see login via QR code.
auth.acceptLoginTokenAccept QR code login token, logging in the app that generated it.

Returns info about the new session.

For more info, see login via QR code.
auth.importLoginTokenLogin using a redirected login token, generated in case of DC mismatch during QR code login.

For more info, see login via QR code.
-

Miscellaneous

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
help.saveAppLogSaves logs of application on the server.
initConnectionInitialize connection
invokeAfterMsgInvokes a query after successfull completion of one of the previous queries.
invokeAfterMsgsInvokes a query after a successfull completion of previous queries
invokeWithLayerInvoke the specified query using the specified API layer
invokeWithoutUpdatesInvoke a request without subscribing the used connection for updates (this is enabled by default for file queries).
-

Registration/Authorization

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
auth.bindTempAuthKeyBinds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one.

For more information, see Perfect Forward Secrecy.
auth.cancelCodeCancel the login verification code
auth.checkPasswordTry logging to an account protected by a 2FA password.
auth.dropTempAuthKeysDelete all temporary authorization keys except for the ones specified
auth.exportAuthorizationReturns data for copying authorization to another data-centre.
auth.importAuthorizationLogs in a user using a key transmitted from his native data-centre.
auth.importBotAuthorizationLogin as a bot
auth.logOutLogs out the user.
auth.recoverPasswordReset the 2FA password using the recovery code sent using auth.requestPasswordRecovery.
auth.requestPasswordRecoveryRequest recovery code of a 2FA password, only for accounts with a recovery email configured.
auth.resendCodeResend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info.
auth.resetAuthorizationsTerminates all user's authorized sessions except for the current one.

After calling this method it is necessary to reregister the current device using the method account.registerDevice
auth.sendCodeSend the verification code for login
auth.signInSigns in a user with a validated phone number.
auth.signUpRegisters a validated phone number in the system.
-

Working with GDPR export

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.initTakeoutSessionIntialize account takeout session
account.finishTakeoutSessionFinish account takeout session
messages.getSplitRangesGet message ranges for saving the user's chat history
channels.getLeftChannelsGet a list of channels/supergroups we left
invokeWithMessagesRangeInvoke with the given message range
invokeWithTakeoutInvoke a method within a takeout session
-

Working with GIFs (actually MPEG4 GIFs)

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getSavedGifsGet saved GIFs
messages.saveGifAdd GIF to saved gifs list
messages.searchGifsSearch for GIFs
-

Working with Public Service Announcement and MTProxy channels

- - - - - - - - - - - - - - - - - -
NameDescription
help.hidePromoDataHide MTProxy/Public Service Announcement information
help.getPromoDataGet MTProxy/Public Service Announcement information
-

Working with TSF (internal use only)

- - - - - - - - - - - - - - - - - -
NameDescription
help.editUserInfoInternal use
help.getUserInfoInternal use
-

Working with 2FA login

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.confirmPasswordEmailVerify an email to use as 2FA recovery method.
account.resendPasswordEmailResend the code to verify an email to use as 2FA recovery method.
account.cancelPasswordEmailCancel the code that was sent to verify an email to use as 2FA recovery method.
account.getPasswordObtain configuration for two-factor authorization with password
account.getPasswordSettingsGet private info associated to the password info (recovery email, telegram passport info & so on)
account.updatePasswordSettingsSet a new 2FA password
-

Working with Seamless Telegram Login

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.requestUrlAuthGet more info about a Seamless Telegram Login authorization request, for more info click here »
messages.acceptUrlAuthUse this to accept a Seamless Telegram Login authorization request, for more info click here »
account.getWebAuthorizationsGet web login widget authorizations
account.resetWebAuthorizationLog out an active web telegram login session
account.resetWebAuthorizationsReset all active web telegram login sessions
-

Working with VoIP calls

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
phone.acceptCallAccept incoming call
phone.confirmCallComplete phone call E2E encryption key exchange »
phone.discardCallRefuse or end running call
phone.getCallConfigGet phone call configuration to be passed to libtgvoip's shared config
phone.receivedCallOptional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended.
phone.requestCallStart a telegram phone call
phone.saveCallDebugSend phone call debug data to server
phone.sendSignalingDataSend VoIP signaling data
phone.setCallRatingRate a call
-

Working with channels/supergroups/geogroups

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
channels.createChannelCreate a supergroup/channel.
channels.getInactiveChannelsGet inactive channels and supergroups
channels.deleteChannelDelete a channel/supergroup
channels.deleteHistoryDelete the history of a supergroup
channels.deleteMessagesDelete messages in a channel/supergroup
channels.deleteUserHistoryDelete all messages sent by a certain user in a supergroup
channels.editAdminModify the admin rights of a user in a supergroup/channel.
channels.editBannedBan/unban/kick a user in a supergroup/channel.
channels.editCreatorTransfer channel ownership
channels.editLocationEdit location of geogroup
channels.editPhotoChange the photo of a channel/supergroup
channels.editTitleEdit the name of a channel/supergroup
channels.exportMessageLinkGet link and embed info of a message in a channel/supergroup
channels.getAdminLogGet the admin log of a channel/supergroup
channels.getAdminedPublicChannelsGet channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups.
channels.getChannelsGet info about channels/supergroups
channels.getFullChannelGet full info about a channel
channels.getGroupsForDiscussionGet all groups that can be used as discussion groups.

Returned legacy group chats must be first upgraded to supergroups before they can be set as a discussion group.
To set a returned supergroup as a discussion group, access to its old messages must be enabled using channels.togglePreHistoryHidden, first.
channels.getMessagesGet channel/supergroup messages
channels.getParticipantGet info about a channel/supergroup participant
channels.getParticipantsGet the participants of a supergroup/channel
channels.inviteToChannelInvite users to a channel/supergroup
channels.joinChannelJoin a channel/supergroup
channels.leaveChannelLeave a channel/supergroup
channels.readHistoryMark channel/supergroup history as read
channels.readMessageContentsMark channel/supergroup message contents as read
channels.setDiscussionGroupAssociate a group to a channel as discussion group for that channel
channels.setStickersAssociate a stickerset to the supergroup
channels.togglePreHistoryHiddenHide/unhide message history for new channel/supergroup users
channels.toggleSignaturesEnable/disable message signatures in channels
channels.toggleSlowModeToggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds
messages.getStatsURLReturns URL with the chat statistics. Currently this method can be used only for channels
-

Working with chats/supergroups/channels

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.addChatUserAdds a user to a chat and sends a service message on it.
messages.checkChatInviteCheck the validity of a chat invite link and get basic info about it
messages.createChatCreates a new chat.
messages.deleteChatUserDeletes a user from a chat and sends a service message on it.
messages.editChatAboutEdit the description of a group/supergroup/channel.
messages.editChatAdminMake a user admin in a legacy group.
messages.editChatDefaultBannedRightsEdit the default banned rights of a channel/supergroup/group.
messages.editChatPhotoChanges chat photo and sends a service message on it
messages.editChatTitleChanages chat name and sends a service message on it.
messages.exportChatInviteExport an invite link for a chat
messages.getAllChatsGet all chats, channels and supergroups
messages.getChatsReturns chat basic info on their IDs.
messages.getCommonChatsGet chats in common with a user
messages.getFullChatReturns full chat info according to its ID.
messages.importChatInviteImport a chat invite and join a private chat/supergroup/channel
messages.migrateChatTurn a legacy group into a supergroup
-

Working with deep links

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.startBotStart a conversation with a bot using a deep linking parameter
help.getDeepLinkInfoGet info about a t.me link
help.getRecentMeUrlsGet recently used t.me links
-

Working with files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
help.getCdnConfigGet configuration for CDN file downloads.
upload.getCdnFileDownload a CDN file.
upload.getCdnFileHashesGet SHA256 hashes for verifying downloaded CDN files
upload.reuploadCdnFileRequest a reupload of a certain file to a CDN DC.
upload.getFileReturns content of a whole file or its part.
upload.getFileHashesGet SHA256 hashes for verifying downloaded files
upload.getWebFileReturns content of an HTTP file or a part, by proxying the request through telegram.
upload.saveBigFilePartSaves a part of a large file (over 10Mb in size) to be later passed to one of the methods.
upload.saveFilePartSaves a part of file for futher sending to one of the methods.
messages.uploadEncryptedFileUpload encrypted file and associate it to a secret chat
messages.uploadMediaUpload a file and associate it to a chat (without actually sending it to the chat)
messages.getDocumentByHashGet a document by its SHA256 hash, mainly used for gifs
-

Working with instant view pages

- - - - - - - - - - - - - - - - - -
NameDescription
messages.getWebPageGet instant view page
messages.getWebPagePreviewGet preview of webpage
-

Working with secret chats

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.setEncryptedTypingSend typing event by the current user to a secret chat.
messages.readEncryptedHistoryMarks message history within a secret chat as read.
messages.acceptEncryptionConfirms creation of a secret chat
messages.discardEncryptionCancels a request for creation and/or delete info on secret chat.
messages.requestEncryptionSends a request to start a secret chat to the user.
messages.sendEncryptedSends a text message to a secret chat.
messages.sendEncryptedFileSends a message with a file attachment to a secret chat
messages.sendEncryptedServiceSends a service message to a secret chat.
messages.getDhConfigReturns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length.
messages.receivedQueueConfirms receipt of messages in a secret chat by client, cancels push notifications.
-

Working with telegram passport

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.sendVerifyEmailCodeSend the verification email code for telegram passport.
account.verifyEmailVerify an email address for telegram passport.
account.sendVerifyPhoneCodeSend the verification phone code for telegram passport.
account.verifyPhoneVerify a phone number for telegram passport.
account.acceptAuthorizationSends a Telegram Passport authorization form, effectively sharing data with the service
account.getAuthorizationFormReturns a Telegram Passport authorization form for sharing data with a service
account.getAuthorizationsGet logged-in sessions
account.deleteSecureValueDelete stored Telegram Passport documents, for more info see the passport docs »
account.getAllSecureValuesGet all saved Telegram Passport documents, for more info see the passport docs »
account.getSecureValueGet saved Telegram Passport document, for more info see the passport docs »
account.saveSecureValueSecurely save Telegram Passport document, for more info see the passport docs »
help.getPassportConfigGet passport configuration
users.setSecureValueErrorsNotify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change).

Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
-

Working with updates

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
updates.getChannelDifferenceReturns the difference between the current state of updates of a certain channel and transmitted.
updates.getDifferenceGet new updates.
updates.getStateReturns a current state of updates.
-

Working with bot inline queries and callback buttons

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getInlineBotResultsQuery an inline bot
messages.setInlineBotResultsAnswer an inline query, for bots only
messages.sendInlineBotResultSend a result obtained using messages.getInlineBotResults.
messages.getBotCallbackAnswerPress an inline callback button and get a callback answer from the bot
messages.setBotCallbackAnswerSet the callback answer to a user button press (bots only)
messages.editInlineBotMessageEdit an inline bot message
-

Working with bots

- - - - - - - - - - - - - -
NameDescription
bots.setBotCommandsSet bot command list
-

Working with bots (internal bot API use)

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
bots.answerWebhookJSONQueryAnswers a custom query; for bots only
bots.sendCustomRequestSends a custom request; for bots only
help.setBotUpdatesStatusInforms the server about the number of pending bot updates if they haven't been processed for a long time; for bots only
-

Working with cloud themes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.updateThemeUpdate theme
account.uploadThemeUpload theme
account.getThemesGet installed themes
account.createThemeCreate a theme
account.installThemeInstall a theme
account.saveThemeSave a theme
account.getThemeGet theme information
-

Working with contacts and top peers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.getContactSignUpNotificationWhether the user will receive notifications when contacts sign up
account.setContactSignUpNotificationToggle contact sign up notifications
contacts.acceptContactIf the peer settings of a new user allow us to add him as contact, add that user as contact
contacts.addContactAdd an existing telegram user as contact.

Use contacts.importContacts to add contacts by phone number, without knowing their Telegram ID.
contacts.blockAdds the user to the blacklist.
contacts.deleteByPhonesDelete contacts by phone number
contacts.deleteContactsDeletes several contacts from the list.
contacts.getBlockedReturns the list of blocked users.
contacts.getContactIDsGet contact by telegram IDs
contacts.getContactsReturns the current user's contact list.
contacts.getLocatedGet contacts near you
contacts.getSavedGet all contacts
contacts.getStatusesReturns the list of contact statuses.
contacts.getTopPeersGet most used peers
contacts.importContactsImports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.

Use contacts.addContact to add Telegram contacts without actually using their phone number.
contacts.resetSavedDelete saved contacts
contacts.resetTopPeerRatingReset rating of top peer
contacts.searchReturns users found by username substring.
contacts.toggleTopPeersEnable/disable top peers
contacts.unblockDeletes the user from the blacklist.
-

Working with credit cards

- - - - - - - - - - - - - -
NameDescription
payments.getBankCardDataGet info about a credit card
-

Working with dialogs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getDialogsReturns the current user dialog list.
messages.getPeerDialogsGet dialog info of specified peers
messages.getPinnedDialogsGet pinned dialogs
messages.toggleDialogPinPin/unpin a dialog
messages.reorderPinnedDialogsReorder pinned dialogs
messages.getDialogUnreadMarksGet dialogs manually marked as unread
messages.markDialogUnreadManually mark dialog as unread
messages.getPeerSettingsGet peer settings
messages.hidePeerSettingsBarShould be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the peer's settings.
messages.getOnlinesGet count of online users in a chat
messages.sendScreenshotNotificationNotify the other user in a private chat that a screenshot of the chat was taken
messages.setTypingSends a current user typing event (see SendMessageAction for all event types) to a conversation partner or group.
-

Working with drafts

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.clearAllDraftsClear all drafts.
messages.getAllDraftsSave get all message drafts.
messages.saveDraftSave a message draft associated to a chat.
-

Working with emoji keywords

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getEmojiKeywordsGet localized emoji keywords
messages.getEmojiKeywordsDifferenceGet changed emoji keywords
messages.getEmojiKeywordsLanguagesGet info about an emoji keyword localization
messages.getEmojiURLReturns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation
-

Working with folders

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.updateDialogFiltersOrderReorder folders
messages.getDialogFiltersGet folders
messages.getSuggestedDialogFiltersGet suggested folders
messages.updateDialogFilterUpdate folder
folders.deleteFolderDelete a peer folder
folders.editPeerFoldersEdit peers in peer folder
-

Working with games

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getGameHighScoresGet highscores of a game
messages.getInlineGameHighScoresGet highscores of a game sent using an inline bot
messages.setGameScoreUse this method to set the score of the specified user in a game sent as a normal message (bots only).
messages.setInlineGameScoreUse this method to set the score of the specified user in a game sent as an inline message (bots only).
-

Working with localization packs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
langpack.getDifferenceGet new strings in languagepack
langpack.getLangPackGet localization pack strings
langpack.getLanguageGet information about a language in a localization pack
langpack.getLanguagesGet information about all languages in a localization pack
langpack.getStringsGet strings from a language pack
-

Working with media autodownload settings

- - - - - - - - - - - - - - - - - -
NameDescription
account.getAutoDownloadSettingsGet media autodownload settings
account.saveAutoDownloadSettingsChange media autodownload settings
-

Working with message threads

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getRepliesGet messages in a reply thread
contacts.blockFromRepliesStop getting notifications about thread replies of a certain user in @replies
messages.getDiscussionMessageGet discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group
messages.readDiscussionMark a thread as read
-

Working with message reactions

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getMessagesReactionsGet message reactions
messages.sendReactionSend reaction to message
messages.getMessageReactionsListGet full message reaction list
-

Working with messages

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.deleteHistoryDeletes communication history.
messages.deleteMessagesDeletes messages by their identifiers.
messages.editMessageEdit message
messages.forwardMessagesForwards messages by their IDs.
messages.getHistoryGets back the conversation history with one interlocutor / within a chat
messages.getMessageEditDataFind out if a media message's caption can be edited
messages.getMessagesReturns the list of messages by their IDs.
messages.getMessagesViewsGet and increase the view counter of a message sent or forwarded from a channel
messages.getRecentLocationsGet live location history of a certain user
messages.getSearchCountersGet the number of results that would be found by a messages.search call with the same parameters
messages.getUnreadMentionsGet unread messages where we were mentioned
messages.readHistoryMarks message history as read.
messages.readMentionsMark mentions as read
messages.readMessageContentsNotifies the sender about the recipient having listened a voice message or watched a video.
messages.receivedMessagesConfirms receipt of messages by a client, cancels PUSH-notification sending.
messages.searchGets back found messages
messages.searchGlobalSearch for messages and peers globally
messages.sendMediaSend a media
messages.sendMessageSends a message to a chat
messages.sendMultiMediaSend an album or grouped media
messages.updatePinnedMessagePin a message
messages.unpinAllMessagesUnpin all pinned messages
-

Working with notification settings

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.registerDeviceRegister device to receive PUSH notifications
account.unregisterDeviceDeletes a device by its token, stops sending PUSH-notifications to it.
account.updateDeviceLockedWhen client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications.
account.getNotifyExceptionsReturns list of chats with non-default notification settings
account.getNotifySettingsGets current notification settings for a given user/group, from all users/all groups.
account.updateNotifySettingsEdits notification settings from a given user/group, from all users/all groups.
account.resetNotifySettingsResets all notification settings from users and groups.
-

Working with other users

- - - - - - - - - - - - - - - - - -
NameDescription
users.getFullUserReturns extended user info by ID.
users.getUsersReturns basic user info according to their identifiers.
-

Working with payments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
payments.getSavedInfoGet saved payment information
payments.clearSavedInfoClear saved payment information
payments.getPaymentFormGet a payment form
payments.validateRequestedInfoSubmit requested order information for validation
messages.setBotShippingResultsIf you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an updateBotShippingQuery update. Use this method to reply to shipping queries.
account.getTmpPasswordGet temporary payment password
payments.sendPaymentFormSend compiled payment form
messages.setBotPrecheckoutResultsOnce the user has confirmed their payment and shipping details, the bot receives an updateBotPrecheckoutQuery update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent.
payments.getPaymentReceiptGet payment receipt
-

Working with polls

- - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getPollResultsGet poll results
messages.getPollVotesGet poll results for non-anonymous polls
messages.sendVoteVote in a poll
-

Working with scheduled messages

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.sendScheduledMessagesSend scheduled messages right away
messages.getScheduledHistoryGet scheduled messages
messages.deleteScheduledMessagesDelete scheduled messages
messages.getScheduledMessagesGet scheduled messages
-

Working with sensitive content (NSFW)

- - - - - - - - - - - - - - - - - -
NameDescription
account.getContentSettingsGet sensitive content settings
account.setContentSettingsSet sensitive content settings (for viewing or hiding NSFW content)
-

Working with sponsored proxies

- - - - - - - - - - - - - -
NameDescription
help.getProxyDataGet promotion info of the currently-used MTProxy
-

Working with statistics

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
stats.loadAsyncGraphLoad channel statistics graph asynchronously
stats.getBroadcastStatsGet channel statistics
stats.getMessagePublicForwardsObtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of messages with peer_id equal to the public channel to which this message was forwarded.
stats.getMegagroupStatsGet supergroup statistics
stats.getMessageStatsGet message statistics
-

Working with stickers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
messages.getOldFeaturedStickersMethod for fetching previously featured stickers
messages.toggleStickerSetsApply changes to multiple stickersets
stickers.setStickerSetThumbSet stickerset thumbnail
stickers.addStickerToSetAdd a sticker to a stickerset, bots only. The sticker set must have been created by the bot.
stickers.changeStickerPositionChanges the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot
stickers.createStickerSetCreate a stickerset, bots only.
stickers.removeStickerFromSetRemove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot.
messages.clearRecentStickersClear recent stickers
messages.faveStickerMark a sticker as favorite
messages.getAllStickersGet all installed stickers
messages.getArchivedStickersGet all archived stickers
messages.getAttachedStickersGet stickers attached to a photo or video
messages.getFavedStickersGet faved stickers
messages.getFeaturedStickersGet featured stickers
messages.getMaskStickersGet installed mask stickers
messages.getRecentStickersGet recent stickers
messages.getStickerSetGet info about a stickerset
messages.getStickersGet stickers by emoji
messages.saveRecentStickerAdd/remove sticker from recent stickers list
messages.installStickerSetInstall a stickerset
messages.readFeaturedStickersMark new featured stickers as read
messages.reorderStickerSetsReorder installed stickersets
messages.searchStickerSetsSearch for stickersets
messages.uninstallStickerSetUninstall a stickerset
-

Working with the user's account

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.changePhoneChange the phone number of the current account
account.confirmPhoneConfirm a phone number to cancel account deletion, for more info click here »
account.deleteAccountDelete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured.
account.getAccountTTLGet days to live of account
account.getPrivacyGet privacy settings of current account
account.resetAuthorizationLog out an active authorized session by its hash
account.sendChangePhoneCodeVerify a new phone number to associate to the current account
account.sendConfirmPhoneCodeSend confirmation code to cancel account deletion, for more info click here »
account.setAccountTTLSet account self-destruction period
account.setPrivacyChange privacy settings of current account
account.setGlobalPrivacySettingsSet global privacy settings
account.getGlobalPrivacySettingsGet global privacy settings
account.updateProfileUpdates user profile.
account.updateStatusUpdates online user status.
-

Working with user profile pictures

- - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
photos.deletePhotosDeletes profile photos.
photos.getUserPhotosReturns the list of user photos.
photos.updateProfilePhotoInstalls a previously uploaded photo as a profile photo.
photos.uploadProfilePhotoUpdates current user profile photo.
-

Working with usernames

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
channels.checkUsernameCheck if a username is free and can be assigned to a channel/supergroup
channels.updateUsernameChange the username of a supergroup/channel
account.updateUsernameChanges username for the current user.
account.checkUsernameValidates a username and checks availability.
contacts.resolveUsernameResolve a @username to get peer info
-

Working with wallpapers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescription
account.getMultiWallPapersGet info about multiple wallpapers
account.getWallPaperGet info about a certain wallpaper
account.getWallPapersReturns a list of available wallpapers.
account.installWallPaperInstall wallpaper
account.resetWallPapersDelete installed wallpapers
account.saveWallPaperInstall/uninstall wallpaper
account.uploadWallPaperCreate and upload a new wallpaper
- -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/type/MessageReactionsList.html b/data/core.telegram.org/type/MessageReactionsList.html deleted file mode 100644 index 9b7f6be3f2..0000000000 --- a/data/core.telegram.org/type/MessageReactionsList.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - MessageReactionsList - - - - - - - - - - - - - -
- - - -
- - - - - - diff --git a/data/core.telegram.org/type/help.ProxyData b/data/core.telegram.org/type/help.ProxyData deleted file mode 100644 index 74b4b9f7c4..0000000000 --- a/data/core.telegram.org/type/help.ProxyData +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Help.ProxyData - - - - - - - - - - - - - -
- - - -
- - - - - - diff --git a/data/core.telegram.org/type/messages.FoundGifs b/data/core.telegram.org/type/messages.FoundGifs deleted file mode 100644 index 45502897c9..0000000000 --- a/data/core.telegram.org/type/messages.FoundGifs +++ /dev/null @@ -1,128 +0,0 @@ - - - - - Messages.FoundGifs - - - - - - - - - - - - - -
- - - -
- - - - - - diff --git a/data/tsf.telegram.org/auth.html b/data/tsf.telegram.org/auth.html deleted file mode 100644 index d9ec828195..0000000000 --- a/data/tsf.telegram.org/auth.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - Telegram Support Force - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
- -
-
-
-
- -
-
-
-

Telegram Support Initiative

- -

Our users ask us tens of thousands of questions each day. We would like to answer them all — and we are looking for brilliant people from all over the world who would like to help us do this. If you are interested in joining us, please read this Telegram Support Force Manifesto — and don't miss the tiny FAQ below.

-
- -
- -

Harnessing the power of procrastination

-
    -
  1. Telegram is a free messaging system that is used by tens of millions of people daily. Each of our apps has an ‘Ask a question’ button. Our users press it thousands of times each day: some have questions, others just want to chat, still others are bored trolls. We think that they all deserve an answer of some kind.

    -
  2. -
  3. Robots and algorithms are good at handing out answers at scale, but they sometimes cause frustration, fundamentally lack human touch and are bad conversation partners. FAQs are a remedy for the select few that enjoy finding answers in FAQs. To be happy, humanity requires human answers.

    -
  4. -
  5. Manually answering tens of thousands of questions daily requires considerable resources. Manually answering them in style — even when assisted by algorithms and templates — requires limitless resources. But, the resources in question being humans and time, the modern world happens to have a limitless source of just such energy.

    -
  6. -
  7. This world is full of bright-minded, elegant, downright wonderful people who, like you and me, sometimes just can't get started with whatever they were supposed to be doing. And procrastinate instead. This brings countless people in any profession to hours and hours of unnecessary house-cleaning, dog-walking and web-surfing every day. Millions of hours go to waste — procrastination is as ubiquitous in the XXI century as are people who do their work behind computer screens.

    -
  8. -
  9. It is our goal to harness the power of procrastination. For user support, we rely on an army of volunteers from all over the world. They donate a fraction of their time to answer a few questions from Telegram users — every now and then, or all the time. We call this the Telegram Support Force and you are welcome to join.

    -
  10. -
  11. Answering questions may be devilishly tricky at times, so we couldn't accept everyone even if we wanted to. The Telegram Support Force needs patient, inquisitive people, who are no strangers to elegance, humor and style. Although Telegram volunteers help people from their own countries, proficiency in English is also a requirement, since the data you will be getting from us, as well as pretty much all communication inside the team, will be in English.

    -
  12. -
  13. We believe in support as an art form. Support should be fun — for people on both ends of the line. So we are looking for perfect, human and precise answers to the world's questions. Something to make them smile and to make you proud.

    -
  14. -
-

If this is something you might be interested in doing, don't hesitate to contact our @TelegramAuditions account. Please write us a few phrases in English describing how your favourite feature works (don’t copy it, let it be your hand-made text). Include a picture of a marmot if you want a better chance at convincing us that you actually read all of the above and below and, therefore, are inquisitive enough.

-

Markus Ra
@Telegram

-
-

Manifesto FAQ

-

Q: Do I need to know anything special to be eligible?

-

No, not really. But you do need to know how to learn things. And be inquisitive enough to want to learn them.

-

Q: What else is required?

-

We‘re looking for perfectionists. It’d also be nice if you loved your language and had at least a moderate affection for the people of Earth. It'd be cool if you like to read and write. And then, patience and understanding are very useful at times.

-

Q: Will the people I answer know who I am or get my number?

-

No, they will not. Unless you choose to tell them for some mysterious reason.

-

Q: What should I say when I contact you?

-

We'd love to know more about you (who you are, what you think, what you like — not a CV, no!), the languages you speak and the devices you use (mobile, desktop OS).

-

Q: How long does it take for you to reply?

-

We try not to take too long. But we sometimes do, so we apologize in advance. Sorry. Don‘t lose heart and remember that thing about patience above. We’ll get back to you as soon as we can.

-

Q: Is that thing about sending a marmot picture a joke?

-

No.

-
- -
-
-
-
- - - - - - - - - - - - - - - - - diff --git a/data/tsf.telegram.org/js/jquery-ui.min.js b/data/tsf.telegram.org/js/jquery-ui.min.js deleted file mode 100644 index a47c061a05..0000000000 --- a/data/tsf.telegram.org/js/jquery-ui.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! jQuery UI - v1.11.4 - 2017-08-30 -* http://jqueryui.com -* Includes: core.js, widget.js, mouse.js, draggable.js, resizable.js, sortable.js, slider.js, effect.js, effect-slide.js -* Copyright jQuery Foundation and other contributors; Licensed MIT */ - -(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(e,s){var n,o,a,r=e.nodeName.toLowerCase();return"area"===r?(n=e.parentNode,o=n.name,e.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']")[0],!!a&&i(a)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!e.disabled:"a"===r?e.href||s:s)&&i(e)}function i(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}t.ui=t.ui||{},t.extend(t.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({scrollParent:function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])},focusable:function(i){return e(i,!isNaN(t.attr(i,"tabindex")))},tabbable:function(i){var s=t.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&e(i,!n)}}),t("").outerWidth(1).jquery||t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.fn.extend({focus:function(e){return function(i,s){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),s&&s.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var i,s,n=t(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}};var s=0,n=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r,l={},h=e.split(".")[0];return e=e.split(".")[1],n=h+"-"+e,s||(s=i,i=t.Widget),t.expr[":"][n.toLowerCase()]=function(e){return!!t.data(e,n)},t[h]=t[h]||{},o=t[h][e],a=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new a(t,e)},t.extend(a,o,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),r=new i,r.options=t.widget.extend({},r.options),t.each(s,function(e,s){return t.isFunction(s)?(l[e]=function(){var t=function(){return i.prototype[e].apply(this,arguments)},n=function(t){return i.prototype[e].apply(this,t)};return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(l[e]=s,void 0)}),a.prototype=t.widget.extend(r,{widgetEventPrefix:o?r.widgetEventPrefix||e:e},l,{constructor:a,namespace:h,widgetName:e,widgetFullName:n}),o?(t.each(o._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,a,i._proto)}),delete o._childConstructors):i._childConstructors.push(a),t.widget.bridge(e,a),a},t.widget.extend=function(e){for(var i,s,o=n.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])s=o[a][i],o[a].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=n.call(arguments,1),l=this;return a?this.each(function(){var i,n=t.data(this,s);return"instance"===o?(l=n,!1):n?t.isFunction(n[o])&&"_"!==o.charAt(0)?(i=n[o].apply(n,r),i!==n&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,s);e?(e.option(o||{}),e._init&&e._init()):t.data(this,s,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=s++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!e),e&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.delegate(c,h,r):i.bind(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(i).undelegate(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget;var o=!1;t(document).mouseup(function(){o=!1}),t.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!o){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),o=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),o=!1,!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.widget("ui.draggable",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this._blurActiveElement(e),this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=this.document[0];if(this.handleElement.is(e.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&t(i.activeElement).blur()}catch(s){}},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._normalizeRightBottom(),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.focus(),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseInt(t,10)||0 -},_isNumber:function(t){return!isNaN(parseInt(t,10))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i,s,n,o,a=this,r=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)s=t.trim(e[i]),o="ui-resizable-"+s,n=t("
"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(t(this).removeClass("ui-resizable-autohide"),a._handles.show())}).mouseleave(function(){r.disabled||a.resizing||(t(this).addClass("ui-resizable-autohide"),a._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),a.addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,l=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseInt(s[e],10)||0,i[e]+=parseInt(n[e],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.options,s=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.sortable",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),t.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),s=e&&i,n=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return s?this.floating?o&&"right"===o||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue; -d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"clientX":"clientY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.slider",t.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("
").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,l,h,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,o.addClass("ui-state-active").focus(),l=o.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-o.width()/2,top:e.pageY-l.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,o;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,o=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),o!==!1&&this.values(e,i))):i!==this.value()&&(o=this._trigger("slide",t,{handle:this.handles[e],value:i}),o!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!i),this._super(e,i),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.floor(+(t-e).toFixed(this._precision())/i)*i;t=s+e,this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,l=this,h=this._animateOff?!1:r.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((l.values(s)-l._valueMin())/(l._valueMax()-l._valueMin())),c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,r.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===s&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(e.target).addClass("ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}});var a="ui-effects-",r=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=h(),n=s._rgba=[];return i=i.toLowerCase(),f(l,function(t,o){var a,r=o.re.exec(i),l=r&&o.parse(r),h=o.space||"rgba";return l?(a=s[h](l),s[c[h].cache]=a[c[h].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],h=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=h.support={},p=t("

")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),h.fn=t.extend(h.prototype,{parse:function(n,a,r,l){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,l],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof h?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=h(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=h(t),n=s._space(),o=c[n],a=0===this.alpha()?h("transparent"):this,r=a[o.cache]||o.to(a._rgba),l=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],h=s[o],c=u[n.type]||{};null!==h&&(null===a?l[o]=h:(c.mod&&(h-a>c.mod/2?a+=c.mod:a-h>c.mod/2&&(a-=c.mod)),l[o]=i((h-a)*e+a,n)))}),this[n](l)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=h(e)._rgba;return h(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),l=Math.min(s,n,o),h=r-l,c=r+l,u=.5*c;return e=l===r?0:s===r?60*(n-o)/h+360:n===r?60*(o-s)/h+120:60*(s-n)/h+240,i=0===h?0:.5>=u?h/c:h/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,l=n.to,c=n.from;h.fn[s]=function(s){if(l&&!this[a]&&(this[a]=l(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=h(c(d)),n[a]=d,n):h(d)},f(o,function(e,i){h.fn[e]||(h.fn[e]=function(n){var o,a=t.type(n),l="alpha"===e?this._hsla?"hsla":"rgba":s,h=this[l](),c=h[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),h[i.idx]=n,this[l](h)))})})}),h.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=h(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(l){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=h(e.elem,i),e.end=h(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(r),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(r.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var l=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",h=l.children?a.find("*").addBack():a;h=h.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),h=h.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),h=h.map(function(){var e=this,i=t.Deferred(),s=t.extend({},l,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,h.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),l.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.11.4",save:function(t,e){for(var i=0;e.length>i;i++)null!==e[i]&&t.data(a+e[i],t[0].style[e[i]])},restore:function(t,e){var i,s;for(s=0;e.length>s;s++)null!==e[s]&&(i=t.data(a+e[s]),void 0===i&&(i=""),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("

").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){t.isFunction(o)&&o.call(n[0]),t.isFunction(e)&&e()}var n=t(this),o=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):a.call(n[0],s,i)}var s=e.apply(this,arguments),n=s.mode,o=s.queue,a=t.effects.effect[s.effect]; -return t.fx.off||!a?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):o===!1?this.each(i):this.queue(o||"fx",i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}(),t.effects,t.effects.effect.slide=function(e,i){var s,n=t(this),o=["position","top","bottom","left","right","width","height"],a=t.effects.setMode(n,e.mode||"show"),r="show"===a,l=e.direction||"left",h="up"===l||"down"===l?"top":"left",c="up"===l||"left"===l,u={};t.effects.save(n,o),n.show(),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(h,c?isNaN(s)?"-"+s:-s:s),u[h]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&n.hide(),t.effects.restore(n,o),t.effects.removeWrapper(n),i()}})}}); \ No newline at end of file diff --git a/data/tsf.telegram.org/js/main-aj.js b/data/tsf.telegram.org/js/main-aj.js deleted file mode 100644 index 1813fd5404..0000000000 --- a/data/tsf.telegram.org/js/main-aj.js +++ /dev/null @@ -1,1079 +0,0 @@ -function ajInit(options) { - if (!window.history || !history.pushState) { - return false; - } - - var nav_url = location.href; - var short_url = layerUrlToShort(nav_url); - if (options.layer && !short_url) { - nav_url = layerUrlToNav(nav_url); - } - if (!history.state) { - history.replaceState({i: 0, u: nav_url}, null, short_url); - } else if (!history.state.u) { - history.replaceState({i: history.state.i, u: nav_url}, null, short_url); - } else if (short_url && location.href != short_url) { - history.replaceState(history.state, null, short_url); - } - - var $progress = $('#aj_progress'), - progressBoxShadow = 'inset 0 2px 0 #39ade7', - progressNoBoxShadow = 'inset 0 0 0 #39ade7', - progressTransition = 'width .3s linear, box-shadow .2s ease', - progressTo, - progressVal = 0; - $progress.css({ - width: 0, - transition: progressTransition, - position: 'fixed', - zIndex: 1000, - top: 0, - height: 3 - }); - - var skipPopState = false; - var curHistoryState = history.state; - var curLocation = loc(curHistoryState.u); - var layerCloseLocation = layerCloseLoc(curHistoryState.u); - var underLayerTitle = document.title; - var curOnLoad = [], curOnUnload = []; - var curOnLayerLoad = [], curOnLayerUnload = []; - var curBeforeUnload = false, curBeforeLayerUnload = false; - var ajContainer = $('#aj_content'); - - console.log('history init', 'curState =', curHistoryState); - - window.Aj = { - apiUrl: options.apiUrl, - version: options.version, - unauth: options.unauth || false, - onLoad: onLoad, - onUnload: onUnload, - onLayerLoad: onLayerLoad, - onLayerUnload: onLayerUnload, - pageLoaded: pageLoaded, - layerLoaded: layerLoaded, - showProgress: showProgress, - hideProgress: hideProgress, - onBeforeUnload: onBeforeUnload, - onBeforeLayerUnload: onBeforeLayerUnload, - linkHandler: linkHandler, - location: _location, - layerLocation: layerLocation, - setLocation: setLocation, - setLayerLocation: setLayerLocation, - apiRequest: apiRequest, - needAuth: needAuth, - ajContainer: ajContainer, - state: options.state || {}, - layerState: {}, - layer: false - }; - - if (options.layer) { - Aj.layer = $('#layer-popup-container'); - Aj.layerState = options.layerState || {}; - if (options.layerTitle) { - document.title = options.layerTitle; - } - } - - function showProgress() { - clearTimeout(progressTo); - if (!progressVal) { - $progress.css({width: 0, transition: 'none'}); - progressTo = setTimeout(function() { - $progress.css({transition: progressTransition}); - showProgress(); - }, 50); - } else { - progressTo = setTimeout(showProgress, 300); - } - $progress.css({width: progressVal + '%', boxShadow: progressBoxShadow}); - progressVal = progressVal + (99 - progressVal) / 4; - } - - function hideProgress(cancel) { - clearTimeout(progressTo); - progressTo = false; - progressVal = 0; - $progress.css({width: cancel ? '0%' : '100%'}); - setTimeout(function() { - $progress.css({boxShadow: progressNoBoxShadow}); - }, 300); - } - - function apiRequest(method, data, onSuccess) { - return $.ajax(Aj.apiUrl, { - type: 'POST', - data: $.extend(data, {method: method}), - dataType: 'json', - xhrFields: { - withCredentials: true - }, - success: function(result) { - if (result._dlog) { - $('#dlog').append(result._dlog); - } - onSuccess && onSuccess(result); - }, - error: function(xhr) { - if (!xhr.readyState && !xhr.status) { - // was aborted - } else if (xhr.status == 401) { - location.href = '/auth'; - } else { - location.reload(); - } - } - }); - } - - function loc(href) { - var url = document.createElement('a'); - url.href = href; - return url; - } - - function layerHref(href) { - var url = document.createElement('a'); - url.href = href; - var search = url.search; - if (search.substr(0, 1) == '?') { - search = search.substr(1); - } - var params = search.split('&'); - for (var i = 0; i < params.length; i++) { - var kv = params[i].split('='); - if (kv[0] == 'l') { - return decodeURIComponent(kv[1] || ''); - } - } - return null; - } - - function layerOpenHref(href, l) { - var url = document.createElement('a'); - url.href = href; - url.search = url.search.replace(/&l=[^&]*/g, '', url.search); - url.search = url.search.replace(/(\?)l=[^&]*&|\?l=[^&]*$/g, '$1', url.search); - url.search += (url.search ? '&' : '?') + 'l=' + encodeURIComponent(l); - return url.href; - } - - function layerCloseLoc(href) { - var url = document.createElement('a'); - url.href = href; - url.search = url.search.replace(/&l=[^&]*/g, '', url.search); - url.search = url.search.replace(/(\?)l=[^&]*&|\?l=[^&]*$/g, '$1', url.search); - return url; - } - - function layerUrlToShort(href) { - var url = document.createElement('a'); - url.href = href; - var match = url.search.match(/(\?|&)l=([^&]*)/); - if (match) { - return '/' + decodeURIComponent(match[2]); - } - return null; - } - - function layerUrlToNav(href, cur_loc) { - if (layerUrlToShort(href)) { - return href; - } - var url = document.createElement('a'); - url.href = href; - var layer_url = url.pathname.replace(/^\/+|\/+$/g, ''); - return layerOpenHref(cur_loc || '/', layer_url); - } - - function changeLocation(url, push_state) { - if (push_state) { - location.href = url; - } else { - location.replace(url); - } - } - - function scrollToEl(elem) { - $(window).scrollTop($(elem).offset().top); - } - - function scrollToHash(hash) { - hash = hash || curLocation.hash; - if (hash[0] == '#') hash = hash.substr(1); - if (!hash) return; - var elem = document.getElementById(hash); - if (elem) { - return scrollToEl(elem); - } - elem = $('a[name]').filter(function() { - return $(this).attr('name') == hash; - }).eq(0); - if (elem.length) { - scrollToEl(elem); - } - } - - function onLoad(func) { - console.log('added to onLoad'); - curOnLoad.push(func); - } - - function onUnload(func) { - console.log('added to onUnload'); - curOnUnload.push(func); - } - - function onLayerLoad(func) { - console.log('added to onLayerLoad'); - curOnLayerLoad.push(func); - } - - function onLayerUnload(func) { - console.log('added to onLayerUnload'); - curOnLayerUnload.push(func); - } - - function onBeforeUnload(func) { - curBeforeUnload = func; - } - - function onBeforeLayerUnload(func) { - curBeforeLayerUnload = func; - } - - function pageLoaded() { - curBeforeUnload = false; - if (curOnLoad.length) { - for (var i = 0; i < curOnLoad.length; i++) { - console.log('onLoad', i); - curOnLoad[i](Aj.state); - } - } - onUnload(function() { - $(ajContainer).off('.curPage'); - $(document).off('.curPage'); - }); - if (Aj.layer) { - layerLoaded(); - } - } - - function layerLoaded() { - curBeforeLayerUnload = false; - if (curOnLayerLoad.length) { - for (var i = 0; i < curOnLayerLoad.length; i++) { - console.log('onLayerLoad', i); - curOnLayerLoad[i](Aj.layerState); - } - } - onLayerUnload(function() { - Aj.layer.off('.curLayer'); - }); - Aj.layer.one('popup:close', function() { - if (curOnLayerUnload.length) { - for (var i = 0; i < curOnLayerUnload.length; i++) { - console.log('onLayerUnload', i); - curOnLayerUnload[i](Aj.layerState); - } - } - Aj.layer.remove(); - if (underLayerTitle) { - document.title = underLayerTitle; - } - if (layerCloseLocation) { - setLocation(layerCloseLocation.href); - layerCloseLocation = false; - } - Aj.layer = false; - Aj.layerState = {}; - curOnLayerLoad = []; - curOnLayerUnload = []; - }); - Aj.layer.on('click.curLayer', 'a[data-layer-close]', function(e) { - e.preventDefault(); - e.stopImmediatePropagation(); - closePopup(Aj.layer); - }); - openPopup(Aj.layer, { - closeByClickOutside: '.popup-no-close', - onBeforeClose: function($popup) { - var unloaded = checkBeforeUnload(function() { - var options = $popup.data('options'); - options.onBeforeClose = null; - closePopup($popup); - }); - return unloaded; - } - }); - } - - function onResult(url, http_code, result, push_state) { - hideProgress(); - if (http_code != 200 || !result || !result.v || result.v != Aj.version) { - changeLocation(url, push_state); - return; - } - var url_hash = loc(url).hash; - if (result.r) { - var redirect_url = result.r; - if (url_hash) { - redirect_url = redirect_url.split('#')[0] + url_hash; - } - if (result.hr || !loadPage(loc(redirect_url), push_state)) { - changeLocation(redirect_url, push_state); - } - return; - } - var saved_ult = underLayerTitle; - var saved_lcl = (!Aj.layer || !push_state) ? layerCloseLocation : false; - underLayerTitle = false; - layerCloseLocation = false; - closeAllPopups(); - underLayerTitle = saved_ult; - layerCloseLocation = saved_lcl; - - if (result.h) { - if (curOnUnload.length) { - for (var i = 0; i < curOnUnload.length; i++) { - console.log('onUnload', i); - curOnUnload[i](Aj.state); - } - } - if (push_state) { - if (result.l) { - url = layerUrlToNav(url); - } - setLocation(url); - } - Aj.state = {}; - curOnLoad = []; - curOnUnload = []; - if (result.t) { - document.title = result.t; - underLayerTitle = document.title; - } - if (result.h) { - ajContainer.html(result.h); - } - if (result.s) { - $.extend(Aj.state, result.s); - } - if (result._dlog) { - $('#dlog').html(result._dlog); - } - if (push_state || !Aj._useScrollHack) { - $(window).scrollTop(0); - } - $('body').css({height: '', overflow: ''}); - if (url_hash) { - scrollToHash(); - } - if (result.l) { - Aj.layer = $(''); - Aj.layerState = {}; - curOnLayerLoad = []; - curOnLayerUnload = []; - if (result.lt) { - document.title = result.lt; - } - if (result.ls) { - $.extend(Aj.layerState, result.ls); - } - Aj.layer.html(result.l).appendTo(document.body); - } - if (result.j) { - window.execScript ? window.execScript(result.j) : eval(result.j); - } - pageLoaded(); - return; - } else if (result.l) { - if (push_state) { - url = layerUrlToNav(url); - setLocation(url); - } - if (result.s) { - $.extend(Aj.state, result.s); - } - if (result._dlog) { - $('#dlog').html(result._dlog); - } - Aj.layer = $(''); - Aj.layerState = {}; - curOnLayerLoad = []; - curOnLayerUnload = []; - if (result.lt) { - document.title = result.lt; - } - if (result.ls) { - $.extend(Aj.layerState, result.ls); - } - Aj.layer.html(result.l).appendTo(document.body); - if (result.j) { - window.execScript ? window.execScript(result.j) : eval(result.j); - } - Aj.layerLoaded(); - return; - } - return changeLocation(url, push_state); - } - - function loadPage(link, push_state, state_go) { - var url = link.href; - var cur_url = curLocation.href; - if (link.origin != curLocation.origin) { - return false; - } - if (link.pathname == curLocation.pathname && - link.search == curLocation.search && - link.hash != curLocation.hash) { - return false; - } - var load_fn, interrupted = false; - load_fn = function() { - if (!push_state) { - if (interrupted) { - historyJump(state_go); - } - curLocation = loc(url); - layerCloseLocation = layerCloseLoc(url); - } - if (interrupted && Aj.layer) { - var options = Aj.layer.data('options'); - options.onBeforeClose = null; - } - showProgress(); - $.ajax(url, { - dataType: 'json', - xhrFields: {withCredentials: true}, - headers: {'X-Aj-Referer': cur_url}, - success: function(result, t, xhr) { - onResult(url, xhr.status, result, push_state); - }, - error: function(xhr) { - onResult(url, xhr.status, false, push_state); - } - }); - }; - interrupted = !checkBeforeUnload(load_fn); - if (interrupted && !push_state) { - historyJump(-state_go); - } - return true; - } - - function _location(href) { - if (typeof href !== 'undefined') { - loadPage(loc(href), true); - } else { - return loc(curLocation.href); - } - } - - function layerLocation(layer_url) { - if (typeof layer_url !== 'undefined') { - var layer_href = layerOpenHref(curLocation, layer_url); - loadPage(loc(layer_href), true); - } else { - return layerHref(curLocation.href); - } - } - - function setLocation(href) { - var url = loc(href).href; - var short_url = layerUrlToShort(url) || url; - history.pushState({i: curHistoryState.i + 1, u: url}, null, short_url); - console.log('history push', 'oldState =', curHistoryState, 'newState =', history.state); - curHistoryState = history.state; - curLocation = loc(curHistoryState.u); - layerCloseLocation = layerCloseLoc(curHistoryState.u); - } - - function setLayerLocation(layer_url) { - layer_url = layer_url.toString().replace(/^\/+|\/+$/g, ''); - var layer_href = layerOpenHref(curLocation, layer_url); - var url = loc(layer_href).href; - var short_url = layerUrlToShort(url) || url; - history.pushState({i: curHistoryState.i + 1, u: url}, null, short_url); - console.log('history push', 'oldState =', curHistoryState, 'newState =', history.state); - curHistoryState = history.state; - curLocation = loc(curHistoryState.u); - } - - function historyJump(delta) { - if (delta) { - skipPopState = true; - history.go(delta); - } - } - - function needAuth() { - if (Aj.unauth) { - openPopup('#login-popup-container'); - return true; - } - return false; - } - - function linkHandler(e) { - if (e.metaKey || e.ctrlKey) return true; - var href = this.href; - if (this.hasAttribute('data-unsafe') && - href != $(this).text()) { - var $confirm = showConfirm(l('WEB_OPEN_LINK_CONFIRM', {url: cleanHTML(href)}, 'Do you want to open {url}?'), null, l('WEB_OPEN_LINK', 'Open')); - $('.popup-primary-btn', $confirm).attr({ - href: href, - target: $(this).attr('target'), - rel: $(this).attr('rel') - }); - return false; - } - if ($(this).attr('target') == '_blank') return true; - if (this.hasAttribute('data-layer')) { - href = layerUrlToNav(href, curLocation); - } - if ($(this).hasClass('need-auth') && needAuth() || - loadPage(loc(href), true)) { - e.preventDefault(); - } - } - - function beforeUnloadHandler(e) { - var message = null; - if (Aj.layer && curBeforeLayerUnload) { - message = curBeforeLayerUnload(); - } - if (!message && curBeforeUnload) { - message = curBeforeUnload(); - } - if (message) { - if (typeof e === 'undefined') e = window.e; - if (e) e.returnValue = message; - return message; - } - } - function checkBeforeUnload(load_fn) { - var message = null; - if (Aj.layer && curBeforeLayerUnload) { - message = curBeforeLayerUnload(); - } - if (!message && curBeforeUnload) { - message = curBeforeUnload(); - } - if (message) { - var message_html = $('
').text(message).html(); - showConfirm(message_html, load_fn, l('WEB_LEAVE_PAGE', 'Leave')); - return false; - } else { - load_fn(); - return true; - } - } - - $(document).on('click', 'a[href]', linkHandler); - $(document.body).removeClass('no-transition'); - - $(window).on('popstate', function(e) { - var popstate = e.originalEvent.state; - var state_go = popstate ? (popstate.i - curHistoryState.i) : 0; - if (!popstate) { - popstate = {i: 0, u: location.href}; - } else if (!popstate.u) { - popstate.u = location.href; - } - console.log('history popstate', 'oldState =', curHistoryState, 'newState =', popstate, 'go(' + state_go + ')'); - curHistoryState = popstate; - if (skipPopState) { - skipPopState = false; - return; - } - if (Aj._useScrollHack) { - $('body').css({height: '100000px', overflow: 'hidden'}); // for correct scroll restoration - } - var link = loc(curHistoryState.u); - loadPage(link, false, state_go); - }); - window.onbeforeunload = beforeUnloadHandler; -} - -function updateNavBar() { - var $nav_menu = $('.nav-menu'); - $nav_menu.addClass('nav-menu-can-fix'); - if ($nav_menu.css('position') == 'fixed') { - $nav_menu.width($nav_menu.parent().width()); - } else { - $nav_menu.css('width', 'auto'); - } -} - -function getBR() { - if (window._brHTML) return window._brHTML; - return window._brHTML = $('

').html(); -} - -function cleanHTML(value) { - return value.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/\n/g, getBR()); -} - -function cleanRE(value) { - return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); -} - -var Keys = { - BACKSPACE: 8, - ESC: 27, - TAB: 9, - RETURN: 13, - LEFT: 37, - UP: 38, - RIGHT: 39, - DOWN: 40, - on: function(key, callback) { - return function(e){ if(e.which == key) callback.apply(this, Array.prototype.slice.apply(arguments)); }; - } -}; - -var Popups = []; - -function openPopup(popup, options) { - if (!popup) return false; - options = options || {}; - var $popup = $(popup); - var popup_id = $popup.data('puid'); - if (!popup_id) { - if (!Popups._pid) Popups._pid = 0; - popup_id = ++Popups._pid; - $popup.data('puid', popup_id); - } - $popup.data('options', options); - var i = Popups.indexOf(popup_id); - if (i >= 0) { - Popups.splice(i, 1); - } - Popups.push(popup_id); - $('body').css('overflow', 'hidden'); - $popup.appendTo(window.Aj && Aj.ajContainer || 'body'); - $popup.removeClass('hide'); - if (document.activeElement) { - document.activeElement.blur(); - } - if (options.closeByClickOutside) { - $popup.on('click', function(e) { - if ($(e.target).closest('body').length && - !$(e.target).closest(options.closeByClickOutside).length) { - closePopup($popup); - } - }); - } - $('.popup-cancel-btn', $popup).on('click', function(e) { - closePopup($popup); - }); - $popup.trigger('popup:open'); -} - -function getPopupById(popup_id) { - var $popups = $('.popup-container'); - var found = false; - for (var i = 0; i < $popups.length; i++) { - $popup = $popups.eq(i); - if (popup_id == $popup.data('puid')) { - return $popup; - } - } - return false; -} - -function closePopup(popup) { - if (!Popups.length) return false; - var $popup, popup_id; - if (popup) { - $popup = $(popup); - popup_id = $popup.data('puid'); - } else { - popup_id = Popups[Popups.length - 1]; - $popup = getPopupById(popup_id); - if (!$popup) { - return false; - } - } - var options = $popup.data('options'); - if (options.onBeforeClose) { - var result = options.onBeforeClose($popup); - if (result === false) { - return false; - } - } - var i = Popups.indexOf(popup_id); - if (i >= 0) { - Popups.splice(i, 1); - } - if (!Popups.length) { - $('body').css('overflow', ''); - } - if (options.closeByClickOutside) { - $popup.off('click'); - } - $('.popup-cancel-btn', $popup).off('click'); - $popup.addClass('hide'); - $popup.trigger('popup:close'); -} - -function closeAllPopups() { - for (var i = Popups.length - 1; i >= 0; i--) { - var $popup = getPopupById(Popups[i]); - if ($popup) { - closePopup($popup); - } - } -} - -function showAlert(html, options) { - options = options || {}; - var $alert = $('
'); - var onEnterPress = function(e) { - if (e.keyCode == Keys.RETURN) { - e.stopImmediatePropagation(); - closePopup($alert); - } - }; - $('.popup-text', $alert).html(html); - $(document).on('keydown', onEnterPress); - $alert.one('popup:close', function() { - $(document).off('keydown', onEnterPress); - $alert.remove(); - }); - openPopup($alert); - return $alert; -} - -function showConfirm(html, onConfirm, confirm_btn, onCancel, cancel_btn) { - var $confirm = $(''); - var confirm = function() { - onConfirm && onConfirm($confirm); - closePopup($confirm); - } - var onEnterPress = function(e) { - if (e.keyCode == Keys.RETURN) { - e.stopImmediatePropagation(); - confirm(); - } - }; - $('.popup-text', $confirm).html(html); - var $primaryBtn = $('.popup-primary-btn', $confirm); - $primaryBtn.on('click', confirm); - if (onCancel) { - var cancel = function(){ onCancel($confirm); }; - var $cancelBtn = $('.popup-cancel-btn', $confirm); - $cancelBtn.on('click', cancel); - } - $(document).on('keydown', onEnterPress); - $confirm.one('popup:close', function() { - $primaryBtn.off('click', confirm); - if (onCancel) { - $cancelBtn.off('click', cancel); - } - $(document).off('keydown', onEnterPress); - $confirm.remove(); - }); - openPopup($confirm); - return $confirm; -} - -function showMedia(src, is_video, options) { - var media_html = is_video ? '' : '
'; - var $popup = $(''); - var media = { - $wrap: $('.media-popup-wrap', $popup), - $cover: $('.media-popup-cover', $popup), - $pwrap: $('.circle-progress-wrap', $popup), - $media: $('.media', $popup), - width: null, - height: null, - cover: null, - timeout: null, - checkMediaSize: function() { - if (is_video) { - var video = media.mediaEl; - if (video.videoWidth && video.videoHeight) { - media.width = video.videoWidth; - media.height = video.videoHeight; - media.$media.removeClass('ohide'); - media.$wrap.removeClass('file-loading').addClass('file-loaded'); - media.onResize(); - return; - } - } else { - var img = media.mediaEl; - if (img.naturalWidth && img.naturalHeight) { - media.width = img.naturalWidth; - media.height = img.naturalHeight; - media.onResize(); - return; - } - } - media.timeout = setTimeout(media.checkMediaSize, 50); - }, - onResize: function() { - if (!media.width || !media.height) { - return; - } - var w = media.width, h = media.height; - var de = document.documentElement; - var vw = de.clientWidth, vh = de.clientHeight; - vw -= parseInt($popup.css('paddingLeft') || 0) - + parseInt($popup.css('paddingRight') || 0) - + parseInt(media.$wrap.css('paddingRight') || 0); - vh -= parseInt($popup.css('paddingTop') || 0) - + parseInt($popup.css('paddingBottom') || 0) - + parseInt(media.$wrap.css('paddingBottom') || 0); - var min_vw = Math.max(320, vw); - var min_vh = Math.max(320, vh); - var sw = w / min_vw; - var sh = h / min_vh; - var s = Math.max(sw, sh); - var iw = w / s, ih = h / s; - if (!is_video) { - var can_zoom = (s > 1); - if (!can_zoom || $popup.hasClass('fullsize')) { - var iw = w, ih = h; - } - $popup.toggleClass('can-zoom', can_zoom); - } - var scroll_x = iw > vw; - var scroll_y = ih > vh; - $popup.toggleClass('scroll-x', scroll_x); - $popup.toggleClass('scroll-y', scroll_y); - media.$media.width(iw); - media.$media.height(ih); - }, - onLoad: function() { - if (!is_video) { - media.$media.css('background-image', "url('" + media.mediaEl.src + "')"); - media.$media.removeClass('ohide'); - media.$wrap.removeClass('ohide').removeClass('file-loading').addClass('file-loaded'); - media.onResize(); - } - }, - onZoomInOut: function(e) { - if (!is_video) { - var photo = media.$media.get(0); - var dx, dy, px, py, sx, sy, rect; - rect = photo.getBoundingClientRect(); - dx = e.clientX - rect.left; - dy = e.clientY - rect.top; - px = dx / rect.width; - py = dy / rect.height; - $popup.toggleClass('fullsize'); - media.onResize(); - rect = photo.getBoundingClientRect(); - dx = px * rect.width; - dy = py * rect.height; - sx = e.clientX - dx - rect.left - $popup.scrollLeft(); - sy = e.clientY - dy - rect.top - $popup.scrollTop(); - $popup.scrollLeft(-sx); - $popup.scrollTop(-sy); - } - } - }; - if (is_video) { - media.mediaEl = media.$media.get(0); - } else { - media.mediaEl = new Image(); - media.mediaEl.onload = media.onLoad; - media.$wrap.on('click', media.onZoomInOut); - } - $(window).on('resize', media.onResize); - media.checkMediaSize(); - $popup.one('popup:close', function() { - if (!is_video) { - media.$media.off('click', media.onZoomInOut); - } - $(window).off('resize', media.onResize); - clearTimeout(media.timeout); - $popup.remove(); - }); - openPopup($popup, { - closeByClickOutside: '.popup-no-close', - }); - if (options.width && options.height && options.cover) { - media.width = parseInt(options.width); - media.height = parseInt(options.height); - media.cover = options.cover; - media.$cover.css('background-image', "url('" + media.cover + "')").removeClass('ohide'); - media.onResize(); - } - setTimeout(function() { - media.$pwrap.get(0).classList.remove('ohide'); - }, 250); - media.mediaEl.src = src; - return $popup; -} - -function showPhoto(image_src, options) { - showMedia(image_src, false, options); -} - -function showVideo(video_src, options) { - showMedia(video_src, true, options); -} - -function showToast(html, delay) { - var $toast = $('
'); - $('.toast', $toast).html(html); - var to, close = function() { - clearTimeout(to); - $toast.fadeHide(); - setTimeout(function() { $toast.remove(); }, 200); - }; - $toast.appendTo('body').redraw().fadeShow(); - $(document).one('mousedown touchstart', close); - to = setTimeout(close, delay || 2000); -} - -function l(lang_key, params, def_value) { - if (typeof params === 'string') { - def_value = params; - params = {}; - } - params = params || {}; - var value = l._keys[lang_key] || def_value || lang_key; - value = value.replace(/\{\{([A-Za-z_\-\d]{1,32}):(.+?)\}\}/g, function(lang_value, token, options) { - var number = +params[token] || 0; - var numeric_options = options.split('|'); - var i; - if (number == 1) i = 0; - else i = 1; - if (typeof numeric_options[i] === 'undefined') { - i = 1; - } - var numeric_option = numeric_options[i] || '#'; - return numeric_option.replace(/#/g, number); - }); - value = value.replace(/\{([A-Za-z_\-\d]{1,32}):(.{1,256}?)\}/g, function(lang_value, token, options) { - var number = +params[token] || 0; - var numeric_options = options.split('|'); - var i; - if (!number) i = 0; - else if (number == 1) i = 1; - else i = 2; - if (typeof numeric_options[i] === 'undefined') { - i = 0; - } - var numeric_option = numeric_options[i] || '#'; - return numeric_option.replace(/#/g, number); - }); - for (var param in params) { - value = value.split('{' + param + '}').join(params[param]); - } - return value; -} -l._keys = {}; -l.add = function(lang_values) { - for (var lang_key in lang_values) { - l._keys[lang_key] = lang_values[lang_key]; - } -} - -function redraw(el) { - el.offsetTop + 1; -} - -$(document).on('keydown', function(e) { - if (e.keyCode == Keys.ESC && Popups.length > 0) { - var last_popup_id = Popups[Popups.length - 1]; - var $popup = getPopupById(last_popup_id); - if ($popup && !$popup.hasClass('popup-ignore-esc')) { - e.stopImmediatePropagation(); - e.preventDefault(); - closePopup($popup); - } - } -}); - -$(document).on('keydown', 'textarea', function(e) { - if (e.keyCode == Keys.RETURN && (e.metaKey || e.ctrlKey)) { - $(this.form).submit(); - } -}); - -(function($) { - function onTextRippleStart(evt) { - var e = evt.originalEvent; - if (document.activeElement === this) return; - var rect = this.getBoundingClientRect(); - if (e.type == 'touchstart') { - var clientX = e.targetTouches[0].clientX; - } else { - var clientX = e.clientX; - } - var ripple = this.parentNode.querySelector('.textfield-item-underline'); - var rippleX = (clientX - rect.left) / this.offsetWidth * 100; - ripple.style.transition = 'none'; - redraw(ripple); - ripple.style.left = rippleX + '%'; - ripple.style.right = (100 - rippleX) + '%'; - redraw(ripple); - ripple.style.left = ''; - ripple.style.right = ''; - ripple.style.transition = ''; - } - function onRippleStart(evt) { - var e = evt.originalEvent; - var rippleMask = this.querySelector('.ripple-mask'); - if (!rippleMask) return; - var rect = rippleMask.getBoundingClientRect(); - if (e.type == 'touchstart') { - var clientX = e.targetTouches[0].clientX; - var clientY = e.targetTouches[0].clientY; - } else { - var clientX = e.clientX; - var clientY = e.clientY; - } - var rippleX = (clientX - rect.left) - rippleMask.offsetWidth / 2; - var rippleY = (clientY - rect.top) - rippleMask.offsetHeight / 2; - var ripple = this.querySelector('.ripple'); - ripple.style.transition = 'none'; - redraw(ripple); - ripple.style.transform = 'translate3d(' + rippleX + 'px, ' + rippleY + 'px, 0) scale3d(0.2, 0.2, 1)'; - ripple.style.opacity = 1; - redraw(ripple); - ripple.style.transform = 'translate3d(' + rippleX + 'px, ' + rippleY + 'px, 0) scale3d(1, 1, 1)'; - ripple.style.transition = ''; - - function onRippleEnd(e) { - ripple.style.transitionDuration = '.2s'; - ripple.style.opacity = 0; - document.removeEventListener('mouseup', onRippleEnd); - document.removeEventListener('touchend', onRippleEnd); - document.removeEventListener('touchcancel', onRippleEnd); - } - document.addEventListener('mouseup', onRippleEnd); - document.addEventListener('touchend', onRippleEnd); - document.addEventListener('touchcancel', onRippleEnd); - } - $.fn.initRipple = function() { - return this.map(function(){ - $(this).off('.ripple'); - $(this).on('mousedown.ripple touchstart.ripple', '.textfield-item input.form-control', onTextRippleStart); - $(this).on('mousedown.ripple touchstart.ripple', '.ripple-handler', onRippleStart); - return this; - }); - }; - $.fn.destroyRipple = function() { - return this.map(function(){ - $(this).off('.ripple'); - return this; - }); - }; -})(jQuery); -$(document).initRipple(); - -Function.prototype.pbind = function() { - var func = this, args = Array.prototype.slice.apply(arguments); - return function() { - return func.apply(this, args.concat(Array.prototype.slice.apply(arguments))); - } -}